1
0
Fork 0
Commit Graph

17 Commits (34ff6c2fe366f389dbe45badb5d100bd3aa02bea)

Author SHA1 Message Date
Song Hongyan 59d0f2da35 iio: hid: Add temperature sensor support
Environmental temperature sensor is a hid defined sensor,
it measures temperature.

More information can be found in:
http://www.usb.org/developers/hidpage/HUTRR39b.pdf

According to IIO ABI definition, IIO_TEMP data output unit is
milli degrees Celsius. Add the unit convert from degree to milli degree.

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-04 18:45:26 +00:00
Srinivas Pandruvada a96cd0f901 iio: accel: hid-sensor-accel-3d: Add timestamp
Added timestamp channel. With this change, each sample has a timestamp.
This timestamp can be from the sensor hub when present or local kernel
timestamp. HID sensors can send timestamp with input data using usage id
HID_USAGE_SENSOR_TIME_TIMESTAMP. This timestamp value is converted to
nano seconds before pushing this sample to the iio core.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-03 10:06:13 +00:00
Greg Kroah-Hartman ce0347c2b0 Merge 4.9-rc5 into staging-next
We want the staging/iio fixes in here as well to resolve issues and
merge problems.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-14 08:53:56 +01:00
Song Hongyan 6f77199e9e iio: hid-sensors: Increase the precision of scale to fix wrong reading interpretation.
While testing, it was observed that on some platforms the scale value
from iio sysfs for gyroscope is always 0 (E.g. Yoga 260). This results
in the final angular velocity component values to be zeros.

This is caused by insufficient precision of scale value displayed in sysfs.
If the precision is changed to nano from current micro, then this is
sufficient to display the scale value on this platform.
Since this can be a problem for all other HID sensors, increase scale
precision of all HID sensors to nano from current micro.

Results on Yoga 260:

name		scale before	scale now
--------------------------------------------
gyro_3d		0.000000	0.000000174
als			0.001000	0.001000000
magn_3d		0.000001	0.000001000
accel_3d		0.000009	0.000009806

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05 17:50:56 +00:00
Song Hongyan ab54163190 iio: hid-sensor-attributes: Check sample_frequency/hysteresis write data legitimacy
Neither sample frequency value nor hysteresis value can be set to be a
negative number, check and return "Invalid argument" if they are negative.

If not do this change, sample_frequency will be set into some unknown
value, read hysteresis value after write negative number will return
"Invalid argument".

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05 16:25:33 +00:00
Kweh, Hock Leong 36afb176d3 iio: fix pressure data output unit in hid-sensor-attributes
According to IIO ABI definition, IIO_PRESSURE data output unit is
kilopascal:
http://lxr.free-electrons.com/source/Documentation/ABI/testing/sysfs-bus-iio

This patch fix output unit of HID pressure sensor IIO driver from pascal to
kilopascal to follow IIO ABI definition.

Signed-off-by: Kweh, Hock Leong <hock.leong.kweh@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-03 17:09:58 +01:00
Srinivas Pandruvada 3950e03389 HID: hid-sensor-hub: Enhance feature report set API
Current API only allows setting one offset in the field. This API
is extended to set multiple offsets in the field report.
Also update parameters in the users of this API.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2015-02-23 15:20:00 +01:00
Srinivas Pandruvada 6adc83fca7 HID: hid-sensor-hub: Enhance get feature report API
Some hid sensor feature report can contain more than one reports.
This API can now support receiving multiple values from the feature
report.
Also update the parameters in the users of this API.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2015-02-23 15:19:49 +01:00
Daniel Baluta fb123a6b6b iio: hid-sensors: make hid_sensor_get_reporting_interval static
This fixes the following sparse warning:

  CHECK   drivers/iio/common/hid-sensors/hid-sensor-attributes.c
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:346:5: warning:
symbol 'hid_sensor_get_reporting_interval' was not declared. Should it be static?

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-07 13:29:49 +01:00
Sachin Kamat a034234277 iio: hid-sensors: Fix compilation warning
Move the 'static' keyword to beginning of definition to silence the
following compilation warning:
drivers/iio/common/hid-sensors/hid-sensor-attributes.c:34:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-05 11:21:09 +01:00
Archana Patni 3e729974d6 iio: hid-sensors: Set default unit of measure for report interval
For PROP_REPORT_INTERVAL, the spec does not mandate the presence
of the report interval unit in the feature report and expects the
default unit of measure to be used as milliseconds.

Currently, when the unit is not present, it gets set as zero leading
to issues in sampling frequency.

This patch sets the unit of measure to the default unit if it
is not defined by firmware.

Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-10 11:45:02 +01:00
Dan Carpenter bf7f5204ab iio: hid-sensors: typo leads to potential forever loop
The "i < " was missing in this condition.

Fixes: 5d02edfc39 ('iio: hid-sensors: Convert units and exponent')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-10 11:38:10 +01:00
Srinivas Pandruvada 9030924510 iio: hid-sensors: Add api to get poll value
Added interface to get poll value in milli-seconds. This value is
changed by changing sampling frequency. This API allows clients
to wait for at least some poll milli seconds before reading a new sample.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-05 10:59:45 +01:00
Srinivas Pandruvada 5d02edfc39 iio: hid-sensors: Convert units and exponent
HID sensor hub specify a default unit and alternative units. This
along with unit exponent can be used adjust scale. This change
change HID sensor data units to IIO defined units for each
sensor type. So in this way user space can use a simply use:
"(data + offset) * scale" to get final result.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-05 10:59:44 +01:00
Alexander Holler e07c6d170c hid: iio: rename struct hid_sensor_iio_common to hid_sensor_common
The structure with common attributes for hid-sensors isn't specific
to the iio-subsystem, so rename it to hid_sensor_common.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-01-06 11:48:11 +00:00
Alexander Holler 2974cdf293 iio: merge hid-sensor-attributes.h into hid-sensor-hub.h
The stuff in hid-sensor-attributes.h is needed by every piece which
uses hid-sensor-hub and merging it into hid-sensor-hub.h makes it accessible
from outside the iio subdirectory.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-01-06 11:43:37 +00:00
srinivas pandruvada 73c6768b71 iio: hid-sensors: Common attribute and trigger
This patch contains the common code, which is used by all HID sensors.
There are some common set of attributes, which every hid sensor
needs it. This patch contains all such attributes processing.
Also the trigger interface is common among all HID sensors. This
patch contains common trigger functions utilized by all HID sensors.

Signed-off-by: srinivas pandruvada <srinivas.pandruvada@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-09-06 19:20:11 +01:00