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 2/9] iio: hid-sensors: Add connection type
Date: Wed, 23 Oct 2013 12:11:09 -0700 [thread overview]
Message-ID: <1382555476-15826-2-git-send-email-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <1382555476-15826-1-git-send-email-srinivas.pandruvada@linux.intel.com>
Some sensor hub firmware are very strict about the connection type
setting. The connection type specifies whether it is an integrated
or external sensor hub.
By default choosing integrated type unless changed via a module
param.
Also a fix a minor typo for POWER_STATE.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
drivers/iio/common/hid-sensors/hid-sensor-attributes.c | 12 +++++++++---
drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 8 ++++++++
include/linux/hid-sensor-hub.h | 1 +
include/linux/hid-sensor-ids.h | 6 +++++-
4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
index 75b5473..dacd98d 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
@@ -226,7 +226,7 @@ int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
sensor_hub_input_get_attribute_info(hsdev,
HID_FEATURE_REPORT, usage_id,
- HID_USAGE_SENSOR_PROY_POWER_STATE,
+ HID_USAGE_SENSOR_PROT_POWER_STATE,
&st->power_state);
sensor_hub_input_get_attribute_info(hsdev,
@@ -234,11 +234,17 @@ int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
HID_USAGE_SENSOR_PROP_SENSITIVITY_ABS,
&st->sensitivity);
- hid_dbg(hsdev->hdev, "common attributes: %x:%x, %x:%x, %x:%x %x:%x\n",
+ sensor_hub_input_get_attribute_info(hsdev,
+ HID_FEATURE_REPORT, usage_id,
+ HID_USAGE_SENSOR_PROP_SENSOR_CONNECTION_TYPE,
+ &st->conn_type);
+
+ hid_dbg(hsdev->hdev, "common attributes: %x:%x, %x:%x, %x:%x %x:%x %x:%x\n",
st->poll.index, st->poll.report_id,
st->report_state.index, st->report_state.report_id,
st->power_state.index, st->power_state.report_id,
- st->sensitivity.index, st->sensitivity.report_id);
+ st->sensitivity.index, st->sensitivity.report_id,
+ st->conn_type.index, st->conn_type.report_id);
return 0;
}
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
index 759582d..9aff8c3 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
@@ -34,6 +34,10 @@ module_param(hid_sensor_named_array_base, int, 0644);
MODULE_PARM_DESC(hid_sensor_named_array_base,
"HID SENSOR NAMED ARRAY BASE (0 or 1).");
+static int hid_sensor_conn_type = HID_USAGE_SENSOR_PROP_CONNEC_TYPE_PC_INT_ENUM;
+module_param(hid_sensor_conn_type, int, 0644);
+MODULE_PARM_DESC(hid_sensor_conn_type, "HID SENSOR CONNECT TYPE (1 to 3).");
+
static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
bool state)
{
@@ -68,6 +72,10 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
st->report_state.index,
(s32)report_state);
+ sensor_hub_set_feature(st->hsdev, st->conn_type.report_id,
+ st->conn_type.index,
+ hid_sensor_conn_type);
+
return 0;
}
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index 107baec4..27116b4 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -189,6 +189,7 @@ struct hid_sensor_common {
struct hid_sensor_hub_attribute_info report_state;
struct hid_sensor_hub_attribute_info power_state;
struct hid_sensor_hub_attribute_info sensitivity;
+ struct hid_sensor_hub_attribute_info conn_type;
};
/* Convert from hid unit expo to regular exponent */
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 8323775..714e3e1 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -106,6 +106,7 @@
#define HID_USAGE_SENSOR_UNITS_DEGREES_PER_SECOND 0x15
/* Common selectors */
+#define HID_USAGE_SENSOR_PROP_SENSOR_CONNECTION_TYPE 0x200309
#define HID_USAGE_SENSOR_PROP_REPORT_INTERVAL 0x20030E
#define HID_USAGE_SENSOR_PROP_SENSITIVITY_ABS 0x20030F
#define HID_USAGE_SENSOR_PROP_SENSITIVITY_RANGE_PCT 0x200310
@@ -115,7 +116,10 @@
#define HID_USAGE_SENSOR_PROP_RANGE_MAXIMUM 0x200314
#define HID_USAGE_SENSOR_PROP_RANGE_MINIMUM 0x200315
#define HID_USAGE_SENSOR_PROP_REPORT_STATE 0x200316
-#define HID_USAGE_SENSOR_PROY_POWER_STATE 0x200319
+#define HID_USAGE_SENSOR_PROT_POWER_STATE 0x200319
+
+/* Default connection type */
+#define HID_USAGE_SENSOR_PROP_CONNEC_TYPE_PC_INT_ENUM 0x01
/* Power state enumerations */
#define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x00
--
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 ` Srinivas Pandruvada [this message]
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 ` [PATCH v2 5/9] iio: hid-sensors: light/als " Srinivas Pandruvada
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-2-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).