Commit fba51482 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'iio-for-6.4a' of...

Merge tag 'iio-for-6.4a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

1st set of IIO new device support, features and cleanups for the 6.4 cycle.

New device support
* bosch,bmp280
  - Add support for BMP580 - includes significant refactoring and general
    driver cleanup + support for non-volatile memory for trimming and config
    parameters.
* rohm BU27034
  - New driver for this 3 channel ambient light sensor.
  - New support library for devices where both integration time and
    amplifier gain are configurable.  In these cases a scale change
    may require changing bother underlying values. This library module
    provides code to help with this.
* st,accel
  - Add support for IIS328DQ (ID only as compatible wtih LIS331DL)
* st,lsm6dsx
  - Add support for ASM330LHB automotive MEMS sensor.
* ti,ads1100, ads1000
  - New driver for these 16 bit ADCs.
* ti,tmp117
  - Add support for older tmp116 device. Includes some general driver cleanup.

Staging driver drops
* adi,ade7854
  - Driver was a very long way from compliant with IIO infrastructure and ABI.
    If anyone wants a non staging version of this driver they are better off
    starting from scratch. Hence drop it and the associated meter.h header.

Features
* adi,ad7441r
  - Add DT binding to set sink current for digital input.
* semtech,sx9324,9360
  - Support older register mapping from firmware designed for windows.

Core improvements.
* Move iio_trigger_poll() docs to next to the implementation and add a note
  on expected caller context.
* Rename iio_trigger_poll_chained() to iio_trigger_poll_nested() so
  as to use more standard / common terminology.
* Improve main ABI docs references to offset and scale for raw values by
  making them consistent and clear.

Cleanups and minor fixes:
* adi,ad5592r
  - Add GPIO names - useful for debug.
* adi,ad7441r
  - Fix current input, loop powered mode configuration setup.
* adi,adis16475
  - Fix wrong commented value for minimum advised lower rate.
* adi,admv1013
  - Use devm_clk_get_enabled() to reduce boilerplate.
* adi,ads1210
  - Fix wrong bits for writing config register (late fix and has
    been broken a long time so not rushed upstream)
* amlogic,meson-saradc
  - Improve cleanup in error handling if BL30 handshake fails.
* apex-embedded,stx104
  - Migrate to regmap and use regmap_read_poll_timeout() to neatly handle
    retries.
  - Add local mutex to close various races.
  - Use define U16_MAX rather than value for limit.
  - Improve code readability with minor reorganization.
* atmel,ad91-sama5d2
  - Drop trivial dead code.
* kionix,kx022a
  - Drop unused structure element.
* linear,ltc2983
  - Reorganize bindings doc to enable unevaluatedProperties to be set
    in one place for all child nodes.
  - Make binding for adi,custom-thermocouple accept signed values.
* maxim,max44000
  - Add OF Device matching (of_match_table was not correctly set).
* maxim,max5522
  - Missing static
* measurement-computing,cio-dac
  - Fix wrong part name in comments.
  - Migrate to regmap.
  - Improve includes by replacing bitops.h with more direct bits.h
* qcom,pm8xxx-xoadc
  - Remove a check that can never fail.
* renesas,rcar-gyroadc
  - DT binding documentation improvements.
  - Tidy up an unused warning with __maybe_unused.
* semtech,sx_common
  - Drop docs for a structure element that doesn't exist.
* semtech,sx9500
  - Drop ACPI_PTR() and of_match_ptr() protections that just complicate
    the code / block some firmware registration types that would otherwise
    work.
* sensiron,sps30
  - Comment formatting tidy up.
* st,sensors
  - Drop duplicate text in DT binding.
* st,stm32-adc
  - Add some missing static markings.
* ti,ads1100
  - Use correct return code in dev_err_probe() call.
* x-powers,axp20x_adc - precursor series to simplify addition of AXP192.
  - General code cleanup / minor refactoring for better readabilty of code.
  - Switch from boolean value to mask for adc_en2 field to avoid hard coding
    a mask that will be different in AXP192

* tag 'iio-for-6.4a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (63 commits)
  MAINTAINERS: Add ROHM BU27034
  iio: light: ROHM BU27034 Ambient Light Sensor
  dt-bindings: iio: light: Support ROHM BU27034
  MAINTAINERS: Add IIO gain-time-scale helpers
  iio: light: Add gain-time-scale helpers
  doc: Make sysfs-bus-iio doc more exact
  iio: dac: set variable max5522_channels storage-class-specifier to static
  dt-bindings: iio: temperature: ltc2983: Make 'adi,custom-thermocouple' signed
  dt-bindings: iio: temperature: ltc2983: Fix child node unevaluated properties
  iio: addac: stx104: Use regmap_read_poll_timeout() for conversion poll
  iio: addac: stx104: Migrate to the regmap API
  iio: addac: stx104: Improve indentation in stx104_write_raw()
  iio: addac: stx104: Use define rather than hardcoded limit for write val
  iio: addac: stx104: Fix race condition when converting analog-to-digital
  iio: addac: stx104: Fix race condition for stx104_write_raw()
  dt-bindings: iio: st-sensors: Fix repeated text
  staging: iio: resolver: ads1210: fix config mode
  iio: adc: ti-ads1100: fix error code in probe()
  iio: accel: add support for IIS328DQ variant
  dt-bindings: iio: st-sensors: Add IIS328DQ accelerometer
  ...
parents 5790d407 c86b0e73
...@@ -1807,8 +1807,8 @@ What: /sys/bus/iio/devices/iio:deviceX/out_resistanceX_raw ...@@ -1807,8 +1807,8 @@ What: /sys/bus/iio/devices/iio:deviceX/out_resistanceX_raw
KernelVersion: 4.3 KernelVersion: 4.3
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
Description: Description:
Raw (unscaled no offset etc.) resistance reading that can be processed Raw (unscaled no offset etc.) resistance reading.
into an ohm value. Units after application of scale and offset are ohms.
What: /sys/bus/iio/devices/iio:deviceX/heater_enable What: /sys/bus/iio/devices/iio:deviceX/heater_enable
KernelVersion: 4.1.0 KernelVersion: 4.1.0
...@@ -1894,8 +1894,9 @@ What: /sys/bus/iio/devices/iio:deviceX/in_electricalconductivity_raw ...@@ -1894,8 +1894,9 @@ What: /sys/bus/iio/devices/iio:deviceX/in_electricalconductivity_raw
KernelVersion: 4.8 KernelVersion: 4.8
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
Description: Description:
Raw (unscaled no offset etc.) electric conductivity reading that Raw (unscaled no offset etc.) electric conductivity reading.
can be processed to siemens per meter. Units after application of scale and offset are siemens per
meter.
What: /sys/bus/iio/devices/iio:deviceX/in_countY_raw What: /sys/bus/iio/devices/iio:deviceX/in_countY_raw
KernelVersion: 4.10 KernelVersion: 4.10
...@@ -1951,8 +1952,8 @@ What: /sys/bus/iio/devices/iio:deviceX/in_phaseY_raw ...@@ -1951,8 +1952,8 @@ What: /sys/bus/iio/devices/iio:deviceX/in_phaseY_raw
KernelVersion: 4.18 KernelVersion: 4.18
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
Description: Description:
Raw (unscaled) phase difference reading from channel Y Raw (unscaled) phase difference reading from channel Y.
that can be processed to radians. Units after application of scale and offset are radians.
What: /sys/bus/iio/devices/iio:deviceX/in_massconcentration_pm1_input What: /sys/bus/iio/devices/iio:deviceX/in_massconcentration_pm1_input
What: /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm1_input What: /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm1_input
......
...@@ -34,9 +34,11 @@ properties: ...@@ -34,9 +34,11 @@ properties:
clock-names: clock-names:
const: fck const: fck
power-domains: true power-domains:
maxItems: 1
resets: true resets:
maxItems: 1
"#address-cells": "#address-cells":
const: 1 const: 1
...@@ -51,6 +53,8 @@ required: ...@@ -51,6 +53,8 @@ required:
- reg - reg
- clocks - clocks
- clock-names - clock-names
- power-domains
- resets
- "#address-cells" - "#address-cells"
- "#size-cells" - "#size-cells"
...@@ -108,21 +112,16 @@ patternProperties: ...@@ -108,21 +112,16 @@ patternProperties:
examples: examples:
- | - |
#include <dt-bindings/clock/r8a7791-clock.h> #include <dt-bindings/clock/r8a7791-cpg-mssr.h>
#include <dt-bindings/power/r8a7791-sysc.h> #include <dt-bindings/power/r8a7791-sysc.h>
soc {
#address-cells = <2>;
#size-cells = <2>;
adc@e6e54000 { adc@e6e54000 {
compatible = "renesas,r8a7791-gyroadc", "renesas,rcar-gyroadc"; compatible = "renesas,r8a7791-gyroadc", "renesas,rcar-gyroadc";
reg = <0 0xe6e54000 0 64>; reg = <0xe6e54000 64>;
clocks = <&mstp9_clks R8A7791_CLK_GYROADC>; clocks = <&cpg CPG_MOD 901>;
clock-names = "fck"; clock-names = "fck";
power-domains = <&sysc R8A7791_PD_ALWAYS_ON>; power-domains = <&sysc R8A7791_PD_ALWAYS_ON>;
resets = <&cpg 901>;
pinctrl-0 = <&adc_pins>;
pinctrl-names = "default";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
...@@ -139,5 +138,4 @@ examples: ...@@ -139,5 +138,4 @@ examples:
vref-supply = <&vref_max1162>; vref-supply = <&vref_max1162>;
}; };
}; };
};
... ...
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/adc/ti,ads1100.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: TI ADS1100/ADS1000 single channel I2C analog to digital converter
maintainers:
- Mike Looijmans <mike.looijmans@topic.nl>
description: |
Datasheet at: https://www.ti.com/lit/gpn/ads1100
properties:
compatible:
enum:
- ti,ads1100
- ti,ads1000
reg:
maxItems: 1
vdd-supply: true
"#io-channel-cells":
const: 0
required:
- compatible
- reg
additionalProperties: false
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
adc@49 {
compatible = "ti,ads1100";
reg = <0x49>;
};
};
...
...@@ -101,6 +101,15 @@ patternProperties: ...@@ -101,6 +101,15 @@ patternProperties:
When not configured as a comparator, the GPO will be treated as an When not configured as a comparator, the GPO will be treated as an
output-only GPIO. output-only GPIO.
drive-strength-microamp:
description: |
For channels configured as digital input, this configures the sink
current.
minimum: 0
maximum: 1800
default: 0
multipleOf: 120
required: required:
- reg - reg
......
...@@ -46,6 +46,9 @@ properties: ...@@ -46,6 +46,9 @@ properties:
- items: - items:
- const: st,ism330is - const: st,ism330is
- const: st,lsm6dso16is - const: st,lsm6dso16is
- items:
- const: st,asm330lhb
- const: st,asm330lhh
reg: reg:
maxItems: 1 maxItems: 1
......
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/light/rohm,bu27034.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROHM BU27034 ambient light sensor
maintainers:
- Matti Vaittinen <mazziesaccount@gmail.com>
description: |
ROHM BU27034 is an ambient light sesnor with 3 channels and 3 photo diodes
capable of detecting a very wide range of illuminance. Typical application
is adjusting LCD and backlight power of TVs and mobile phones.
https://fscdn.rohm.com/en/products/databook/datasheet/ic/sensor/light/bu27034nuc-e.pdf
properties:
compatible:
const: rohm,bu27034
reg:
maxItems: 1
vdd-supply: true
required:
- compatible
- reg
additionalProperties: false
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
light-sensor@38 {
compatible = "rohm,bu27034";
reg = <0x38>;
vdd-supply = <&vdd>;
};
};
...
...@@ -17,6 +17,7 @@ description: | ...@@ -17,6 +17,7 @@ description: |
https://www.bosch-sensortec.com/bst/products/all_products/bmp280 https://www.bosch-sensortec.com/bst/products/all_products/bmp280
https://www.bosch-sensortec.com/bst/products/all_products/bme280 https://www.bosch-sensortec.com/bst/products/all_products/bme280
https://www.bosch-sensortec.com/bst/products/all_products/bmp380 https://www.bosch-sensortec.com/bst/products/all_products/bmp380
https://www.bosch-sensortec.com/bst/products/all_products/bmp580
properties: properties:
compatible: compatible:
...@@ -26,6 +27,7 @@ properties: ...@@ -26,6 +27,7 @@ properties:
- bosch,bmp280 - bosch,bmp280
- bosch,bme280 - bosch,bme280
- bosch,bmp380 - bosch,bmp380
- bosch,bmp580
reg: reg:
maxItems: 1 maxItems: 1
......
...@@ -11,9 +11,6 @@ description: The STMicroelectronics sensor devices are pretty straight-forward ...@@ -11,9 +11,6 @@ description: The STMicroelectronics sensor devices are pretty straight-forward
what type of sensor it is. what type of sensor it is.
Note that whilst this covers many STMicro MEMs sensors, some more complex Note that whilst this covers many STMicro MEMs sensors, some more complex
IMUs need their own bindings. IMUs need their own bindings.
The STMicroelectronics sensor devices are pretty straight-forward I2C or
SPI devices, all sharing the same device tree descriptions no matter what
type of sensor it is.
maintainers: maintainers:
- Denis Ciocca <denis.ciocca@st.com> - Denis Ciocca <denis.ciocca@st.com>
...@@ -48,6 +45,9 @@ properties: ...@@ -48,6 +45,9 @@ properties:
- st,lsm330d-accel - st,lsm330d-accel
- st,lsm330dl-accel - st,lsm330dl-accel
- st,lsm330dlc-accel - st,lsm330dlc-accel
- items:
- const: st,iis328dq
- const: st,h3lis331dl-accel
- description: Silan Accelerometers - description: Silan Accelerometers
enum: enum:
- silan,sc7a20 - silan,sc7a20
......
...@@ -18,6 +18,28 @@ description: | ...@@ -18,6 +18,28 @@ description: |
https://www.analog.com/media/en/technical-documentation/data-sheets/29861fa.pdf https://www.analog.com/media/en/technical-documentation/data-sheets/29861fa.pdf
https://www.analog.com/media/en/technical-documentation/data-sheets/ltm2985.pdf https://www.analog.com/media/en/technical-documentation/data-sheets/ltm2985.pdf
$defs:
sensor-node:
type: object
description: Sensor node common constraints
properties:
reg:
description:
Channel number. Connects the sensor to the channel with this number
of the device.
minimum: 1
maximum: 20
adi,sensor-type:
description: Type of sensor connected to the device.
$ref: /schemas/types.yaml#/definitions/uint32
required:
- reg
- adi,sensor-type
properties: properties:
compatible: compatible:
oneOf: oneOf:
...@@ -64,28 +86,10 @@ properties: ...@@ -64,28 +86,10 @@ properties:
const: 0 const: 0
patternProperties: patternProperties:
"@([0-9a-f]+)$":
type: object
description: Sensor.
properties:
reg:
description:
Channel number. Connects the sensor to the channel with this number
of the device.
minimum: 1
maximum: 20
adi,sensor-type:
description: Type of sensor connected to the device.
$ref: /schemas/types.yaml#/definitions/uint32
required:
- reg
- adi,sensor-type
"^thermocouple@": "^thermocouple@":
type: object $ref: '#/$defs/sensor-node'
unevaluatedProperties: false
description: Thermocouple sensor. description: Thermocouple sensor.
properties: properties:
...@@ -123,7 +127,7 @@ patternProperties: ...@@ -123,7 +127,7 @@ patternProperties:
description: description:
Used for digitizing custom thermocouples. Used for digitizing custom thermocouples.
See Page 59 of the datasheet. See Page 59 of the datasheet.
$ref: /schemas/types.yaml#/definitions/uint64-matrix $ref: /schemas/types.yaml#/definitions/int64-matrix
minItems: 3 minItems: 3
maxItems: 64 maxItems: 64
items: items:
...@@ -141,7 +145,9 @@ patternProperties: ...@@ -141,7 +145,9 @@ patternProperties:
- adi,custom-thermocouple - adi,custom-thermocouple
"^diode@": "^diode@":
type: object $ref: '#/$defs/sensor-node'
unevaluatedProperties: false
description: Diode sensor. description: Diode sensor.
properties: properties:
...@@ -184,7 +190,8 @@ patternProperties: ...@@ -184,7 +190,8 @@ patternProperties:
default: 0 default: 0
"^rtd@": "^rtd@":
type: object $ref: '#/$defs/sensor-node'
unevaluatedProperties: false
description: RTD sensor. description: RTD sensor.
properties: properties:
...@@ -282,7 +289,8 @@ patternProperties: ...@@ -282,7 +289,8 @@ patternProperties:
- adi,custom-rtd - adi,custom-rtd
"^thermistor@": "^thermistor@":
type: object $ref: '#/$defs/sensor-node'
unevaluatedProperties: false
description: Thermistor sensor. description: Thermistor sensor.
properties: properties:
...@@ -383,7 +391,8 @@ patternProperties: ...@@ -383,7 +391,8 @@ patternProperties:
- adi,custom-thermistor - adi,custom-thermistor
"^adc@": "^adc@":
type: object $ref: '#/$defs/sensor-node'
unevaluatedProperties: false
description: Direct ADC sensor. description: Direct ADC sensor.
properties: properties:
...@@ -397,7 +406,8 @@ patternProperties: ...@@ -397,7 +406,8 @@ patternProperties:
type: boolean type: boolean
"^temp@": "^temp@":
type: object $ref: '#/$defs/sensor-node'
unevaluatedProperties: false
description: Active analog temperature sensor. description: Active analog temperature sensor.
properties: properties:
...@@ -426,7 +436,8 @@ patternProperties: ...@@ -426,7 +436,8 @@ patternProperties:
- adi,custom-temp - adi,custom-temp
"^rsense@": "^rsense@":
type: object $ref: '#/$defs/sensor-node'
unevaluatedProperties: false
description: Sense resistor sensor. description: Sense resistor sensor.
properties: properties:
......
...@@ -7,9 +7,10 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# ...@@ -7,9 +7,10 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: TI TMP117 - Digital temperature sensor with integrated NV memory title: TI TMP117 - Digital temperature sensor with integrated NV memory
description: | description: |
TI TMP117 - Digital temperature sensor with integrated NV memory that supports TI TMP116/117 - Digital temperature sensor with integrated NV memory that
I2C interface. supports I2C interface.
https://www.ti.com/lit/gpn/tmp1 https://www.ti.com/lit/gpn/tmp116
https://www.ti.com/lit/gpn/tmp117
maintainers: maintainers:
- Puranjay Mohan <puranjay12@gmail.com> - Puranjay Mohan <puranjay12@gmail.com>
...@@ -17,6 +18,7 @@ maintainers: ...@@ -17,6 +18,7 @@ maintainers:
properties: properties:
compatible: compatible:
enum: enum:
- ti,tmp116
- ti,tmp117 - ti,tmp117
reg: reg:
......
...@@ -9947,6 +9947,13 @@ F: Documentation/ABI/testing/sysfs-bus-iio-adc-envelope-detector ...@@ -9947,6 +9947,13 @@ F: Documentation/ABI/testing/sysfs-bus-iio-adc-envelope-detector
F: Documentation/devicetree/bindings/iio/adc/envelope-detector.yaml F: Documentation/devicetree/bindings/iio/adc/envelope-detector.yaml
F: drivers/iio/adc/envelope-detector.c F: drivers/iio/adc/envelope-detector.c
IIO LIGHT SENSOR GAIN-TIME-SCALE HELPERS
M: Matti Vaittinen <mazziesaccount@gmail.com>
L: linux-iio@vger.kernel.org
S: Maintained
F: drivers/iio/light/gain-time-scale-helper.c
F: drivers/iio/light/gain-time-scale-helper.h
IIO MULTIPLEXER IIO MULTIPLEXER
M: Peter Rosin <peda@axentia.se> M: Peter Rosin <peda@axentia.se>
L: linux-iio@vger.kernel.org L: linux-iio@vger.kernel.org
...@@ -18092,6 +18099,12 @@ S: Maintained ...@@ -18092,6 +18099,12 @@ S: Maintained
F: Documentation/devicetree/bindings/iio/light/bh1750.yaml F: Documentation/devicetree/bindings/iio/light/bh1750.yaml
F: drivers/iio/light/bh1750.c F: drivers/iio/light/bh1750.c
ROHM BU27034 AMBIENT LIGHT SENSOR DRIVER
M: Matti Vaittinen <mazziesaccount@gmail.com>
L: linux-iio@vger.kernel.org
S: Supported
F: drivers/iio/light/rohm-bu27034.c
ROHM MULTIFUNCTION BD9571MWV-M PMIC DEVICE DRIVERS ROHM MULTIFUNCTION BD9571MWV-M PMIC DEVICE DRIVERS
M: Marek Vasut <marek.vasut+renesas@gmail.com> M: Marek Vasut <marek.vasut+renesas@gmail.com>
L: linux-kernel@vger.kernel.org L: linux-kernel@vger.kernel.org
......
...@@ -30,6 +30,9 @@ config IIO_CONFIGFS ...@@ -30,6 +30,9 @@ config IIO_CONFIGFS
(e.g. software triggers). For more info see (e.g. software triggers). For more info see
Documentation/iio/iio_configfs.rst. Documentation/iio/iio_configfs.rst.
config IIO_GTS_HELPER
tristate
config IIO_TRIGGER config IIO_TRIGGER
bool "Enable triggered sampling support" bool "Enable triggered sampling support"
help help
......
...@@ -9,6 +9,7 @@ industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o ...@@ -9,6 +9,7 @@ industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o
industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o
obj-$(CONFIG_IIO_CONFIGFS) += industrialio-configfs.o obj-$(CONFIG_IIO_CONFIGFS) += industrialio-configfs.o
obj-$(CONFIG_IIO_GTS_HELPER) += industrialio-gts-helper.o
obj-$(CONFIG_IIO_SW_DEVICE) += industrialio-sw-device.o obj-$(CONFIG_IIO_SW_DEVICE) += industrialio-sw-device.o
obj-$(CONFIG_IIO_SW_TRIGGER) += industrialio-sw-trigger.o obj-$(CONFIG_IIO_SW_TRIGGER) += industrialio-sw-trigger.o
obj-$(CONFIG_IIO_TRIGGERED_EVENT) += industrialio-triggered-event.o obj-$(CONFIG_IIO_TRIGGERED_EVENT) += industrialio-triggered-event.o
......
...@@ -1688,7 +1688,7 @@ static irqreturn_t bma400_interrupt(int irq, void *private) ...@@ -1688,7 +1688,7 @@ static irqreturn_t bma400_interrupt(int irq, void *private)
if (FIELD_GET(BMA400_INT_DRDY_MSK, le16_to_cpu(data->status))) { if (FIELD_GET(BMA400_INT_DRDY_MSK, le16_to_cpu(data->status))) {
mutex_unlock(&data->mutex); mutex_unlock(&data->mutex);
iio_trigger_poll_chained(data->trig); iio_trigger_poll_nested(data->trig);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -162,7 +162,6 @@ struct kx022a_data { ...@@ -162,7 +162,6 @@ struct kx022a_data {
int inc_reg; int inc_reg;
int ien_reg; int ien_reg;
unsigned int g_range;
unsigned int state; unsigned int state;
unsigned int odr_ns; unsigned int odr_ns;
...@@ -900,7 +899,7 @@ static irqreturn_t kx022a_irq_thread_handler(int irq, void *private) ...@@ -900,7 +899,7 @@ static irqreturn_t kx022a_irq_thread_handler(int irq, void *private)
mutex_lock(&data->mutex); mutex_lock(&data->mutex);
if (data->trigger_enabled) { if (data->trigger_enabled) {
iio_trigger_poll_chained(data->trig); iio_trigger_poll_nested(data->trig);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} }
......
...@@ -1067,7 +1067,7 @@ static irqreturn_t mma8452_interrupt(int irq, void *p) ...@@ -1067,7 +1067,7 @@ static irqreturn_t mma8452_interrupt(int irq, void *p)
return IRQ_NONE; return IRQ_NONE;
if (src & MMA8452_INT_DRDY) { if (src & MMA8452_INT_DRDY) {
iio_trigger_poll_chained(indio_dev->trig); iio_trigger_poll_nested(indio_dev->trig);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} }
......
...@@ -951,7 +951,7 @@ static irqreturn_t msa311_irq_thread(int irq, void *p) ...@@ -951,7 +951,7 @@ static irqreturn_t msa311_irq_thread(int irq, void *p)
} }
if (new_data_int_enabled) if (new_data_int_enabled)
iio_trigger_poll_chained(msa311->new_data_trig); iio_trigger_poll_nested(msa311->new_data_trig);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#define LIS302DL_ACCEL_DEV_NAME "lis302dl" #define LIS302DL_ACCEL_DEV_NAME "lis302dl"
#define LSM303C_ACCEL_DEV_NAME "lsm303c_accel" #define LSM303C_ACCEL_DEV_NAME "lsm303c_accel"
#define SC7A20_ACCEL_DEV_NAME "sc7a20" #define SC7A20_ACCEL_DEV_NAME "sc7a20"
#define IIS328DQ_ACCEL_DEV_NAME "iis328dq"
#ifdef CONFIG_IIO_BUFFER #ifdef CONFIG_IIO_BUFFER
......
...@@ -517,6 +517,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { ...@@ -517,6 +517,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
.sensors_supported = { .sensors_supported = {
[0] = H3LIS331DL_ACCEL_DEV_NAME, [0] = H3LIS331DL_ACCEL_DEV_NAME,
[1] = IIS328DQ_ACCEL_DEV_NAME,
}, },
.ch = (struct iio_chan_spec *)st_accel_12bit_channels, .ch = (struct iio_chan_spec *)st_accel_12bit_channels,
.odr = { .odr = {
......
...@@ -119,6 +119,10 @@ static const struct of_device_id st_accel_of_match[] = { ...@@ -119,6 +119,10 @@ static const struct of_device_id st_accel_of_match[] = {
.compatible = "silan,sc7a20", .compatible = "silan,sc7a20",
.data = SC7A20_ACCEL_DEV_NAME, .data = SC7A20_ACCEL_DEV_NAME,
}, },
{
.compatible = "st,iis328dq",
.data = IIS328DQ_ACCEL_DEV_NAME,
},
{}, {},
}; };
MODULE_DEVICE_TABLE(of, st_accel_of_match); MODULE_DEVICE_TABLE(of, st_accel_of_match);
...@@ -157,6 +161,7 @@ static const struct i2c_device_id st_accel_id_table[] = { ...@@ -157,6 +161,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
{ LIS302DL_ACCEL_DEV_NAME }, { LIS302DL_ACCEL_DEV_NAME },
{ LSM303C_ACCEL_DEV_NAME }, { LSM303C_ACCEL_DEV_NAME },
{ SC7A20_ACCEL_DEV_NAME }, { SC7A20_ACCEL_DEV_NAME },
{ IIS328DQ_ACCEL_DEV_NAME },
{}, {},
}; };
MODULE_DEVICE_TABLE(i2c, st_accel_id_table); MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
......
...@@ -100,6 +100,10 @@ static const struct of_device_id st_accel_of_match[] = { ...@@ -100,6 +100,10 @@ static const struct of_device_id st_accel_of_match[] = {
.compatible = "st,lsm303c-accel", .compatible = "st,lsm303c-accel",
.data = LSM303C_ACCEL_DEV_NAME, .data = LSM303C_ACCEL_DEV_NAME,
}, },
{
.compatible = "st,iis328dq",
.data = IIS328DQ_ACCEL_DEV_NAME,
},
{} {}
}; };
MODULE_DEVICE_TABLE(of, st_accel_of_match); MODULE_DEVICE_TABLE(of, st_accel_of_match);
...@@ -157,6 +161,7 @@ static const struct spi_device_id st_accel_id_table[] = { ...@@ -157,6 +161,7 @@ static const struct spi_device_id st_accel_id_table[] = {
{ LIS3DE_ACCEL_DEV_NAME }, { LIS3DE_ACCEL_DEV_NAME },
{ LIS302DL_ACCEL_DEV_NAME }, { LIS302DL_ACCEL_DEV_NAME },
{ LSM303C_ACCEL_DEV_NAME }, { LSM303C_ACCEL_DEV_NAME },
{ IIS328DQ_ACCEL_DEV_NAME },
{}, {},
}; };
MODULE_DEVICE_TABLE(spi, st_accel_id_table); MODULE_DEVICE_TABLE(spi, st_accel_id_table);
......
...@@ -1229,6 +1229,16 @@ config TI_ADS7924 ...@@ -1229,6 +1229,16 @@ config TI_ADS7924
This driver can also be built as a module. If so, the module will be This driver can also be built as a module. If so, the module will be
called ti-ads7924. called ti-ads7924.
config TI_ADS1100
tristate "Texas Instruments ADS1100 and ADS1000 ADC"
depends on I2C
help
If you say yes here you get support for Texas Instruments ADS1100 and
ADS1000 ADC chips.
This driver can also be built as a module. If so, the module will be
called ti-ads1100.
config TI_ADS7950 config TI_ADS7950
tristate "Texas Instruments ADS7950 ADC driver" tristate "Texas Instruments ADS7950 ADC driver"
depends on SPI && GPIOLIB depends on SPI && GPIOLIB
......
...@@ -108,6 +108,7 @@ obj-$(CONFIG_TI_ADC108S102) += ti-adc108s102.o ...@@ -108,6 +108,7 @@ obj-$(CONFIG_TI_ADC108S102) += ti-adc108s102.o
obj-$(CONFIG_TI_ADC128S052) += ti-adc128s052.o obj-$(CONFIG_TI_ADC128S052) += ti-adc128s052.o
obj-$(CONFIG_TI_ADC161S626) += ti-adc161s626.o obj-$(CONFIG_TI_ADC161S626) += ti-adc161s626.o
obj-$(CONFIG_TI_ADS1015) += ti-ads1015.o obj-$(CONFIG_TI_ADS1015) += ti-ads1015.o
obj-$(CONFIG_TI_ADS1100) += ti-ads1100.o
obj-$(CONFIG_TI_ADS7924) += ti-ads7924.o obj-$(CONFIG_TI_ADS7924) += ti-ads7924.o
obj-$(CONFIG_TI_ADS7950) += ti-ads7950.o obj-$(CONFIG_TI_ADS7950) += ti-ads7950.o
obj-$(CONFIG_TI_ADS8344) += ti-ads8344.o obj-$(CONFIG_TI_ADS8344) += ti-ads8344.o
......
...@@ -477,7 +477,7 @@ static irqreturn_t ad7606_interrupt(int irq, void *dev_id) ...@@ -477,7 +477,7 @@ static irqreturn_t ad7606_interrupt(int irq, void *dev_id)
if (iio_buffer_enabled(indio_dev)) { if (iio_buffer_enabled(indio_dev)) {
gpiod_set_value(st->gpio_convst, 0); gpiod_set_value(st->gpio_convst, 0);
iio_trigger_poll_chained(st->trig); iio_trigger_poll_nested(st->trig);
} else { } else {
complete(&st->completion); complete(&st->completion);
} }
......
...@@ -1194,7 +1194,7 @@ static void at91_dma_buffer_done(void *data) ...@@ -1194,7 +1194,7 @@ static void at91_dma_buffer_done(void *data)
{ {
struct iio_dev *indio_dev = data; struct iio_dev *indio_dev = data;
iio_trigger_poll_chained(indio_dev->trig); iio_trigger_poll_nested(indio_dev->trig);
} }
static int at91_adc_dma_start(struct iio_dev *indio_dev) static int at91_adc_dma_start(struct iio_dev *indio_dev)
...@@ -2400,12 +2400,8 @@ static int at91_adc_probe(struct platform_device *pdev) ...@@ -2400,12 +2400,8 @@ static int at91_adc_probe(struct platform_device *pdev)
st->dma_st.phys_addr = res->start; st->dma_st.phys_addr = res->start;
st->irq = platform_get_irq(pdev, 0); st->irq = platform_get_irq(pdev, 0);
if (st->irq <= 0) { if (st->irq < 0)
if (!st->irq)
st->irq = -ENXIO;
return st->irq; return st->irq;
}
st->per_clk = devm_clk_get(&pdev->dev, "adc_clk"); st->per_clk = devm_clk_get(&pdev->dev, "adc_clk");
if (IS_ERR(st->per_clk)) if (IS_ERR(st->per_clk))
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Quentin Schulz <quentin.schulz@free-electrons.com> * Quentin Schulz <quentin.schulz@free-electrons.com>
*/ */
#include <linux/bitfield.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -22,20 +23,20 @@ ...@@ -22,20 +23,20 @@
#include <linux/mfd/axp20x.h> #include <linux/mfd/axp20x.h>
#define AXP20X_ADC_EN1_MASK GENMASK(7, 0) #define AXP20X_ADC_EN1_MASK GENMASK(7, 0)
#define AXP20X_ADC_EN2_MASK (GENMASK(3, 2) | BIT(7)) #define AXP20X_ADC_EN2_MASK (GENMASK(3, 2) | BIT(7))
#define AXP22X_ADC_EN1_MASK (GENMASK(7, 5) | BIT(0)) #define AXP22X_ADC_EN1_MASK (GENMASK(7, 5) | BIT(0))
#define AXP20X_GPIO10_IN_RANGE_GPIO0 BIT(0) #define AXP20X_GPIO10_IN_RANGE_GPIO0 BIT(0)
#define AXP20X_GPIO10_IN_RANGE_GPIO1 BIT(1) #define AXP20X_GPIO10_IN_RANGE_GPIO1 BIT(1)
#define AXP20X_GPIO10_IN_RANGE_GPIO0_VAL(x) ((x) & BIT(0))
#define AXP20X_GPIO10_IN_RANGE_GPIO1_VAL(x) (((x) & BIT(0)) << 1)
#define AXP20X_ADC_RATE_MASK GENMASK(7, 6) #define AXP20X_ADC_RATE_MASK GENMASK(7, 6)
#define AXP813_V_I_ADC_RATE_MASK GENMASK(5, 4)
#define AXP813_ADC_RATE_MASK (AXP20X_ADC_RATE_MASK | AXP813_V_I_ADC_RATE_MASK)
#define AXP20X_ADC_RATE_HZ(x) ((ilog2((x) / 25) << 6) & AXP20X_ADC_RATE_MASK) #define AXP20X_ADC_RATE_HZ(x) ((ilog2((x) / 25) << 6) & AXP20X_ADC_RATE_MASK)
#define AXP22X_ADC_RATE_HZ(x) ((ilog2((x) / 100) << 6) & AXP20X_ADC_RATE_MASK) #define AXP22X_ADC_RATE_HZ(x) ((ilog2((x) / 100) << 6) & AXP20X_ADC_RATE_MASK)
#define AXP813_V_I_ADC_RATE_MASK GENMASK(5, 4)
#define AXP813_ADC_RATE_MASK (AXP20X_ADC_RATE_MASK | AXP813_V_I_ADC_RATE_MASK)
#define AXP813_TS_GPIO0_ADC_RATE_HZ(x) AXP20X_ADC_RATE_HZ(x) #define AXP813_TS_GPIO0_ADC_RATE_HZ(x) AXP20X_ADC_RATE_HZ(x)
#define AXP813_V_I_ADC_RATE_HZ(x) ((ilog2((x) / 100) << 4) & AXP813_V_I_ADC_RATE_MASK) #define AXP813_V_I_ADC_RATE_HZ(x) ((ilog2((x) / 100) << 4) & AXP813_V_I_ADC_RATE_MASK)
#define AXP813_ADC_RATE_HZ(x) (AXP20X_ADC_RATE_HZ(x) | AXP813_V_I_ADC_RATE_HZ(x)) #define AXP813_ADC_RATE_HZ(x) (AXP20X_ADC_RATE_HZ(x) | AXP813_V_I_ADC_RATE_HZ(x))
...@@ -234,7 +235,7 @@ static int axp20x_adc_raw(struct iio_dev *indio_dev, ...@@ -234,7 +235,7 @@ static int axp20x_adc_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val) struct iio_chan_spec const *chan, int *val)
{ {
struct axp20x_adc_iio *info = iio_priv(indio_dev); struct axp20x_adc_iio *info = iio_priv(indio_dev);
int size = 12; int ret, size;
/* /*
* N.B.: Unlike the Chinese datasheets tell, the charging current is * N.B.: Unlike the Chinese datasheets tell, the charging current is
...@@ -246,10 +247,11 @@ static int axp20x_adc_raw(struct iio_dev *indio_dev, ...@@ -246,10 +247,11 @@ static int axp20x_adc_raw(struct iio_dev *indio_dev,
else else
size = 12; size = 12;
*val = axp20x_read_variable_width(info->regmap, chan->address, size); ret = axp20x_read_variable_width(info->regmap, chan->address, size);
if (*val < 0) if (ret < 0)
return *val; return ret;
*val = ret;
return IIO_VAL_INT; return IIO_VAL_INT;
} }
...@@ -257,11 +259,13 @@ static int axp22x_adc_raw(struct iio_dev *indio_dev, ...@@ -257,11 +259,13 @@ static int axp22x_adc_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val) struct iio_chan_spec const *chan, int *val)
{ {
struct axp20x_adc_iio *info = iio_priv(indio_dev); struct axp20x_adc_iio *info = iio_priv(indio_dev);
int ret;
*val = axp20x_read_variable_width(info->regmap, chan->address, 12); ret = axp20x_read_variable_width(info->regmap, chan->address, 12);
if (*val < 0) if (ret < 0)
return *val; return ret;
*val = ret;
return IIO_VAL_INT; return IIO_VAL_INT;
} }
...@@ -269,11 +273,13 @@ static int axp813_adc_raw(struct iio_dev *indio_dev, ...@@ -269,11 +273,13 @@ static int axp813_adc_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val) struct iio_chan_spec const *chan, int *val)
{ {
struct axp20x_adc_iio *info = iio_priv(indio_dev); struct axp20x_adc_iio *info = iio_priv(indio_dev);
int ret;
*val = axp20x_read_variable_width(info->regmap, chan->address, 12); ret = axp20x_read_variable_width(info->regmap, chan->address, 12);
if (*val < 0) if (ret < 0)
return *val; return ret;
*val = ret;
return IIO_VAL_INT; return IIO_VAL_INT;
} }
...@@ -443,27 +449,27 @@ static int axp20x_adc_offset_voltage(struct iio_dev *indio_dev, int channel, ...@@ -443,27 +449,27 @@ static int axp20x_adc_offset_voltage(struct iio_dev *indio_dev, int channel,
int *val) int *val)
{ {
struct axp20x_adc_iio *info = iio_priv(indio_dev); struct axp20x_adc_iio *info = iio_priv(indio_dev);
unsigned int regval;
int ret; int ret;
ret = regmap_read(info->regmap, AXP20X_GPIO10_IN_RANGE, val); ret = regmap_read(info->regmap, AXP20X_GPIO10_IN_RANGE, &regval);
if (ret < 0) if (ret < 0)
return ret; return ret;
switch (channel) { switch (channel) {
case AXP20X_GPIO0_V: case AXP20X_GPIO0_V:
*val &= AXP20X_GPIO10_IN_RANGE_GPIO0; regval = FIELD_GET(AXP20X_GPIO10_IN_RANGE_GPIO0, regval);
break; break;
case AXP20X_GPIO1_V: case AXP20X_GPIO1_V:
*val &= AXP20X_GPIO10_IN_RANGE_GPIO1; regval = FIELD_GET(AXP20X_GPIO10_IN_RANGE_GPIO1, regval);
break; break;
default: default:
return -EINVAL; return -EINVAL;
} }
*val = *val ? 700000 : 0; *val = regval ? 700000 : 0;
return IIO_VAL_INT; return IIO_VAL_INT;
} }
...@@ -548,7 +554,7 @@ static int axp20x_write_raw(struct iio_dev *indio_dev, ...@@ -548,7 +554,7 @@ static int axp20x_write_raw(struct iio_dev *indio_dev,
long mask) long mask)
{ {
struct axp20x_adc_iio *info = iio_priv(indio_dev); struct axp20x_adc_iio *info = iio_priv(indio_dev);
unsigned int reg, regval; unsigned int regmask, regval;
/* /*
* The AXP20X PMIC allows the user to choose between 0V and 0.7V offsets * The AXP20X PMIC allows the user to choose between 0V and 0.7V offsets
...@@ -560,25 +566,22 @@ static int axp20x_write_raw(struct iio_dev *indio_dev, ...@@ -560,25 +566,22 @@ static int axp20x_write_raw(struct iio_dev *indio_dev,
if (val != 0 && val != 700000) if (val != 0 && val != 700000)
return -EINVAL; return -EINVAL;
val = val ? 1 : 0;
switch (chan->channel) { switch (chan->channel) {
case AXP20X_GPIO0_V: case AXP20X_GPIO0_V:
reg = AXP20X_GPIO10_IN_RANGE_GPIO0; regmask = AXP20X_GPIO10_IN_RANGE_GPIO0;
regval = AXP20X_GPIO10_IN_RANGE_GPIO0_VAL(val); regval = FIELD_PREP(AXP20X_GPIO10_IN_RANGE_GPIO0, !!val);
break; break;
case AXP20X_GPIO1_V: case AXP20X_GPIO1_V:
reg = AXP20X_GPIO10_IN_RANGE_GPIO1; regmask = AXP20X_GPIO10_IN_RANGE_GPIO1;
regval = AXP20X_GPIO10_IN_RANGE_GPIO1_VAL(val); regval = FIELD_PREP(AXP20X_GPIO10_IN_RANGE_GPIO1, !!val);
break; break;
default: default:
return -EINVAL; return -EINVAL;
} }
return regmap_update_bits(info->regmap, AXP20X_GPIO10_IN_RANGE, reg, return regmap_update_bits(info->regmap, AXP20X_GPIO10_IN_RANGE, regmask, regval);
regval);
} }
static const struct iio_info axp20x_adc_iio_info = { static const struct iio_info axp20x_adc_iio_info = {
...@@ -620,9 +623,9 @@ struct axp_data { ...@@ -620,9 +623,9 @@ struct axp_data {
int num_channels; int num_channels;
struct iio_chan_spec const *channels; struct iio_chan_spec const *channels;
unsigned long adc_en1_mask; unsigned long adc_en1_mask;
unsigned long adc_en2_mask;
int (*adc_rate)(struct axp20x_adc_iio *info, int (*adc_rate)(struct axp20x_adc_iio *info,
int rate); int rate);
bool adc_en2;
struct iio_map *maps; struct iio_map *maps;
}; };
...@@ -631,8 +634,8 @@ static const struct axp_data axp20x_data = { ...@@ -631,8 +634,8 @@ static const struct axp_data axp20x_data = {
.num_channels = ARRAY_SIZE(axp20x_adc_channels), .num_channels = ARRAY_SIZE(axp20x_adc_channels),
.channels = axp20x_adc_channels, .channels = axp20x_adc_channels,
.adc_en1_mask = AXP20X_ADC_EN1_MASK, .adc_en1_mask = AXP20X_ADC_EN1_MASK,
.adc_en2_mask = AXP20X_ADC_EN2_MASK,
.adc_rate = axp20x_adc_rate, .adc_rate = axp20x_adc_rate,
.adc_en2 = true,
.maps = axp20x_maps, .maps = axp20x_maps,
}; };
...@@ -642,7 +645,6 @@ static const struct axp_data axp22x_data = { ...@@ -642,7 +645,6 @@ static const struct axp_data axp22x_data = {
.channels = axp22x_adc_channels, .channels = axp22x_adc_channels,
.adc_en1_mask = AXP22X_ADC_EN1_MASK, .adc_en1_mask = AXP22X_ADC_EN1_MASK,
.adc_rate = axp22x_adc_rate, .adc_rate = axp22x_adc_rate,
.adc_en2 = false,
.maps = axp22x_maps, .maps = axp22x_maps,
}; };
...@@ -652,7 +654,6 @@ static const struct axp_data axp813_data = { ...@@ -652,7 +654,6 @@ static const struct axp_data axp813_data = {
.channels = axp813_adc_channels, .channels = axp813_adc_channels,
.adc_en1_mask = AXP22X_ADC_EN1_MASK, .adc_en1_mask = AXP22X_ADC_EN1_MASK,
.adc_rate = axp813_adc_rate, .adc_rate = axp813_adc_rate,
.adc_en2 = false,
.maps = axp22x_maps, .maps = axp22x_maps,
}; };
...@@ -710,10 +711,10 @@ static int axp20x_probe(struct platform_device *pdev) ...@@ -710,10 +711,10 @@ static int axp20x_probe(struct platform_device *pdev)
/* Enable the ADCs on IP */ /* Enable the ADCs on IP */
regmap_write(info->regmap, AXP20X_ADC_EN1, info->data->adc_en1_mask); regmap_write(info->regmap, AXP20X_ADC_EN1, info->data->adc_en1_mask);
if (info->data->adc_en2) if (info->data->adc_en2_mask)
/* Enable GPIO0/1 and internal temperature ADCs */
regmap_update_bits(info->regmap, AXP20X_ADC_EN2, regmap_update_bits(info->regmap, AXP20X_ADC_EN2,
AXP20X_ADC_EN2_MASK, AXP20X_ADC_EN2_MASK); info->data->adc_en2_mask,
info->data->adc_en2_mask);
/* Configure ADCs rate */ /* Configure ADCs rate */
info->data->adc_rate(info, 100); info->data->adc_rate(info, 100);
...@@ -738,7 +739,7 @@ static int axp20x_probe(struct platform_device *pdev) ...@@ -738,7 +739,7 @@ static int axp20x_probe(struct platform_device *pdev)
fail_map: fail_map:
regmap_write(info->regmap, AXP20X_ADC_EN1, 0); regmap_write(info->regmap, AXP20X_ADC_EN1, 0);
if (info->data->adc_en2) if (info->data->adc_en2_mask)
regmap_write(info->regmap, AXP20X_ADC_EN2, 0); regmap_write(info->regmap, AXP20X_ADC_EN2, 0);
return ret; return ret;
...@@ -754,7 +755,7 @@ static int axp20x_remove(struct platform_device *pdev) ...@@ -754,7 +755,7 @@ static int axp20x_remove(struct platform_device *pdev)
regmap_write(info->regmap, AXP20X_ADC_EN1, 0); regmap_write(info->regmap, AXP20X_ADC_EN1, 0);
if (info->data->adc_en2) if (info->data->adc_en2_mask)
regmap_write(info->regmap, AXP20X_ADC_EN2, 0); regmap_write(info->regmap, AXP20X_ADC_EN2, 0);
return 0; return 0;
......
...@@ -682,7 +682,7 @@ static irqreturn_t max11410_interrupt(int irq, void *dev_id) ...@@ -682,7 +682,7 @@ static irqreturn_t max11410_interrupt(int irq, void *dev_id)
struct max11410_state *st = iio_priv(indio_dev); struct max11410_state *st = iio_priv(indio_dev);
if (iio_buffer_enabled(indio_dev)) if (iio_buffer_enabled(indio_dev))
iio_trigger_poll_chained(st->trig); iio_trigger_poll_nested(st->trig);
else else
complete(&st->completion); complete(&st->completion);
......
...@@ -957,14 +957,18 @@ static int meson_sar_adc_hw_enable(struct iio_dev *indio_dev) ...@@ -957,14 +957,18 @@ static int meson_sar_adc_hw_enable(struct iio_dev *indio_dev)
return ret; return ret;
} }
static int meson_sar_adc_hw_disable(struct iio_dev *indio_dev) static void meson_sar_adc_hw_disable(struct iio_dev *indio_dev)
{ {
struct meson_sar_adc_priv *priv = iio_priv(indio_dev); struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
int ret; int ret;
/*
* If taking the lock fails we have to assume that BL30 is broken. The
* best we can do then is to release the resources anyhow.
*/
ret = meson_sar_adc_lock(indio_dev); ret = meson_sar_adc_lock(indio_dev);
if (ret) if (ret)
return ret; dev_err(indio_dev->dev.parent, "Failed to lock ADC (%pE)\n", ERR_PTR(ret));
clk_disable_unprepare(priv->adc_clk); clk_disable_unprepare(priv->adc_clk);
...@@ -977,9 +981,8 @@ static int meson_sar_adc_hw_disable(struct iio_dev *indio_dev) ...@@ -977,9 +981,8 @@ static int meson_sar_adc_hw_disable(struct iio_dev *indio_dev)
regulator_disable(priv->vref); regulator_disable(priv->vref);
if (!ret)
meson_sar_adc_unlock(indio_dev); meson_sar_adc_unlock(indio_dev);
return 0;
} }
static irqreturn_t meson_sar_adc_irq(int irq, void *data) static irqreturn_t meson_sar_adc_irq(int irq, void *data)
...@@ -1283,14 +1286,18 @@ static int meson_sar_adc_remove(struct platform_device *pdev) ...@@ -1283,14 +1286,18 @@ static int meson_sar_adc_remove(struct platform_device *pdev)
iio_device_unregister(indio_dev); iio_device_unregister(indio_dev);
return meson_sar_adc_hw_disable(indio_dev); meson_sar_adc_hw_disable(indio_dev);
return 0;
} }
static int meson_sar_adc_suspend(struct device *dev) static int meson_sar_adc_suspend(struct device *dev)
{ {
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
return meson_sar_adc_hw_disable(indio_dev); meson_sar_adc_hw_disable(indio_dev);
return 0;
} }
static int meson_sar_adc_resume(struct device *dev) static int meson_sar_adc_resume(struct device *dev)
......
...@@ -758,7 +758,7 @@ static int pm8xxx_xoadc_parse_channel(struct device *dev, ...@@ -758,7 +758,7 @@ static int pm8xxx_xoadc_parse_channel(struct device *dev,
/* Find the right channel setting */ /* Find the right channel setting */
chid = 0; chid = 0;
hwchan = &hw_channels[0]; hwchan = &hw_channels[0];
while (hwchan && hwchan->datasheet_name) { while (hwchan->datasheet_name) {
if (hwchan->pre_scale_mux == pre_scale_mux && if (hwchan->pre_scale_mux == pre_scale_mux &&
hwchan->amux_channel == amux_channel) hwchan->amux_channel == amux_channel)
break; break;
......
...@@ -283,7 +283,7 @@ static const struct of_device_id rcar_gyroadc_match[] = { ...@@ -283,7 +283,7 @@ static const struct of_device_id rcar_gyroadc_match[] = {
MODULE_DEVICE_TABLE(of, rcar_gyroadc_match); MODULE_DEVICE_TABLE(of, rcar_gyroadc_match);
static const struct of_device_id rcar_gyroadc_child_match[] = { static const struct of_device_id rcar_gyroadc_child_match[] __maybe_unused = {
/* Mode 1 ADCs */ /* Mode 1 ADCs */
{ {
.compatible = "fujitsu,mb88101a", .compatible = "fujitsu,mb88101a",
......
...@@ -2588,7 +2588,7 @@ static const struct stm32_adc_cfg stm32f4_adc_cfg = { ...@@ -2588,7 +2588,7 @@ static const struct stm32_adc_cfg stm32f4_adc_cfg = {
.irq_clear = stm32f4_adc_irq_clear, .irq_clear = stm32f4_adc_irq_clear,
}; };
const unsigned int stm32_adc_min_ts_h7[] = { 0, 0, 0, 4300, 9000 }; static const unsigned int stm32_adc_min_ts_h7[] = { 0, 0, 0, 4300, 9000 };
static_assert(ARRAY_SIZE(stm32_adc_min_ts_h7) == STM32_ADC_INT_CH_NB); static_assert(ARRAY_SIZE(stm32_adc_min_ts_h7) == STM32_ADC_INT_CH_NB);
static const struct stm32_adc_cfg stm32h7_adc_cfg = { static const struct stm32_adc_cfg stm32h7_adc_cfg = {
...@@ -2607,7 +2607,7 @@ static const struct stm32_adc_cfg stm32h7_adc_cfg = { ...@@ -2607,7 +2607,7 @@ static const struct stm32_adc_cfg stm32h7_adc_cfg = {
.ts_int_ch = stm32_adc_min_ts_h7, .ts_int_ch = stm32_adc_min_ts_h7,
}; };
const unsigned int stm32_adc_min_ts_mp1[] = { 100, 100, 100, 4300, 9800 }; static const unsigned int stm32_adc_min_ts_mp1[] = { 100, 100, 100, 4300, 9800 };
static_assert(ARRAY_SIZE(stm32_adc_min_ts_mp1) == STM32_ADC_INT_CH_NB); static_assert(ARRAY_SIZE(stm32_adc_min_ts_mp1) == STM32_ADC_INT_CH_NB);
static const struct stm32_adc_cfg stm32mp1_adc_cfg = { static const struct stm32_adc_cfg stm32mp1_adc_cfg = {
...@@ -2627,7 +2627,7 @@ static const struct stm32_adc_cfg stm32mp1_adc_cfg = { ...@@ -2627,7 +2627,7 @@ static const struct stm32_adc_cfg stm32mp1_adc_cfg = {
.ts_int_ch = stm32_adc_min_ts_mp1, .ts_int_ch = stm32_adc_min_ts_mp1,
}; };
const unsigned int stm32_adc_min_ts_mp13[] = { 100, 0, 0, 4300, 9800 }; static const unsigned int stm32_adc_min_ts_mp13[] = { 100, 0, 0, 4300, 9800 };
static_assert(ARRAY_SIZE(stm32_adc_min_ts_mp13) == STM32_ADC_INT_CH_NB); static_assert(ARRAY_SIZE(stm32_adc_min_ts_mp13) == STM32_ADC_INT_CH_NB);
static const struct stm32_adc_cfg stm32mp13_adc_cfg = { static const struct stm32_adc_cfg stm32mp13_adc_cfg = {
......
This diff is collapsed.
...@@ -35,7 +35,9 @@ config STX104 ...@@ -35,7 +35,9 @@ config STX104
tristate "Apex Embedded Systems STX104 driver" tristate "Apex Embedded Systems STX104 driver"
depends on PC104 && X86 depends on PC104 && X86
select ISA_BUS_API select ISA_BUS_API
select REGMAP_MMIO
select GPIOLIB select GPIOLIB
select GPIO_REGMAP
help help
Say yes here to build support for the Apex Embedded Systems STX104 Say yes here to build support for the Apex Embedded Systems STX104
integrated analog PC/104 card. integrated analog PC/104 card.
......
...@@ -39,6 +39,7 @@ struct ad74413r_chip_info { ...@@ -39,6 +39,7 @@ struct ad74413r_chip_info {
struct ad74413r_channel_config { struct ad74413r_channel_config {
u32 func; u32 func;
u32 drive_strength;
bool gpo_comparator; bool gpo_comparator;
bool initialized; bool initialized;
}; };
...@@ -99,6 +100,7 @@ struct ad74413r_state { ...@@ -99,6 +100,7 @@ struct ad74413r_state {
#define AD74413R_REG_ADC_CONFIG_X(x) (0x05 + (x)) #define AD74413R_REG_ADC_CONFIG_X(x) (0x05 + (x))
#define AD74413R_ADC_CONFIG_RANGE_MASK GENMASK(7, 5) #define AD74413R_ADC_CONFIG_RANGE_MASK GENMASK(7, 5)
#define AD74413R_ADC_CONFIG_REJECTION_MASK GENMASK(4, 3) #define AD74413R_ADC_CONFIG_REJECTION_MASK GENMASK(4, 3)
#define AD74413R_ADC_CONFIG_CH_200K_TO_GND BIT(2)
#define AD74413R_ADC_RANGE_10V 0b000 #define AD74413R_ADC_RANGE_10V 0b000
#define AD74413R_ADC_RANGE_2P5V_EXT_POW 0b001 #define AD74413R_ADC_RANGE_2P5V_EXT_POW 0b001
#define AD74413R_ADC_RANGE_2P5V_INT_POW 0b010 #define AD74413R_ADC_RANGE_2P5V_INT_POW 0b010
...@@ -111,6 +113,7 @@ struct ad74413r_state { ...@@ -111,6 +113,7 @@ struct ad74413r_state {
#define AD74413R_REG_DIN_CONFIG_X(x) (0x09 + (x)) #define AD74413R_REG_DIN_CONFIG_X(x) (0x09 + (x))
#define AD74413R_DIN_DEBOUNCE_MASK GENMASK(4, 0) #define AD74413R_DIN_DEBOUNCE_MASK GENMASK(4, 0)
#define AD74413R_DIN_DEBOUNCE_LEN BIT(5) #define AD74413R_DIN_DEBOUNCE_LEN BIT(5)
#define AD74413R_DIN_SINK_MASK GENMASK(9, 6)
#define AD74413R_REG_DAC_CODE_X(x) (0x16 + (x)) #define AD74413R_REG_DAC_CODE_X(x) (0x16 + (x))
#define AD74413R_DAC_CODE_MAX GENMASK(12, 0) #define AD74413R_DAC_CODE_MAX GENMASK(12, 0)
...@@ -261,6 +264,18 @@ static int ad74413r_set_comp_debounce(struct ad74413r_state *st, ...@@ -261,6 +264,18 @@ static int ad74413r_set_comp_debounce(struct ad74413r_state *st,
val); val);
} }
static int ad74413r_set_comp_drive_strength(struct ad74413r_state *st,
unsigned int offset,
unsigned int strength)
{
strength = min(strength, 1800U);
return regmap_update_bits(st->regmap, AD74413R_REG_DIN_CONFIG_X(offset),
AD74413R_DIN_SINK_MASK,
FIELD_PREP(AD74413R_DIN_SINK_MASK, strength / 120));
}
static void ad74413r_gpio_set(struct gpio_chip *chip, static void ad74413r_gpio_set(struct gpio_chip *chip,
unsigned int offset, int val) unsigned int offset, int val)
{ {
...@@ -424,9 +439,20 @@ static int ad74413r_set_channel_dac_code(struct ad74413r_state *st, ...@@ -424,9 +439,20 @@ static int ad74413r_set_channel_dac_code(struct ad74413r_state *st,
static int ad74413r_set_channel_function(struct ad74413r_state *st, static int ad74413r_set_channel_function(struct ad74413r_state *st,
unsigned int channel, u8 func) unsigned int channel, u8 func)
{ {
return regmap_update_bits(st->regmap, int ret;
ret = regmap_update_bits(st->regmap,
AD74413R_REG_CH_FUNC_SETUP_X(channel), AD74413R_REG_CH_FUNC_SETUP_X(channel),
AD74413R_CH_FUNC_SETUP_MASK, func); AD74413R_CH_FUNC_SETUP_MASK, func);
if (ret)
return ret;
if (func == CH_FUNC_CURRENT_INPUT_LOOP_POWER)
ret = regmap_set_bits(st->regmap,
AD74413R_REG_ADC_CONFIG_X(channel),
AD74413R_ADC_CONFIG_CH_200K_TO_GND);
return ret;
} }
static int ad74413r_set_adc_conv_seq(struct ad74413r_state *st, static int ad74413r_set_adc_conv_seq(struct ad74413r_state *st,
...@@ -1112,6 +1138,11 @@ static struct iio_chan_spec ad74413r_current_input_channels[] = { ...@@ -1112,6 +1138,11 @@ static struct iio_chan_spec ad74413r_current_input_channels[] = {
AD74413R_ADC_CURRENT_CHANNEL, AD74413R_ADC_CURRENT_CHANNEL,
}; };
static struct iio_chan_spec ad74413r_current_input_loop_channels[] = {
AD74413R_DAC_CHANNEL(IIO_CURRENT, BIT(IIO_CHAN_INFO_SCALE)),
AD74413R_ADC_CURRENT_CHANNEL,
};
static struct iio_chan_spec ad74413r_resistance_input_channels[] = { static struct iio_chan_spec ad74413r_resistance_input_channels[] = {
AD74413R_ADC_CHANNEL(IIO_RESISTANCE, BIT(IIO_CHAN_INFO_PROCESSED)), AD74413R_ADC_CHANNEL(IIO_RESISTANCE, BIT(IIO_CHAN_INFO_PROCESSED)),
}; };
...@@ -1135,7 +1166,7 @@ static const struct ad74413r_channels ad74413r_channels_map[] = { ...@@ -1135,7 +1166,7 @@ static const struct ad74413r_channels ad74413r_channels_map[] = {
[CH_FUNC_CURRENT_OUTPUT] = AD74413R_CHANNELS(current_output), [CH_FUNC_CURRENT_OUTPUT] = AD74413R_CHANNELS(current_output),
[CH_FUNC_VOLTAGE_INPUT] = AD74413R_CHANNELS(voltage_input), [CH_FUNC_VOLTAGE_INPUT] = AD74413R_CHANNELS(voltage_input),
[CH_FUNC_CURRENT_INPUT_EXT_POWER] = AD74413R_CHANNELS(current_input), [CH_FUNC_CURRENT_INPUT_EXT_POWER] = AD74413R_CHANNELS(current_input),
[CH_FUNC_CURRENT_INPUT_LOOP_POWER] = AD74413R_CHANNELS(current_input), [CH_FUNC_CURRENT_INPUT_LOOP_POWER] = AD74413R_CHANNELS(current_input_loop),
[CH_FUNC_RESISTANCE_INPUT] = AD74413R_CHANNELS(resistance_input), [CH_FUNC_RESISTANCE_INPUT] = AD74413R_CHANNELS(resistance_input),
[CH_FUNC_DIGITAL_INPUT_LOGIC] = AD74413R_CHANNELS(digital_input), [CH_FUNC_DIGITAL_INPUT_LOGIC] = AD74413R_CHANNELS(digital_input),
[CH_FUNC_DIGITAL_INPUT_LOOP_POWER] = AD74413R_CHANNELS(digital_input), [CH_FUNC_DIGITAL_INPUT_LOOP_POWER] = AD74413R_CHANNELS(digital_input),
...@@ -1190,6 +1221,9 @@ static int ad74413r_parse_channel_config(struct iio_dev *indio_dev, ...@@ -1190,6 +1221,9 @@ static int ad74413r_parse_channel_config(struct iio_dev *indio_dev,
config->gpo_comparator = fwnode_property_read_bool(channel_node, config->gpo_comparator = fwnode_property_read_bool(channel_node,
"adi,gpo-comparator"); "adi,gpo-comparator");
fwnode_property_read_u32(channel_node, "drive-strength-microamp",
&config->drive_strength);
if (!config->gpo_comparator) if (!config->gpo_comparator)
st->num_gpo_gpios++; st->num_gpo_gpios++;
...@@ -1269,6 +1303,7 @@ static int ad74413r_setup_gpios(struct ad74413r_state *st) ...@@ -1269,6 +1303,7 @@ static int ad74413r_setup_gpios(struct ad74413r_state *st)
unsigned int gpo_gpio_i = 0; unsigned int gpo_gpio_i = 0;
unsigned int i; unsigned int i;
u8 gpo_config; u8 gpo_config;
u32 strength;
int ret; int ret;
for (i = 0; i < AD74413R_CHANNEL_MAX; i++) { for (i = 0; i < AD74413R_CHANNEL_MAX; i++) {
...@@ -1285,6 +1320,11 @@ static int ad74413r_setup_gpios(struct ad74413r_state *st) ...@@ -1285,6 +1320,11 @@ static int ad74413r_setup_gpios(struct ad74413r_state *st)
config->func == CH_FUNC_DIGITAL_INPUT_LOOP_POWER) config->func == CH_FUNC_DIGITAL_INPUT_LOOP_POWER)
st->comp_gpio_offsets[comp_gpio_i++] = i; st->comp_gpio_offsets[comp_gpio_i++] = i;
strength = config->drive_strength;
ret = ad74413r_set_comp_drive_strength(st, i, strength);
if (ret)
return ret;
ret = ad74413r_set_gpo_config(st, i, gpo_config); ret = ad74413r_set_gpo_config(st, i, gpo_config);
if (ret) if (ret)
return ret; return ret;
......
This diff is collapsed.
...@@ -85,7 +85,7 @@ static irqreturn_t st_sensors_irq_thread(int irq, void *p) ...@@ -85,7 +85,7 @@ static irqreturn_t st_sensors_irq_thread(int irq, void *p)
*/ */
if (sdata->hw_irq_trigger && if (sdata->hw_irq_trigger &&
st_sensors_new_samples_available(indio_dev, sdata)) { st_sensors_new_samples_available(indio_dev, sdata)) {
iio_trigger_poll_chained(p); iio_trigger_poll_nested(p);
} else { } else {
dev_dbg(indio_dev->dev.parent, "spurious IRQ\n"); dev_dbg(indio_dev->dev.parent, "spurious IRQ\n");
return IRQ_NONE; return IRQ_NONE;
...@@ -110,7 +110,7 @@ static irqreturn_t st_sensors_irq_thread(int irq, void *p) ...@@ -110,7 +110,7 @@ static irqreturn_t st_sensors_irq_thread(int irq, void *p)
dev_dbg(indio_dev->dev.parent, dev_dbg(indio_dev->dev.parent,
"more samples came in during polling\n"); "more samples came in during polling\n");
sdata->hw_timestamp = iio_get_time_ns(indio_dev); sdata->hw_timestamp = iio_get_time_ns(indio_dev);
iio_trigger_poll_chained(p); iio_trigger_poll_nested(p);
} }
return IRQ_HANDLED; return IRQ_HANDLED;
......
...@@ -277,6 +277,7 @@ config CIO_DAC ...@@ -277,6 +277,7 @@ config CIO_DAC
tristate "Measurement Computing CIO-DAC IIO driver" tristate "Measurement Computing CIO-DAC IIO driver"
depends on X86 && (ISA_BUS || PC104) depends on X86 && (ISA_BUS || PC104)
select ISA_BUS_API select ISA_BUS_API
select REGMAP_MMIO
help help
Say yes here to build support for the Measurement Computing CIO-DAC Say yes here to build support for the Measurement Computing CIO-DAC
analog output device family (CIO-DAC16, CIO-DAC08, PC104-DAC06). The analog output device family (CIO-DAC16, CIO-DAC08, PC104-DAC06). The
......
...@@ -124,6 +124,10 @@ static int ad5592r_gpio_request(struct gpio_chip *chip, unsigned offset) ...@@ -124,6 +124,10 @@ static int ad5592r_gpio_request(struct gpio_chip *chip, unsigned offset)
return 0; return 0;
} }
static const char * const ad5592r_gpio_names[] = {
"GPIO0", "GPIO1", "GPIO2", "GPIO3", "GPIO4", "GPIO5", "GPIO6", "GPIO7",
};
static int ad5592r_gpio_init(struct ad5592r_state *st) static int ad5592r_gpio_init(struct ad5592r_state *st)
{ {
if (!st->gpio_map) if (!st->gpio_map)
...@@ -140,6 +144,7 @@ static int ad5592r_gpio_init(struct ad5592r_state *st) ...@@ -140,6 +144,7 @@ static int ad5592r_gpio_init(struct ad5592r_state *st)
st->gpiochip.set = ad5592r_gpio_set; st->gpiochip.set = ad5592r_gpio_set;
st->gpiochip.request = ad5592r_gpio_request; st->gpiochip.request = ad5592r_gpio_request;
st->gpiochip.owner = THIS_MODULE; st->gpiochip.owner = THIS_MODULE;
st->gpiochip.names = ad5592r_gpio_names;
mutex_init(&st->gpio_lock); mutex_init(&st->gpio_lock);
......
...@@ -4,18 +4,17 @@ ...@@ -4,18 +4,17 @@
* Copyright (C) 2016 William Breathitt Gray * Copyright (C) 2016 William Breathitt Gray
* *
* This driver supports the following Measurement Computing devices: CIO-DAC16, * This driver supports the following Measurement Computing devices: CIO-DAC16,
* CIO-DAC06, and PC104-DAC06. * CIO-DAC08, and PC104-DAC06.
*/ */
#include <linux/bitops.h> #include <linux/bits.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/errno.h> #include <linux/err.h>
#include <linux/iio/iio.h> #include <linux/iio/iio.h>
#include <linux/iio/types.h> #include <linux/iio/types.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/isa.h> #include <linux/isa.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/regmap.h>
#include <linux/types.h> #include <linux/types.h>
#define CIO_DAC_NUM_CHAN 16 #define CIO_DAC_NUM_CHAN 16
...@@ -35,25 +34,51 @@ static unsigned int num_cio_dac; ...@@ -35,25 +34,51 @@ static unsigned int num_cio_dac;
module_param_hw_array(base, uint, ioport, &num_cio_dac, 0); module_param_hw_array(base, uint, ioport, &num_cio_dac, 0);
MODULE_PARM_DESC(base, "Measurement Computing CIO-DAC base addresses"); MODULE_PARM_DESC(base, "Measurement Computing CIO-DAC base addresses");
#define CIO_DAC_BASE 0x00
#define CIO_DAC_CHANNEL_STRIDE 2
static bool cio_dac_precious_reg(struct device *dev, unsigned int reg)
{
/*
* All registers are considered precious; if the XFER jumper is set on
* the device, then no update occurs until a DAC register is read.
*/
return true;
}
static const struct regmap_config cio_dac_regmap_config = {
.reg_bits = 16,
.reg_stride = 2,
.val_bits = 16,
.io_port = true,
.max_register = 0x1F,
.precious_reg = cio_dac_precious_reg,
};
/** /**
* struct cio_dac_iio - IIO device private data structure * struct cio_dac_iio - IIO device private data structure
* @chan_out_states: channels' output states * @map: Regmap for the device
* @base: base memory address of the DAC device
*/ */
struct cio_dac_iio { struct cio_dac_iio {
int chan_out_states[CIO_DAC_NUM_CHAN]; struct regmap *map;
u16 __iomem *base;
}; };
static int cio_dac_read_raw(struct iio_dev *indio_dev, static int cio_dac_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val, int *val2, long mask) struct iio_chan_spec const *chan, int *val, int *val2, long mask)
{ {
struct cio_dac_iio *const priv = iio_priv(indio_dev); struct cio_dac_iio *const priv = iio_priv(indio_dev);
const unsigned int offset = chan->channel * CIO_DAC_CHANNEL_STRIDE;
int err;
unsigned int dac_val;
if (mask != IIO_CHAN_INFO_RAW) if (mask != IIO_CHAN_INFO_RAW)
return -EINVAL; return -EINVAL;
*val = priv->chan_out_states[chan->channel]; err = regmap_read(priv->map, CIO_DAC_BASE + offset, &dac_val);
if (err)
return err;
*val = dac_val;
return IIO_VAL_INT; return IIO_VAL_INT;
} }
...@@ -62,6 +87,7 @@ static int cio_dac_write_raw(struct iio_dev *indio_dev, ...@@ -62,6 +87,7 @@ static int cio_dac_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int val, int val2, long mask) struct iio_chan_spec const *chan, int val, int val2, long mask)
{ {
struct cio_dac_iio *const priv = iio_priv(indio_dev); struct cio_dac_iio *const priv = iio_priv(indio_dev);
const unsigned int offset = chan->channel * CIO_DAC_CHANNEL_STRIDE;
if (mask != IIO_CHAN_INFO_RAW) if (mask != IIO_CHAN_INFO_RAW)
return -EINVAL; return -EINVAL;
...@@ -70,10 +96,7 @@ static int cio_dac_write_raw(struct iio_dev *indio_dev, ...@@ -70,10 +96,7 @@ static int cio_dac_write_raw(struct iio_dev *indio_dev,
if ((unsigned int)val > 4095) if ((unsigned int)val > 4095)
return -EINVAL; return -EINVAL;
priv->chan_out_states[chan->channel] = val; return regmap_write(priv->map, CIO_DAC_BASE + offset, val);
iowrite16(val, priv->base + chan->channel);
return 0;
} }
static const struct iio_info cio_dac_info = { static const struct iio_info cio_dac_info = {
...@@ -92,7 +115,7 @@ static int cio_dac_probe(struct device *dev, unsigned int id) ...@@ -92,7 +115,7 @@ static int cio_dac_probe(struct device *dev, unsigned int id)
{ {
struct iio_dev *indio_dev; struct iio_dev *indio_dev;
struct cio_dac_iio *priv; struct cio_dac_iio *priv;
unsigned int i; void __iomem *regs;
indio_dev = devm_iio_device_alloc(dev, sizeof(*priv)); indio_dev = devm_iio_device_alloc(dev, sizeof(*priv));
if (!indio_dev) if (!indio_dev)
...@@ -105,21 +128,22 @@ static int cio_dac_probe(struct device *dev, unsigned int id) ...@@ -105,21 +128,22 @@ static int cio_dac_probe(struct device *dev, unsigned int id)
return -EBUSY; return -EBUSY;
} }
priv = iio_priv(indio_dev); regs = devm_ioport_map(dev, base[id], CIO_DAC_EXTENT);
priv->base = devm_ioport_map(dev, base[id], CIO_DAC_EXTENT); if (!regs)
if (!priv->base)
return -ENOMEM; return -ENOMEM;
priv = iio_priv(indio_dev);
priv->map = devm_regmap_init_mmio(dev, regs, &cio_dac_regmap_config);
if (IS_ERR(priv->map))
return dev_err_probe(dev, PTR_ERR(priv->map),
"Unable to initialize register map\n");
indio_dev->info = &cio_dac_info; indio_dev->info = &cio_dac_info;
indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = cio_dac_channels; indio_dev->channels = cio_dac_channels;
indio_dev->num_channels = CIO_DAC_NUM_CHAN; indio_dev->num_channels = CIO_DAC_NUM_CHAN;
indio_dev->name = dev_name(dev); indio_dev->name = dev_name(dev);
/* initialize DAC outputs to 0V */
for (i = 0; i < CIO_DAC_NUM_CHAN; i++)
iowrite16(0, priv->base + i);
return devm_iio_device_register(dev, indio_dev); return devm_iio_device_register(dev, indio_dev);
} }
......
...@@ -52,7 +52,7 @@ struct max5522_state { ...@@ -52,7 +52,7 @@ struct max5522_state {
} \ } \
} }
const struct iio_chan_spec max5522_channels[] = { static const struct iio_chan_spec max5522_channels[] = {
MAX5522_CHANNEL(0), MAX5522_CHANNEL(0),
MAX5522_CHANNEL(1), MAX5522_CHANNEL(1),
}; };
......
...@@ -490,11 +490,6 @@ static int admv1013_init(struct admv1013_state *st) ...@@ -490,11 +490,6 @@ static int admv1013_init(struct admv1013_state *st)
st->input_mode); st->input_mode);
} }
static void admv1013_clk_disable(void *data)
{
clk_disable_unprepare(data);
}
static void admv1013_reg_disable(void *data) static void admv1013_reg_disable(void *data)
{ {
regulator_disable(data); regulator_disable(data);
...@@ -559,11 +554,6 @@ static int admv1013_properties_parse(struct admv1013_state *st) ...@@ -559,11 +554,6 @@ static int admv1013_properties_parse(struct admv1013_state *st)
return dev_err_probe(&spi->dev, PTR_ERR(st->reg), return dev_err_probe(&spi->dev, PTR_ERR(st->reg),
"failed to get the common-mode voltage\n"); "failed to get the common-mode voltage\n");
st->clkin = devm_clk_get(&spi->dev, "lo_in");
if (IS_ERR(st->clkin))
return dev_err_probe(&spi->dev, PTR_ERR(st->clkin),
"failed to get the LO input clock\n");
return 0; return 0;
} }
...@@ -601,13 +591,10 @@ static int admv1013_probe(struct spi_device *spi) ...@@ -601,13 +591,10 @@ static int admv1013_probe(struct spi_device *spi)
if (ret) if (ret)
return ret; return ret;
ret = clk_prepare_enable(st->clkin); st->clkin = devm_clk_get_enabled(&spi->dev, "lo_in");
if (ret) if (IS_ERR(st->clkin))
return ret; return dev_err_probe(&spi->dev, PTR_ERR(st->clkin),
"failed to get the LO input clock\n");
ret = devm_add_action_or_reset(&spi->dev, admv1013_clk_disable, st->clkin);
if (ret)
return ret;
st->nb.notifier_call = admv1013_freq_change; st->nb.notifier_call = admv1013_freq_change;
ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb); ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb);
......
...@@ -813,7 +813,7 @@ static irqreturn_t fxas21002c_data_rdy_thread(int irq, void *private) ...@@ -813,7 +813,7 @@ static irqreturn_t fxas21002c_data_rdy_thread(int irq, void *private)
if (!data_ready) if (!data_ready)
return IRQ_NONE; return IRQ_NONE;
iio_trigger_poll_chained(data->dready_trig); iio_trigger_poll_nested(data->dready_trig);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -939,7 +939,7 @@ static irqreturn_t mpu3050_irq_thread(int irq, void *p) ...@@ -939,7 +939,7 @@ static irqreturn_t mpu3050_irq_thread(int irq, void *p)
if (!(val & MPU3050_INT_STATUS_RAW_RDY)) if (!(val & MPU3050_INT_STATUS_RAW_RDY))
return IRQ_NONE; return IRQ_NONE;
iio_trigger_poll_chained(p); iio_trigger_poll_nested(p);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -68,7 +68,7 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private) ...@@ -68,7 +68,7 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
if (!(status & HTS221_RH_DRDY_MASK)) if (!(status & HTS221_RH_DRDY_MASK))
return IRQ_NONE; return IRQ_NONE;
iio_trigger_poll_chained(hw->trig); iio_trigger_poll_nested(hw->trig);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -326,11 +326,11 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq) ...@@ -326,11 +326,11 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq)
/* /*
* This is not an hard requirement but it's not advised to run the IMU * This is not an hard requirement but it's not advised to run the IMU
* with a sample rate lower than 4000Hz due to possible undersampling * with a sample rate lower than 1900Hz due to possible undersampling
* issues. However, there are users that might really want to take the risk. * issues. However, there are users that might really want to take the risk.
* Hence, we provide a module parameter for them. If set, we allow sample * Hence, we provide a module parameter for them. If set, we allow sample
* rates lower than 4KHz. By default, we won't allow this and we just roundup * rates lower than 1.9KHz. By default, we won't allow this and we just roundup
* the rate to the next multiple of the input clock bigger than 4KHz. This * the rate to the next multiple of the input clock bigger than 1.9KHz. This
* is done like this as in some cases (when DEC_RATE is 0) might give * is done like this as in some cases (when DEC_RATE is 0) might give
* us the closest value to the one desired by the user... * us the closest value to the one desired by the user...
*/ */
......
...@@ -14,8 +14,8 @@ config IIO_ST_LSM6DSX ...@@ -14,8 +14,8 @@ config IIO_ST_LSM6DSX
sensor. Supported devices: lsm6ds3, lsm6ds3h, lsm6dsl, lsm6dsm, sensor. Supported devices: lsm6ds3, lsm6ds3h, lsm6dsl, lsm6dsm,
ism330dlc, lsm6dso, lsm6dsox, asm330lhh, asm330lhhx, lsm6dsr, ism330dlc, lsm6dso, lsm6dsox, asm330lhh, asm330lhhx, lsm6dsr,
lsm6ds3tr-c, ism330dhcx, lsm6dsrx, lsm6ds0, lsm6dsop, lsm6dstx, lsm6ds3tr-c, ism330dhcx, lsm6dsrx, lsm6ds0, lsm6dsop, lsm6dstx,
lsm6dsv, lsm6dsv16x, lsm6dso16is, ism330is, lsm6dst and the lsm6dsv, lsm6dsv16x, lsm6dso16is, ism330is, asm330lhb, lsm6dst
accelerometer/gyroscope of lsm9ds1. and the accelerometer/gyroscope of lsm9ds1.
To compile this driver as a module, choose M here: the module To compile this driver as a module, choose M here: the module
will be called st_lsm6dsx. will be called st_lsm6dsx.
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#define ST_LSM6DSV16X_DEV_NAME "lsm6dsv16x" #define ST_LSM6DSV16X_DEV_NAME "lsm6dsv16x"
#define ST_LSM6DSO16IS_DEV_NAME "lsm6dso16is" #define ST_LSM6DSO16IS_DEV_NAME "lsm6dso16is"
#define ST_ISM330IS_DEV_NAME "ism330is" #define ST_ISM330IS_DEV_NAME "ism330is"
#define ST_ASM330LHB_DEV_NAME "asm330lhb"
enum st_lsm6dsx_hw_id { enum st_lsm6dsx_hw_id {
ST_LSM6DS3_ID, ST_LSM6DS3_ID,
...@@ -61,6 +62,7 @@ enum st_lsm6dsx_hw_id { ...@@ -61,6 +62,7 @@ enum st_lsm6dsx_hw_id {
ST_LSM6DSV16X_ID, ST_LSM6DSV16X_ID,
ST_LSM6DSO16IS_ID, ST_LSM6DSO16IS_ID,
ST_ISM330IS_ID, ST_ISM330IS_ID,
ST_ASM330LHB_ID,
ST_LSM6DSX_MAX_ID, ST_LSM6DSX_MAX_ID,
}; };
...@@ -137,6 +139,13 @@ struct st_lsm6dsx_odr_table_entry { ...@@ -137,6 +139,13 @@ struct st_lsm6dsx_odr_table_entry {
int odr_len; int odr_len;
}; };
struct st_lsm6dsx_samples_to_discard {
struct {
u32 milli_hz;
u16 samples;
} val[ST_LSM6DSX_ODR_LIST_SIZE];
};
struct st_lsm6dsx_fs { struct st_lsm6dsx_fs {
u32 gain; u32 gain;
u8 val; u8 val;
...@@ -291,6 +300,7 @@ struct st_lsm6dsx_ext_dev_settings { ...@@ -291,6 +300,7 @@ struct st_lsm6dsx_ext_dev_settings {
* @irq_config: interrupts related registers. * @irq_config: interrupts related registers.
* @drdy_mask: register info for data-ready mask (addr + mask). * @drdy_mask: register info for data-ready mask (addr + mask).
* @odr_table: Hw sensors odr table (Hz + val). * @odr_table: Hw sensors odr table (Hz + val).
* @samples_to_discard: Number of samples to discard for filters settling time.
* @fs_table: Hw sensors gain table (gain + val). * @fs_table: Hw sensors gain table (gain + val).
* @decimator: List of decimator register info (addr + mask). * @decimator: List of decimator register info (addr + mask).
* @batch: List of FIFO batching register info (addr + mask). * @batch: List of FIFO batching register info (addr + mask).
...@@ -323,6 +333,7 @@ struct st_lsm6dsx_settings { ...@@ -323,6 +333,7 @@ struct st_lsm6dsx_settings {
} irq_config; } irq_config;
struct st_lsm6dsx_reg drdy_mask; struct st_lsm6dsx_reg drdy_mask;
struct st_lsm6dsx_odr_table_entry odr_table[2]; struct st_lsm6dsx_odr_table_entry odr_table[2];
struct st_lsm6dsx_samples_to_discard samples_to_discard[2];
struct st_lsm6dsx_fs_table_entry fs_table[2]; struct st_lsm6dsx_fs_table_entry fs_table[2];
struct st_lsm6dsx_reg decimator[ST_LSM6DSX_MAX_ID]; struct st_lsm6dsx_reg decimator[ST_LSM6DSX_MAX_ID];
struct st_lsm6dsx_reg batch[ST_LSM6DSX_MAX_ID]; struct st_lsm6dsx_reg batch[ST_LSM6DSX_MAX_ID];
...@@ -353,6 +364,7 @@ enum st_lsm6dsx_fifo_mode { ...@@ -353,6 +364,7 @@ enum st_lsm6dsx_fifo_mode {
* @hw: Pointer to instance of struct st_lsm6dsx_hw. * @hw: Pointer to instance of struct st_lsm6dsx_hw.
* @gain: Configured sensor sensitivity. * @gain: Configured sensor sensitivity.
* @odr: Output data rate of the sensor [Hz]. * @odr: Output data rate of the sensor [Hz].
* @samples_to_discard: Number of samples to discard for filters settling time.
* @watermark: Sensor watermark level. * @watermark: Sensor watermark level.
* @decimator: Sensor decimation factor. * @decimator: Sensor decimation factor.
* @sip: Number of samples in a given pattern. * @sip: Number of samples in a given pattern.
...@@ -367,6 +379,7 @@ struct st_lsm6dsx_sensor { ...@@ -367,6 +379,7 @@ struct st_lsm6dsx_sensor {
u32 gain; u32 gain;
u32 odr; u32 odr;
u16 samples_to_discard;
u16 watermark; u16 watermark;
u8 decimator; u8 decimator;
u8 sip; u8 sip;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* value of the decimation factor and ODR set for each FIFO data set. * value of the decimation factor and ODR set for each FIFO data set.
* *
* LSM6DSO/LSM6DSOX/ASM330LHH/ASM330LHHX/LSM6DSR/LSM6DSRX/ISM330DHCX/ * LSM6DSO/LSM6DSOX/ASM330LHH/ASM330LHHX/LSM6DSR/LSM6DSRX/ISM330DHCX/
* LSM6DST/LSM6DSOP/LSM6DSTX/LSM6DSV: * LSM6DST/LSM6DSOP/LSM6DSTX/LSM6DSV/ASM330LHB:
* The FIFO buffer can be configured to store data from gyroscope and * The FIFO buffer can be configured to store data from gyroscope and
* accelerometer. Each sample is queued with a tag (1B) indicating data * accelerometer. Each sample is queued with a tag (1B) indicating data
* source (gyroscope, accelerometer, hw timer). * source (gyroscope, accelerometer, hw timer).
...@@ -457,6 +457,13 @@ int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) ...@@ -457,6 +457,13 @@ int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw)
} }
if (gyro_sip > 0 && !(sip % gyro_sensor->decimator)) { if (gyro_sip > 0 && !(sip % gyro_sensor->decimator)) {
/*
* We need to discards gyro samples during
* filters settling time
*/
if (gyro_sensor->samples_to_discard > 0)
gyro_sensor->samples_to_discard--;
else
iio_push_to_buffers_with_timestamp( iio_push_to_buffers_with_timestamp(
hw->iio_devs[ST_LSM6DSX_ID_GYRO], hw->iio_devs[ST_LSM6DSX_ID_GYRO],
&hw->scan[ST_LSM6DSX_ID_GYRO], &hw->scan[ST_LSM6DSX_ID_GYRO],
...@@ -464,6 +471,13 @@ int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) ...@@ -464,6 +471,13 @@ int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw)
gyro_sip--; gyro_sip--;
} }
if (acc_sip > 0 && !(sip % acc_sensor->decimator)) { if (acc_sip > 0 && !(sip % acc_sensor->decimator)) {
/*
* We need to discards accel samples during
* filters settling time
*/
if (acc_sensor->samples_to_discard > 0)
acc_sensor->samples_to_discard--;
else
iio_push_to_buffers_with_timestamp( iio_push_to_buffers_with_timestamp(
hw->iio_devs[ST_LSM6DSX_ID_ACC], hw->iio_devs[ST_LSM6DSX_ID_ACC],
&hw->scan[ST_LSM6DSX_ID_ACC], &hw->scan[ST_LSM6DSX_ID_ACC],
...@@ -654,6 +668,30 @@ int st_lsm6dsx_flush_fifo(struct st_lsm6dsx_hw *hw) ...@@ -654,6 +668,30 @@ int st_lsm6dsx_flush_fifo(struct st_lsm6dsx_hw *hw)
return err; return err;
} }
static void
st_lsm6dsx_update_samples_to_discard(struct st_lsm6dsx_sensor *sensor)
{
const struct st_lsm6dsx_samples_to_discard *data;
struct st_lsm6dsx_hw *hw = sensor->hw;
int i;
if (sensor->id != ST_LSM6DSX_ID_GYRO &&
sensor->id != ST_LSM6DSX_ID_ACC)
return;
/* check if drdy mask is supported in hw */
if (hw->settings->drdy_mask.addr)
return;
data = &hw->settings->samples_to_discard[sensor->id];
for (i = 0; i < ST_LSM6DSX_ODR_LIST_SIZE; i++) {
if (data->val[i].milli_hz == sensor->odr) {
sensor->samples_to_discard = data->val[i].samples;
return;
}
}
}
int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable) int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable)
{ {
struct st_lsm6dsx_hw *hw = sensor->hw; struct st_lsm6dsx_hw *hw = sensor->hw;
...@@ -673,6 +711,9 @@ int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable) ...@@ -673,6 +711,9 @@ int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable)
goto out; goto out;
} }
if (enable)
st_lsm6dsx_update_samples_to_discard(sensor);
err = st_lsm6dsx_device_set_enable(sensor, enable); err = st_lsm6dsx_device_set_enable(sensor, enable);
if (err < 0) if (err < 0)
goto out; goto out;
......
...@@ -634,6 +634,24 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { ...@@ -634,6 +634,24 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
.fs_len = 4, .fs_len = 4,
}, },
}, },
.samples_to_discard = {
[ST_LSM6DSX_ID_ACC] = {
.val[0] = { 12500, 1 },
.val[1] = { 26000, 1 },
.val[2] = { 52000, 1 },
.val[3] = { 104000, 2 },
.val[4] = { 208000, 2 },
.val[5] = { 416000, 2 },
},
[ST_LSM6DSX_ID_GYRO] = {
.val[0] = { 12500, 2 },
.val[1] = { 26000, 5 },
.val[2] = { 52000, 7 },
.val[3] = { 104000, 12 },
.val[4] = { 208000, 20 },
.val[5] = { 416000, 36 },
},
},
.irq_config = { .irq_config = {
.irq1 = { .irq1 = {
.addr = 0x0d, .addr = 0x0d,
...@@ -1014,6 +1032,10 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { ...@@ -1014,6 +1032,10 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
.hw_id = ST_LSM6DSOP_ID, .hw_id = ST_LSM6DSOP_ID,
.name = ST_LSM6DSOP_DEV_NAME, .name = ST_LSM6DSOP_DEV_NAME,
.wai = 0x6c, .wai = 0x6c,
}, {
.hw_id = ST_ASM330LHB_ID,
.name = ST_ASM330LHB_DEV_NAME,
.wai = 0x6b,
}, },
}, },
.channels = { .channels = {
......
...@@ -125,6 +125,10 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = { ...@@ -125,6 +125,10 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = {
.compatible = "st,ism330is", .compatible = "st,ism330is",
.data = (void *)ST_ISM330IS_ID, .data = (void *)ST_ISM330IS_ID,
}, },
{
.compatible = "st,asm330lhb",
.data = (void *)ST_ASM330LHB_ID,
},
{}, {},
}; };
MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match); MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match);
...@@ -152,6 +156,7 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = { ...@@ -152,6 +156,7 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = {
{ ST_LSM6DSV16X_DEV_NAME, ST_LSM6DSV16X_ID }, { ST_LSM6DSV16X_DEV_NAME, ST_LSM6DSV16X_ID },
{ ST_LSM6DSO16IS_DEV_NAME, ST_LSM6DSO16IS_ID }, { ST_LSM6DSO16IS_DEV_NAME, ST_LSM6DSO16IS_ID },
{ ST_ISM330IS_DEV_NAME, ST_ISM330IS_ID }, { ST_ISM330IS_DEV_NAME, ST_ISM330IS_ID },
{ ST_ASM330LHB_DEV_NAME, ST_ASM330LHB_ID },
{}, {},
}; };
MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table); MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table);
......
...@@ -125,6 +125,10 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = { ...@@ -125,6 +125,10 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = {
.compatible = "st,ism330is", .compatible = "st,ism330is",
.data = (void *)ST_ISM330IS_ID, .data = (void *)ST_ISM330IS_ID,
}, },
{
.compatible = "st,asm330lhb",
.data = (void *)ST_ASM330LHB_ID,
},
{}, {},
}; };
MODULE_DEVICE_TABLE(of, st_lsm6dsx_spi_of_match); MODULE_DEVICE_TABLE(of, st_lsm6dsx_spi_of_match);
...@@ -152,6 +156,7 @@ static const struct spi_device_id st_lsm6dsx_spi_id_table[] = { ...@@ -152,6 +156,7 @@ static const struct spi_device_id st_lsm6dsx_spi_id_table[] = {
{ ST_LSM6DSV16X_DEV_NAME, ST_LSM6DSV16X_ID }, { ST_LSM6DSV16X_DEV_NAME, ST_LSM6DSV16X_ID },
{ ST_LSM6DSO16IS_DEV_NAME, ST_LSM6DSO16IS_ID }, { ST_LSM6DSO16IS_DEV_NAME, ST_LSM6DSO16IS_ID },
{ ST_ISM330IS_DEV_NAME, ST_ISM330IS_ID }, { ST_ISM330IS_DEV_NAME, ST_ISM330IS_ID },
{ ST_ASM330LHB_DEV_NAME, ST_ASM330LHB_ID },
{}, {},
}; };
MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table); MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table);
......
This diff is collapsed.
...@@ -192,6 +192,12 @@ static void iio_trigger_notify_done_atomic(struct iio_trigger *trig) ...@@ -192,6 +192,12 @@ static void iio_trigger_notify_done_atomic(struct iio_trigger *trig)
schedule_work(&trig->reenable_work); schedule_work(&trig->reenable_work);
} }
/**
* iio_trigger_poll() - Call the IRQ trigger handler of the consumers
* @trig: trigger which occurred
*
* This function should only be called from a hard IRQ context.
*/
void iio_trigger_poll(struct iio_trigger *trig) void iio_trigger_poll(struct iio_trigger *trig)
{ {
int i; int i;
...@@ -216,7 +222,14 @@ irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private) ...@@ -216,7 +222,14 @@ irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private)
} }
EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll); EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll);
void iio_trigger_poll_chained(struct iio_trigger *trig) /**
* iio_trigger_poll_nested() - Call the threaded trigger handler of the
* consumers
* @trig: trigger which occurred
*
* This function should only be called from a kernel thread context.
*/
void iio_trigger_poll_nested(struct iio_trigger *trig)
{ {
int i; int i;
...@@ -231,7 +244,7 @@ void iio_trigger_poll_chained(struct iio_trigger *trig) ...@@ -231,7 +244,7 @@ void iio_trigger_poll_chained(struct iio_trigger *trig)
} }
} }
} }
EXPORT_SYMBOL(iio_trigger_poll_chained); EXPORT_SYMBOL(iio_trigger_poll_nested);
void iio_trigger_notify_done(struct iio_trigger *trig) void iio_trigger_notify_done(struct iio_trigger *trig)
{ {
......
...@@ -289,6 +289,20 @@ config JSA1212 ...@@ -289,6 +289,20 @@ config JSA1212
To compile this driver as a module, choose M here: To compile this driver as a module, choose M here:
the module will be called jsa1212. the module will be called jsa1212.
config ROHM_BU27034
tristate "ROHM BU27034 ambient light sensor"
depends on I2C
select REGMAP_I2C
select IIO_GTS_HELPER
select IIO_BUFFER
select IIO_KFIFO_BUF
help
Enable support for the ROHM BU27034 ambient light sensor. ROHM BU27034
is an ambient light sesnor with 3 channels and 3 photo diodes capable
of detecting a very wide range of illuminance.
Typical application is adjusting LCD and backlight power of TVs and
mobile phones.
config RPR0521 config RPR0521
tristate "ROHM RPR0521 ALS and proximity sensor driver" tristate "ROHM RPR0521 ALS and proximity sensor driver"
depends on I2C depends on I2C
......
...@@ -38,6 +38,7 @@ obj-$(CONFIG_MAX44009) += max44009.o ...@@ -38,6 +38,7 @@ obj-$(CONFIG_MAX44009) += max44009.o
obj-$(CONFIG_NOA1305) += noa1305.o obj-$(CONFIG_NOA1305) += noa1305.o
obj-$(CONFIG_OPT3001) += opt3001.o obj-$(CONFIG_OPT3001) += opt3001.o
obj-$(CONFIG_PA12203001) += pa12203001.o obj-$(CONFIG_PA12203001) += pa12203001.o
obj-$(CONFIG_ROHM_BU27034) += rohm-bu27034.o
obj-$(CONFIG_RPR0521) += rpr0521.o obj-$(CONFIG_RPR0521) += rpr0521.o
obj-$(CONFIG_SI1133) += si1133.o obj-$(CONFIG_SI1133) += si1133.o
obj-$(CONFIG_SI1145) += si1145.o obj-$(CONFIG_SI1145) += si1145.o
......
...@@ -108,7 +108,7 @@ static void acpi_als_notify(struct acpi_device *device, u32 event) ...@@ -108,7 +108,7 @@ static void acpi_als_notify(struct acpi_device *device, u32 event)
if (iio_buffer_enabled(indio_dev) && iio_trigger_using_own(indio_dev)) { if (iio_buffer_enabled(indio_dev) && iio_trigger_using_own(indio_dev)) {
switch (event) { switch (event) {
case ACPI_ALS_NOTIFY_ILLUMINANCE: case ACPI_ALS_NOTIFY_ILLUMINANCE:
iio_trigger_poll_chained(als->trig); iio_trigger_poll_nested(als->trig);
break; break;
default: default:
/* Unhandled event */ /* Unhandled event */
......
...@@ -527,6 +527,12 @@ static int max44009_probe(struct i2c_client *client) ...@@ -527,6 +527,12 @@ static int max44009_probe(struct i2c_client *client)
return devm_iio_device_register(&client->dev, indio_dev); return devm_iio_device_register(&client->dev, indio_dev);
} }
static const struct of_device_id max44009_of_match[] = {
{ .compatible = "maxim,max44009" },
{ }
};
MODULE_DEVICE_TABLE(of, max44009_of_match);
static const struct i2c_device_id max44009_id[] = { static const struct i2c_device_id max44009_id[] = {
{ "max44009", 0 }, { "max44009", 0 },
{ } { }
...@@ -536,18 +542,13 @@ MODULE_DEVICE_TABLE(i2c, max44009_id); ...@@ -536,18 +542,13 @@ MODULE_DEVICE_TABLE(i2c, max44009_id);
static struct i2c_driver max44009_driver = { static struct i2c_driver max44009_driver = {
.driver = { .driver = {
.name = MAX44009_DRV_NAME, .name = MAX44009_DRV_NAME,
.of_match_table = max44009_of_match,
}, },
.probe_new = max44009_probe, .probe_new = max44009_probe,
.id_table = max44009_id, .id_table = max44009_id,
}; };
module_i2c_driver(max44009_driver); module_i2c_driver(max44009_driver);
static const struct of_device_id max44009_of_match[] = {
{ .compatible = "maxim,max44009" },
{ }
};
MODULE_DEVICE_TABLE(of, max44009_of_match);
MODULE_AUTHOR("Robert Eshleman <bobbyeshleman@gmail.com>"); MODULE_AUTHOR("Robert Eshleman <bobbyeshleman@gmail.com>");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("MAX44009 ambient light sensor driver"); MODULE_DESCRIPTION("MAX44009 ambient light sensor driver");
This diff is collapsed.
...@@ -431,7 +431,7 @@ static irqreturn_t rpr0521_drdy_irq_thread(int irq, void *private) ...@@ -431,7 +431,7 @@ static irqreturn_t rpr0521_drdy_irq_thread(int irq, void *private)
struct rpr0521_data *data = iio_priv(indio_dev); struct rpr0521_data *data = iio_priv(indio_dev);
if (rpr0521_is_triggered(data)) { if (rpr0521_is_triggered(data)) {
iio_trigger_poll_chained(data->drdy_trigger0); iio_trigger_poll_nested(data->drdy_trigger0);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -161,7 +161,7 @@ static irqreturn_t st_uvis25_trigger_handler_thread(int irq, void *private) ...@@ -161,7 +161,7 @@ static irqreturn_t st_uvis25_trigger_handler_thread(int irq, void *private)
if (!(status & ST_UVIS25_REG_UV_DA_MASK)) if (!(status & ST_UVIS25_REG_UV_DA_MASK))
return IRQ_NONE; return IRQ_NONE;
iio_trigger_poll_chained(hw->trig); iio_trigger_poll_nested(hw->trig);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -1077,7 +1077,7 @@ static irqreturn_t vcnl4010_irq_thread(int irq, void *p) ...@@ -1077,7 +1077,7 @@ static irqreturn_t vcnl4010_irq_thread(int irq, void *p)
} }
if (isr & VCNL4010_INT_DRDY && iio_buffer_enabled(indio_dev)) if (isr & VCNL4010_INT_DRDY && iio_buffer_enabled(indio_dev))
iio_trigger_poll_chained(indio_dev->trig); iio_trigger_poll_nested(indio_dev->trig);
end: end:
return IRQ_HANDLED; return IRQ_HANDLED;
......
...@@ -89,7 +89,7 @@ static irqreturn_t vcnl4035_drdy_irq_thread(int irq, void *private) ...@@ -89,7 +89,7 @@ static irqreturn_t vcnl4035_drdy_irq_thread(int irq, void *private)
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_EITHER), IIO_EV_DIR_EITHER),
iio_get_time_ns(indio_dev)); iio_get_time_ns(indio_dev));
iio_trigger_poll_chained(data->drdy_trigger0); iio_trigger_poll_nested(data->drdy_trigger0);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -118,7 +118,7 @@ static int lmp91000_read(struct lmp91000_data *data, int channel, int *val) ...@@ -118,7 +118,7 @@ static int lmp91000_read(struct lmp91000_data *data, int channel, int *val)
data->chan_select = channel != LMP91000_REG_MODECN_3LEAD; data->chan_select = channel != LMP91000_REG_MODECN_3LEAD;
iio_trigger_poll_chained(data->trig); iio_trigger_poll_nested(data->trig);
ret = wait_for_completion_timeout(&data->completion, HZ); ret = wait_for_completion_timeout(&data->completion, HZ);
reinit_completion(&data->completion); reinit_completion(&data->completion);
......
...@@ -17,14 +17,14 @@ config ABP060MG ...@@ -17,14 +17,14 @@ config ABP060MG
will be called abp060mg. will be called abp060mg.
config BMP280 config BMP280
tristate "Bosch Sensortec BMP180/BMP280/BMP380 pressure sensor I2C driver" tristate "Bosch Sensortec BMP180/BMP280/BMP380/BMP580 pressure sensor driver"
depends on (I2C || SPI_MASTER) depends on (I2C || SPI_MASTER)
select REGMAP select REGMAP
select BMP280_I2C if (I2C) select BMP280_I2C if (I2C)
select BMP280_SPI if (SPI_MASTER) select BMP280_SPI if (SPI_MASTER)
help help
Say yes here to build support for Bosch Sensortec BMP180, BMP280 and Say yes here to build support for Bosch Sensortec BMP180, BMP280, BMP380
BMP380 pressure and temperature sensors. Also supports the BME280 with and BMP580 pressure and temperature sensors. Also supports the BME280 with
an additional humidity sensor channel. an additional humidity sensor channel.
To compile this driver as a module, choose M here: the core module To compile this driver as a module, choose M here: the core module
......
This diff is collapsed.
...@@ -8,25 +8,14 @@ ...@@ -8,25 +8,14 @@
static int bmp280_i2c_probe(struct i2c_client *client) static int bmp280_i2c_probe(struct i2c_client *client)
{ {
struct regmap *regmap; struct regmap *regmap;
const struct regmap_config *regmap_config; const struct bmp280_chip_info *chip_info;
const struct i2c_device_id *id = i2c_client_get_device_id(client); const struct i2c_device_id *id = i2c_client_get_device_id(client);
switch (id->driver_data) { chip_info = device_get_match_data(&client->dev);
case BMP180_CHIP_ID: if (!chip_info)
regmap_config = &bmp180_regmap_config; chip_info = (const struct bmp280_chip_info *) id->driver_data;
break;
case BMP280_CHIP_ID:
case BME280_CHIP_ID:
regmap_config = &bmp280_regmap_config;
break;
case BMP380_CHIP_ID:
regmap_config = &bmp380_regmap_config;
break;
default:
return -EINVAL;
}
regmap = devm_regmap_init_i2c(client, regmap_config); regmap = devm_regmap_init_i2c(client, chip_info->regmap_config);
if (IS_ERR(regmap)) { if (IS_ERR(regmap)) {
dev_err(&client->dev, "failed to allocate register map\n"); dev_err(&client->dev, "failed to allocate register map\n");
return PTR_ERR(regmap); return PTR_ERR(regmap);
...@@ -34,27 +23,29 @@ static int bmp280_i2c_probe(struct i2c_client *client) ...@@ -34,27 +23,29 @@ static int bmp280_i2c_probe(struct i2c_client *client)
return bmp280_common_probe(&client->dev, return bmp280_common_probe(&client->dev,
regmap, regmap,
id->driver_data, chip_info,
id->name, id->name,
client->irq); client->irq);
} }
static const struct of_device_id bmp280_of_i2c_match[] = { static const struct of_device_id bmp280_of_i2c_match[] = {
{ .compatible = "bosch,bmp085", .data = (void *)BMP180_CHIP_ID }, { .compatible = "bosch,bmp085", .data = &bmp180_chip_info },
{ .compatible = "bosch,bmp180", .data = (void *)BMP180_CHIP_ID }, { .compatible = "bosch,bmp180", .data = &bmp180_chip_info },
{ .compatible = "bosch,bmp280", .data = (void *)BMP280_CHIP_ID }, { .compatible = "bosch,bmp280", .data = &bmp280_chip_info },
{ .compatible = "bosch,bme280", .data = (void *)BME280_CHIP_ID }, { .compatible = "bosch,bme280", .data = &bme280_chip_info },
{ .compatible = "bosch,bmp380", .data = (void *)BMP380_CHIP_ID }, { .compatible = "bosch,bmp380", .data = &bmp380_chip_info },
{ .compatible = "bosch,bmp580", .data = &bmp580_chip_info },
{ }, { },
}; };
MODULE_DEVICE_TABLE(of, bmp280_of_i2c_match); MODULE_DEVICE_TABLE(of, bmp280_of_i2c_match);
static const struct i2c_device_id bmp280_i2c_id[] = { static const struct i2c_device_id bmp280_i2c_id[] = {
{"bmp085", BMP180_CHIP_ID }, {"bmp085", (kernel_ulong_t)&bmp180_chip_info },
{"bmp180", BMP180_CHIP_ID }, {"bmp180", (kernel_ulong_t)&bmp180_chip_info },
{"bmp280", BMP280_CHIP_ID }, {"bmp280", (kernel_ulong_t)&bmp280_chip_info },
{"bme280", BME280_CHIP_ID }, {"bme280", (kernel_ulong_t)&bme280_chip_info },
{"bmp380", BMP380_CHIP_ID }, {"bmp380", (kernel_ulong_t)&bmp380_chip_info },
{"bmp580", (kernel_ulong_t)&bmp580_chip_info },
{ }, { },
}; };
MODULE_DEVICE_TABLE(i2c, bmp280_i2c_id); MODULE_DEVICE_TABLE(i2c, bmp280_i2c_id);
......
...@@ -115,6 +115,54 @@ static bool bmp380_is_volatile_reg(struct device *dev, unsigned int reg) ...@@ -115,6 +115,54 @@ static bool bmp380_is_volatile_reg(struct device *dev, unsigned int reg)
} }
} }
static bool bmp580_is_writeable_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case BMP580_REG_NVM_DATA_MSB:
case BMP580_REG_NVM_DATA_LSB:
case BMP580_REG_NVM_ADDR:
case BMP580_REG_ODR_CONFIG:
case BMP580_REG_OSR_CONFIG:
case BMP580_REG_INT_SOURCE:
case BMP580_REG_INT_CONFIG:
case BMP580_REG_OOR_THR_MSB:
case BMP580_REG_OOR_THR_LSB:
case BMP580_REG_OOR_CONFIG:
case BMP580_REG_OOR_RANGE:
case BMP580_REG_IF_CONFIG:
case BMP580_REG_FIFO_CONFIG:
case BMP580_REG_FIFO_SEL:
case BMP580_REG_DSP_CONFIG:
case BMP580_REG_DSP_IIR:
case BMP580_REG_CMD:
return true;
default:
return false;
}
}
static bool bmp580_is_volatile_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case BMP580_REG_NVM_DATA_MSB:
case BMP580_REG_NVM_DATA_LSB:
case BMP580_REG_FIFO_COUNT:
case BMP580_REG_INT_STATUS:
case BMP580_REG_PRESS_XLSB:
case BMP580_REG_PRESS_LSB:
case BMP580_REG_PRESS_MSB:
case BMP580_REG_FIFO_DATA:
case BMP580_REG_TEMP_XLSB:
case BMP580_REG_TEMP_LSB:
case BMP580_REG_TEMP_MSB:
case BMP580_REG_EFF_OSR:
case BMP580_REG_STATUS:
return true;
default:
return false;
}
}
const struct regmap_config bmp280_regmap_config = { const struct regmap_config bmp280_regmap_config = {
.reg_bits = 8, .reg_bits = 8,
.val_bits = 8, .val_bits = 8,
...@@ -138,3 +186,15 @@ const struct regmap_config bmp380_regmap_config = { ...@@ -138,3 +186,15 @@ const struct regmap_config bmp380_regmap_config = {
.volatile_reg = bmp380_is_volatile_reg, .volatile_reg = bmp380_is_volatile_reg,
}; };
EXPORT_SYMBOL_NS(bmp380_regmap_config, IIO_BMP280); EXPORT_SYMBOL_NS(bmp380_regmap_config, IIO_BMP280);
const struct regmap_config bmp580_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = BMP580_REG_CMD,
.cache_type = REGCACHE_RBTREE,
.writeable_reg = bmp580_is_writeable_reg,
.volatile_reg = bmp580_is_volatile_reg,
};
EXPORT_SYMBOL_NS(bmp580_regmap_config, IIO_BMP280);
...@@ -47,8 +47,8 @@ static struct regmap_bus bmp280_regmap_bus = { ...@@ -47,8 +47,8 @@ static struct regmap_bus bmp280_regmap_bus = {
static int bmp280_spi_probe(struct spi_device *spi) static int bmp280_spi_probe(struct spi_device *spi)
{ {
const struct spi_device_id *id = spi_get_device_id(spi); const struct spi_device_id *id = spi_get_device_id(spi);
const struct bmp280_chip_info *chip_info;
struct regmap *regmap; struct regmap *regmap;
const struct regmap_config *regmap_config;
int ret; int ret;
spi->bits_per_word = 8; spi->bits_per_word = 8;
...@@ -58,25 +58,14 @@ static int bmp280_spi_probe(struct spi_device *spi) ...@@ -58,25 +58,14 @@ static int bmp280_spi_probe(struct spi_device *spi)
return ret; return ret;
} }
switch (id->driver_data) { chip_info = device_get_match_data(&spi->dev);
case BMP180_CHIP_ID: if (!chip_info)
regmap_config = &bmp180_regmap_config; chip_info = (const struct bmp280_chip_info *) id->driver_data;
break;
case BMP280_CHIP_ID:
case BME280_CHIP_ID:
regmap_config = &bmp280_regmap_config;
break;
case BMP380_CHIP_ID:
regmap_config = &bmp380_regmap_config;
break;
default:
return -EINVAL;
}
regmap = devm_regmap_init(&spi->dev, regmap = devm_regmap_init(&spi->dev,
&bmp280_regmap_bus, &bmp280_regmap_bus,
&spi->dev, &spi->dev,
regmap_config); chip_info->regmap_config);
if (IS_ERR(regmap)) { if (IS_ERR(regmap)) {
dev_err(&spi->dev, "failed to allocate register map\n"); dev_err(&spi->dev, "failed to allocate register map\n");
return PTR_ERR(regmap); return PTR_ERR(regmap);
...@@ -84,28 +73,30 @@ static int bmp280_spi_probe(struct spi_device *spi) ...@@ -84,28 +73,30 @@ static int bmp280_spi_probe(struct spi_device *spi)
return bmp280_common_probe(&spi->dev, return bmp280_common_probe(&spi->dev,
regmap, regmap,
id->driver_data, chip_info,
id->name, id->name,
spi->irq); spi->irq);
} }
static const struct of_device_id bmp280_of_spi_match[] = { static const struct of_device_id bmp280_of_spi_match[] = {
{ .compatible = "bosch,bmp085", }, { .compatible = "bosch,bmp085", .data = &bmp180_chip_info },
{ .compatible = "bosch,bmp180", }, { .compatible = "bosch,bmp180", .data = &bmp180_chip_info },
{ .compatible = "bosch,bmp181", }, { .compatible = "bosch,bmp181", .data = &bmp180_chip_info },
{ .compatible = "bosch,bmp280", }, { .compatible = "bosch,bmp280", .data = &bmp280_chip_info },
{ .compatible = "bosch,bme280", }, { .compatible = "bosch,bme280", .data = &bmp280_chip_info },
{ .compatible = "bosch,bmp380", }, { .compatible = "bosch,bmp380", .data = &bmp380_chip_info },
{ .compatible = "bosch,bmp580", .data = &bmp580_chip_info },
{ }, { },
}; };
MODULE_DEVICE_TABLE(of, bmp280_of_spi_match); MODULE_DEVICE_TABLE(of, bmp280_of_spi_match);
static const struct spi_device_id bmp280_spi_id[] = { static const struct spi_device_id bmp280_spi_id[] = {
{ "bmp180", BMP180_CHIP_ID }, { "bmp180", (kernel_ulong_t)&bmp180_chip_info },
{ "bmp181", BMP180_CHIP_ID }, { "bmp181", (kernel_ulong_t)&bmp180_chip_info },
{ "bmp280", BMP280_CHIP_ID }, { "bmp280", (kernel_ulong_t)&bmp280_chip_info },
{ "bme280", BME280_CHIP_ID }, { "bme280", (kernel_ulong_t)&bmp280_chip_info },
{ "bmp380", BMP380_CHIP_ID }, { "bmp380", (kernel_ulong_t)&bmp380_chip_info },
{ "bmp580", (kernel_ulong_t)&bmp580_chip_info },
{ } { }
}; };
MODULE_DEVICE_TABLE(spi, bmp280_spi_id); MODULE_DEVICE_TABLE(spi, bmp280_spi_id);
......
This diff is collapsed.
...@@ -829,7 +829,7 @@ static irqreturn_t zpa2326_handle_threaded_irq(int irq, void *data) ...@@ -829,7 +829,7 @@ static irqreturn_t zpa2326_handle_threaded_irq(int irq, void *data)
} }
/* New sample available: dispatch internal trigger consumers. */ /* New sample available: dispatch internal trigger consumers. */
iio_trigger_poll_chained(priv->trigger); iio_trigger_poll_nested(priv->trigger);
if (cont) if (cont)
/* /*
......
...@@ -257,7 +257,7 @@ static void as3935_event_work(struct work_struct *work) ...@@ -257,7 +257,7 @@ static void as3935_event_work(struct work_struct *work)
switch (val) { switch (val) {
case AS3935_EVENT_INT: case AS3935_EVENT_INT:
iio_trigger_poll_chained(st->trig); iio_trigger_poll_nested(st->trig);
break; break;
case AS3935_DISTURB_INT: case AS3935_DISTURB_INT:
case AS3935_NOISE_INT: case AS3935_NOISE_INT:
......
This diff is collapsed.
...@@ -663,37 +663,37 @@ static int sx9360_write_raw(struct iio_dev *indio_dev, ...@@ -663,37 +663,37 @@ static int sx9360_write_raw(struct iio_dev *indio_dev,
static const struct sx_common_reg_default sx9360_default_regs[] = { static const struct sx_common_reg_default sx9360_default_regs[] = {
{ SX9360_REG_IRQ_MSK, 0x00 }, { SX9360_REG_IRQ_MSK, 0x00 },
{ SX9360_REG_IRQ_CFG, 0x00 }, { SX9360_REG_IRQ_CFG, 0x00, "irq_cfg" },
/* /*
* The lower 2 bits should not be set as it enable sensors measurements. * The lower 2 bits should not be set as it enable sensors measurements.
* Turning the detection on before the configuration values are set to * Turning the detection on before the configuration values are set to
* good values can cause the device to return erroneous readings. * good values can cause the device to return erroneous readings.
*/ */
{ SX9360_REG_GNRL_CTRL0, 0x00 }, { SX9360_REG_GNRL_CTRL0, 0x00, "gnrl_ctrl0" },
{ SX9360_REG_GNRL_CTRL1, 0x00 }, { SX9360_REG_GNRL_CTRL1, 0x00, "gnrl_ctrl1" },
{ SX9360_REG_GNRL_CTRL2, SX9360_REG_GNRL_CTRL2_PERIOD_102MS }, { SX9360_REG_GNRL_CTRL2, SX9360_REG_GNRL_CTRL2_PERIOD_102MS, "gnrl_ctrl2" },
{ SX9360_REG_AFE_CTRL1, SX9360_REG_AFE_CTRL1_RESFILTIN_0OHMS }, { SX9360_REG_AFE_CTRL1, SX9360_REG_AFE_CTRL1_RESFILTIN_0OHMS, "afe_ctrl0" },
{ SX9360_REG_AFE_PARAM0_PHR, SX9360_REG_AFE_PARAM0_RSVD | { SX9360_REG_AFE_PARAM0_PHR, SX9360_REG_AFE_PARAM0_RSVD |
SX9360_REG_AFE_PARAM0_RESOLUTION_128 }, SX9360_REG_AFE_PARAM0_RESOLUTION_128, "afe_param0_phr" },
{ SX9360_REG_AFE_PARAM1_PHR, SX9360_REG_AFE_PARAM1_AGAIN_PHM_6PF | { SX9360_REG_AFE_PARAM1_PHR, SX9360_REG_AFE_PARAM1_AGAIN_PHM_6PF |
SX9360_REG_AFE_PARAM1_FREQ_83_33HZ }, SX9360_REG_AFE_PARAM1_FREQ_83_33HZ, "afe_param1_phr" },
{ SX9360_REG_AFE_PARAM0_PHM, SX9360_REG_AFE_PARAM0_RSVD | { SX9360_REG_AFE_PARAM0_PHM, SX9360_REG_AFE_PARAM0_RSVD |
SX9360_REG_AFE_PARAM0_RESOLUTION_128 }, SX9360_REG_AFE_PARAM0_RESOLUTION_128, "afe_param0_phm" },
{ SX9360_REG_AFE_PARAM1_PHM, SX9360_REG_AFE_PARAM1_AGAIN_PHM_6PF | { SX9360_REG_AFE_PARAM1_PHM, SX9360_REG_AFE_PARAM1_AGAIN_PHM_6PF |
SX9360_REG_AFE_PARAM1_FREQ_83_33HZ }, SX9360_REG_AFE_PARAM1_FREQ_83_33HZ, "afe_param1_phm" },
{ SX9360_REG_PROX_CTRL0_PHR, SX9360_REG_PROX_CTRL0_GAIN_1 | { SX9360_REG_PROX_CTRL0_PHR, SX9360_REG_PROX_CTRL0_GAIN_1 |
SX9360_REG_PROX_CTRL0_RAWFILT_1P50 }, SX9360_REG_PROX_CTRL0_RAWFILT_1P50, "prox_ctrl0_phr" },
{ SX9360_REG_PROX_CTRL0_PHM, SX9360_REG_PROX_CTRL0_GAIN_1 | { SX9360_REG_PROX_CTRL0_PHM, SX9360_REG_PROX_CTRL0_GAIN_1 |
SX9360_REG_PROX_CTRL0_RAWFILT_1P50 }, SX9360_REG_PROX_CTRL0_RAWFILT_1P50, "prox_ctrl0_phm" },
{ SX9360_REG_PROX_CTRL1, SX9360_REG_PROX_CTRL1_AVGNEG_THRESH_16K }, { SX9360_REG_PROX_CTRL1, SX9360_REG_PROX_CTRL1_AVGNEG_THRESH_16K, "prox_ctrl1" },
{ SX9360_REG_PROX_CTRL2, SX9360_REG_PROX_CTRL2_AVGDEB_2SAMPLES | { SX9360_REG_PROX_CTRL2, SX9360_REG_PROX_CTRL2_AVGDEB_2SAMPLES |
SX9360_REG_PROX_CTRL2_AVGPOS_THRESH_16K }, SX9360_REG_PROX_CTRL2_AVGPOS_THRESH_16K, "prox_ctrl2" },
{ SX9360_REG_PROX_CTRL3, SX9360_REG_PROX_CTRL3_AVGNEG_FILT_2 | { SX9360_REG_PROX_CTRL3, SX9360_REG_PROX_CTRL3_AVGNEG_FILT_2 |
SX9360_REG_PROX_CTRL3_AVGPOS_FILT_256 }, SX9360_REG_PROX_CTRL3_AVGPOS_FILT_256, "prox_ctrl3" },
{ SX9360_REG_PROX_CTRL4, 0x00 }, { SX9360_REG_PROX_CTRL4, 0x00, "prox_ctrl4" },
{ SX9360_REG_PROX_CTRL5, SX9360_REG_PROX_CTRL5_PROXTHRESH_32 }, { SX9360_REG_PROX_CTRL5, SX9360_REG_PROX_CTRL5_PROXTHRESH_32, "prox_ctrl5" },
}; };
/* Activate all channels and perform an initial compensation. */ /* Activate all channels and perform an initial compensation. */
......
...@@ -1051,8 +1051,8 @@ MODULE_DEVICE_TABLE(i2c, sx9500_id); ...@@ -1051,8 +1051,8 @@ MODULE_DEVICE_TABLE(i2c, sx9500_id);
static struct i2c_driver sx9500_driver = { static struct i2c_driver sx9500_driver = {
.driver = { .driver = {
.name = SX9500_DRIVER_NAME, .name = SX9500_DRIVER_NAME,
.acpi_match_table = ACPI_PTR(sx9500_acpi_match), .acpi_match_table = sx9500_acpi_match,
.of_match_table = of_match_ptr(sx9500_of_match), .of_match_table = sx9500_of_match,
.pm = pm_sleep_ptr(&sx9500_pm_ops), .pm = pm_sleep_ptr(&sx9500_pm_ops),
}, },
.probe_new = sx9500_probe, .probe_new = sx9500_probe,
......
...@@ -424,6 +424,27 @@ static const struct iio_buffer_setup_ops sx_common_buffer_setup_ops = { ...@@ -424,6 +424,27 @@ static const struct iio_buffer_setup_ops sx_common_buffer_setup_ops = {
.postdisable = sx_common_buffer_postdisable, .postdisable = sx_common_buffer_postdisable,
}; };
void sx_common_get_raw_register_config(struct device *dev,
struct sx_common_reg_default *reg_def)
{
#ifdef CONFIG_ACPI
struct acpi_device *adev = ACPI_COMPANION(dev);
u32 raw = 0, ret;
char prop[80];
if (!reg_def->property || !adev)
return;
snprintf(prop, ARRAY_SIZE(prop), "%s,reg_%s", acpi_device_hid(adev), reg_def->property);
ret = device_property_read_u32(dev, prop, &raw);
if (ret)
return;
reg_def->def = raw;
#endif
}
EXPORT_SYMBOL_NS_GPL(sx_common_get_raw_register_config, SEMTECH_PROX);
#define SX_COMMON_SOFT_RESET 0xde #define SX_COMMON_SOFT_RESET 0xde
static int sx_common_init_device(struct device *dev, struct iio_dev *indio_dev) static int sx_common_init_device(struct device *dev, struct iio_dev *indio_dev)
......
This diff is collapsed.
This diff is collapsed.
...@@ -46,7 +46,7 @@ static int iio_loop_thread(void *data) ...@@ -46,7 +46,7 @@ static int iio_loop_thread(void *data)
set_freezable(); set_freezable();
do { do {
iio_trigger_poll_chained(trig); iio_trigger_poll_nested(trig);
} while (likely(!kthread_freezable_should_stop(NULL))); } while (likely(!kthread_freezable_should_stop(NULL)));
return 0; return 0;
......
...@@ -10,7 +10,6 @@ source "drivers/staging/iio/adc/Kconfig" ...@@ -10,7 +10,6 @@ source "drivers/staging/iio/adc/Kconfig"
source "drivers/staging/iio/addac/Kconfig" source "drivers/staging/iio/addac/Kconfig"
source "drivers/staging/iio/frequency/Kconfig" source "drivers/staging/iio/frequency/Kconfig"
source "drivers/staging/iio/impedance-analyzer/Kconfig" source "drivers/staging/iio/impedance-analyzer/Kconfig"
source "drivers/staging/iio/meter/Kconfig"
source "drivers/staging/iio/resolver/Kconfig" source "drivers/staging/iio/resolver/Kconfig"
endmenu endmenu
...@@ -8,5 +8,4 @@ obj-y += adc/ ...@@ -8,5 +8,4 @@ obj-y += adc/
obj-y += addac/ obj-y += addac/
obj-y += frequency/ obj-y += frequency/
obj-y += impedance-analyzer/ obj-y += impedance-analyzer/
obj-y += meter/
obj-y += resolver/ obj-y += resolver/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment