From: linjh Date: Wed, 20 Apr 2011 09:14:19 +0000 (+0800) Subject: modify suspend of gps and default close gyroscope X-Git-Tag: firefly_0821_release~10439^2~2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f07e8d9799fb413e856d32c489b7a504eee117cb;p=firefly-linux-kernel-4.4.55.git modify suspend of gps and default close gyroscope --- diff --git a/drivers/input/gsensor/Kconfig b/drivers/input/gsensor/Kconfig index 31b87eb67403..687fcec87527 100644 --- a/drivers/input/gsensor/Kconfig +++ b/drivers/input/gsensor/Kconfig @@ -30,7 +30,7 @@ config GS_MMA8452 config GS_L3G4200D bool "gs_l3g4200d" depends on G_SENSOR_DEVICE - default y + default n help To have support for your specific gsesnor you will have to select the proper drivers which depend on this option. diff --git a/drivers/misc/gps/rk29_gps.c b/drivers/misc/gps/rk29_gps.c index f36b9cc43e02..09eedb74eb12 100644 --- a/drivers/misc/gps/rk29_gps.c +++ b/drivers/misc/gps/rk29_gps.c @@ -108,17 +108,19 @@ int rk29_gps_suspend(struct platform_device *pdev, pm_message_t state) { struct rk29_gps_data *pdata = pdev->dev.platform_data; - if(!pdata) + if(!pdata) { + printk("%s: pdata = NULL ...... \n", __func__); return -1; + } if(pdata->power_flag == 1) { - pdata->suspend = 1; - queue_work(pdata->wq, &pdata->work); + rk29_gps_uart_to_gpio(pdata->uart_id); + pdata->power_down(); + pdata->reset(GPIO_LOW); } printk("%s\n",__FUNCTION__); - return 0; } @@ -126,48 +128,39 @@ int rk29_gps_resume(struct platform_device *pdev) { struct rk29_gps_data *pdata = pdev->dev.platform_data; - if(!pdata) + if(!pdata) { + printk("%s: pdata = NULL ...... \n", __func__); return -1; + } if(pdata->power_flag == 1) { - pdata->suspend = 0; queue_work(pdata->wq, &pdata->work); } printk("%s\n",__FUNCTION__); - return 0; } static void rk29_gps_delay_power_downup(struct work_struct *work) { - //int ret; struct rk29_gps_data *pdata = container_of(work, struct rk29_gps_data, work); if (pdata == NULL) { printk("%s: pdata = NULL\n", __func__); return; } + DBG("%s: suspend=%d\n", __func__, pdata->suspend); + down(&pdata->power_sem); - //if (ret < 0) { - // printk("%s: down power_sem error ret = %d\n", __func__, ret); - // return ; - //} - if (pdata->suspend) { - rk29_gps_uart_to_gpio(pdata->uart_id); - pdata->power_down(); - pdata->reset(GPIO_LOW); - } - else { - pdata->reset(GPIO_LOW); - mdelay(10); - pdata->power_up(); - mdelay(500); - pdata->reset(GPIO_HIGH); - rk29_gps_gpio_to_uart(pdata->uart_id); - } + pdata->reset(GPIO_LOW); + mdelay(5); + pdata->power_up(); + msleep(500); + pdata->reset(GPIO_HIGH); + rk29_gps_gpio_to_uart(pdata->uart_id); + up(&pdata->power_sem); } @@ -182,8 +175,11 @@ ssize_t rk29_gps_read(struct file *filp, char __user *ptr, size_t size, loff_t * { if (ptr == NULL) printk("%s: user space address is NULL\n", __func__); - if (pgps == NULL) + + if (pgps == NULL) { printk("%s: pgps addr is NULL\n", __func__); + return -1; + } put_user(pgps->uart_id, ptr); @@ -206,9 +202,9 @@ int rk29_gps_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, uns switch (cmd){ case ENABLE: pdata->reset(GPIO_LOW); - mdelay(10); + mdelay(5); pdata->power_up(); - mdelay(10); + mdelay(5); rk29_gps_gpio_to_uart(pdata->uart_id); mdelay(500); pdata->reset(GPIO_HIGH); @@ -237,7 +233,7 @@ int rk29_gps_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, uns int rk29_gps_release(struct inode *inode, struct file *filp) { - DBG("rk29_gps_release\n"); + DBG("rk29_gps_release\n"); return 0; } @@ -274,7 +270,6 @@ static int rk29_gps_probe(struct platform_device *pdev) pdata->wq = create_freezeable_workqueue("rk29_gps"); INIT_WORK(&pdata->work, rk29_gps_delay_power_downup); pdata->power_flag = 0; - pdata->suspend = 0; pgps = pdata; diff --git a/drivers/misc/gps/rk29_gps.h b/drivers/misc/gps/rk29_gps.h index 75ce567a35b8..2599b7e4c4b2 100644 --- a/drivers/misc/gps/rk29_gps.h +++ b/drivers/misc/gps/rk29_gps.h @@ -11,7 +11,6 @@ struct rk29_gps_data { int (*reset)(int); int uart_id; int power_flag; - int suspend; struct semaphore power_sem; struct workqueue_struct *wq; struct work_struct work;