summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorSachin Nikam <snikam@nvidia.com>2012-06-01 15:45:04 +0530
committerVarun Colbert <vcolbert@nvidia.com>2012-06-04 17:30:58 -0700
commit02487bb96c7a6d608058c2a1095e1d501f193419 (patch)
treec69bfe0d197296cb8cf6af93eab4ea08deef073c /drivers/input
parent7af2c7ce772882f6e85e2a357711bf822f066bfa (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 9c9b60d69619..2e96808284cc 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.
@@ -36,11 +38,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);
@@ -460,6 +462,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)); */
@@ -481,6 +484,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));