Skip to content

Commit

Permalink
Merge tag 'iio-for-5.16b' of https://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/jic23/iio into char-misc-next

Jonathan writes:

2nd set of IIO new driver, cleanups and features for the 5.16 cycle

New device support
* adrf6780 microwave upconverter.
  - New driver for this interesting device including bindings.

Features
* lite-on ltr501
  - Add dt-bindings including vendor ID and of_device_id table.
  - Add regulator support.
* sensiron,scd4x
  - Add reporting of channel scale.

Cleanups including fixes for things in this cycle
* Tree wide: Another set of dev_err_probe() introductions to reduce
  noise in logs when deferred probing is needed and provide more debug
  info. Devices included this time:
  - amlogic,meson_saradc
  - capella,cm3605
  - fsl,imx7d
  - maxim,max1118
  - maxim,max1241
  - nxp,lpc18xx
  - qcom,pm8xxxx-xoadc
  - rockchip,saradc
  - sharp,gp2ap002
  - sterricson,ab8500
  - ti,ads7950
* core - iio:buffer
  - Fix a path where a ret value is not intialized.
* channel-mux
  - Add support to mux core subsystem for a settling delay and use
    it in the iio-channel-mux driver.
  - Fix a few dt binding warnings.
* nxp,lpc18xx
  - Convert to devm_ functions for all of probe and drop remove()
* st,lsm6dsx
  - Suppress a warning due to lack of handling of an enum *_MAX entry
    that is just there to get the size.
* st,stm32-adc
  - Add generic channel binding, deprecating the old approach.
  - Add nvmem support to get calibration data for the vrefint channel and
    use it to perform such calibration.
  - Add a binding for sample-time to the generic channel description as it
    can be per channel.
* ti,adc128s052
  - Use devm_ managed functions and drop remove()
* vti,sca3000
  - Use sign_extend32() rather than opencoding.
* xilinx,xadc
  - Drop irq field from state structure as now just used in probe.

* tag 'iio-for-5.16b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (36 commits)
  dt-bindings: iio: frequency: add adrf6780 doc
  iio: frequency: adrf6780: add support for ADRF6780
  iio: chemical: scd4x: Add a scale for the co2 concentration reading
  dt-bindings: iio: io-channel-mux: allow duplicate channel, labels
  dt-bindings: iio: io-channel-mux: add optional #io-channel-cells
  iio: adc: adc128s052: Simplify adc128_probe()
  iio: multiplexer: iio-mux: Support settle-time-us property
  dt-bindings: iio: io-channel-mux: Add property for settle time
  mux: add support for delay after muxing
  iio: adc: stm32-adc: use generic binding for sample-time
  iio: adc: stm32-adc: add vrefint calibration support
  iio: adc: stm32-adc: add support of internal channels
  iio: adc: stm32-adc: add support of generic channels binding
  iio: adc: stm32-adc: split channel init into several routines
  dt-bindings: iio: stm32-adc: add nvmem support for vrefint internal channel
  dt-bindings: iio: stm32-adc: add generic channel binding
  iio: accel: sca3000: Use sign_extend32() instead of opencoding sign extension.
  iio: xilinx-xadc: Remove `irq` field from state struct
  iio: imu: st_lsm6dsx: Avoid potential array overflow in st_lsm6dsx_set_odr()
  iio: light: gp2ap002: Make use of the helper function dev_err_probe()
  ...
  • Loading branch information
Greg Kroah-Hartman committed Oct 24, 2021
2 parents 8210a20 + 77af145 commit b6df1fc
Show file tree
Hide file tree
Showing 34 changed files with 1,467 additions and 250 deletions.
108 changes: 101 additions & 7 deletions Documentation/devicetree/bindings/iio/adc/st,stm32-adc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ patternProperties:
'#io-channel-cells':
const: 1

'#address-cells':
const: 1

'#size-cells':
const: 0

interrupts:
description: |
IRQ Line for the ADC instance. Valid values are:
Expand Down Expand Up @@ -256,6 +262,7 @@ patternProperties:
- 20 channels, numbered from 0 to 19 (for in0..in19) on stm32h7 and
stm32mp1.
$ref: /schemas/types.yaml#/definitions/uint32-array
deprecated: true

st,adc-diff-channels:
description: |
Expand All @@ -265,7 +272,9 @@ patternProperties:
<vinp vinn>, <vinp vinn>,... vinp and vinn are numbered from 0 to 19.
Note: At least one of "st,adc-channels" or "st,adc-diff-channels" is
required. Both properties can be used together. Some channels can be
required if no adc generic channel is defined. These legacy channel
properties are exclusive with adc generic channel bindings.
Both properties can be used together. Some channels can be
used as single-ended and some other ones as differential (mixed). But
channels can't be configured both as single-ended and differential.
$ref: /schemas/types.yaml#/definitions/uint32-matrix
Expand All @@ -279,6 +288,7 @@ patternProperties:
"vinn" indicates negative input number
minimum: 0
maximum: 19
deprecated: true

st,min-sample-time-nsecs:
description:
Expand All @@ -289,6 +299,50 @@ patternProperties:
list, to set sample time resp. for all channels, or independently for
each channel.
$ref: /schemas/types.yaml#/definitions/uint32-array
deprecated: true

nvmem-cells:
items:
- description: Phandle to the calibration vrefint data provided by otp

nvmem-cell-names:
items:
- const: vrefint

patternProperties:
"^channel@([0-9]|1[0-9])$":
type: object
$ref: "adc.yaml"
description: Represents the external channels which are connected to the ADC.

properties:
reg:
items:
minimum: 0
maximum: 19

label:
description: |
Unique name to identify which channel this is.
Reserved label names "vddcore", "vrefint" and "vbat"
are used to identify internal channels with matching names.
diff-channels:
$ref: /schemas/types.yaml#/definitions/uint32-array
items:
minimum: 0
maximum: 19

st,min-sample-time-ns:
description: |
Minimum sampling time in nanoseconds. Depending on hardware (board)
e.g. high/low analog input source impedance, fine tune of ADC
sampling time may be recommended.
required:
- reg

additionalProperties: false

allOf:
- if:
Expand Down Expand Up @@ -369,12 +423,6 @@ patternProperties:

additionalProperties: false

anyOf:
- required:
- st,adc-channels
- required:
- st,adc-diff-channels

required:
- compatible
- reg
Expand Down Expand Up @@ -451,4 +499,50 @@ examples:
// other adc child node follow...
};
- |
// Example 3: with stm32mp157c to setup ADC2 with:
// - internal channels 13, 14, 15.
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/clock/stm32mp1-clks.h>
adc122: adc@48003000 {
compatible = "st,stm32mp1-adc-core";
reg = <0x48003000 0x400>;
interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc ADC12>, <&rcc ADC12_K>;
clock-names = "bus", "adc";
booster-supply = <&booster>;
vdd-supply = <&vdd>;
vdda-supply = <&vdda>;
vref-supply = <&vref>;
st,syscfg = <&syscfg>;
interrupt-controller;
#interrupt-cells = <1>;
#address-cells = <1>;
#size-cells = <0>;
adc@100 {
compatible = "st,stm32mp1-adc";
#io-channel-cells = <1>;
reg = <0x100>;
interrupts = <1>;
#address-cells = <1>;
#size-cells = <0>;
channel@13 {
reg = <13>;
label = "vrefint";
st,min-sample-time-ns = <9000>;
};
channel@14 {
reg = <14>;
label = "vddcore";
st,min-sample-time-ns = <9000>;
};
channel@15 {
reg = <15>;
label = "vbat";
st,min-sample-time-ns = <9000>;
};
};
};
...
131 changes: 131 additions & 0 deletions Documentation/devicetree/bindings/iio/frequency/adi,adrf6780.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/frequency/adi,adrf6780.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: ADRF6780 Microwave Upconverter

maintainers:
- Antoniu Miclaus <antoniu.miclaus@analog.com>

description: |
Wideband, microwave upconverter optimized for point to point microwave
radio designs operating in the 5.9 GHz to 23.6 GHz frequency range.
https://www.analog.com/en/products/adrf6780.html
properties:
compatible:
enum:
- adi,adrf6780

reg:
maxItems: 1

spi-max-frequency:
maximum: 1000000

clocks:
description:
Definition of the external clock.
minItems: 1

clock-names:
items:
- const: lo_in

clock-output-names:
maxItems: 1

adi,vga-buff-en:
description:
RF Variable Gain Amplifier Buffer Enable. Gain is controlled by
the voltage on the VATT pin.
type: boolean

adi,lo-buff-en:
description:
Local Oscillator Amplifier Enable. Disable to put the part in
a power down state.
type: boolean

adi,if-mode-en:
description:
Intermediate Frequency Mode Enable. Either IF Mode or I/Q Mode
can be enabled at a time.
type: boolean

adi,iq-mode-en:
description:
I/Q Mode Enable. Either IF Mode or I/Q Mode can be enabled at a
time.
type: boolean

adi,lo-x2-en:
description:
Double the Local Oscillator output frequency from the Local
Oscillator Input Frequency. Either LOx1 or LOx2 can be enabled
at a time.
type: boolean

adi,lo-ppf-en:
description:
Local Oscillator input frequency equal to the Local Oscillator
output frequency (LO x1). Either LOx1 or LOx2 can be enabled
at a time.
type: boolean

adi,lo-en:
description:
Enable additional cirtuitry in the LO chain. Disable to put the
part in a power down state.
type: boolean

adi,uc-bias-en:
description:
Enable all bias circuitry thourghout the entire part.
Disable to put the part in a power down state.
type: boolean

adi,lo-sideband:
description:
Switch to the Lower LO Sideband. By default the Upper LO
sideband is enabled.
type: boolean

adi,vdet-out-en:
description:
VDET Output Select Enable. Expose the RF detector output to the
VDET external pin.
type: boolean

'#clock-cells':
const: 0

dependencies:
adi,lo-x2-en: [ "adi,lo-en" ]
adi,lo-ppf-en: [ "adi,lo-en" ]

required:
- compatible
- reg
- clocks
- clock-names

additionalProperties: false

examples:
- |
spi {
#address-cells = <1>;
#size-cells = <0>;
adrf6780@0 {
compatible = "adi,adrf6780";
reg = <0>;
spi-max-frequency = <1000000>;
clocks = <&adrf6780_lo>;
clock-names = "lo_in";
};
};
...
51 changes: 51 additions & 0 deletions Documentation/devicetree/bindings/iio/light/liteon,ltr501.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/light/liteon,ltr501.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: LiteON LTR501 I2C Proximity and Light sensor

maintainers:
- Nikita Travkin <nikita@trvn.ru>

properties:
compatible:
enum:
- liteon,ltr501
- liteon,ltr559
- liteon,ltr301

reg:
maxItems: 1

vdd-supply: true
vddio-supply: true

interrupts:
maxItems: 1

additionalProperties: false

required:
- compatible
- reg

examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
light-sensor@23 {
compatible = "liteon,ltr559";
reg = <0x23>;
vdd-supply = <&pm8916_l17>;
vddio-supply = <&pm8916_l6>;
interrupt-parent = <&msmgpio>;
interrupts = <115 IRQ_TYPE_EDGE_FALLING>;
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,18 @@ properties:
mux-control-names: true

channels:
$ref: /schemas/types.yaml#/definitions/string-array
$ref: /schemas/types.yaml#/definitions/non-unique-string-array
description:
List of strings, labeling the mux controller states.
List of strings, labeling the mux controller states. An empty
string for a state means that the channel is not available.

settle-time-us:
default: 0
description:
Time required for analog signals to settle after muxing.

"#io-channel-cells":
const: 1

required:
- compatible
Expand Down
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/vendor-prefixes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,8 @@ patternProperties:
description: Linux-specific binding
"^linx,.*":
description: Linx Technologies
"^liteon,.*":
description: LITE-ON Technology Corp.
"^litex,.*":
description: LiteX SoC builder
"^lltc,.*":
Expand Down
3 changes: 1 addition & 2 deletions drivers/iio/accel/sca3000.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,7 @@ static int sca3000_read_raw(struct iio_dev *indio_dev,
return ret;
}
*val = (be16_to_cpup((__be16 *)st->rx) >> 3) & 0x1FFF;
*val = ((*val) << (sizeof(*val) * 8 - 13)) >>
(sizeof(*val) * 8 - 13);
*val = sign_extend32(*val, 12);
} else {
/* get the temperature when available */
ret = sca3000_read_data_short(st,
Expand Down
Loading

0 comments on commit b6df1fc

Please sign in to comment.