From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: jic23@kernel.org
Cc: linux-iio@vger.kernel.org,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: [PATCH v2 5/9] iio: hid-sensors: light/als : Add sensitivity
Date: Wed, 23 Oct 2013 12:11:12 -0700 [thread overview]
Message-ID: <1382555476-15826-5-git-send-email-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <1382555476-15826-1-git-send-email-srinivas.pandruvada@linux.intel.com>
A number of Properties that can be applied to Data Fields are per data
field basis or for all data fields. Adding sensitivity field for all
als fields, which is most commonly used in currently available
sensor hubs.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
drivers/iio/light/hid-sensor-als.c | 13 ++++++++++++-
include/linux/hid-sensor-ids.h | 1 +
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index 771c919..b518488 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -228,6 +228,17 @@ static int als_parse_report(struct platform_device *pdev,
dev_dbg(&pdev->dev, "als %x:%x\n", st->als_illum.index,
st->als_illum.report_id);
+ /* Set Sensitivity field ids, when there is no individual modifier */
+ if (st->common_attributes.sensitivity.index < 0) {
+ sensor_hub_input_get_attribute_info(hsdev,
+ HID_FEATURE_REPORT, usage_id,
+ HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS |
+ HID_USAGE_SENSOR_DATA_LIGHT,
+ &st->common_attributes.sensitivity);
+ dev_dbg(&pdev->dev, "Sensitivity index:report %d:%d\n",
+ st->common_attributes.sensitivity.index,
+ st->common_attributes.sensitivity.report_id);
+ }
return ret;
}
@@ -330,7 +341,7 @@ static int hid_als_remove(struct platform_device *pdev)
sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_ALS);
iio_device_unregister(indio_dev);
- hid_sensor_remove_trigger(&als_state->common_attribute);
+ hid_sensor_remove_trigger(&als_state->common_attributes);
iio_triggered_buffer_cleanup(indio_dev);
kfree(indio_dev->channels);
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 73cd4ee..3f349fa 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -30,6 +30,7 @@
/* ALS (200041) */
#define HID_USAGE_SENSOR_ALS 0x200041
+#define HID_USAGE_SENSOR_DATA_LIGHT 0x2004d0
#define HID_USAGE_SENSOR_LIGHT_ILLUM 0x2004d1
/* Gyro 3D: (200076) */
--
1.8.3.2
next prev parent reply other threads:[~2013-10-23 19:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-23 19:11 [PATCH v2 1/9] iio: hid_Sensors: fix crash during trigger unregister Srinivas Pandruvada
2013-10-23 19:11 ` [PATCH v2 2/9] iio: hid-sensors: Add connection type Srinivas Pandruvada
2013-10-23 19:11 ` [PATCH v2 3/9] iio: hid-sensors: accelerometer: Add sensitivity Srinivas Pandruvada
2013-10-23 19:11 ` [PATCH v2 4/9] iio: hid-sensors: gyro : " Srinivas Pandruvada
2013-10-23 19:11 ` Srinivas Pandruvada [this message]
2013-10-23 19:11 ` [PATCH v2 6/9] iio: hid-sensors: magnetometer " Srinivas Pandruvada
2013-10-23 19:11 ` [PATCH v2 7/9] iio: hid-sensors: Added Inclinometer 3D Srinivas Pandruvada
2013-10-24 11:06 ` Jonathan Cameron
2013-10-24 11:11 ` Jonathan Cameron
2013-10-23 19:11 ` [PATCH v2 8/9] iio: Add channel modifiers for Quaternion Rotations Srinivas Pandruvada
2013-10-24 11:18 ` Jonathan Cameron
2013-10-24 15:17 ` Srinivas Pandruvada
2013-10-24 16:20 ` Jonathan Cameron
2013-10-28 23:44 ` Srinivas Pandruvada
2013-10-29 6:54 ` Jonathan Cameron
2013-10-23 19:11 ` [PATCH v2 9/9] iio: hid-sensors: Added device rotation support Srinivas Pandruvada
2013-10-24 10:42 ` [PATCH v2 1/9] iio: hid_Sensors: fix crash during trigger unregister Jonathan Cameron
2013-10-24 15:21 ` Lars-Peter Clausen
2013-10-24 15:40 ` Srinivas Pandruvada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1382555476-15826-5-git-send-email-srinivas.pandruvada@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).