summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorsteven <skao@nvidia.com>2014-04-14 17:02:22 +0800
committerRiham Haidar <rhaidar@nvidia.com>2014-05-27 18:45:53 -0700
commitf79ae4b3c61c55df53e015e256c2c01b7c6e54b3 (patch)
treec78b90782e7f2cc830ac295a94c29bfbaaf03808 /drivers/staging
parentbf107f4559d461bcb6840dff65a914826197d469 (diff)
staging: iio: cm3217: add optional value in DT.
Add below optional value can be overrid by DT for project. If no add in DT will load default value. 1)integration-time. Default:"480000" 2)max-range. Default:"78643.2" 3)resolution. Default:"307" 4)power-consumed. Default:"1670" Bug 1496947 Change-Id: I8718bf5636042bc801574c8e4177a12e5a948540 Signed-off-by: steven <skao@nvidia.com> Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com> Reviewed-on: http://git-master/r/395755 Reviewed-on: http://git-master/r/411415 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com> Reviewed-by: Mitch Luban <mluban@nvidia.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/iio/light/Kconfig5
-rw-r--r--drivers/staging/iio/light/cm3217.c14
2 files changed, 18 insertions, 1 deletions
diff --git a/drivers/staging/iio/light/Kconfig b/drivers/staging/iio/light/Kconfig
index 49d0b146450e..3630c68dee51 100644
--- a/drivers/staging/iio/light/Kconfig
+++ b/drivers/staging/iio/light/Kconfig
@@ -98,9 +98,14 @@ config SENSORS_TCS3772
config SENSORS_CM3217
tristate "CM3217 Ambient light sensor"
depends on I2C
+ select LS_OF
+ select LS_SYSFS
default n
help
Say Y here to enable the CM3217 Ambient Light Sensor.
+ This driver will provide the measurements of ambient light intensity
+ in its own units.
+ Data from sensor is accessible via sysfs.
config LS_OF
tristate "Device Tree parsing for Light sensor specification details"
diff --git a/drivers/staging/iio/light/cm3217.c b/drivers/staging/iio/light/cm3217.c
index e5cc8e7f7223..a955bb255d7e 100644
--- a/drivers/staging/iio/light/cm3217.c
+++ b/drivers/staging/iio/light/cm3217.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
+/* Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -19,6 +19,8 @@
#include <linux/regulator/consumer.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
+#include <linux/iio/light/ls_sysfs.h>
+#include <linux/iio/light/ls_dt.h>
/* IT = Integration Time. The amount of time the photons hit the sensor.
* STEP = the value from HW which is the photon count during IT.
@@ -445,6 +447,7 @@ static int cm3217_probe(struct i2c_client *client,
{
struct cm3217_inf *inf;
struct iio_dev *indio_dev;
+ struct lightsensor_spec *ls_spec;
int err;
indio_dev = iio_device_alloc(sizeof(*inf));
@@ -455,6 +458,15 @@ static int cm3217_probe(struct i2c_client *client,
inf = iio_priv(indio_dev);
+ ls_spec = of_get_ls_spec(&client->dev);
+ if (!ls_spec) {
+ dev_warn(&client->dev,
+ "devname:%s func:%s line:%d invalid meta data, use default\n",
+ id->name, __func__, __LINE__);
+ } else {
+ fill_ls_attrs(ls_spec, cm3217_attrs);
+ }
+
inf->wq = create_singlethread_workqueue(CM3217_NAME);
if (!inf->wq) {
dev_err(&client->dev, "%s workqueue err\n", __func__);