First set of new device support, features and cleanups for IIO in the 5.3 cycle

New device support
 * mt6577
   - add supprot for the mt6765 which requires a few minor additional
     new features in the driver.
 
 Yaml binding conversions
 * adxl345
 * isl29018
 * tsl2583
 * tsl2772
 
 Minor features and improvements
 * ad5758
   - declare an of_device_id table rather than just relying on the spi
     fallback which doesn't use the manufacturer id.
   - drop a set but not used variable left from previous refactor.
 * ad7816
   - Add a bit more description to kconfig text.
 * ad9523
   - change calculation order to improve frequency accuracy.
 * adxl372
   - declare an of_device_id table
 * adt7316
   - white space.
 * at91_adc
   - Use dev_get_drvdata directly rather than boucing to the platform device
     and back again.
 * cros_ec
   - add an id sysfs entry to bring in line with the other implementations.
 * ds5522
   - drop a check on the of_node existing as we don't actually use it for
     anything.
 * kxsd9
   - declare an of_device_id table.
 * maxim_thermocouple
   - declare an of_device_id table.
 * mt6577
   - add dt binding entry for mt8183 which is also supported.
 * rcar-gyroadc
   - tidy up unnecessary error messages.
 * stm32-dfsdm
   - improved error handling.
 * stmpe-adc
   - drop an unnecessary variable assignment.
   - add an of_device_id table.
   - reinit completion on begin converstion to avoid a path in which
     previous round had been interrupted, also switch to non interruptible
     wait to avoid an issue with a user program using -pg
   - simplify interrupt handling by just having them always enabled.
   - reset all interrupts on startup and in the timeout handler to
     avoid getting stuck.
 * sun4i-gpadc
   - SPDX
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlzhGTcRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FojBAhAAs2wmP0xK9bvVRCJ8necpxesQFMMCHYl5
 E6oewDaZPsB/zdCmBY8XFnMsIfx+hUWHNlJt1J7IEvdCnDyGJ0S7KKTNFaP9JNNM
 yEuJuzeE6xKr8QPojB6oHPH5aNKk0ZaDb3E0+aLeSgVlAcY6OB6hGBKof2oupNWW
 wwfeiR02pESylP6ZokbjzZTGOoa3fnGDyu2zHtSpNiNq31AwWzOGWSMz3OOohGJ7
 gCpqxMDMhk85haTsfAQ7t8E+HUTB8ABUUqd/ie3rkaHlLjn9mTS8RpCT53I6YoeS
 T7bxJEoboiIYOWr2OHqzMriKbvRi2NU+7s9Vj4PHeE2m3/kveHB3nvA4uElmakGn
 H/WYZee9vxWGcImjU+BtIQ7aWV16J2BJMKjSzLzqAS7CgpGTOOYqRKdZ2MSX+g8H
 rUSK/c17tspr7ZYWQkklbAaq50KJ9rPSzkriHX+0xF74AwjVPbJ1ZJYsmcNZPT0u
 oUNHvV07G7sQcQ3uySG0EHDvWnN5T15ETxe9uIxq5/SoQY09S6NkCrXx9FT4F3rq
 tU2gAMRq6kuvZrPMN5dJiQgGn3xxQWS+u+QB4vfvDb4EMJ8SqdOz9lYRcg0beE2R
 9WtB42aYC7R654dVI13yyD+xjsf3Odd2Xcikp7GhpXvXBBrseNggWZnVAcw/NmuD
 Nfagpatyxvo=
 =dKoi
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First set of new device support, features and cleanups for IIO in the 5.3 cycle

New device support
* mt6577
  - add supprot for the mt6765 which requires a few minor additional
    new features in the driver.

Yaml binding conversions
* adxl345
* isl29018
* tsl2583
* tsl2772

Minor features and improvements
* ad5758
  - declare an of_device_id table rather than just relying on the spi
    fallback which doesn't use the manufacturer id.
  - drop a set but not used variable left from previous refactor.
* ad7816
  - Add a bit more description to kconfig text.
* ad9523
  - change calculation order to improve frequency accuracy.
* adxl372
  - declare an of_device_id table
* adt7316
  - white space.
* at91_adc
  - Use dev_get_drvdata directly rather than boucing to the platform device
    and back again.
* cros_ec
  - add an id sysfs entry to bring in line with the other implementations.
* ds5522
  - drop a check on the of_node existing as we don't actually use it for
    anything.
* kxsd9
  - declare an of_device_id table.
* maxim_thermocouple
  - declare an of_device_id table.
* mt6577
  - add dt binding entry for mt8183 which is also supported.
* rcar-gyroadc
  - tidy up unnecessary error messages.
* stm32-dfsdm
  - improved error handling.
* stmpe-adc
  - drop an unnecessary variable assignment.
  - add an of_device_id table.
  - reinit completion on begin converstion to avoid a path in which
    previous round had been interrupted, also switch to non interruptible
    wait to avoid an issue with a user program using -pg
  - simplify interrupt handling by just having them always enabled.
  - reset all interrupts on startup and in the timeout handler to
    avoid getting stuck.
* sun4i-gpadc
  - SPDX

* tag 'iio-for-5.3a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (28 commits)
  iio: adc: mediatek: mt6577-auxadc, add mt6765 support
  dt-bindings: iio: adc: mediatek: Add document for mt6765
  dt-bindings: iio: accel: adxl345: switch to YAML bindings
  iio: adc: sun4i-gpadc-iio convert to SPDX license tags
  iio: ad9523-1: Improve reported VCO frequency accuracy
  iio: dac: ds4422/ds4424 drop of_node check
  iio: stmpe-adc: Reset possible interrupts
  iio: stmpe-adc: Use wait_for_completion_timeout
  iio: stmpe-adc: Enable all stmpe-adc interrupts just once
  iio: stmpe-adc: Reinit completion struct on begin conversion
  iio: stmpe-adc: Add compatible name
  iio: stmpe-adc: Remove unnecessary assignment
  staging: iio: adc: Add paragraph to describe Kconfig symbol
  staging: iio: adt7316: match parenthesis alignment
  iio: adc: rcar-gyroadc: Remove devm_iio_device_alloc() error printing
  dt-bindings: iio: isl29018: convert bindings to YAML format
  dt-bindings: adc: mt8183: add binding document
  iio: dac: ad5758: remove set but not used variable 'dc_dc_mode'
  iio: cros_ec: add 'id' sysfs entry
  iio: adc: stm32-dfsdm: missing error case during probe
  ...
This commit is contained in:
Greg Kroah-Hartman 2019-05-20 09:13:53 +02:00
commit c8b741e10b
28 changed files with 411 additions and 204 deletions

View file

@ -18,11 +18,11 @@ Description:
values are 'base' and 'lid'.
What: /sys/bus/iio/devices/iio:deviceX/id
Date: Septembre 2017
Date: September 2017
KernelVersion: 4.14
Contact: linux-iio@vger.kernel.org
Description:
This attribute is exposed by the CrOS EC legacy accelerometer
driver and represents the sensor ID as exposed by the EC. This
ID is used by the Android sensor service hardware abstraction
layer (sensor HAL) through the Android container on ChromeOS.
This attribute is exposed by the CrOS EC sensors driver and
represents the sensor ID as exposed by the EC. This ID is used
by the Android sensor service hardware abstraction layer (sensor
HAL) through the Android container on ChromeOS.

View file

@ -0,0 +1,72 @@
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/accelerometers/adi,adxl345.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Analog Devices ADXL345/ADXL375 3-Axis Digital Accelerometers
maintainers:
- Michael Hennerich <michael.hennerich@analog.com>
description: |
Analog Devices ADXL345/ADXL375 3-Axis Digital Accelerometers that supports
both I2C & SPI interfaces.
http://www.analog.com/en/products/mems/accelerometers/adxl345.html
http://www.analog.com/en/products/sensors-mems/accelerometers/adxl375.html
properties:
compatible:
enum:
- adi,adxl345
- adi,adxl375
reg:
maxItems: 1
spi-cpha: true
spi-cpol: true
interrupts:
maxItems: 1
required:
- compatible
- reg
- interrupts
examples:
- |
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
i2c0 {
#address-cells = <1>;
#size-cells = <0>;
/* Example for a I2C device node */
accelerometer@2a {
compatible = "adi,adxl345";
reg = <0x53>;
interrupt-parent = <&gpio0>;
interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
};
};
- |
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
spi0 {
#address-cells = <1>;
#size-cells = <0>;
/* Example for a SPI device node */
accelerometer@0 {
compatible = "adi,adxl345";
reg = <0>;
spi-max-frequency = <5000000>;
spi-cpol;
spi-cpha;
interrupt-parent = <&gpio0>;
interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
};
};

View file

@ -1,39 +0,0 @@
Analog Devices ADXL345/ADXL375 3-Axis Digital Accelerometers
http://www.analog.com/en/products/mems/accelerometers/adxl345.html
http://www.analog.com/en/products/sensors-mems/accelerometers/adxl375.html
Required properties:
- compatible : should be one of
"adi,adxl345"
"adi,adxl375"
- reg : the I2C address or SPI chip select number of the sensor
Required properties for SPI bus usage:
- spi-max-frequency : set maximum clock frequency, must be 5000000
- spi-cpol and spi-cpha : must be defined for adxl345 to enable SPI mode 3
Optional properties:
- interrupts: interrupt mapping for IRQ as documented in
Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
Example for a I2C device node:
accelerometer@2a {
compatible = "adi,adxl345";
reg = <0x53>;
interrupt-parent = <&gpio1>;
interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
};
Example for a SPI device node:
accelerometer@0 {
compatible = "adi,adxl345";
reg = <0>;
spi-max-frequency = <5000000>;
spi-cpol;
spi-cpha;
interrupt-parent = <&gpio1>;
interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
};

View file

@ -13,8 +13,10 @@ Required properties:
- compatible: Should be one of:
- "mediatek,mt2701-auxadc": For MT2701 family of SoCs
- "mediatek,mt2712-auxadc": For MT2712 family of SoCs
- "mediatek,mt6765-auxadc": For MT6765 family of SoCs
- "mediatek,mt7622-auxadc": For MT7622 family of SoCs
- "mediatek,mt8173-auxadc": For MT8173 family of SoCs
- "mediatek,mt8183-auxadc", "mediatek,mt8173-auxadc": For MT8183 family of SoCs
- reg: Address range of the AUXADC unit.
- clocks: Should contain a clock specifier for each entry in clock-names
- clock-names: Should contain "main".

View file

@ -1,27 +0,0 @@
* ISL 29018/29023/29035 I2C ALS, Proximity, and Infrared sensor
Required properties:
- compatible: Should be one of
"isil,isl29018"
"isil,isl29023"
"isil,isl29035"
- reg: the I2C address of the device
Optional properties:
- interrupts: the sole interrupt generated by the device
Refer to interrupt-controller/interrupts.txt for generic interrupt client
node bindings.
- vcc-supply: phandle to the regulator that provides power to the sensor.
Example:
isl29018@44 {
compatible = "isil,isl29018";
reg = <0x44>;
interrupt-parent = <&gpio>;
interrupts = <TEGRA_GPIO(Z, 2) IRQ_TYPE_LEVEL_HIGH>;
};

View file

@ -0,0 +1,56 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/light/isl29018.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: |
Intersil 29018/29023/29035 Ambient Light, Infrared Light, and Proximity Sensor
maintainers:
- Brian Masney <masneyb@onstation.org>
description: |
Ambient and infrared light sensing with proximity detection over an i2c
interface.
https://www.renesas.com/us/en/www/doc/datasheet/isl29018.pdf
https://www.renesas.com/us/en/www/doc/datasheet/isl29023.pdf
https://www.renesas.com/us/en/www/doc/datasheet/isl29035.pdf
properties:
compatible:
enum:
- isil,isl29018
- isil,isl29023
- isil,isl29035
reg:
maxItems: 1
interrupts:
maxItems: 1
vcc-supply:
description: Regulator that provides power to the sensor
required:
- compatible
- reg
examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
sensor@44 {
compatible = "isil,isl29018";
reg = <0x44>;
interrupts-extended = <&msmgpio 61 IRQ_TYPE_LEVEL_HIGH>;
};
};
...

View file

@ -1,25 +0,0 @@
* TAOS TSL 2580/2581/2583 ALS sensor
Required properties:
- compatible: Should be one of
"amstaos,tsl2580"
"amstaos,tsl2581"
"amstaos,tsl2583"
- reg: the I2C address of the device
Optional properties:
- interrupts: the sole interrupt generated by the device
Refer to interrupt-controller/interrupts.txt for generic interrupt client
node bindings.
- vcc-supply: phandle to the regulator that provides power to the sensor.
Example:
tsl2581@29 {
compatible = "amstaos,tsl2581";
reg = <0x29>;
};

View file

@ -0,0 +1,46 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/light/tsl2583.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: AMS/TAOS Ambient Light Sensor (ALS)
maintainers:
- Brian Masney <masneyb@onstation.org>
description: |
Ambient light sensing with an i2c interface.
properties:
compatible:
enum:
- amstaos,tsl2580
- amstaos,tsl2581
- amstaos,tsl2583
reg:
maxItems: 1
interrupts:
maxItems: 1
vcc-supply:
description: Regulator that provides power to the sensor
required:
- compatible
- reg
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
light-sensor@29 {
compatible = "amstaos,tsl2581";
reg = <0x29>;
};
};
...

View file

@ -1,42 +0,0 @@
* AMS/TAOS ALS and proximity sensor
Required properties:
- compatible: Should be one of
"amstaos,tsl2571"
"amstaos,tsl2671"
"amstaos,tmd2671"
"amstaos,tsl2771"
"amstaos,tmd2771"
"amstaos,tsl2572"
"amstaos,tsl2672"
"amstaos,tmd2672"
"amstaos,tsl2772"
"amstaos,tmd2772"
"avago,apds9930"
- reg: the I2C address of the device
Optional properties:
- amstaos,proximity-diodes - proximity diodes to enable. <0>, <1>, or <0 1>
are the only valid values.
- led-max-microamp - current for the proximity LED. Must be 100000, 50000,
25000, or 13000.
- vdd-supply: phandle to the regulator that provides power to the sensor.
- vddio-supply: phandle to the regulator that provides power to the bus.
- interrupts: the sole interrupt generated by the device
Refer to interrupt-controller/interrupts.txt for generic interrupt client
node bindings.
Example:
tsl2772@39 {
compatible = "amstaos,tsl2772";
reg = <0x39>;
interrupts-extended = <&msmgpio 61 IRQ_TYPE_EDGE_FALLING>;
vdd-supply = <&pm8941_l17>;
vddio-supply = <&pm8941_lvs1>;
amstaos,proximity-diodes = <0>;
led-max-microamp = <100000>;
};

View file

@ -0,0 +1,83 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/light/tsl2772.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: AMS/TAOS Ambient Light Sensor (ALS) and Proximity Detector
maintainers:
- Brian Masney <masneyb@onstation.org>
description: |
Ambient light sensing and proximity detection with an i2c interface.
https://ams.com/documents/20143/36005/TSL2772_DS000181_2-00.pdf
properties:
compatible:
enum:
- amstaos,tsl2571
- amstaos,tsl2671
- amstaos,tmd2671
- amstaos,tsl2771
- amstaos,tmd2771
- amstaos,tsl2572
- amstaos,tsl2672
- amstaos,tmd2672
- amstaos,tsl2772
- amstaos,tmd2772
- avago,apds9930
reg:
maxItems: 1
amstaos,proximity-diodes:
description: Proximity diodes to enable
allOf:
- $ref: /schemas/types.yaml#/definitions/uint32-array
- minItems: 1
maxItems: 2
items:
minimum: 0
maximum: 1
interrupts:
maxItems: 1
led-max-microamp:
description: Current for the proximity LED
enum:
- 13000
- 25000
- 50000
- 100000
vdd-supply:
description: Regulator that provides power to the sensor
vddio-supply:
description: Regulator that provides power to the bus
required:
- compatible
- reg
examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
sensor@39 {
compatible = "amstaos,tsl2772";
reg = <0x39>;
interrupts-extended = <&msmgpio 61 IRQ_TYPE_EDGE_FALLING>;
vdd-supply = <&pm8941_l17>;
vddio-supply = <&pm8941_lvs1>;
amstaos,proximity-diodes = <0>;
led-max-microamp = <100000>;
};
};
...

View file

@ -551,6 +551,7 @@ W: http://wiki.analog.com/ADXL345
W: http://ez.analog.com/community/linux-device-drivers
S: Supported
F: drivers/input/misc/adxl34x.c
F: Documentation/devicetree/bindings/iio/accel/adi,adxl345.yaml
ADXL372 THREE-AXIS DIGITAL ACCELEROMETER DRIVER
M: Stefan Popa <stefan.popa@analog.com>

View file

@ -7,6 +7,8 @@
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/spi/spi.h>
#include "adxl372.h"
@ -37,9 +39,16 @@ static const struct spi_device_id adxl372_spi_id[] = {
};
MODULE_DEVICE_TABLE(spi, adxl372_spi_id);
static const struct of_device_id adxl372_of_match[] = {
{ .compatible = "adi,adxl372" },
{ },
};
MODULE_DEVICE_TABLE(of, adxl372_of_match);
static struct spi_driver adxl372_spi_driver = {
.driver = {
.name = "adxl372_spi",
.of_match_table = adxl372_of_match,
},
.probe = adxl372_spi_probe,
.id_table = adxl372_spi_id,

View file

@ -1,5 +1,7 @@
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/spi/spi.h>
#include <linux/module.h>
#include <linux/slab.h>
@ -40,10 +42,17 @@ static const struct spi_device_id kxsd9_spi_id[] = {
};
MODULE_DEVICE_TABLE(spi, kxsd9_spi_id);
static const struct of_device_id kxsd9_of_match[] = {
{ .compatible = "kionix,kxsd9" },
{ },
};
MODULE_DEVICE_TABLE(of, kxsd9_of_match);
static struct spi_driver kxsd9_spi_driver = {
.driver = {
.name = "kxsd9",
.pm = &kxsd9_dev_pm_ops,
.of_match_table = kxsd9_of_match,
},
.probe = kxsd9_spi_probe,
.remove = kxsd9_spi_remove,

View file

@ -1586,8 +1586,7 @@ static void at91_adc_hw_init(struct at91_adc_state *st)
static ssize_t at91_adc_get_fifo_state(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct iio_dev *indio_dev =
platform_get_drvdata(to_platform_device(dev));
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct at91_adc_state *st = iio_priv(indio_dev);
return scnprintf(buf, PAGE_SIZE, "%d\n", !!st->dma_st.dma_chan);
@ -1596,8 +1595,7 @@ static ssize_t at91_adc_get_fifo_state(struct device *dev,
static ssize_t at91_adc_get_watermark(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct iio_dev *indio_dev =
platform_get_drvdata(to_platform_device(dev));
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct at91_adc_state *st = iio_priv(indio_dev);
return scnprintf(buf, PAGE_SIZE, "%d\n", st->dma_st.watermark);
@ -1849,8 +1847,7 @@ static int at91_adc_remove(struct platform_device *pdev)
static __maybe_unused int at91_adc_suspend(struct device *dev)
{
struct iio_dev *indio_dev =
platform_get_drvdata(to_platform_device(dev));
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct at91_adc_state *st = iio_priv(indio_dev);
/*
@ -1870,8 +1867,7 @@ static __maybe_unused int at91_adc_suspend(struct device *dev)
static __maybe_unused int at91_adc_resume(struct device *dev)
{
struct iio_dev *indio_dev =
platform_get_drvdata(to_platform_device(dev));
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct at91_adc_state *st = iio_priv(indio_dev);
int ret;

View file

@ -1360,7 +1360,7 @@ static int at91_adc_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int at91_adc_suspend(struct device *dev)
{
struct iio_dev *idev = platform_get_drvdata(to_platform_device(dev));
struct iio_dev *idev = dev_get_drvdata(dev);
struct at91_adc_state *st = iio_priv(idev);
pinctrl_pm_select_sleep_state(dev);
@ -1371,7 +1371,7 @@ static int at91_adc_suspend(struct device *dev)
static int at91_adc_resume(struct device *dev)
{
struct iio_dev *idev = platform_get_drvdata(to_platform_device(dev));
struct iio_dev *idev = dev_get_drvdata(dev);
struct at91_adc_state *st = iio_priv(idev);
clk_prepare_enable(st->clk);

View file

@ -42,10 +42,26 @@
#define MT6577_AUXADC_POWER_READY_MS 1
#define MT6577_AUXADC_SAMPLE_READY_US 25
struct mtk_auxadc_compatible {
bool sample_data_cali;
bool check_global_idle;
};
struct mt6577_auxadc_device {
void __iomem *reg_base;
struct clk *adc_clk;
struct mutex lock;
const struct mtk_auxadc_compatible *dev_comp;
};
static const struct mtk_auxadc_compatible mt8173_compat = {
.sample_data_cali = false,
.check_global_idle = true,
};
static const struct mtk_auxadc_compatible mt6765_compat = {
.sample_data_cali = true,
.check_global_idle = false,
};
#define MT6577_AUXADC_CHANNEL(idx) { \
@ -74,6 +90,11 @@ static const struct iio_chan_spec mt6577_auxadc_iio_channels[] = {
MT6577_AUXADC_CHANNEL(15),
};
static int mt_auxadc_get_cali_data(int rawdata, bool enable_cali)
{
return rawdata;
}
static inline void mt6577_auxadc_mod_reg(void __iomem *reg,
u32 or_mask, u32 and_mask)
{
@ -120,15 +141,17 @@ static int mt6577_auxadc_read(struct iio_dev *indio_dev,
/* we must delay here for hardware sample channel data */
udelay(MT6577_AUXADC_SAMPLE_READY_US);
/* check MTK_AUXADC_CON2 if auxadc is idle */
ret = readl_poll_timeout(adc_dev->reg_base + MT6577_AUXADC_CON2, val,
((val & MT6577_AUXADC_STA) == 0),
MT6577_AUXADC_SLEEP_US,
MT6577_AUXADC_TIMEOUT_US);
if (ret < 0) {
dev_err(indio_dev->dev.parent,
"wait for auxadc idle time out\n");
goto err_timeout;
if (adc_dev->dev_comp->check_global_idle) {
/* check MTK_AUXADC_CON2 if auxadc is idle */
ret = readl_poll_timeout(adc_dev->reg_base + MT6577_AUXADC_CON2,
val, ((val & MT6577_AUXADC_STA) == 0),
MT6577_AUXADC_SLEEP_US,
MT6577_AUXADC_TIMEOUT_US);
if (ret < 0) {
dev_err(indio_dev->dev.parent,
"wait for auxadc idle time out\n");
goto err_timeout;
}
}
/* read channel and make sure ready bit == 1 */
@ -163,6 +186,8 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev,
int *val2,
long info)
{
struct mt6577_auxadc_device *adc_dev = iio_priv(indio_dev);
switch (info) {
case IIO_CHAN_INFO_PROCESSED:
*val = mt6577_auxadc_read(indio_dev, chan);
@ -172,6 +197,8 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev,
chan->channel);
return *val;
}
if (adc_dev->dev_comp->sample_data_cali)
*val = mt_auxadc_get_cali_data(*val, true);
return IIO_VAL_INT;
default:
@ -304,10 +331,11 @@ static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
mt6577_auxadc_resume);
static const struct of_device_id mt6577_auxadc_of_match[] = {
{ .compatible = "mediatek,mt2701-auxadc", },
{ .compatible = "mediatek,mt2712-auxadc", },
{ .compatible = "mediatek,mt7622-auxadc", },
{ .compatible = "mediatek,mt8173-auxadc", },
{ .compatible = "mediatek,mt2701-auxadc", .data = &mt8173_compat},
{ .compatible = "mediatek,mt2712-auxadc", .data = &mt8173_compat},
{ .compatible = "mediatek,mt7622-auxadc", .data = &mt8173_compat},
{ .compatible = "mediatek,mt8173-auxadc", .data = &mt8173_compat},
{ .compatible = "mediatek,mt6765-auxadc", .data = &mt6765_compat},
{ }
};
MODULE_DEVICE_TABLE(of, mt6577_auxadc_of_match);

View file

@ -485,10 +485,8 @@ static int rcar_gyroadc_probe(struct platform_device *pdev)
int ret;
indio_dev = devm_iio_device_alloc(dev, sizeof(*priv));
if (!indio_dev) {
dev_err(dev, "Failed to allocate IIO device.\n");
if (!indio_dev)
return -ENOMEM;
}
priv = iio_priv(indio_dev);
priv->dev = dev;

View file

@ -1456,6 +1456,12 @@ static int stm32_dfsdm_adc_probe(struct platform_device *pdev)
* So IRQ associated to filter instance 0 is dedicated to the Filter 0.
*/
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
if (irq != -EPROBE_DEFER)
dev_err(dev, "Failed to get IRQ: %d\n", irq);
return irq;
}
ret = devm_request_irq(dev, irq, stm32_dfsdm_irq,
0, pdev->name, adc);
if (ret < 0) {

View file

@ -233,6 +233,8 @@ static int stm32_dfsdm_parse_of(struct platform_device *pdev,
}
priv->dfsdm.phys_base = res->start;
priv->dfsdm.base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->dfsdm.base))
return PTR_ERR(priv->dfsdm.base);
/*
* "dfsdm" clock is mandatory for DFSDM peripheral clocking.
@ -242,8 +244,10 @@ static int stm32_dfsdm_parse_of(struct platform_device *pdev,
*/
priv->clk = devm_clk_get(&pdev->dev, "dfsdm");
if (IS_ERR(priv->clk)) {
dev_err(&pdev->dev, "No stm32_dfsdm_clk clock found\n");
return -EINVAL;
ret = PTR_ERR(priv->clk);
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "Failed to get clock (%d)\n", ret);
return ret;
}
priv->aclk = devm_clk_get(&pdev->dev, "audio");

View file

@ -65,6 +65,8 @@ static int stmpe_read_voltage(struct stmpe_adc *info,
mutex_lock(&info->lock);
reinit_completion(&info->completion);
info->channel = (u8)chan->channel;
if (info->channel > STMPE_ADC_LAST_NR) {
@ -72,23 +74,16 @@ static int stmpe_read_voltage(struct stmpe_adc *info,
return -EINVAL;
}
stmpe_reg_write(info->stmpe, STMPE_REG_ADC_INT_EN,
STMPE_ADC_CH(info->channel));
stmpe_reg_write(info->stmpe, STMPE_REG_ADC_CAPT,
STMPE_ADC_CH(info->channel));
*val = info->value;
ret = wait_for_completion_interruptible_timeout
(&info->completion, STMPE_ADC_TIMEOUT);
ret = wait_for_completion_timeout(&info->completion, STMPE_ADC_TIMEOUT);
if (ret <= 0) {
stmpe_reg_write(info->stmpe, STMPE_REG_ADC_INT_STA,
STMPE_ADC_CH(info->channel));
mutex_unlock(&info->lock);
if (ret == 0)
return -ETIMEDOUT;
else
return ret;
return -ETIMEDOUT;
}
*val = info->value;
@ -105,6 +100,8 @@ static int stmpe_read_temp(struct stmpe_adc *info,
mutex_lock(&info->lock);
reinit_completion(&info->completion);
info->channel = (u8)chan->channel;
if (info->channel != STMPE_TEMP_CHANNEL) {
@ -115,15 +112,11 @@ static int stmpe_read_temp(struct stmpe_adc *info,
stmpe_reg_write(info->stmpe, STMPE_REG_TEMP_CTRL,
STMPE_START_ONE_TEMP_CONV);
ret = wait_for_completion_interruptible_timeout
(&info->completion, STMPE_ADC_TIMEOUT);
ret = wait_for_completion_timeout(&info->completion, STMPE_ADC_TIMEOUT);
if (ret <= 0) {
mutex_unlock(&info->lock);
if (ret == 0)
return -ETIMEDOUT;
else
return ret;
return -ETIMEDOUT;
}
/*
@ -331,6 +324,12 @@ static int stmpe_adc_probe(struct platform_device *pdev)
if (ret)
return ret;
stmpe_reg_write(info->stmpe, STMPE_REG_ADC_INT_EN,
~(norequest_mask & 0xFF));
stmpe_reg_write(info->stmpe, STMPE_REG_ADC_INT_STA,
~(norequest_mask & 0xFF));
return devm_iio_device_register(&pdev->dev, indio_dev);
}
@ -353,9 +352,14 @@ static struct platform_driver stmpe_adc_driver = {
.pm = &stmpe_adc_pm_ops,
},
};
module_platform_driver(stmpe_adc_driver);
static const struct of_device_id stmpe_adc_ids[] = {
{ .compatible = "st,stmpe-adc", },
{ },
};
MODULE_DEVICE_TABLE(of, stmpe_adc_ids);
MODULE_AUTHOR("Stefan Agner <stefan.agner@toradex.com>");
MODULE_DESCRIPTION("STMPEXXX ADC driver");
MODULE_LICENSE("GPL v2");

View file

@ -1,11 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
/* ADC driver for sunxi platforms' (A10, A13 and A31) GPADC
*
* Copyright (c) 2016 Quentin Schulz <quentin.schulz@free-electrons.com>
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 2 as published by the
* Free Software Foundation.
*
* The Allwinner SoCs all have an ADC that can also act as a touchscreen
* controller and a thermal sensor.
* The thermal sensor works only when the ADC acts as a touchscreen controller

View file

@ -125,6 +125,15 @@ static ssize_t cros_ec_sensors_calibrate(struct iio_dev *indio_dev,
return ret ? ret : len;
}
static ssize_t cros_ec_sensors_id(struct iio_dev *indio_dev,
uintptr_t private,
const struct iio_chan_spec *chan, char *buf)
{
struct cros_ec_sensors_core_state *st = iio_priv(indio_dev);
return snprintf(buf, PAGE_SIZE, "%d\n", st->param.info.sensor_num);
}
static ssize_t cros_ec_sensors_loc(struct iio_dev *indio_dev,
uintptr_t private, const struct iio_chan_spec *chan,
char *buf)
@ -140,6 +149,11 @@ const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[] = {
.shared = IIO_SHARED_BY_ALL,
.write = cros_ec_sensors_calibrate
},
{
.name = "id",
.shared = IIO_SHARED_BY_ALL,
.read = cros_ec_sensors_id
},
{
.name = "location",
.shared = IIO_SHARED_BY_ALL,

View file

@ -11,6 +11,8 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/property.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/spi/spi.h>
#include <linux/gpio/consumer.h>
@ -582,7 +584,7 @@ static ssize_t ad5758_write_powerdown(struct iio_dev *indio_dev,
{
struct ad5758_state *st = iio_priv(indio_dev);
bool pwr_down;
unsigned int dc_dc_mode, dac_config_mode, val;
unsigned int dac_config_mode, val;
unsigned long int dac_config_msk;
int ret;
@ -591,13 +593,10 @@ static ssize_t ad5758_write_powerdown(struct iio_dev *indio_dev,
return ret;
mutex_lock(&st->lock);
if (pwr_down) {
dc_dc_mode = AD5758_DCDC_MODE_POWER_OFF;
if (pwr_down)
val = 0;
} else {
dc_dc_mode = st->dc_dc_mode;
else
val = 1;
}
dac_config_mode = AD5758_DAC_CONFIG_OUT_EN_MODE(val) |
AD5758_DAC_CONFIG_INT_EN_MODE(val);
@ -885,9 +884,16 @@ static const struct spi_device_id ad5758_id[] = {
};
MODULE_DEVICE_TABLE(spi, ad5758_id);
static const struct of_device_id ad5758_of_match[] = {
{ .compatible = "adi,ad5758" },
{ },
};
MODULE_DEVICE_TABLE(of, ad5758_of_match);
static struct spi_driver ad5758_driver = {
.driver = {
.name = KBUILD_MODNAME,
.of_match_table = ad5758_of_match,
},
.probe = ad5758_probe,
.id_table = ad5758_id,

View file

@ -236,12 +236,6 @@ static int ds4424_probe(struct i2c_client *client,
indio_dev->dev.of_node = client->dev.of_node;
indio_dev->dev.parent = &client->dev;
if (!client->dev.of_node) {
dev_err(&client->dev,
"Not found DT.\n");
return -ENODEV;
}
data->vcc_reg = devm_regulator_get(&client->dev, "vcc");
if (IS_ERR(data->vcc_reg)) {
dev_err(&client->dev,

View file

@ -862,9 +862,11 @@ static int ad9523_setup(struct iio_dev *indio_dev)
if (ret < 0)
return ret;
st->vco_freq = (pdata->vcxo_freq * (pdata->pll2_freq_doubler_en ? 2 : 1)
/ pdata->pll2_r2_div) * AD9523_PLL2_FB_NDIV(pdata->
pll2_ndiv_a_cnt, pdata->pll2_ndiv_b_cnt);
st->vco_freq = div_u64((unsigned long long)pdata->vcxo_freq *
(pdata->pll2_freq_doubler_en ? 2 : 1) *
AD9523_PLL2_FB_NDIV(pdata->pll2_ndiv_a_cnt,
pdata->pll2_ndiv_b_cnt),
pdata->pll2_r2_div);
ret = ad9523_write(indio_dev, AD9523_PLL2_VCO_CTRL,
AD9523_PLL2_VCO_CALIBRATE);

View file

@ -10,6 +10,8 @@
#include <linux/init.h>
#include <linux/mutex.h>
#include <linux/err.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/spi/spi.h>
#include <linux/iio/iio.h>
#include <linux/iio/trigger.h>
@ -262,9 +264,17 @@ static const struct spi_device_id maxim_thermocouple_id[] = {
};
MODULE_DEVICE_TABLE(spi, maxim_thermocouple_id);
static const struct of_device_id maxim_thermocouple_of_match[] = {
{ .compatible = "maxim,max6675" },
{ .compatible = "maxim,max31855" },
{ },
};
MODULE_DEVICE_TABLE(of, maxim_thermocouple_of_match);
static struct spi_driver maxim_thermocouple_driver = {
.driver = {
.name = MAXIM_THERMOCOUPLE_DRV_NAME,
.of_match_table = maxim_thermocouple_of_match,
},
.probe = maxim_thermocouple_probe,
.remove = maxim_thermocouple_remove,

View file

@ -12,6 +12,9 @@ config AD7816
Say yes here to build support for Analog Devices AD7816/7/8
temperature sensors and ADC.
To compile this driver as a module, choose M here: the
module will be called ad7816.
config AD7192
tristate "Analog Devices AD7190 AD7192 AD7193 AD7195 ADC driver"
depends on SPI

View file

@ -2154,7 +2154,7 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
chip->dac_bits = 8;
chip->ldac_pin = devm_gpiod_get_optional(dev, "adi,ldac",
GPIOD_OUT_LOW);
GPIOD_OUT_LOW);
if (IS_ERR(chip->ldac_pin)) {
ret = PTR_ERR(chip->ldac_pin);
dev_err(dev, "Failed to request ldac GPIO: %d\n", ret);