1
0
Fork 0
Commit Graph

26 Commits (a61127c2130236168321cc76c5a58e15c00ad154)

Author SHA1 Message Date
Thomas Gleixner a61127c213 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 335
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms and conditions of the gnu general public license
  version 2 as published by the free software foundation this program
  is distributed in the hope it will be useful but without any
  warranty without even the implied warranty of merchantability or
  fitness for a particular purpose see the gnu general public license
  for more details you should have received a copy of the gnu general
  public license along with this program if not write to the free
  software foundation inc 51 franklin st fifth floor boston ma 02110
  1301 usa

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 111 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190530000436.567572064@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05 17:37:06 +02:00
Srinivas Pandruvada 138bc7969c iio: hid-sensor-hub: Implement batch mode
HID sensor hubs using Integrated Senor Hub (ISH) has added capability to
support batch mode. This allows host processor to go to sleep for extended
duration, while the sensor hub is storing samples in its internal buffers.

'Commit f4f4673b75 ("iio: add support for hardware fifo")' implements
feature in IIO core to implement such feature. This feature is used in
bmc150-accel-core.c to implement batch mode. This implementation allows
software device buffer watermark to be used as a hint to adjust hardware
FIFO.

But HID sensor hubs don't allow to change internal buffer size of FIFOs.
Instead an additional usage id to set "maximum report latency" is defined.
This allows host to go to sleep upto this latency period without getting
any report. Since there is no ABI to set this latency, a new attribute
"hwfifo_timeout" is added so that user mode can specify a latency.

This change checks presence of usage id to get/set maximum report latency
and if present, it will expose hwfifo_timeout.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-16 19:44:01 +01:00
Song Hongyan 00907c7a32 iio: hid-sensor-rotation: Add geomagnetic orientation sensor hid support.
Geomagnetic orientation(AM) sensor is one kind of orientation 6dof sensor.
It gives the device rotation in respect to the earth center and the
magnetic north. The sensor is implemented through use of an accelerometer
and magnetometer do not use gyroscope. It is a standard HID sensor.

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

Geomagnetic orientation(AM) sensor and dev rotation sensor have same
channel and share channel usage id. So the most of the code for relative
orientation sensor can be reused.

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-07 12:22:33 +01:00
Song Hongyan 9ff88edc5e iio: hid-sensor-rotation: Add relative orientation sensor hid support
Relative orientation(AG) sensor is a 6dof orientation sensor,
it depends on acceleration and gyroscope sensor data. It gives
a quaternion describing the orientation of the device relative
to an initial orientation. It is a standard HID sensor.

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

Relative orientation(AG) sensor and dev rotation sensor have same
channels and share channel usage id. So the most of the code for
relative orientation sensor can be reused.

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Xu Even <even.xu@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-07 12:22:27 +01:00
Song Hongyan d7ed89d5aa iio: hid: Add humidity sensor support
Environmental humidity sensor is a hid defined sensor,
it shows raw humidity measurement of air.

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

According to IIO ABI definition, humidityrelative data output unit is
milli percent. Add the unit convert from percent to milli percent.

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-25 16:32:24 +00:00
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
Song Hongyan 0e377f3b9a iio: Add gravity sensor support
Gravity sensor is a soft sensor, which derives value from
standard accelerometer device by filtering out the acceleration
which is not caused by gravity.

Gravity sensor provides a three dimensional vector indicating
the direction and magnitude of gravity. Typically, this sensor
is used to determine the device's relative orientation in space.
The units and the coordinate system is the same as the one used by
the acceleration sensor.
When a device is at rest, the output of the gravity sensor should
be identical to that of the accelerometer.

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

Gravity sensor and accelerometer have similar channels and
share channel usage ids. So the most of the code for accel_3d
can be reused.

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-01-05 13:07:24 +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
Srinivas Pandruvada cb67126f32 HID: hid-sensor-hub: Add support for application collection
Section 4.2.5 of HID Sensor hub specification allows two methods
defining sensor devices.
- Each sensor device by its own collection
- A top level application collection object, including multiple
sensors.
In the first method, each sensor can be in its own sensor application
collection without a physical collection.
In the second method there is a usage id for collection type, which
is defined as an application collection, with multiple physical
collections in it. It is possible to define fusion sensor with this
and may have its own handler. If there is a callback registered
for the collection type, then forward all reports for sensors in
its collection to this handler.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2015-02-23 15:11:52 +01:00
Srinivas Pandruvada fc18dddc06 iio: hid-sensors: Added device rotation support
Added usage id processing for device rotation. This uses IIO
interfaces for triggered buffer to present data to user
mode.This uses HID sensor framework for registering callback
events from the sensor hub.
Data is exported to user space in the form of quaternion rotation
format.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-04-29 22:11:53 +01:00
Linus Torvalds 0f1b1e6d73 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina:
 - substantial cleanup of the generic and transport layers, in the
   direction of an ultimate goal of making struct hid_device completely
   transport independent, by Benjamin Tissoires
 - cp2112 driver from David Barksdale
 - a lot of fixes and new hardware support (Dualshock 4) to hid-sony
   driver, by Frank Praznik
 - support for Win 8.1 multitouch protocol by Andrew Duggan
 - other smaller fixes / device ID additions

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (75 commits)
  HID: sony: fix force feedback mismerge
  HID: sony: Set the quriks flag for Bluetooth controllers
  HID: sony: Fix Sixaxis cable state detection
  HID: uhid: Add UHID_CREATE2 + UHID_INPUT2
  HID: hyperv: fix _raw_request() prototype
  HID: hyperv: Implement a stub raw_request() entry point
  HID: hid-sensor-hub: fix sleeping function called from invalid context
  HID: multitouch: add support for Win 8.1 multitouch touchpads
  HID: remove hid_output_raw_report transport implementations
  HID: sony: do not rely on hid_output_raw_report
  HID: cp2112: remove the last hid_output_raw_report() call
  HID: cp2112: remove various hid_out_raw_report calls
  HID: multitouch: add support of other generic collections in hid-mt
  HID: multitouch: remove pen special handling
  HID: multitouch: remove registered devices with default behavior
  HID: hidp: Add a comment that some devices depend on the current behavior of uniq
  HID: sony: Prevent duplicate controller connections.
  HID: sony: Perform a boundry check on the sixaxis battery level index.
  HID: sony: Fix work queue issues
  HID: sony: Fix multi-line comment styling
  ...
2014-04-02 16:24:28 -07:00
Archana Patni f64a799b8a iio: hid-sensors: Added Pressure Sensor driver
Added usage id processing for Pressure Sensor. This uses IIO
interfaces for triggered buffer to present data to user
mode. This uses HID sensor framework for registering callback
events from the sensor hub.

Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-22 13:07:06 +00:00
Archana Patni 39a3a0138f iio: hid-sensors: Added Proximity Sensor Driver
Added usage id processing for Proximity (Human Presence).
This uses IIO interfaces for triggered buffer to present data
to user mode. This uses HID sensor framework for registering
callback events from the sensor hub.

Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-22 13:07:01 +00:00
Srinivas Pandruvada 1a214ae5d1 iio: hid-sensor-hub: Remove hard coded indexes
Remove the hard coded indexes, instead search for usage id and
use the index to set the power and report state.
This will fix issue, where the report descriptor doesn't contain
the full list of possible selector for power and report state.

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>
2014-02-17 15:09:47 +01:00
Greg Kroah-Hartman a6e8e3a470 2nd round of new IIO drivers, features and cleanups for the 3.14 cycle.
New drivers
 
 * HID inclinometer driver.
 
 * DHT11 humidity driver.  Note that previous humidity drivers have been in
   hwmon, but no one was ever entirely happy with that, and they should find
   a more comfortable home in IIO (their original placement in hwmon was my
   fault - oops).  As this is our first humidity driver, core support is also
   added.
 
 New features
 
 * Two of mxs-lradc channels are internally wired to a temperature sensor,
   make this explicit in the driver by providing the relevant temperature
   channel.
 
 * Add support for blocking IO on buffers.
 
 * Add a data_available call back to the interface between buffer implementations
   and the core.  This is much cleaner than the old, 'stufftoread' flag.
   Implemented in the kfifo buffer.
 
 Cleanups
 
 * Last user of the old event configuration interface is converted and the
   old interface dropped.  Nice to be rid of this thanks to Lars-Peter's hard
   work!
 
 * Replace all remaining instances of the IIO_ST macro with explicit filling
   of the scan_type structure within struct iio_chan_spec.  This macro was a
   bad idea, that rapidly ceased to cover all elements of the structure.
   Miss reading of the macro arguements has led to a number of bugs so lets
   just get rid of it. The final removal patch is awaiting for some fixes
   to make their way into mainline.
   In a couple of drivers, no elements of scan_type were even being used so
   in those case, it has been dropped entirely.
 
 * Drop a couple of of_match_ptr helper uses in drivers where devicetree is
   not optional and hence the structures being protected by this always exist.
 
 * Fix up some cases where data was read from a device in a particular
   byte order, but he code placed it into a s16 or similar.  These were
   highlighted by Sparse.
 
 * Use the new ATTRIBUTE_GROUPS macro to drop some boiler plate in the triggers
   core code.
 
 * ad7746 and ad7280a - stop storing buffers on the stack, giving cleaner code
   and possibly avoiding issues with i2c bus drivers that assume they can dma
   directly into the buffer.  Note that this cannot currently happen as the the
   i2c_smbus_read_i2c_block_data function has a memcpy from the buffer actually
   passed to the bus driver.  I missed this element of the commit message
   and don't think it is major enough to rebase the iio tree.
 
 * ad5791 and ad5504 stop storing buffers on the stack for an SPI driver.
   Unlike the i2c drivers, this is a real issue for SPI drivers which can dma
   directly into the buffer supplied.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJStyIbAAoJEFSFNJnE9BaI1goQAL0hKYCYuIl3d1fAy65u2I4h
 5mzJs/oJmomq/4BqAopfEQ8CbhZhksAYoR4JndOzZH7n4jVY/fRgyY/bH/Ymj0oI
 OpCtfee6IeeBLA0p8CMeEPem/pnwxRhSDzul9jsiwpTrTRKAIC1BPZwrmLpaoUfc
 obD8r1ocVZStzfsYBr3DUwkcIpcTQTCVy/Pl8HoKLKKsdYoFhTpNwEHJFOoZdiFi
 KKGRkeL9Q8VRWt/otWU0L0VFGZFwI1PWlxrqnbisVcGwSs8FF4wGcQvijfC0mUMg
 BdKDM7J4GrourZhj3og566B/8WMtGo6YTJXAe/QvvPp768rQncccDHem4V0Tnu49
 OJbjgD4ZGVXt3uBFaYddBIbMEIB8SfA2VYur/MW3gnZ7saSAtDk6TllsvC6CxIkR
 +LOOxWylhEGeJFIjyMrFPqRVhrrRNkuDRxPz8ZGTiDc8ovo6DWuTLsJrLSX8EJyZ
 O6TN6EEk8TCJaf8V63uTFW0Dlom4IQHyQei6LKhfhzwUQq/ri0esBp5P8lGzI3Uq
 wtOSdCDuYyoUEYPYbwjohFmQJ27w1rx9KcS4Y9BGmhTIRXslUg3hr+wA/gKMSDZ0
 /AUkLQajcv9otupfGzsp5mIWkthKKsGt/Y50xc5zIodnFtnM3nQGq4AqlP6t8nzP
 jucVwVMQLj5KaNH13P6K
 =Whfv
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-3.14b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

2nd round of new IIO drivers, features and cleanups for the 3.14 cycle.

New drivers

* HID inclinometer driver.

* DHT11 humidity driver.  Note that previous humidity drivers have been in
  hwmon, but no one was ever entirely happy with that, and they should find
  a more comfortable home in IIO (their original placement in hwmon was my
  fault - oops).  As this is our first humidity driver, core support is also
  added.

New features

* Two of mxs-lradc channels are internally wired to a temperature sensor,
  make this explicit in the driver by providing the relevant temperature
  channel.

* Add support for blocking IO on buffers.

* Add a data_available call back to the interface between buffer implementations
  and the core.  This is much cleaner than the old, 'stufftoread' flag.
  Implemented in the kfifo buffer.

Cleanups

* Last user of the old event configuration interface is converted and the
  old interface dropped.  Nice to be rid of this thanks to Lars-Peter's hard
  work!

* Replace all remaining instances of the IIO_ST macro with explicit filling
  of the scan_type structure within struct iio_chan_spec.  This macro was a
  bad idea, that rapidly ceased to cover all elements of the structure.
  Miss reading of the macro arguements has led to a number of bugs so lets
  just get rid of it. The final removal patch is awaiting for some fixes
  to make their way into mainline.
  In a couple of drivers, no elements of scan_type were even being used so
  in those case, it has been dropped entirely.

* Drop a couple of of_match_ptr helper uses in drivers where devicetree is
  not optional and hence the structures being protected by this always exist.

* Fix up some cases where data was read from a device in a particular
  byte order, but he code placed it into a s16 or similar.  These were
  highlighted by Sparse.

* Use the new ATTRIBUTE_GROUPS macro to drop some boiler plate in the triggers
  core code.

* ad7746 and ad7280a - stop storing buffers on the stack, giving cleaner code
  and possibly avoiding issues with i2c bus drivers that assume they can dma
  directly into the buffer.  Note that this cannot currently happen as the the
  i2c_smbus_read_i2c_block_data function has a memcpy from the buffer actually
  passed to the bus driver.  I missed this element of the commit message
  and don't think it is major enough to rebase the iio tree.

* ad5791 and ad5504 stop storing buffers on the stack for an SPI driver.
  Unlike the i2c drivers, this is a real issue for SPI drivers which can dma
  directly into the buffer supplied.
2013-12-24 10:30:57 -08:00
Greg Kroah-Hartman 5c5bccb76c Merge 3.13-rc4 into staging-next.
We want the fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-16 17:12:04 -08:00
Srinivas Pandruvada 098d3beccf iio: hid-sensors: Added Inclinometer 3D
Added usage id processing for Inclinometer 3D. This uses IIO
interfaces for triggered buffer to present data to user
mode.This uses HID sensor framework for registering callback
events from the sensor hub.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:31:59 +00:00
Srinivas Pandruvada 751d17e23a iio: hid-sensors: Fix power and report state
In the original HID sensor hub firmwares all Named array enums were
to 0-based. But the most recent hub implemented as 1-based,
because of the implementation by one of the major OS vendor.
Using logical minimum for the field as the base of enum. So we add
logical minimum to the selector values before setting those fields.
Some sensor hub FWs already changed logical minimum from 0 to 1
to reflect this and hope every other vendor will follow.
There is no easy way to add a common HID quirk for NAry elements,
even if the standard specifies these field as NAry, the collection
used to describe selectors is still just "logical".

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-02 21:05:32 +00:00
Srinivas Pandruvada 2461fc9f3f iio: hid-sensors: magnetometer : Add sensitivity
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
magnetometer fields, which is most commonly used in currently available
sensor hubs.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-09 13:51:23 +00:00
Srinivas Pandruvada f87ee1bd88 iio: hid-sensors: light/als : Add sensitivity
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>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-05 23:03:11 +00:00
Srinivas Pandruvada 2371aebf02 iio: hid-sensors: gyro : Add sensitivity
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
gyro fields, which is most commonly used in currently available
sensor hubs.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-05 23:02:53 +00:00
Srinivas Pandruvada 64528d03d7 iio: hid-sensors: accelerometer: Add sensitivity
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
accelerometer fields, which is most commonly used in currently
available sensor hubs.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-05 23:02:43 +00:00
Andy Shevchenko 15261f6d8d HID: hid-sensor-hub: fix style of comments
This patch fixes the style of the comments to be like following
	/* The commentary */

There is no functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-08-26 13:46:11 +02:00
Alexander Holler 8e3cdca26c iio: Add Usage IDs for HID time sensors.
These are Usage IDs for the attributes year, month, day,
hour, minute and second, needed to read HID time sensors.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-01-06 11:41:12 +00:00
Alexander Holler 83499b52c6 HID: sensors: autodetect USB HID sensor hubs
It should not be necessary to add IDs for HID sensor hubs to lists in
hid-core.c and hid-sensor-hub.c. So instead of a whitelist, autodetect such USB
HID sensor hubs, based on a collection of type physical inside a useage page of
type sensor. If some sensor hubs stil must be usable as raw devices, a
blacklist might be created.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
Acked-by: "Pandruvada, Srinivas" <srinivas.pandruvada@intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-12-12 16:49:10 +01:00
srinivas pandruvada 401ca24fb3 HID: sensors: introduce sensor framework
Adding processing for HID Sensor usage table as defined by
HID 1.12, Request #: HUTRR39, dated 05 May, 2011.
This driver uses HID driver framework to register, send and
receive events.
This uses MFD framework, so that actual processing for a
specific usage id can be done in a different driver. For
example an accelerometer driver can be a separate driver and
use the interface provided by this driver to register for
events.

Signed-off-by: srinivas pandruvada <srinivas.pandruvada@intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-09-06 19:13:13 +01:00