mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 22:50:41 +00:00
2nd set of IIO new device support, cleanups etc for 6.2
Includes a few late breaking fixes for old issues. Contains a large set of conversions from i2c probe() to probe_new() as part of an attempt to finally get rid of the old style probe(). New devices support * adi,ad74115 - New driver for this complex input/output device with 16 bit ADCs, 14 bit DACs amongst other features. - A few tidy ups / removal of unused data patches followed. * adi,adf4377 - New driver for this dual output integer-N phased locked loop and VCO chip. * maxim,max30208 - New driver for this high accuracy digital temperature sensor. * st,lsm6dsx - Support for LSM6DS016IS (chip specific data) - Support for ISM330IS (id entry only) Minor cleanups etc * adi,adis - Fix a deadlock on device instance specific mutex. - Tidy up by calling unlocked form of __adis_initial_startup() in all cases and dropping the locked version. * adi,ad4130 - Reference spi-peripehral-props.yaml in the dt-binding. * adi,ad74413r - Fix a bug brought on by integer promotion of signed value to unsigned type. - Add an spi_device_id table to allow module autoloading to work. - Add support for reset pin. * adi,ad7606_par - devm_platform_get_and_ioremap_resource() instead of opencoding. * adi,ad7923 - Add dt-bindings docs for ad7927 via a fallback to ad7928 and do similar for ad7924. * adi,ltc2983 - Drop a now unneeded $ref for -nanoamp property as dt-schema no covers this unit. * maxim,max11410 - Fix mask due to repeated use of VREFN instead of one of them being VREFP. * qcom,spmi-iadc - Add fallback compatibles to dt-binding. * renesas,rzg2l - Document use for RZ/Five SoC. * st,stm32-adc - Improved calibration support with error logging and a debugfs interface to read back the result. * ti,adc128s052 - Fix an issue with missing data members in the adc128_of_match table that meant all device were being handled as adc128s052 ADCs. -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmOCXq8RHGppYzIzQGtl cm5lbC5vcmcACgkQVIU0mcT0FoiLcBAArDMAWec2CUMnbiRqoXKnjuGy1ruTD2mA qQgmnR60koLxQ6Fhl9HDFpfqcQnKszCUGYyrhHhOwFBl1s7MdPrZ5yHWWJw4ie8w EyEPoRk9K8Qcc9anrl3IFjhjtrj/cY8FBLKkFDl9x5xaEkTeaNPLkjf8YPez3y0f YxdpwKWgxAxsS2xCEd4E4bHye2XLs4B3MXgb6buE2eHvNCrXUMSXuPMw33PbMym/ sAqlNzr/Q+W28QSkzXjAhK3s8jd5KxavtAUMZROoUhBc0Wvw2Jln+pC2i/APMGTN Z6VkRk7wkRViwzcBFjkis+vnK1xFaPWHkjHQrS68IHhSjw6obYeNe2T/upWuJBQ+ pGfUr2UwOAjLaqXE3vQjCae0AcS8Tf1Oa/ZMKAAyBcVsdZRdgIRx5qtxeHHWHWGJ XKZGeZohHPlCZkYqhTEvkJVknKDM1heQNh0e43P3GajprfSqoRvWUL6mbtAjYKNF TvHACNQ+ru8NdmC9c1dVEhZOnHZ82mnus5/fEFLsaeu/bxyvhablp3ANp++rqAPx UnCM4W3tWHZ/HjdsHN3PjaW0e53LUO8Yy01mktmVO4NsOoGl3X//uoRYPnQchFbs AStMr/ojGg2duZgwQm0JBva3wBlATdCEHKGRZ4fYoB7bXsHq6gzJCnBpjyRt1vRG kHpSBNiOvVk= =AUOr -----END PGP SIGNATURE----- Merge tag 'iio-for-6.2b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Jonathan writes: 2nd set of IIO new device support, cleanups etc for 6.2 Includes a few late breaking fixes for old issues. Contains a large set of conversions from i2c probe() to probe_new() as part of an attempt to finally get rid of the old style probe(). New devices support * adi,ad74115 - New driver for this complex input/output device with 16 bit ADCs, 14 bit DACs amongst other features. - A few tidy ups / removal of unused data patches followed. * adi,adf4377 - New driver for this dual output integer-N phased locked loop and VCO chip. * maxim,max30208 - New driver for this high accuracy digital temperature sensor. * st,lsm6dsx - Support for LSM6DS016IS (chip specific data) - Support for ISM330IS (id entry only) Minor cleanups etc * adi,adis - Fix a deadlock on device instance specific mutex. - Tidy up by calling unlocked form of __adis_initial_startup() in all cases and dropping the locked version. * adi,ad4130 - Reference spi-peripehral-props.yaml in the dt-binding. * adi,ad74413r - Fix a bug brought on by integer promotion of signed value to unsigned type. - Add an spi_device_id table to allow module autoloading to work. - Add support for reset pin. * adi,ad7606_par - devm_platform_get_and_ioremap_resource() instead of opencoding. * adi,ad7923 - Add dt-bindings docs for ad7927 via a fallback to ad7928 and do similar for ad7924. * adi,ltc2983 - Drop a now unneeded $ref for -nanoamp property as dt-schema no covers this unit. * maxim,max11410 - Fix mask due to repeated use of VREFN instead of one of them being VREFP. * qcom,spmi-iadc - Add fallback compatibles to dt-binding. * renesas,rzg2l - Document use for RZ/Five SoC. * st,stm32-adc - Improved calibration support with error logging and a debugfs interface to read back the result. * ti,adc128s052 - Fix an issue with missing data members in the adc128_of_match table that meant all device were being handled as adc128s052 ADCs. * tag 'iio-for-6.2b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (178 commits) iio: addac: ad74413r: fix blank line after declaration warning iio: addac: ad74115: remove unused ad74115_dac_slew_rate_hz_tbl dt-bindings: iio: imu: st_lsm6dsx: add ism330is iio: imu: st_lsm6dsx: add support to ISM330IS iio: frequency: adf4377: add support for ADF4377 dt-bindings: iio: frequency: add adf4377 doc dt-bindings: iio: adc: ad4130: use spi-peripheral-props.yaml dt-bindings: iio: temperature: ltc2983: drop $ref for -nanoamp properties dt-bindings: iio: adc: renesas,rzg2l-adc: Document RZ/Five SoC iio: adc128s052: add proper .data members in adc128_of_match table iio: adc: stm32-adc: add debugfs to read raw calibration result iio: adc: stm32-adc: improve calibration error log iio: adc: stm32-adc: smart calibration support iio: addac: ad74413r: add support for reset-gpio dt-bindings: iio: ad74413r: add optional reset-gpios iio: addac: ad74413r: add spi_device_id table dt-bindings: iio/adc: qcom,spmi-iadc: use double compatibles dt-bindings: iio: imu: st_lsm6dsx: add lsm6dso16is iio: imu: st_lsm6dsx: add support to LSM6DSO16IS iio: addac: add AD74115 driver ...
This commit is contained in:
commit
75621ae307
@ -190,7 +190,10 @@ patternProperties:
|
||||
- reg
|
||||
- diff-channels
|
||||
|
||||
additionalProperties: false
|
||||
allOf:
|
||||
- $ref: /schemas/spi/spi-peripheral-props.yaml#
|
||||
|
||||
unevaluatedProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
|
@ -11,7 +11,7 @@ maintainers:
|
||||
|
||||
description: |
|
||||
Analog Devices AD7904, AD7914, AD7923, AD7924 4 Channel ADCs, and AD7908,
|
||||
AD7918, AD7928 8 Channels ADCs.
|
||||
AD7918, AD7927, AD7928 8 Channels ADCs.
|
||||
|
||||
Specifications about the part can be found at:
|
||||
https://www.analog.com/media/en/technical-documentation/data-sheets/AD7923.pdf
|
||||
@ -20,14 +20,22 @@ description: |
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- adi,ad7904
|
||||
- adi,ad7914
|
||||
- adi,ad7923
|
||||
- adi,ad7924
|
||||
- adi,ad7908
|
||||
- adi,ad7918
|
||||
- adi,ad7928
|
||||
oneOf:
|
||||
- enum:
|
||||
- adi,ad7904
|
||||
- adi,ad7908
|
||||
- adi,ad7914
|
||||
- adi,ad7918
|
||||
- adi,ad7923
|
||||
- adi,ad7928
|
||||
- const: adi,ad7924
|
||||
deprecated: true
|
||||
- items:
|
||||
- const: adi,ad7924
|
||||
- const: adi,ad7923
|
||||
- items:
|
||||
- const: adi,ad7927
|
||||
- const: adi,ad7928
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
@ -18,7 +18,10 @@ description: |
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: qcom,spmi-iadc
|
||||
items:
|
||||
- enum:
|
||||
- qcom,pm8941-iadc
|
||||
- const: qcom,spmi-iadc
|
||||
|
||||
reg:
|
||||
description: IADC base address and length in the SPMI PMIC register map
|
||||
@ -50,7 +53,7 @@ examples:
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
pmic_iadc: adc@3600 {
|
||||
compatible = "qcom,spmi-iadc";
|
||||
compatible = "qcom,pm8941-iadc", "qcom,spmi-iadc";
|
||||
reg = <0x3600>;
|
||||
interrupts = <0x0 0x36 0x0 IRQ_TYPE_EDGE_RISING>;
|
||||
qcom,external-resistor-micro-ohms = <10000>;
|
||||
|
@ -19,7 +19,7 @@ properties:
|
||||
compatible:
|
||||
items:
|
||||
- enum:
|
||||
- renesas,r9a07g043-adc # RZ/G2UL
|
||||
- renesas,r9a07g043-adc # RZ/G2UL and RZ/Five
|
||||
- renesas,r9a07g044-adc # RZ/G2L
|
||||
- renesas,r9a07g054-adc # RZ/V2L
|
||||
- const: renesas,rzg2l-adc
|
||||
|
373
Documentation/devicetree/bindings/iio/addac/adi,ad74115.yaml
Normal file
373
Documentation/devicetree/bindings/iio/addac/adi,ad74115.yaml
Normal file
@ -0,0 +1,373 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/iio/addac/adi,ad74115.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Analog Devices AD74115H device
|
||||
|
||||
maintainers:
|
||||
- Cosmin Tanislav <cosmin.tanislav@analog.com>
|
||||
|
||||
description: |
|
||||
The AD74115H is a single-channel software configurable input/output
|
||||
device for industrial control applications. It contains functionality for
|
||||
analog output, analog input, digital output, digital input, resistance
|
||||
temperature detector, and thermocouple measurements integrated into a single
|
||||
chip solution with an SPI interface. The device features a 16-bit ADC and a
|
||||
14-bit DAC.
|
||||
|
||||
https://www.analog.com/en/products/ad74115h.html
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- adi,ad74115h
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
spi-max-frequency:
|
||||
maximum: 24000000
|
||||
|
||||
spi-cpol: true
|
||||
|
||||
reset-gpios: true
|
||||
|
||||
interrupts:
|
||||
minItems: 1
|
||||
maxItems: 2
|
||||
|
||||
interrupt-names:
|
||||
minItems: 1
|
||||
maxItems: 2
|
||||
items:
|
||||
enum:
|
||||
- adc_rdy
|
||||
- alert
|
||||
|
||||
avdd-supply: true
|
||||
avcc-supply: true
|
||||
dvcc-supply: true
|
||||
dovdd-supply: true
|
||||
refin-supply: true
|
||||
|
||||
adi,ch-func:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: |
|
||||
Channel function.
|
||||
0 - High impedance
|
||||
1 - Voltage output
|
||||
2 - Current output
|
||||
3 - Voltage input
|
||||
4 - Current input, externally-powered
|
||||
5 - Current input, loop-powered
|
||||
6 - Resistance input
|
||||
7 - RTD measure
|
||||
8 - Digital input logic
|
||||
9 - Digital input, loop-powered
|
||||
10 - Current output with HART
|
||||
11 - Current input, externally-powered, with HART
|
||||
12 - Current input, loop-powered, with HART
|
||||
minimum: 0
|
||||
maximum: 12
|
||||
default: 0
|
||||
|
||||
adi,conv2-mux:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: |
|
||||
Input node for ADC conversion 2.
|
||||
0 - SENSE_EXT1 to AGND_SENSE
|
||||
1 - SENSE_EXT2 to AGND_SENSE
|
||||
2 - SENSE_EXT2 to SENSE_EXT1
|
||||
3 - AGND to AGND
|
||||
minimum: 0
|
||||
maximum: 3
|
||||
default: 0
|
||||
|
||||
adi,conv2-range-microvolt:
|
||||
description: Conversion range for ADC conversion 2.
|
||||
oneOf:
|
||||
- items:
|
||||
- enum: [-2500000, 0]
|
||||
- const: 2500000
|
||||
- items:
|
||||
- enum: [-12000000, 0]
|
||||
- const: 12000000
|
||||
- items:
|
||||
- const: -2500000
|
||||
- const: 0
|
||||
- items:
|
||||
- const: -104000
|
||||
- const: 104000
|
||||
- items:
|
||||
- const: 0
|
||||
- const: 625000
|
||||
|
||||
adi,sense-agnd-buffer-low-power:
|
||||
type: boolean
|
||||
description:
|
||||
Whether to enable low-power buffered mode for the AGND sense pin.
|
||||
|
||||
adi,lf-buffer-low-power:
|
||||
type: boolean
|
||||
description:
|
||||
Whether to enable low-power buffered mode for the low-side filtered
|
||||
sense pin.
|
||||
|
||||
adi,hf-buffer-low-power:
|
||||
type: boolean
|
||||
description:
|
||||
Whether to enable low-power buffered mode for the high-side filtered
|
||||
sense pin.
|
||||
|
||||
adi,ext2-buffer-low-power:
|
||||
type: boolean
|
||||
description: Whether to enable low-power buffered mode for the EXT2 pin.
|
||||
|
||||
adi,ext1-buffer-low-power:
|
||||
type: boolean
|
||||
description: Whether to enable low-power buffered mode for the EXT1 pin.
|
||||
|
||||
adi,comparator-invert:
|
||||
type: boolean
|
||||
description: Whether to invert the comparator output.
|
||||
|
||||
adi,digital-input-sink-range-high:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: |
|
||||
When not present, the digital input range is from 0 to 3700uA in steps
|
||||
of 120uA, with a ~2k series resistance.
|
||||
When present, the digital input range is from 0 to 7400uA in steps
|
||||
of 240uA, with a ~1k series resistance.
|
||||
|
||||
adi,digital-input-sink-microamp:
|
||||
description: Sink current in digital input mode.
|
||||
minimum: 0
|
||||
maximum: 3700
|
||||
default: 0
|
||||
|
||||
adi,digital-input-debounce-mode-counter-reset:
|
||||
type: boolean
|
||||
description: |
|
||||
When not present, a counter increments when the signal is asserted
|
||||
and decrements when the signal is de-asserted.
|
||||
When present, a counter increments while the signal is asserted and
|
||||
resets when the signal de-asserts
|
||||
|
||||
adi,digital-input-unbuffered:
|
||||
type: boolean
|
||||
description: Whether to buffer digital input signals.
|
||||
|
||||
adi,digital-input-short-circuit-detection:
|
||||
type: boolean
|
||||
description: Whether to detect digital input short circuits.
|
||||
|
||||
adi,digital-input-open-circuit-detection:
|
||||
type: boolean
|
||||
description: Whether to detect digital input open circuits.
|
||||
|
||||
adi,digital-input-threshold-mode-fixed:
|
||||
type: boolean
|
||||
description: |
|
||||
When not present, the digital input threshold range is -0.96 * AVDD
|
||||
to AVDD.
|
||||
When present, the threshold range is fixed from -19V to 30V.
|
||||
|
||||
adi,dac-bipolar:
|
||||
type: boolean
|
||||
description: |
|
||||
When not present, the DAC operates in the 0V to 12V range.
|
||||
When present, the DAC operates in the -12V to 12V range.
|
||||
|
||||
adi,charge-pump:
|
||||
type: boolean
|
||||
description: Whether to enable the internal charge pump.
|
||||
|
||||
adi,dac-hart-slew:
|
||||
type: boolean
|
||||
description: Whether to use a HART-compatible slew rate.
|
||||
|
||||
adi,dac-current-limit-low:
|
||||
type: boolean
|
||||
description: |
|
||||
When not present, the DAC short-circuit current limit is 32mA in
|
||||
either source or sink for VOUT and 4mA sink for IOUT.
|
||||
When present, the limit is 16mA in either source or sink for VOUT,
|
||||
1mA sink for IOUT.
|
||||
|
||||
adi,4-wire-rtd:
|
||||
type: boolean
|
||||
description: |
|
||||
When not present, the ADC should be used for measuring 3-wire RTDs.
|
||||
When present, the ADC should be used for measuring 4-wire RTDs.
|
||||
|
||||
adi,3-wire-rtd-excitation-swap:
|
||||
type: boolean
|
||||
description: Whether to swap the excitation for 3-wire RTD.
|
||||
|
||||
adi,rtd-excitation-current-microamp:
|
||||
description: Excitation current to apply to RTD.
|
||||
enum: [250, 500, 750, 1000]
|
||||
default: 250
|
||||
|
||||
adi,ext1-burnout:
|
||||
type: boolean
|
||||
description: Whether to enable burnout current for EXT1.
|
||||
|
||||
adi,ext1-burnout-current-nanoamp:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description:
|
||||
Burnout current in nanoamps to be applied to EXT1.
|
||||
enum: [0, 50, 500, 1000, 10000]
|
||||
default: 0
|
||||
|
||||
adi,ext1-burnout-current-polarity-sourcing:
|
||||
type: boolean
|
||||
description: |
|
||||
When not present, the burnout current polarity for EXT1 is sinking.
|
||||
When present, the burnout current polarity for EXT1 is sourcing.
|
||||
|
||||
adi,ext2-burnout:
|
||||
type: boolean
|
||||
description: Whether to enable burnout current for EXT2.
|
||||
|
||||
adi,ext2-burnout-current-nanoamp:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: Burnout current in nanoamps to be applied to EXT2.
|
||||
enum: [0, 50, 500, 1000, 10000]
|
||||
default: 0
|
||||
|
||||
adi,ext2-burnout-current-polarity-sourcing:
|
||||
type: boolean
|
||||
description: |
|
||||
When not present, the burnout current polarity for EXT2 is sinking.
|
||||
When present, the burnout current polarity for EXT2 is sourcing.
|
||||
|
||||
adi,viout-burnout:
|
||||
type: boolean
|
||||
description: Whether to enable burnout current for VIOUT.
|
||||
|
||||
adi,viout-burnout-current-nanoamp:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: Burnout current in nanoamps to be applied to VIOUT.
|
||||
enum: [0, 1000, 10000]
|
||||
default: 0
|
||||
|
||||
adi,viout-burnout-current-polarity-sourcing:
|
||||
type: boolean
|
||||
description: |
|
||||
When not present, the burnout current polarity for VIOUT is sinking.
|
||||
When present, the burnout current polarity for VIOUT is sourcing.
|
||||
|
||||
adi,gpio0-mode:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: |
|
||||
GPIO functions.
|
||||
0 - Disabled
|
||||
1 - Logic I/O
|
||||
2 - Comparator output
|
||||
3 - Control HART CD
|
||||
4 - Monitor HART CD
|
||||
5 - Monitor HART EOM status
|
||||
minimum: 0
|
||||
maximum: 5
|
||||
default: 0
|
||||
|
||||
adi,gpio1-mode:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: |
|
||||
GPIO functions.
|
||||
0 - Disabled
|
||||
1 - Logic I/O
|
||||
2 - Drive external digital output FET
|
||||
3 - Control HART RXD
|
||||
4 - Monitor HART RXD
|
||||
5 - Monitor HART SOM status
|
||||
minimum: 0
|
||||
maximum: 5
|
||||
default: 0
|
||||
|
||||
adi,gpio2-mode:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: |
|
||||
GPIO functions.
|
||||
0 - Disabled
|
||||
1 - Logic I/O
|
||||
2 - Drive internal digital output FET
|
||||
3 - Control HART TXD
|
||||
4 - Monitor HART TXD
|
||||
5 - Monitor HART TX complete status
|
||||
minimum: 0
|
||||
maximum: 5
|
||||
default: 0
|
||||
|
||||
adi,gpio3-mode:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: |
|
||||
GPIO functions.
|
||||
0 - Disabled
|
||||
1 - Logic I/O
|
||||
2 - High impedance
|
||||
3 - Control HART RTS
|
||||
4 - Monitor HART RTS
|
||||
5 - Monitor HART CD complete status
|
||||
minimum: 0
|
||||
maximum: 5
|
||||
default: 0
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- spi-cpol
|
||||
- avdd-supply
|
||||
|
||||
allOf:
|
||||
- $ref: /schemas/spi/spi-peripheral-props.yaml#
|
||||
- if:
|
||||
required:
|
||||
- adi,digital-input-sink-range-high
|
||||
then:
|
||||
properties:
|
||||
adi,digital-input-sink-microamp:
|
||||
maximum: 7400
|
||||
|
||||
unevaluatedProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
|
||||
spi {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
addac@0 {
|
||||
compatible = "adi,ad74115h";
|
||||
reg = <0>;
|
||||
|
||||
spi-max-frequency = <12000000>;
|
||||
spi-cpol;
|
||||
|
||||
reset-gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
|
||||
|
||||
interrupt-parent = <&gpio>;
|
||||
interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
|
||||
interrupt-names = "adc_rdy";
|
||||
|
||||
avdd-supply = <&ad74115_avdd>;
|
||||
|
||||
adi,ch-func = <1>;
|
||||
adi,conv2-mux = <2>;
|
||||
adi,conv2-range-microvolt = <(-12000000) 12000000>;
|
||||
|
||||
adi,gpio0-mode = <1>;
|
||||
adi,gpio1-mode = <1>;
|
||||
adi,gpio2-mode = <1>;
|
||||
adi,gpio3-mode = <1>;
|
||||
|
||||
adi,dac-bipolar;
|
||||
};
|
||||
};
|
||||
...
|
@ -51,6 +51,9 @@ properties:
|
||||
Shunt (sense) resistor value in micro-Ohms.
|
||||
default: 100000000
|
||||
|
||||
reset-gpios:
|
||||
maxItems: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
@ -129,6 +132,7 @@ examples:
|
||||
interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
|
||||
|
||||
refin-supply = <&ad74413r_refin>;
|
||||
reset-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
|
||||
|
||||
channel@0 {
|
||||
reg = <0>;
|
||||
|
@ -0,0 +1,92 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/iio/frequency/adi,adf4377.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: ADF4377 Microwave Wideband Synthesizer with Integrated VCO
|
||||
|
||||
maintainers:
|
||||
- Antoniu Miclaus <antoniu.miclaus@analog.com>
|
||||
- Dragos Bogdan <dragos.bogdan@analog.com>
|
||||
|
||||
description: |
|
||||
The ADF4377 is a high performance, ultralow jitter, dual output integer-N
|
||||
phased locked loop (PLL) with integrated voltage controlled oscillator (VCO)
|
||||
ideally suited for data converter and mixed signal front end (MxFE) clock
|
||||
applications.
|
||||
|
||||
https://www.analog.com/en/products/adf4377.html
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- adi,adf4377
|
||||
- adi,adf4378
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
spi-max-frequency:
|
||||
maximum: 10000000
|
||||
|
||||
clocks:
|
||||
maxItems: 1
|
||||
|
||||
clock-names:
|
||||
description:
|
||||
External clock that provides reference input frequency.
|
||||
items:
|
||||
- const: ref_in
|
||||
|
||||
chip-enable-gpios:
|
||||
description:
|
||||
GPIO that controls the Chip Enable Pin.
|
||||
maxItems: 1
|
||||
|
||||
clk1-enable-gpios:
|
||||
description:
|
||||
GPIO that controls the Enable Clock 1 Output Buffer Pin.
|
||||
maxItems: 1
|
||||
|
||||
clk2-enable-gpios:
|
||||
description:
|
||||
GPIO that controls the Enable Clock 2 Output Buffer Pin.
|
||||
maxItems: 1
|
||||
|
||||
adi,muxout-select:
|
||||
description:
|
||||
On chip multiplexer output selection.
|
||||
high_z - MUXOUT Pin set to high-Z.
|
||||
lock_detect - MUXOUT Pin set to lock detector output.
|
||||
muxout_low - MUXOUT Pin set to low.
|
||||
f_div_rclk_2 - MUXOUT Pin set to fDIV_RCLK/2.
|
||||
f_div_nclk_2 - MUXOUT Pin set to fDIV_NCLK/2.
|
||||
muxout_high - MUXOUT Pin set to high.
|
||||
enum: [high_z, lock_detect, muxout_low, f_div_rclk_2, f_div_nclk_2, muxout_high]
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- clocks
|
||||
- clock-names
|
||||
|
||||
allOf:
|
||||
- $ref: /schemas/spi/spi-peripheral-props.yaml#
|
||||
|
||||
unevaluatedProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
spi {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
frequency@0 {
|
||||
compatible = "adi,adf4377";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <10000000>;
|
||||
clocks = <&adf4377_ref_in>;
|
||||
clock-names = "ref_in";
|
||||
};
|
||||
};
|
||||
...
|
@ -33,6 +33,7 @@ properties:
|
||||
- st,lsm6dst
|
||||
- st,lsm6dsop
|
||||
- st,lsm6dsv
|
||||
- st,lsm6dso16is
|
||||
- items:
|
||||
- const: st,asm330lhhx
|
||||
- const: st,lsm6dsr
|
||||
@ -42,6 +43,9 @@ properties:
|
||||
- items:
|
||||
- const: st,lsm6dsv16x
|
||||
- const: st,lsm6dsv
|
||||
- items:
|
||||
- const: st,ism330is
|
||||
- const: st,lsm6dso16is
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
@ -325,7 +325,6 @@ patternProperties:
|
||||
description:
|
||||
Excitation current applied to the thermistor.
|
||||
0 sets the sensor in auto-range mode.
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
enum: [0, 250, 500, 1000, 5000, 10000, 25000, 50000, 100000, 250000,
|
||||
500000, 1000000]
|
||||
default: 0
|
||||
|
22
MAINTAINERS
22
MAINTAINERS
@ -1175,6 +1175,14 @@ W: https://ez.analog.com/linux-software-drivers
|
||||
F: Documentation/devicetree/bindings/iio/adc/adi,ad7780.yaml
|
||||
F: drivers/iio/adc/ad7780.c
|
||||
|
||||
ANALOG DEVICES INC AD74115 DRIVER
|
||||
M: Cosmin Tanislav <cosmin.tanislav@analog.com>
|
||||
L: linux-iio@vger.kernel.org
|
||||
S: Supported
|
||||
W: http://ez.analog.com/community/linux-device-drivers
|
||||
F: Documentation/devicetree/bindings/iio/addac/adi,ad74115.yaml
|
||||
F: drivers/iio/addac/ad74115.c
|
||||
|
||||
ANALOG DEVICES INC AD74413R DRIVER
|
||||
M: Cosmin Tanislav <cosmin.tanislav@analog.com>
|
||||
L: linux-iio@vger.kernel.org
|
||||
@ -1198,6 +1206,14 @@ W: https://ez.analog.com/linux-software-drivers
|
||||
F: Documentation/devicetree/bindings/iio/amplifiers/adi,ada4250.yaml
|
||||
F: drivers/iio/amplifiers/ada4250.c
|
||||
|
||||
ANALOG DEVICES INC ADF4377 DRIVER
|
||||
M: Antoniu Miclaus <antoniu.miclaus@analog.com>
|
||||
L: linux-iio@vger.kernel.org
|
||||
S: Supported
|
||||
W: https://ez.analog.com/linux-software-drivers
|
||||
F: Documentation/devicetree/bindings/iio/frequency/adi,adf4377.yaml
|
||||
F: drivers/iio/frequency/adf4377.c
|
||||
|
||||
ANALOG DEVICES INC ADGS1408 DRIVER
|
||||
M: Mircea Caprioru <mircea.caprioru@analog.com>
|
||||
S: Supported
|
||||
@ -12522,6 +12538,12 @@ S: Maintained
|
||||
F: Documentation/devicetree/bindings/regulator/maxim,max20086.yaml
|
||||
F: drivers/regulator/max20086-regulator.c
|
||||
|
||||
MAXIM MAX30208 TEMPERATURE SENSOR DRIVER
|
||||
M: Rajat Khandelwal <rajat.khandelwal@linux.intel.com>
|
||||
L: linux-iio@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/iio/temperature/max30208.c
|
||||
|
||||
MAXIM MAX77650 PMIC MFD DRIVER
|
||||
M: Bartosz Golaszewski <brgl@bgdev.pl>
|
||||
L: linux-kernel@vger.kernel.org
|
||||
|
@ -281,7 +281,7 @@ static int adis16201_probe(struct spi_device *spi)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = adis_initial_startup(st);
|
||||
ret = __adis_initial_startup(st);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -291,7 +291,7 @@ static int adis16209_probe(struct spi_device *spi)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = adis_initial_startup(st);
|
||||
ret = __adis_initial_startup(st);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -18,9 +18,9 @@ static const struct regmap_config adxl372_regmap_config = {
|
||||
.readable_noinc_reg = adxl372_readable_noinc_reg,
|
||||
};
|
||||
|
||||
static int adxl372_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int adxl372_i2c_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct regmap *regmap;
|
||||
unsigned int regval;
|
||||
int ret;
|
||||
@ -58,7 +58,7 @@ static struct i2c_driver adxl372_i2c_driver = {
|
||||
.name = "adxl372_i2c",
|
||||
.of_match_table = adxl372_of_match,
|
||||
},
|
||||
.probe = adxl372_i2c_probe,
|
||||
.probe_new = adxl372_i2c_probe,
|
||||
.id_table = adxl372_i2c_id,
|
||||
};
|
||||
|
||||
|
@ -921,9 +921,9 @@ static const struct iio_trigger_ops bma180_trigger_ops = {
|
||||
.reenable = bma180_trig_reen,
|
||||
};
|
||||
|
||||
static int bma180_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int bma180_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct device *dev = &client->dev;
|
||||
struct bma180_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
@ -1134,7 +1134,7 @@ static struct i2c_driver bma180_driver = {
|
||||
.pm = pm_sleep_ptr(&bma180_pm_ops),
|
||||
.of_match_table = bma180_of_match,
|
||||
},
|
||||
.probe = bma180_probe,
|
||||
.probe_new = bma180_probe,
|
||||
.remove = bma180_remove,
|
||||
.id_table = bma180_ids,
|
||||
};
|
||||
|
@ -13,9 +13,9 @@
|
||||
|
||||
#include "bma400.h"
|
||||
|
||||
static int bma400_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int bma400_i2c_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct regmap *regmap;
|
||||
|
||||
regmap = devm_regmap_init_i2c(client, &bma400_regmap_config);
|
||||
@ -44,7 +44,7 @@ static struct i2c_driver bma400_i2c_driver = {
|
||||
.name = "bma400",
|
||||
.of_match_table = bma400_of_i2c_match,
|
||||
},
|
||||
.probe = bma400_i2c_probe,
|
||||
.probe_new = bma400_i2c_probe,
|
||||
.id_table = bma400_i2c_ids,
|
||||
};
|
||||
|
||||
|
@ -171,9 +171,9 @@ static void bmc150_acpi_dual_accel_probe(struct i2c_client *client) {}
|
||||
static void bmc150_acpi_dual_accel_remove(struct i2c_client *client) {}
|
||||
#endif
|
||||
|
||||
static int bmc150_accel_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int bmc150_accel_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct regmap *regmap;
|
||||
const char *name = NULL;
|
||||
enum bmc150_type type = BOSCH_UNKNOWN;
|
||||
@ -269,7 +269,7 @@ static struct i2c_driver bmc150_accel_driver = {
|
||||
.acpi_match_table = ACPI_PTR(bmc150_accel_acpi_match),
|
||||
.pm = &bmc150_accel_pm_ops,
|
||||
},
|
||||
.probe = bmc150_accel_probe,
|
||||
.probe_new = bmc150_accel_probe,
|
||||
.remove = bmc150_accel_remove,
|
||||
.id_table = bmc150_accel_id,
|
||||
};
|
||||
|
@ -105,9 +105,9 @@ static void da280_disable(void *client)
|
||||
da280_enable(client, false);
|
||||
}
|
||||
|
||||
static int da280_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int da280_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
int ret;
|
||||
struct iio_dev *indio_dev;
|
||||
struct da280_data *data;
|
||||
@ -184,7 +184,7 @@ static struct i2c_driver da280_driver = {
|
||||
.acpi_match_table = ACPI_PTR(da280_acpi_match),
|
||||
.pm = pm_sleep_ptr(&da280_pm_ops),
|
||||
},
|
||||
.probe = da280_probe,
|
||||
.probe_new = da280_probe,
|
||||
.id_table = da280_i2c_id,
|
||||
};
|
||||
|
||||
|
@ -1424,9 +1424,9 @@ static const char *kxcjk1013_match_acpi_device(struct device *dev,
|
||||
return dev_name(dev);
|
||||
}
|
||||
|
||||
static int kxcjk1013_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int kxcjk1013_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
static const char * const regulator_names[] = { "vdd", "vddio" };
|
||||
struct kxcjk1013_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
@ -1732,7 +1732,7 @@ static struct i2c_driver kxcjk1013_driver = {
|
||||
.of_match_table = kxcjk1013_of_match,
|
||||
.pm = &kxcjk1013_pm_ops,
|
||||
},
|
||||
.probe = kxcjk1013_probe,
|
||||
.probe_new = kxcjk1013_probe,
|
||||
.remove = kxcjk1013_remove,
|
||||
.id_table = kxcjk1013_id,
|
||||
};
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
#include "mma7455.h"
|
||||
|
||||
static int mma7455_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
static int mma7455_i2c_probe(struct i2c_client *i2c)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
|
||||
struct regmap *regmap;
|
||||
const char *name = NULL;
|
||||
|
||||
@ -46,7 +46,7 @@ static const struct of_device_id mma7455_of_match[] = {
|
||||
MODULE_DEVICE_TABLE(of, mma7455_of_match);
|
||||
|
||||
static struct i2c_driver mma7455_i2c_driver = {
|
||||
.probe = mma7455_i2c_probe,
|
||||
.probe_new = mma7455_i2c_probe,
|
||||
.remove = mma7455_i2c_remove,
|
||||
.id_table = mma7455_i2c_ids,
|
||||
.driver = {
|
||||
|
@ -1545,9 +1545,9 @@ static const struct of_device_id mma8452_dt_ids[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, mma8452_dt_ids);
|
||||
|
||||
static int mma8452_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int mma8452_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct mma8452_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
int ret;
|
||||
@ -1846,7 +1846,7 @@ static struct i2c_driver mma8452_driver = {
|
||||
.of_match_table = mma8452_dt_ids,
|
||||
.pm = &mma8452_pm_ops,
|
||||
},
|
||||
.probe = mma8452_probe,
|
||||
.probe_new = mma8452_probe,
|
||||
.remove = mma8452_remove,
|
||||
.id_table = mma8452_id,
|
||||
};
|
||||
|
@ -446,9 +446,9 @@ static const char *mma9551_match_acpi_device(struct device *dev)
|
||||
return dev_name(dev);
|
||||
}
|
||||
|
||||
static int mma9551_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int mma9551_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct mma9551_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
const char *name = NULL;
|
||||
@ -607,7 +607,7 @@ static struct i2c_driver mma9551_driver = {
|
||||
.acpi_match_table = ACPI_PTR(mma9551_acpi_match),
|
||||
.pm = pm_ptr(&mma9551_pm_ops),
|
||||
},
|
||||
.probe = mma9551_probe,
|
||||
.probe_new = mma9551_probe,
|
||||
.remove = mma9551_remove,
|
||||
.id_table = mma9551_id,
|
||||
};
|
||||
|
@ -1073,9 +1073,9 @@ static const char *mma9553_match_acpi_device(struct device *dev)
|
||||
return dev_name(dev);
|
||||
}
|
||||
|
||||
static int mma9553_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int mma9553_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct mma9553_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
const char *name = NULL;
|
||||
@ -1246,7 +1246,7 @@ static struct i2c_driver mma9553_driver = {
|
||||
.acpi_match_table = ACPI_PTR(mma9553_acpi_match),
|
||||
.pm = pm_ptr(&mma9553_pm_ops),
|
||||
},
|
||||
.probe = mma9553_probe,
|
||||
.probe_new = mma9553_probe,
|
||||
.remove = mma9553_remove,
|
||||
.id_table = mma9553_id,
|
||||
};
|
||||
|
@ -69,9 +69,9 @@ static const struct ad7091r_chip_info ad7091r5_chip_info_noirq = {
|
||||
.vref_mV = 2500,
|
||||
};
|
||||
|
||||
static int ad7091r5_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
static int ad7091r5_i2c_probe(struct i2c_client *i2c)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
|
||||
const struct ad7091r_chip_info *chip_info;
|
||||
struct regmap *map = devm_regmap_init_i2c(i2c, &ad7091r_regmap_config);
|
||||
|
||||
@ -103,7 +103,7 @@ static struct i2c_driver ad7091r5_driver = {
|
||||
.name = "ad7091r5",
|
||||
.of_match_table = ad7091r5_dt_ids,
|
||||
},
|
||||
.probe = ad7091r5_i2c_probe,
|
||||
.probe_new = ad7091r5_i2c_probe,
|
||||
.id_table = ad7091r5_i2c_ids,
|
||||
};
|
||||
module_i2c_driver(ad7091r5_driver);
|
||||
|
@ -465,9 +465,9 @@ static void ad7291_reg_disable(void *reg)
|
||||
regulator_disable(reg);
|
||||
}
|
||||
|
||||
static int ad7291_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int ad7291_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct ad7291_chip_info *chip;
|
||||
struct iio_dev *indio_dev;
|
||||
int ret;
|
||||
@ -553,7 +553,7 @@ static struct i2c_driver ad7291_driver = {
|
||||
.name = KBUILD_MODNAME,
|
||||
.of_match_table = ad7291_of_match,
|
||||
},
|
||||
.probe = ad7291_probe,
|
||||
.probe_new = ad7291_probe,
|
||||
.id_table = ad7291_id,
|
||||
};
|
||||
module_i2c_driver(ad7291_driver);
|
||||
|
@ -57,8 +57,7 @@ static int ad7606_par_probe(struct platform_device *pdev)
|
||||
if (irq < 0)
|
||||
return irq;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
addr = devm_ioremap_resource(&pdev->dev, res);
|
||||
addr = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(addr))
|
||||
return PTR_ERR(addr);
|
||||
|
||||
|
@ -775,9 +775,9 @@ static const struct ad799x_chip_info ad799x_chip_info_tbl[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static int ad799x_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int ad799x_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
int ret;
|
||||
int extra_config = 0;
|
||||
struct ad799x_state *st;
|
||||
@ -968,7 +968,7 @@ static struct i2c_driver ad799x_driver = {
|
||||
.name = "ad799x",
|
||||
.pm = pm_sleep_ptr(&ad799x_pm_ops),
|
||||
},
|
||||
.probe = ad799x_probe,
|
||||
.probe_new = ad799x_probe,
|
||||
.remove = ad799x_remove,
|
||||
.id_table = ad799x_id,
|
||||
};
|
||||
|
@ -946,9 +946,9 @@ static int ina2xx_init(struct ina2xx_chip_info *chip, unsigned int config)
|
||||
return ina2xx_set_calibration(chip);
|
||||
}
|
||||
|
||||
static int ina2xx_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int ina2xx_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct ina2xx_chip_info *chip;
|
||||
struct iio_dev *indio_dev;
|
||||
unsigned int val;
|
||||
@ -1090,7 +1090,7 @@ static struct i2c_driver ina2xx_driver = {
|
||||
.name = KBUILD_MODNAME,
|
||||
.of_match_table = ina2xx_of_match,
|
||||
},
|
||||
.probe = ina2xx_probe,
|
||||
.probe_new = ina2xx_probe,
|
||||
.remove = ina2xx_remove,
|
||||
.id_table = ina2xx_id,
|
||||
};
|
||||
|
@ -99,9 +99,9 @@ static const struct iio_info ltc2471_info = {
|
||||
.read_raw = ltc2471_read_raw,
|
||||
};
|
||||
|
||||
static int ltc2471_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int ltc2471_i2c_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct iio_dev *indio_dev;
|
||||
struct ltc2471_data *data;
|
||||
int ret;
|
||||
@ -146,7 +146,7 @@ static struct i2c_driver ltc2471_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "ltc2471",
|
||||
},
|
||||
.probe = ltc2471_i2c_probe,
|
||||
.probe_new = ltc2471_i2c_probe,
|
||||
.id_table = ltc2471_i2c_id,
|
||||
};
|
||||
|
||||
|
@ -89,9 +89,9 @@ static const struct iio_info ltc2485_info = {
|
||||
.read_raw = ltc2485_read_raw,
|
||||
};
|
||||
|
||||
static int ltc2485_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int ltc2485_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct iio_dev *indio_dev;
|
||||
struct ltc2485_data *data;
|
||||
int ret;
|
||||
@ -133,7 +133,7 @@ static struct i2c_driver ltc2485_driver = {
|
||||
.driver = {
|
||||
.name = "ltc2485",
|
||||
},
|
||||
.probe = ltc2485_probe,
|
||||
.probe_new = ltc2485_probe,
|
||||
.id_table = ltc2485_id,
|
||||
};
|
||||
module_i2c_driver(ltc2485_driver);
|
||||
|
@ -94,9 +94,9 @@ static int ltc2497_result_and_measure(struct ltc2497core_driverdata *ddata,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ltc2497_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int ltc2497_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
const struct ltc2497_chip_info *chip_info;
|
||||
struct iio_dev *indio_dev;
|
||||
struct ltc2497_driverdata *st;
|
||||
@ -165,7 +165,7 @@ static struct i2c_driver ltc2497_driver = {
|
||||
.name = "ltc2497",
|
||||
.of_match_table = ltc2497_of_match,
|
||||
},
|
||||
.probe = ltc2497_probe,
|
||||
.probe_new = ltc2497_probe,
|
||||
.remove = ltc2497_remove,
|
||||
.id_table = ltc2497_id,
|
||||
};
|
||||
|
@ -370,7 +370,7 @@ static int max11410_configure_channel(struct max11410_state *st,
|
||||
FIELD_PREP(MAX11410_CTRL_UNIPOLAR_BIT, cfg.bipolar ? 0 : 1);
|
||||
ret = regmap_update_bits(st->regmap, MAX11410_REG_CTRL,
|
||||
MAX11410_CTRL_REFSEL_MASK |
|
||||
MAX11410_CTRL_VREFN_BUF_BIT |
|
||||
MAX11410_CTRL_VREFP_BUF_BIT |
|
||||
MAX11410_CTRL_VREFN_BUF_BIT |
|
||||
MAX11410_CTRL_UNIPOLAR_BIT, regval);
|
||||
if (ret)
|
||||
|
@ -1579,9 +1579,9 @@ static void max1363_reg_disable(void *reg)
|
||||
regulator_disable(reg);
|
||||
}
|
||||
|
||||
static int max1363_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int max1363_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
int ret;
|
||||
struct max1363_state *st;
|
||||
struct iio_dev *indio_dev;
|
||||
@ -1718,7 +1718,7 @@ static struct i2c_driver max1363_driver = {
|
||||
.name = "max1363",
|
||||
.of_match_table = max1363_of_match,
|
||||
},
|
||||
.probe = max1363_probe,
|
||||
.probe_new = max1363_probe,
|
||||
.id_table = max1363_id,
|
||||
};
|
||||
module_i2c_driver(max1363_driver);
|
||||
|
@ -510,8 +510,7 @@ static const struct of_device_id max9611_of_table[] = {
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(of, max9611_of_table);
|
||||
static int max9611_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int max9611_probe(struct i2c_client *client)
|
||||
{
|
||||
const char * const shunt_res_prop = "shunt-resistor-micro-ohms";
|
||||
struct max9611_dev *max9611;
|
||||
@ -557,7 +556,7 @@ static struct i2c_driver max9611_driver = {
|
||||
.name = DRIVER_NAME,
|
||||
.of_match_table = max9611_of_table,
|
||||
},
|
||||
.probe = max9611_probe,
|
||||
.probe_new = max9611_probe,
|
||||
};
|
||||
module_i2c_driver(max9611_driver);
|
||||
|
||||
|
@ -330,9 +330,9 @@ static const struct iio_info mcp3422_info = {
|
||||
.attrs = &mcp3422_attribute_group,
|
||||
};
|
||||
|
||||
static int mcp3422_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int mcp3422_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct iio_dev *indio_dev;
|
||||
struct mcp3422 *adc;
|
||||
int err;
|
||||
@ -417,7 +417,7 @@ static struct i2c_driver mcp3422_driver = {
|
||||
.name = "mcp3422",
|
||||
.of_match_table = mcp3422_of_match,
|
||||
},
|
||||
.probe = mcp3422_probe,
|
||||
.probe_new = mcp3422_probe,
|
||||
.id_table = mcp3422_id,
|
||||
};
|
||||
module_i2c_driver(mcp3422_driver);
|
||||
|
@ -142,6 +142,7 @@
|
||||
#define STM32H7_LINCALRDYW3 BIT(24)
|
||||
#define STM32H7_LINCALRDYW2 BIT(23)
|
||||
#define STM32H7_LINCALRDYW1 BIT(22)
|
||||
#define STM32H7_LINCALRDYW_MASK GENMASK(27, 22)
|
||||
#define STM32H7_ADCALLIN BIT(16)
|
||||
#define STM32H7_BOOST BIT(8)
|
||||
#define STM32H7_ADSTP BIT(4)
|
||||
|
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/dmaengine.h>
|
||||
@ -119,16 +120,12 @@ struct stm32_adc_trig_info {
|
||||
|
||||
/**
|
||||
* struct stm32_adc_calib - optional adc calibration data
|
||||
* @calfact_s: Calibration offset for single ended channels
|
||||
* @calfact_d: Calibration offset in differential
|
||||
* @lincalfact: Linearity calibration factor
|
||||
* @calibrated: Indicates calibration status
|
||||
* @lincal_saved: Indicates that linear calibration factors are saved
|
||||
*/
|
||||
struct stm32_adc_calib {
|
||||
u32 calfact_s;
|
||||
u32 calfact_d;
|
||||
u32 lincalfact[STM32H7_LINCALFACT_NUM];
|
||||
bool calibrated;
|
||||
bool lincal_saved;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -165,8 +162,6 @@ struct stm32_adc_vrefint {
|
||||
* @extsel: trigger selection register & bitfield
|
||||
* @res: resolution selection register & bitfield
|
||||
* @difsel: differential mode selection register & bitfield
|
||||
* @calfact_s: single-ended calibration factors register & bitfield
|
||||
* @calfact_d: differential calibration factors register & bitfield
|
||||
* @smpr: smpr1 & smpr2 registers offset array
|
||||
* @smp_bits: smpr1 & smpr2 index and bitfields
|
||||
* @or_vddcore: option register & vddcore bitfield
|
||||
@ -186,8 +181,6 @@ struct stm32_adc_regspec {
|
||||
const struct stm32_adc_regs extsel;
|
||||
const struct stm32_adc_regs res;
|
||||
const struct stm32_adc_regs difsel;
|
||||
const struct stm32_adc_regs calfact_s;
|
||||
const struct stm32_adc_regs calfact_d;
|
||||
const u32 smpr[2];
|
||||
const struct stm32_adc_regs *smp_bits;
|
||||
const struct stm32_adc_regs or_vddcore;
|
||||
@ -525,10 +518,6 @@ static const struct stm32_adc_regspec stm32h7_adc_regspec = {
|
||||
STM32H7_EXTSEL_SHIFT },
|
||||
.res = { STM32H7_ADC_CFGR, STM32H7_RES_MASK, STM32H7_RES_SHIFT },
|
||||
.difsel = { STM32H7_ADC_DIFSEL, STM32H7_DIFSEL_MASK},
|
||||
.calfact_s = { STM32H7_ADC_CALFACT, STM32H7_CALFACT_S_MASK,
|
||||
STM32H7_CALFACT_S_SHIFT },
|
||||
.calfact_d = { STM32H7_ADC_CALFACT, STM32H7_CALFACT_D_MASK,
|
||||
STM32H7_CALFACT_D_SHIFT },
|
||||
.smpr = { STM32H7_ADC_SMPR1, STM32H7_ADC_SMPR2 },
|
||||
.smp_bits = stm32h7_smp_bits,
|
||||
};
|
||||
@ -550,10 +539,6 @@ static const struct stm32_adc_regspec stm32mp13_adc_regspec = {
|
||||
STM32H7_EXTSEL_SHIFT },
|
||||
.res = { STM32H7_ADC_CFGR, STM32MP13_RES_MASK, STM32MP13_RES_SHIFT },
|
||||
.difsel = { STM32MP13_ADC_DIFSEL, STM32MP13_DIFSEL_MASK},
|
||||
.calfact_s = { STM32MP13_ADC_CALFACT, STM32MP13_CALFACT_S_MASK,
|
||||
STM32MP13_CALFACT_S_SHIFT },
|
||||
.calfact_d = { STM32MP13_ADC_CALFACT, STM32MP13_CALFACT_D_MASK,
|
||||
STM32MP13_CALFACT_D_SHIFT },
|
||||
.smpr = { STM32H7_ADC_SMPR1, STM32H7_ADC_SMPR2 },
|
||||
.smp_bits = stm32h7_smp_bits,
|
||||
.or_vddcore = { STM32MP13_ADC2_OR, STM32MP13_OP0 },
|
||||
@ -575,10 +560,6 @@ static const struct stm32_adc_regspec stm32mp1_adc_regspec = {
|
||||
STM32H7_EXTSEL_SHIFT },
|
||||
.res = { STM32H7_ADC_CFGR, STM32H7_RES_MASK, STM32H7_RES_SHIFT },
|
||||
.difsel = { STM32H7_ADC_DIFSEL, STM32H7_DIFSEL_MASK},
|
||||
.calfact_s = { STM32H7_ADC_CALFACT, STM32H7_CALFACT_S_MASK,
|
||||
STM32H7_CALFACT_S_SHIFT },
|
||||
.calfact_d = { STM32H7_ADC_CALFACT, STM32H7_CALFACT_D_MASK,
|
||||
STM32H7_CALFACT_D_SHIFT },
|
||||
.smpr = { STM32H7_ADC_SMPR1, STM32H7_ADC_SMPR2 },
|
||||
.smp_bits = stm32h7_smp_bits,
|
||||
.or_vddcore = { STM32MP1_ADC2_OR, STM32MP1_VDDCOREEN },
|
||||
@ -1000,9 +981,6 @@ static int stm32h7_adc_read_selfcalib(struct iio_dev *indio_dev)
|
||||
int i, ret;
|
||||
u32 lincalrdyw_mask, val;
|
||||
|
||||
if (!adc->cfg->has_linearcal)
|
||||
goto skip_linearcal;
|
||||
|
||||
/* Read linearity calibration */
|
||||
lincalrdyw_mask = STM32H7_LINCALRDYW6;
|
||||
for (i = STM32H7_LINCALFACT_NUM - 1; i >= 0; i--) {
|
||||
@ -1024,15 +1002,7 @@ static int stm32h7_adc_read_selfcalib(struct iio_dev *indio_dev)
|
||||
|
||||
lincalrdyw_mask >>= 1;
|
||||
}
|
||||
|
||||
skip_linearcal:
|
||||
/* Read offset calibration */
|
||||
val = stm32_adc_readl(adc, adc->cfg->regs->calfact_s.reg);
|
||||
adc->cal.calfact_s = (val & adc->cfg->regs->calfact_s.mask);
|
||||
adc->cal.calfact_s >>= adc->cfg->regs->calfact_s.shift;
|
||||
adc->cal.calfact_d = (val & adc->cfg->regs->calfact_d.mask);
|
||||
adc->cal.calfact_d >>= adc->cfg->regs->calfact_d.shift;
|
||||
adc->cal.calibrated = true;
|
||||
adc->cal.lincal_saved = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1048,13 +1018,6 @@ static int stm32h7_adc_restore_selfcalib(struct iio_dev *indio_dev)
|
||||
int i, ret;
|
||||
u32 lincalrdyw_mask, val;
|
||||
|
||||
val = (adc->cal.calfact_s << adc->cfg->regs->calfact_s.shift) |
|
||||
(adc->cal.calfact_d << adc->cfg->regs->calfact_d.shift);
|
||||
stm32_adc_writel(adc, adc->cfg->regs->calfact_s.reg, val);
|
||||
|
||||
if (!adc->cfg->has_linearcal)
|
||||
return 0;
|
||||
|
||||
lincalrdyw_mask = STM32H7_LINCALRDYW6;
|
||||
for (i = STM32H7_LINCALFACT_NUM - 1; i >= 0; i--) {
|
||||
/*
|
||||
@ -1116,19 +1079,20 @@ static int stm32h7_adc_restore_selfcalib(struct iio_dev *indio_dev)
|
||||
/**
|
||||
* stm32h7_adc_selfcalib() - Procedure to calibrate ADC
|
||||
* @indio_dev: IIO device instance
|
||||
* @do_lincal: linear calibration request flag
|
||||
* Note: Must be called once ADC is out of power down.
|
||||
*
|
||||
* Run offset calibration unconditionally.
|
||||
* Run linear calibration if requested & supported.
|
||||
*/
|
||||
static int stm32h7_adc_selfcalib(struct iio_dev *indio_dev)
|
||||
static int stm32h7_adc_selfcalib(struct iio_dev *indio_dev, int do_lincal)
|
||||
{
|
||||
struct stm32_adc *adc = iio_priv(indio_dev);
|
||||
int ret;
|
||||
u32 msk = STM32H7_ADCALDIF;
|
||||
u32 val;
|
||||
|
||||
if (adc->cal.calibrated)
|
||||
return true;
|
||||
|
||||
if (adc->cfg->has_linearcal)
|
||||
if (adc->cfg->has_linearcal && do_lincal)
|
||||
msk |= STM32H7_ADCALLIN;
|
||||
/* ADC must be disabled for calibration */
|
||||
stm32h7_adc_disable(indio_dev);
|
||||
@ -1146,7 +1110,7 @@ static int stm32h7_adc_selfcalib(struct iio_dev *indio_dev)
|
||||
!(val & STM32H7_ADCAL), 100,
|
||||
STM32H7_ADC_CALIB_TIMEOUT_US);
|
||||
if (ret) {
|
||||
dev_err(&indio_dev->dev, "calibration failed\n");
|
||||
dev_err(&indio_dev->dev, "calibration (single-ended) error %d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1162,7 +1126,8 @@ static int stm32h7_adc_selfcalib(struct iio_dev *indio_dev)
|
||||
!(val & STM32H7_ADCAL), 100,
|
||||
STM32H7_ADC_CALIB_TIMEOUT_US);
|
||||
if (ret) {
|
||||
dev_err(&indio_dev->dev, "calibration failed\n");
|
||||
dev_err(&indio_dev->dev, "calibration (diff%s) error %d\n",
|
||||
(msk & STM32H7_ADCALLIN) ? "+linear" : "", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1172,6 +1137,33 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* stm32h7_adc_check_selfcalib() - Check linear calibration status
|
||||
* @indio_dev: IIO device instance
|
||||
*
|
||||
* Used to check if linear calibration has been done.
|
||||
* Return true if linear calibration factors are already saved in private data
|
||||
* or if a linear calibration has been done at boot stage.
|
||||
*/
|
||||
static int stm32h7_adc_check_selfcalib(struct iio_dev *indio_dev)
|
||||
{
|
||||
struct stm32_adc *adc = iio_priv(indio_dev);
|
||||
u32 val;
|
||||
|
||||
if (adc->cal.lincal_saved)
|
||||
return true;
|
||||
|
||||
/*
|
||||
* Check if linear calibration factors are available in ADC registers,
|
||||
* by checking that all LINCALRDYWx bits are set.
|
||||
*/
|
||||
val = stm32_adc_readl(adc, STM32H7_ADC_CR) & STM32H7_LINCALRDYW_MASK;
|
||||
if (val == STM32H7_LINCALRDYW_MASK)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* stm32h7_adc_prepare() - Leave power down mode to enable ADC.
|
||||
* @indio_dev: IIO device instance
|
||||
@ -1186,16 +1178,20 @@ out:
|
||||
static int stm32h7_adc_prepare(struct iio_dev *indio_dev)
|
||||
{
|
||||
struct stm32_adc *adc = iio_priv(indio_dev);
|
||||
int calib, ret;
|
||||
int lincal_done = false;
|
||||
int ret;
|
||||
|
||||
ret = stm32h7_adc_exit_pwr_down(indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = stm32h7_adc_selfcalib(indio_dev);
|
||||
if (adc->cfg->has_linearcal)
|
||||
lincal_done = stm32h7_adc_check_selfcalib(indio_dev);
|
||||
|
||||
/* Always run offset calibration. Run linear calibration only once */
|
||||
ret = stm32h7_adc_selfcalib(indio_dev, !lincal_done);
|
||||
if (ret < 0)
|
||||
goto pwr_dwn;
|
||||
calib = ret;
|
||||
|
||||
stm32_adc_int_ch_enable(indio_dev);
|
||||
|
||||
@ -1205,13 +1201,15 @@ static int stm32h7_adc_prepare(struct iio_dev *indio_dev)
|
||||
if (ret)
|
||||
goto ch_disable;
|
||||
|
||||
/* Either restore or read calibration result for future reference */
|
||||
if (calib)
|
||||
ret = stm32h7_adc_restore_selfcalib(indio_dev);
|
||||
else
|
||||
ret = stm32h7_adc_read_selfcalib(indio_dev);
|
||||
if (ret)
|
||||
goto disable;
|
||||
if (adc->cfg->has_linearcal) {
|
||||
if (!adc->cal.lincal_saved)
|
||||
ret = stm32h7_adc_read_selfcalib(indio_dev);
|
||||
else
|
||||
ret = stm32h7_adc_restore_selfcalib(indio_dev);
|
||||
|
||||
if (ret)
|
||||
goto disable;
|
||||
}
|
||||
|
||||
if (adc->cfg->has_presel)
|
||||
stm32_adc_writel(adc, STM32H7_ADC_PCSEL, adc->pcsel);
|
||||
@ -1882,6 +1880,23 @@ static const struct iio_chan_spec_ext_info stm32_adc_ext_info[] = {
|
||||
{},
|
||||
};
|
||||
|
||||
static void stm32_adc_debugfs_init(struct iio_dev *indio_dev)
|
||||
{
|
||||
struct stm32_adc *adc = iio_priv(indio_dev);
|
||||
struct dentry *d = iio_get_debugfs_dentry(indio_dev);
|
||||
struct stm32_adc_calib *cal = &adc->cal;
|
||||
char buf[16];
|
||||
unsigned int i;
|
||||
|
||||
if (!adc->cfg->has_linearcal)
|
||||
return;
|
||||
|
||||
for (i = 0; i < STM32H7_LINCALFACT_NUM; i++) {
|
||||
snprintf(buf, sizeof(buf), "lincalfact%d", i + 1);
|
||||
debugfs_create_u32(buf, 0444, d, &cal->lincalfact[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static int stm32_adc_fw_get_resolution(struct iio_dev *indio_dev)
|
||||
{
|
||||
struct device *dev = &indio_dev->dev;
|
||||
@ -2468,6 +2483,9 @@ static int stm32_adc_probe(struct platform_device *pdev)
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
pm_runtime_put_autosuspend(dev);
|
||||
|
||||
if (IS_ENABLED(CONFIG_DEBUG_FS))
|
||||
stm32_adc_debugfs_init(indio_dev);
|
||||
|
||||
return 0;
|
||||
|
||||
err_hw_stop:
|
||||
@ -2496,6 +2514,7 @@ static int stm32_adc_remove(struct platform_device *pdev)
|
||||
struct stm32_adc *adc = iio_priv(indio_dev);
|
||||
|
||||
pm_runtime_get_sync(&pdev->dev);
|
||||
/* iio_device_unregister() also removes debugfs entries */
|
||||
iio_device_unregister(indio_dev);
|
||||
stm32_adc_hw_stop(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
@ -152,9 +152,9 @@ static void adc081c_reg_disable(void *reg)
|
||||
regulator_disable(reg);
|
||||
}
|
||||
|
||||
static int adc081c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int adc081c_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct iio_dev *iio;
|
||||
struct adc081c *adc;
|
||||
const struct adcxx1c_model *model;
|
||||
@ -235,7 +235,7 @@ static struct i2c_driver adc081c_driver = {
|
||||
.of_match_table = adc081c_of_match,
|
||||
.acpi_match_table = adc081c_acpi_match,
|
||||
},
|
||||
.probe = adc081c_probe,
|
||||
.probe_new = adc081c_probe,
|
||||
.id_table = adc081c_id,
|
||||
};
|
||||
module_i2c_driver(adc081c_driver);
|
||||
|
@ -181,13 +181,13 @@ static int adc128_probe(struct spi_device *spi)
|
||||
}
|
||||
|
||||
static const struct of_device_id adc128_of_match[] = {
|
||||
{ .compatible = "ti,adc128s052", },
|
||||
{ .compatible = "ti,adc122s021", },
|
||||
{ .compatible = "ti,adc122s051", },
|
||||
{ .compatible = "ti,adc122s101", },
|
||||
{ .compatible = "ti,adc124s021", },
|
||||
{ .compatible = "ti,adc124s051", },
|
||||
{ .compatible = "ti,adc124s101", },
|
||||
{ .compatible = "ti,adc128s052", .data = (void*)0L, },
|
||||
{ .compatible = "ti,adc122s021", .data = (void*)1L, },
|
||||
{ .compatible = "ti,adc122s051", .data = (void*)1L, },
|
||||
{ .compatible = "ti,adc122s101", .data = (void*)1L, },
|
||||
{ .compatible = "ti,adc124s021", .data = (void*)2L, },
|
||||
{ .compatible = "ti,adc124s051", .data = (void*)2L, },
|
||||
{ .compatible = "ti,adc124s101", .data = (void*)2L, },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, adc128_of_match);
|
||||
|
@ -974,9 +974,9 @@ static int ads1015_set_conv_mode(struct ads1015_data *data, int mode)
|
||||
mode << ADS1015_CFG_MOD_SHIFT);
|
||||
}
|
||||
|
||||
static int ads1015_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int ads1015_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
const struct ads1015_chip_data *chip;
|
||||
struct iio_dev *indio_dev;
|
||||
struct ads1015_data *data;
|
||||
@ -1195,7 +1195,7 @@ static struct i2c_driver ads1015_driver = {
|
||||
.of_match_table = ads1015_of_match,
|
||||
.pm = &ads1015_pm_ops,
|
||||
},
|
||||
.probe = ads1015_probe,
|
||||
.probe_new = ads1015_probe,
|
||||
.remove = ads1015_remove,
|
||||
.id_table = ads1015_id,
|
||||
};
|
||||
|
@ -5,6 +5,20 @@
|
||||
|
||||
menu "Analog to digital and digital to analog converters"
|
||||
|
||||
config AD74115
|
||||
tristate "Analog Devices AD74115H driver"
|
||||
depends on GPIOLIB && SPI
|
||||
select CRC8
|
||||
select IIO_BUFFER
|
||||
select IIO_TRIGGERED_BUFFER
|
||||
select REGMAP_SPI
|
||||
help
|
||||
Say yes here to build support for Analog Devices AD74115H
|
||||
single-channel software configurable input/output solution.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called ad74115.
|
||||
|
||||
config AD74413R
|
||||
tristate "Analog Devices AD74412R/AD74413R driver"
|
||||
depends on GPIOLIB && SPI
|
||||
|
@ -4,5 +4,6 @@
|
||||
#
|
||||
|
||||
# When adding new entries keep the list in alphabetical order
|
||||
obj-$(CONFIG_AD74115) += ad74115.o
|
||||
obj-$(CONFIG_AD74413R) += ad74413r.o
|
||||
obj-$(CONFIG_STX104) += stx104.o
|
||||
|
1943
drivers/iio/addac/ad74115.c
Normal file
1943
drivers/iio/addac/ad74115.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -71,6 +71,7 @@ struct ad74413r_state {
|
||||
struct regmap *regmap;
|
||||
struct device *dev;
|
||||
struct iio_trigger *trig;
|
||||
struct gpio_desc *reset_gpio;
|
||||
|
||||
size_t adc_active_channels;
|
||||
struct spi_message adc_samples_msg;
|
||||
@ -393,6 +394,13 @@ static int ad74413r_reset(struct ad74413r_state *st)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (st->reset_gpio) {
|
||||
gpiod_set_value_cansleep(st->reset_gpio, 1);
|
||||
fsleep(50);
|
||||
gpiod_set_value_cansleep(st->reset_gpio, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = regmap_write(st->regmap, AD74413R_REG_CMD_KEY,
|
||||
AD74413R_CMD_KEY_RESET1);
|
||||
if (ret)
|
||||
@ -691,7 +699,7 @@ static int ad74413_get_input_current_offset(struct ad74413r_state *st,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
*val = voltage_offset * AD74413R_ADC_RESULT_MAX / voltage_range;
|
||||
*val = voltage_offset * (int)AD74413R_ADC_RESULT_MAX / voltage_range;
|
||||
|
||||
return IIO_VAL_INT;
|
||||
}
|
||||
@ -1305,6 +1313,16 @@ static int ad74413r_probe(struct spi_device *spi)
|
||||
st->spi = spi;
|
||||
st->dev = &spi->dev;
|
||||
st->chip_info = device_get_match_data(&spi->dev);
|
||||
if (!st->chip_info) {
|
||||
const struct spi_device_id *id = spi_get_device_id(spi);
|
||||
|
||||
if (id)
|
||||
st->chip_info =
|
||||
(struct ad74413r_chip_info *)id->driver_data;
|
||||
if (!st->chip_info)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_init(&st->lock);
|
||||
init_completion(&st->adc_data_completion);
|
||||
|
||||
@ -1313,6 +1331,10 @@ static int ad74413r_probe(struct spi_device *spi)
|
||||
if (IS_ERR(st->regmap))
|
||||
return PTR_ERR(st->regmap);
|
||||
|
||||
st->reset_gpio = devm_gpiod_get_optional(st->dev, "reset", GPIOD_OUT_LOW);
|
||||
if (IS_ERR(st->reset_gpio))
|
||||
return PTR_ERR(st->reset_gpio);
|
||||
|
||||
st->refin_reg = devm_regulator_get(st->dev, "refin");
|
||||
if (IS_ERR(st->refin_reg))
|
||||
return dev_err_probe(st->dev, PTR_ERR(st->refin_reg),
|
||||
@ -1457,12 +1479,20 @@ static const struct of_device_id ad74413r_dt_id[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, ad74413r_dt_id);
|
||||
|
||||
static const struct spi_device_id ad74413r_spi_id[] = {
|
||||
{ .name = "ad74412r", .driver_data = (kernel_ulong_t)&ad74412r_chip_info_data },
|
||||
{ .name = "ad74413r", .driver_data = (kernel_ulong_t)&ad74413r_chip_info_data },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(spi, ad74413r_spi_id);
|
||||
|
||||
static struct spi_driver ad74413r_driver = {
|
||||
.driver = {
|
||||
.name = "ad74413r",
|
||||
.of_match_table = ad74413r_dt_id,
|
||||
},
|
||||
.probe = ad74413r_probe,
|
||||
.id_table = ad74413r_spi_id,
|
||||
};
|
||||
|
||||
module_driver(ad74413r_driver,
|
||||
|
@ -536,9 +536,9 @@ static const struct iio_info ad7150_info_no_irq = {
|
||||
.read_raw = &ad7150_read_raw,
|
||||
};
|
||||
|
||||
static int ad7150_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int ad7150_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct ad7150_chip_info *chip;
|
||||
struct iio_dev *indio_dev;
|
||||
int ret;
|
||||
@ -647,7 +647,7 @@ static struct i2c_driver ad7150_driver = {
|
||||
.name = "ad7150",
|
||||
.of_match_table = ad7150_of_match,
|
||||
},
|
||||
.probe = ad7150_probe,
|
||||
.probe_new = ad7150_probe,
|
||||
.id_table = ad7150_id,
|
||||
};
|
||||
module_i2c_driver(ad7150_driver);
|
||||
|
@ -717,9 +717,9 @@ static const struct iio_info ad7746_info = {
|
||||
.write_raw = ad7746_write_raw,
|
||||
};
|
||||
|
||||
static int ad7746_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int ad7746_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct device *dev = &client->dev;
|
||||
struct ad7746_chip_info *chip;
|
||||
struct iio_dev *indio_dev;
|
||||
@ -810,7 +810,7 @@ static struct i2c_driver ad7746_driver = {
|
||||
.name = KBUILD_MODNAME,
|
||||
.of_match_table = ad7746_of_match,
|
||||
},
|
||||
.probe = ad7746_probe,
|
||||
.probe_new = ad7746_probe,
|
||||
.id_table = ad7746_id,
|
||||
};
|
||||
module_i2c_driver(ad7746_driver);
|
||||
|
@ -135,8 +135,7 @@ static const struct iio_info ams_iaqcore_info = {
|
||||
.read_raw = ams_iaqcore_read_raw,
|
||||
};
|
||||
|
||||
static int ams_iaqcore_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int ams_iaqcore_probe(struct i2c_client *client)
|
||||
{
|
||||
struct iio_dev *indio_dev;
|
||||
struct ams_iaqcore_data *data;
|
||||
@ -180,7 +179,7 @@ static struct i2c_driver ams_iaqcore_driver = {
|
||||
.name = "ams-iaq-core",
|
||||
.of_match_table = ams_iaqcore_dt_ids,
|
||||
},
|
||||
.probe = ams_iaqcore_probe,
|
||||
.probe_new = ams_iaqcore_probe,
|
||||
.id_table = ams_iaqcore_id,
|
||||
};
|
||||
module_i2c_driver(ams_iaqcore_driver);
|
||||
|
@ -201,9 +201,9 @@ static const struct of_device_id atlas_ezo_dt_ids[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, atlas_ezo_dt_ids);
|
||||
|
||||
static int atlas_ezo_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int atlas_ezo_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
const struct atlas_ezo_device *chip;
|
||||
struct atlas_ezo_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
@ -238,7 +238,7 @@ static struct i2c_driver atlas_ezo_driver = {
|
||||
.name = ATLAS_EZO_DRV_NAME,
|
||||
.of_match_table = atlas_ezo_dt_ids,
|
||||
},
|
||||
.probe = atlas_ezo_probe,
|
||||
.probe_new = atlas_ezo_probe,
|
||||
.id_table = atlas_ezo_id,
|
||||
};
|
||||
module_i2c_driver(atlas_ezo_driver);
|
||||
|
@ -608,9 +608,9 @@ static const struct of_device_id atlas_dt_ids[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, atlas_dt_ids);
|
||||
|
||||
static int atlas_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int atlas_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct atlas_data *data;
|
||||
struct atlas_device *chip;
|
||||
struct iio_trigger *trig;
|
||||
@ -767,7 +767,7 @@ static struct i2c_driver atlas_driver = {
|
||||
.of_match_table = atlas_dt_ids,
|
||||
.pm = pm_ptr(&atlas_pm_ops),
|
||||
},
|
||||
.probe = atlas_probe,
|
||||
.probe_new = atlas_probe,
|
||||
.remove = atlas_remove,
|
||||
.id_table = atlas_id,
|
||||
};
|
||||
|
@ -17,9 +17,9 @@
|
||||
|
||||
#include "bme680.h"
|
||||
|
||||
static int bme680_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int bme680_i2c_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct regmap *regmap;
|
||||
const char *name = NULL;
|
||||
|
||||
@ -52,7 +52,7 @@ static struct i2c_driver bme680_i2c_driver = {
|
||||
.name = "bme680_i2c",
|
||||
.of_match_table = bme680_of_i2c_match,
|
||||
},
|
||||
.probe = bme680_i2c_probe,
|
||||
.probe_new = bme680_i2c_probe,
|
||||
.id_table = bme680_i2c_id,
|
||||
};
|
||||
module_i2c_driver(bme680_i2c_driver);
|
||||
|
@ -401,9 +401,9 @@ static int ccs811_reset(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ccs811_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int ccs811_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct iio_dev *indio_dev;
|
||||
struct ccs811_data *data;
|
||||
int ret;
|
||||
@ -567,7 +567,7 @@ static struct i2c_driver ccs811_driver = {
|
||||
.name = "ccs811",
|
||||
.of_match_table = ccs811_dt_ids,
|
||||
},
|
||||
.probe = ccs811_probe,
|
||||
.probe_new = ccs811_probe,
|
||||
.remove = ccs811_remove,
|
||||
.id_table = ccs811_id,
|
||||
};
|
||||
|
@ -615,7 +615,7 @@ out:
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int scd4x_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||
static int scd4x_probe(struct i2c_client *client)
|
||||
{
|
||||
static const unsigned long scd4x_scan_masks[] = { 0x07, 0x00 };
|
||||
struct device *dev = &client->dev;
|
||||
@ -690,7 +690,7 @@ static struct i2c_driver scd4x_i2c_driver = {
|
||||
.of_match_table = scd4x_dt_ids,
|
||||
.pm = pm_sleep_ptr(&scd4x_pm_ops),
|
||||
},
|
||||
.probe = scd4x_probe,
|
||||
.probe_new = scd4x_probe,
|
||||
};
|
||||
module_i2c_driver(scd4x_i2c_driver);
|
||||
|
||||
|
@ -496,9 +496,9 @@ static const struct of_device_id sgp_dt_ids[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
static int sgp_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int sgp_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct device *dev = &client->dev;
|
||||
struct iio_dev *indio_dev;
|
||||
struct sgp_data *data;
|
||||
@ -575,7 +575,7 @@ static struct i2c_driver sgp_driver = {
|
||||
.name = "sgp30",
|
||||
.of_match_table = sgp_dt_ids,
|
||||
},
|
||||
.probe = sgp_probe,
|
||||
.probe_new = sgp_probe,
|
||||
.remove = sgp_remove,
|
||||
.id_table = sgp_id,
|
||||
};
|
||||
|
@ -311,9 +311,9 @@ static const struct iio_info sgp40_info = {
|
||||
.write_raw = sgp40_write_raw,
|
||||
};
|
||||
|
||||
static int sgp40_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int sgp40_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct device *dev = &client->dev;
|
||||
struct iio_dev *indio_dev;
|
||||
struct sgp40_data *data;
|
||||
@ -368,7 +368,7 @@ static struct i2c_driver sgp40_driver = {
|
||||
.name = "sgp40",
|
||||
.of_match_table = sgp40_dt_ids,
|
||||
},
|
||||
.probe = sgp40_probe,
|
||||
.probe_new = sgp40_probe,
|
||||
.id_table = sgp40_id,
|
||||
};
|
||||
module_i2c_driver(sgp40_driver);
|
||||
|
@ -348,9 +348,9 @@ static const struct of_device_id vz89x_dt_ids[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, vz89x_dt_ids);
|
||||
|
||||
static int vz89x_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int vz89x_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct device *dev = &client->dev;
|
||||
struct iio_dev *indio_dev;
|
||||
struct vz89x_data *data;
|
||||
@ -402,7 +402,7 @@ static struct i2c_driver vz89x_driver = {
|
||||
.name = "vz89x",
|
||||
.of_match_table = vz89x_dt_ids,
|
||||
},
|
||||
.probe = vz89x_probe,
|
||||
.probe_new = vz89x_probe,
|
||||
.id_table = vz89x_id,
|
||||
};
|
||||
module_i2c_driver(vz89x_driver);
|
||||
|
@ -993,9 +993,9 @@ static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ad5064_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
static int ad5064_i2c_probe(struct i2c_client *i2c)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
|
||||
return ad5064_probe(&i2c->dev, id->driver_data, id->name,
|
||||
ad5064_i2c_write);
|
||||
}
|
||||
@ -1056,7 +1056,7 @@ static struct i2c_driver ad5064_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "ad5064",
|
||||
},
|
||||
.probe = ad5064_i2c_probe,
|
||||
.probe_new = ad5064_i2c_probe,
|
||||
.id_table = ad5064_i2c_ids,
|
||||
};
|
||||
|
||||
|
@ -546,9 +546,9 @@ static inline void ad5380_spi_unregister_driver(void)
|
||||
|
||||
#if IS_ENABLED(CONFIG_I2C)
|
||||
|
||||
static int ad5380_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
static int ad5380_i2c_probe(struct i2c_client *i2c)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
|
||||
struct regmap *regmap;
|
||||
|
||||
regmap = devm_regmap_init_i2c(i2c, &ad5380_regmap_config);
|
||||
@ -589,7 +589,7 @@ static struct i2c_driver ad5380_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "ad5380",
|
||||
},
|
||||
.probe = ad5380_i2c_probe,
|
||||
.probe_new = ad5380_i2c_probe,
|
||||
.remove = ad5380_i2c_remove,
|
||||
.id_table = ad5380_i2c_ids,
|
||||
};
|
||||
|
@ -568,9 +568,9 @@ static const struct ad5446_chip_info ad5446_i2c_chip_info[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static int ad5446_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
static int ad5446_i2c_probe(struct i2c_client *i2c)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
|
||||
return ad5446_probe(&i2c->dev, id->name,
|
||||
&ad5446_i2c_chip_info[id->driver_data]);
|
||||
}
|
||||
@ -595,7 +595,7 @@ static struct i2c_driver ad5446_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "ad5446",
|
||||
},
|
||||
.probe = ad5446_i2c_probe,
|
||||
.probe_new = ad5446_i2c_probe,
|
||||
.remove = ad5446_i2c_remove,
|
||||
.id_table = ad5446_i2c_ids,
|
||||
};
|
||||
|
@ -99,9 +99,9 @@ static const struct ad5592r_rw_ops ad5593r_rw_ops = {
|
||||
.gpio_read = ad5593r_gpio_read,
|
||||
};
|
||||
|
||||
static int ad5593r_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
static int ad5593r_i2c_probe(struct i2c_client *i2c)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
|
||||
if (!i2c_check_functionality(i2c->adapter,
|
||||
I2C_FUNC_SMBUS_BYTE | I2C_FUNC_I2C))
|
||||
return -EOPNOTSUPP;
|
||||
@ -138,7 +138,7 @@ static struct i2c_driver ad5593r_driver = {
|
||||
.of_match_table = ad5593r_of_match,
|
||||
.acpi_match_table = ad5593r_acpi_match,
|
||||
},
|
||||
.probe = ad5593r_i2c_probe,
|
||||
.probe_new = ad5593r_i2c_probe,
|
||||
.remove = ad5593r_i2c_remove,
|
||||
.id_table = ad5593r_i2c_ids,
|
||||
};
|
||||
|
@ -58,9 +58,9 @@ static int ad5686_i2c_write(struct ad5686_state *st,
|
||||
return (ret != 3) ? -EIO : 0;
|
||||
}
|
||||
|
||||
static int ad5686_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
static int ad5686_i2c_probe(struct i2c_client *i2c)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
|
||||
return ad5686_probe(&i2c->dev, id->driver_data, id->name,
|
||||
ad5686_i2c_write, ad5686_i2c_read);
|
||||
}
|
||||
@ -113,7 +113,7 @@ static struct i2c_driver ad5686_i2c_driver = {
|
||||
.name = "ad5696",
|
||||
.of_match_table = ad5686_of_match,
|
||||
},
|
||||
.probe = ad5686_i2c_probe,
|
||||
.probe_new = ad5686_i2c_probe,
|
||||
.remove = ad5686_i2c_remove,
|
||||
.id_table = ad5686_i2c_id,
|
||||
};
|
||||
|
@ -213,9 +213,9 @@ static const struct iio_info ds4424_info = {
|
||||
.write_raw = ds4424_write_raw,
|
||||
};
|
||||
|
||||
static int ds4424_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int ds4424_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct ds4424_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
int ret;
|
||||
@ -312,7 +312,7 @@ static struct i2c_driver ds4424_driver = {
|
||||
.of_match_table = ds4424_of_match,
|
||||
.pm = pm_sleep_ptr(&ds4424_pm_ops),
|
||||
},
|
||||
.probe = ds4424_probe,
|
||||
.probe_new = ds4424_probe,
|
||||
.remove = ds4424_remove,
|
||||
.id_table = ds4424_id,
|
||||
};
|
||||
|
@ -176,8 +176,7 @@ static const struct iio_chan_spec m62332_channels[M62332_CHANNELS] = {
|
||||
M62332_CHANNEL(1)
|
||||
};
|
||||
|
||||
static int m62332_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int m62332_probe(struct i2c_client *client)
|
||||
{
|
||||
struct m62332_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
@ -239,7 +238,7 @@ static struct i2c_driver m62332_driver = {
|
||||
.name = "m62332",
|
||||
.pm = pm_sleep_ptr(&m62332_pm_ops),
|
||||
},
|
||||
.probe = m62332_probe,
|
||||
.probe_new = m62332_probe,
|
||||
.remove = m62332_remove,
|
||||
.id_table = m62332_id,
|
||||
};
|
||||
|
@ -141,9 +141,9 @@ static const struct iio_chan_spec max517_channels[] = {
|
||||
MAX517_CHANNEL(7),
|
||||
};
|
||||
|
||||
static int max517_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int max517_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct max517_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
struct max517_platform_data *platform_data = client->dev.platform_data;
|
||||
@ -203,7 +203,7 @@ static struct i2c_driver max517_driver = {
|
||||
.name = MAX517_DRV_NAME,
|
||||
.pm = pm_sleep_ptr(&max517_pm_ops),
|
||||
},
|
||||
.probe = max517_probe,
|
||||
.probe_new = max517_probe,
|
||||
.id_table = max517_id,
|
||||
};
|
||||
module_i2c_driver(max517_driver);
|
||||
|
@ -300,9 +300,9 @@ static void max5821_regulator_disable(void *reg)
|
||||
regulator_disable(reg);
|
||||
}
|
||||
|
||||
static int max5821_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int max5821_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct max5821_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
u32 tmp;
|
||||
@ -377,7 +377,7 @@ static struct i2c_driver max5821_driver = {
|
||||
.of_match_table = max5821_of_match,
|
||||
.pm = pm_sleep_ptr(&max5821_pm_ops),
|
||||
},
|
||||
.probe = max5821_probe,
|
||||
.probe_new = max5821_probe,
|
||||
.id_table = max5821_id,
|
||||
};
|
||||
module_i2c_driver(max5821_driver);
|
||||
|
@ -369,9 +369,9 @@ static int mcp4725_probe_dt(struct device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mcp4725_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int mcp4725_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct mcp4725_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
struct mcp4725_platform_data *pdata, pdata_dt;
|
||||
@ -524,7 +524,7 @@ static struct i2c_driver mcp4725_driver = {
|
||||
.of_match_table = mcp4725_of_match,
|
||||
.pm = pm_sleep_ptr(&mcp4725_pm_ops),
|
||||
},
|
||||
.probe = mcp4725_probe,
|
||||
.probe_new = mcp4725_probe,
|
||||
.remove = mcp4725_remove,
|
||||
.id_table = mcp4725_id,
|
||||
};
|
||||
|
@ -306,9 +306,9 @@ static const struct iio_info dac5571_info = {
|
||||
.write_raw_get_fmt = dac5571_write_raw_get_fmt,
|
||||
};
|
||||
|
||||
static int dac5571_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int dac5571_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct device *dev = &client->dev;
|
||||
const struct dac5571_spec *spec;
|
||||
struct dac5571_data *data;
|
||||
@ -426,7 +426,7 @@ static struct i2c_driver dac5571_driver = {
|
||||
.name = "ti-dac5571",
|
||||
.of_match_table = dac5571_of_id,
|
||||
},
|
||||
.probe = dac5571_probe,
|
||||
.probe_new = dac5571_probe,
|
||||
.remove = dac5571_remove,
|
||||
.id_table = dac5571_id,
|
||||
};
|
||||
|
@ -50,6 +50,16 @@ config ADF4371
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called adf4371.
|
||||
|
||||
config ADF4377
|
||||
tristate "Analog Devices ADF4377 Microwave Wideband Synthesizer"
|
||||
depends on SPI && COMMON_CLK
|
||||
help
|
||||
Say yes here to build support for Analog Devices ADF4377 Microwave
|
||||
Wideband Synthesizer.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called adf4377.
|
||||
|
||||
config ADMV1013
|
||||
tristate "Analog Devices ADMV1013 Microwave Upconverter"
|
||||
depends on SPI && COMMON_CLK
|
||||
|
@ -7,6 +7,7 @@
|
||||
obj-$(CONFIG_AD9523) += ad9523.o
|
||||
obj-$(CONFIG_ADF4350) += adf4350.o
|
||||
obj-$(CONFIG_ADF4371) += adf4371.o
|
||||
obj-$(CONFIG_ADF4377) += adf4377.o
|
||||
obj-$(CONFIG_ADMV1013) += admv1013.o
|
||||
obj-$(CONFIG_ADMV1014) += admv1014.o
|
||||
obj-$(CONFIG_ADMV4420) += admv4420.o
|
||||
|
994
drivers/iio/frequency/adf4377.c
Normal file
994
drivers/iio/frequency/adf4377.c
Normal file
@ -0,0 +1,994 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* ADF4377 driver
|
||||
*
|
||||
* Copyright 2022 Analog Devices Inc.
|
||||
*/
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/bits.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clkdev.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/iio/iio.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/units.h>
|
||||
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
/* ADF4377 REG0000 Map */
|
||||
#define ADF4377_0000_SOFT_RESET_R_MSK BIT(7)
|
||||
#define ADF4377_0000_LSB_FIRST_R_MSK BIT(6)
|
||||
#define ADF4377_0000_ADDRESS_ASC_R_MSK BIT(5)
|
||||
#define ADF4377_0000_SDO_ACTIVE_R_MSK BIT(4)
|
||||
#define ADF4377_0000_SDO_ACTIVE_MSK BIT(3)
|
||||
#define ADF4377_0000_ADDRESS_ASC_MSK BIT(2)
|
||||
#define ADF4377_0000_LSB_FIRST_MSK BIT(1)
|
||||
#define ADF4377_0000_SOFT_RESET_MSK BIT(0)
|
||||
|
||||
/* ADF4377 REG0000 Bit Definition */
|
||||
#define ADF4377_0000_SDO_ACTIVE_SPI_3W 0x0
|
||||
#define ADF4377_0000_SDO_ACTIVE_SPI_4W 0x1
|
||||
|
||||
#define ADF4377_0000_ADDR_ASC_AUTO_DECR 0x0
|
||||
#define ADF4377_0000_ADDR_ASC_AUTO_INCR 0x1
|
||||
|
||||
#define ADF4377_0000_LSB_FIRST_MSB 0x0
|
||||
#define ADF4377_0000_LSB_FIRST_LSB 0x1
|
||||
|
||||
#define ADF4377_0000_SOFT_RESET_N_OP 0x0
|
||||
#define ADF4377_0000_SOFT_RESET_EN 0x1
|
||||
|
||||
/* ADF4377 REG0001 Map */
|
||||
#define ADF4377_0001_SINGLE_INSTR_MSK BIT(7)
|
||||
#define ADF4377_0001_MASTER_RB_CTRL_MSK BIT(5)
|
||||
|
||||
/* ADF4377 REG0003 Bit Definition */
|
||||
#define ADF4377_0003_CHIP_TYPE 0x06
|
||||
|
||||
/* ADF4377 REG0004 Bit Definition */
|
||||
#define ADF4377_0004_PRODUCT_ID_LSB 0x0005
|
||||
|
||||
/* ADF4377 REG0005 Bit Definition */
|
||||
#define ADF4377_0005_PRODUCT_ID_MSB 0x0005
|
||||
|
||||
/* ADF4377 REG000A Map */
|
||||
#define ADF4377_000A_SCRATCHPAD_MSK GENMASK(7, 0)
|
||||
|
||||
/* ADF4377 REG000C Bit Definition */
|
||||
#define ADF4377_000C_VENDOR_ID_LSB 0x56
|
||||
|
||||
/* ADF4377 REG000D Bit Definition */
|
||||
#define ADF4377_000D_VENDOR_ID_MSB 0x04
|
||||
|
||||
/* ADF4377 REG000F Bit Definition */
|
||||
#define ADF4377_000F_R00F_RSV1_MSK GENMASK(7, 0)
|
||||
|
||||
/* ADF4377 REG0010 Map*/
|
||||
#define ADF4377_0010_N_INT_LSB_MSK GENMASK(7, 0)
|
||||
|
||||
/* ADF4377 REG0011 Map*/
|
||||
#define ADF4377_0011_EN_AUTOCAL_MSK BIT(7)
|
||||
#define ADF4377_0011_EN_RDBLR_MSK BIT(6)
|
||||
#define ADF4377_0011_DCLK_DIV2_MSK GENMASK(5, 4)
|
||||
#define ADF4377_0011_N_INT_MSB_MSK GENMASK(3, 0)
|
||||
|
||||
/* ADF4377 REG0011 Bit Definition */
|
||||
#define ADF4377_0011_DCLK_DIV2_1 0x0
|
||||
#define ADF4377_0011_DCLK_DIV2_2 0x1
|
||||
#define ADF4377_0011_DCLK_DIV2_4 0x2
|
||||
#define ADF4377_0011_DCLK_DIV2_8 0x3
|
||||
|
||||
/* ADF4377 REG0012 Map*/
|
||||
#define ADF4377_0012_CLKOUT_DIV_MSK GENMASK(7, 6)
|
||||
#define ADF4377_0012_R_DIV_MSK GENMASK(5, 0)
|
||||
|
||||
/* ADF4377 REG0012 Bit Definition */
|
||||
#define ADF4377_0012_CLKOUT_DIV_1 0x0
|
||||
#define ADF4377_0012_CLKOUT_DIV_2 0x1
|
||||
#define ADF4377_0012_CLKOUT_DIV_4 0x2
|
||||
#define ADF4377_0012_CLKOUT_DIV_8 0x3
|
||||
|
||||
/* ADF4377 REG0013 Map */
|
||||
#define ADF4377_0013_M_VCO_CORE_MSK GENMASK(5, 4)
|
||||
#define ADF4377_0013_VCO_BIAS_MSK GENMASK(3, 0)
|
||||
|
||||
/* ADF4377 REG0013 Bit Definition */
|
||||
#define ADF4377_0013_M_VCO_0 0x0
|
||||
#define ADF4377_0013_M_VCO_1 0x1
|
||||
#define ADF4377_0013_M_VCO_2 0x2
|
||||
#define ADF4377_0013_M_VCO_3 0x3
|
||||
|
||||
/* ADF4377 REG0014 Map */
|
||||
#define ADF4377_0014_M_VCO_BAND_MSK GENMASK(7, 0)
|
||||
|
||||
/* ADF4377 REG0015 Map */
|
||||
#define ADF4377_0015_BLEED_I_LSB_MSK GENMASK(7, 6)
|
||||
#define ADF4377_0015_BLEED_POL_MSK BIT(5)
|
||||
#define ADF4377_0015_EN_BLEED_MSK BIT(4)
|
||||
#define ADF4377_0015_CP_I_MSK GENMASK(3, 0)
|
||||
|
||||
/* ADF4377 REG0015 Bit Definition */
|
||||
#define ADF4377_CURRENT_SINK 0x0
|
||||
#define ADF4377_CURRENT_SOURCE 0x1
|
||||
|
||||
#define ADF4377_0015_CP_0MA7 0x0
|
||||
#define ADF4377_0015_CP_0MA9 0x1
|
||||
#define ADF4377_0015_CP_1MA1 0x2
|
||||
#define ADF4377_0015_CP_1MA3 0x3
|
||||
#define ADF4377_0015_CP_1MA4 0x4
|
||||
#define ADF4377_0015_CP_1MA8 0x5
|
||||
#define ADF4377_0015_CP_2MA2 0x6
|
||||
#define ADF4377_0015_CP_2MA5 0x7
|
||||
#define ADF4377_0015_CP_2MA9 0x8
|
||||
#define ADF4377_0015_CP_3MA6 0x9
|
||||
#define ADF4377_0015_CP_4MA3 0xA
|
||||
#define ADF4377_0015_CP_5MA0 0xB
|
||||
#define ADF4377_0015_CP_5MA7 0xC
|
||||
#define ADF4377_0015_CP_7MA2 0xD
|
||||
#define ADF4377_0015_CP_8MA6 0xE
|
||||
#define ADF4377_0015_CP_10MA1 0xF
|
||||
|
||||
/* ADF4377 REG0016 Map */
|
||||
#define ADF4377_0016_BLEED_I_MSB_MSK GENMASK(7, 0)
|
||||
|
||||
/* ADF4377 REG0017 Map */
|
||||
#define ADF4377_0016_INV_CLKOUT_MSK BIT(7)
|
||||
#define ADF4377_0016_N_DEL_MSK GENMASK(6, 0)
|
||||
|
||||
/* ADF4377 REG0018 Map */
|
||||
#define ADF4377_0018_CMOS_OV_MSK BIT(7)
|
||||
#define ADF4377_0018_R_DEL_MSK GENMASK(6, 0)
|
||||
|
||||
/* ADF4377 REG0018 Bit Definition */
|
||||
#define ADF4377_0018_1V8_LOGIC 0x0
|
||||
#define ADF4377_0018_3V3_LOGIC 0x1
|
||||
|
||||
/* ADF4377 REG0019 Map */
|
||||
#define ADF4377_0019_CLKOUT2_OP_MSK GENMASK(7, 6)
|
||||
#define ADF4377_0019_CLKOUT1_OP_MSK GENMASK(5, 4)
|
||||
#define ADF4377_0019_PD_CLK_MSK BIT(3)
|
||||
#define ADF4377_0019_PD_RDET_MSK BIT(2)
|
||||
#define ADF4377_0019_PD_ADC_MSK BIT(1)
|
||||
#define ADF4377_0019_PD_CALADC_MSK BIT(0)
|
||||
|
||||
/* ADF4377 REG0019 Bit Definition */
|
||||
#define ADF4377_0019_CLKOUT_320MV 0x0
|
||||
#define ADF4377_0019_CLKOUT_420MV 0x1
|
||||
#define ADF4377_0019_CLKOUT_530MV 0x2
|
||||
#define ADF4377_0019_CLKOUT_640MV 0x3
|
||||
|
||||
/* ADF4377 REG001A Map */
|
||||
#define ADF4377_001A_PD_ALL_MSK BIT(7)
|
||||
#define ADF4377_001A_PD_RDIV_MSK BIT(6)
|
||||
#define ADF4377_001A_PD_NDIV_MSK BIT(5)
|
||||
#define ADF4377_001A_PD_VCO_MSK BIT(4)
|
||||
#define ADF4377_001A_PD_LD_MSK BIT(3)
|
||||
#define ADF4377_001A_PD_PFDCP_MSK BIT(2)
|
||||
#define ADF4377_001A_PD_CLKOUT1_MSK BIT(1)
|
||||
#define ADF4377_001A_PD_CLKOUT2_MSK BIT(0)
|
||||
|
||||
/* ADF4377 REG001B Map */
|
||||
#define ADF4377_001B_EN_LOL_MSK BIT(7)
|
||||
#define ADF4377_001B_LDWIN_PW_MSK BIT(6)
|
||||
#define ADF4377_001B_EN_LDWIN_MSK BIT(5)
|
||||
#define ADF4377_001B_LD_COUNT_MSK GENMASK(4, 0)
|
||||
|
||||
/* ADF4377 REG001B Bit Definition */
|
||||
#define ADF4377_001B_LDWIN_PW_NARROW 0x0
|
||||
#define ADF4377_001B_LDWIN_PW_WIDE 0x1
|
||||
|
||||
/* ADF4377 REG001C Map */
|
||||
#define ADF4377_001C_EN_DNCLK_MSK BIT(7)
|
||||
#define ADF4377_001C_EN_DRCLK_MSK BIT(6)
|
||||
#define ADF4377_001C_RST_LD_MSK BIT(2)
|
||||
#define ADF4377_001C_R01C_RSV1_MSK BIT(0)
|
||||
|
||||
/* ADF4377 REG001C Bit Definition */
|
||||
#define ADF4377_001C_RST_LD_INACTIVE 0x0
|
||||
#define ADF4377_001C_RST_LD_ACTIVE 0x1
|
||||
|
||||
#define ADF4377_001C_R01C_RSV1 0x1
|
||||
|
||||
/* ADF4377 REG001D Map */
|
||||
#define ADF4377_001D_MUXOUT_MSK GENMASK(7, 4)
|
||||
#define ADF4377_001D_EN_CPTEST_MSK BIT(2)
|
||||
#define ADF4377_001D_CP_DOWN_MSK BIT(1)
|
||||
#define ADF4377_001D_CP_UP_MSK BIT(0)
|
||||
|
||||
#define ADF4377_001D_EN_CPTEST_OFF 0x0
|
||||
#define ADF4377_001D_EN_CPTEST_ON 0x1
|
||||
|
||||
#define ADF4377_001D_CP_DOWN_OFF 0x0
|
||||
#define ADF4377_001D_CP_DOWN_ON 0x1
|
||||
|
||||
#define ADF4377_001D_CP_UP_OFF 0x0
|
||||
#define ADF4377_001D_CP_UP_ON 0x1
|
||||
|
||||
/* ADF4377 REG001F Map */
|
||||
#define ADF4377_001F_BST_REF_MSK BIT(7)
|
||||
#define ADF4377_001F_FILT_REF_MSK BIT(6)
|
||||
#define ADF4377_001F_REF_SEL_MSK BIT(5)
|
||||
#define ADF4377_001F_R01F_RSV1_MSK GENMASK(4, 0)
|
||||
|
||||
/* ADF4377 REG001F Bit Definition */
|
||||
#define ADF4377_001F_BST_LARGE_REF_IN 0x0
|
||||
#define ADF4377_001F_BST_SMALL_REF_IN 0x1
|
||||
|
||||
#define ADF4377_001F_FILT_REF_OFF 0x0
|
||||
#define ADF4377_001F_FILT_REF_ON 0x1
|
||||
|
||||
#define ADF4377_001F_REF_SEL_DMA 0x0
|
||||
#define ADF4377_001F_REF_SEL_LNA 0x1
|
||||
|
||||
#define ADF4377_001F_R01F_RSV1 0x7
|
||||
|
||||
/* ADF4377 REG0020 Map */
|
||||
#define ADF4377_0020_RST_SYS_MSK BIT(4)
|
||||
#define ADF4377_0020_EN_ADC_CLK_MSK BIT(3)
|
||||
#define ADF4377_0020_R020_RSV1_MSK BIT(0)
|
||||
|
||||
/* ADF4377 REG0021 Bit Definition */
|
||||
#define ADF4377_0021_R021_RSV1 0xD3
|
||||
|
||||
/* ADF4377 REG0022 Bit Definition */
|
||||
#define ADF4377_0022_R022_RSV1 0x32
|
||||
|
||||
/* ADF4377 REG0023 Map */
|
||||
#define ADF4377_0023_CAT_CT_SEL BIT(7)
|
||||
#define ADF4377_0023_R023_RSV1_MSK GENMASK(6, 0)
|
||||
|
||||
/* ADF4377 REG0023 Bit Definition */
|
||||
#define ADF4377_0023_R023_RSV1 0x18
|
||||
|
||||
/* ADF4377 REG0024 Map */
|
||||
#define ADF4377_0024_DCLK_MODE_MSK BIT(2)
|
||||
|
||||
/* ADF4377 REG0025 Map */
|
||||
#define ADF4377_0025_CLKODIV_DB_MSK BIT(7)
|
||||
#define ADF4377_0025_DCLK_DB_MSK BIT(6)
|
||||
#define ADF4377_0025_R025_RSV1_MSK GENMASK(5, 0)
|
||||
|
||||
/* ADF4377 REG0025 Bit Definition */
|
||||
#define ADF4377_0025_R025_RSV1 0x16
|
||||
|
||||
/* ADF4377 REG0026 Map */
|
||||
#define ADF4377_0026_VCO_BAND_DIV_MSK GENMASK(7, 0)
|
||||
|
||||
/* ADF4377 REG0027 Map */
|
||||
#define ADF4377_0027_SYNTH_LOCK_TO_LSB_MSK GENMASK(7, 0)
|
||||
|
||||
/* ADF4377 REG0028 Map */
|
||||
#define ADF4377_0028_O_VCO_DB_MSK BIT(7)
|
||||
#define ADF4377_0028_SYNTH_LOCK_TO_MSB_MSK GENMASK(6, 0)
|
||||
|
||||
/* ADF4377 REG0029 Map */
|
||||
#define ADF4377_0029_VCO_ALC_TO_LSB_MSK GENMASK(7, 0)
|
||||
|
||||
/* ADF4377 REG002A Map */
|
||||
#define ADF4377_002A_DEL_CTRL_DB_MSK BIT(7)
|
||||
#define ADF4377_002A_VCO_ALC_TO_MSB_MSK GENMASK(6, 0)
|
||||
|
||||
/* ADF4377 REG002C Map */
|
||||
#define ADF4377_002C_R02C_RSV1 0xC0
|
||||
|
||||
/* ADF4377 REG002D Map */
|
||||
#define ADF4377_002D_ADC_CLK_DIV_MSK GENMASK(7, 0)
|
||||
|
||||
/* ADF4377 REG002E Map */
|
||||
#define ADF4377_002E_EN_ADC_CNV_MSK BIT(7)
|
||||
#define ADF4377_002E_EN_ADC_MSK BIT(1)
|
||||
#define ADF4377_002E_ADC_A_CONV_MSK BIT(0)
|
||||
|
||||
/* ADF4377 REG002E Bit Definition */
|
||||
#define ADF4377_002E_ADC_A_CONV_ADC_ST_CNV 0x0
|
||||
#define ADF4377_002E_ADC_A_CONV_VCO_CALIB 0x1
|
||||
|
||||
/* ADF4377 REG002F Map */
|
||||
#define ADF4377_002F_DCLK_DIV1_MSK GENMASK(1, 0)
|
||||
|
||||
/* ADF4377 REG002F Bit Definition */
|
||||
#define ADF4377_002F_DCLK_DIV1_1 0x0
|
||||
#define ADF4377_002F_DCLK_DIV1_2 0x1
|
||||
#define ADF4377_002F_DCLK_DIV1_8 0x2
|
||||
#define ADF4377_002F_DCLK_DIV1_32 0x3
|
||||
|
||||
/* ADF4377 REG0031 Bit Definition */
|
||||
#define ADF4377_0031_R031_RSV1 0x09
|
||||
|
||||
/* ADF4377 REG0032 Map */
|
||||
#define ADF4377_0032_ADC_CLK_SEL_MSK BIT(6)
|
||||
#define ADF4377_0032_R032_RSV1_MSK GENMASK(5, 0)
|
||||
|
||||
/* ADF4377 REG0032 Bit Definition */
|
||||
#define ADF4377_0032_ADC_CLK_SEL_N_OP 0x0
|
||||
#define ADF4377_0032_ADC_CLK_SEL_SPI_CLK 0x1
|
||||
|
||||
#define ADF4377_0032_R032_RSV1 0x9
|
||||
|
||||
/* ADF4377 REG0033 Bit Definition */
|
||||
#define ADF4377_0033_R033_RSV1 0x18
|
||||
|
||||
/* ADF4377 REG0034 Bit Definition */
|
||||
#define ADF4377_0034_R034_RSV1 0x08
|
||||
|
||||
/* ADF4377 REG003A Bit Definition */
|
||||
#define ADF4377_003A_R03A_RSV1 0x5D
|
||||
|
||||
/* ADF4377 REG003B Bit Definition */
|
||||
#define ADF4377_003B_R03B_RSV1 0x2B
|
||||
|
||||
/* ADF4377 REG003D Map */
|
||||
#define ADF4377_003D_O_VCO_BAND_MSK BIT(3)
|
||||
#define ADF4377_003D_O_VCO_CORE_MSK BIT(2)
|
||||
#define ADF4377_003D_O_VCO_BIAS_MSK BIT(1)
|
||||
|
||||
/* ADF4377 REG003D Bit Definition */
|
||||
#define ADF4377_003D_O_VCO_BAND_VCO_CALIB 0x0
|
||||
#define ADF4377_003D_O_VCO_BAND_M_VCO 0x1
|
||||
|
||||
#define ADF4377_003D_O_VCO_CORE_VCO_CALIB 0x0
|
||||
#define ADF4377_003D_O_VCO_CORE_M_VCO 0x1
|
||||
|
||||
#define ADF4377_003D_O_VCO_BIAS_VCO_CALIB 0x0
|
||||
#define ADF4377_003D_O_VCO_BIAS_M_VCO 0x1
|
||||
|
||||
/* ADF4377 REG0042 Map */
|
||||
#define ADF4377_0042_R042_RSV1 0x05
|
||||
|
||||
/* ADF4377 REG0045 Map */
|
||||
#define ADF4377_0045_ADC_ST_CNV_MSK BIT(0)
|
||||
|
||||
/* ADF4377 REG0049 Map */
|
||||
#define ADF4377_0049_EN_CLK2_MSK BIT(7)
|
||||
#define ADF4377_0049_EN_CLK1_MSK BIT(6)
|
||||
#define ADF4377_0049_REF_OK_MSK BIT(3)
|
||||
#define ADF4377_0049_ADC_BUSY_MSK BIT(2)
|
||||
#define ADF4377_0049_FSM_BUSY_MSK BIT(1)
|
||||
#define ADF4377_0049_LOCKED_MSK BIT(0)
|
||||
|
||||
/* ADF4377 REG004B Map */
|
||||
#define ADF4377_004B_VCO_CORE_MSK GENMASK(1, 0)
|
||||
|
||||
/* ADF4377 REG004C Map */
|
||||
#define ADF4377_004C_CHIP_TEMP_LSB_MSK GENMASK(7, 0)
|
||||
|
||||
/* ADF4377 REG004D Map */
|
||||
#define ADF4377_004D_CHIP_TEMP_MSB_MSK BIT(0)
|
||||
|
||||
/* ADF4377 REG004F Map */
|
||||
#define ADF4377_004F_VCO_BAND_MSK GENMASK(7, 0)
|
||||
|
||||
/* ADF4377 REG0051 Map */
|
||||
#define ADF4377_0051_VCO_BIAS_MSK GENMASK(3, 0)
|
||||
|
||||
/* ADF4377 REG0054 Map */
|
||||
#define ADF4377_0054_CHIP_VERSION_MSK GENMASK(7, 0)
|
||||
|
||||
/* Specifications */
|
||||
#define ADF4377_SPI_READ_CMD BIT(7)
|
||||
#define ADF4377_MAX_VCO_FREQ (12800ULL * HZ_PER_MHZ)
|
||||
#define ADF4377_MIN_VCO_FREQ (6400ULL * HZ_PER_MHZ)
|
||||
#define ADF4377_MAX_REFIN_FREQ (1000 * HZ_PER_MHZ)
|
||||
#define ADF4377_MIN_REFIN_FREQ (10 * HZ_PER_MHZ)
|
||||
#define ADF4377_MAX_FREQ_PFD (500 * HZ_PER_MHZ)
|
||||
#define ADF4377_MIN_FREQ_PFD (3 * HZ_PER_MHZ)
|
||||
#define ADF4377_MAX_CLKPN_FREQ ADF4377_MAX_VCO_FREQ
|
||||
#define ADF4377_MIN_CLKPN_FREQ (ADF4377_MIN_VCO_FREQ / 8)
|
||||
#define ADF4377_FREQ_PFD_80MHZ (80 * HZ_PER_MHZ)
|
||||
#define ADF4377_FREQ_PFD_125MHZ (125 * HZ_PER_MHZ)
|
||||
#define ADF4377_FREQ_PFD_160MHZ (160 * HZ_PER_MHZ)
|
||||
#define ADF4377_FREQ_PFD_250MHZ (250 * HZ_PER_MHZ)
|
||||
#define ADF4377_FREQ_PFD_320MHZ (320 * HZ_PER_MHZ)
|
||||
|
||||
enum {
|
||||
ADF4377_FREQ,
|
||||
};
|
||||
|
||||
enum muxout_select_mode {
|
||||
ADF4377_MUXOUT_HIGH_Z = 0x0,
|
||||
ADF4377_MUXOUT_LKDET = 0x1,
|
||||
ADF4377_MUXOUT_LOW = 0x2,
|
||||
ADF4377_MUXOUT_DIV_RCLK_2 = 0x4,
|
||||
ADF4377_MUXOUT_DIV_NCLK_2 = 0x5,
|
||||
ADF4377_MUXOUT_HIGH = 0x8,
|
||||
};
|
||||
|
||||
struct adf4377_state {
|
||||
struct spi_device *spi;
|
||||
struct regmap *regmap;
|
||||
struct clk *clkin;
|
||||
/* Protect against concurrent accesses to the device and data content */
|
||||
struct mutex lock;
|
||||
struct notifier_block nb;
|
||||
/* Reference Divider */
|
||||
unsigned int ref_div_factor;
|
||||
/* PFD Frequency */
|
||||
unsigned int f_pfd;
|
||||
/* Input Reference Clock */
|
||||
unsigned int clkin_freq;
|
||||
/* CLKOUT Divider */
|
||||
u8 clkout_div_sel;
|
||||
/* Feedback Divider (N) */
|
||||
u16 n_int;
|
||||
u16 synth_lock_timeout;
|
||||
u16 vco_alc_timeout;
|
||||
u16 adc_clk_div;
|
||||
u16 vco_band_div;
|
||||
u8 dclk_div1;
|
||||
u8 dclk_div2;
|
||||
u8 dclk_mode;
|
||||
unsigned int f_div_rclk;
|
||||
enum muxout_select_mode muxout_select;
|
||||
struct gpio_desc *gpio_ce;
|
||||
struct gpio_desc *gpio_enclk1;
|
||||
struct gpio_desc *gpio_enclk2;
|
||||
u8 buf[2] __aligned(IIO_DMA_MINALIGN);
|
||||
};
|
||||
|
||||
static const char * const adf4377_muxout_modes[] = {
|
||||
[ADF4377_MUXOUT_HIGH_Z] = "high_z",
|
||||
[ADF4377_MUXOUT_LKDET] = "lock_detect",
|
||||
[ADF4377_MUXOUT_LOW] = "muxout_low",
|
||||
[ADF4377_MUXOUT_DIV_RCLK_2] = "f_div_rclk_2",
|
||||
[ADF4377_MUXOUT_DIV_NCLK_2] = "f_div_nclk_2",
|
||||
[ADF4377_MUXOUT_HIGH] = "muxout_high",
|
||||
};
|
||||
|
||||
static const struct reg_sequence adf4377_reg_defaults[] = {
|
||||
{ 0x42, ADF4377_0042_R042_RSV1 },
|
||||
{ 0x3B, ADF4377_003B_R03B_RSV1 },
|
||||
{ 0x3A, ADF4377_003A_R03A_RSV1 },
|
||||
{ 0x34, ADF4377_0034_R034_RSV1 },
|
||||
{ 0x33, ADF4377_0033_R033_RSV1 },
|
||||
{ 0x32, ADF4377_0032_R032_RSV1 },
|
||||
{ 0x31, ADF4377_0031_R031_RSV1 },
|
||||
{ 0x2C, ADF4377_002C_R02C_RSV1 },
|
||||
{ 0x25, ADF4377_0025_R025_RSV1 },
|
||||
{ 0x23, ADF4377_0023_R023_RSV1 },
|
||||
{ 0x22, ADF4377_0022_R022_RSV1 },
|
||||
{ 0x21, ADF4377_0021_R021_RSV1 },
|
||||
{ 0x1f, ADF4377_001F_R01F_RSV1 },
|
||||
{ 0x1c, ADF4377_001C_R01C_RSV1 },
|
||||
};
|
||||
|
||||
static const struct regmap_config adf4377_regmap_config = {
|
||||
.reg_bits = 16,
|
||||
.val_bits = 8,
|
||||
.read_flag_mask = BIT(7),
|
||||
.max_register = 0x54,
|
||||
};
|
||||
|
||||
static int adf4377_reg_access(struct iio_dev *indio_dev,
|
||||
unsigned int reg,
|
||||
unsigned int write_val,
|
||||
unsigned int *read_val)
|
||||
{
|
||||
struct adf4377_state *st = iio_priv(indio_dev);
|
||||
|
||||
if (read_val)
|
||||
return regmap_read(st->regmap, reg, read_val);
|
||||
|
||||
return regmap_write(st->regmap, reg, write_val);
|
||||
}
|
||||
|
||||
static const struct iio_info adf4377_info = {
|
||||
.debugfs_reg_access = &adf4377_reg_access,
|
||||
};
|
||||
|
||||
static int adf4377_soft_reset(struct adf4377_state *st)
|
||||
{
|
||||
unsigned int read_val;
|
||||
int ret;
|
||||
|
||||
ret = regmap_update_bits(st->regmap, 0x0, ADF4377_0000_SOFT_RESET_MSK |
|
||||
ADF4377_0000_SOFT_RESET_R_MSK,
|
||||
FIELD_PREP(ADF4377_0000_SOFT_RESET_MSK, 1) |
|
||||
FIELD_PREP(ADF4377_0000_SOFT_RESET_R_MSK, 1));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return regmap_read_poll_timeout(st->regmap, 0x0, read_val,
|
||||
!(read_val & (ADF4377_0000_SOFT_RESET_R_MSK |
|
||||
ADF4377_0000_SOFT_RESET_R_MSK)), 200, 200 * 100);
|
||||
}
|
||||
|
||||
static int adf4377_get_freq(struct adf4377_state *st, u64 *freq)
|
||||
{
|
||||
unsigned int ref_div_factor, n_int;
|
||||
u64 clkin_freq;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&st->lock);
|
||||
ret = regmap_read(st->regmap, 0x12, &ref_div_factor);
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_bulk_read(st->regmap, 0x10, st->buf, sizeof(st->buf));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
clkin_freq = clk_get_rate(st->clkin);
|
||||
ref_div_factor = FIELD_GET(ADF4377_0012_R_DIV_MSK, ref_div_factor);
|
||||
n_int = FIELD_GET(ADF4377_0010_N_INT_LSB_MSK | ADF4377_0011_N_INT_MSB_MSK,
|
||||
get_unaligned_le16(&st->buf));
|
||||
|
||||
*freq = div_u64(clkin_freq, ref_div_factor) * n_int;
|
||||
exit:
|
||||
mutex_unlock(&st->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int adf4377_set_freq(struct adf4377_state *st, u64 freq)
|
||||
{
|
||||
unsigned int read_val;
|
||||
u64 f_vco;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&st->lock);
|
||||
|
||||
if (freq > ADF4377_MAX_CLKPN_FREQ || freq < ADF4377_MIN_CLKPN_FREQ) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ret = regmap_update_bits(st->regmap, 0x1C, ADF4377_001C_EN_DNCLK_MSK |
|
||||
ADF4377_001C_EN_DRCLK_MSK,
|
||||
FIELD_PREP(ADF4377_001C_EN_DNCLK_MSK, 1) |
|
||||
FIELD_PREP(ADF4377_001C_EN_DRCLK_MSK, 1));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_update_bits(st->regmap, 0x11, ADF4377_0011_EN_AUTOCAL_MSK |
|
||||
ADF4377_0011_DCLK_DIV2_MSK,
|
||||
FIELD_PREP(ADF4377_0011_EN_AUTOCAL_MSK, 1) |
|
||||
FIELD_PREP(ADF4377_0011_DCLK_DIV2_MSK, st->dclk_div2));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_update_bits(st->regmap, 0x2E, ADF4377_002E_EN_ADC_CNV_MSK |
|
||||
ADF4377_002E_EN_ADC_MSK |
|
||||
ADF4377_002E_ADC_A_CONV_MSK,
|
||||
FIELD_PREP(ADF4377_002E_EN_ADC_CNV_MSK, 1) |
|
||||
FIELD_PREP(ADF4377_002E_EN_ADC_MSK, 1) |
|
||||
FIELD_PREP(ADF4377_002E_ADC_A_CONV_MSK,
|
||||
ADF4377_002E_ADC_A_CONV_VCO_CALIB));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_update_bits(st->regmap, 0x20, ADF4377_0020_EN_ADC_CLK_MSK,
|
||||
FIELD_PREP(ADF4377_0020_EN_ADC_CLK_MSK, 1));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_update_bits(st->regmap, 0x2F, ADF4377_002F_DCLK_DIV1_MSK,
|
||||
FIELD_PREP(ADF4377_002F_DCLK_DIV1_MSK, st->dclk_div1));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_update_bits(st->regmap, 0x24, ADF4377_0024_DCLK_MODE_MSK,
|
||||
FIELD_PREP(ADF4377_0024_DCLK_MODE_MSK, st->dclk_mode));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_write(st->regmap, 0x27,
|
||||
FIELD_PREP(ADF4377_0027_SYNTH_LOCK_TO_LSB_MSK,
|
||||
st->synth_lock_timeout));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_update_bits(st->regmap, 0x28, ADF4377_0028_SYNTH_LOCK_TO_MSB_MSK,
|
||||
FIELD_PREP(ADF4377_0028_SYNTH_LOCK_TO_MSB_MSK,
|
||||
st->synth_lock_timeout >> 8));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_write(st->regmap, 0x29,
|
||||
FIELD_PREP(ADF4377_0029_VCO_ALC_TO_LSB_MSK,
|
||||
st->vco_alc_timeout));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_update_bits(st->regmap, 0x2A, ADF4377_002A_VCO_ALC_TO_MSB_MSK,
|
||||
FIELD_PREP(ADF4377_002A_VCO_ALC_TO_MSB_MSK,
|
||||
st->vco_alc_timeout >> 8));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_write(st->regmap, 0x26,
|
||||
FIELD_PREP(ADF4377_0026_VCO_BAND_DIV_MSK, st->vco_band_div));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_write(st->regmap, 0x2D,
|
||||
FIELD_PREP(ADF4377_002D_ADC_CLK_DIV_MSK, st->adc_clk_div));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
st->clkout_div_sel = 0;
|
||||
|
||||
f_vco = freq;
|
||||
|
||||
while (f_vco < ADF4377_MIN_VCO_FREQ) {
|
||||
f_vco <<= 1;
|
||||
st->clkout_div_sel++;
|
||||
}
|
||||
|
||||
st->n_int = div_u64(freq, st->f_pfd);
|
||||
|
||||
ret = regmap_update_bits(st->regmap, 0x11, ADF4377_0011_EN_RDBLR_MSK |
|
||||
ADF4377_0011_N_INT_MSB_MSK,
|
||||
FIELD_PREP(ADF4377_0011_EN_RDBLR_MSK, 0) |
|
||||
FIELD_PREP(ADF4377_0011_N_INT_MSB_MSK, st->n_int >> 8));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_update_bits(st->regmap, 0x12, ADF4377_0012_R_DIV_MSK |
|
||||
ADF4377_0012_CLKOUT_DIV_MSK,
|
||||
FIELD_PREP(ADF4377_0012_CLKOUT_DIV_MSK, st->clkout_div_sel) |
|
||||
FIELD_PREP(ADF4377_0012_R_DIV_MSK, st->ref_div_factor));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_write(st->regmap, 0x10,
|
||||
FIELD_PREP(ADF4377_0010_N_INT_LSB_MSK, st->n_int));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = regmap_read_poll_timeout(st->regmap, 0x49, read_val,
|
||||
!(read_val & (ADF4377_0049_FSM_BUSY_MSK)), 200, 200 * 100);
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
/* Disable EN_DNCLK, EN_DRCLK */
|
||||
ret = regmap_update_bits(st->regmap, 0x1C, ADF4377_001C_EN_DNCLK_MSK |
|
||||
ADF4377_001C_EN_DRCLK_MSK,
|
||||
FIELD_PREP(ADF4377_001C_EN_DNCLK_MSK, 0) |
|
||||
FIELD_PREP(ADF4377_001C_EN_DRCLK_MSK, 0));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
/* Disable EN_ADC_CLK */
|
||||
ret = regmap_update_bits(st->regmap, 0x20, ADF4377_0020_EN_ADC_CLK_MSK,
|
||||
FIELD_PREP(ADF4377_0020_EN_ADC_CLK_MSK, 0));
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
/* Set output Amplitude */
|
||||
ret = regmap_update_bits(st->regmap, 0x19, ADF4377_0019_CLKOUT2_OP_MSK |
|
||||
ADF4377_0019_CLKOUT1_OP_MSK,
|
||||
FIELD_PREP(ADF4377_0019_CLKOUT1_OP_MSK,
|
||||
ADF4377_0019_CLKOUT_420MV) |
|
||||
FIELD_PREP(ADF4377_0019_CLKOUT2_OP_MSK,
|
||||
ADF4377_0019_CLKOUT_420MV));
|
||||
|
||||
exit:
|
||||
mutex_unlock(&st->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void adf4377_gpio_init(struct adf4377_state *st)
|
||||
{
|
||||
if (st->gpio_ce) {
|
||||
gpiod_set_value(st->gpio_ce, 1);
|
||||
|
||||
/* Delay for SPI register bits to settle to their power-on reset state */
|
||||
fsleep(200);
|
||||
}
|
||||
|
||||
if (st->gpio_enclk1)
|
||||
gpiod_set_value(st->gpio_enclk1, 1);
|
||||
|
||||
if (st->gpio_enclk2)
|
||||
gpiod_set_value(st->gpio_enclk2, 1);
|
||||
}
|
||||
|
||||
static int adf4377_init(struct adf4377_state *st)
|
||||
{
|
||||
struct spi_device *spi = st->spi;
|
||||
int ret;
|
||||
|
||||
adf4377_gpio_init(st);
|
||||
|
||||
ret = adf4377_soft_reset(st);
|
||||
if (ret) {
|
||||
dev_err(&spi->dev, "Failed to soft reset.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = regmap_multi_reg_write(st->regmap, adf4377_reg_defaults,
|
||||
ARRAY_SIZE(adf4377_reg_defaults));
|
||||
if (ret) {
|
||||
dev_err(&spi->dev, "Failed to set default registers.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = regmap_update_bits(st->regmap, 0x00,
|
||||
ADF4377_0000_SDO_ACTIVE_MSK | ADF4377_0000_SDO_ACTIVE_R_MSK,
|
||||
FIELD_PREP(ADF4377_0000_SDO_ACTIVE_MSK,
|
||||
ADF4377_0000_SDO_ACTIVE_SPI_4W) |
|
||||
FIELD_PREP(ADF4377_0000_SDO_ACTIVE_R_MSK,
|
||||
ADF4377_0000_SDO_ACTIVE_SPI_4W));
|
||||
if (ret) {
|
||||
dev_err(&spi->dev, "Failed to set 4-Wire Operation.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
st->clkin_freq = clk_get_rate(st->clkin);
|
||||
|
||||
/* Power Up */
|
||||
ret = regmap_write(st->regmap, 0x1a,
|
||||
FIELD_PREP(ADF4377_001A_PD_ALL_MSK, 0) |
|
||||
FIELD_PREP(ADF4377_001A_PD_RDIV_MSK, 0) |
|
||||
FIELD_PREP(ADF4377_001A_PD_NDIV_MSK, 0) |
|
||||
FIELD_PREP(ADF4377_001A_PD_VCO_MSK, 0) |
|
||||
FIELD_PREP(ADF4377_001A_PD_LD_MSK, 0) |
|
||||
FIELD_PREP(ADF4377_001A_PD_PFDCP_MSK, 0) |
|
||||
FIELD_PREP(ADF4377_001A_PD_CLKOUT1_MSK, 0) |
|
||||
FIELD_PREP(ADF4377_001A_PD_CLKOUT2_MSK, 0));
|
||||
if (ret) {
|
||||
dev_err(&spi->dev, "Failed to set power down registers.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Set Mux Output */
|
||||
ret = regmap_update_bits(st->regmap, 0x1D,
|
||||
ADF4377_001D_MUXOUT_MSK,
|
||||
FIELD_PREP(ADF4377_001D_MUXOUT_MSK, st->muxout_select));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Compute PFD */
|
||||
st->ref_div_factor = 0;
|
||||
do {
|
||||
st->ref_div_factor++;
|
||||
st->f_pfd = st->clkin_freq / st->ref_div_factor;
|
||||
} while (st->f_pfd > ADF4377_MAX_FREQ_PFD);
|
||||
|
||||
if (st->f_pfd > ADF4377_MAX_FREQ_PFD || st->f_pfd < ADF4377_MIN_FREQ_PFD)
|
||||
return -EINVAL;
|
||||
|
||||
st->f_div_rclk = st->f_pfd;
|
||||
|
||||
if (st->f_pfd <= ADF4377_FREQ_PFD_80MHZ) {
|
||||
st->dclk_div1 = ADF4377_002F_DCLK_DIV1_1;
|
||||
st->dclk_div2 = ADF4377_0011_DCLK_DIV2_1;
|
||||
st->dclk_mode = 0;
|
||||
} else if (st->f_pfd <= ADF4377_FREQ_PFD_125MHZ) {
|
||||
st->dclk_div1 = ADF4377_002F_DCLK_DIV1_1;
|
||||
st->dclk_div2 = ADF4377_0011_DCLK_DIV2_1;
|
||||
st->dclk_mode = 1;
|
||||
} else if (st->f_pfd <= ADF4377_FREQ_PFD_160MHZ) {
|
||||
st->dclk_div1 = ADF4377_002F_DCLK_DIV1_2;
|
||||
st->dclk_div2 = ADF4377_0011_DCLK_DIV2_1;
|
||||
st->dclk_mode = 0;
|
||||
st->f_div_rclk /= 2;
|
||||
} else if (st->f_pfd <= ADF4377_FREQ_PFD_250MHZ) {
|
||||
st->dclk_div1 = ADF4377_002F_DCLK_DIV1_2;
|
||||
st->dclk_div2 = ADF4377_0011_DCLK_DIV2_1;
|
||||
st->dclk_mode = 1;
|
||||
st->f_div_rclk /= 2;
|
||||
} else if (st->f_pfd <= ADF4377_FREQ_PFD_320MHZ) {
|
||||
st->dclk_div1 = ADF4377_002F_DCLK_DIV1_2;
|
||||
st->dclk_div2 = ADF4377_0011_DCLK_DIV2_2;
|
||||
st->dclk_mode = 0;
|
||||
st->f_div_rclk /= 4;
|
||||
} else {
|
||||
st->dclk_div1 = ADF4377_002F_DCLK_DIV1_2;
|
||||
st->dclk_div2 = ADF4377_0011_DCLK_DIV2_2;
|
||||
st->dclk_mode = 1;
|
||||
st->f_div_rclk /= 4;
|
||||
}
|
||||
|
||||
st->synth_lock_timeout = DIV_ROUND_UP(st->f_div_rclk, 50000);
|
||||
st->vco_alc_timeout = DIV_ROUND_UP(st->f_div_rclk, 20000);
|
||||
st->vco_band_div = DIV_ROUND_UP(st->f_div_rclk, 150000 * 16 * (1 << st->dclk_mode));
|
||||
st->adc_clk_div = DIV_ROUND_UP((st->f_div_rclk / 400000 - 2), 4);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t adf4377_read(struct iio_dev *indio_dev, uintptr_t private,
|
||||
const struct iio_chan_spec *chan, char *buf)
|
||||
{
|
||||
struct adf4377_state *st = iio_priv(indio_dev);
|
||||
u64 val = 0;
|
||||
int ret;
|
||||
|
||||
switch ((u32)private) {
|
||||
case ADF4377_FREQ:
|
||||
ret = adf4377_get_freq(st, &val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return sysfs_emit(buf, "%llu\n", val);
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
static ssize_t adf4377_write(struct iio_dev *indio_dev, uintptr_t private,
|
||||
const struct iio_chan_spec *chan, const char *buf,
|
||||
size_t len)
|
||||
{
|
||||
struct adf4377_state *st = iio_priv(indio_dev);
|
||||
unsigned long long freq;
|
||||
int ret;
|
||||
|
||||
switch ((u32)private) {
|
||||
case ADF4377_FREQ:
|
||||
ret = kstrtoull(buf, 10, &freq);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = adf4377_set_freq(st, freq);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return len;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
#define _ADF4377_EXT_INFO(_name, _shared, _ident) { \
|
||||
.name = _name, \
|
||||
.read = adf4377_read, \
|
||||
.write = adf4377_write, \
|
||||
.private = _ident, \
|
||||
.shared = _shared, \
|
||||
}
|
||||
|
||||
static const struct iio_chan_spec_ext_info adf4377_ext_info[] = {
|
||||
/*
|
||||
* Usually we use IIO_CHAN_INFO_FREQUENCY, but there are
|
||||
* values > 2^32 in order to support the entire frequency range
|
||||
* in Hz.
|
||||
*/
|
||||
_ADF4377_EXT_INFO("frequency", IIO_SEPARATE, ADF4377_FREQ),
|
||||
{ }
|
||||
};
|
||||
|
||||
static const struct iio_chan_spec adf4377_channels[] = {
|
||||
{
|
||||
.type = IIO_ALTVOLTAGE,
|
||||
.indexed = 1,
|
||||
.output = 1,
|
||||
.channel = 0,
|
||||
.ext_info = adf4377_ext_info,
|
||||
},
|
||||
};
|
||||
|
||||
static int adf4377_properties_parse(struct adf4377_state *st)
|
||||
{
|
||||
struct spi_device *spi = st->spi;
|
||||
const char *str;
|
||||
int ret;
|
||||
|
||||
st->clkin = devm_clk_get_enabled(&spi->dev, "ref_in");
|
||||
if (IS_ERR(st->clkin))
|
||||
return dev_err_probe(&spi->dev, PTR_ERR(st->clkin),
|
||||
"failed to get the reference input clock\n");
|
||||
|
||||
st->gpio_ce = devm_gpiod_get_optional(&st->spi->dev, "chip-enable",
|
||||
GPIOD_OUT_LOW);
|
||||
if (IS_ERR(st->gpio_ce))
|
||||
return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_ce),
|
||||
"failed to get the CE GPIO\n");
|
||||
|
||||
st->gpio_enclk1 = devm_gpiod_get_optional(&st->spi->dev, "clk1-enable",
|
||||
GPIOD_OUT_LOW);
|
||||
if (IS_ERR(st->gpio_enclk1))
|
||||
return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_enclk1),
|
||||
"failed to get the CE GPIO\n");
|
||||
|
||||
st->gpio_enclk2 = devm_gpiod_get_optional(&st->spi->dev, "clk2-enable",
|
||||
GPIOD_OUT_LOW);
|
||||
if (IS_ERR(st->gpio_enclk2))
|
||||
return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_enclk2),
|
||||
"failed to get the CE GPIO\n");
|
||||
|
||||
ret = device_property_read_string(&spi->dev, "adi,muxout-select", &str);
|
||||
if (ret) {
|
||||
st->muxout_select = ADF4377_MUXOUT_HIGH_Z;
|
||||
} else {
|
||||
ret = match_string(adf4377_muxout_modes, ARRAY_SIZE(adf4377_muxout_modes), str);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
st->muxout_select = ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int adf4377_freq_change(struct notifier_block *nb, unsigned long action, void *data)
|
||||
{
|
||||
struct adf4377_state *st = container_of(nb, struct adf4377_state, nb);
|
||||
int ret;
|
||||
|
||||
if (action == POST_RATE_CHANGE) {
|
||||
mutex_lock(&st->lock);
|
||||
ret = notifier_from_errno(adf4377_init(st));
|
||||
mutex_unlock(&st->lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
static int adf4377_probe(struct spi_device *spi)
|
||||
{
|
||||
struct iio_dev *indio_dev;
|
||||
struct regmap *regmap;
|
||||
struct adf4377_state *st;
|
||||
int ret;
|
||||
|
||||
indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
|
||||
if (!indio_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
regmap = devm_regmap_init_spi(spi, &adf4377_regmap_config);
|
||||
if (IS_ERR(regmap))
|
||||
return PTR_ERR(regmap);
|
||||
|
||||
st = iio_priv(indio_dev);
|
||||
|
||||
indio_dev->info = &adf4377_info;
|
||||
indio_dev->name = "adf4377";
|
||||
indio_dev->channels = adf4377_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(adf4377_channels);
|
||||
|
||||
st->regmap = regmap;
|
||||
st->spi = spi;
|
||||
mutex_init(&st->lock);
|
||||
|
||||
ret = adf4377_properties_parse(st);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
st->nb.notifier_call = adf4377_freq_change;
|
||||
ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = adf4377_init(st);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return devm_iio_device_register(&spi->dev, indio_dev);
|
||||
}
|
||||
|
||||
static const struct spi_device_id adf4377_id[] = {
|
||||
{ "adf4377", 0 },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(spi, adf4377_id);
|
||||
|
||||
static const struct of_device_id adf4377_of_match[] = {
|
||||
{ .compatible = "adi,adf4377" },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, adf4377_of_match);
|
||||
|
||||
static struct spi_driver adf4377_driver = {
|
||||
.driver = {
|
||||
.name = "adf4377",
|
||||
.of_match_table = adf4377_of_match,
|
||||
},
|
||||
.probe = adf4377_probe,
|
||||
.id_table = adf4377_id,
|
||||
};
|
||||
module_spi_driver(adf4377_driver);
|
||||
|
||||
MODULE_AUTHOR("Antoniu Miclaus <antoniu.miclaus@analog.com>");
|
||||
MODULE_DESCRIPTION("Analog Devices ADF4377");
|
||||
MODULE_LICENSE("GPL");
|
@ -429,7 +429,7 @@ static int adis16136_initial_setup(struct iio_dev *indio_dev)
|
||||
uint16_t prod_id;
|
||||
int ret;
|
||||
|
||||
ret = adis_initial_startup(&adis16136->adis);
|
||||
ret = __adis_initial_startup(&adis16136->adis);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -395,7 +395,7 @@ static int adis16260_probe(struct spi_device *spi)
|
||||
return ret;
|
||||
|
||||
/* Get the device into a sane initial state */
|
||||
ret = adis_initial_startup(&adis16260->adis);
|
||||
ret = __adis_initial_startup(&adis16260->adis);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -13,9 +13,9 @@ static const struct regmap_config bmg160_regmap_i2c_conf = {
|
||||
.max_register = 0x3f
|
||||
};
|
||||
|
||||
static int bmg160_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int bmg160_i2c_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct regmap *regmap;
|
||||
const char *name = NULL;
|
||||
|
||||
@ -70,7 +70,7 @@ static struct i2c_driver bmg160_i2c_driver = {
|
||||
.of_match_table = bmg160_of_match,
|
||||
.pm = &bmg160_pm_ops,
|
||||
},
|
||||
.probe = bmg160_i2c_probe,
|
||||
.probe_new = bmg160_i2c_probe,
|
||||
.remove = bmg160_i2c_remove,
|
||||
.id_table = bmg160_i2c_id,
|
||||
};
|
||||
|
@ -295,8 +295,7 @@ static const struct iio_info itg3200_info = {
|
||||
|
||||
static const unsigned long itg3200_available_scan_masks[] = { 0xffffffff, 0x0 };
|
||||
|
||||
static int itg3200_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int itg3200_probe(struct i2c_client *client)
|
||||
{
|
||||
int ret;
|
||||
struct itg3200 *st;
|
||||
@ -406,7 +405,7 @@ static struct i2c_driver itg3200_driver = {
|
||||
.pm = pm_sleep_ptr(&itg3200_pm_ops),
|
||||
},
|
||||
.id_table = itg3200_id,
|
||||
.probe = itg3200_probe,
|
||||
.probe_new = itg3200_probe,
|
||||
.remove = itg3200_remove,
|
||||
};
|
||||
|
||||
|
@ -32,9 +32,9 @@ static int mpu3050_i2c_bypass_deselect(struct i2c_mux_core *mux, u32 chan_id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mpu3050_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int mpu3050_i2c_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct regmap *regmap;
|
||||
const char *name;
|
||||
struct mpu3050 *mpu3050;
|
||||
@ -108,7 +108,7 @@ static const struct of_device_id mpu3050_i2c_of_match[] = {
|
||||
MODULE_DEVICE_TABLE(of, mpu3050_i2c_of_match);
|
||||
|
||||
static struct i2c_driver mpu3050_i2c_driver = {
|
||||
.probe = mpu3050_i2c_probe,
|
||||
.probe_new = mpu3050_i2c_probe,
|
||||
.remove = mpu3050_i2c_remove,
|
||||
.id_table = mpu3050_i2c_id,
|
||||
.driver = {
|
||||
|
@ -58,8 +58,7 @@ static const struct of_device_id st_gyro_of_match[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, st_gyro_of_match);
|
||||
|
||||
static int st_gyro_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int st_gyro_i2c_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct st_sensor_settings *settings;
|
||||
struct st_sensor_data *gdata;
|
||||
@ -112,7 +111,7 @@ static struct i2c_driver st_gyro_driver = {
|
||||
.name = "st-gyro-i2c",
|
||||
.of_match_table = st_gyro_of_match,
|
||||
},
|
||||
.probe = st_gyro_i2c_probe,
|
||||
.probe_new = st_gyro_i2c_probe,
|
||||
.id_table = st_gyro_id_table,
|
||||
};
|
||||
module_i2c_driver(st_gyro_driver);
|
||||
|
@ -459,8 +459,7 @@ static int afe4404_resume(struct device *dev)
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(afe4404_pm_ops, afe4404_suspend,
|
||||
afe4404_resume);
|
||||
|
||||
static int afe4404_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int afe4404_probe(struct i2c_client *client)
|
||||
{
|
||||
struct iio_dev *indio_dev;
|
||||
struct afe4404_data *afe;
|
||||
@ -608,7 +607,7 @@ static struct i2c_driver afe4404_i2c_driver = {
|
||||
.of_match_table = afe4404_of_match,
|
||||
.pm = pm_sleep_ptr(&afe4404_pm_ops),
|
||||
},
|
||||
.probe = afe4404_probe,
|
||||
.probe_new = afe4404_probe,
|
||||
.remove = afe4404_remove,
|
||||
.id_table = afe4404_ids,
|
||||
};
|
||||
|
@ -417,8 +417,7 @@ static const struct iio_info max30100_info = {
|
||||
.read_raw = max30100_read_raw,
|
||||
};
|
||||
|
||||
static int max30100_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int max30100_probe(struct i2c_client *client)
|
||||
{
|
||||
struct max30100_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
@ -500,7 +499,7 @@ static struct i2c_driver max30100_driver = {
|
||||
.name = MAX30100_DRV_NAME,
|
||||
.of_match_table = max30100_dt_ids,
|
||||
},
|
||||
.probe = max30100_probe,
|
||||
.probe_new = max30100_probe,
|
||||
.remove = max30100_remove,
|
||||
.id_table = max30100_id,
|
||||
};
|
||||
|
@ -513,9 +513,9 @@ static const struct iio_info max30102_info = {
|
||||
.read_raw = max30102_read_raw,
|
||||
};
|
||||
|
||||
static int max30102_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int max30102_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct max30102_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
int ret;
|
||||
@ -631,7 +631,7 @@ static struct i2c_driver max30102_driver = {
|
||||
.name = MAX30102_DRV_NAME,
|
||||
.of_match_table = max30102_dt_ids,
|
||||
},
|
||||
.probe = max30102_probe,
|
||||
.probe_new = max30102_probe,
|
||||
.remove = max30102_remove,
|
||||
.id_table = max30102_id,
|
||||
};
|
||||
|
@ -218,8 +218,7 @@ static const struct iio_info am2315_info = {
|
||||
.read_raw = am2315_read_raw,
|
||||
};
|
||||
|
||||
static int am2315_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int am2315_probe(struct i2c_client *client)
|
||||
{
|
||||
int ret;
|
||||
struct iio_dev *indio_dev;
|
||||
@ -263,7 +262,7 @@ static struct i2c_driver am2315_driver = {
|
||||
.driver = {
|
||||
.name = "am2315",
|
||||
},
|
||||
.probe = am2315_probe,
|
||||
.probe_new = am2315_probe,
|
||||
.id_table = am2315_i2c_id,
|
||||
};
|
||||
|
||||
|
@ -351,8 +351,7 @@ static const struct iio_info hdc100x_info = {
|
||||
.attrs = &hdc100x_attribute_group,
|
||||
};
|
||||
|
||||
static int hdc100x_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int hdc100x_probe(struct i2c_client *client)
|
||||
{
|
||||
struct iio_dev *indio_dev;
|
||||
struct hdc100x_data *data;
|
||||
@ -429,7 +428,7 @@ static struct i2c_driver hdc100x_driver = {
|
||||
.of_match_table = hdc100x_dt_ids,
|
||||
.acpi_match_table = hdc100x_acpi_match,
|
||||
},
|
||||
.probe = hdc100x_probe,
|
||||
.probe_new = hdc100x_probe,
|
||||
.id_table = hdc100x_id,
|
||||
};
|
||||
module_i2c_driver(hdc100x_driver);
|
||||
|
@ -251,8 +251,7 @@ static const struct iio_info hdc2010_info = {
|
||||
.attrs = &hdc2010_attribute_group,
|
||||
};
|
||||
|
||||
static int hdc2010_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int hdc2010_probe(struct i2c_client *client)
|
||||
{
|
||||
struct iio_dev *indio_dev;
|
||||
struct hdc2010_data *data;
|
||||
@ -339,7 +338,7 @@ static struct i2c_driver hdc2010_driver = {
|
||||
.name = "hdc2010",
|
||||
.of_match_table = hdc2010_dt_ids,
|
||||
},
|
||||
.probe = hdc2010_probe,
|
||||
.probe_new = hdc2010_probe,
|
||||
.remove = hdc2010_remove,
|
||||
.id_table = hdc2010_id,
|
||||
};
|
||||
|
@ -25,8 +25,7 @@ static const struct regmap_config hts221_i2c_regmap_config = {
|
||||
.read_flag_mask = HTS221_I2C_AUTO_INCREMENT,
|
||||
};
|
||||
|
||||
static int hts221_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int hts221_i2c_probe(struct i2c_client *client)
|
||||
{
|
||||
struct regmap *regmap;
|
||||
|
||||
@ -66,7 +65,7 @@ static struct i2c_driver hts221_driver = {
|
||||
.of_match_table = hts221_i2c_of_match,
|
||||
.acpi_match_table = ACPI_PTR(hts221_acpi_match),
|
||||
},
|
||||
.probe = hts221_i2c_probe,
|
||||
.probe_new = hts221_i2c_probe,
|
||||
.id_table = hts221_i2c_id_table,
|
||||
};
|
||||
module_i2c_driver(hts221_driver);
|
||||
|
@ -177,9 +177,9 @@ static const struct iio_info htu21_info = {
|
||||
.attrs = &htu21_attribute_group,
|
||||
};
|
||||
|
||||
static int htu21_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int htu21_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct ms_ht_dev *dev_data;
|
||||
struct iio_dev *indio_dev;
|
||||
int ret;
|
||||
@ -244,7 +244,7 @@ static const struct of_device_id htu21_of_match[] = {
|
||||
MODULE_DEVICE_TABLE(of, htu21_of_match);
|
||||
|
||||
static struct i2c_driver htu21_driver = {
|
||||
.probe = htu21_probe,
|
||||
.probe_new = htu21_probe,
|
||||
.id_table = htu21_id,
|
||||
.driver = {
|
||||
.name = "htu21",
|
||||
|
@ -123,8 +123,7 @@ static const struct iio_info si7005_info = {
|
||||
.read_raw = si7005_read_raw,
|
||||
};
|
||||
|
||||
static int si7005_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int si7005_probe(struct i2c_client *client)
|
||||
{
|
||||
struct iio_dev *indio_dev;
|
||||
struct si7005_data *data;
|
||||
@ -174,7 +173,7 @@ static struct i2c_driver si7005_driver = {
|
||||
.driver = {
|
||||
.name = "si7005",
|
||||
},
|
||||
.probe = si7005_probe,
|
||||
.probe_new = si7005_probe,
|
||||
.id_table = si7005_id,
|
||||
};
|
||||
module_i2c_driver(si7005_driver);
|
||||
|
@ -103,8 +103,7 @@ static const struct iio_info si7020_info = {
|
||||
.read_raw = si7020_read_raw,
|
||||
};
|
||||
|
||||
static int si7020_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int si7020_probe(struct i2c_client *client)
|
||||
{
|
||||
struct iio_dev *indio_dev;
|
||||
struct i2c_client **data;
|
||||
@ -156,7 +155,7 @@ static struct i2c_driver si7020_driver = {
|
||||
.name = "si7020",
|
||||
.of_match_table = si7020_dt_ids,
|
||||
},
|
||||
.probe = si7020_probe,
|
||||
.probe_new = si7020_probe,
|
||||
.id_table = si7020_id,
|
||||
};
|
||||
|
||||
|
@ -270,23 +270,19 @@ EXPORT_SYMBOL_NS(adis_debugfs_reg_access, IIO_ADISLIB);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* adis_enable_irq() - Enable or disable data ready IRQ
|
||||
* __adis_enable_irq() - Enable or disable data ready IRQ (unlocked)
|
||||
* @adis: The adis device
|
||||
* @enable: Whether to enable the IRQ
|
||||
*
|
||||
* Returns 0 on success, negative error code otherwise
|
||||
*/
|
||||
int adis_enable_irq(struct adis *adis, bool enable)
|
||||
int __adis_enable_irq(struct adis *adis, bool enable)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
u16 msc;
|
||||
|
||||
mutex_lock(&adis->state_lock);
|
||||
|
||||
if (adis->data->enable_irq) {
|
||||
ret = adis->data->enable_irq(adis, enable);
|
||||
goto out_unlock;
|
||||
}
|
||||
if (adis->data->enable_irq)
|
||||
return adis->data->enable_irq(adis, enable);
|
||||
|
||||
if (adis->data->unmasked_drdy) {
|
||||
if (enable)
|
||||
@ -294,12 +290,12 @@ int adis_enable_irq(struct adis *adis, bool enable)
|
||||
else
|
||||
disable_irq(adis->spi->irq);
|
||||
|
||||
goto out_unlock;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = __adis_read_reg_16(adis, adis->data->msc_ctrl_reg, &msc);
|
||||
if (ret)
|
||||
goto out_unlock;
|
||||
return ret;
|
||||
|
||||
msc |= ADIS_MSC_CTRL_DATA_RDY_POL_HIGH;
|
||||
msc &= ~ADIS_MSC_CTRL_DATA_RDY_DIO2;
|
||||
@ -308,13 +304,9 @@ int adis_enable_irq(struct adis *adis, bool enable)
|
||||
else
|
||||
msc &= ~ADIS_MSC_CTRL_DATA_RDY_EN;
|
||||
|
||||
ret = __adis_write_reg_16(adis, adis->data->msc_ctrl_reg, msc);
|
||||
|
||||
out_unlock:
|
||||
mutex_unlock(&adis->state_lock);
|
||||
return ret;
|
||||
return __adis_write_reg_16(adis, adis->data->msc_ctrl_reg, msc);
|
||||
}
|
||||
EXPORT_SYMBOL_NS(adis_enable_irq, IIO_ADISLIB);
|
||||
EXPORT_SYMBOL_NS(__adis_enable_irq, IIO_ADISLIB);
|
||||
|
||||
/**
|
||||
* __adis_check_status() - Check the device for error conditions (unlocked)
|
||||
@ -445,7 +437,7 @@ int __adis_initial_startup(struct adis *adis)
|
||||
* with 'IRQF_NO_AUTOEN' anyways.
|
||||
*/
|
||||
if (!adis->data->unmasked_drdy)
|
||||
adis_enable_irq(adis, false);
|
||||
__adis_enable_irq(adis, false);
|
||||
|
||||
if (!adis->data->prod_id_reg)
|
||||
return 0;
|
||||
|
@ -445,7 +445,7 @@ static int adis16400_initial_setup(struct iio_dev *indio_dev)
|
||||
st->adis.spi->mode = SPI_MODE_3;
|
||||
spi_setup(st->adis.spi);
|
||||
|
||||
ret = adis_initial_startup(&st->adis);
|
||||
ret = __adis_initial_startup(&st->adis);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
#include "bmi160.h"
|
||||
|
||||
static int bmi160_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int bmi160_i2c_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct regmap *regmap;
|
||||
const char *name;
|
||||
|
||||
@ -60,7 +60,7 @@ static struct i2c_driver bmi160_i2c_driver = {
|
||||
.acpi_match_table = bmi160_acpi_match,
|
||||
.of_match_table = bmi160_of_match,
|
||||
},
|
||||
.probe = bmi160_i2c_probe,
|
||||
.probe_new = bmi160_i2c_probe,
|
||||
.id_table = bmi160_i2c_id,
|
||||
};
|
||||
module_i2c_driver(bmi160_i2c_driver);
|
||||
|
@ -18,9 +18,9 @@
|
||||
|
||||
#include "fxos8700.h"
|
||||
|
||||
static int fxos8700_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int fxos8700_i2c_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
struct regmap *regmap;
|
||||
const char *name = NULL;
|
||||
|
||||
@ -60,7 +60,7 @@ static struct i2c_driver fxos8700_i2c_driver = {
|
||||
.acpi_match_table = ACPI_PTR(fxos8700_acpi_match),
|
||||
.of_match_table = fxos8700_of_match,
|
||||
},
|
||||
.probe = fxos8700_i2c_probe,
|
||||
.probe_new = fxos8700_i2c_probe,
|
||||
.id_table = fxos8700_i2c_id,
|
||||
};
|
||||
module_i2c_driver(fxos8700_i2c_driver);
|
||||
|
@ -91,13 +91,12 @@ static int inv_mpu_i2c_aux_setup(struct iio_dev *indio_dev)
|
||||
/**
|
||||
* inv_mpu_probe() - probe function.
|
||||
* @client: i2c client.
|
||||
* @id: i2c device id.
|
||||
*
|
||||
* Returns 0 on success, a negative error code otherwise.
|
||||
*/
|
||||
static int inv_mpu_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int inv_mpu_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
const void *match;
|
||||
struct inv_mpu6050_state *st;
|
||||
int result;
|
||||
@ -260,7 +259,7 @@ static const struct acpi_device_id inv_acpi_match[] = {
|
||||
MODULE_DEVICE_TABLE(acpi, inv_acpi_match);
|
||||
|
||||
static struct i2c_driver inv_mpu_driver = {
|
||||
.probe = inv_mpu_probe,
|
||||
.probe_new = inv_mpu_probe,
|
||||
.remove = inv_mpu_remove,
|
||||
.id_table = inv_mpu_id,
|
||||
.driver = {
|
||||
|
@ -1276,9 +1276,9 @@ static struct iio_trigger *kmx61_trigger_setup(struct kmx61_data *data,
|
||||
return trig;
|
||||
}
|
||||
|
||||
static int kmx61_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int kmx61_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
int ret;
|
||||
struct kmx61_data *data;
|
||||
const char *name = NULL;
|
||||
@ -1517,7 +1517,7 @@ static struct i2c_driver kmx61_driver = {
|
||||
.acpi_match_table = ACPI_PTR(kmx61_acpi_match),
|
||||
.pm = pm_ptr(&kmx61_pm_ops),
|
||||
},
|
||||
.probe = kmx61_probe,
|
||||
.probe_new = kmx61_probe,
|
||||
.remove = kmx61_remove,
|
||||
.id_table = kmx61_id,
|
||||
};
|
||||
|
@ -13,8 +13,8 @@ config IIO_ST_LSM6DSX
|
||||
sensor. Supported devices: lsm6ds3, lsm6ds3h, lsm6dsl, lsm6dsm,
|
||||
ism330dlc, lsm6dso, lsm6dsox, asm330lhh, asm330lhhx, lsm6dsr,
|
||||
lsm6ds3tr-c, ism330dhcx, lsm6dsrx, lsm6ds0, lsm6dsop, lsm6dstx,
|
||||
lsm6dsv, lsm6dsv16x, the accelerometer/gyroscope of lsm9ds1
|
||||
and lsm6dst.
|
||||
lsm6dsv, lsm6dsv16x, lsm6dso16is, ism330is, lsm6dst and the
|
||||
accelerometer/gyroscope of lsm9ds1.
|
||||
|
||||
To compile this driver as a module, choose M here: the module
|
||||
will be called st_lsm6dsx.
|
||||
|
@ -35,6 +35,8 @@
|
||||
#define ST_LSM6DSTX_DEV_NAME "lsm6dstx"
|
||||
#define ST_LSM6DSV_DEV_NAME "lsm6dsv"
|
||||
#define ST_LSM6DSV16X_DEV_NAME "lsm6dsv16x"
|
||||
#define ST_LSM6DSO16IS_DEV_NAME "lsm6dso16is"
|
||||
#define ST_ISM330IS_DEV_NAME "ism330is"
|
||||
|
||||
enum st_lsm6dsx_hw_id {
|
||||
ST_LSM6DS3_ID,
|
||||
@ -57,6 +59,8 @@ enum st_lsm6dsx_hw_id {
|
||||
ST_LSM6DSTX_ID,
|
||||
ST_LSM6DSV_ID,
|
||||
ST_LSM6DSV16X_ID,
|
||||
ST_LSM6DSO16IS_ID,
|
||||
ST_ISM330IS_ID,
|
||||
ST_LSM6DSX_MAX_ID,
|
||||
};
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
* - FIFO size: 4KB
|
||||
*
|
||||
* - LSM6DSO/LSM6DSOX/ASM330LHH/ASM330LHHX/LSM6DSR/ISM330DHCX/LSM6DST/LSM6DSOP/
|
||||
* LSM6DSTX:
|
||||
* LSM6DSTX/LSM6DSO16IS/ISM330IS:
|
||||
* - Accelerometer/Gyroscope supported ODR [Hz]: 12.5, 26, 52, 104, 208, 416,
|
||||
* 833
|
||||
* - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
|
||||
@ -1375,6 +1375,136 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
|
||||
.wakeup_src_x_mask = BIT(2),
|
||||
},
|
||||
},
|
||||
{
|
||||
.reset = {
|
||||
.addr = 0x12,
|
||||
.mask = BIT(0),
|
||||
},
|
||||
.boot = {
|
||||
.addr = 0x12,
|
||||
.mask = BIT(7),
|
||||
},
|
||||
.bdu = {
|
||||
.addr = 0x12,
|
||||
.mask = BIT(6),
|
||||
},
|
||||
.id = {
|
||||
{
|
||||
.hw_id = ST_LSM6DSO16IS_ID,
|
||||
.name = ST_LSM6DSO16IS_DEV_NAME,
|
||||
.wai = 0x22,
|
||||
}, {
|
||||
.hw_id = ST_ISM330IS_ID,
|
||||
.name = ST_ISM330IS_DEV_NAME,
|
||||
.wai = 0x22,
|
||||
}
|
||||
},
|
||||
.channels = {
|
||||
[ST_LSM6DSX_ID_ACC] = {
|
||||
.chan = st_lsm6dsx_acc_channels,
|
||||
.len = ARRAY_SIZE(st_lsm6dsx_acc_channels),
|
||||
},
|
||||
[ST_LSM6DSX_ID_GYRO] = {
|
||||
.chan = st_lsm6dsx_gyro_channels,
|
||||
.len = ARRAY_SIZE(st_lsm6dsx_gyro_channels),
|
||||
},
|
||||
},
|
||||
.odr_table = {
|
||||
[ST_LSM6DSX_ID_ACC] = {
|
||||
.reg = {
|
||||
.addr = 0x10,
|
||||
.mask = GENMASK(7, 4),
|
||||
},
|
||||
.odr_avl[0] = { 12500, 0x01 },
|
||||
.odr_avl[1] = { 26000, 0x02 },
|
||||
.odr_avl[2] = { 52000, 0x03 },
|
||||
.odr_avl[3] = { 104000, 0x04 },
|
||||
.odr_avl[4] = { 208000, 0x05 },
|
||||
.odr_avl[5] = { 416000, 0x06 },
|
||||
.odr_avl[6] = { 833000, 0x07 },
|
||||
.odr_len = 7,
|
||||
},
|
||||
[ST_LSM6DSX_ID_GYRO] = {
|
||||
.reg = {
|
||||
.addr = 0x11,
|
||||
.mask = GENMASK(7, 4),
|
||||
},
|
||||
.odr_avl[0] = { 12500, 0x01 },
|
||||
.odr_avl[1] = { 26000, 0x02 },
|
||||
.odr_avl[2] = { 52000, 0x03 },
|
||||
.odr_avl[3] = { 104000, 0x04 },
|
||||
.odr_avl[4] = { 208000, 0x05 },
|
||||
.odr_avl[5] = { 416000, 0x06 },
|
||||
.odr_avl[6] = { 833000, 0x07 },
|
||||
.odr_len = 7,
|
||||
},
|
||||
},
|
||||
.fs_table = {
|
||||
[ST_LSM6DSX_ID_ACC] = {
|
||||
.reg = {
|
||||
.addr = 0x10,
|
||||
.mask = GENMASK(3, 2),
|
||||
},
|
||||
.fs_avl[0] = { IIO_G_TO_M_S_2(61000), 0x0 },
|
||||
.fs_avl[1] = { IIO_G_TO_M_S_2(122000), 0x2 },
|
||||
.fs_avl[2] = { IIO_G_TO_M_S_2(244000), 0x3 },
|
||||
.fs_avl[3] = { IIO_G_TO_M_S_2(488000), 0x1 },
|
||||
.fs_len = 4,
|
||||
},
|
||||
[ST_LSM6DSX_ID_GYRO] = {
|
||||
.reg = {
|
||||
.addr = 0x11,
|
||||
.mask = GENMASK(3, 2),
|
||||
},
|
||||
.fs_avl[0] = { IIO_DEGREE_TO_RAD(8750000), 0x0 },
|
||||
.fs_avl[1] = { IIO_DEGREE_TO_RAD(17500000), 0x1 },
|
||||
.fs_avl[2] = { IIO_DEGREE_TO_RAD(35000000), 0x2 },
|
||||
.fs_avl[3] = { IIO_DEGREE_TO_RAD(70000000), 0x3 },
|
||||
.fs_len = 4,
|
||||
},
|
||||
},
|
||||
.irq_config = {
|
||||
.hla = {
|
||||
.addr = 0x12,
|
||||
.mask = BIT(5),
|
||||
},
|
||||
.od = {
|
||||
.addr = 0x12,
|
||||
.mask = BIT(4),
|
||||
},
|
||||
},
|
||||
.shub_settings = {
|
||||
.page_mux = {
|
||||
.addr = 0x01,
|
||||
.mask = BIT(6),
|
||||
},
|
||||
.master_en = {
|
||||
.sec_page = true,
|
||||
.addr = 0x14,
|
||||
.mask = BIT(2),
|
||||
},
|
||||
.pullup_en = {
|
||||
.sec_page = true,
|
||||
.addr = 0x14,
|
||||
.mask = BIT(3),
|
||||
},
|
||||
.aux_sens = {
|
||||
.addr = 0x14,
|
||||
.mask = GENMASK(1, 0),
|
||||
},
|
||||
.wr_once = {
|
||||
.addr = 0x14,
|
||||
.mask = BIT(6),
|
||||
},
|
||||
.num_ext_dev = 3,
|
||||
.shub_out = {
|
||||
.sec_page = true,
|
||||
.addr = 0x02,
|
||||
},
|
||||
.slv0_addr = 0x15,
|
||||
.dw_slv0_addr = 0x21,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
int st_lsm6dsx_set_page(struct st_lsm6dsx_hw *hw, bool enable)
|
||||
|
@ -21,9 +21,9 @@ static const struct regmap_config st_lsm6dsx_i2c_regmap_config = {
|
||||
.val_bits = 8,
|
||||
};
|
||||
|
||||
static int st_lsm6dsx_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int st_lsm6dsx_i2c_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
int hw_id = id->driver_data;
|
||||
struct regmap *regmap;
|
||||
|
||||
@ -117,6 +117,14 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = {
|
||||
.compatible = "st,lsm6dsv16x",
|
||||
.data = (void *)ST_LSM6DSV16X_ID,
|
||||
},
|
||||
{
|
||||
.compatible = "st,lsm6dso16is",
|
||||
.data = (void *)ST_LSM6DSO16IS_ID,
|
||||
},
|
||||
{
|
||||
.compatible = "st,ism330is",
|
||||
.data = (void *)ST_ISM330IS_ID,
|
||||
},
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match);
|
||||
@ -142,6 +150,8 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = {
|
||||
{ ST_LSM6DSTX_DEV_NAME, ST_LSM6DSTX_ID },
|
||||
{ ST_LSM6DSV_DEV_NAME, ST_LSM6DSV_ID },
|
||||
{ ST_LSM6DSV16X_DEV_NAME, ST_LSM6DSV16X_ID },
|
||||
{ ST_LSM6DSO16IS_DEV_NAME, ST_LSM6DSO16IS_ID },
|
||||
{ ST_ISM330IS_DEV_NAME, ST_ISM330IS_ID },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table);
|
||||
@ -152,7 +162,7 @@ static struct i2c_driver st_lsm6dsx_driver = {
|
||||
.pm = pm_sleep_ptr(&st_lsm6dsx_pm_ops),
|
||||
.of_match_table = st_lsm6dsx_i2c_of_match,
|
||||
},
|
||||
.probe = st_lsm6dsx_i2c_probe,
|
||||
.probe_new = st_lsm6dsx_i2c_probe,
|
||||
.id_table = st_lsm6dsx_i2c_id_table,
|
||||
};
|
||||
module_i2c_driver(st_lsm6dsx_driver);
|
||||
|
@ -117,6 +117,14 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = {
|
||||
.compatible = "st,lsm6dsv16x",
|
||||
.data = (void *)ST_LSM6DSV16X_ID,
|
||||
},
|
||||
{
|
||||
.compatible = "st,lsm6dso16is",
|
||||
.data = (void *)ST_LSM6DSO16IS_ID,
|
||||
},
|
||||
{
|
||||
.compatible = "st,ism330is",
|
||||
.data = (void *)ST_ISM330IS_ID,
|
||||
},
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, st_lsm6dsx_spi_of_match);
|
||||
@ -142,6 +150,8 @@ static const struct spi_device_id st_lsm6dsx_spi_id_table[] = {
|
||||
{ ST_LSM6DSTX_DEV_NAME, ST_LSM6DSTX_ID },
|
||||
{ ST_LSM6DSV_DEV_NAME, ST_LSM6DSV_ID },
|
||||
{ ST_LSM6DSV16X_DEV_NAME, ST_LSM6DSV16X_ID },
|
||||
{ ST_LSM6DSO16IS_DEV_NAME, ST_LSM6DSO16IS_ID },
|
||||
{ ST_ISM330IS_DEV_NAME, ST_ISM330IS_ID },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table);
|
||||
|
@ -233,8 +233,7 @@ static const struct iio_info adjd_s311_info = {
|
||||
.write_raw = adjd_s311_write_raw,
|
||||
};
|
||||
|
||||
static int adjd_s311_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int adjd_s311_probe(struct i2c_client *client)
|
||||
{
|
||||
struct adjd_s311_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
@ -271,7 +270,7 @@ static struct i2c_driver adjd_s311_driver = {
|
||||
.driver = {
|
||||
.name = ADJD_S311_DRV_NAME,
|
||||
},
|
||||
.probe = adjd_s311_probe,
|
||||
.probe_new = adjd_s311_probe,
|
||||
.id_table = adjd_s311_id,
|
||||
};
|
||||
module_i2c_driver(adjd_s311_driver);
|
||||
|
@ -774,8 +774,7 @@ static int adux1020_chip_init(struct adux1020_data *data)
|
||||
ADUX1020_MODE_INT_MASK, ADUX1020_MODE_INT_DISABLE);
|
||||
}
|
||||
|
||||
static int adux1020_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int adux1020_probe(struct i2c_client *client)
|
||||
{
|
||||
struct adux1020_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
@ -838,7 +837,7 @@ static struct i2c_driver adux1020_driver = {
|
||||
.name = ADUX1020_DRV_NAME,
|
||||
.of_match_table = adux1020_of_match,
|
||||
},
|
||||
.probe = adux1020_probe,
|
||||
.probe_new = adux1020_probe,
|
||||
.id_table = adux1020_id,
|
||||
};
|
||||
module_i2c_driver(adux1020_driver);
|
||||
|
@ -164,8 +164,7 @@ static const struct iio_info al3010_info = {
|
||||
.attrs = &al3010_attribute_group,
|
||||
};
|
||||
|
||||
static int al3010_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int al3010_probe(struct i2c_client *client)
|
||||
{
|
||||
struct al3010_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
@ -230,7 +229,7 @@ static struct i2c_driver al3010_driver = {
|
||||
.of_match_table = al3010_of_match,
|
||||
.pm = pm_sleep_ptr(&al3010_pm_ops),
|
||||
},
|
||||
.probe = al3010_probe,
|
||||
.probe_new = al3010_probe,
|
||||
.id_table = al3010_id,
|
||||
};
|
||||
module_i2c_driver(al3010_driver);
|
||||
|
@ -187,8 +187,7 @@ static const struct iio_info al3320a_info = {
|
||||
.attrs = &al3320a_attribute_group,
|
||||
};
|
||||
|
||||
static int al3320a_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int al3320a_probe(struct i2c_client *client)
|
||||
{
|
||||
struct al3320a_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
@ -254,7 +253,7 @@ static struct i2c_driver al3320a_driver = {
|
||||
.of_match_table = al3320a_of_match,
|
||||
.pm = pm_sleep_ptr(&al3320a_pm_ops),
|
||||
},
|
||||
.probe = al3320a_probe,
|
||||
.probe_new = al3320a_probe,
|
||||
.id_table = al3320a_id,
|
||||
};
|
||||
|
||||
|
@ -398,8 +398,7 @@ static irqreturn_t apds9300_interrupt_handler(int irq, void *private)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int apds9300_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int apds9300_probe(struct i2c_client *client)
|
||||
{
|
||||
struct apds9300_data *data;
|
||||
struct iio_dev *indio_dev;
|
||||
@ -505,7 +504,7 @@ static struct i2c_driver apds9300_driver = {
|
||||
.name = APDS9300_DRV_NAME,
|
||||
.pm = pm_sleep_ptr(&apds9300_pm_ops),
|
||||
},
|
||||
.probe = apds9300_probe,
|
||||
.probe_new = apds9300_probe,
|
||||
.remove = apds9300_remove,
|
||||
.id_table = apds9300_id,
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user