summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorSachin Nikam <snikam@nvidia.com>2012-06-01 15:45:04 +0530
committerVarun Wadekar <vwadekar@nvidia.com>2012-07-12 10:12:03 +0530
commitefaffec30c7ba3a48d0e32037b9455e4d986227c (patch)
tree058aa63697c77b549cf46df16862fbb5346f1db9 /drivers/input
parent558446e672c02ac9a1f103ffbca41d7ea4f7f69d (diff)
lightsensor: cm3217: increasing polling_dealy for als
- Increasing default polling_delay from 500mS to 1000mS to reduce unnecessary cpu hogging - Supporting LIGHTSENSOR_IOCTL_SET_DELAY to have facility to set delay from sensor HAL - Less prints spew on console by changing pr_info -> pr_debug Bug 993924 Change-Id: Iac0770553a1d426e4953aa4c8ff976b6cdc8fd81 Signed-off-by: Sachin Nikam <snikam@nvidia.com> Reviewed-on: http://git-master/r/105898 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/misc/cm3217.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/input/misc/cm3217.c b/drivers/input/misc/cm3217.c
index 2fb6eb7b3029..a9d93429882f 100644
--- a/drivers/input/misc/cm3217.c
+++ b/drivers/input/misc/cm3217.c
@@ -3,6 +3,8 @@
* Copyright (C) 2011 Capella Microsystems Inc.
* Author: Frank Hsieh <pengyueh@gmail.com>
*
+ * Copyright (c) 2012, NVIDIA Corporation.
+ *
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
@@ -38,11 +40,11 @@
#include <asm/mach-types.h>
#include <asm/setup.h>
-#define D(x...) pr_info(x)
+#define D(x...) pr_debug(x)
#define I2C_RETRY_COUNT 10
-#define LS_POLLING_DELAY 500
+#define LS_POLLING_DELAY 1000 /* mSec */
static void report_do_work(struct work_struct *w);
static DECLARE_DELAYED_WORK(report_work, report_do_work);
@@ -464,6 +466,7 @@ static long lightsensor_ioctl(struct file *file, unsigned int cmd,
{
int rc, val;
struct cm3217_info *lpi = lp_info;
+ unsigned long delay;
/* D("[CM3217] %s cmd %d\n", __func__, _IOC_NR(cmd)); */
@@ -485,6 +488,17 @@ static long lightsensor_ioctl(struct file *file, unsigned int cmd,
rc = put_user(val, (unsigned long __user *)arg);
break;
+ case LIGHTSENSOR_IOCTL_SET_DELAY:
+ if (get_user(delay, (unsigned long __user *)arg)) {
+ rc = -EFAULT;
+ break;
+ }
+ D("[LS][CM3217] %s LIGHTSENSOR_IOCTL_SET_DELAY, delay %ld\n",
+ __func__, delay);
+ delay = delay / 1000;
+ lpi->polling_delay = msecs_to_jiffies(delay);
+ break;
+
default:
pr_err("[LS][CM3217 error]%s: invalid cmd %d\n",
__func__, _IOC_NR(cmd));