platform/kernel/linux-rpi.git
3 years agoiio: gyro: adxrs290: Insert missing mutex initialization call
Nishant Malpani [Tue, 25 Aug 2020 12:45:52 +0000 (18:15 +0530)]
iio: gyro: adxrs290: Insert missing mutex initialization call

Insert a missing mutex_init() call during the probe that initializes
the driver's local lock to unlocked state.

Fixes: 2c8920fff145 ("iio: gyro: Add driver support for ADXRS290")
Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Link: https://lore.kernel.org/r/20200825124552.11155-1-nish.malpani25@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodocs: abi: iio: Use What: consistently
Gwendal Grignou [Fri, 28 Aug 2020 23:31:55 +0000 (16:31 -0700)]
docs: abi: iio: Use What: consistently

Change "[w|W]hat[:| ]" to What: for consistency.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20200828233156.2264689-2-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: multiplexer: iio-mux: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:26 +0000 (08:47 +0200)]
iio: multiplexer: iio-mux: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Peter Rosin <peda@axentia.se>
Link: https://lore.kernel.org/r/20200829064726.26268-18-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: magnetometer: mag3110: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:25 +0000 (08:47 +0200)]
iio: magnetometer: mag3110: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200829064726.26268-17-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: magnetometer: ak8974: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:24 +0000 (08:47 +0200)]
iio: magnetometer: ak8974: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20200829064726.26268-16-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: light: tsl2772: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:23 +0000 (08:47 +0200)]
iio: light: tsl2772: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200829064726.26268-15-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: light: isl29018: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:22 +0000 (08:47 +0200)]
iio: light: isl29018: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200829064726.26268-14-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: imu: inv_mpu6050: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:21 +0000 (08:47 +0200)]
iio: imu: inv_mpu6050: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Link: https://lore.kernel.org/r/20200829064726.26268-13-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: dac: dpot-dac: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:20 +0000 (08:47 +0200)]
iio: dac: dpot-dac: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Peter Rosin <peda@axentia.se>
Link: https://lore.kernel.org/r/20200829064726.26268-12-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: chemical: scd30: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:19 +0000 (08:47 +0200)]
iio: chemical: scd30: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Tomasz Duszynski <tomasz.duszynski@octakon.com>
Link: https://lore.kernel.org/r/20200829064726.26268-11-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: amplifiers: hmc425a: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:18 +0000 (08:47 +0200)]
iio: amplifiers: hmc425a: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200829064726.26268-10-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: afe: iio-rescale: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:17 +0000 (08:47 +0200)]
iio: afe: iio-rescale: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Peter Rosin <peda@axentia.se>
Link: https://lore.kernel.org/r/20200829064726.26268-9-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: adc: stm32: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:16 +0000 (08:47 +0200)]
iio: adc: stm32: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200829064726.26268-8-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: adc: rcar-gyroadc: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:15 +0000 (08:47 +0200)]
iio: adc: rcar-gyroadc: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200829064726.26268-7-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: adc: meson_saradc: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:14 +0000 (08:47 +0200)]
iio: adc: meson_saradc: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20200829064726.26268-6-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: adc: ltc2497: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:13 +0000 (08:47 +0200)]
iio: adc: ltc2497: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200829064726.26268-5-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: adc: exynos_adc: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:12 +0000 (08:47 +0200)]
iio: adc: exynos_adc: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200829064726.26268-4-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: adc: envelope-detector: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:11 +0000 (08:47 +0200)]
iio: adc: envelope-detector: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Peter Rosin <peda@axentia.se>
Link: https://lore.kernel.org/r/20200829064726.26268-3-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: accel: mma8452: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:10 +0000 (08:47 +0200)]
iio: accel: mma8452: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200829064726.26268-2-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: accel: bma180: Simplify with dev_err_probe()
Krzysztof Kozlowski [Sat, 29 Aug 2020 06:47:09 +0000 (08:47 +0200)]
iio: accel: bma180: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200829064726.26268-1-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: chemical: atlas-ezo-sensor: add humidity sensor support
Matt Ranostay [Mon, 17 Aug 2020 00:50:52 +0000 (03:50 +0300)]
iio: chemical: atlas-ezo-sensor: add humidity sensor support

Add support for atlas,hum-ezo / humidity sensor which with scaling
provides respective data in millipercent

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: iio: chemical: add Atlas EZO Humidity module documentation
Matt Ranostay [Mon, 17 Aug 2020 00:50:51 +0000 (03:50 +0300)]
dt-bindings: iio: chemical: add Atlas EZO Humidity module documentation

Cc: devicetree@vger.kernel.org
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: adc: adi-axi-adc: Use kobj_to_dev() instead of container_of()
Tian Tao [Thu, 20 Aug 2020 03:01:26 +0000 (11:01 +0800)]
iio: adc: adi-axi-adc: Use kobj_to_dev() instead of container_of()

Use kobj_to_dev() instead of container_of()

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: dac: ad5686: Constify static struct iio_chan_spec
Rikard Falkeborn [Tue, 26 May 2020 21:02:21 +0000 (23:02 +0200)]
iio: dac: ad5686: Constify static struct iio_chan_spec

These are never modified and can be made const to allow the compiler to
put it in read-only memory.

Before:
   text    data     bss     dec     hex filename
   6642   12608      64   19314    4b72 drivers/iio/dac/ad5686.o

After:
   text    data     bss     dec     hex filename
  16946    2304      64   19314    4b72 drivers/iio/dac/ad5686.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio/dac: convert ltc2632.txt to lltc,ltc2632.yaml
Chris Ruehl [Mon, 10 Aug 2020 03:37:52 +0000 (11:37 +0800)]
iio/dac: convert ltc2632.txt to lltc,ltc2632.yaml

Conversion of the ltc2632 to yaml format and name the file to
'lltc,ltc2632.yaml'.

Signed-off-by: Chris Ruehl <chris.ruehl@gtsys.com.hk>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: documentation: light: Add as73211 sysfs documentation
Christian Eggers [Mon, 10 Aug 2020 05:24:47 +0000 (07:24 +0200)]
iio: documentation: light: Add as73211 sysfs documentation

The driver for the as73211 light sensor provides the following not yet
documented sysfs entries:
- in_intensity_(x|y|z)_raw
- in_intensity_(x|y|z)_scale
- in_intensity_sampling_frequency(_available)
- in_intensity_hardwaregain(_available)
- in_intensity_integration_time

Signed-off-by: Christian Eggers <ceggers@arri.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio:adc:axp20x: Convert from OF to generic fw / device properties
Jonathan Cameron [Sun, 9 Aug 2020 14:13:05 +0000 (15:13 +0100)]
iio:adc:axp20x: Convert from OF to generic fw / device properties

Whilst fairly unlikely anyone will ever use this driver with anything
other than DT, we are trying to move IIO over to the generic interfaces
where easy to do so.

In this case this involved moving to generic check on presence
of fwnode, generic device_get_match_data() and dropping the of_match_ptr
protection.  Also relevant header changes to have property.h and
mod_devicetable.h only.

Also drop the casting away of a const in favour of retaining
the const throughout.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Quentin Schulz <quentin.schulz@bootlin.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
3 years agoDocumentation: ABI: iio: fix some spelling mistakes
Ahmad Fatoum [Thu, 13 Aug 2020 06:52:20 +0000 (08:52 +0200)]
Documentation: ABI: iio: fix some spelling mistakes

This fixes some typos found while browsing the documentation.

Cc: trivial@kernel.org
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: health: max30102: update author's email
Matt Ranostay [Fri, 14 Aug 2020 13:49:41 +0000 (06:49 -0700)]
iio: health: max30102: update author's email

Update email to author's current employer

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio:adc:ti-adc081c: Drop ACPI ids that seem very unlikely to be official.
Jonathan Cameron [Tue, 21 Jul 2020 17:14:41 +0000 (18:14 +0100)]
iio:adc:ti-adc081c: Drop ACPI ids that seem very unlikely to be official.

We have no known users of these in the wild.
it seems very unlikely these are real IDs having the form ADCXXXX
as that ID is owned by Achnor Datacomm not TI.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
3 years agoiio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections
Jonathan Cameron [Tue, 21 Jul 2020 17:14:42 +0000 (18:14 +0100)]
iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections

I'm trying to clean this (now) anti-pattern out of IIO to avoid
cut and paste into new drivers.

Also add an include of mod_devicetable.h as the driver directly uses
struct of_device_id which is defined in there.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
3 years agoiio:adc:ti-adc128s052: drop of_match_ptr protection
Jonathan Cameron [Tue, 21 Jul 2020 17:14:43 +0000 (18:14 +0100)]
iio:adc:ti-adc128s052: drop of_match_ptr protection

There is no real advantage in having these protections and
for parts that do not have an explicit ACPI ID, it prevents the
use of PRP0001. I'm trying to clear this out of IIO in general
to avoid copying in new drivers.

Include mod_devicetable.h as we are using of_device_id in here so
including that header is best practice.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Angelo Compagnucci <angelo.compagnucci@gmail.com>
3 years agoiio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h
Jonathan Cameron [Tue, 21 Jul 2020 17:14:44 +0000 (18:14 +0100)]
iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h

This driver cannot be instantiated from ACPI due to it's use of
syscon_regmap_lookup_by_phandle() but in the interests of clearing
this anti pattern out of IIO, let us switch to an explicit
check in Kconfig and remove the protections on the of_match_table
The switch of header is because we only use of_device_id
in here and that is defined in mod_devicetable.h not of.h.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
3 years agoiio: dac: dac5571: Support powerdown for multi-channel
Vincent Whitchurch [Tue, 4 Aug 2020 09:31:38 +0000 (11:31 +0200)]
iio: dac: dac5571: Support powerdown for multi-channel

The driver currently only allows channel 0 to be powered down but the
multi-channel variants of the hardware allow each channel to be powered
down separately and with separate power down modes.  Add support for
this.

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Acked-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: iio: humidity: Add TI HDC20x0 support
Eugene Zaikonnikov [Fri, 7 Aug 2020 14:38:53 +0000 (16:38 +0200)]
dt-bindings: iio: humidity: Add TI HDC20x0 support

Add device tree bindings for HDC2010/HDC2080 family of humidity and
temperature sensors.

Signed-off-by: Eugene Zaikonnikov <ez@norphonic.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: humidity: Add TI HDC20x0 support
Eugene Zaikonnikov [Fri, 7 Aug 2020 14:17:55 +0000 (16:17 +0200)]
iio: humidity: Add TI HDC20x0 support

Add driver support for HDC2010/2080 series devices and sysfs
documentation for their heater element.

HDC2010 is an integrated high-accuracy humidity and temperature sensor
with very low power consumption. The device includes a resistive heating
element. The temperature range is -40C to 125C with 0.2C
accuracy. Humidity measurement is 0 to 100% with 2% RH accuracy.

Signed-off-by: Eugene Zaikonnikov <ez@norphonic.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Use irq trigger flags from firmware
Stephen Boyd [Mon, 3 Aug 2020 23:58:15 +0000 (17:58 -0600)]
iio: sx9310: Use irq trigger flags from firmware

We shouldn't need to set default irq trigger flags here as the firmware
should have properly indicated the trigger type, i.e. level low, in the
DT or ACPI tables.

Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Enable vdd and svdd regulators at probe
Stephen Boyd [Mon, 3 Aug 2020 23:58:14 +0000 (17:58 -0600)]
iio: sx9310: Enable vdd and svdd regulators at probe

Enable the main power supply (vdd) and digital IO power supply (svdd)
during probe so that the i2c communication and device works properly on
boards that aggressively power gate these supplies.

Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Drop channel_users[]
Stephen Boyd [Mon, 3 Aug 2020 23:58:13 +0000 (17:58 -0600)]
iio: sx9310: Drop channel_users[]

This struct member isn't used. Drop it.

Fixes: 72ad02b15d63 ("iio: Add SEMTECH SX9310/9311 sensor driver")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Daniel Campello <campello@chromium.org>
Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Miscellaneous format fixes
Daniel Campello [Mon, 3 Aug 2020 23:58:12 +0000 (17:58 -0600)]
iio: sx9310: Miscellaneous format fixes

Miscellaneous format fixes throughout the whole file.

Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Use variable to hold &client->dev
Daniel Campello [Mon, 3 Aug 2020 23:58:11 +0000 (17:58 -0600)]
iio: sx9310: Use variable to hold &client->dev

Improves readability by storing &client->dev in a local variable.

Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Simplify error return handling
Daniel Campello [Mon, 3 Aug 2020 23:58:10 +0000 (17:58 -0600)]
iio: sx9310: Simplify error return handling

Checks for non-zero return values to signal error conditions.

Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Update copyright
Daniel Campello [Mon, 3 Aug 2020 23:58:09 +0000 (17:58 -0600)]
iio: sx9310: Update copyright

Fixes wrong copyright year.

Signed-off-by: Daniel Campello <campello@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Use regmap_read_poll_timeout() for compensation
Daniel Campello [Mon, 3 Aug 2020 23:58:08 +0000 (17:58 -0600)]
iio: sx9310: Use regmap_read_poll_timeout() for compensation

Simplify compensation stage by using regmap_read_poll_timeout().

Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Use long instead of int for channel bitmaps
Daniel Campello [Mon, 3 Aug 2020 23:58:07 +0000 (17:58 -0600)]
iio: sx9310: Use long instead of int for channel bitmaps

Uses for_each_set_bit() macro to loop over channel bitmaps.

Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Fixes various memory handling
Daniel Campello [Mon, 3 Aug 2020 23:58:06 +0000 (17:58 -0600)]
iio: sx9310: Fixes various memory handling

Makes use __aligned(8) to ensure that the timestamp is correctly aligned
when we call io_push_to_buffers_with_timestamp().
Also makes use of sizeof() for regmap_bulk_read instead of static value.

Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Change from .probe to .probe_new
Daniel Campello [Mon, 3 Aug 2020 23:58:05 +0000 (17:58 -0600)]
iio: sx9310: Change from .probe to .probe_new

Uses .probe_new in place of .probe. Also uses device_get_match_data()
for whoami matching.

Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Remove acpi and of table macros
Daniel Campello [Mon, 3 Aug 2020 23:58:04 +0000 (17:58 -0600)]
iio: sx9310: Remove acpi and of table macros

Avoids unused warnings due to acpi/of table macros.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Fix irq handling
Daniel Campello [Mon, 3 Aug 2020 23:58:03 +0000 (17:58 -0600)]
iio: sx9310: Fix irq handling

Fixes enable/disable irq handling at various points. The driver needs to
only enable/disable irqs if there is an actual irq handler installed.

Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: sx9310: Update macros declarations
Daniel Campello [Mon, 3 Aug 2020 23:58:02 +0000 (17:58 -0600)]
iio: sx9310: Update macros declarations

Follows spec sheet for macro declarations.

Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: iio: Add bindings for sx9310 sensor
Daniel Campello [Mon, 3 Aug 2020 23:58:01 +0000 (17:58 -0600)]
dt-bindings: iio: Add bindings for sx9310 sensor

Adds device tree bindings for sx9310 sensor.

Signed-off-by: Daniel Campello <campello@chromium.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Rob Herring <robh+dt@kernel.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
[swboyd@chromium.org: Add both regulators and make them optional]
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: iio: adc: maxim,max1118 yaml conversion
Jonathan Cameron [Sat, 1 Aug 2020 17:58:50 +0000 (18:58 +0100)]
dt-bindings: iio: adc: maxim,max1118 yaml conversion

Simple device with a simple conversion.  Special handling needed
for the max1118 which is the only supported part that has an external
reference voltage.

Cc: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Rob Herring <robh@kernel.org>
3 years agoiio: light: as73211: New driver
Christian Eggers [Wed, 5 Aug 2020 05:57:44 +0000 (07:57 +0200)]
iio: light: as73211: New driver

Support for AMS AS73211 JENCOLOR(R) Digital XYZ Sensor.

This driver has no built-in trigger. In order for making triggered
measurements, an external (software) trigger driver like
iio-trig-hrtimer or iio-trig-sysfs is required.

The sensor supports single and continuous measurement modes. The latter
is not used by design as this would require tight timing synchronization
between hardware and driver without much benefit.

Datasheet: https://ams.com/documents/20143/36005/AS73211_DS000556_3-01.pdf
Signed-off-by: Christian Eggers <ceggers@arri.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: iio: light: add AMS AS73211 support
Christian Eggers [Wed, 5 Aug 2020 05:57:43 +0000 (07:57 +0200)]
dt-bindings: iio: light: add AMS AS73211 support

Add DT bindings for AMS AS73211 XYZ True Color Sensor.

Signed-off-by: Christian Eggers <ceggers@arri.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agostaging: iio: ad9834: Remove excess blank line
Calvin Glisson [Wed, 5 Aug 2020 22:23:00 +0000 (15:23 -0700)]
staging: iio: ad9834: Remove excess blank line

Remove excess blank line after variable declarations.
Improves code consistency and readability.
Change suggested by checkpatch.pl:

CHECK: Please don't use multiple blank lines

Signed-off-by: Calvin Glisson <taragaram@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoplatform_data: ad7793.h: drop a duplicated word
Randy Dunlap [Sun, 19 Jul 2020 00:30:40 +0000 (17:30 -0700)]
platform_data: ad7793.h: drop a duplicated word

Drop the repeated word "and" in a comment.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: iio: adc: maxim,max9611 yaml conversions
Jonathan Cameron [Wed, 22 Jul 2020 17:12:24 +0000 (18:12 +0100)]
dt-bindings: iio: adc: maxim,max9611 yaml conversions

Straight forward conversion of this binding for this
current sense amplifier and ADC.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
3 years agodt-bindings: iio: adc: maxim,max11100 yaml conversion
Jonathan Cameron [Wed, 22 Jul 2020 17:12:22 +0000 (18:12 +0100)]
dt-bindings: iio: adc: maxim,max11100 yaml conversion

Straight forward conversion for this SPI ADC.
Added limits on spi-max-frequency from datasheet (0.1 to 4.8MHz)

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
3 years agodt-bindings: iio: gyro: Add DT binding doc for ADXRS290
Nishant Malpani [Sun, 26 Jul 2020 14:10:26 +0000 (19:40 +0530)]
dt-bindings: iio: gyro: Add DT binding doc for ADXRS290

Add devicetree binding document for ADXRS290, a dual-axis MEMS gyroscope.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: gyro: Add driver support for ADXRS290
Nishant Malpani [Sun, 26 Jul 2020 14:10:16 +0000 (19:40 +0530)]
iio: gyro: Add driver support for ADXRS290

ADXRS290 is a high performance MEMS pitch and roll (dual-axis in-plane)
angular rate sensor (gyroscope) designed for use in stabilization
applications. It also features an internal temperature sensor and
programmable high-pass and low-pass filters.

Add support for ADXRS290 in direct-access mode for now.

Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXRS290.pdf
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoStaging: iio: Fixed a punctuation and a spelling mistake.
Ankit Baluni [Wed, 29 Jul 2020 08:11:55 +0000 (13:41 +0530)]
Staging: iio: Fixed a punctuation and a spelling mistake.

Added a missing comma and changed 'it it useful' to 'it is useful'.

Signed-off-by: Ankit Baluni <b18007@students.iitmandi.ac.in>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: trigger: make stub functions static inline
Lars-Peter Clausen [Mon, 20 Jul 2020 13:51:33 +0000 (16:51 +0300)]
iio: trigger: make stub functions static inline

Make sure that the trigger function stubs are all static inline.
Otherwise we might see compiler warnings about declared but unused
functions.

Fixes 77712e5fbe2e4: ("Staging: iio: Staticise non-exported functions")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: iio: chemical: add O2 EZO module documentation
Matt Ranostay [Mon, 20 Jul 2020 07:03:29 +0000 (00:03 -0700)]
dt-bindings: iio: chemical: add O2 EZO module documentation

Cc: devicetree@vger.kernel.org
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: Kconfig: ad8366: add entry for HMC1119 chip
Alexandru Ardelean [Mon, 20 Jul 2020 13:52:37 +0000 (16:52 +0300)]
iio: Kconfig: ad8366: add entry for HMC1119 chip

The change is mostly cosmetic. When looking into the menuconfig help of the
ad8366 driver, the HMC1119 chip should also show up (since the driver
supports it).

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: adxl372_i2c: Add OF device ID table
Stefan Popa [Wed, 22 Jul 2020 07:30:03 +0000 (10:30 +0300)]
iio: adxl372_i2c: 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 OF device ID
table.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: adxl372_spi: change indentation for of_table
Alexandru Ardelean [Wed, 22 Jul 2020 07:25:46 +0000 (10:25 +0300)]
iio: adxl372_spi: change indentation for of_table

The change is mostly stylistic. The table should be indented with tabs
instead of spaces.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: frequency: ad9523: convert rest of driver to device managed functions
Alexandru Ardelean [Wed, 22 Jul 2020 07:22:01 +0000 (10:22 +0300)]
iio: frequency: ad9523: convert rest of driver to device managed functions

The driver pretty much uses device managed functions. The only left-over is
the iio_device_register() function, which also requires an action-or-reset
hook to disable the regulator on the remove and error path.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: chemical: atlas-ezo-sensor: add support for O2 sensor
Matt Ranostay [Thu, 23 Jul 2020 06:29:44 +0000 (09:29 +0300)]
iio: chemical: atlas-ezo-sensor: add support for O2 sensor

Add support for the Atlas EZO O2 chemical sensor which required
some refactoring of the driver and parsing of i2c transfer.

Sensor data is converted by the scaling value from percent to
IIO_CONCENTRATION.

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: add IIO_MOD_O2 modifier
Matt Ranostay [Thu, 23 Jul 2020 06:29:43 +0000 (09:29 +0300)]
iio: add IIO_MOD_O2 modifier

Add modifier IIO_MOD_O2 for O2 concentration reporting

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agostaging: hikey9xx: Kconfig: add regulator dependency
Mauro Carvalho Chehab [Tue, 18 Aug 2020 16:04:48 +0000 (18:04 +0200)]
staging: hikey9xx: Kconfig: add regulator dependency

The regulator driver needs it, as otherwise it will produce
errors when creating vmlinux.

Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/a287238bd0141aa68aae7d4cec4c1174a43b3e53.1597766680.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: emxx_udc: Allow for building on !ARM
Alex Dewar [Tue, 18 Aug 2020 15:11:29 +0000 (16:11 +0100)]
staging: emxx_udc: Allow for building on !ARM

Currently the module can only be test built on ARM, although it seems to
build fine on x86. Change this to allow for broader test coverage.

Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
Link: https://lore.kernel.org/r/20200818151133.583382-1-alex.dewar90@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoMAINTAINERS: add an entry for HiSilicon 6421v600 drivers
Mauro Carvalho Chehab [Tue, 18 Aug 2020 14:58:58 +0000 (16:58 +0200)]
MAINTAINERS: add an entry for HiSilicon 6421v600 drivers

Add an entry for the SPMI, MFD and PMIC parts of the
HiSilicon 6421v600 support.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/14b009ef0255d61eeaf4273e9c36dafdb1e5e12f.1597762400.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agodt: document HiSilicon SPMI controller and mfd/regulator properties
Mauro Carvalho Chehab [Tue, 18 Aug 2020 14:58:57 +0000 (16:58 +0200)]
dt: document HiSilicon SPMI controller and mfd/regulator properties

Add documentation for the properties needed by the HiSilicon
6421v600 driver, and by the SPMI controller used to access
the chipset.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/56c40a260bf31edf7049f50586c63ee0d06e02cb.1597762400.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: mfd: hi6421-spmi-pmic: Simplify the compatible string
Mauro Carvalho Chehab [Tue, 18 Aug 2020 14:58:56 +0000 (16:58 +0200)]
staging: mfd: hi6421-spmi-pmic: Simplify the compatible string

It is clear that this driver is for PMIC. So, get rid of
it at the compatible.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/12bdc9b4734e156098408d0d27256abdc91ac283.1597762400.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: spmi: hisi-spmi-controller: change compatible string
Mauro Carvalho Chehab [Tue, 18 Aug 2020 14:58:55 +0000 (16:58 +0200)]
staging: spmi: hisi-spmi-controller: change compatible string

Add the chipset name at the compatible string, as other
HiSilicon chipsets with SPMI bus might require something
different.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/f34062e82b5d5ee49aab4f9055b44e42e5023f0a.1597762400.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: mfd: hi6421-spmi-pmic: get rid of interrupt properties
Mauro Carvalho Chehab [Tue, 18 Aug 2020 14:58:54 +0000 (16:58 +0200)]
staging: mfd: hi6421-spmi-pmic: get rid of interrupt properties

Both irqnum and irqarray properties reflect the same thing:
the number of bits and bytes for interrupts at this
chipset. E. g.:

irqnum = 8 x irqarray

This can be seen by the way pending interrupts are handled:

/* During probe time */
pmic->irqs = devm_kzalloc(dev, pmic->irqnum * sizeof(int), GFP_KERNEL);

/* While handling IRQs */
for (i = 0; i < pmic->irqarray; i++) {
pending = hi6421_spmi_pmic_read(pmic, (i + pmic->irq_addr));
pending &= 0xff;

for_each_set_bit(offset, &pending, 8)
generic_handle_irq(pmic->irqs[offset + i * 8]);

}

Going further, there are some logic at the driver which assumes
that irqarray is 2:

/* solve powerkey order */
if ((i == HISI_IRQ_KEY_NUM) &&
    ((pending & HISI_IRQ_KEY_VALUE) == HISI_IRQ_KEY_VALUE)) {
generic_handle_irq(pmic->irqs[HISI_IRQ_KEY_DOWN]);
generic_handle_irq(pmic->irqs[HISI_IRQ_KEY_UP]);
pending &= (~HISI_IRQ_KEY_VALUE);
}

As HISI_IRQ_KEY_DOWN and HISI_IRQ_KEY_UP are fixed values
and don't depend on irqnum/irqarray.

The IRQ addr and mask addr seem to be also fixed, based on some
comments at the OF parsing code. So, get rid of them too,
removing the of parsing function completely.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/e231244e42cb5b56240705cac2f987e11a078038.1597762400.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: hikey9xx: fix Kconfig dependency chain
Mauro Carvalho Chehab [Tue, 18 Aug 2020 14:58:53 +0000 (16:58 +0200)]
staging: hikey9xx: fix Kconfig dependency chain

Both the SPMI controller and the SPMI PMIC driver
depends on the SPMI bus support.

The dependency for the regulator is also wrong:
it should depends on the SPMI version of the HiSilicon 6421,
and not on the normal one.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/1b7e23500e7449593393115cc0954af441b0c730.1597762400.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: hikey9xx: add a TODO list
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:11:00 +0000 (09:11 +0200)]
staging: hikey9xx: add a TODO list

Place the things that are needed to be able to move those
drivers out of staging.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/bf3ebe32125646e0a87a59280392e8c6fda08488.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: code cleanup
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:59 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: code cleanup

Do some code cleanup in order to make it cleaner for moving
it out of staging in the future.

Suggested-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/32fadb359c1817992af78052e2d9448b8c5fc61f.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: add it to the building system
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:58 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: add it to the building system

Change the binding logic to ensure that the PMIC SPMI
driver will run before the regulator code and add it to the
building system.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/2992dc49945dcfb07c4bd96fa5c288c4e679701a.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: fix some coding style issues
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:57 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: fix some coding style issues

Fix the remaining issues complained by checkpatch.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/af5101fa2ab1d267ac5ac22603f95c6065ac110f.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: cleanup DT settings
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:56 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: cleanup DT settings

Currently, an array is used to store both vsel and enable
settings, mixing registers, masks and bit settings.

Change it in order to have one separate property for each.

This makes easier to understand the contents of the DT
file, and to describe it at the Documentation/.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/fd72215b0a7da55dd727c2d7bd01c047a46cdd2e.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: initialize ramp_delay
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:55 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: initialize ramp_delay

Without that, the regulator's core complains with:

       ldo17: ramp_delay not set

For now, use the enable time, as we don't have any datasheets from
this device.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/67df5456e4f23c88ab4fd9331eb8202c3952e5c5.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: add a driver-specific debug macro
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:54 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: add a driver-specific debug macro

Using dev_dbg() is not too nice, as, instead of printing the
name of the regulator, it prints "regulator.<number>", making
harder to associate what is happening with each ldo line.

So, add a debug-specific macro, which will print the rdev's
name, just like the regulator core.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/1690b8531b23910aa915bd2725410b926022c481.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: don't use usleep_range for off_on_delay
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:53 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: don't use usleep_range for off_on_delay

The regulator's core already handles it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/4f17adca2b04c401e5de5556700638648ce25c0c.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: convert to use get/set voltage_sel
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:52 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: convert to use get/set voltage_sel

As the supported LDOs on this driver are all using a selector,
change the implementation to use get_voltage_sel and
set_voltage_sel ops.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/1cf4f26540e65ffbb561c7d52e53f6be5bd63ac4.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: change namespace
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:51 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: change namespace

Rename the functions used internally inside the driver in
order for them to follow the driver's name.

While here, get rid of some unused definitions at the
header file.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/5cda96baef9374a096a7a0c8f76f60491b0084c7.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: better handle modes
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:50 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: better handle modes

Instead of implementing a custom set of properties, set
valid_modes_mask based on having or not a mask for enabling
the eco_mode.

This makes the code clearer, and remove some uneeded props
from DT.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/0f4ac5a4167bbca428c8507b6992acd8b3ebabd1.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: use shorter names for OF properties
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:49 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: use shorter names for OF properties

Simplify the names of the OF properties, in order to make
them similar to other drivers and to make easier to understand
what each property means.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/98f66100263940901ba59ec187919e9cf5e64f31.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: cleanup debug messages
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:48 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: cleanup debug messages

- use dev_foo() instead of pr_foo();
- cleanup the messages, making them more standard and easier
  to understand.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/2d17e168031340da73e1bd1c826289ceba2dbe8f.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: cleanup struct hisi_regulator
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:47 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: cleanup struct hisi_regulator

There are several fields on this struct that can be removed,
as they already exists at struct regulator_desc.

Remove them, cleaning up the code in the process.

While here, rename it to hi6421v600_regulator_info, in order
to better match the driver's name.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/648d48f11368a9869d760c2bd54bfbc3feb4f44c.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: change the binding logic
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:46 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: change the binding logic

Change the binding logic to ensure that the PMIC SPMI
driver will run before the regulator code and add it to the
building system.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/aa40d443dfc6c8e69e4c36fa79d15459762924e4.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: coding style fixups
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:45 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: coding style fixups

There are several issues on those drivers related to their
coding style. Solve most of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/9ea7fdc004c7c44ae513b6c8f6c4a4493dd1ac61.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: port it to upstream
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:44 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: port it to upstream

The driver was originally written for Kernel 4.9. It needs to
be ported to upstream:

- Got rid of timeval;
- Removed a bogus dependency;
- Did cleanups at the header file.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/9e34400d2cc15ef501a8478f69a95c9abc5c4d8d.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: hi6421v600-regulator: get rid of unused code
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:43 +0000 (09:10 +0200)]
staging: regulator: hi6421v600-regulator: get rid of unused code

Get rid of the sysfs code and other parts of the driver
which aren't needed upstream.

If needed later, this patch can be (partially?) reversed.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/698b2c7bdc92e336d2559bc65415807499b0e3a8.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: regulator: add a regulator driver for HiSilicon 6421v600 SPMI PMIC
Mayulong [Mon, 17 Aug 2020 07:10:42 +0000 (09:10 +0200)]
staging: regulator: add a regulator driver for HiSilicon 6421v600 SPMI PMIC

Add the regulator driver for the LDO lines provided by the
HiSilicon 6421v600 SPMI PMIC device.

[mchehab+huawei@kernel.org: keep just the regulator driver on this patch,
 renaming it to better fit at upstream namespace]

The compete patch is at:
https://github.com/96boards-hikey/linux/commit/08464419fba2

Signed-off-by: Mayulong <mayulong1@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/6e5f6a811edf77575ddaa84ab6542cc646024423.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: mfd: hi6421-spmi-pmic: cleanup the code
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:41 +0000 (09:10 +0200)]
staging: mfd: hi6421-spmi-pmic: cleanup the code

There are several small cleanups that can be done in order to
make the code more prepared to be upstreamed.

Suggested-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/823792ba2f69e613629ab52a33e5728d54e2288b.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: mfd: hi6421-spmi-pmic: add it to the building system
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:40 +0000 (09:10 +0200)]
staging: mfd: hi6421-spmi-pmic: add it to the building system

Now that the driver is ready, place it at the build system.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/952e11ea1a33beaf67d6dc355d5c0f99ab4fb964.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: mfd: hi6421-spmi-pmic: fix some coding style issues
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:39 +0000 (09:10 +0200)]
staging: mfd: hi6421-spmi-pmic: fix some coding style issues

Checkpatch complains about some minor issues inside this
driver that were not addressed by the previous patch.

Address them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/84b53d20632c84cc60b8dadfe937f3c54b355cef.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: mfd: hi6421-spmi-pmic: change namespace on its functions
Mauro Carvalho Chehab [Mon, 17 Aug 2020 07:10:38 +0000 (09:10 +0200)]
staging: mfd: hi6421-spmi-pmic: change namespace on its functions

Rename the functions used internally inside the driver in
order for them to follow the driver's name.

While here, get rid of some unused definitions at the
header file.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/bfa8bf33f71612b1511d73269ca242d0d4e70940.1597647359.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>