OSDN Git Service

tomoyo/tomoyo-test1.git
5 years agoiio: chemical: sps30: remove printk format specifier
Tomasz Duszynski [Sat, 2 Feb 2019 09:00:03 +0000 (10:00 +0100)]
iio: chemical: sps30: remove printk format specifier

pr_fmt is used by printk wrappers. There are not any in the driver
code so remove the format specifier.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: frequency: ad9833: Load clock using clock framework
Beniamin Bia [Fri, 1 Feb 2019 15:01:38 +0000 (17:01 +0200)]
staging: iio: frequency: ad9833: Load clock using clock framework

The clock frequency is loaded from device-tree using clock framework
instead of statically value. The change allow configuration of
the device via device-trees and better initialization sequence.
This is part of broader effort to add device-tree support to this driver
and take it out from staging.

Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: frequency: ad9833: Get frequency value statically
Beniamin Bia [Fri, 1 Feb 2019 15:01:37 +0000 (17:01 +0200)]
staging: iio: frequency: ad9833: Get frequency value statically

The values from platform data were replaced by statically values.
This was just a intermediate step of taking this driver out of staging and
load data from device tree.

Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: light: Add max44009
Robert Eshleman [Thu, 31 Jan 2019 15:49:16 +0000 (07:49 -0800)]
dt-bindings: iio: light: Add max44009

Adds device tree bindings for the max44009 light sensor.

Signed-off-by: Robert Eshleman <bobbyeshleman@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: light: add driver for MAX44009
Robert Eshleman [Thu, 31 Jan 2019 15:29:01 +0000 (07:29 -0800)]
iio: light: add driver for MAX44009

The MAX44009 is a low-power ambient light sensor from Maxim
Integrated. It differs from the MAX44000 in that it doesn't have
proximity sensing and that it requires far less current (1 micro-amp
vs 5 micro-amps). The register mapping and feature set between the
two are different enough to require a new driver for the MAX44009.

Developed and tested with a BeagleBone Black and UDOO Neo (i.MX6SX)

Supported features:

* Reading lux (processed value)

* Rising and falling illuminance threshold
  events

* Configuring integration time

https://datasheets.maximintegrated.com/en/ds/MAX44009.pdf

Signed-off-by: Robert Eshleman <bobbyeshleman@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: adc: Add docs for AD7768-1
Stefan Popa [Thu, 31 Jan 2019 16:21:42 +0000 (18:21 +0200)]
dt-bindings: iio: adc: Add docs for AD7768-1

Document support for AD7768-1 Analog to Digital Converter.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: Add AD7768-1 ADC basic support
Stefan Popa [Thu, 31 Jan 2019 16:20:51 +0000 (18:20 +0200)]
iio: adc: Add AD7768-1 ADC basic support

The ad7768-1 is a single channel, precision 24-bit analog to digital
converter (ADC).

This basic patch configures the device in fast mode, with 32 kSPS and
leaves the default sinc5 filter.

Two data conversion modes are made available. When data is retrieved by
using the read_raw attribute, one shot single conversion mode is set.
The continuous conversion mode is enabled when the triggered buffer
mechanism is used. To assure correct data retrieval, the driver waits
for the interrupt triggered by the low to high transition of the DRDY
pin.

Datasheets:
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/ad7768-1.pdf
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: cdc: ad7152: remove driver completely
Alexandru Ardelean [Wed, 30 Jan 2019 09:12:36 +0000 (11:12 +0200)]
staging: iio: cdc: ad7152: remove driver completely

The AD7153 part has been obsoleted for some time. The AD7152 part will be
obsolete in the coming future.
Moving it out of staging doesn't make sense anymore. Which makes the driver
enter a limbo state.

This patch removes the driver completely, so that no effort is placed on
it, allowing people to focus on other parts that will still be around.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: mpu6050: Add support for the ICM 20602 IMU
Randolph Maaßen [Mon, 28 Jan 2019 18:50:03 +0000 (19:50 +0100)]
iio: imu: mpu6050: Add support for the ICM 20602 IMU

The Invensense ICM-20602 is a 6-axis MotionTracking device that
combines a 3-axis gyroscope and an 3-axis accelerometer. It is very
similar to the ICM-20608 imu which is already supported by the mpu6050
driver. The main difference is that the ICM-20602 has the i2c bus
disable bit in a separate register.

Signed-off-by: Randolph Maaßen <gaireg@gaireg.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: imu: add icm20602 bindings to mpu6050
Randolph Maaßen [Mon, 28 Jan 2019 18:50:02 +0000 (19:50 +0100)]
dt-bindings: iio: imu: add icm20602 bindings to mpu6050

Adding the invensense ICM-20602 to the compatible list of the mpu6050
driver

Signed-off-by: Randolph Maaßen <gaireg@gaireg.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: pressure: add LPS22HH bindings
Lorenzo Bianconi [Sat, 19 Jan 2019 20:47:53 +0000 (21:47 +0100)]
dt-bindings: iio: pressure: add LPS22HH bindings

Fix following checkpatch warnings:
WARNING: DT compatible string "st,lps22hh" appears un-documented -- check ./Documentation/devicetree/bindings/
.compatible = "st,lps22hh",

WARNING: DT compatible string "st,lps22hh" appears un-documented -- check ./Documentation/devicetree/bindings/
.compatible = "st,lps22hh",

Fixes: e5aab7b0d88d ("iio:st_pressure:initial lps22hh sensor support")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: st_accel: use ACPI orientation data
Daniel Drake [Thu, 20 Dec 2018 06:59:33 +0000 (14:59 +0800)]
iio: st_accel: use ACPI orientation data

Platform-specific ST accelerometer mount matrix information can be
provided by returning a package of 6 integers from the ACPI _ONT
method. This has been seen on Acer products such as Veriton Z4860G,
Z6860G and A890, which include a ST SMO8840 sensor. We have also
confirmed experimentally that the Windows driver uses such information.

The _ONT data format was explained by a ST vendor contact. However,
strangely enough, the _ONT transformations must be applied after first
applying another mount matrix which we determined experimentally. ST
have not commented on why this is the case, but we imagine that perhaps
earlier devices (before _ONT was introduced) required this translation
and hence it became 'standard.'

Interpret the _ONT data and export the equivalent mount matrix to
userspace.

If no _ONT data is present, no mount matrix is exported.

Signed-off-by: Daniel Drake <drake@endlessm.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: add NPCM ADC driver
Tomer Maimon [Wed, 16 Jan 2019 16:48:55 +0000 (18:48 +0200)]
iio: adc: add NPCM ADC driver

Add Nuvoton NPCM BMC Analog-to-Digital Converter(ADC) driver.

The NPCM ADC is a 10-bit converter for eight channel inputs.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-binding: iio: add NPCM ADC documentation
Tomer Maimon [Wed, 16 Jan 2019 16:48:54 +0000 (18:48 +0200)]
dt-binding: iio: add NPCM ADC documentation

Added device tree binding documentation for Nuvoton BMC
NPCM Analog-to-Digital Converter(ADC).

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: chemical: sps30: allow changing self cleaning period
Tomasz Duszynski [Tue, 15 Jan 2019 19:00:06 +0000 (20:00 +0100)]
iio: chemical: sps30: allow changing self cleaning period

Sensor can periodically trigger self cleaning. Period can be changed by
writing a new value to a dedicated attribute. Upon attribute read
current period gets returned.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: chemical: Add bindings for bme680
Sebastien Bourdelin [Mon, 14 Jan 2019 20:19:14 +0000 (15:19 -0500)]
dt-bindings: iio: chemical: Add bindings for bme680

BME680 is a pressure/temperature/humidity/voc sensor.

Signed-off-by: Sebastien Bourdelin <sebastien.bourdelin@gmail.com>
Acked-by: Himanshu Jha <himanshujha199640@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: chemical: bme680: Add device-tree support
Sebastien Bourdelin [Mon, 14 Jan 2019 20:19:13 +0000 (15:19 -0500)]
iio: chemical: bme680: Add device-tree support

This commit allow the driver to work with device-tree.

Signed-off-by: Sebastien Bourdelin <sebastien.bourdelin@gmail.com>
Acked-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio:st_pressure:initial lps22hh sensor support
mario tesi [Mon, 14 Jan 2019 17:24:20 +0000 (18:24 +0100)]
iio:st_pressure:initial lps22hh sensor support

Initial support for ST LPS22HH pressure sensor. Datasheet:
http://www2.st.com/resource/en/datasheet/lps22hh.pdf

Features:
 * pressure, temperature data and timestamping channels
 * sampling frequency selection [1..200] Hz
 * interrupt based trigger
 * over I2C or SPI interface

Signed-off-by: mario tesi <mario.tesi@st.com>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: accell: mma8452: add vdd/vddio regulator operation support
Anson Huang [Tue, 8 Jan 2019 09:14:06 +0000 (09:14 +0000)]
iio: accell: mma8452: add vdd/vddio regulator operation support

The accelerometer's power supply could be controllable on some
platforms, such as i.MX6Q-SABRESD board, the mma8451's power supplies
are controlled by a GPIO fixed regulator, need to make sure the
regulators are enabled before any communication with mma8451, this
patch adds vdd/vddio regulator operation support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Acked-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: accel: mma8452: add power supplies property
Anson Huang [Tue, 8 Jan 2019 09:14:01 +0000 (09:14 +0000)]
dt-bindings: iio: accel: mma8452: add power supplies property

The accelerometer's power supplies could be controllable on some
platforms, add property "vdd/vddio" power supply to let device tree
to pass phandles to the regulators to driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: light: isl29018: add vcc regulator operation support
Anson Huang [Tue, 8 Jan 2019 09:09:39 +0000 (09:09 +0000)]
iio: light: isl29018: add vcc regulator operation support

The light sensor's power supply could be controllable by regulator
on some platforms, such as i.MX6Q-SABRESD board, the light sensor
isl29023's power supply is controlled by a GPIO fixed regulator,
need to make sure the regulator is enabled before any operation of
sensor, this patch adds vcc regulator operation support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: magnetometer: mag3110: add vdd/vddio regulator operation support
Anson Huang [Tue, 8 Jan 2019 09:16:04 +0000 (09:16 +0000)]
iio: magnetometer: mag3110: add vdd/vddio regulator operation support

The magnetometer's power supplies could be controllable on some platforms,
such as i.MX6Q-SABRESD board, the mag3110's power supplies are controlled
by a GPIO fixed regulator, need to make sure the regulators are enabled
before any communication with mag3110, this patch adds vdd/vddio regulator
operation support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: dac: ad5686: Add support for AD5674R/AD5679R
Mircea Caprioru [Wed, 9 Jan 2019 09:14:16 +0000 (11:14 +0200)]
iio: dac: ad5686: Add support for AD5674R/AD5679R

The AD5674R/AD5679R are low power, 16-channel, 12-/16-bit buffered voltage
output digital-to-analog converters (DACs). They include a 2.5 V internal
reference (enabled by default).

These devices are very similar to AD5684R/AD5686R, except that they have 16
channels.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: Add the TI ads124s08 ADC code
Dan Murphy [Fri, 11 Jan 2019 19:57:06 +0000 (13:57 -0600)]
iio: adc: Add the TI ads124s08 ADC code

Introduce the TI ADS124S08 and the ADS124S06 ADC
devices from TI.  The ADS124S08 is the 12 channel ADC
and the ADS124S06 is the 6 channel ADC device

These devices share a common datasheet:
http://www.ti.com/lit/gpn/ads124s08

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: ti-ads124s08: Add DT binding documentation
Dan Murphy [Fri, 11 Jan 2019 19:57:05 +0000 (13:57 -0600)]
iio: ti-ads124s08: Add DT binding documentation

Adding binding documentation for Texas Instruments ADS124S08
and ADS124S06 ADC.

S08 is a 12 channel ADC
S06 is a 6 channel ADC

Datesheet can be found here:
http://www.ti.com/lit/gpn/ads124s08

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adt7316: fix the dac write calculation
Jeremy Fertic [Sun, 23 Dec 2018 04:57:43 +0000 (21:57 -0700)]
staging: iio: adt7316: fix the dac write calculation

The lsb calculation is not masking the correct bits from the user input.
Subtract 1 from (1 << offset) to correctly set up the mask to be applied
to user input.

The lsb register stores its value starting at the bit 7 position.
adt7316_store_DAC() currently assumes the value is at the other end of the
register. Shift the lsb value before storing it in a new variable lsb_reg,
and write this variable to the lsb register.

Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adt7316: fix the dac read calculation
Jeremy Fertic [Sun, 23 Dec 2018 04:57:42 +0000 (21:57 -0700)]
staging: iio: adt7316: fix the dac read calculation

The calculation of the current dac value is using the wrong bits of the
dac lsb register. Create two macros to shift the lsb register value into
lsb position, depending on whether the dac is 10 or 12 bit. Initialize
data to 0 so, with an 8 bit dac, the msb register value can be bitwise
ORed with data.

Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adt7316: fix handling of dac high resolution option
Jeremy Fertic [Sun, 23 Dec 2018 04:57:41 +0000 (21:57 -0700)]
staging: iio: adt7316: fix handling of dac high resolution option

The adt7316/7 and adt7516/7 have the option to output voltage proportional
to temperature on dac a and/or dac b. The default dac resolution in this
mode is 8 bits with the dac high resolution option enabling 10 bits. None
of these settings affect dacs c and d. Remove the "1 (12 bits)" output from
the show function since that is not an option for this mode. Return
"1 (10 bits)" if the device is one of the above mentioned chips and the dac
high resolution mode is enabled.

In the store function, the driver currently allows the user to write to the
ADT7316_DA_HIGH_RESOLUTION bit regardless of the device in use. Add a check
to return an error in the case of an adt7318 or adt7519. Remove the else
statement that clears the ADT7316_DA_HIGH_RESOLUTION bit. Instead, clear it
before conditionally enabling it, depending on user input. This matches the
typical pattern in the driver when an attribute is a boolean.

Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adt7316: fix dac_bits assignment
Jeremy Fertic [Sun, 23 Dec 2018 04:57:40 +0000 (21:57 -0700)]
staging: iio: adt7316: fix dac_bits assignment

The value of dac_bits is used in adt7316_show_DAC() and adt7316_store_DAC(),
and it should be either 8, 10, or 12 bits depending on the device in use. The
driver currently only assigns a value to dac_bits in
adt7316_store_da_high_resolution(). The purpose of the dac high resolution
option is not to change dac resolution for normal operation. Instead, it
is specific to an optional feature where one or two of the four dacs can
be set to output voltage proportional to temperature. If the user chooses
to set dac a and/or dac b to output voltage proportional to temperature,
the da_high_resolution attribute can optionally be enabled to use 10 bit
resolution rather than the default 8 bits. This is only available on the
10 and 12 bit dac devices. If the user attempts to read or write dacs a
or b under these settings, the driver's current behaviour is to return an
error. Dacs c and d continue to operate normally under these conditions.
With the above in mind, remove the dac_bits assignments from this function
since the value of dac_bits as used in the driver is not dependent on this
dac high resolution option.

Since the dac_bits assignments discussed above are currently the only ones
in this driver, the default value of dac_bits is 0. This results in incorrect
calculations when the dacs are read or written in adt7316_show_DAC() and
adt7316_store_DAC(). To correct this, assign a value to dac_bits in
adt7316_probe() to ensure correct operation as soon as the device is
registered and available to userspace.

Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: xilinx: check return value of xadc_write_adc_reg
Aditya Pakki [Thu, 27 Dec 2018 19:54:52 +0000 (13:54 -0600)]
iio: adc: xilinx: check return value of xadc_write_adc_reg

In function xadc_probe, xadc_write_adc_reg can return an error value
when write fails. The fix checks for the return value consistent with
other invocations of the latter function.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: meson-saradc: enable the temperature sensor two more SoCs
Martin Blumenstingl [Thu, 27 Dec 2018 21:50:20 +0000 (22:50 +0100)]
iio: adc: meson-saradc: enable the temperature sensor two more SoCs

Meson8b and Meson8m2 use the same logic to convert the ADC register
value to celsius, which is different from Meson8:
- Meson8 has different multiplier and divider values
- Meson8 uses a 4-bit TSC (temperature sensor coefficient) which fits
  into the 4-bit field in the MESON_SAR_ADC_DELTA_10 register:
  MESON_SAR_ADC_DELTA_10_TS_C_MASK. Meson8b and Meson8m2 have a 5-bit
  TSC which requires writing the upper-most bit into the
  MESON_HHI_DPLL_TOP_0[9] register from the HHI register area.

This adds support for the temperature sensor on the Meson8b and Meson8m2
SoCs by implementing the logic to write the upper-most TSC bit into the
HHI register area. The SoC-specific values (temperature_trimming_bits,
temperature_multiplier, temperature_divider) are added - these simply
integrate into the existing infrastructure (which was implemented for
Meson8) and thus require no further changes to the existing temperature
calculation logic.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: adc: meson-saradc: update temperature sensor support
Martin Blumenstingl [Thu, 27 Dec 2018 21:50:19 +0000 (22:50 +0100)]
dt-bindings: iio: adc: meson-saradc: update temperature sensor support

Meson8b and Meson8m2 use a 5-bit wide TSC (temperature sensor
coefficient). The SAR ADC registers however can only store (the lower)
4 bits. The fifth (upper-most) bit is stored inside the
MESON_HHI_DPLL_TOP_0[9] register from the HHI register area.
This adds a syscon property to the HHI register area so a driver can
fetch the HHI register map and store the fifth TSC bit in there.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: adc: Add docs for AD7606 ADC
Stefan Popa [Mon, 17 Dec 2018 12:23:40 +0000 (14:23 +0200)]
dt-bindings: iio: adc: Add docs for AD7606 ADC

Document support for AD7606 Analog to Digital Converter.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7606: Move out of staging
Stefan Popa [Mon, 17 Dec 2018 12:23:39 +0000 (14:23 +0200)]
staging: iio: adc: ad7606: Move out of staging

Move ad7606 ADC driver out of staging and into the mainline.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7606: Misc style fixes (no functional change)
Stefan Popa [Mon, 17 Dec 2018 12:23:38 +0000 (14:23 +0200)]
staging: iio: adc: ad7606: Misc style fixes (no functional change)

* Placed includes in alphabetical order
* Added brackets around num and mask through out for AD760X_CHANNEL
* Used single line comments where needed
* Removed extra lines and spaces

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7606: Add support for threaded irq
Stefan Popa [Mon, 17 Dec 2018 12:23:37 +0000 (14:23 +0200)]
staging: iio: adc: ad7606: Add support for threaded irq

This patch replaces the use of a polling ring buffer with a threaded
interrupt.

Enabling the buffer sets the CONVST signal to high. When the rising edge
of the CONVST is applied, BUSY signal goes logic high and transitions low
at the end of the entire conversion process. The falling edge of the BUSY
signal triggers the interrupt.

ad7606_trigger_handler() is used as bottom half of the poll function.
It reads data from the device and stores it in the internal buffer.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7606: Use SPDX identifier
Stefan Popa [Mon, 17 Dec 2018 12:23:36 +0000 (14:23 +0200)]
staging: iio: adc: ad7606: Use SPDX identifier

This patch replaces the license text at the top of ad7606 driver files
and instead adds SPDX GPL-2.0 license identifier.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7606: Simplify the Kconfing menu
Stefan Popa [Mon, 17 Dec 2018 12:23:35 +0000 (14:23 +0200)]
staging: iio: adc: ad7606: Simplify the Kconfing menu

There is no point in having three menu entries that can be selected
individually. Instead, the SPI and parallel interfaces should select
AD7606.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: ad9523: fix a missing check of return value
Kangjie Lu [Thu, 20 Dec 2018 07:21:22 +0000 (01:21 -0600)]
iio: ad9523: fix a missing check of return value

If ad9523_write() fails, indio_dev may get incorrect data. The fix
inserts a check for the return value of ad9523_write(), and it fails,
returns an error.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: chemical: sps30: add support for self cleaning
Tomasz Duszynski [Tue, 18 Dec 2018 20:28:09 +0000 (21:28 +0100)]
iio: chemical: sps30: add support for self cleaning

Self cleaning is especially useful in cases where sensor undergoes
frequent power on/off cycles. In such scenarios it is recommended to
turn self cleaning at least once per week in order to maintain reliable
measurements.

Self cleaning is activated by writing 1 to a dedicated attribute.
Internal fan accelerates to its maximum speed and keeps spinning
for about 10 seconds blowing out accumulated dust.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Tested-by: Andreas Brauchli <andreas.brauchli@sensirion.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: remove set but not used variable ''
YueHaibing [Sat, 15 Dec 2018 06:31:24 +0000 (06:31 +0000)]
iio: imu: st_lsm6dsx: remove set but not used variable ''

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c: In function 'st_lsm6dsx_shub_read_reg':
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:108:41: warning:
 variable 'hub_settings' set but not used [-Wunused-but-set-variable]

It never used since introduction in commit c91c1c844ebd ("iio: imu: st_lsm6dsx:
add i2c embedded controller support")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7606: Add OF device ID table
Stefan Popa [Thu, 13 Dec 2018 12:46:20 +0000 (14:46 +0200)]
staging: iio: adc: ad7606: Add OF device ID table

The driver does not have a struct of_device_id table, but supported
devices are registered via Device Trees. This patch adds and OF device
ID table.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7606: Use vendor prefix for DT properties
Stefan Popa [Thu, 13 Dec 2018 12:46:19 +0000 (14:46 +0200)]
staging: iio: adc: ad7606: Use vendor prefix for DT properties

The 'adi' vendor prefix needs to be added to conversion-start, range,
first-data and oversampling-ratio properties.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7606: Use find_closest() macro
Stefan Popa [Thu, 13 Dec 2018 12:46:18 +0000 (14:46 +0200)]
staging: iio: adc: ad7606: Use find_closest() macro

When looking for the available scale or oversampling ratio, it is better
to use the find_closest() macro. This simplifies the code and also does
not require an exact value to be entered from the user space.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7606: Use devm functions in probe
Stefan Popa [Thu, 13 Dec 2018 12:46:16 +0000 (14:46 +0200)]
staging: iio: adc: ad7606: Use devm functions in probe

Switch to devm version of request_irq, iio_triggered_buffer_setup,
iio_device_register. To avoid potential ordering issues in probe,
devm_add_action_or_reset() is used for the regulator_disable(). This
simplifies the code and decreases the chance of bugs.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7606: Use wait-for-completion handler
Stefan Popa [Thu, 13 Dec 2018 12:46:15 +0000 (14:46 +0200)]
staging: iio: adc: ad7606: Use wait-for-completion handler

This patch replaces the use of wait_event_interruptible() with
wait_for_completion_timeout() when reading the result of a single
conversion. In this way, if the interrupt never occurs, the program will
not remain blocked.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: chemical: sgp30: add device tree support
Andreas Brauchli [Thu, 13 Dec 2018 14:44:18 +0000 (15:44 +0100)]
iio: chemical: sgp30: add device tree support

Add device tree support for Sensirion SGP30/SGPC3 gas sensors.

Signed-off-by: Andreas Brauchli <andreas.brauchli@sensirion.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: chemical: sgp30: Support Sensirion SGP30/SGPC3 sensors
Andreas Brauchli [Thu, 13 Dec 2018 14:43:23 +0000 (15:43 +0100)]
iio: chemical: sgp30: Support Sensirion SGP30/SGPC3 sensors

Support Sensirion SGP30 and SGPC3 multi-pixel I2C gas sensors

Supported Features:

* Indoor Air Quality (IAQ) concentrations for
  - tVOC (in_concentration_voc_input)
  - CO2eq (in_concentration_co2_input) - SGP30 only

  IAQ concentrations are periodically read out by a background thread
  to allow the sensor to maintain its internal baseline.

* Gas concentration signals
  - Ethanol (in_concentration_ethanol_raw)
  - H2 (in_concentration_h2_raw) - SGP30 only

https://www.sensirion.com/file/datasheet_sgp30
https://www.sensirion.com/file/datasheet_sgpc3

Signed-off-by: Andreas Brauchli <andreas.brauchli@sensirion.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: Add modifiers for ethanol and H2 gases
Andreas Brauchli [Thu, 13 Dec 2018 14:43:22 +0000 (15:43 +0100)]
iio: Add modifiers for ethanol and H2 gases

Add ethanol and H2 gas modifiers:
* IIO_MOD_ETHANOL
* IIO_MOD_H2

Signed-off-by: Andreas Brauchli <andreas.brauchli@sensirion.com>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: chemical: sps30: add device tree support
Tomasz Duszynski [Fri, 14 Dec 2018 18:28:03 +0000 (19:28 +0100)]
dt-bindings: iio: chemical: sps30: add device tree support

Add device tree support for Sensirion SPS30 particulate
matter sensor.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: chemical: add support for Sensirion SPS30 sensor
Tomasz Duszynski [Fri, 14 Dec 2018 18:28:02 +0000 (19:28 +0100)]
iio: chemical: add support for Sensirion SPS30 sensor

Add support for Sensirion SPS30 particulate matter sensor.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: add IIO_MASSCONCENTRATION channel type
Tomasz Duszynski [Fri, 14 Dec 2018 18:28:01 +0000 (19:28 +0100)]
iio: add IIO_MASSCONCENTRATION channel type

Measuring particulate matter in ug / m3 (micro-grams per cubic meter)
is de facto standard. Existing air quality sensors usually follow
this convention and are capable of returning measurements using
this unit.

IIO currently does not offer suitable channel type for this
type of measurements hence this patch adds this.

In addition, extra modifiers are introduced used for distinguishing
between fine pm1, pm2p5 and coarse pm4, pm10 particle measurements, i.e
IIO_MOD_PM1, IIO_MOD_PM25 and IIO_MOD_PM4, IIO_MOD_PM10.

pmX consists of particles with aerodynamic diameter less or equal to
X micrometers.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7816: drop unnecessary initialization of variables
Hardik Singh Rathore [Wed, 12 Dec 2018 17:57:07 +0000 (23:27 +0530)]
staging: iio: ad7816: drop unnecessary initialization of variables

Initialization is unnecessary when the variable is written before it is
read. There were some occasions in which the driver would initialize `ret'
during declaration without need.

Signed-off-by: Hardik Singh Rathore <hardiksingh.k@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7280a: split ad7280_attr_init() to more functions
Slawomir Stepien [Wed, 12 Dec 2018 17:02:28 +0000 (18:02 +0100)]
staging: iio: adc: ad7280a: split ad7280_attr_init() to more functions

The ad7280_attr_init function has been split into more specific
functions to increase the code readability.

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7280a: split ad7280_channel_init() to more functions
Slawomir Stepien [Wed, 12 Dec 2018 17:02:27 +0000 (18:02 +0100)]
staging: iio: adc: ad7280a: split ad7280_channel_init() to more functions

The ad7280_channel_init function has been split into more specific
functions to increase the code readability.

The setting of channel's scan_type.shift to 0, has been removed, since
it is the default value.

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad5933: add binding doc for ad5933
Marcelo Schmitt [Sat, 8 Dec 2018 18:19:59 +0000 (16:19 -0200)]
staging: iio: ad5933: add binding doc for ad5933

Add a devicetree documentation for the ad5933 and ad5934 impedance
converter, network analyzer.

Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Gabriel Capella <gabriel@capella.pro>
Co-Developed-by: Gabriel Capella <gabriel@capella.pro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad5933: use clock framework for clock reference
Marcelo Schmitt [Sat, 8 Dec 2018 18:19:38 +0000 (16:19 -0200)]
staging: iio: ad5933: use clock framework for clock reference

Add the option to specify the external clock (MCLK) using the clock
framework.
Also remove the old platform data structure.

Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Gabriel Capella <gabriel@capella.pro>
Co-developed-by: Gabriel Capella <gabriel@capella.pro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad5933: change regulator binging for vref
Marcelo Schmitt [Sat, 8 Dec 2018 18:19:08 +0000 (16:19 -0200)]
staging: iio: ad5933: change regulator binging for vref

Set a single voltage regulator for all voltage references.
Remove voltage reference value from default platafrom data struct.

Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Gabriel Capella <gabriel@capella.pro>
Co-developed-by: Gabriel Capella <gabriel@capella.pro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoStaging: iio: adt7316: Add all irq related code in adt7316_irq_setup()
Shreeya Patel [Thu, 13 Dec 2018 19:43:35 +0000 (01:13 +0530)]
Staging: iio: adt7316: Add all irq related code in adt7316_irq_setup()

ADT7316 driver no more uses platform data and hence use device tree
data instead of platform data for assigning irq_type field and
implement this in adt7316_irq_setup function.
Switch case figures out the type of irq and if it's the default case
then assign the default value to the irq_type i.e.
irq_type = IRQF_TRIGGER_LOW
Move devm_request_threaded_irq() and assignment of chip->config1
into the adt7316_setup_irq() to unclutter the code in probe function.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adt7316: drop unnecessary initialization of variables
Hardik Singh Rathore [Wed, 12 Dec 2018 16:47:46 +0000 (22:17 +0530)]
staging: iio: adt7316: drop unnecessary initialization of variables

Initialization is unnecessary when the variable is written before it is
read. There were some occasions in which the driver would initialize `ret'
during declaration without need.

Purely a cosmetic change with no functional impact.

Signed-off-by: Hardik Singh Rathore <hardiksingh.k@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adt7316: correct spelling of ADT7316_DA_EN_VIA_DAC_LDCA
Jeremy Fertic [Wed, 12 Dec 2018 00:55:03 +0000 (17:55 -0700)]
staging: iio: adt7316: correct spelling of ADT7316_DA_EN_VIA_DAC_LDCA

Change LDCA to LDAC.

Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adt7316: change interpretation of write to dac update mode
Jeremy Fertic [Wed, 12 Dec 2018 00:55:02 +0000 (17:55 -0700)]
staging: iio: adt7316: change interpretation of write to dac update mode

Based on the output of adt7316_show_all_DAC_update_modes() and
adt7316_show_DAC_update_mode(), adt7316_store_DAC_update_mode() should
expect the user to enter an integer input from 0 to 3. The user input is
currently expected to account for the actual bit positions in the register.
For example, choosing option 3 would require a write of 0x30 (actually 48
since it expects base 10). To address this inconsistency, create a shift
macro to be used in the valid input check as well as the calculation for
the register write.

Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adt7316: remove dac vref buffer bypass from adt751x
Jeremy Fertic [Wed, 12 Dec 2018 00:55:01 +0000 (17:55 -0700)]
staging: iio: adt7316: remove dac vref buffer bypass from adt751x

The option to allow the external vref to bypass the reference buffer is
only available for adt7316/7/8. Remove the attributes for adt751x as
well as the chip->id checks from the show and store functions.

Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adt7316: allow adt751x to use internal vref for all dacs
Jeremy Fertic [Wed, 12 Dec 2018 00:55:00 +0000 (17:55 -0700)]
staging: iio: adt7316: allow adt751x to use internal vref for all dacs

With adt7516/7/9, internal vref is available for dacs a and b, dacs c and
d, or all dacs. The driver doesn't currently support internal vref for all
dacs. Change the else if to an if so both bits are checked rather than
just one or the other.

Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adt7316: use correct variable in DAC_internal_Vref read
Jeremy Fertic [Wed, 12 Dec 2018 00:54:59 +0000 (17:54 -0700)]
staging: iio: adt7316: use correct variable in DAC_internal_Vref read

The dac internal vref settings are part of the ldac config register rather
than the dac config register. Change the variable being used so the read
returns the correct result.

Whilst a fix, it is for a driver in heavy churn so do not backport
to stable without taking considerable care and testing.

Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adt7316: invert the logic of the check for an ldac pin
Jeremy Fertic [Wed, 12 Dec 2018 00:54:54 +0000 (17:54 -0700)]
staging: iio: adt7316: invert the logic of the check for an ldac pin

ADT7316_DA_EN_VIA_DAC_LDCA is set when the dac and ldac registers are being
used to update the dacs instead of the ldac pin. ADT7516_SEL_AIN3 is an adc
input that shares the ldac pin. Only set these bits if an ldac pin is not
being used.

This could be backported to stable, but note there are various
other bugs that probably make that a waste of time.

Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adt7316: fix register and bit definitions
Jeremy Fertic [Wed, 12 Dec 2018 00:54:53 +0000 (17:54 -0700)]
staging: iio: adt7316: fix register and bit definitions

Change two register addresses and one bit definition to match the
datasheet.

Note that there are many issues in this driver so I would
not suggest backporting these fixes to stable trees.

Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoMerge tag 'iio-for-4.21b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Thu, 13 Dec 2018 12:37:24 +0000 (13:37 +0100)]
Merge tag 'iio-for-4.21b' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of IIO new device support, features and cleanups for the 4.21 cycle.

Staging graduation
* ad2s90
  - Driver for this resolver to digital chip.

New drivers and device support.
* ad5686
  - Add support for ad5310r DAC and associated fix in value read back.
* exynos-adc
  - Support for S5PV210 which is slightly different from other parts.
* mcp41010
  - Driver supporting MCP41010, MCP41050, MCP41100, MCP42010, MCP42050 and
  MCP42100 microchip potentiometers.

New ACPI ids.
* ak8975
  - AKM9911 ACPI HID.
* kxcjk-1013
  - KXJ2109 ACPI HID.
  - KIOX010A ACPI HID.

New features
* ad5933
  - Explicit DT binding.
* ad2s90
  - Explicit DT binding including dropping spi setup that is done via dt
    in favour of verifying the settings form DT.
* adt7316
  - Explicit DT binding and support for gpio, irq_flags etc.
* stm32-adc
  - Runtime power management.

Minor fixes and cleanups
* core
  - Protect against missing info structure.
* ad2s90
  - SPDX
  - Add documentation fo the mutex.
ad7280a
  - Check allocation failure.
  - Fix an accidental replacement of an error return.
* adt7316
  - Switch some variables to be local and rename for consistency with other
    drivers.
  - Revert a false handling of 0 as an error introduced earlier this cycle.
* bmi160
  - Use devm functions throughout probe() to avoid need for remove().
* hid-sensor-hub
  - White space cleanup.
* hts221
  - MAINTAINERS entry.
* lis302
  - Use generic name in the DT binding doc.
* Messon-saradc
  - Check for allocation error.
  - Fix some presented clock names that break clk debugfs.
* qcom-spmi-adc
  - A fix for initialization of the prescale property. Came late in the
    cycle, so merge window is probably the best route for this.
* st_lsm6dsx
  - Allow for variable read length to support wider range of slave devices.

* tag 'iio-for-4.21b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (37 commits)
  iio: adc: qcom-spmi-adc5: Initialize prescale properly
  dt-bindings: iio: adc: exynos-adc: Add S5PV210 variant
  iio: adc: Allow selection of Exynos ADC on S5PV210
  iio: adc: exynos-adc: Add S5PV210 variant
  iio: bmi160: use all devm functions in probe
  iio: dac: ad5686: fix bit shift read register
  iio:dac:ad5686: Add AD5310R support
  Revert "Staging: iio: adt7316: Add an extra check for 'ret' equals to 0"
  dt-bindings: iio: accel: use a generic node name for lis302
  iio: core: check 'info' value before registering the device
  staging: iio: adc: ad7280a: fix overwrite of the returned value
  staging: iio: adc: ad7280a: check for devm_kasprint() failure
  iio: humidity: hts221: add entry in MAINTAINERS file
  iio: magnetometer: ak8975: Add the "AKM9911" ACPI HID
  staging:iio:ad2s90: Move out of staging
  staging:iio:ad2s90: Add comment to device state mutex
  staging:iio:ad2s90: Replace license text w/ SPDX identifier
  dt-bindings:iio:resolver: Add docs for ad2s90
  staging:iio:ad2s90: Add max frequency check at probe
  staging:iio:ad2s90: Remove spi setup that should be done via dt
  ...

5 years agoiio: adc: qcom-spmi-adc5: Initialize prescale properly
Evan Green [Tue, 4 Dec 2018 19:14:19 +0000 (11:14 -0800)]
iio: adc: qcom-spmi-adc5: Initialize prescale properly

adc5_get_dt_data uses a local, prop, feeds it to adc5_get_dt_channel_data,
and then puts the result into adc->chan_props. The problem is
adc5_get_dt_channel_data may not initialize that structure fully, so a
garbage value is used for prescale if the optional "qcom,pre-scaling" is
not defined in DT. adc5_read_raw then uses this as an array index,
generating a crash that looks like this:

[    6.683186] Unable to handle kernel paging request at virtual address ffffff90e78c7964
Call trace:
qcom_vadc_scale_code_voltage_factor+0x74/0x104
qcom_vadc_scale_hw_calib_die_temp+0x20/0x60
qcom_adc5_hw_scale+0x78/0xa4
adc5_read_raw+0x3d0/0x65c
iio_channel_read+0x240/0x30c
iio_read_channel_processed+0x10c/0x150
qpnp_tm_get_temp+0xc0/0x40c
of_thermal_get_temp+0x7c/0x98
thermal_zone_get_temp+0xac/0xd8
thermal_zone_device_update+0xc0/0x38c
qpnp_tm_probe+0x624/0x81c
platform_drv_probe+0xe4/0x11c
really_probe+0x188/0x3fc
driver_probe_device+0xb8/0x188
__device_attach_driver+0x114/0x180
bus_for_each_drv+0xd8/0x118
__device_attach+0x180/0x27c
device_initial_probe+0x20/0x2c
bus_probe_device+0x78/0x124
deferred_probe_work_func+0xfc/0x138
process_one_work+0x3d8/0x8b0
process_scheduled_works+0x48/0x6c
worker_thread+0x488/0x7cc
kthread+0x24c/0x264
ret_from_fork+0x10/0x18

Unfortunately, when I went to add the initializer for this and tried to
boot it, my machine shut down immediately, complaining that it was
hotter than the sun. It appears that adc5_chans_pmic and adc5_chans_rev2
were initializing prescale_index as if it were directly a divisor,
rather than the index into adc5_prescale_ratios that it is.

Fix the uninitialized value, and change the static initialization to use
indices into adc5_prescale_ratios.

Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: adc: exynos-adc: Add S5PV210 variant
Jonathan Bakker [Fri, 7 Dec 2018 19:11:36 +0000 (20:11 +0100)]
dt-bindings: iio: adc: exynos-adc: Add S5PV210 variant

Add information about new compatible for S5PV210

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: Allow selection of Exynos ADC on S5PV210
Jonathan Bakker [Fri, 7 Dec 2018 19:11:35 +0000 (20:11 +0100)]
iio: adc: Allow selection of Exynos ADC on S5PV210

Make it possible to use Exynos ADC driver on S5PV210 based devices.

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: exynos-adc: Add S5PV210 variant
Jonathan Bakker [Fri, 7 Dec 2018 19:11:34 +0000 (20:11 +0100)]
iio: adc: exynos-adc: Add S5PV210 variant

S5PV210's ADC variant is almost the same as v1 except that it has 10
channels and doesn't require the pmu register

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: mt7621-mmc: Fix incompletely removed #if 0 block in sd.c
Nishad Kamdar [Thu, 6 Dec 2018 15:57:06 +0000 (21:27 +0530)]
staging: mt7621-mmc: Fix incompletely removed #if 0 block in sd.c

Commit 2a54e3259e2a ("staging: mt7621-mmc: Remove #if 0 blocks in sd.c")
does not completely remove an #if 0 block in sd.c. This causes the function
msdc_select_clksrc() which was eariler not compiled, to be compiled.
That causes an error - MSDC_CLKSRC_REG is not defined.

This patch completely removes the #if 0 block

Reported-by: NeilBrown <neil@brown.name>
Fixes: 2a54e3259e2a ("staging: mt7621-mmc: Remove #if 0 blocks in sd.c")
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-camera: Add hint about possible faulty config
Stefan Wahren [Thu, 6 Dec 2018 18:29:00 +0000 (19:29 +0100)]
staging: bcm2835-camera: Add hint about possible faulty config

As per default the GPU memory config of the Raspberry Pi isn't sufficient
for the camera usage. Even worse the bcm2835 camera driver doesn't provide a
helpful error message in this case. So let's add a hint to point the user
to the likely cause.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-camera: Provide more specific probe error messages
Stefan Wahren [Thu, 6 Dec 2018 18:28:59 +0000 (19:28 +0100)]
staging: bcm2835-camera: Provide more specific probe error messages

Currently there is only a catch-all info message which print the
relevant error code without any context. So add more specific error
messages in order to narrow down possible issues.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Drop DT dependency
Stefan Wahren [Thu, 6 Dec 2018 18:28:58 +0000 (19:28 +0100)]
staging: bcm2835-audio: Drop DT dependency

Just like the bcm2835-video make this a platform driver which is probed
by vchiq. In order to change the number of channels use a module
parameter instead, but use the maximum as default.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: use module_platform_driver() macro
Stefan Wahren [Thu, 6 Dec 2018 18:28:57 +0000 (19:28 +0100)]
staging: bcm2835-audio: use module_platform_driver() macro

There is not much value behind this boilerplate, so use
module_platform_driver() instead.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-audio: Enable compile test
Stefan Wahren [Thu, 6 Dec 2018 18:28:56 +0000 (19:28 +0100)]
staging: bcm2835-audio: Enable compile test

Enable the compilation test for bcm2835-audio to gain more build coverage.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vchiq_arm: Register a platform device for audio
Stefan Wahren [Thu, 6 Dec 2018 18:28:55 +0000 (19:28 +0100)]
staging: vchiq_arm: Register a platform device for audio

Following Eric's commit 37b7b3087a2f ("staging/vc04_services: Register a
platform device for the camera driver.") this register the audio driver as
a platform device, too.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vchiq_arm: Fix camera device registration
Stefan Wahren [Thu, 6 Dec 2018 18:28:54 +0000 (19:28 +0100)]
staging: vchiq_arm: Fix camera device registration

Since the camera driver isn't probed via DT, we need to properly setup DMA.

Fixes: 37b7b3087a2f ("staging/vc04_services: Register a platform device for the camera driver.")
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-camera: Move module info to the end
Stefan Wahren [Thu, 6 Dec 2018 18:28:53 +0000 (19:28 +0100)]
staging: bcm2835-camera: Move module info to the end

In order to have this more consistent between the vc04 services move
the module information to the end of the file.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-camera: fix module autoloading
Stefan Wahren [Thu, 6 Dec 2018 18:28:52 +0000 (19:28 +0100)]
staging: bcm2835-camera: fix module autoloading

In order to make the module bcm2835-camera load automatically, we need to
add a module alias.

Fixes: 4bebb0312ea9 ("staging/bcm2835-camera: Set ourselves up as a platform driver.")
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: bcm2835-camera: Abort probe if there is no camera
Stefan Wahren [Thu, 6 Dec 2018 18:28:51 +0000 (19:28 +0100)]
staging: bcm2835-camera: Abort probe if there is no camera

Abort the probing of the camera driver in case there isn't a camera
actually connected to the Raspberry Pi. This solution also avoids a
NULL ptr dereference of mmal instance on driver unload.

Fixes: 7b3ad5abf027 ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.")
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-dts: avoid warnings in pinctrl definitions
NeilBrown [Sun, 9 Dec 2018 05:20:33 +0000 (16:20 +1100)]
staging: mt7621-dts: avoid warnings in pinctrl definitions

The device-tree checking code sees node names  "i2c" and "spi" in the
pinctrl definition and thinks these are defining i2c or spi devices,
and complains that they look wrong.

So add a '0' to the end of each name (much like "uart" and "rgmii"
have numbers at the end) to avoid the warning.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-mmc: fix compile warnging: cmd_buf
NeilBrown [Sun, 9 Dec 2018 05:20:33 +0000 (16:20 +1100)]
staging: mt7621-mmc: fix compile warnging: cmd_buf

cmd_buf is only used when MT6575_SD_DEBUG is defined.
So only declare it in that case.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-mmc: add missing header.
NeilBrown [Sun, 9 Dec 2018 05:20:33 +0000 (16:20 +1100)]
staging: mt7621-mmc: add missing header.

<linux/interrupt.h> is sometimes included by other include files,
and sometimes not, depending on config, particularly CONFIG_HIGHMEM.

So include it explicitly rather than relying on implicit inclusion.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-eth: fix compile warning.
NeilBrown [Sun, 9 Dec 2018 05:20:32 +0000 (16:20 +1100)]
staging: mt7621-eth: fix compile warning.

This code generates a waring as PHY_GBIT_FEATURES is "long" but
->supported in "int".

It looks likely that "PHY_1000BT_FEATURES" is the correct define to
use - it is intended to be used with the ->features field.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-dts: allow gnubee to reboot cleanly.
NeilBrown [Sun, 9 Dec 2018 05:20:32 +0000 (16:20 +1100)]
staging: mt7621-dts: allow gnubee to reboot cleanly.

Since commit bb276262e88d ("mtd: spi-nor: only apply reset hacks to
broken hardware"), we need to mark the spi-nor as "broken" for reboot
to work.
Note that nothing is actually broken here.  The hardware-watchdog in
the SoC isn't wired in a way that works, but then the board doesn't
claim to support a hardware watchdog - and the SPI certain isn't
"broken".

This causes an annoying warning on every boot, but that is better than
failing on ever reboot.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-mmc: set correct dma mask.
NeilBrown [Sun, 9 Dec 2018 05:20:32 +0000 (16:20 +1100)]
staging: mt7621-mmc: set correct dma mask.

Since commit f8c55dc6e828 ("MIPS: use generic dma noncoherent ops for
simple noncoherent platforms") changed MIPS dma handling, the mmc
driver fails because it doesn't have a dma mask is set.

So set the correct dma mask.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-eth: set correct dma mask.
NeilBrown [Sun, 9 Dec 2018 05:20:32 +0000 (16:20 +1100)]
staging: mt7621-eth: set correct dma mask.

Since commit f8c55dc6e828 ("MIPS: use generic dma noncoherent ops for
simple noncoherent platforms") changed MIPS dma handling, the eth
driver fails because the dma mask is set on the wrong 'struct device'.

Move the setting to the correct struct device.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vchiq: rework remove_event handling
Arnd Bergmann [Mon, 10 Dec 2018 21:11:58 +0000 (22:11 +0100)]
staging: vchiq: rework remove_event handling

I had started the removal of semaphores in this driver without knowing
that Nicolas Saenz Julienne also worked on this. In case of the "remote
event" infrastructure, my solution seemed significantly better, so I'm
proposing this as a change on top.

The problem with using either semaphores or completions here is that
it's an overly complex way of waking up a thread, and it looks like the
'count' of the semaphore can easily get out of sync, even though I found
it hard to come up with a specific example.

Changing it to a 'wait_queue_head_t' instead of a completion simplifies
this by letting us wait directly on the 'event->fired' variable that is
set by the videocore.

Another simplification is passing the wait queue directly into the helper
functions instead of going through the fragile logic of recording the
offset inside of a structure as part of a shared memory variable. This
also avoids one uncached memory read and should be faster.

Note that I'm changing it back to 'killable' after the previous patch
changed 'killable' to 'interruptible', apparently based on a misunderstanding
of the subtle down_interruptible() macro override in vchiq_killable.h.

Fixes: f27e47bc6b8b ("staging: vchiq: use completions instead of semaphores")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: remove semaphore remnants
Arnd Bergmann [Mon, 10 Dec 2018 21:40:32 +0000 (22:40 +0100)]
staging: rtl8723bs: remove semaphore remnants

Nothing uses the semaphores any more in this driver, so remove
all references to that type.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: change pwrctrl lock to a mutex
Arnd Bergmann [Mon, 10 Dec 2018 21:40:31 +0000 (22:40 +0100)]
staging: rtl8723bs: change pwrctrl lock to a mutex

This semaphore is used like a mutex, so it should use the regular
mutex API, as we do in the other copies of this driver.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: change semaphores to completions
Arnd Bergmann [Mon, 10 Dec 2018 21:40:30 +0000 (22:40 +0100)]
staging: rtl8723bs: change semaphores to completions

This driver uses many semaphores, most of them are equivalent to
completions. The other copies of this driver got moved over to
completions a while ago, so do the same here.

In this usage scenario, the two are equivalent, so the behavior
should not change.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: fix typo in the TODO file
Michael Straube [Mon, 10 Dec 2018 09:52:02 +0000 (10:52 +0100)]
staging: rtl8723bs: fix typo in the TODO file

HGz -> GHz

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: remove dead code, rtw_port_switch_chk()
Michael Straube [Mon, 10 Dec 2018 09:52:01 +0000 (10:52 +0100)]
staging: rtl8723bs: remove dead code, rtw_port_switch_chk()

The function rtw_port_switch_chk() returns always false.
Remove the function and related dead code.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: reuse Hal_GetChnlGroup88E()
Michael Straube [Fri, 7 Dec 2018 20:55:15 +0000 (21:55 +0100)]
staging: rtl8188eu: reuse Hal_GetChnlGroup88E()

Use Hal_GetChnlGroup88E() instead of duplicating it's code
in get_rx_power_val_by_reg().

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: simplify loop in rtl88eu_phy_iq_calibrate()
Michael Straube [Fri, 7 Dec 2018 20:55:14 +0000 (21:55 +0100)]
staging: rtl8188eu: simplify loop in rtl88eu_phy_iq_calibrate()

Zeroing the array result[m][n] and setting only the values at
even 'n's simplifies the code and slightly reduces object file
size.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: change do_insn*_ioctl to allow more samples
Spencer E. Olson [Tue, 4 Dec 2018 19:07:50 +0000 (12:07 -0700)]
staging: comedi: change do_insn*_ioctl to allow more samples

Changes do_insn*_ioctl functions to allow for data lengths for each
comedi_insn of up to 2^16.  This patch also changes these functions to only
allocate as much memory as is necessary for each comedi_insn, rather than
allocating a fixed-sized scratch space.

In testing some user-space code for the new INSN_DEVICE_CONFIG_GET_ROUTES
facility with some newer hardware, I discovered that do_insn_ioctl and
do_insnlist_ioctl limited the amount of data that can be passed into the
kernel for insn's to a length of 256.  For some newer hardware, the number
of routes can be greater than 1000.  Working around the old limits (256)
would complicate the user-space/kernel interaction.

The new upper limit is reasonable with current memory available and does
not otherwise impact the memory footprint for any current or otherwise
typical configuration.

Signed-off-by: Spencer E. Olson <olsonse@umich.edu>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-spi: drop support for SPI mode 1/2/3
Chuanhong Guo [Thu, 6 Dec 2018 13:15:09 +0000 (21:15 +0800)]
staging: mt7621-spi: drop support for SPI mode 1/2/3

As explained in previous patch, this SPI controller seems to be
tested on SPI flash only before mass production and some bits are
swizzled under other SPI modes probably due to incorrect wiring
inside the silicon. Drop implementation of SPI mode 1/2/3 since
they are broken.

Also drop RT2880_SPI_MODE_BITS macro because we now have only
SPI_LSB_FIRST implemented and the mode_bits is so short that we
don't need a macro there.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>