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

Some new devices, but particularly good this time is the core rework coming
 from Alexandru. Some of this has been in Analog's tree a long time, but other
 parts are motivated by closing down common mistakes in new drivers.
 
 Changes since first try at this pull request:
 * Add missed patch to actually remove iio_priv_to_dev and as a result
   also drop a few ingenic patches that need to be updated to take this
   into account.
 * Fix an ordering issue int he pollfunc attach in the core rework.
 
 New device support
 * qcom pmic7 adc
   - New driver using common qcom-vadc library. Some associated cleanups and
     refactors.
 * invensense icm42600
   - New driver supporting icm42600, icm42602, icm42605 and icm42622 via i2c
     or spi.  These are all 6 axis IMUs with gyro and accelerometers.
     Driver supports buffered modes using the hardware fifo and interpolation
     for accurate timestamps.
 * sensirion scd30
   - New driver for this carbon dioxide sensor including i2c and serial
     interfaces + bindings.
 
 Features
 * ak8975
   - Add reset gpio support.
 * bma400
   - Support SPI.
 * bmc150
   - Document and add support for bmc156b and bmm150b, tidy up _magn endings.
 * bmi160
   - Regulator and mount matrix support.
 * mxc4005
   - Add ID for mxc6655
 * rockchip-saradc
   - Triggered buffer support.
 
 DT bindings
 * qcom spmi-vadc converted to yaml + pmic7 bindings
 * ak8975 tidy up and convert to yaml + add reset-gpio binding
 * ingenic-adc -convert to yaml.
 
 Core rework all carried through by Alexandru Ardelean.
 * Assign parent device in the core rather than every driver. A few devices
   need to provide specific non standard parents, so there is support for
   overriding.
 * Start to take parts of struct iio_dev opaque to the drivers.
   This will be a long term job, but should reduce the number of drivers
   we get that use parts that are currently only 'internal' by documentation.
 * Move attach and detach of pollfunc to the core.  Every triggered buffer
   using driver had to do the same thing, so lets do it in the core.  The
   hard part here was getting all the drivers into canonical form so there
   would be no functional changes in this final patch.  That's taken quite
   a lot of work over last couple of cycles!
 
 Cleanups and minor fixes.
 * docs
   - Improve IIO_CONCENTRATION channel type description in ABI docs.
   - Drop doubled word cases.
   - Http to Https conversion.
 * core
   - Make iio_device_get_drvdata take a const struct iio_dev * avoiding some
     nasty casts.
 * ADCs
   - Drop lots of users of of_match_ptr macro, includes of mod_devicetable.h
     and CONFIG_OF protections.  These prevent use of ACPI PRP0001 with these
     drivers and get coppied into lots of new drivers.
 * ad5380
   - Constify iio_chan_spec_ext_info
 * ad5592r
   - Constify iio_chan_spec_ext_info
   - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
 * ad8366
   - Make gpio optional as doesn't matter if its there or not.
 * adis16480
   - Use irq types instead of the flags.
 * atlas-ezo-sensor
   - Minimize scope of ret variable.
 * at91-adc
   - Add COMPILE_TEST dependency to driver to improve build coverage.
   - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
 * at91-sama5d2
   - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
   - Drop Ludovic as a co-maintaienr.
 * cros_ec
   - Reapply the range after resume.
   - Add a read only frequency entry for legacy version.
   - Typo fixes
 * hts221
   - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
 * inv_mpu
   - Drop double check on ACPI companion device.
 * iqs621
   - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
 * iqs624
   - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
 * max11100
   - Constify iio_chan_spec
 * mmc35240
   - Constify reg_default
 * rockchip-saradc
   - Move to managed allocators for everything in probe.
   - Use more distinctive prefix for channel macros.
 * stk3310
   - Constify regmap_config.
 * stm32-adc
   - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
 * stm32-dfsdm-adc
   - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
 * ti-am335x
   - Use managed allocations where straight forward in probe function.
 * tsl2563
   - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAl8RWQMRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0Fog3jg//cMoA/XHNIbhpCCR0soQgculw+b8qmvGn
 GMSt2g6AZadRWmKAlzIVn34GJ2TmskA0ksawSLPLPNw0AhGvp+/XJ+UGc6JmF+Sf
 5SHbL67e0y8GbGt8882B56ApeLKOVt8sMHIcMHG7xanwZFTw6uFv+OYdjxrG+HhX
 YQGyxvSEoXn4xRmjfdw5s/raGuJqfeqYP4PH4FMMoKC6UfLj4tDkLd4/n2C0iCl9
 FcozwAT08zZXPYxfBMlG8q44hdSS3DDhVsfmvOlH1T1wN/zA/JqMV0h+qytOgtOV
 l1UBCpzpVuTRMJPRf4zHEamsvjo7uhUcr2P5xxGs3hFbXpZwvzWIKffkOwDo09QX
 3z7pt6UxfGRc1yKLa3jCgSw6YTtAWBSqZgzEzJSBiM3Au2uUz/a0uD9CpZJAwpAz
 Mqd7JqSJmQ2jusrPRQxuYyofGDie1iWsdFx+87BxzoajXRha1Wy10a+t1ItQDWiv
 ayEWykptiA0XprJ2m2gYrziWptsgKgK3Z4qo9WaV5N6hyiOH00MPJ9U5RIfEHk0t
 cL5KAQv28FHDP9ZKAdMwB6Qjjsj1Xgbvej+XCG4BPtgSQg2/kec7DEqWy9+HVOnR
 kcoTSC9ON1+sN59G95w76mOjNYtz98DnRIgVlGsh3Tk2pApUJjSywl3cKtoih0WK
 9XqtPrrDQfI=
 =LyRl
 -----END PGP SIGNATURE-----

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

Jonathan writes:

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

Some new devices, but particularly good this time is the core rework coming
from Alexandru. Some of this has been in Analog's tree a long time, but other
parts are motivated by closing down common mistakes in new drivers.

Changes since first try at this pull request:
* Add missed patch to actually remove iio_priv_to_dev and as a result
  also drop a few ingenic patches that need to be updated to take this
  into account.
* Fix an ordering issue int he pollfunc attach in the core rework.

New device support
* qcom pmic7 adc
  - New driver using common qcom-vadc library. Some associated cleanups and
    refactors.
* invensense icm42600
  - New driver supporting icm42600, icm42602, icm42605 and icm42622 via i2c
    or spi.  These are all 6 axis IMUs with gyro and accelerometers.
    Driver supports buffered modes using the hardware fifo and interpolation
    for accurate timestamps.
* sensirion scd30
  - New driver for this carbon dioxide sensor including i2c and serial
    interfaces + bindings.

Features
* ak8975
  - Add reset gpio support.
* bma400
  - Support SPI.
* bmc150
  - Document and add support for bmc156b and bmm150b, tidy up _magn endings.
* bmi160
  - Regulator and mount matrix support.
* mxc4005
  - Add ID for mxc6655
* rockchip-saradc
  - Triggered buffer support.

DT bindings
* qcom spmi-vadc converted to yaml + pmic7 bindings
* ak8975 tidy up and convert to yaml + add reset-gpio binding
* ingenic-adc -convert to yaml.

Core rework all carried through by Alexandru Ardelean.
* Assign parent device in the core rather than every driver. A few devices
  need to provide specific non standard parents, so there is support for
  overriding.
* Start to take parts of struct iio_dev opaque to the drivers.
  This will be a long term job, but should reduce the number of drivers
  we get that use parts that are currently only 'internal' by documentation.
* Move attach and detach of pollfunc to the core.  Every triggered buffer
  using driver had to do the same thing, so lets do it in the core.  The
  hard part here was getting all the drivers into canonical form so there
  would be no functional changes in this final patch.  That's taken quite
  a lot of work over last couple of cycles!

Cleanups and minor fixes.
* docs
  - Improve IIO_CONCENTRATION channel type description in ABI docs.
  - Drop doubled word cases.
  - Http to Https conversion.
* core
  - Make iio_device_get_drvdata take a const struct iio_dev * avoiding some
    nasty casts.
* ADCs
  - Drop lots of users of of_match_ptr macro, includes of mod_devicetable.h
    and CONFIG_OF protections.  These prevent use of ACPI PRP0001 with these
    drivers and get coppied into lots of new drivers.
* ad5380
  - Constify iio_chan_spec_ext_info
* ad5592r
  - Constify iio_chan_spec_ext_info
  - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
* ad8366
  - Make gpio optional as doesn't matter if its there or not.
* adis16480
  - Use irq types instead of the flags.
* atlas-ezo-sensor
  - Minimize scope of ret variable.
* at91-adc
  - Add COMPILE_TEST dependency to driver to improve build coverage.
  - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
* at91-sama5d2
  - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
  - Drop Ludovic as a co-maintaienr.
* cros_ec
  - Reapply the range after resume.
  - Add a read only frequency entry for legacy version.
  - Typo fixes
* hts221
  - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
* inv_mpu
  - Drop double check on ACPI companion device.
* iqs621
  - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
* iqs624
  - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
* max11100
  - Constify iio_chan_spec
* mmc35240
  - Constify reg_default
* rockchip-saradc
  - Move to managed allocators for everything in probe.
  - Use more distinctive prefix for channel macros.
* stk3310
  - Constify regmap_config.
* stm32-adc
  - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
* stm32-dfsdm-adc
  - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)
* ti-am335x
  - Use managed allocations where straight forward in probe function.
* tsl2563
  - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque)

* tag 'iio-for-5.9a-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (107 commits)
  iio: buffer: fix attach/detach pollfunc order
  iio: core: remove iio_priv_to_dev() helper
  Replace HTTP links with HTTPS ones: drivers/iio
  Replace HTTP links with HTTPS ones: Documentation/devicetree/bindings/iio
  dt-bindings: iio/adc: Convert ingenic-adc docs to YAML.
  iio: cros_ec_accel_legacy: Add Read Only frequency entries
  MAINTAINERS: adc: at91-sama5d2_adc: remove myself as co-maintainer
  iio: adc: ti_am335x_adc: alloc kfifo & IRQ via devm_ functions
  iio: adc: ti_am335x_adc: alloc channels via devm_kcalloc()
  iio:adc:ingenic: drop of_match_ptr protection and include mod_devicetable.h
  iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections.
  iio:adc:ti-adc161s626: Drop of_match_ptr protection.
  iio:adc:ti-adc084s021: drop of_match_ptr protection
  iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections
  iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h
  iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes
  iio:adc:mcp3422: remove CONFIG_OF and of_match_ptr protections
  iio:adc:mcp320x: Drop CONFIG_OF and of_match_ptr protections
  iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections
  iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h include
  ...
This commit is contained in:
Greg Kroah-Hartman 2020-07-17 12:04:05 +02:00
commit f6b35db072
429 changed files with 7973 additions and 1642 deletions

View File

@ -1569,7 +1569,8 @@ What: /sys/bus/iio/devices/iio:deviceX/in_concentrationX_voc_raw
KernelVersion: 4.3
Contact: linux-iio@vger.kernel.org
Description:
Raw (unscaled no offset etc.) percentage reading of a substance.
Raw (unscaled no offset etc.) reading of a substance. Units
after application of scale and offset are percents.
What: /sys/bus/iio/devices/iio:deviceX/in_resistance_raw
What: /sys/bus/iio/devices/iio:deviceX/in_resistanceX_raw

View File

@ -0,0 +1,20 @@
What: /sys/bus/iio/devices/iio:deviceX/in_accel_x_calibbias
What: /sys/bus/iio/devices/iio:deviceX/in_accel_y_calibbias
What: /sys/bus/iio/devices/iio:deviceX/in_accel_z_calibbias
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_x_calibbias
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_y_calibbias
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_z_calibbias
KernelVersion: 5.8
Contact: linux-iio@vger.kernel.org
Description:
Hardware applied calibration offset (assumed to fix production
inaccuracies). Values represent a real physical offset expressed
in SI units (m/s^2 for accelerometer and rad/s for gyroscope).
What: /sys/bus/iio/devices/iio:deviceX/in_accel_calibbias_available
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_calibbias_available
KernelVersion: 5.8
Contact: linux-iio@vger.kernel.org
Description:
Range of available values for hardware offset. Values in SI
units (m/s^2 for accelerometer and rad/s for gyroscope).

View File

@ -0,0 +1,34 @@
What: /sys/bus/iio/devices/iio:deviceX/calibration_auto_enable
Date: June 2020
KernelVersion: 5.8
Contact: linux-iio@vger.kernel.org
Description:
Contaminants build-up in the measurement chamber or optical
elements deterioration leads to sensor drift.
One can compensate for sensor drift by using automatic self
calibration procedure (asc).
Writing 1 or 0 to this attribute will respectively activate or
deactivate asc.
Upon reading current asc status is returned.
What: /sys/bus/iio/devices/iio:deviceX/calibration_forced_value
Date: June 2020
KernelVersion: 5.8
Contact: linux-iio@vger.kernel.org
Description:
Contaminants build-up in the measurement chamber or optical
elements deterioration leads to sensor drift.
One can compensate for sensor drift by using forced
recalibration (frc). This is useful in case there's known
co2 reference available nearby the sensor.
Picking value from the range [400 1 2000] and writing it to the
sensor will set frc.
Upon reading current frc value is returned. Note that after
power cycling default value (i.e 400) is returned even though
internally sensor had recalibrated itself.

View File

@ -12,8 +12,8 @@ maintainers:
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
https://www.analog.com/en/products/mems/accelerometers/adxl345.html
https://www.analog.com/en/products/sensors-mems/accelerometers/adxl375.html
properties:
compatible:

View File

@ -1,49 +0,0 @@
* Ingenic JZ47xx ADC controller IIO bindings
Required properties:
- compatible: Should be one of:
* ingenic,jz4725b-adc
* ingenic,jz4740-adc
* ingenic,jz4770-adc
- reg: ADC controller registers location and length.
- clocks: phandle to the SoC's ADC clock.
- clock-names: Must be set to "adc".
- #io-channel-cells: Must be set to <1> to indicate channels are selected
by index.
ADC clients must use the format described in iio-bindings.txt, giving
a phandle and IIO specifier pair ("io-channels") to the ADC controller.
Example:
#include <dt-bindings/iio/adc/ingenic,adc.h>
adc: adc@10070000 {
compatible = "ingenic,jz4740-adc";
#io-channel-cells = <1>;
reg = <0x10070000 0x30>;
clocks = <&cgu JZ4740_CLK_ADC>;
clock-names = "adc";
interrupt-parent = <&intc>;
interrupts = <18>;
};
adc-keys {
...
compatible = "adc-keys";
io-channels = <&adc INGENIC_ADC_AUX>;
io-channel-names = "buttons";
...
};
battery {
...
compatible = "ingenic,jz4740-battery";
io-channels = <&adc INGENIC_ADC_BATTERY>;
io-channel-names = "battery";
...
};

View File

@ -0,0 +1,71 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
# Copyright 2019-2020 Artur Rojek
%YAML 1.2
---
$id: "http://devicetree.org/schemas/iio/adc/ingenic,adc.yaml#"
$schema: "http://devicetree.org/meta-schemas/core.yaml#"
title: Ingenic JZ47xx ADC controller IIO bindings
maintainers:
- Artur Rojek <contact@artur-rojek.eu>
description: >
Industrial I/O subsystem bindings for ADC controller found in
Ingenic JZ47xx SoCs.
ADC clients must use the format described in iio-bindings.txt, giving
a phandle and IIO specifier pair ("io-channels") to the ADC controller.
properties:
compatible:
enum:
- ingenic,jz4725b-adc
- ingenic,jz4740-adc
- ingenic,jz4770-adc
'#io-channel-cells':
const: 1
description:
Must be set to <1> to indicate channels are selected by index.
reg:
maxItems: 1
clocks:
maxItems: 1
clock-names:
items:
- const: adc
interrupts:
maxItems: 1
required:
- compatible
- '#io-channel-cells'
- reg
- clocks
- clock-names
- interrupts
additionalProperties: false
examples:
- |
#include <dt-bindings/clock/jz4740-cgu.h>
#include <dt-bindings/iio/adc/ingenic,adc.h>
adc@10070000 {
compatible = "ingenic,jz4740-adc";
#io-channel-cells = <1>;
reg = <0x10070000 0x30>;
clocks = <&cgu JZ4740_CLK_ADC>;
clock-names = "adc";
interrupt-parent = <&intc>;
interrupts = <18>;
};

View File

@ -1,173 +0,0 @@
Qualcomm's SPMI PMIC ADC
- SPMI PMIC voltage ADC (VADC) provides interface to clients to read
voltage. The VADC is a 15-bit sigma-delta ADC.
- SPMI PMIC5 voltage ADC (ADC) provides interface to clients to read
voltage. The VADC is a 16-bit sigma-delta ADC.
VADC node:
- compatible:
Usage: required
Value type: <string>
Definition: Should contain "qcom,spmi-vadc".
Should contain "qcom,spmi-adc5" for PMIC5 ADC driver.
Should contain "qcom,spmi-adc-rev2" for PMIC rev2 ADC driver.
Should contain "qcom,pms405-adc" for PMS405 PMIC
- reg:
Usage: required
Value type: <prop-encoded-array>
Definition: VADC base address in the SPMI PMIC register map.
- #address-cells:
Usage: required
Value type: <u32>
Definition: Must be one. Child node 'reg' property should define ADC
channel number.
- #size-cells:
Usage: required
Value type: <u32>
Definition: Must be zero.
- #io-channel-cells:
Usage: required
Value type: <u32>
Definition: Must be one. For details about IIO bindings see:
Documentation/devicetree/bindings/iio/iio-bindings.txt
- interrupts:
Usage: optional
Value type: <prop-encoded-array>
Definition: End of conversion interrupt.
Channel node properties:
- reg:
Usage: required
Value type: <u32>
Definition: ADC channel number.
See include/dt-bindings/iio/qcom,spmi-vadc.h
- label:
Usage: required for "qcom,spmi-adc5" and "qcom,spmi-adc-rev2"
Value type: <empty>
Definition: ADC input of the platform as seen in the schematics.
For thermistor inputs connected to generic AMUX or GPIO inputs
these can vary across platform for the same pins. Hence select
the platform schematics name for this channel.
- qcom,decimation:
Usage: optional
Value type: <u32>
Definition: This parameter is used to decrease ADC sampling rate.
Quicker measurements can be made by reducing decimation ratio.
- For compatible property "qcom,spmi-vadc", valid values are
512, 1024, 2048, 4096. If property is not found, default value
of 512 will be used.
- For compatible property "qcom,spmi-adc5", valid values are 250, 420
and 840. If property is not found, default value of 840 is used.
- For compatible property "qcom,spmi-adc-rev2", valid values are 256,
512 and 1024. If property is not present, default value is 1024.
- qcom,pre-scaling:
Usage: optional
Value type: <u32 array>
Definition: Used for scaling the channel input signal before the signal is
fed to VADC. The configuration for this node is to know the
pre-determined ratio and use it for post scaling. Select one from
the following options.
<1 1>, <1 3>, <1 4>, <1 6>, <1 20>, <1 8>, <10 81>, <1 10>
If property is not found default value depending on chip will be used.
- qcom,ratiometric:
Usage: optional
Value type: <empty>
Definition: Channel calibration type.
- For compatible property "qcom,spmi-vadc", if this property is
specified VADC will use the VDD reference (1.8V) and GND for
channel calibration. If property is not found, channel will be
calibrated with 0.625V and 1.25V reference channels, also
known as absolute calibration.
- For compatible property "qcom,spmi-adc5" and "qcom,spmi-adc-rev2",
if this property is specified VADC will use the VDD reference
(1.875V) and GND for channel calibration. If property is not found,
channel will be calibrated with 0V and 1.25V reference channels,
also known as absolute calibration.
- qcom,hw-settle-time:
Usage: optional
Value type: <u32>
Definition: Time between AMUX getting configured and the ADC starting
conversion. The 'hw_settle_time' is an index used from valid values
and programmed in hardware to achieve the hardware settling delay.
- For compatible property "qcom,spmi-vadc" and "qcom,spmi-adc-rev2",
Delay = 100us * (hw_settle_time) for hw_settle_time < 11,
and 2ms * (hw_settle_time - 10) otherwise.
Valid values are: 0, 100, 200, 300, 400, 500, 600, 700, 800,
900 us and 1, 2, 4, 6, 8, 10 ms.
If property is not found, channel will use 0us.
- For compatible property "qcom,spmi-adc5", delay = 15us for
value 0, 100us * (value) for values < 11,
and 2ms * (value - 10) otherwise.
Valid values are: 15, 100, 200, 300, 400, 500, 600, 700, 800,
900 us and 1, 2, 4, 6, 8, 10 ms
Certain controller digital versions have valid values of
15, 100, 200, 300, 400, 500, 600, 700, 1, 2, 4, 8, 16, 32, 64, 128 ms
If property is not found, channel will use 15us.
- qcom,avg-samples:
Usage: optional
Value type: <u32>
Definition: Number of samples to be used for measurement.
Averaging provides the option to obtain a single measurement
from the ADC that is an average of multiple samples. The value
selected is 2^(value).
- For compatible property "qcom,spmi-vadc", valid values
are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512
If property is not found, 1 sample will be used.
- For compatible property "qcom,spmi-adc5" and "qcom,spmi-adc-rev2",
valid values are: 1, 2, 4, 8, 16
If property is not found, 1 sample will be used.
NOTE:
For compatible property "qcom,spmi-vadc" following channels, also known as
reference point channels, are used for result calibration and their channel
configuration nodes should be defined:
VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV,
VADC_GND_REF and VADC_VDD_VADC.
Example:
#include <dt-bindings/iio/qcom,spmi-vadc.h>
#include <linux/irq.h>
/* ... */
/* VADC node */
pmic_vadc: vadc@3100 {
compatible = "qcom,spmi-vadc";
reg = <0x3100>;
interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
#address-cells = <1>;
#size-cells = <0>;
#io-channel-cells = <1>;
io-channel-ranges;
/* Channel node */
adc-chan@VADC_LR_MUX10_USB_ID {
reg = <VADC_LR_MUX10_USB_ID>;
qcom,decimation = <512>;
qcom,ratiometric;
qcom,hw-settle-time = <200>;
qcom,avg-samples = <1>;
qcom,pre-scaling = <1 3>;
};
};
/* IIO client node */
usb {
io-channels = <&pmic_vadc VADC_LR_MUX10_USB_ID>;
io-channel-names = "vadc";
};

View File

@ -0,0 +1,278 @@
# SPDX-License-Identifier: GPL-2.0-only
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/adc/qcom,spmi-vadc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Qualcomm's SPMI PMIC ADC
maintainers:
- Andy Gross <agross@kernel.org>
- Bjorn Andersson <bjorn.andersson@linaro.org>
description: |
SPMI PMIC voltage ADC (VADC) provides interface to clients to read
voltage. The VADC is a 15-bit sigma-delta ADC.
SPMI PMIC5/PMIC7 voltage ADC (ADC) provides interface to clients to read
voltage. The VADC is a 16-bit sigma-delta ADC.
properties:
compatible:
oneOf:
- items:
- const: qcom,pms405-adc
- const: qcom,spmi-adc-rev2
- items:
- enum:
- qcom,spmi-vadc
- qcom,spmi-adc5
- qcom,spmi-adc-rev2
- qcom,spmi-adc7
reg:
description: VADC base address in the SPMI PMIC register map
maxItems: 1
'#address-cells':
const: 1
'#size-cells':
const: 0
'#io-channel-cells':
const: 1
interrupts:
maxItems: 1
description:
End of conversion interrupt.
required:
- compatible
- reg
- '#address-cells'
- '#size-cells'
- '#io-channel-cells'
patternProperties:
"^.*@[0-9a-f]+$":
type: object
description: |
Represents the external channels which are connected to the ADC.
For compatible property "qcom,spmi-vadc" following channels, also known as
reference point channels, are used for result calibration and their channel
configuration nodes should be defined:
VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV,
VADC_GND_REF and VADC_VDD_VADC.
properties:
reg:
description: |
ADC channel number.
See include/dt-bindings/iio/qcom,spmi-vadc.h
For PMIC7 ADC, the channel numbers are specified separately per PMIC
in the PMIC-specific files in include/dt-bindings/iio/.
label:
$ref: /schemas/types.yaml#/definitions/string
description: |
ADC input of the platform as seen in the schematics.
For thermistor inputs connected to generic AMUX or GPIO inputs
these can vary across platform for the same pins. Hence select
the platform schematics name for this channel.
qcom,decimation:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
This parameter is used to decrease ADC sampling rate.
Quicker measurements can be made by reducing decimation ratio.
qcom,pre-scaling:
description: |
Used for scaling the channel input signal before the signal is
fed to VADC. The configuration for this node is to know the
pre-determined ratio and use it for post scaling. It is a pair of
integers, denoting the numerator and denominator of the fraction by which
input signal is multiplied. For example, <1 3> indicates the signal is scaled
down to 1/3 of its value before ADC measurement.
If property is not found default value depending on chip will be used.
allOf:
- $ref: /schemas/types.yaml#/definitions/uint32-array
oneOf:
- items:
- const: 1
- enum: [ 1, 3, 4, 6, 20, 8, 10 ]
- items:
- const: 10
- const: 81
qcom,ratiometric:
description: |
Channel calibration type.
- For compatible property "qcom,spmi-vadc", if this property is
specified VADC will use the VDD reference (1.8V) and GND for
channel calibration. If property is not found, channel will be
calibrated with 0.625V and 1.25V reference channels, also
known as absolute calibration.
- For compatible property "qcom,spmi-adc5", "qcom,spmi-adc7" and
"qcom,spmi-adc-rev2", if this property is specified VADC will use
the VDD reference (1.875V) and GND for channel calibration. If
property is not found, channel will be calibrated with 0V and 1.25V
reference channels, also known as absolute calibration.
type: boolean
qcom,hw-settle-time:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
Time between AMUX getting configured and the ADC starting
conversion. The 'hw_settle_time' is an index used from valid values
and programmed in hardware to achieve the hardware settling delay.
qcom,avg-samples:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
Number of samples to be used for measurement.
Averaging provides the option to obtain a single measurement
from the ADC that is an average of multiple samples. The value
selected is 2^(value).
required:
- reg
allOf:
- if:
properties:
compatible:
contains:
const: qcom,spmi-vadc
then:
patternProperties:
"^.*@[0-9a-f]+$":
properties:
qcom,decimation:
enum: [ 512, 1024, 2048, 4096 ]
default: 512
qcom,hw-settle-time:
enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
4, 6, 8, 10 ]
default: 0
qcom,avg-samples:
enum: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 ]
default: 1
- if:
properties:
compatible:
contains:
const: qcom,spmi-adc-rev2
then:
patternProperties:
"^.*@[0-9a-f]+$":
properties:
qcom,decimation:
enum: [ 256, 512, 1024 ]
default: 1024
qcom,hw-settle-time:
enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
4, 6, 8, 10 ]
default: 0
qcom,avg-samples:
enum: [ 1, 2, 4, 8, 16 ]
default: 1
- if:
properties:
compatible:
contains:
const: qcom,spmi-adc5
then:
patternProperties:
"^.*@[0-9a-f]+$":
properties:
qcom,decimation:
enum: [ 250, 420, 840 ]
default: 840
qcom,hw-settle-time:
enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
4, 6, 8, 10, 16, 32, 64, 128 ]
default: 15
qcom,avg-samples:
enum: [ 1, 2, 4, 8, 16 ]
default: 1
- if:
properties:
compatible:
contains:
const: qcom,spmi-adc7
then:
patternProperties:
"^.*@[0-9a-f]+$":
properties:
qcom,decimation:
enum: [ 85, 340, 1360 ]
default: 1360
qcom,hw-settle-time:
enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000,
8000, 16000, 32000, 64000, 128000 ]
default: 15
qcom,avg-samples:
enum: [ 1, 2, 4, 8, 16 ]
default: 1
examples:
- |
spmi_bus {
#address-cells = <1>;
#size-cells = <0>;
/* VADC node */
pmic_vadc: adc@3100 {
compatible = "qcom,spmi-vadc";
reg = <0x3100>;
interrupts = <0x0 0x31 0x0 0x1>;
#address-cells = <1>;
#size-cells = <0>;
#io-channel-cells = <1>;
io-channel-ranges;
/* Channel node */
adc-chan@39 {
reg = <0x39>;
qcom,decimation = <512>;
qcom,ratiometric;
qcom,hw-settle-time = <200>;
qcom,avg-samples = <1>;
qcom,pre-scaling = <1 3>;
};
adc-chan@9 {
reg = <0x9>;
};
adc-chan@a {
reg = <0xa>;
};
adc-chan@e {
reg = <0xe>;
};
adc-chan@f {
reg = <0xf>;
};
};
};

View File

@ -0,0 +1,68 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/chemical/sensirion,scd30.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Sensirion SCD30 carbon dioxide sensor
maintainers:
- Tomasz Duszynski <tomasz.duszynski@octakon.com>
description: |
Air quality sensor capable of measuring co2 concentration, temperature
and relative humidity.
properties:
compatible:
enum:
- sensirion,scd30
reg:
maxItems: 1
interrupts:
maxItems: 1
vdd-supply: true
sensirion,sel-gpios:
description: GPIO connected to the SEL line
maxItems: 1
sensirion,pwm-gpios:
description: GPIO connected to the PWM line
maxItems: 1
required:
- compatible
additionalProperties: false
examples:
- |
# include <dt-bindings/interrupt-controller/irq.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
co2-sensor@61 {
compatible = "sensirion,scd30";
reg = <0x61>;
vdd-supply = <&vdd>;
interrupt-parent = <&gpio0>;
interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
};
};
- |
# include <dt-bindings/interrupt-controller/irq.h>
serial {
co2-sensor {
compatible = "sensirion,scd30";
vdd-supply = <&vdd>;
interrupt-parent = <&gpio0>;
interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
};
};
...

View File

@ -6,7 +6,7 @@ Is is programmable through an SPI interface.
The internal DACs are loaded when the LOADDACS pin is pulled down.
http://www.ti.com/lit/ds/sbas106/sbas106.pdf
https://www.ti.com/lit/ds/sbas106/sbas106.pdf
Required Properties:
- compatible: Should be one of:

View File

@ -9,7 +9,7 @@ specifier is an array of one or more cells identifying the IIO
output on a device. The length of an IIO specifier is defined by the
value of a #io-channel-cells property in the IIO provider node.
[1] http://marc.info/?l=linux-iio&m=135902119507483&w=2
[1] https://marc.info/?l=linux-iio&m=135902119507483&w=2
==IIO providers==

View File

@ -37,6 +37,15 @@ properties:
set if the specified interrupt pin should be configured as
open drain. If not set, defaults to push-pull.
vdd-supply:
description: provide VDD power to the sensor.
vddio-supply:
description: provide VDD IO power to the sensor.
mount-matrix:
description: an optional 3x3 mounting rotation matrix
required:
- compatible
- reg
@ -52,9 +61,14 @@ examples:
bmi160@68 {
compatible = "bosch,bmi160";
reg = <0x68>;
vdd-supply = <&pm8916_l17>;
vddio-supply = <&pm8916_l6>;
interrupt-parent = <&gpio4>;
interrupts = <12 IRQ_TYPE_EDGE_RISING>;
interrupt-names = "INT1";
mount-matrix = "0", "1", "0",
"-1", "0", "0",
"0", "0", "1";
};
};
- |

View File

@ -0,0 +1,90 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/imu/invensense,icm42600.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: InvenSense ICM-426xx Inertial Measurement Unit
maintainers:
- Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
description: |
6-axis MotionTracking device that combines a 3-axis gyroscope and a 3-axis
accelerometer.
It has a configurable host interface that supports I3C, I2C and SPI serial
communication, features a 2kB FIFO and 2 programmable interrupts with
ultra-low-power wake-on-motion support to minimize system power consumption.
Other industry-leading features include InvenSense on-chip APEX Motion
Processing engine for gesture recognition, activity classification, and
pedometer, along with programmable digital filters, and an embedded
temperature sensor.
https://invensense.tdk.com/wp-content/uploads/2020/03/DS-000292-ICM-42605-v1.4.pdf
properties:
compatible:
enum:
- invensense,icm42600
- invensense,icm42602
- invensense,icm42605
- invensense,icm42622
reg:
maxItems: 1
interrupts:
maxItems: 1
drive-open-drain:
type: boolean
vdd-supply:
description: Regulator that provides power to the sensor
vddio-supply:
description: Regulator that provides power to the bus
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>;
icm42605@68 {
compatible = "invensense,icm42605";
reg = <0x68>;
interrupt-parent = <&gpio2>;
interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
vdd-supply = <&vdd>;
vddio-supply = <&vddio>;
};
};
- |
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
spi0 {
#address-cells = <1>;
#size-cells = <0>;
icm42602@0 {
compatible = "invensense,icm42602";
reg = <0>;
spi-max-frequency = <24000000>;
spi-cpha;
spi-cpol;
interrupt-parent = <&gpio1>;
interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
vdd-supply = <&vdd>;
vddio-supply = <&vddio>;
};
};

View File

@ -1,6 +1,6 @@
* Avago APDS9300 ambient light sensor
http://www.avagotech.com/docs/AV02-1077EN
https://www.avagotech.com/docs/AV02-1077EN
Required properties:

View File

@ -1,6 +1,6 @@
* Avago APDS9960 gesture/RGB/ALS/proximity sensor
http://www.avagotech.com/docs/AV02-4191EN
https://www.avagotech.com/docs/AV02-4191EN
Required properties:

View File

@ -6,7 +6,7 @@ the optional generation of IIO events on rising/falling light threshold changes
requires the use of interrupts. Without interrupts, only the simple reading
of the current light value is supported through the IIO API.
http://www.ti.com/product/opt3001
https://www.ti.com/product/opt3001
Required properties:
- compatible: should be "ti,opt3001"

View File

@ -1,6 +1,6 @@
STMicro VL6180 - ALS, range and proximity sensor
Link to datasheet: http://www.st.com/resource/en/datasheet/vl6180x.pdf
Link to datasheet: https://www.st.com/resource/en/datasheet/vl6180x.pdf
Required properties:

View File

@ -1,30 +0,0 @@
* AsahiKASEI AK8975 magnetometer sensor
Required properties:
- compatible : should be "asahi-kasei,ak8975"
- reg : the I2C address of the magnetometer
Optional properties:
- gpios : should be device tree identifier of the magnetometer DRDY pin
- vdd-supply: an optional regulator that needs to be on to provide VDD
- mount-matrix: an optional 3x3 mounting rotation matrix
Example:
ak8975@c {
compatible = "asahi-kasei,ak8975";
reg = <0x0c>;
gpios = <&gpj0 7 0>;
vdd-supply = <&ldo_3v3_gnss>;
mount-matrix = "-0.984807753012208", /* x0 */
"0", /* y0 */
"-0.173648177666930", /* z0 */
"0", /* x1 */
"-1", /* y1 */
"0", /* z1 */
"-0.173648177666930", /* x2 */
"0", /* y2 */
"0.984807753012208"; /* z2 */
};

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/magnetometer/asahi-kasei,ak8975.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: AsahiKASEI AK8975 magnetometer sensor
maintainers:
- Jonathan Albrieux <jonathan.albrieux@gmail.com>
properties:
compatible:
oneOf:
- enum:
- asahi-kasei,ak8975
- asahi-kasei,ak8963
- asahi-kasei,ak09911
- asahi-kasei,ak09912
- enum:
- ak8975
- ak8963
- ak09911
- ak09912
deprecated: true
reg:
maxItems: 1
gpios:
maxItems: 1
description: |
AK8975 has a "Data ready" pin (DRDY) which informs that data
is ready to be read and is possible to listen on it. If used,
this should be active high. Prefer interrupt over this.
interrupts:
maxItems: 1
description: interrupt for DRDY pin. Triggered on rising edge.
vdd-supply:
description: |
an optional regulator that needs to be on to provide VDD power to
the sensor.
mount-matrix:
description: an optional 3x3 mounting rotation matrix.
reset-gpios:
description: |
an optional pin needed for AK09911 to set the reset state. This should
be usually active low
required:
- compatible
- reg
examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/gpio/gpio.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
magnetometer@c {
compatible = "asahi-kasei,ak8975";
reg = <0x0c>;
interrupt-parent = <&gpio6>;
interrupts = <15 IRQ_TYPE_EDGE_RISING>;
vdd-supply = <&ldo_3v3_gnss>;
reset-gpios = <&msmgpio 111 GPIO_ACTIVE_LOW>;
mount-matrix = "-0.984807753012208", /* x0 */
"0", /* y0 */
"-0.173648177666930", /* z0 */
"0", /* x1 */
"-1", /* y1 */
"0", /* z1 */
"-0.173648177666930", /* x2 */
"0", /* y2 */
"0.984807753012208"; /* z2 */
};
};

View File

@ -4,7 +4,11 @@ http://ae-bst.resource.bosch.com/media/products/dokumente/bmc150/BST-BMC150-DS00
Required properties:
- compatible : should be "bosch,bmc150_magn"
- compatible : should be one of:
"bosch,bmc150_magn"
"bosch,bmc156_magn"
"bosch,bmm150"
"bosch,bmm150_magn" (DEPRECATED, use bosch,bmm150)
- reg : the I2C address of the magnetometer
Optional properties:

View File

@ -1,7 +1,7 @@
* Microchip MCP41010/41050/41100/42010/42050/42100 Digital Potentiometer
Datasheet publicly available at:
http://ww1.microchip.com/downloads/en/devicedoc/11195c.pdf
https://ww1.microchip.com/downloads/en/devicedoc/11195c.pdf
The node for this driver must be a child node of a SPI controller, hence
all mandatory properties described in

View File

@ -1,7 +1,7 @@
* Texas Instruments LMP91000 series of potentiostats
LMP91000: http://www.ti.com/lit/ds/symlink/lmp91000.pdf
LMP91002: http://www.ti.com/lit/ds/symlink/lmp91002.pdf
LMP91000: https://www.ti.com/lit/ds/symlink/lmp91000.pdf
LMP91002: https://www.ti.com/lit/ds/symlink/lmp91002.pdf
Required properties:

View File

@ -13,7 +13,7 @@ description: |
Bindings for the All Sensors DLH series pressure sensors.
Specifications about the sensors can be found at:
http://www.allsensors.com/cad/DS-0355_Rev_B.PDF
https://www.allsensors.com/cad/DS-0355_Rev_B.PDF
properties:
compatible:

View File

@ -17,9 +17,9 @@ description: |
until it is received once again
Specifications about the devices can be found at:
http://www.robot-electronics.co.uk/htm/srf04tech.htm
https://www.robot-electronics.co.uk/htm/srf04tech.htm
http://www.maxbotix.com/documents/LV-MaxSonar-EZ_Datasheet.pdf
https://www.maxbotix.com/documents/LV-MaxSonar-EZ_Datasheet.pdf
properties:
compatible:

View File

@ -262,7 +262,7 @@ the system.
Counter Counts may be allocated via counter_count structures, and
respective Counter Signal associations (Synapses) made via
counter_synapse structures. Associated counter_synapse structures are
stored as an array and set to the the synapses array member of the
stored as an array and set to the synapses array member of the
respective counter_count structure. These counter_count structures are
set to the counts array member of an allocated counter_device structure
before the Counter is registered to the system.

View File

@ -88,7 +88,7 @@ fields in iio_chan_spec definition::
The driver implementing the accelerometer described above will have the
following channel definition::
struct struct iio_chan_spec accel_channels[] = {
struct iio_chan_spec accel_channels[] = {
{
.type = IIO_ACCEL,
.modified = 1,

View File

@ -8979,6 +8979,14 @@ F: include/dt-bindings/interconnect/
F: include/linux/interconnect-provider.h
F: include/linux/interconnect.h
INVENSENSE ICM-426xx IMU DRIVER
M: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
L: linux-iio@vger.kernel.org
S: Maintained
W https://invensense.tdk.com/
F: Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
F: drivers/iio/imu/inv_icm42600/
INVENSENSE MPU-3050 GYROSCOPE DRIVER
M: Linus Walleij <linus.walleij@linaro.org>
L: linux-iio@vger.kernel.org
@ -11324,7 +11332,6 @@ F: Documentation/devicetree/bindings/pwm/atmel-pwm.txt
F: drivers/pwm/pwm-atmel.c
MICROCHIP SAMA5D2-COMPATIBLE ADC DRIVER
M: Ludovic Desroches <ludovic.desroches@microchip.com>
M: Eugen Hristev <eugen.hristev@microchip.com>
L: linux-iio@vger.kernel.org
S: Supported
@ -15373,6 +15380,15 @@ S: Maintained
F: drivers/misc/phantom.c
F: include/uapi/linux/phantom.h
SENSIRION SCD30 CARBON DIOXIDE SENSOR DRIVER
M: Tomasz Duszynski <tomasz.duszynski@octakon.com>
S: Maintained
F: Documentation/devicetree/bindings/iio/chemical/sensirion,scd30.yaml
F: drivers/iio/chemical/scd30.h
F: drivers/iio/chemical/scd30_core.c
F: drivers/iio/chemical/scd30_i2c.c
F: drivers/iio/chemical/scd30_serial.c
SENSIRION SPS30 AIR POLLUTION SENSOR DRIVER
M: Tomasz Duszynski <tduszyns@gmail.com>
S: Maintained

View File

@ -1538,7 +1538,6 @@ static int quad8_probe(struct device *dev, unsigned int id)
indio_dev->num_channels = ARRAY_SIZE(quad8_channels);
indio_dev->channels = quad8_channels;
indio_dev->name = dev_name(dev);
indio_dev->dev.parent = dev;
/* Initialize Counter device and driver data */
quad8iio = iio_priv(indio_dev);

View File

@ -648,7 +648,6 @@ static int stm32_lptim_cnt_probe(struct platform_device *pdev)
/* Initialize IIO device */
indio_dev->name = dev_name(&pdev->dev);
indio_dev->dev.parent = &pdev->dev;
indio_dev->dev.of_node = pdev->dev.of_node;
indio_dev->info = &stm32_lptim_cnt_iio_info;
if (ddata->has_encoder)

View File

@ -116,18 +116,24 @@ config BMA400
tristate "Bosch BMA400 3-Axis Accelerometer Driver"
select REGMAP
select BMA400_I2C if I2C
select BMA400_SPI if SPI
help
Say Y here if you want to build a driver for the Bosch BMA400
triaxial acceleration sensor.
To compile this driver as a module, choose M here: the
module will be called bma400_core and you will also get
bma400_i2c if I2C is enabled.
bma400_i2c if I2C is enabled and bma400_spi if SPI is
enabled.
config BMA400_I2C
tristate
depends on BMA400
config BMA400_SPI
tristate
depends on BMA400
config BMC150_ACCEL
tristate "Bosch BMC150 Accelerometer Driver"
select IIO_BUFFER

View File

@ -16,6 +16,7 @@ obj-$(CONFIG_BMA180) += bma180.o
obj-$(CONFIG_BMA220) += bma220_spi.o
obj-$(CONFIG_BMA400) += bma400_core.o
obj-$(CONFIG_BMA400_I2C) += bma400_i2c.o
obj-$(CONFIG_BMA400_SPI) += bma400_spi.o
obj-$(CONFIG_BMC150_ACCEL) += bmc150-accel-core.o
obj-$(CONFIG_BMC150_ACCEL_I2C) += bmc150-accel-i2c.o
obj-$(CONFIG_BMC150_ACCEL_SPI) += bmc150-accel-spi.o

View File

@ -271,7 +271,6 @@ static int adis16201_probe(struct spi_device *spi)
spi_set_drvdata(spi, indio_dev);
indio_dev->name = spi->dev.driver->name;
indio_dev->dev.parent = &spi->dev;
indio_dev->info = &adis16201_info;
indio_dev->channels = adis16201_channels;

View File

@ -282,7 +282,6 @@ static int adis16209_probe(struct spi_device *spi)
spi_set_drvdata(spi, indio_dev);
indio_dev->name = spi->dev.driver->name;
indio_dev->dev.parent = &spi->dev;
indio_dev->info = &adis16209_info;
indio_dev->channels = adis16209_channels;
indio_dev->num_channels = ARRAY_SIZE(adis16209_channels);

View File

@ -4,7 +4,7 @@
*
* Copyright (c) 2017 Eva Rachel Retuya <eraretuya@gmail.com>
*
* Datasheet: http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf
* Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf
*/
#include <linux/module.h>
@ -246,7 +246,6 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap,
return ret;
}
indio_dev->dev.parent = dev;
indio_dev->name = name;
indio_dev->info = &adxl345_info;
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -795,13 +795,9 @@ static int adxl372_buffer_postenable(struct iio_dev *indio_dev)
unsigned int mask;
int i, ret;
ret = iio_triggered_buffer_postenable(indio_dev);
if (ret < 0)
return ret;
ret = adxl372_set_interrupts(st, ADXL372_INT1_MAP_FIFO_FULL_MSK, 0);
if (ret < 0)
goto err;
return ret;
mask = *indio_dev->active_scan_mask;
@ -810,10 +806,8 @@ static int adxl372_buffer_postenable(struct iio_dev *indio_dev)
break;
}
if (i == ARRAY_SIZE(adxl372_axis_lookup_table)) {
ret = -EINVAL;
goto err;
}
if (i == ARRAY_SIZE(adxl372_axis_lookup_table))
return -EINVAL;
st->fifo_format = adxl372_axis_lookup_table[i].fifo_format;
st->fifo_set_size = bitmap_weight(indio_dev->active_scan_mask,
@ -833,14 +827,10 @@ static int adxl372_buffer_postenable(struct iio_dev *indio_dev)
if (ret < 0) {
st->fifo_mode = ADXL372_FIFO_BYPASSED;
adxl372_set_interrupts(st, 0, 0);
goto err;
return ret;
}
return 0;
err:
iio_triggered_buffer_predisable(indio_dev);
return ret;
}
static int adxl372_buffer_predisable(struct iio_dev *indio_dev)
@ -851,7 +841,7 @@ static int adxl372_buffer_predisable(struct iio_dev *indio_dev)
st->fifo_mode = ADXL372_FIFO_BYPASSED;
adxl372_configure_fifo(st);
return iio_triggered_buffer_predisable(indio_dev);
return 0;
}
static const struct iio_buffer_setup_ops adxl372_buffer_ops = {
@ -938,7 +928,6 @@ int adxl372_probe(struct device *dev, struct regmap *regmap,
indio_dev->channels = adxl372_channels;
indio_dev->num_channels = ARRAY_SIZE(adxl372_channels);
indio_dev->available_scan_masks = adxl372_channel_masks;
indio_dev->dev.parent = dev;
indio_dev->name = name;
indio_dev->info = &adxl372_info;
indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_SOFTWARE;

View File

@ -1038,7 +1038,6 @@ static int bma180_probe(struct i2c_client *client,
goto err_chip_disable;
mutex_init(&data->mutex);
indio_dev->dev.parent = dev;
indio_dev->channels = data->part_info->channels;
indio_dev->num_channels = data->part_info->num_channels;
indio_dev->name = id->name;

View File

@ -237,7 +237,6 @@ static int bma220_probe(struct spi_device *spi)
spi_set_drvdata(spi, indio_dev);
mutex_init(&data->lock);
indio_dev->dev.parent = &spi->dev;
indio_dev->info = &bma220_info;
indio_dev->name = BMA220_DEVICE_NAME;
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -816,7 +816,6 @@ int bma400_probe(struct device *dev, struct regmap *regmap, const char *name)
return ret;
mutex_init(&data->mutex);
indio_dev->dev.parent = dev;
indio_dev->name = name;
indio_dev->info = &bma400_info;
indio_dev->channels = bma400_channels;

View File

@ -0,0 +1,120 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* SPI IIO driver for Bosch BMA400 triaxial acceleration sensor.
*
* Copyright 2020 Dan Robertson <dan@dlrobertson.com>
*
*/
#include <linux/bits.h>
#include <linux/init.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/spi/spi.h>
#include "bma400.h"
#define BMA400_MAX_SPI_READ 2
#define BMA400_SPI_READ_BUFFER_SIZE (BMA400_MAX_SPI_READ + 1)
static int bma400_regmap_spi_read(void *context,
const void *reg, size_t reg_size,
void *val, size_t val_size)
{
struct device *dev = context;
struct spi_device *spi = to_spi_device(dev);
u8 result[BMA400_SPI_READ_BUFFER_SIZE];
ssize_t status;
if (val_size > BMA400_MAX_SPI_READ)
return -EINVAL;
status = spi_write_then_read(spi, reg, 1, result, val_size + 1);
if (status)
return status;
/*
* From the BMA400 datasheet:
*
* > For a basic read operation two bytes have to be read and the first
* > has to be dropped and the second byte must be interpreted.
*/
memcpy(val, result + 1, val_size);
return 0;
}
static int bma400_regmap_spi_write(void *context, const void *data,
size_t count)
{
struct device *dev = context;
struct spi_device *spi = to_spi_device(dev);
return spi_write(spi, data, count);
}
static struct regmap_bus bma400_regmap_bus = {
.read = bma400_regmap_spi_read,
.write = bma400_regmap_spi_write,
.read_flag_mask = BIT(7),
.max_raw_read = BMA400_MAX_SPI_READ,
};
static int bma400_spi_probe(struct spi_device *spi)
{
const struct spi_device_id *id = spi_get_device_id(spi);
struct regmap *regmap;
unsigned int val;
int ret;
regmap = devm_regmap_init(&spi->dev, &bma400_regmap_bus,
&spi->dev, &bma400_regmap_config);
if (IS_ERR(regmap)) {
dev_err(&spi->dev, "failed to create regmap\n");
return PTR_ERR(regmap);
}
/*
* Per the bma400 datasheet, the first SPI read may
* return garbage. As the datasheet recommends, the
* chip ID register will be read here and checked
* again in the following probe.
*/
ret = regmap_read(regmap, BMA400_CHIP_ID_REG, &val);
if (ret)
dev_err(&spi->dev, "Failed to read chip id register\n");
return bma400_probe(&spi->dev, regmap, id->name);
}
static int bma400_spi_remove(struct spi_device *spi)
{
return bma400_remove(&spi->dev);
}
static const struct spi_device_id bma400_spi_ids[] = {
{ "bma400", 0 },
{ }
};
MODULE_DEVICE_TABLE(spi, bma400_spi_ids);
static const struct of_device_id bma400_of_spi_match[] = {
{ .compatible = "bosch,bma400" },
{ }
};
MODULE_DEVICE_TABLE(of, bma400_of_spi_match);
static struct spi_driver bma400_spi_driver = {
.driver = {
.name = "bma400",
.of_match_table = bma400_of_spi_match,
},
.probe = bma400_spi_probe,
.remove = bma400_spi_remove,
.id_table = bma400_spi_ids,
};
module_spi_driver(bma400_spi_driver);
MODULE_AUTHOR("Dan Robertson <dan@dlrobertson.com>");
MODULE_DESCRIPTION("Bosch BMA400 triaxial acceleration sensor (SPI)");
MODULE_LICENSE("GPL");

View File

@ -1411,7 +1411,7 @@ static int bmc150_accel_buffer_postenable(struct iio_dev *indio_dev)
int ret = 0;
if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED)
return iio_triggered_buffer_postenable(indio_dev);
return 0;
mutex_lock(&data->mutex);
@ -1443,7 +1443,7 @@ static int bmc150_accel_buffer_predisable(struct iio_dev *indio_dev)
struct bmc150_accel_data *data = iio_priv(indio_dev);
if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED)
return iio_triggered_buffer_predisable(indio_dev);
return 0;
mutex_lock(&data->mutex);
@ -1574,7 +1574,6 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
mutex_init(&data->mutex);
indio_dev->dev.parent = dev;
indio_dev->channels = data->chip_info->channels;
indio_dev->num_channels = data->chip_info->num_channels;
indio_dev->name = name ? name : data->chip_info->name;

View File

@ -33,6 +33,11 @@
*/
#define ACCEL_LEGACY_NSCALE 9586168
/*
* Sensor frequency is hard-coded to 10Hz.
*/
static const int cros_ec_legacy_sample_freq[] = { 10, 0 };
static int cros_ec_accel_legacy_read_cmd(struct iio_dev *indio_dev,
unsigned long scan_mask, s16 *data)
{
@ -96,6 +101,11 @@ static int cros_ec_accel_legacy_read(struct iio_dev *indio_dev,
*val = 0;
ret = IIO_VAL_INT;
break;
case IIO_CHAN_INFO_SAMP_FREQ:
*val = cros_ec_legacy_sample_freq[0];
*val2 = cros_ec_legacy_sample_freq[1];
ret = IIO_VAL_INT_PLUS_MICRO;
break;
default:
ret = cros_ec_sensors_core_read(st, chan, val, val2,
mask);
@ -120,9 +130,39 @@ static int cros_ec_accel_legacy_write(struct iio_dev *indio_dev,
return -EINVAL;
}
/**
* cros_ec_accel_legacy_read_avail() - get available values
* @indio_dev: pointer to state information for device
* @chan: channel specification structure table
* @vals: list of available values
* @type: type of data returned
* @length: number of data returned in the array
* @mask: specifies which values to be requested
*
* Return: an error code or IIO_AVAIL_LIST
*/
static int cros_ec_accel_legacy_read_avail(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
const int **vals,
int *type,
int *length,
long mask)
{
switch (mask) {
case IIO_CHAN_INFO_SAMP_FREQ:
*length = ARRAY_SIZE(cros_ec_legacy_sample_freq);
*vals = cros_ec_legacy_sample_freq;
*type = IIO_VAL_INT_PLUS_MICRO;
return IIO_AVAIL_LIST;
}
return -EINVAL;
}
static const struct iio_info cros_ec_accel_legacy_info = {
.read_raw = &cros_ec_accel_legacy_read,
.write_raw = &cros_ec_accel_legacy_write,
.read_avail = &cros_ec_accel_legacy_read_avail,
};
/*
@ -142,7 +182,11 @@ static const struct iio_info cros_ec_accel_legacy_info = {
.info_mask_separate = \
BIT(IIO_CHAN_INFO_RAW) | \
BIT(IIO_CHAN_INFO_CALIBBIAS), \
.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SCALE), \
.info_mask_shared_by_all = \
BIT(IIO_CHAN_INFO_SCALE) | \
BIT(IIO_CHAN_INFO_SAMP_FREQ), \
.info_mask_shared_by_all_available = \
BIT(IIO_CHAN_INFO_SAMP_FREQ), \
.ext_info = cros_ec_sensors_ext_info, \
.scan_type = { \
.sign = 's', \

View File

@ -120,7 +120,6 @@ static int da280_probe(struct i2c_client *client,
data->client = client;
i2c_set_clientdata(client, indio_dev);
indio_dev->dev.parent = &client->dev;
indio_dev->info = &da280_info;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = da280_channels;

View File

@ -231,7 +231,6 @@ static int da311_probe(struct i2c_client *client,
data->client = client;
i2c_set_clientdata(client, indio_dev);
indio_dev->dev.parent = &client->dev;
indio_dev->info = &da311_info;
indio_dev->name = "da311";
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -161,7 +161,6 @@ static int dmard06_probe(struct i2c_client *client,
dmard06->chip_id = ret;
i2c_set_clientdata(client, indio_dev);
indio_dev->dev.parent = &client->dev;
indio_dev->name = DMARD06_DRV_NAME;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = dmard06_channels;

View File

@ -116,7 +116,6 @@ static int dmard09_probe(struct i2c_client *client,
}
i2c_set_clientdata(client, indio_dev);
indio_dev->dev.parent = &client->dev;
indio_dev->name = DMARD09_DRV_NAME;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = dmard09_channels;

View File

@ -196,7 +196,6 @@ static int dmard10_probe(struct i2c_client *client,
data->client = client;
i2c_set_clientdata(client, indio_dev);
indio_dev->dev.parent = &client->dev;
indio_dev->info = &dmard10_info;
indio_dev->name = "dmard10";
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -384,7 +384,6 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
goto error_free_dev_mem;
}
indio_dev->dev.parent = &pdev->dev;
indio_dev->info = &accel_3d_info;
indio_dev->name = name;
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -1027,9 +1027,7 @@ static const struct iio_chan_spec kxcjk1013_channels[] = {
static const struct iio_buffer_setup_ops kxcjk1013_buffer_setup_ops = {
.preenable = kxcjk1013_buffer_preenable,
.postenable = iio_triggered_buffer_postenable,
.postdisable = kxcjk1013_buffer_postdisable,
.predisable = iio_triggered_buffer_predisable,
};
static const struct iio_info kxcjk1013_info = {
@ -1311,7 +1309,6 @@ static int kxcjk1013_probe(struct i2c_client *client,
mutex_init(&data->mutex);
indio_dev->dev.parent = &client->dev;
indio_dev->channels = kxcjk1013_channels;
indio_dev->num_channels = ARRAY_SIZE(kxcjk1013_channels);
indio_dev->available_scan_masks = kxcjk1013_scan_masks;

View File

@ -252,8 +252,6 @@ static int kxsd9_buffer_postdisable(struct iio_dev *indio_dev)
static const struct iio_buffer_setup_ops kxsd9_buffer_setup_ops = {
.preenable = kxsd9_buffer_preenable,
.postenable = iio_triggered_buffer_postenable,
.predisable = iio_triggered_buffer_predisable,
.postdisable = kxsd9_buffer_postdisable,
};
@ -411,7 +409,6 @@ int kxsd9_common_probe(struct device *dev,
indio_dev->channels = kxsd9_channels;
indio_dev->num_channels = ARRAY_SIZE(kxsd9_channels);
indio_dev->name = name;
indio_dev->dev.parent = dev;
indio_dev->info = &kxsd9_info;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->available_scan_masks = kxsd9_scan_masks;

View File

@ -132,7 +132,6 @@ static int mc3230_probe(struct i2c_client *client,
data->client = client;
i2c_set_clientdata(client, indio_dev);
indio_dev->dev.parent = &client->dev;
indio_dev->info = &mc3230_info;
indio_dev->name = "mc3230";
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -260,7 +260,6 @@ int mma7455_core_probe(struct device *dev, struct regmap *regmap,
indio_dev->info = &mma7455_info;
indio_dev->name = name;
indio_dev->dev.parent = dev;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = mma7455_channels;
indio_dev->num_channels = ARRAY_SIZE(mma7455_channels);

View File

@ -188,7 +188,6 @@ static int mma7660_probe(struct i2c_client *client,
mutex_init(&data->lock);
data->mode = MMA7660_MODE_STANDBY;
indio_dev->dev.parent = &client->dev;
indio_dev->info = &mma7660_info;
indio_dev->name = MMA7660_DRIVER_NAME;
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -1592,7 +1592,6 @@ static int mma8452_probe(struct i2c_client *client,
i2c_set_clientdata(client, indio_dev);
indio_dev->info = &mma8452_info;
indio_dev->name = id->name;
indio_dev->dev.parent = &client->dev;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = data->chip_info->channels;
indio_dev->num_channels = data->chip_info->num_channels;

View File

@ -473,7 +473,6 @@ static int mma9551_probe(struct i2c_client *client,
mutex_init(&data->mutex);
indio_dev->dev.parent = &client->dev;
indio_dev->channels = mma9551_channels;
indio_dev->num_channels = ARRAY_SIZE(mma9551_channels);
indio_dev->name = name;

View File

@ -1103,7 +1103,6 @@ static int mma9553_probe(struct i2c_client *client,
if (ret < 0)
return ret;
indio_dev->dev.parent = &client->dev;
indio_dev->channels = mma9553_channels;
indio_dev->num_channels = ARRAY_SIZE(mma9553_channels);
indio_dev->name = name;

View File

@ -416,7 +416,6 @@ static int mxc4005_probe(struct i2c_client *client,
mutex_init(&data->mutex);
indio_dev->dev.parent = &client->dev;
indio_dev->channels = mxc4005_channels;
indio_dev->num_channels = ARRAY_SIZE(mxc4005_channels);
indio_dev->available_scan_masks = mxc4005_scan_masks;
@ -474,12 +473,14 @@ static int mxc4005_probe(struct i2c_client *client,
static const struct acpi_device_id mxc4005_acpi_match[] = {
{"MXC4005", 0},
{"MXC6655", 0},
{ },
};
MODULE_DEVICE_TABLE(acpi, mxc4005_acpi_match);
static const struct i2c_device_id mxc4005_id[] = {
{"mxc4005", 0},
{"mxc6655", 0},
{ },
};
MODULE_DEVICE_TABLE(i2c, mxc4005_id);

View File

@ -138,7 +138,6 @@ static int mxc6255_probe(struct i2c_client *client,
data->regmap = regmap;
indio_dev->name = MXC6255_DRV_NAME;
indio_dev->dev.parent = &client->dev;
indio_dev->channels = mxc6255_channels;
indio_dev->num_channels = ARRAY_SIZE(mxc6255_channels);
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -1467,7 +1467,6 @@ static int sca3000_probe(struct spi_device *spi)
st->info = &sca3000_spi_chip_info_tbl[spi_get_device_id(spi)
->driver_data];
indio_dev->dev.parent = &spi->dev;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->info = &sca3000_info;
if (st->info->temp_output) {

View File

@ -108,8 +108,6 @@ static int ssp_accel_probe(struct platform_device *pdev)
spd->type = SSP_ACCELEROMETER_SENSOR;
indio_dev->name = ssp_accel_device_name;
indio_dev->dev.parent = &pdev->dev;
indio_dev->dev.of_node = pdev->dev.of_node;
indio_dev->info = &ssp_accel_iio_info;
indio_dev->modes = INDIO_BUFFER_SOFTWARE;
indio_dev->channels = ssp_acc_channels;

View File

@ -33,13 +33,9 @@ static int st_accel_buffer_postenable(struct iio_dev *indio_dev)
{
int err;
err = iio_triggered_buffer_postenable(indio_dev);
if (err < 0)
return err;
err = st_sensors_set_axis_enable(indio_dev, indio_dev->active_scan_mask[0]);
if (err < 0)
goto st_accel_buffer_predisable;
return err;
err = st_sensors_set_enable(indio_dev, true);
if (err < 0)
@ -49,27 +45,19 @@ static int st_accel_buffer_postenable(struct iio_dev *indio_dev)
st_accel_buffer_enable_all_axis:
st_sensors_set_axis_enable(indio_dev, ST_SENSORS_ENABLE_ALL_AXIS);
st_accel_buffer_predisable:
iio_triggered_buffer_predisable(indio_dev);
return err;
}
static int st_accel_buffer_predisable(struct iio_dev *indio_dev)
{
int err, err2;
int err;
err = st_sensors_set_enable(indio_dev, false);
if (err < 0)
goto st_accel_buffer_predisable;
return err;
err = st_sensors_set_axis_enable(indio_dev, ST_SENSORS_ENABLE_ALL_AXIS);
st_accel_buffer_predisable:
err2 = iio_triggered_buffer_predisable(indio_dev);
if (!err)
err = err2;
return err;
return st_sensors_set_axis_enable(indio_dev,
ST_SENSORS_ENABLE_ALL_AXIS);
}
static const struct iio_buffer_setup_ops st_accel_buffer_setup_ops = {

View File

@ -492,8 +492,6 @@ static int stk8312_buffer_postdisable(struct iio_dev *indio_dev)
static const struct iio_buffer_setup_ops stk8312_buffer_setup_ops = {
.preenable = stk8312_buffer_preenable,
.postenable = iio_triggered_buffer_postenable,
.predisable = iio_triggered_buffer_predisable,
.postdisable = stk8312_buffer_postdisable,
};
@ -515,7 +513,6 @@ static int stk8312_probe(struct i2c_client *client,
i2c_set_clientdata(client, indio_dev);
mutex_init(&data->lock);
indio_dev->dev.parent = &client->dev;
indio_dev->info = &stk8312_info;
indio_dev->name = STK8312_DRIVER_NAME;
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -376,8 +376,6 @@ static int stk8ba50_buffer_postdisable(struct iio_dev *indio_dev)
static const struct iio_buffer_setup_ops stk8ba50_buffer_setup_ops = {
.preenable = stk8ba50_buffer_preenable,
.postenable = iio_triggered_buffer_postenable,
.predisable = iio_triggered_buffer_predisable,
.postdisable = stk8ba50_buffer_postdisable,
};
@ -399,7 +397,6 @@ static int stk8ba50_probe(struct i2c_client *client,
i2c_set_clientdata(client, indio_dev);
mutex_init(&data->lock);
indio_dev->dev.parent = &client->dev;
indio_dev->info = &stk8ba50_info;
indio_dev->name = STK8BA50_DRIVER_NAME;
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -294,7 +294,7 @@ config ASPEED_ADC
config AT91_ADC
tristate "Atmel AT91 ADC"
depends on ARCH_AT91
depends on ARCH_AT91 || COMPILE_TEST
depends on INPUT && SYSFS
select IIO_BUFFER
select IIO_TRIGGERED_BUFFER

View File

@ -1163,8 +1163,6 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
pm_runtime_put(dev);
indio_dev->dev.parent = dev;
indio_dev->dev.of_node = np;
indio_dev->name = "ab8500-gpadc";
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &ab8500_gpadc_info;

View File

@ -224,7 +224,6 @@ int ad7091r_probe(struct device *dev, const char *name,
st->chip_info = chip_info;
st->map = map;
iio_dev->dev.parent = dev;
iio_dev->name = name;
iio_dev->info = &ad7091r_info;
iio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -683,7 +683,6 @@ static int ad7124_probe(struct spi_device *spi)
spi_set_drvdata(spi, indio_dev);
indio_dev->dev.parent = &spi->dev;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &ad7124_info;

View File

@ -970,7 +970,6 @@ static int ad7192_probe(struct spi_device *spi)
spi_set_drvdata(spi, indio_dev);
st->chip_info = of_device_get_match_data(&spi->dev);
indio_dev->dev.parent = &spi->dev;
indio_dev->name = st->chip_info->name;
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -74,8 +74,6 @@ static int ad7266_postdisable(struct iio_dev *indio_dev)
static const struct iio_buffer_setup_ops iio_triggered_buffer_setup_ops = {
.preenable = &ad7266_preenable,
.postenable = &iio_triggered_buffer_postenable,
.predisable = &iio_triggered_buffer_predisable,
.postdisable = &ad7266_postdisable,
};
@ -437,8 +435,6 @@ static int ad7266_probe(struct spi_device *spi)
spi_set_drvdata(spi, indio_dev);
st->spi = spi;
indio_dev->dev.parent = &spi->dev;
indio_dev->dev.of_node = spi->dev.of_node;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &ad7266_info;

View File

@ -502,8 +502,6 @@ static int ad7291_probe(struct i2c_client *client,
indio_dev->channels = ad7291_channels;
indio_dev->num_channels = ARRAY_SIZE(ad7291_channels);
indio_dev->dev.parent = &client->dev;
indio_dev->dev.of_node = client->dev.of_node;
indio_dev->info = &ad7291_info;
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -304,7 +304,6 @@ static int ad7292_probe(struct spi_device *spi)
st->vref_mv = 1250;
}
indio_dev->dev.parent = &spi->dev;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &ad7292_info;

View File

@ -312,8 +312,6 @@ static int ad7298_probe(struct spi_device *spi)
st->spi = spi;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->dev.parent = &spi->dev;
indio_dev->dev.of_node = spi->dev.of_node;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = ad7298_channels;
indio_dev->num_channels = ARRAY_SIZE(ad7298_channels);

View File

@ -300,9 +300,6 @@ static int ad7476_probe(struct spi_device *spi)
st->spi = spi;
/* Establish that the iio_dev is a child of the spi device */
indio_dev->dev.parent = &spi->dev;
indio_dev->dev.of_node = spi->dev.of_node;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = st->chip_info->channel;

View File

@ -499,7 +499,6 @@ static int ad7606_buffer_postenable(struct iio_dev *indio_dev)
{
struct ad7606_state *st = iio_priv(indio_dev);
iio_triggered_buffer_postenable(indio_dev);
gpiod_set_value(st->gpio_convst, 1);
return 0;
@ -511,7 +510,7 @@ static int ad7606_buffer_predisable(struct iio_dev *indio_dev)
gpiod_set_value(st->gpio_convst, 0);
return iio_triggered_buffer_predisable(indio_dev);
return 0;
}
static const struct iio_buffer_setup_ops ad7606_buffer_ops = {
@ -614,7 +613,6 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
if (ret)
return ret;
indio_dev->dev.parent = dev;
if (st->gpio_os) {
if (st->gpio_range)
indio_dev->info = &ad7606_info_os_and_range;

View File

@ -178,8 +178,6 @@ static const struct ad7766_chip_info ad7766_chip_info[] = {
static const struct iio_buffer_setup_ops ad7766_buffer_setup_ops = {
.preenable = &ad7766_preenable,
.postenable = &iio_triggered_buffer_postenable,
.predisable = &iio_triggered_buffer_predisable,
.postdisable = &ad7766_postdisable,
};
@ -242,7 +240,6 @@ static int ad7766_probe(struct spi_device *spi)
if (IS_ERR(ad7766->pd_gpio))
return PTR_ERR(ad7766->pd_gpio);
indio_dev->dev.parent = &spi->dev;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = ad7766_channels;

View File

@ -490,7 +490,6 @@ static int ad7768_buffer_postenable(struct iio_dev *indio_dev)
{
struct ad7768_state *st = iio_priv(indio_dev);
iio_triggered_buffer_postenable(indio_dev);
/*
* Write a 1 to the LSB of the INTERFACE_FORMAT register to enter
* continuous read mode. Subsequent data reads do not require an
@ -502,17 +501,12 @@ static int ad7768_buffer_postenable(struct iio_dev *indio_dev)
static int ad7768_buffer_predisable(struct iio_dev *indio_dev)
{
struct ad7768_state *st = iio_priv(indio_dev);
int ret;
/*
* To exit continuous read mode, perform a single read of the ADC_DATA
* reg (0x2C), which allows further configuration of the device.
*/
ret = ad7768_spi_reg_read(st, AD7768_REG_ADC_DATA, 3);
if (ret < 0)
return ret;
return iio_triggered_buffer_predisable(indio_dev);
return ad7768_spi_reg_read(st, AD7768_REG_ADC_DATA, 3);
}
static const struct iio_buffer_setup_ops ad7768_buffer_ops = {
@ -584,7 +578,6 @@ static int ad7768_probe(struct spi_device *spi)
indio_dev->channels = ad7768_channels;
indio_dev->num_channels = ARRAY_SIZE(ad7768_channels);
indio_dev->dev.parent = &spi->dev;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->info = &ad7768_info;
indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_TRIGGERED;

View File

@ -320,7 +320,6 @@ static int ad7780_probe(struct spi_device *spi)
spi_set_drvdata(spi, indio_dev);
indio_dev->dev.parent = &spi->dev;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = &st->chip_info->channel;

View File

@ -425,8 +425,6 @@ static int ad7791_probe(struct spi_device *spi)
spi_set_drvdata(spi, indio_dev);
indio_dev->dev.parent = &spi->dev;
indio_dev->dev.of_node = spi->dev.of_node;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = st->info->channels;

View File

@ -818,8 +818,6 @@ static int ad7793_probe(struct spi_device *spi)
spi_set_drvdata(spi, indio_dev);
indio_dev->dev.parent = &spi->dev;
indio_dev->dev.of_node = spi->dev.of_node;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = st->chip_info->channels;

View File

@ -136,8 +136,6 @@ done:
static const struct iio_buffer_setup_ops ad7887_ring_setup_ops = {
.preenable = &ad7887_ring_preenable,
.postenable = &iio_triggered_buffer_postenable,
.predisable = &iio_triggered_buffer_predisable,
.postdisable = &ad7887_ring_postdisable,
};
@ -264,9 +262,6 @@ static int ad7887_probe(struct spi_device *spi)
spi_set_drvdata(spi, indio_dev);
st->spi = spi;
/* Estabilish that the iio_dev is a child of the spi device */
indio_dev->dev.parent = &spi->dev;
indio_dev->dev.of_node = spi->dev.of_node;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->info = &ad7887_info;
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -315,8 +315,6 @@ static int ad7923_probe(struct spi_device *spi)
info = &ad7923_chip_info[spi_get_device_id(spi)->driver_data];
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->dev.parent = &spi->dev;
indio_dev->dev.of_node = spi->dev.of_node;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = info->channels;
indio_dev->num_channels = info->num_channels;

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2018 CMC NV
*
* http://www.analog.com/media/en/technical-documentation/data-sheets/AD7949.pdf
* https://www.analog.com/media/en/technical-documentation/data-sheets/AD7949.pdf
*/
#include <linux/delay.h>
@ -243,8 +243,6 @@ static int ad7949_spi_probe(struct spi_device *spi)
return -ENOMEM;
}
indio_dev->dev.parent = dev;
indio_dev->dev.of_node = dev->of_node;
indio_dev->info = &ad7949_spi_info;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -814,8 +814,6 @@ static int ad799x_probe(struct i2c_client *client,
st->client = client;
indio_dev->dev.parent = &client->dev;
indio_dev->dev.of_node = client->dev.of_node;
indio_dev->name = id->name;
indio_dev->info = st->chip_config->info;

View File

@ -345,10 +345,6 @@ static int ad_sd_buffer_postenable(struct iio_dev *indio_dev)
unsigned int channel;
int ret;
ret = iio_triggered_buffer_postenable(indio_dev);
if (ret < 0)
return ret;
channel = find_first_bit(indio_dev->active_scan_mask,
indio_dev->masklength);
ret = ad_sigma_delta_set_channel(sigma_delta,
@ -441,7 +437,6 @@ static irqreturn_t ad_sd_trigger_handler(int irq, void *p)
static const struct iio_buffer_setup_ops ad_sd_buffer_setup_ops = {
.postenable = &ad_sd_buffer_postenable,
.predisable = &iio_triggered_buffer_predisable,
.postdisable = &ad_sd_buffer_postdisable,
.validate_scan_mask = &iio_validate_scan_mask_onehot,
};

View File

@ -435,7 +435,6 @@ static int adi_axi_adc_probe(struct platform_device *pdev)
}
indio_dev->info = &adi_axi_adc_info;
indio_dev->dev.parent = &pdev->dev;
indio_dev->name = "adi-axi-adc";
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->num_channels = conv->chip_info->num_channels;

View File

@ -252,7 +252,6 @@ static int aspeed_adc_probe(struct platform_device *pdev)
model_data = of_device_get_match_data(&pdev->dev);
indio_dev->name = model_data->model_name;
indio_dev->dev.parent = &pdev->dev;
indio_dev->info = &aspeed_adc_iio_info;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = aspeed_adc_iio_channels;

View File

@ -402,6 +402,7 @@ struct at91_adc_state {
wait_queue_head_t wq_data_available;
struct at91_adc_dma dma_st;
struct at91_adc_touch touch_st;
struct iio_dev *indio_dev;
u16 buffer[AT91_BUFFER_MAX_HWORDS];
/*
* lock to prevent concurrent 'single conversion' requests through
@ -642,13 +643,13 @@ static u16 at91_adc_touch_pos(struct at91_adc_state *st, int reg)
/* first half of register is the x or y, second half is the scale */
val = at91_adc_readl(st, reg);
if (!val)
dev_dbg(&iio_priv_to_dev(st)->dev, "pos is 0\n");
dev_dbg(&st->indio_dev->dev, "pos is 0\n");
pos = val & AT91_SAMA5D2_XYZ_MASK;
result = (pos << AT91_SAMA5D2_MAX_POS_BITS) - pos;
scale = (val >> 16) & AT91_SAMA5D2_XYZ_MASK;
if (scale == 0) {
dev_err(&iio_priv_to_dev(st)->dev, "scale is 0\n");
dev_err(&st->indio_dev->dev, "scale is 0\n");
return 0;
}
result /= scale;
@ -937,14 +938,6 @@ static int at91_adc_buffer_preenable(struct iio_dev *indio_dev)
return 0;
}
static int at91_adc_buffer_postenable(struct iio_dev *indio_dev)
{
if (at91_adc_current_chan_is_touch(indio_dev))
return 0;
return iio_triggered_buffer_postenable(indio_dev);
}
static int at91_adc_buffer_postdisable(struct iio_dev *indio_dev)
{
struct at91_adc_state *st = iio_priv(indio_dev);
@ -995,19 +988,9 @@ static int at91_adc_buffer_postdisable(struct iio_dev *indio_dev)
return 0;
}
static int at91_adc_buffer_predisable(struct iio_dev *indio_dev)
{
if (at91_adc_current_chan_is_touch(indio_dev))
return 0;
return iio_triggered_buffer_predisable(indio_dev);
}
static const struct iio_buffer_setup_ops at91_buffer_setup_ops = {
.preenable = &at91_adc_buffer_preenable,
.postdisable = &at91_adc_buffer_postdisable,
.postenable = &at91_adc_buffer_postenable,
.predisable = &at91_adc_buffer_predisable,
};
static struct iio_trigger *at91_adc_allocate_trigger(struct iio_dev *indio,
@ -1204,9 +1187,9 @@ static unsigned at91_adc_startup_time(unsigned startup_time_min,
return i;
}
static void at91_adc_setup_samp_freq(struct at91_adc_state *st, unsigned freq)
static void at91_adc_setup_samp_freq(struct iio_dev *indio_dev, unsigned freq)
{
struct iio_dev *indio_dev = iio_priv_to_dev(st);
struct at91_adc_state *st = iio_priv(indio_dev);
unsigned f_per, prescal, startup, mr;
f_per = clk_get_rate(st->per_clk);
@ -1275,9 +1258,9 @@ static void at91_adc_pen_detect_interrupt(struct at91_adc_state *st)
st->touch_st.touching = true;
}
static void at91_adc_no_pen_detect_interrupt(struct at91_adc_state *st)
static void at91_adc_no_pen_detect_interrupt(struct iio_dev *indio_dev)
{
struct iio_dev *indio_dev = iio_priv_to_dev(st);
struct at91_adc_state *st = iio_priv(indio_dev);
at91_adc_writel(st, AT91_SAMA5D2_TRGR,
AT91_SAMA5D2_TRGR_TRGMOD_NO_TRIGGER);
@ -1297,7 +1280,7 @@ static void at91_adc_workq_handler(struct work_struct *workq)
struct at91_adc_touch, workq);
struct at91_adc_state *st = container_of(touch_st,
struct at91_adc_state, touch_st);
struct iio_dev *indio_dev = iio_priv_to_dev(st);
struct iio_dev *indio_dev = st->indio_dev;
iio_push_to_buffers(indio_dev, st->buffer);
}
@ -1318,7 +1301,7 @@ static irqreturn_t at91_adc_interrupt(int irq, void *private)
at91_adc_pen_detect_interrupt(st);
} else if ((status & AT91_SAMA5D2_IER_NOPEN)) {
/* nopen detected IRQ */
at91_adc_no_pen_detect_interrupt(st);
at91_adc_no_pen_detect_interrupt(indio);
} else if ((status & AT91_SAMA5D2_ISR_PENS) &&
((status & rdy_mask) == rdy_mask)) {
/* periodic trigger IRQ - during pen sense */
@ -1486,7 +1469,7 @@ static int at91_adc_write_raw(struct iio_dev *indio_dev,
val > st->soc_info.max_sample_rate)
return -EINVAL;
at91_adc_setup_samp_freq(st, val);
at91_adc_setup_samp_freq(indio_dev, val);
return 0;
default:
return -EINVAL;
@ -1624,8 +1607,10 @@ static int at91_adc_update_scan_mode(struct iio_dev *indio_dev,
return 0;
}
static void at91_adc_hw_init(struct at91_adc_state *st)
static void at91_adc_hw_init(struct iio_dev *indio_dev)
{
struct at91_adc_state *st = iio_priv(indio_dev);
at91_adc_writel(st, AT91_SAMA5D2_CR, AT91_SAMA5D2_CR_SWRST);
at91_adc_writel(st, AT91_SAMA5D2_IDR, 0xffffffff);
/*
@ -1635,7 +1620,7 @@ static void at91_adc_hw_init(struct at91_adc_state *st)
at91_adc_writel(st, AT91_SAMA5D2_MR,
AT91_SAMA5D2_MR_TRANSFER(2) | AT91_SAMA5D2_MR_ANACH);
at91_adc_setup_samp_freq(st, st->soc_info.min_sample_rate);
at91_adc_setup_samp_freq(indio_dev, st->soc_info.min_sample_rate);
/* configure extended mode register */
at91_adc_config_emr(st);
@ -1710,7 +1695,6 @@ static int at91_adc_probe(struct platform_device *pdev)
if (!indio_dev)
return -ENOMEM;
indio_dev->dev.parent = &pdev->dev;
indio_dev->name = dev_name(&pdev->dev);
indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_SOFTWARE;
indio_dev->info = &at91_adc_info;
@ -1718,6 +1702,7 @@ static int at91_adc_probe(struct platform_device *pdev)
indio_dev->num_channels = ARRAY_SIZE(at91_adc_channels);
st = iio_priv(indio_dev);
st->indio_dev = indio_dev;
bitmap_set(&st->touch_st.channels_bitmask,
AT91_SAMA5D2_TOUCH_X_CHAN_IDX, 1);
@ -1829,7 +1814,7 @@ static int at91_adc_probe(struct platform_device *pdev)
goto vref_disable;
}
at91_adc_hw_init(st);
at91_adc_hw_init(indio_dev);
ret = clk_prepare_enable(st->per_clk);
if (ret)
@ -1945,7 +1930,7 @@ static __maybe_unused int at91_adc_resume(struct device *dev)
if (ret)
goto vref_disable_resume;
at91_adc_hw_init(st);
at91_adc_hw_init(indio_dev);
/* reconfiguring trigger hardware state */
if (!iio_buffer_enabled(indio_dev))

View File

@ -287,13 +287,13 @@ static void handle_adc_eoc_trigger(int irq, struct iio_dev *idev)
}
}
static int at91_ts_sample(struct at91_adc_state *st)
static int at91_ts_sample(struct iio_dev *idev)
{
struct at91_adc_state *st = iio_priv(idev);
unsigned int xscale, yscale, reg, z1, z2;
unsigned int x, y, pres, xpos, ypos;
unsigned int rxp = 1;
unsigned int factor = 1000;
struct iio_dev *idev = iio_priv_to_dev(st);
unsigned int xyz_mask_bits = st->res;
unsigned int xyz_mask = (1 << xyz_mask_bits) - 1;
@ -449,7 +449,7 @@ static irqreturn_t at91_adc_9x5_interrupt(int irq, void *private)
if (status & AT91_ADC_ISR_PENS) {
/* validate data by pen contact */
at91_ts_sample(st);
at91_ts_sample(idev);
} else {
/* triggered by event that is no pen contact, just read
* them to clean the interrupt and discard all.
@ -737,10 +737,10 @@ static int at91_adc_read_raw(struct iio_dev *idev,
return -EINVAL;
}
static int at91_adc_of_get_resolution(struct at91_adc_state *st,
static int at91_adc_of_get_resolution(struct iio_dev *idev,
struct platform_device *pdev)
{
struct iio_dev *idev = iio_priv_to_dev(st);
struct at91_adc_state *st = iio_priv(idev);
struct device_node *np = pdev->dev.of_node;
int count, i, ret = 0;
char *res_name, *s;
@ -866,10 +866,10 @@ static int at91_adc_probe_dt_ts(struct device_node *node,
}
}
static int at91_adc_probe_dt(struct at91_adc_state *st,
static int at91_adc_probe_dt(struct iio_dev *idev,
struct platform_device *pdev)
{
struct iio_dev *idev = iio_priv_to_dev(st);
struct at91_adc_state *st = iio_priv(idev);
struct device_node *node = pdev->dev.of_node;
struct device_node *trig_node;
int i = 0, ret;
@ -910,7 +910,7 @@ static int at91_adc_probe_dt(struct at91_adc_state *st,
}
st->vref_mv = prop;
ret = at91_adc_of_get_resolution(st, pdev);
ret = at91_adc_of_get_resolution(idev, pdev);
if (ret)
goto error_ret;
@ -1010,9 +1010,9 @@ static void atmel_ts_close(struct input_dev *dev)
at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_PEN);
}
static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
static int at91_ts_hw_init(struct iio_dev *idev, u32 adc_clk_khz)
{
struct iio_dev *idev = iio_priv_to_dev(st);
struct at91_adc_state *st = iio_priv(idev);
u32 reg = 0;
u32 tssctim = 0;
int i = 0;
@ -1085,11 +1085,11 @@ static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
return 0;
}
static int at91_ts_register(struct at91_adc_state *st,
static int at91_ts_register(struct iio_dev *idev,
struct platform_device *pdev)
{
struct at91_adc_state *st = iio_priv(idev);
struct input_dev *input;
struct iio_dev *idev = iio_priv_to_dev(st);
int ret;
input = input_allocate_device();
@ -1161,7 +1161,7 @@ static int at91_adc_probe(struct platform_device *pdev)
st = iio_priv(idev);
if (pdev->dev.of_node)
ret = at91_adc_probe_dt(st, pdev);
ret = at91_adc_probe_dt(idev, pdev);
else
ret = at91_adc_probe_pdata(st, pdev);
@ -1172,7 +1172,6 @@ static int at91_adc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, idev);
idev->dev.parent = &pdev->dev;
idev->name = dev_name(&pdev->dev);
idev->modes = INDIO_DIRECT_MODE;
idev->info = &at91_adc_info;
@ -1301,11 +1300,11 @@ static int at91_adc_probe(struct platform_device *pdev)
goto error_disable_adc_clk;
}
} else {
ret = at91_ts_register(st, pdev);
ret = at91_ts_register(idev, pdev);
if (ret)
goto error_disable_adc_clk;
at91_ts_hw_init(st, adc_clk_khz);
at91_ts_hw_init(idev, adc_clk_khz);
}
ret = iio_device_register(idev);

View File

@ -668,8 +668,6 @@ static int axp20x_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, indio_dev);
info->regmap = axp20x_dev->regmap;
indio_dev->dev.parent = &pdev->dev;
indio_dev->dev.of_node = pdev->dev.of_node;
indio_dev->modes = INDIO_DIRECT_MODE;
if (!pdev->dev.of_node) {

View File

@ -271,7 +271,6 @@ static int axp288_adc_probe(struct platform_device *pdev)
return ret;
}
indio_dev->dev.parent = &pdev->dev;
indio_dev->name = pdev->name;
indio_dev->channels = axp288_adc_channels;
indio_dev->num_channels = ARRAY_SIZE(axp288_adc_channels);

View File

@ -573,8 +573,6 @@ static int iproc_adc_probe(struct platform_device *pdev)
}
indio_dev->name = "iproc-static-adc";
indio_dev->dev.parent = &pdev->dev;
indio_dev->dev.of_node = pdev->dev.of_node;
indio_dev->info = &iproc_adc_iio_info;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = iproc_adc_iio_channels;

View File

@ -321,7 +321,6 @@ static int berlin2_adc_probe(struct platform_device *pdev)
init_waitqueue_head(&priv->wq);
mutex_init(&priv->lock);
indio_dev->dev.parent = &pdev->dev;
indio_dev->name = dev_name(&pdev->dev);
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &berlin2_adc_info;

View File

@ -334,7 +334,6 @@ static int cc10001_adc_probe(struct platform_device *pdev)
if (ret)
return ret;
indio_dev->dev.parent = &pdev->dev;
indio_dev->name = dev_name(&pdev->dev);
indio_dev->info = &cc10001_adc_info;
indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -15,9 +15,9 @@
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/iio/buffer.h>
@ -955,22 +955,10 @@ MODULE_DEVICE_TABLE(of, cpcap_adc_id_table);
static int cpcap_adc_probe(struct platform_device *pdev)
{
const struct of_device_id *match;
struct cpcap_adc *ddata;
struct iio_dev *indio_dev;
int error;
match = of_match_device(of_match_ptr(cpcap_adc_id_table),
&pdev->dev);
if (!match)
return -EINVAL;
if (!match->data) {
dev_err(&pdev->dev, "no configuration data found\n");
return -ENODEV;
}
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*ddata));
if (!indio_dev) {
dev_err(&pdev->dev, "failed to allocate iio device\n");
@ -978,15 +966,15 @@ static int cpcap_adc_probe(struct platform_device *pdev)
return -ENOMEM;
}
ddata = iio_priv(indio_dev);
ddata->ato = match->data;
ddata->ato = device_get_match_data(&pdev->dev);
if (!ddata->ato)
return -ENODEV;
ddata->dev = &pdev->dev;
mutex_init(&ddata->lock);
init_waitqueue_head(&ddata->wq_data_avail);
indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_SOFTWARE;
indio_dev->dev.parent = &pdev->dev;
indio_dev->dev.of_node = pdev->dev.of_node;
indio_dev->channels = cpcap_adc_channels;
indio_dev->num_channels = ARRAY_SIZE(cpcap_adc_channels);
indio_dev->name = dev_name(&pdev->dev);
@ -1029,7 +1017,7 @@ static int cpcap_adc_probe(struct platform_device *pdev)
static struct platform_driver cpcap_adc_driver = {
.driver = {
.name = "cpcap_adc",
.of_match_table = of_match_ptr(cpcap_adc_id_table),
.of_match_table = cpcap_adc_id_table,
},
.probe = cpcap_adc_probe,
};

View File

@ -354,8 +354,6 @@ static int da9150_gpadc_probe(struct platform_device *pdev)
}
indio_dev->name = dev_name(dev);
indio_dev->dev.parent = dev;
indio_dev->dev.of_node = pdev->dev.of_node;
indio_dev->info = &da9150_gpadc_info;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = da9150_gpadc_channels;

View File

@ -524,10 +524,6 @@ static int dln2_adc_triggered_buffer_postenable(struct iio_dev *indio_dev)
u16 conflict;
unsigned int trigger_chan;
ret = iio_triggered_buffer_postenable(indio_dev);
if (ret)
return ret;
mutex_lock(&dln2->mutex);
/* Enable ADC */
@ -541,7 +537,6 @@ static int dln2_adc_triggered_buffer_postenable(struct iio_dev *indio_dev)
(int)conflict);
ret = -EBUSY;
}
iio_triggered_buffer_predisable(indio_dev);
return ret;
}
@ -555,7 +550,6 @@ static int dln2_adc_triggered_buffer_postenable(struct iio_dev *indio_dev)
mutex_unlock(&dln2->mutex);
if (ret < 0) {
dev_dbg(&dln2->pdev->dev, "Problem in %s\n", __func__);
iio_triggered_buffer_predisable(indio_dev);
return ret;
}
} else {
@ -568,7 +562,7 @@ static int dln2_adc_triggered_buffer_postenable(struct iio_dev *indio_dev)
static int dln2_adc_triggered_buffer_predisable(struct iio_dev *indio_dev)
{
int ret, ret2;
int ret;
struct dln2_adc *dln2 = iio_priv(indio_dev);
mutex_lock(&dln2->mutex);
@ -586,10 +580,6 @@ static int dln2_adc_triggered_buffer_predisable(struct iio_dev *indio_dev)
if (ret < 0)
dev_dbg(&dln2->pdev->dev, "Problem in %s\n", __func__);
ret2 = iio_triggered_buffer_predisable(indio_dev);
if (ret == 0)
ret = ret2;
return ret;
}
@ -652,7 +642,6 @@ static int dln2_adc_probe(struct platform_device *pdev)
IIO_CHAN_SOFT_TIMESTAMP_ASSIGN(dln2->iio_channels[i], i);
indio_dev->name = DLN2_ADC_MOD_NAME;
indio_dev->dev.parent = dev;
indio_dev->info = &dln2_adc_info;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = dln2->iio_channels;

View File

@ -343,8 +343,6 @@ static int envelope_detector_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&env->comp_timeout, envelope_detector_timeout);
indio_dev->name = dev_name(dev);
indio_dev->dev.parent = dev;
indio_dev->dev.of_node = dev->of_node;
indio_dev->info = &envelope_detector_info;
indio_dev->channels = &envelope_detector_iio_channel;
indio_dev->num_channels = 1;

View File

@ -170,7 +170,6 @@ static int ep93xx_adc_probe(struct platform_device *pdev)
return PTR_ERR(priv->base);
}
iiodev->dev.parent = &pdev->dev;
iiodev->name = dev_name(&pdev->dev);
iiodev->modes = INDIO_DIRECT_MODE;
iiodev->info = &ep93xx_adc_info;

View File

@ -867,8 +867,6 @@ static int exynos_adc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, indio_dev);
indio_dev->name = dev_name(&pdev->dev);
indio_dev->dev.parent = &pdev->dev;
indio_dev->dev.of_node = pdev->dev.of_node;
indio_dev->info = &exynos_adc_iio_info;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = exynos_adc_iio_channels;

View File

@ -350,7 +350,6 @@ static int mx25_gcq_probe(struct platform_device *pdev)
goto err_clk_unprepare;
}
indio_dev->dev.parent = &pdev->dev;
indio_dev->channels = mx25_gcq_channels;
indio_dev->num_channels = ARRAY_SIZE(mx25_gcq_channels);
indio_dev->info = &mx25_gcq_iio_info;

View File

@ -15,9 +15,7 @@
#include <linux/iio/triggered_event.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/mod_devicetable.h>
#include <linux/spi/spi.h>
#include <linux/gpio/consumer.h>
@ -488,8 +486,6 @@ static int hi8435_probe(struct spi_device *spi)
spi_set_drvdata(spi, idev);
mutex_init(&priv->lock);
idev->dev.parent = &spi->dev;
idev->dev.of_node = spi->dev.of_node;
idev->name = spi_get_device_id(spi)->name;
idev->modes = INDIO_DIRECT_MODE;
idev->info = &hi8435_info;
@ -542,7 +538,7 @@ MODULE_DEVICE_TABLE(spi, hi8435_id);
static struct spi_driver hi8435_driver = {
.driver = {
.name = DRV_NAME,
.of_match_table = of_match_ptr(hi8435_dt_ids),
.of_match_table = hi8435_dt_ids,
},
.probe = hi8435_probe,
.id_table = hi8435_id,

Some files were not shown because too many files have changed in this diff Show More