Commit Graph

62 Commits

Author SHA1 Message Date
Jonathan Cameron 3a49b56394 iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
[ Upstream commit 3ab3aa2e7bd57497f9a7c6275c00dce237d2c9ba ]

To make code more readable, use a structure to express the channel
layout and ensure the timestamp is 8 byte aligned.

Found during an audit of all calls of this function.

Fixes: 1a4fbf6a92 ("iio: accel: kxcjk1013 3-axis accelerometer driver")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210501170121.512209-5-jic23@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-14 16:53:37 +02:00
Hans de Goede d3e27c6233 iio: accel: kxcjk1013: Add support for KIOX010A ACPI DSM for setting tablet-mode
commit e5b1032a656e9aa4c7a4df77cb9156a2a651a5f9 upstream.

Some 360 degree hinges (yoga) style 2-in-1 devices use 2 KXCJ91008-s
to allow the OS to determine the angle between the display and the base
of the device, so that the OS can determine if the 2-in-1 is in laptop
or in tablet-mode.

On Windows both accelerometers are read by a special HingeAngleService
process; and this process calls a DSM (Device Specific Method) on the
ACPI KIOX010A device node for the sensor in the display, to let the
embedded-controller (EC) know about the mode so that it can disable the
kbd and touchpad to avoid spurious input while folded into tablet-mode.

This notifying of the EC is problematic because sometimes the EC comes up
thinking that device is in tablet-mode and the kbd and touchpad do not
work. This happens for example on Irbis NB111 devices after a suspend /
resume cycle (after a complete battery drain / hard reset without having
booted Windows at least once). Other 2-in-1s which are likely affected
too are e.g. the Teclast F5 and F6 series.

The kxcjk-1013 driver may seem like a strange place to deal with this,
but since it is *the* driver for the ACPI KIOX010A device, it is also
the driver which has access to the ACPI handle needed by the DSM.

Add support for calling the DSM and on probe unconditionally tell the
EC that the device is laptop mode, fixing the kbd and touchpad sometimes
not working.

Fixes: 7f6232e695 ("iio: accel: kxcjk1013: Add KIOX010A ACPI Hardware-ID")
Reported-and-tested-by: russianneuromancer <russianneuromancer@ya.ru>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201110133835.129080-3-hdegoede@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-24 13:29:21 +01:00
Hans de Goede 9f99cc38cf iio: accel: kxcjk1013: Replace is_smo8500_device with an acpi_type enum
commit 11e94f28c3de35d5ad1ac6a242a5b30f4378991a upstream.

Replace the boolean is_smo8500_device variable with an acpi_type enum.

For now this can be either ACPI_GENERIC or ACPI_SMO8500, this is a
preparation patch for adding special handling for the KIOX010A ACPI HID,
which will add a ACPI_KIOX010A acpi_type to the introduced enum.

For stable as needed as precursor for next patch.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Fixes: 7f6232e695 ("iio: accel: kxcjk1013: Add KIOX010A ACPI Hardware-ID")
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201110133835.129080-2-hdegoede@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-24 13:29:21 +01:00
Hans de Goede c0af3b61b5 iio: accel: kxcjk1013: Improve comments on KIOX010A and KIOX020A ACPI ids
The KIOX010A and KIOX020A ACPI ids go hand in hand, they are used in
yoga style 2-in-1s, with KIOX010A indicating the KXCJ91008 sensor in the
display of the 2-in-1 and KIOX020A indicating the KXCJ91008 sensor in the
base.

Improve the existing comment on the "KIOX010A" kx_acpi_match table entry
to make clear we are talking about a yoga-style (360 degree hinges) device
here and add a similar comment to the "KIOX020A" entry.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-08-18 18:50:56 +01:00
Greg Kroah-Hartman c55cc97a25 Second set of IIO device support, features, cleanups and minor fixes for 5.3.
A few bits for the counters subsystem mixed in here as well.
 There are some late breaking fixes as well, which aren't so urgent
 they can't wait for the merge window.
 
 New Device Support
 * adf4371
   - New driver + bindings.
   - Support the adf4372 PLL. Mostly ID and bindings.
 * ad8366 (note includes rework of driver needed to allow support for these).
   - Support the ADL5240 variable gain amplifier (VGA).
   - Support the ADA4961 digital gain amplifier (DGA).
 * dps310
   - New driver, in several parts from different authors for this temp
     and pressure sensor.
   - Includes errata workaround for a temperature reading issue.
 * stk3310
   - Support the stk3335, mostly ID.
 
 Features and cleanups
 * core
   - drop error handling on debugfs registration.
   - harden by making sure we don't overrun iio_chan_info_postfix.
 * docs
   - convert remaining docs to rst. At somepoint we'll fit these few
     into the main IIO docs.
   - improve sampling_frequency_available docs but explaining the
     range form.
 * ad_sigma_delta
   - Drop a pointless goto.
 * ad2s1210
   - Drop pointless platform data null check seeing as we don't actually
     use platform data anymore.
 * ad7124
   - Relax limitation on channel numbers to allow pseudo different channels.
   - Support control of whether the input is buffered via DT.
   - Use dynamic allocation for channel configuration to make it easier
     to support new devices.
   - YAML binding conversion.
 * ad7150
   - Comment tidy up.
   - Consistent and simple if (ret) handling of i2c errors.
   - FIELD_GET and GENMASK.
   - Ternary rather than !!(condition) for readability.
   - Use macros to avoid repetition of channel definitions.
 * ad7606
   - Add software channel config (rather that pin controlled)
   - Refactor to simplify addition of new part in future.
 * ad7746
   - of_deivce_id table.
 * ad7780
   - MAINTAINERS entry
   - YAML DT bindings.
 * ad8366
   - Stop using core mlock in favour of well scoped local lock.
   - SPDX + copyright date update.
 * ad9834
   - of_device_id table
 * adf4371
   - Add support for output stage muting before lock on has occured.
 * adis library
   - MAINTAINERS entry to reflect that this now Alexandru's problem ;)
 * adis162xx:
   - Fix a slightly incorrect set of comments and print statements on
     minimum supported voltage.
 * adis16203
   - of_device_id table.
 * adis16240
   - Add of_device_id table (in two parts as first patch only used it for
     MODULE_DEVICE_TABLE.)
 * adt7316-spi
   - of_device_id table
 * adxl372
   - YAML DT binding conversion.
   - Cleanup use of buffer callback functions (precursor to core rework).
 * bh1710
   - Simplify getting the i2c adapter from the client.
 * dht11
   - Mote to newer GPIO consumer interface.
 * kxcjk-1013.c
   - Add binding for sensor in display of some ultrabooks after userspace
     tools updated for it not be a problem to report two similar sensors.
 * imx7d
   - drop unused variables.
   - white space
   - define instead of variable for clock frequency that is fixed.
   - drop pointless error message.
 * messon_saradc
   - SPDX
 * sps30
   - MAINTAINERS entry
   - YAML binding conversion.
 * st_accel
   - Tidy up ordering in various buffer related callbacks. This is
     part of a long running effort to simplify the core code.
 * stm32-dfsdm:
   - Manage the resolution cleanly in triggerd modes.
   - Add fast mode support which allows more flexible filter choices.
   - Add a comment on the reason for a 16 bit record when technically
     not 'required'.
 * st_lsm6dsx
   - Embed device name in the sensor_settings struct as i3c doesn't
     have a convenient name field to use for this.
 * xilinx-adc
   - Relax constraints on supported platforms to reflect that this
     can used with FPGAs on PCIe cards and hence many architectures.
 * counters/ftm-quaddec
   - Fix some formatting io MODULE_AUTHOR
   - MAINTAINERS entry
 
 Fixes
 * tools
   - fix incorrect handling of 32 bit channels.
 * sca3000
   - Potential endian bug that is unlikely to bite anyone (be64 host
     seems unlikely for this old part).
 * stm32-adc
   - Add vdda-supply. On some boards it needs to be turned on to supply
     the ADC.  DT bindings included.
 * stm32-dfsdm
   - Fix output resolution to work with filter orders other than 3.
   - Fix output datatype as it's signed and previously claimed not to be.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAl0VHIkRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FojyxhAAgrLRy2wlHjQCAh0S6J22LKs02uPX1qvY
 nm1aI/av2DGcMCV2NF6J1sW2Mocvtt5a79/1f/wRqDzOHBrTpFr0Q0Ngwijv9bzc
 fv6NwfHlWolmXynKx8wK4b6Sa3KVCkltojEVpEVbhkuMkafSQ+pQzYF1Uf7enOrX
 j3Gq6NYaCks4YtFZsBphgzo3DC0mh7CfunlPiOdVcgcg4Pj/KZY9QCX86fJx972x
 YI3BRFHnDSMDOxOTjeqeKvMiqU2zLPlqLSEOCUw2XCrh6HI9qFiU+LVsYx6SP0tx
 aJ2q+qYc9raOTANHk7O2JZYWv/52JXvtKcFSLiuQdABjaAI20xEr1QAZYVYUiXmg
 dFH6lBsWvQyAy5F/SyZ5tavZvTfGsNDB5LhlpEggeO2W6cIIL4CLfHimB2EcxFSH
 utqEA72HQZosEUKut1jbmG6iYMiRnHS72pLOqkJ6HC/2/pZfoEWlEH9x/S3xbBsW
 918ISs9852VwjebQwck96+Dh0LwiKOl8Aii5ONzfNObJB6/JbULPoKKArsMdENQA
 mqDXLOMz6GspY3JgiVDCXAwg2x2Ht/ictR6svRJtOTLiBU2Iybpm/HRkPePhoePF
 HLw8fhwE+mOSWr22KhzjUJBHEAkoejo/14XOgKSTkO9V6amLlOWRDV3uK2PksmdI
 7DQyYhX9Tos=
 =a3vh
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Second set of IIO device support, features, cleanups and minor fixes for 5.3.

A few bits for the counters subsystem mixed in here as well.
There are some late breaking fixes as well, which aren't so urgent
they can't wait for the merge window.

New Device Support
* adf4371
  - New driver + bindings.
  - Support the adf4372 PLL. Mostly ID and bindings.
* ad8366 (note includes rework of driver needed to allow support for these).
  - Support the ADL5240 variable gain amplifier (VGA).
  - Support the ADA4961 digital gain amplifier (DGA).
* dps310
  - New driver, in several parts from different authors for this temp
    and pressure sensor.
  - Includes errata workaround for a temperature reading issue.
* stk3310
  - Support the stk3335, mostly ID.

Features and cleanups
* core
  - drop error handling on debugfs registration.
  - harden by making sure we don't overrun iio_chan_info_postfix.
* docs
  - convert remaining docs to rst. At somepoint we'll fit these few
    into the main IIO docs.
  - improve sampling_frequency_available docs but explaining the
    range form.
* ad_sigma_delta
  - Drop a pointless goto.
* ad2s1210
  - Drop pointless platform data null check seeing as we don't actually
    use platform data anymore.
* ad7124
  - Relax limitation on channel numbers to allow pseudo different channels.
  - Support control of whether the input is buffered via DT.
  - Use dynamic allocation for channel configuration to make it easier
    to support new devices.
  - YAML binding conversion.
* ad7150
  - Comment tidy up.
  - Consistent and simple if (ret) handling of i2c errors.
  - FIELD_GET and GENMASK.
  - Ternary rather than !!(condition) for readability.
  - Use macros to avoid repetition of channel definitions.
* ad7606
  - Add software channel config (rather that pin controlled)
  - Refactor to simplify addition of new part in future.
* ad7746
  - of_deivce_id table.
* ad7780
  - MAINTAINERS entry
  - YAML DT bindings.
* ad8366
  - Stop using core mlock in favour of well scoped local lock.
  - SPDX + copyright date update.
* ad9834
  - of_device_id table
* adf4371
  - Add support for output stage muting before lock on has occured.
* adis library
  - MAINTAINERS entry to reflect that this now Alexandru's problem ;)
* adis162xx:
  - Fix a slightly incorrect set of comments and print statements on
    minimum supported voltage.
* adis16203
  - of_device_id table.
* adis16240
  - Add of_device_id table (in two parts as first patch only used it for
    MODULE_DEVICE_TABLE.)
* adt7316-spi
  - of_device_id table
* adxl372
  - YAML DT binding conversion.
  - Cleanup use of buffer callback functions (precursor to core rework).
* bh1710
  - Simplify getting the i2c adapter from the client.
* dht11
  - Mote to newer GPIO consumer interface.
* kxcjk-1013.c
  - Add binding for sensor in display of some ultrabooks after userspace
    tools updated for it not be a problem to report two similar sensors.
* imx7d
  - drop unused variables.
  - white space
  - define instead of variable for clock frequency that is fixed.
  - drop pointless error message.
* messon_saradc
  - SPDX
* sps30
  - MAINTAINERS entry
  - YAML binding conversion.
* st_accel
  - Tidy up ordering in various buffer related callbacks. This is
    part of a long running effort to simplify the core code.
* stm32-dfsdm:
  - Manage the resolution cleanly in triggerd modes.
  - Add fast mode support which allows more flexible filter choices.
  - Add a comment on the reason for a 16 bit record when technically
    not 'required'.
* st_lsm6dsx
  - Embed device name in the sensor_settings struct as i3c doesn't
    have a convenient name field to use for this.
* xilinx-adc
  - Relax constraints on supported platforms to reflect that this
    can used with FPGAs on PCIe cards and hence many architectures.
* counters/ftm-quaddec
  - Fix some formatting io MODULE_AUTHOR
  - MAINTAINERS entry

Fixes
* tools
  - fix incorrect handling of 32 bit channels.
* sca3000
  - Potential endian bug that is unlikely to bite anyone (be64 host
    seems unlikely for this old part).
* stm32-adc
  - Add vdda-supply. On some boards it needs to be turned on to supply
    the ADC.  DT bindings included.
* stm32-dfsdm
  - Fix output resolution to work with filter orders other than 3.
  - Fix output datatype as it's signed and previously claimed not to be.

* tag 'iio-for-5.3b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (68 commits)
  iio: iio-utils: Fix possible incorrect mask calculation
  iio: frequency: adf4371: Add support for output stage mute
  dt-bindings: iio: frequency: Add ADF4372 PLL documentation
  iio: frequency: adf4371: Add support for ADF4372 PLL
  dt-bindings: iio: adc: Add buffered input property
  Convert AD7124 bindings documentation to YAML format.
  iio: adc: ad7124: Shift to dynamic allocation for channel configuration
  iio: adc: ad7124: Add buffered input support
  iio: adc: ad7124: Remove input number limitation
  MAINTAINERS: add ADIS IMU driver library entry
  iio: adis162xx: fix low-power docs & reports
  counter/ftm-quaddec: Add missing '>' in MODULE_AUTHOR
  iio: core: no need to check return value of debugfs_create functions
  docs: iio: convert to ReST
  iio: adc: stm32-adc: add missing vdda-supply
  dt-bindings: iio: adc: stm32: add missing vdda supply
  iio: adc: stm32-dfsdm: add comment for 16 bits record
  iio: adc: stm32-dfsdm: add fast mode support
  iio: adc: stm32-dfsdm: manage data resolution in trigger mode
  iio: adc: stm32-dfsdm: fix data type
  ...
2019-07-01 10:58:13 +02:00
Luís Ferreira 13c12f6930 iio: accel: add missing sensor for some 2-in-1 based ultrabooks
Some ultrabooks, like Teclast F6 Pro, use KIOX010A sensor on display
and KIOX020A sensor on keyboard base, to detect tablet mode or screen
orientation.

Signed-off-by: Luís Ferreira <luis@aurorafoss.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-06-08 12:33:36 +01:00
Thomas Gleixner 2025cf9e19 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288
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

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

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

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141901.208660670@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05 17:36:37 +02:00
Greg Kroah-Hartman bf402c08eb Second set of IIO new device support, features and cleanup for the 5.2 cycle.
New device suport
 * ad7606
   - Support the AD7616 16 channel, 12bit ADC.
 * fxas21002c
   - New driver for this gyroscope with I2C and SPI support.
 * lsm6dsx
   - Support the lsm6dsr, new device information structure and dt bindings.
 * srf04
   - Addition device IDs for mb1000, mb1010, mb1020, mb1030 and mb1040 +
     support of different required trigger pulse lengths.
 * st-accel
   - Support the ls2de12, new device info and dt bindings.
 * ti-ads8344
   - New driver for this 8 channel, 16 bit SPI ADC.
 
 Binding conversions to yaml - we have started doing these in general for IIO.
 * avia-hx711
 * bmp085
 
 Cleanups and minor fixes / additions
 * ad5758
   - Fixup for some changes between preproduction parts and final part.
 * ad7606
   - Refactor handling of oversampling to make it easy to vary between
     supported devices.
 * ad9832
   - Organise includes.
   - Clock framework to handle clocks.
 * ad9834
   - Drop unnecessary parenthesis.
 * bmc150
   - Use __func__ rather than hardcoding.
 * dummy_evgen.
   - Fix a memleak on error in probe.
 * kxcjk1013
   - Add KXCJ91008 ACPI ID as seen in the wild.
   - Use __func__ rather than hardcoding.
 * imx7d
   - Local dev variable to simplify code a bit.
   - dev_err replaces pr_err to give more info.
   - devm_platform_ioremap_resource for small reduction in boilerplate.
   - Simplify probe and remove by sharing suspend / resume logic.
   - Devm for iio_device_register as remove only contains the unregister.
 * lsm6dsx
   - Remove a variable that was never read.
   - Open code values where they are effectively described by what is assigned
     to them rather than using uninformative defines.
 * max31856
   - Avoid an unintialized ret variable in a path that can't actually occur
     but is hard for a static checker to know.
 * max9611
   - White space
 * mpu3050
   - Reduce a sleep worst case by switching from msleep to usleep_range.
 * qcom-spmi-adc5
   - Add MODULE_DEVICE_TABLE to assist autoloading of this as a module.
 * stm32-dfsdm
   - Fix missing dependencies.
 * stm32-timer trigger
   - Fix a build issue when disabled.
 * ti-ads7950
   - Fix mising dependency on CONFIG_GPIOLIB.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlzAvGYRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FoiurRAAtP0JCVyeh1y7xLhJevl7pm3YZ5vdPPNw
 VlaB0zbjH9kJM3KehdZZDxgE+5ZZ66wVCtq4quLb7/kHhHCJ97kPPT1sqdVI/sfQ
 KnwOIJ7JSC+fXxmpBWDyDMvB1NXGWHmNJHAw7SGtJa1/lVdHxPnZ5bMmdfFMadh5
 eNOX5NOxTinafp2sX8M4LPeyOCp2mV4iIUNr14rl2TZruv+xP3Y4N9RTfJDclgCI
 iuK9f6wneSFQ6it48sBE0MGX76az1WvufOEbpl9hWYDoYKl721Yc9WoP2QzTtKMb
 +3Klq/rEMyJjrzm/mu1G/hkPDgnYwsPBAb24b4qSacv70tXlwbwzTEaPu/3avb5r
 22h+fsU61nU1m0GFtNjwwe6p0bm6H3UKHjRaspfq63tEZUUZfRdapmLLTDCRZfcK
 NNRJsqgRvUcqNgR5P/1PBSK+xvp2btgTDy7SrwnrC06RBQ6XY0vq3PpjpTXygH/z
 zbLmNiufIP3k0Z0g2o2PMmHl2tF3ue8LCq4p1FyU1iV8qn7qL40+8LkkZQihDpGT
 i2sMYxexO9qHmm2/GLxrwDTOnLacw2YZRIGthwtVCB8iA1NKkfVCxi1AfasSMJYc
 t5uGmNQKIdXMV0olzflXMoXJ1pTKncTlqKicgWwDeCLUcq4XhobKSoiE5VfCWL+V
 7UBlgLznT/o=
 =McKo
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Second set of IIO new device support, features and cleanup for the 5.2 cycle.

New device suport
* ad7606
  - Support the AD7616 16 channel, 12bit ADC.
* fxas21002c
  - New driver for this gyroscope with I2C and SPI support.
* lsm6dsx
  - Support the lsm6dsr, new device information structure and dt bindings.
* srf04
  - Addition device IDs for mb1000, mb1010, mb1020, mb1030 and mb1040 +
    support of different required trigger pulse lengths.
* st-accel
  - Support the ls2de12, new device info and dt bindings.
* ti-ads8344
  - New driver for this 8 channel, 16 bit SPI ADC.

Binding conversions to yaml - we have started doing these in general for IIO.
* avia-hx711
* bmp085

Cleanups and minor fixes / additions
* ad5758
  - Fixup for some changes between preproduction parts and final part.
* ad7606
  - Refactor handling of oversampling to make it easy to vary between
    supported devices.
* ad9832
  - Organise includes.
  - Clock framework to handle clocks.
* ad9834
  - Drop unnecessary parenthesis.
* bmc150
  - Use __func__ rather than hardcoding.
* dummy_evgen.
  - Fix a memleak on error in probe.
* kxcjk1013
  - Add KXCJ91008 ACPI ID as seen in the wild.
  - Use __func__ rather than hardcoding.
* imx7d
  - Local dev variable to simplify code a bit.
  - dev_err replaces pr_err to give more info.
  - devm_platform_ioremap_resource for small reduction in boilerplate.
  - Simplify probe and remove by sharing suspend / resume logic.
  - Devm for iio_device_register as remove only contains the unregister.
* lsm6dsx
  - Remove a variable that was never read.
  - Open code values where they are effectively described by what is assigned
    to them rather than using uninformative defines.
* max31856
  - Avoid an unintialized ret variable in a path that can't actually occur
    but is hard for a static checker to know.
* max9611
  - White space
* mpu3050
  - Reduce a sleep worst case by switching from msleep to usleep_range.
* qcom-spmi-adc5
  - Add MODULE_DEVICE_TABLE to assist autoloading of this as a module.
* stm32-dfsdm
  - Fix missing dependencies.
* stm32-timer trigger
  - Fix a build issue when disabled.
* ti-ads7950
  - Fix mising dependency on CONFIG_GPIOLIB.

* tag 'iio-for-5.2b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (42 commits)
  iio: adc: qcom-spmi-adc5: Fix of-based module autoloading
  iio: dummy_evgen: fix possible memleak in evgen init
  iio:accel:Switch hardcoded function name with a reference to __func__ making the code more maintainable
  iio: adc: stm32-dfsdm: fix triggered buffer build dependency
  iio: adc: stm32-dfsdm: fix unmet direct dependencies detected
  iio: trigger: stm32-timer: fix build issue when disabled
  iio: imx7d_adc: Use devm_iio_device_register()
  iio: imx7d_adc: Simplify imx7d_adc_remove() with imx7d_adc_suspend()
  iio: imx7d_adc: Simplify imx7d_adc_probe() with imx7d_adc_resume()
  drivers/iio/gyro/mpu3050-core.c: This patch fix the following checkpatch warning.
  iio: dac: ad5758: Modifications for new revision
  iio: imu: st_lsm6dsx: inline per-sensor data
  iio: adc: Add driver for the TI ADS8344 A/DC chips
  dt-bindings: iio: adc: Add bindings for TI ADS8344 A/DC chips
  MAINTAINERS: add entry for fxas21002c gyro driver
  iio: gyro: fxas21002c: add spi driver
  iio: gyro: fxas21002c: add i2c driver
  iio: gyro: add core driver for fxas21002c
  iio: gyro: add DT bindings to fxas21002c
  Kconfig: change configuration of srf04 ultrasonic iio sensor
  ...
2019-04-25 10:50:51 +02:00
Mohan Kumar ce7afa5c56 iio:accel:Switch hardcoded function name with a reference to __func__ making the code more maintainable
It fixes the following checkpatch.pl warning:

WARNING: Prefer using '"%s...", __func__' to using function's name, in a
string

Signed-off-by: Mohan Kumar <mohankumar718@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22 11:41:35 +01:00
Greg Kroah-Hartman 817de6b859 Merge 5.1-rc6 into staging-next
We want the fixes in here as well as this resolves an iio driver merge
issue.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-21 23:18:44 +02:00
Valentin Manea 45e119e403 iio: accel: kxcjk1013: Add KIOX0008 ACPI Hardware-ID
Add the ACPI ID for KXCJ9 sensor seen on the a Teclast X80 Power
tablet.

Signed-off-by: Valentin Manea <linux-iio@mrs.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14 13:22:30 +01:00
Robert Yang 3b866fd28f iio: accel: kxcjk1013: Add device tree support
Add device tree support for kxcjk-1013 accelerometer sensors.

Signed-off-by: Robert Yang <decatf@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:52 +01:00
he, bo fe2d3df639 io: accel: kxcjk1013: restore the range after resume.
On some laptops, kxcjk1013 is powered off when system enters S3. We need
restore the range regiter during resume. Otherwise, the sensor doesn't
work properly after S3.

Signed-off-by: he, bo <bo.he@intel.com>
Signed-off-by: Chen, Hu <hu1.chen@intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-03-09 17:30:14 +00:00
Hans de Goede 7f6232e695 iio: accel: kxcjk1013: Add KIOX010A ACPI Hardware-ID
Various 2-in-1's use KIOX010A and KIOX020A as HIDs for 2 KXCJ91008
accelerometers. The KIOX010A HID is for the one in the base and the
KIOX020A for the accelerometer in the keyboard.

Since userspace does not have a way yet to deal with (or ignore) the
accelerometer in the keyboard, this commit just adds the KIOX010A HID
for now so that display rotation will work.

Related: https://github.com/hadess/iio-sensor-proxy/issues/166
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-11-25 12:35:26 +00:00
Stephan Gerhold b911b0ab0d iio: accel: kxcjk-1013: Add the "KXJ2109" ACPI HID
This HID is used on the ASUS MeMO Pad 7 (ME176C) tablet.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-11-25 09:31:27 +00:00
Hans de Goede 047a6f7db2 iio: accel: kxcjk1013: Add KIOX0009 ACPI Hardware-ID
Add KIOX0009 ACPI HID, this is used e.g. on the Acer One 10.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-10-14 18:01:40 +01:00
Michał Mirosław 1540d0106b iio: accel: kxcjk1013: add support for KXTF9
KXTF9 has mostly compatible register layout to KXCJK accelerometer.
There is no motion direction interrupt support, but there is tap
direction detection instead (not implemented in this patch).

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 20:50:06 +01:00
Michał Mirosław d2ff1956ba iio: accel: kxcjk1013: make sampling_frequency_avail per-type
Make sampling_frequency_avail per-type - like sampling_frequency is.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 20:50:03 +01:00
Michał Mirosław 81fa8cb9f8 iio: accel: kxcjk1013: make sysfs/sampling_frequency_avail dynamic
In preparation for KXTF9 support, make sampling_frequency_avail
attribute dynamic.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 20:50:01 +01:00
Michał Mirosław d8408e98f5 iio: accel: kxcjk1013: extract report_motion_event() from interrupt handler
Extract reporting of motion event direction from interrupt handler,
as it is not supported by KXTF9.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 20:49:58 +01:00
Michał Mirosław f74e440c81 iio: accel: kxcjk1013: fix INT_CTRL/INT_SRC1 bit names
Fix INT_CTRL1 bit names to match register name and add names
for INT_SRC1 bits.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 20:49:55 +01:00
Michał Mirosław 7469ac69db iio: accel: kxcjk1003: refactor ODR setting
Refactor ODR/WUF setting code in preparation of KXTF9 support.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 20:49:51 +01:00
Jonathan Cameron 6c5bffa80e iio:accel: drop assign iio_info.driver_module and iio_trigger_ops.owner
The equivalent of both of these are now done via macro magic when
the relevant register calls are made.  The actual structure
elements will shortly go away.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-08-22 21:22:40 +01:00
Christophe Chapuis 4d19c48755 iio: accel: kxcjk-1013: add the "KIOX000A" ACPI id
On the Cube i9 tablet, the ACPI id for the Kionix kxcj9 accelerometer is
"KIOX000A" (as can be seen in the DSDT of the Cube i9 tablet).
It is the same accelerometer, so only adding the ACPI id is needed.

Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-24 19:58:40 +01:00
Gregor Boirie bc2b7dab62 iio:core: timestamping clock selection support
Adds a new per-device sysfs attribute "current_timestamp_clock" to allow
userspace to select a particular POSIX clock for buffered samples and
events timestamping.

Following clocks, as listed in clock_gettime(2), are supported:
CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW,
CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and
CLOCK_TAI.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Acked-by: Sanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-30 19:41:38 +01:00
Irina Tirdea b1532909de iio: remove unused gpio consumer.h include
GPIO handling code has been removed from the drivers (since
this is now handled by the ACPI core) in commit 0f0796509c ("iio:
remove gpio interrupt probing from drivers that use a single interrupt").

Remove the include for linux/gpio/consumer.h since it is no longer
used.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03 10:27:47 +01:00
Adriana Reus 65ae47b0ec iio: accel: kxcjk-1013: optimize i2c transfers in trigger handler
Some i2c busses (e.g.: Synopsys DesignWare I2C adapter) need to
enable/disable the bus at each i2c transfer and must wait for
the enable/disable to happen before sending the data.

When reading data in the trigger handler, the kxcjk-1013 accel driver
does one i2c transfer for each axis. This has an impact on the
frequency of the accelerometer at high sample rates due to additional
delays introduced by the i2c bus at each transfer.

Reading all axis values in one i2c transfer reduces the delays
introduced by the i2c bus. Uses i2c_smbus_read_i2c_block_data_or_emulated
that will fallback to reading each axis as a separate word in case i2c
block read is not supported.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03 10:27:46 +01:00
Adriana Reus 09cf1b321a iio: accel: kxcjk-1013: use available_scan_masks
Use available_scan_masks to allow the iio core to select
the data to send to userspace depending on which axes are
enabled, instead of doing this in the driver's interrupt
handler.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03 10:27:45 +01:00
Adriana Reus 7d0ead5c3f iio: Reconcile operation order between iio_register/unregister and pm functions
At probe, runtime pm should be setup before registering the sysfs interface so
that all the power attributes are accurate and functional when registering.
Also, when removing the device we should unregister first to make sure
that the interfaces that may result in wakeups are no longer available.

Fix this behaviour for the following drivers: bmc150, bmg160, kmx61,
kxcj-1013, mma9551, mma9553, rpr0521.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-11-08 15:36:53 +00:00
Octavian Purdila 0f0796509c iio: remove gpio interrupt probing from drivers that use a single interrupt
Commit 845c877009 ("i2c / ACPI: Assign IRQ for devices that have
GpioInt automatically") automatically assigns the first ACPI GPIO
interrupt in client->irq, so we can remove the probing code from
drivers that use only one interrupt.

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-03 12:05:51 +01:00
Octavian Purdila c176becd81 iio: fix drivers that consider 0 as a valid IRQ in client->irq
Since patch "i2c / ACPI: Use 0 to indicate that device does not have
interrupt assigned" [1], 0 is not a valid i2c client irq anymore, so
change all driver's checks accordingly.

The same issue occurs when the device is instantiated via device tree
with no IRQ, or from the i2c sysfs interface, even before the patch
above.

[1] http://lkml.kernel.org/g/<1430908148-201129-3-git-send-email-mika.westerberg@linux.intel.com>

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-23 20:23:11 +01:00
Ana Calinov e23fd9812f iio: accel: kxcjk-1013: Remove blank lines
This patch fixes the the following errors given by
checkpatch.pl with --strict:
Please don't use multiple blank lines.
Blank lines aren't necessary after an open brace '{'.

Signed-off-by: Ana Calinov <ana.calinov@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-11 18:26:28 +01:00
Antonio Ospite e693e15e86 iio: accel: kxcjk-1013: add some blank lines for readability
Some extra blank lines between if checks don't hurt and improve
readability.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: Bastien Nocera <hadess@hadess.net>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-07 10:42:31 +01:00
Antonio Ospite 61e2c70da9 iio: accel: kxcjk-1013: add the "KXCJ9000" ACPI id
This id has been seen in the DSDT of the Teclast X98 Air 3G tablet based
on Intel Bay Trail.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: Bastien Nocera <hadess@hadess.net>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-07 10:42:31 +01:00
Vlad Dogaru a25691c1f9 iio: accel: kxcjk1013: allow using an external trigger
In its present state, the driver mandates that its buffer only be
triggered by one of the device's own triggers (data ready or any
motion).  This is not always desirable, for example because the
interrupt pins may not be wired in.

Patch the driver to be able to accept using an external trigger, such as
one based on hrtimer.  When using such a trigger, we need to ensure that
the device is powered on when the buffer is started.  We do that by
setting setup_ops for the buffer.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-09 14:20:02 +01:00
Greg Kroah-Hartman c610f7f772 Merge 4.0-rc7 into staging-next
We want those fixes (iio primarily) into the -next branch to help with
merge and testing issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-07 11:03:02 +02:00
Octavian Purdila 70dddeee89 iio: fix drivers that check buffer->scan_mask
If the in-kernel push interface is used we may have a different masks
on the device buffer and the kernel buffer and in this case the device
should generate data for the reunion of the buffers, which is
available at indio_dev->active_scan_mask.

Compiled tested only except for bmc150-accel which was tested at
runtime with the hardware.

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-03-07 19:17:07 +00:00
Uwe Kleine-König b457f53a2a iio: improve usage of gpiod API
Since 39b2bbe3d7 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for
outputs.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-02-22 09:49:22 +00:00
Greg Kroah-Hartman 6e49557b31 First round of IIO new drivers, cleanups and functionality for the 3.20 cycle take 2
Updated pull request with Daniel's fix on top for the power management
 Kconfig changes that had snuck in since last update of the IIO tree
 worked it's way through from mainline.
 
 Original pull message
 
 New device support
 * jsa1212 proxmity / ambient light sensor
 * SM08500 supported added to the kxcjk-1013 accelerometer driver
 * KMX61 Accelerometer/Magnetometer.  This took a somewhat rocky path
   being first merged, then reverted for a rewrite after a discussion of
   how to support additional functionality and finally being merged prior
   to some last reviews coming in, with resultant follow up patches.
 * Freescale mma9551l driver (minor follow up warning supression patch).
 * Semtech SX9500 proximity device driver.
 * ak8975 gains support for ak09911 and ak09912 and drop the standalone driver
   for the ak09911.
 
 New functionality
  * Dummy driver gains some virtual registers making it more flexible.
  * IIO_ACTIVITY channel types, with modifiers running, walking etc.  This is
    to support on chip motion clasifiers.  As such it is in the form of a
    confidence percentage.  The only devices so far only do binary decisions
    but this gives us room when other devices give more nuanced clasification.
  * IIO_EV_DIR_NONE type for events where there is no obvious direction.
    First case is step detection.
  * IIO_STEPS channel type for pedometers.
  * ENABLE mask element used to control turning on counting types such as
    the pedometer that need a 'start point'.
  * INSTANCE event type to support things that happen once.
  * info element for height calibration (used in various motion estimation
    algorithms). Note heigh tof use
  * dummy driver demonstration of the use of all the new bits above.
  * event monitor support for the new events.
  * inv_mpu6050 gains an i2c mux to allow bypassing the device to access
    additional devices connected on the other side of it.  Note that in
    Windows these are handled by firmware on the device and not exposed
    directly.
  * inv_mpu6050 gains ACPI enumeration.
  * inkern interface gains iio_write_channel_raw to allow in kernel users
    of DAC functionality via a simple wrapper.
  * Document input current readings in the ABI docs.
  * Add an error message when we get an out of range error in device tree
    processing for the in kernel interfaces.  Basically a device tree debugging
    aid.
  * Add a sanity check that a scan index for a channel is unique during
    registration.  There to help catch bugs as this should never happen
    in a bug free driver.
 
 Cleanups and fixlets
 
  A rework of buffer registration from Lars - a precursor to some other
  upcoming new stuff (a few patches from others rolled in here as well).
  * Ensure all drivers register the same channels for the device and buffer.
  * Move buffer registration into the core rather than using the old
    two step approach.  Now we have simple ways of using a unified set channels
    for both without requiring channels be exposed by both interface, this
    removes a fair bit of boilerplate.
  * Stop sca3000 and ad5933 (both in staging) enabling buffer channels by
    default. It has long be convention in IIO to startup with no channels
    enabled and leave it up to userspace to say what goes in the buffer.
    Getting rid of these allows us to drop export of iio_scan_mask_set.
  * Drop get_bytes_per_datum from iio_buffer_access_funcs as not been used
    for a while.
  * Allocate standard buffer attributes in the core rather than in every
    driver with a buffer.
  * Make the length attribute read only when a driver is not able to set
    the length.
  * Drop the get_length callback for buffers as it is already available in
    struct iio_buffer.
  * Drop an unused arguement form iio_kfifo_allocate and add devm allocator
    for it.
  * some kconfig entries gain anotation with the resulting module name.
  * Fix a resulting compile issue in dummy driver due to a stub taking
    wrong parameters as a result of the above rework.
  * Fix an off by 2 error in copying the core assigned buffer attributes.
 
 Other cleanups,
  * Trivial space before comma fixups.
  * ak8975 fixlets - none critical.  Rework to allow more device support.
  * Drop unnecessary sizeof(u8) calls.
  * bmp280 - refactor the compensation code to reduce copy operations and
    code length.  A second patch futher optimized this and performed some
    other minor cleanups.
  * kxcjk-1013 - various power control cleanups to avoid unnecessary enable
    / disable of device.  Make sure it is only controlled at all if CONFIG_PM
    is enabled.  Also som cleanups of error paths.
  * Small cleanups in adf4530 driver - pointless message and unnecessary braces.
  * Clarifiy the proximity ABI docs to make it clear it should get bigger
    as we move futher away.
  * Drop a misleading comment form industrialio-core.c
  * Trivial white space cleanups.
  * sca3000 looses an unused debug function.
  * Fix char unsigned ordering in ad8366
  * Increase the sleep time in ad9523 to make it predictable (value didn't
    really matter so make it more than 20 msecs)
  * mxs-lradc touchscreen property cleanups in device tree are fixed to ensure
    the meet all the 'interesting' documentation.
  * A couple of cleanups for the staging ad5933 driver to avoid unnecessary
    conversion to a processed temperature vlaue in kernel and remove
    platform data form the state structure as not needed after probe.
  * Fix a wrong scale factor in the docs.
 
 Misc
  * Add IIO include files to the maintainers entry.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJUvtDlAAoJEFSFNJnE9BaIaNMQAI9ZYOrOmvSpxPV4ab71it9z
 gi03VG8+iJl0dPgwcSHeFZvSDiNAOWSX/XdWLoxFAdpjpsnytIp01s9+c3ogz58j
 pYbjxuOT2Qcf+36REuaFkQPFV2ppXMvwDwFUUNeFVupu+bVUKeZuNafBDp00aN1c
 o4MPDwoS1EcTHL+77iCg06exL8LozOwLabfUTRVIRkhIqikemghcmubQHH06m+dk
 EMddtNcXTVR4cJLX076nkKsNDHgmfoBYL9Hy/OvQbjWYAxoZg+q90ZX8yCy0Z5oW
 otChj5XpoYRIa7X6xvP5kTebD4iiR/COWer83EyqFosXhmQ/27rWasST42j1K3q/
 mU40skbscDef4F6COMlgBtVh1FhKUm9AHPAGk5swW792Qjpd4xdt+GShU5bJCa4O
 OOZYk8ulraELeWVz2IK+CrOvJYeTSrNQR6VA6sBjWRHeqxtB0yOJkhxX9NUcSIgJ
 GwM8qNTrQUkvI7OGvFGvf8hp9cboJTKEfzC+yspj+OJSjgJgNWw2pOjzJjsexxaL
 nT2rKhPg46hC+FR4IvPPjhGihCtMSgBWkwbHSeXH+TgRfbbTUh6y6sqEUZraVhnQ
 LKde54G0aH1XBFIM6fwWIPgdWBWsI3b3pFuBRMzhORdcCuAUOvDSyc5hVcaA8qb5
 UZghapUruB556xjoMV3n
 =LlJD
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-3.20a_take2' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-testing

Jonathan writes:

First round of IIO new drivers, cleanups and functionality for the 3.20 cycle take 2

Updated pull request with Daniel's fix on top for the power management
Kconfig changes that had snuck in since last update of the IIO tree
worked it's way through from mainline.

Original pull message

New device support
* jsa1212 proxmity / ambient light sensor
* SM08500 supported added to the kxcjk-1013 accelerometer driver
* KMX61 Accelerometer/Magnetometer.  This took a somewhat rocky path
  being first merged, then reverted for a rewrite after a discussion of
  how to support additional functionality and finally being merged prior
  to some last reviews coming in, with resultant follow up patches.
* Freescale mma9551l driver (minor follow up warning supression patch).
* Semtech SX9500 proximity device driver.
* ak8975 gains support for ak09911 and ak09912 and drop the standalone driver
  for the ak09911.

New functionality
 * Dummy driver gains some virtual registers making it more flexible.
 * IIO_ACTIVITY channel types, with modifiers running, walking etc.  This is
   to support on chip motion clasifiers.  As such it is in the form of a
   confidence percentage.  The only devices so far only do binary decisions
   but this gives us room when other devices give more nuanced clasification.
 * IIO_EV_DIR_NONE type for events where there is no obvious direction.
   First case is step detection.
 * IIO_STEPS channel type for pedometers.
 * ENABLE mask element used to control turning on counting types such as
   the pedometer that need a 'start point'.
 * INSTANCE event type to support things that happen once.
 * info element for height calibration (used in various motion estimation
   algorithms). Note heigh tof use
 * dummy driver demonstration of the use of all the new bits above.
 * event monitor support for the new events.
 * inv_mpu6050 gains an i2c mux to allow bypassing the device to access
   additional devices connected on the other side of it.  Note that in
   Windows these are handled by firmware on the device and not exposed
   directly.
 * inv_mpu6050 gains ACPI enumeration.
 * inkern interface gains iio_write_channel_raw to allow in kernel users
   of DAC functionality via a simple wrapper.
 * Document input current readings in the ABI docs.
 * Add an error message when we get an out of range error in device tree
   processing for the in kernel interfaces.  Basically a device tree debugging
   aid.
 * Add a sanity check that a scan index for a channel is unique during
   registration.  There to help catch bugs as this should never happen
   in a bug free driver.

Cleanups and fixlets

 A rework of buffer registration from Lars - a precursor to some other
 upcoming new stuff (a few patches from others rolled in here as well).
 * Ensure all drivers register the same channels for the device and buffer.
 * Move buffer registration into the core rather than using the old
   two step approach.  Now we have simple ways of using a unified set channels
   for both without requiring channels be exposed by both interface, this
   removes a fair bit of boilerplate.
 * Stop sca3000 and ad5933 (both in staging) enabling buffer channels by
   default. It has long be convention in IIO to startup with no channels
   enabled and leave it up to userspace to say what goes in the buffer.
   Getting rid of these allows us to drop export of iio_scan_mask_set.
 * Drop get_bytes_per_datum from iio_buffer_access_funcs as not been used
   for a while.
 * Allocate standard buffer attributes in the core rather than in every
   driver with a buffer.
 * Make the length attribute read only when a driver is not able to set
   the length.
 * Drop the get_length callback for buffers as it is already available in
   struct iio_buffer.
 * Drop an unused arguement form iio_kfifo_allocate and add devm allocator
   for it.
 * some kconfig entries gain anotation with the resulting module name.
 * Fix a resulting compile issue in dummy driver due to a stub taking
   wrong parameters as a result of the above rework.
 * Fix an off by 2 error in copying the core assigned buffer attributes.

Other cleanups,
 * Trivial space before comma fixups.
 * ak8975 fixlets - none critical.  Rework to allow more device support.
 * Drop unnecessary sizeof(u8) calls.
 * bmp280 - refactor the compensation code to reduce copy operations and
   code length.  A second patch futher optimized this and performed some
   other minor cleanups.
 * kxcjk-1013 - various power control cleanups to avoid unnecessary enable
   / disable of device.  Make sure it is only controlled at all if CONFIG_PM
   is enabled.  Also som cleanups of error paths.
 * Small cleanups in adf4530 driver - pointless message and unnecessary braces.
 * Clarifiy the proximity ABI docs to make it clear it should get bigger
   as we move futher away.
 * Drop a misleading comment form industrialio-core.c
 * Trivial white space cleanups.
 * sca3000 looses an unused debug function.
 * Fix char unsigned ordering in ad8366
 * Increase the sleep time in ad9523 to make it predictable (value didn't
   really matter so make it more than 20 msecs)
 * mxs-lradc touchscreen property cleanups in device tree are fixed to ensure
   the meet all the 'interesting' documentation.
 * A couple of cleanups for the staging ad5933 driver to avoid unnecessary
   conversion to a processed temperature vlaue in kernel and remove
   platform data form the state structure as not needed after probe.
 * Fix a wrong scale factor in the docs.

Misc
 * Add IIO include files to the maintainers entry.
2015-01-21 10:13:37 +08:00
Roberta Dobrescu b0868df433 iio: accel: kxcjk-1013: Add a blank line after declarations
This patch fixes the following checkpatch.pl warning:
WARNING: Missing a blank line after declarations

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-01 12:11:09 +00:00
Irina Tirdea 9d02daf738 iio: accel: kxcjk-1013: power off device if probe fails
When the device is initialized in probe, it is also powered on.
If there is an error after the initialization, the device will
remain powered on.

Power off the device in case probe fails after device initialization.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Suggested-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:35 +00:00
Irina Tirdea fbd123e913 iio: accel: kxcjk-1013: error handling when set mode fails
If there is an error in set mode at runtime resume, reset the state of
the runtime usage count.

If there is an error in set mode at runtime suspend, make sure the framework
retries to suspend the device.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:35 +00:00
Irina Tirdea c75b8dc84f iio: accel: kxcjk-1013: only set power state if CONFIG_PM is defined
When CONFIG_PM is not defined and the driver tries to power off the device,
kxcjk1013_set_power_state will call pm_runtime_put_autosuspend, which is
not implemented (wil return -ENOSYS).

Only call pm_runtime calls to change power state  when CONFIG_PM is defined.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:27 +00:00
Irina Tirdea d3653d0989 iio: accel: kxcjk-1013: always power on device in resume
When the system resumes, it will first call system resume and
then runtime suspend (if CONFIG_RUNTIME_PM is enabled).
There is no need to conditionally power on the device in
system resume, so always power it on and leave runtime
suspend to power it off if needed.

Suggested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:26 +00:00
Rafael J. Wysocki e3d857e1ae Merge branch 'pm-runtime'
* pm-runtime: (25 commits)
  i2c-omap / PM: Drop CONFIG_PM_RUNTIME from i2c-omap.c
  dmaengine / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  drivers: sh / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  e1000e / igb / PM: Eliminate CONFIG_PM_RUNTIME
  MMC / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  MFD / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  misc / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  media / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  input / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  iio / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  hsi / OMAP / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  i2c-hid / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  drm / exynos / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  gpio / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  hwrandom / exynos / PM: Use CONFIG_PM in #ifdef
  block / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  USB / PM: Drop CONFIG_PM_RUNTIME from the USB core
  PM: Merge the SET*_RUNTIME_PM_OPS() macros
  PM / Kconfig: Do not select PM directly from Kconfig files
  PCI / PM: Drop CONFIG_PM_RUNTIME from the PCI core
  ...
2014-12-08 20:00:44 +01:00
Rafael J. Wysocki 6f0a13f25e iio / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
After commit b2b49ccbdd (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks
depending on CONFIG_PM_RUNTIME may now be changed to depend on
CONFIG_PM.

Replace CONFIG_PM_RUNTIME with CONFIG_PM everywhere under
drivers/iio/.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2014-12-04 01:08:13 +01:00
Daniel Baluta e90dea6aaf iio: accel: kxcjk-1013: Fix kxcjk10013_set_range
Currently, we get the new GSEL bits by OR-ing the old values
with the new ones. This only works first time when the old
values are 0.

Startup:
	* GSEL0 = 0, GSEL1 = 0

Set range to 4G: (GSEL0 = 1, GSEL1 = 0)
	* GSEL0 = 0 | 1 = 1
	* GSEL1 = 0 | 0 = 0
	* correct

Change range to 2G: (GSEL0 = 0, GSEL1 = 0)
	* GSEL0 = 1 | 0 = 1
	* GSEL1 = 0 | 0 = 0
	* wrong, GSEL0 should be 0

This has the nice effect that we can use the full scale range,
exported in in_accel_scale_available.

Fixes: a735e3d7f0 (iio: accel: kxcjk-1013: Set adjustable range)
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-15 16:11:28 +00:00
Bastien Nocera 3bfa74f860 iio:kxcjk-1013: Add support for SMO8500 device
The Onda v975w tablet contains an accelerometer that's advertised over
ACPI as SMO8500. This device is however a KXCJ9 accelerometer as
can be seen in the Windows driver's INF file, and from the etching on
the chipset ("KXCJ9 41566 0414").

This patch also removes the attempt to get the IRQ for the "data ready"
signal, as it does not seem to be supported by this device on this
platform.

Signed-off-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-08 12:40:53 +00:00
Daniel Baluta 25afffe16d io: accel: kxcjk-1013: Fix iio_event_spec direction
Because IIO_EV_DIR_* are not bitmasks but enums,
IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING is not equal
with IIO_EV_DIR_EITHER.

This could lead to potential misformatted sysfs attributes
like:
	* in_accel_x_thresh_(null)_en
	* in_accel_x_thresh_(null)_period
	* in_accel_x_thresh_(null)_value

or even memory corruption.

Fixes: b4b491c083 (iio: accel: kxcjk-1013: Support threshold)
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-05 18:33:46 +00:00
Daniel Baluta c9bf2373da iio: accel: kxcjk-1013: Fix defined but unused warning
Noticed when compiling with CONFIG_PM_RUNTIME not set:
kxcjk-1013.c: warning: ‘kxcjk1013_get_startup_times’ defined but not used [-Wunused-function]

Introduced by commit 124e1b1d (iio: accel: kxcjk-1013: support runtime pm).

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-09-14 18:33:23 +01:00