RKMobileSDK:add reset ioctl for 23d
authorphc <phc@rk29>
Mon, 25 Apr 2011 09:19:26 +0000 (17:19 +0800)
committerphc <phc@rk29>
Mon, 25 Apr 2011 09:19:26 +0000 (17:19 +0800)
drivers/misc/mtk23d.c
include/linux/mtk23d.h [changed mode: 0644->0755]

index 2faa0ab859a7fcbdaf951d2b46b3eeb1f02bf316..aa54011023e21ac27a83692f76395a5abe3082f0 100755 (executable)
@@ -160,7 +160,21 @@ static int mtk23d_release(struct inode *inode, struct file *file)
 
 static int mtk23d_ioctl(struct inode *inode,struct file *file, unsigned int cmd, unsigned long arg)
 {
-       MODEMDBG("mtk23d_ioctl\n");
+       struct rk2818_23d_data *pdata = gpdata;
+       
+       MODEMDBG("mtk23d_ioctl, cmd = %d\n", cmd);
+       
+       if(cmd == MODEM_RESET)
+       {
+               gpio_direction_output(pdata->bp_reset, pdata->bp_reset_active_low? GPIO_LOW:GPIO_HIGH);
+               mdelay(100);
+               gpio_set_value(pdata->bp_reset, pdata->bp_reset_active_low? GPIO_HIGH:GPIO_LOW);
+               mdelay(10);
+               gpio_direction_output(pdata->bp_power, pdata->bp_power_active_low? GPIO_LOW:GPIO_HIGH);
+               mdelay(2000);
+               gpio_set_value(pdata->bp_power, pdata->bp_power_active_low? GPIO_HIGH:GPIO_LOW);
+       }
+       
        return 0;
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index 6be28a6..144c15f
@@ -1,6 +1,10 @@
 #include <linux/types.h>
 #include <linux/ioctl.h>
 #include <linux/miscdevice.h>
+                             
+#define MODEM_POWER_START 0x3
+#define MODEM_POWER_END  0x2
+#define MODEM_RESET      0x1
 
 struct modem_dev
 {