Commit graph

678130 commits

Author SHA1 Message Date
Benjamin Gaignard
d89e119a08 iio: add hardware triggered operating mode
Devices, like stm32 timer, could be triggered by hardware events which
are not buffer or software events. However it could be necessary to
validate the triggers like it is done for buffer or event triggered modes.
This patch add a new INDIO_HARDWARE_TRIGGERED operating mode for this
kind of devices and allow this mode to register trigger consumer.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:58:41 +01:00
Arvind Yadav
4e36a8ad4d iio: Aspeed ADC - Handle return value of clk_prepare_enable
clk_prepare_enable() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Rick Altherr <raltherr@google.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:08:20 +01:00
Hans de Goede
440d303c77 Revert "iio: accel: bma180: Add support for BMA250E"
This reverts commit f1320b0951.

The BMA250E is already handled by the bmc150-accel-i2c driver, which
supports the "E" variants of the BMA??? accelerometers better then the
bma180 driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:41 +01:00
Hans de Goede
49dce0f486 Revert "iio: accel: bma180: Add ACPI enumeration support for BMA250E"
This reverts commit 5333e88661.

The BMA250E is already handled by the bmc150-accel-i2c driver, which
supports the "E" variants of the BMA??? accelerometers better then the
bma180 driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:40 +01:00
Lorenzo Bianconi
c83761ff0a iio: magnetometer: st_magn_spi: fix spi_device_id table
Remove LSM303DLHC, LSM303DLM from st_magn_id_table since LSM303DL series
does not support spi interface

Fixes: 872e79add7 (iio: magn: Add STMicroelectronics magn driver)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:40 +01:00
Lorenzo Bianconi
93b1b02fae iio: accel: st_accel_spi: fix spi_device_id table
Remove LSM303DL, LSM303DLM, LSM303DLH, LSM303DLHC from st_accel_id_table
since LSM303DL series does not support spi interface

Fixes: d62511689d (iio: accel: Add STMicroelectronics accel driver)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:39 +01:00
Jean-Baptiste Maneyrol
8a12ed7df7 iio: imu: inv_mpu6050: replace sprintf with scnprintf
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:38 +01:00
Jean-Baptiste Maneyrol
68cd6e5b20 iio: imu: inv_mpu6050: fix lock issues by using our own mutex
There are several locks issues when using buffer and direct polling
data at the same time. Use our own mutex for managing locking and
block simultaneous use of buffer and direct polling by using
iio_device_{claim/release}_direct_mode. This makes chip_config
enable bit obsolete, so delete it.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:37 +01:00
Lorenzo Bianconi
e8ee2b67bd dt-bindings: iio: imu: st_lsm6dsx: support active-low interrupts
Update st_lsm6dsx device binding with active-low interrupts support
(IRQ_TYPE_LEVEL_LOW and IRQ_TYPE_EDGE_FALLING).

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:37 +01:00
Lorenzo Bianconi
89ca88a7cd iio: imu: st_lsm6dsx: support active-low interrupts
Add support for active low interrupts (IRQF_TRIGGER_LOW and
IRQF_TRIGGER_FALLING). Configure the device as active high or low
according to the requested irq line.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:36 +01:00
Andy Shevchenko
405570b4a5 iio: adc: ad7791: Use sysfs_match_string() helper
Use sysfs_match_string() helper instead of open coded variant.

Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:35 +01:00
Andy Shevchenko
02e9a0ff0d iio: core: Use __sysfs_match_string() helper
Use __sysfs_match_string() helper instead of open coded variant.

Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:34 +01:00
Andy Shevchenko
c306dbd88c iio: proximity: sx9500: Use devm_gpiod_get()
Since index is always 0 replace devm_gpiod_get_index() by devm_gpiod_get().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:34 +01:00
Sebastian Reichel
7af1a06776 iio: adc: twl4030: Fold twl4030-madc.h into driver
twl4030-madc.h is no longer used by anything outside of
the iio driver, so it can be merged into the driver.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:33 +01:00
Sebastian Reichel
842eb60b04 iio: adc: twl4030: Remove twl4030_madc_request.func_cb
This functionality is not used by the IIO subsystem. Due
to removal of legacy API it can also be removed.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:32 +01:00
Sebastian Reichel
1adf5a3c0d iio: adc: twl4030: Drop struct twl4030_madc_user_parms
This struct is no longer used by anything in the kernel.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:32 +01:00
Sebastian Reichel
42ab9278eb iio: adc: twl4030: Unexport twl4030_madc_conversion()
All madc users have been converted to IIO API, so drop the
legacy API. The function is still used inside of the driver.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:31 +01:00
Sebastian Reichel
6576ff740f iio: adc: twl4030: Drop twl4030_get_madc_conversion()
Drop legacy twl4030_get_madc_conversion() method. It has been
used by drivers to get madc data before it conversion to IIO
API. There are no users in the mainline kernel anymore.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:30 +01:00
Fabrice Gasnier
95e339b6e8 iio: adc: stm32: add support for STM32H7
Add support for STM32H7 Analog to Digital Converter. It has up
to 20 external channels, resolution ranges from 8 to 16bits.
Either bus or asynchronous adc clock may be used.

Add registers & bitfields definition. Also add new configuration
options to enter/exit powerdown and perform self-calibration.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:29 +01:00
Fabrice Gasnier
204a6a25db iio: adc: stm32: make per instance bus clock optional
STM32F4 requires one clock per ADC instance for register access. But,
newer version of ADC hardware block have common bus clock for all
instances (per instance driver isn't responsible for getting it).
So, make it optional by default. Still, enforce it's required on STM32F4.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:26 +01:00
Fabrice Gasnier
64ad7f6438 iio: adc: stm32: introduce compatible data cfg
Prepare support for stm32h7 adc variant by introducing compatible
configuration data.
Move STM32F4 specific stuff to compatible data structure:
- registers & bit fields
- input channels data
- start/stop procedures
- trigger definitions

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:25 +01:00
Fabrice Gasnier
9fd243c4fb iio: adc: stm32: make core adc clock optional by default
Analog clock input is mandatory on stm32f4. But newer version of
ADC hardware block allow to select either bus clock or asynchronous
clock, for analog circuitry.

So, make it optional by default, but enforce clk presence on stm32f4.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:24 +01:00
Fabrice Gasnier
aaf0ceb3c0 dt-bindings: iio: stm32-adc: add support for STM32H7
Document support for STM32H7 Analog to Digital Converter.
Main difference is regarding compatible, clock definitions and new
features like differential channels support:
STM32H7 ADC block has two clock inputs, common clock for all ADCs.
One 'bus' clock for registers access, and one optional 'adc' clock
for analog circuitry (bus clock may be used for conversions).

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:10 +01:00
Stefan Brüns
18edac2e22 iio: adc: Fix integration time/averaging for INA219/220
INA226/230/231 has integration times per voltage channel and common
averaging setting for both channels, while the INA219/220 only has a
combined integration time/averaging setting per channel.
Only expose the averaging attribute for the INA226, and expose the correct
integration times for the INA219.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03 10:01:57 +01:00
Paolo Cretaro
6b503b216d iio: adc: meson-saradc: use NULL instead of 0 for pointer
Fix sparse warning: Using plain integer as NULL pointer

Signed-off-by: Paolo Cretaro <paolocretaro@gmail.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03 09:55:26 +01:00
Arvind Yadav
42d97ac6a8 iio:adc:lpc32xx Handle return value of clk_prepare_enable
clk_prepare_enable() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03 09:55:25 +01:00
Paolo Cretaro
f4f93bf77d iio: adc: mxs-lradc: fix non-static symbol warnings
Fix sparse warning "symbol foo was not declared. Should it be static?"
for the following symbols:
mx23_lradc_adc_irq_names
mx28_lradc_adc_irq_names
iio_dev_attr_in_voltage0_scale_available
iio_dev_attr_in_voltage1_scale_available
iio_dev_attr_in_voltage2_scale_available
iio_dev_attr_in_voltage3_scale_available
iio_dev_attr_in_voltage4_scale_available
iio_dev_attr_in_voltage5_scale_available
iio_dev_attr_in_voltage6_scale_available
iio_dev_attr_in_voltage7_scale_available
iio_dev_attr_in_voltage10_scale_available
iio_dev_attr_in_voltage11_scale_available
iio_dev_attr_in_voltage12_scale_available
iio_dev_attr_in_voltage13_scale_available
iio_dev_attr_in_voltage14_scale_available
iio_dev_attr_in_voltage15_scale_available

Signed-off-by: Paolo Cretaro <paolocretaro@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03 09:55:25 +01:00
Jonathan Cameron
e18788afeb Revert "iio: hi8435: cleanup reset gpio"
This reverts commit 61305664a5.

This commit was applied prematurely and will break some existing
situations where the signal is inverted as part of voltage level
conversions.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03 09:55:24 +01:00
Arvind Yadav
0a178fd732 iio: adc: xilinx: Handle return value of clk_prepare_enable
clk_prepare_enable() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03 09:55:23 +01:00
Wolfram Sang
ec183bf8b5 iio: use proper name for the R-Car SoC
It is 'R-Car', not 'RCar'. No code or binding changes, only descriptive text.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03 09:54:57 +01:00
Stefan Brüns
84b84dc19b iio: adc: ina2xx: Make use of attribute flags consistent on all channels
Flags for shared channel attributes should be set on all channels of a
channel set. I.e. SAMP_FREQUENCY and OVERSAMPLING_RATIO are set on the
in_voltage{0,1} channels, thus should be set on in_power, in_current.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03 08:43:20 +01:00
Nikita Yushchenko
f06a0d2c88 iio: hi8435: remote ampersands from hi8435_info definition
C syntax allows apersands when initializing structures fields with
function pointers, but in Linux sources ampersands are normally not used
in thix context.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03 08:43:19 +01:00
Tony Lindgren
9d965236fe iio: adc: cpcap: Remove hung interrupt quirk
This is no longer needed as the real problem was interrupt flags
not getting passed properly from device tree to the cpcap-core.c
mfd driver. This got fixed with commit ac89473213 ("mfd: cpcap:
Fix interrupt to use level interrupt") So let's remove ADC
interrupt specific the quirk.

Cc: Marcel Partap <mpartap@gmx.net>
Cc: Michael Scott <michael.scott@linaro.org>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03 08:43:17 +01:00
Tony Lindgren
951d21de88 iio: adc: cpcap: Fix die temperature
It seems that "MC13783 Power Management and Audio Ciruit User's Guide"
MC1378UG.pdf documents several similar components as in the CPCAP PMIC.

Chapter "9.5.5 Die Temperature and UID" says that the die temperature
value is 282 at 25C with LSB of -1.14C. Converting CPCAP PMIC channel3
values with following seems to produce values that make sense for a
PMIC die:

temperature = 25000 + ((regval - 282) * 114)

As we don't have any other documentation, let's assume the die
temperature is unconfigured in the Motorola mapphone Linux kernel
and the current temperature conversion table should be only used
for the battery thermistor and not for the die temperature.

Cc: Marcel Partap <mpartap@gmx.net>
Cc: Michael Scott <michael.scott@linaro.org>
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03 08:43:16 +01:00
Tony Lindgren
3f9f3a1a14 iio: adc: cpcap: Fix default register values and battery temperature
Looking at the register dumps from Android kernel on droid 4, I noticed
the values with the mainline kernel don't match. Let's fix this by
initializing the ADC registers to what Android does.

For getting correct values from the battery thermistor, we need to
toggle the CPCAP_BIT_THERMBIAS_EN when measuring battery temperature
to get correct battery temperatures. And looks like we also need to
wait a little bit before reading the battery temperature as otherwise
the results are inaccurate.

Cc: Marcel Partap <mpartap@gmx.net>
Cc: Michael Scott <michael.scott@linaro.org>
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03 08:43:15 +01:00
Stefan Wahren
57d14635f9 staging: vchiq_core: Replace remaining BUG_ON with WARN_ON
This replaces all remaining BUG_ON with WARN_ON. So in case of
a VCHIQ bug the system is still usable.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:13 +02:00
Stefan Wahren
d1eab9dec6 staging: vchiq_core: Bail out in case of invalid tx_pos
Properly handle the error case in case of an invalid tx_pos.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:13 +02:00
Stefan Wahren
6f2370d260 staging: vchiq_core: Don't BUG if process is unexpected
Bail out properly if the process index doesn't match the remote insert.
We also drop the BUG in case the process index is at local insert,
so we can trigger the WARN_ON again some steps later.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:13 +02:00
Stefan Wahren
5d1a94bb28 staging: vchiq_core: Bail out if ref_count is unexpected
If the ref counter of service has an unexpected value then we better
bail out.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:13 +02:00
Stefan Wahren
6b8db0bce3 staging: vchiq_core: Bail out if service is NULL
In the unlikely case that service is NULL we should bail out instead
of calling BUG_ON(). The other BUG_ON calls will be fixed in separate
patches.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:13 +02:00
Stefan Wahren
00b9d0f560 staging: vchiq_core: Don't BUG if sending RESUME fails
VCHIQ suspend and resume isn't implemented, but even it was
there is no need to call BUG().

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:13 +02:00
Stefan Wahren
359afaccd9 staging: vchiq_core: Bailout if VCHIQ state is already initialized
In case VCHIQ state is already initialized we need to bailout
in order to aovid a memory leak.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:04:12 +02:00
Stefan Wahren
7c35c6af0c staging: vchiq_core: Simplify VCHIQ init
Since the ARM side of VCHIQ support only 1 state, we could simplify
the init code. This makes it possible to avoid BUG_ON and a theoretical
overflow of id.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:30 +02:00
Stefan Wahren
244156ca90 staging: vchiq_2835_arm: Use PAGE_MASK macro
Use the PAGE_MASK instead of open code it.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:30 +02:00
Stefan Wahren
025f69ade9 staging: vchiq_2835_arm: Handle vmalloc_to_page error case
In case vmalloc_to_page returns NULL create_pagelist must abort
imediatly.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:30 +02:00
Stefan Wahren
804980adb9 staging: vchiq_2835_arm: Fix function name cleaup_pagelistinfo
Assuming the intension of the function is to clean up, so fix the function
name accordingly.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:29 +02:00
Stefan Wahren
b322396ce8 staging: vchiq_arm: Avoid multiline dereference
Reduce the indentation within vchiq_dump_service_use_state in order
to avoid a multiline derefernce.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:29 +02:00
Stefan Wahren
42a6bd8f77 staging: vchiq_arm: Fix variable names in comment
This comment was apparently forgotten in the correction of CamelCase.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:29 +02:00
Stefan Wahren
76262b2951 staging: vchiq_2835_arm: Remove unnecessary assignment to slot_mem_size
The variable slot_mem_size is assigned a value which is never used.
This issue has been found by CppCheck.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:29 +02:00
Stefan Wahren
158ef80a87 staging: vchiq_2835_arm: Reduce scope of i in free_pagelist
We can reduce the scope of the counting variable i. This has
been found by CppCheck.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 17:02:29 +02:00