forked from luck/tmp_suning_uos_patched
Staging/IIO driver patches for 5.9-rc1
Here is the large set of Staging and IIO driver patches for 5.9-rc1. Lots of churn here, but overall the size increase in lines added is small, while adding a load of new IIO drivers. Major things in here: - lots and lots of IIO new drivers and frameworks added - IIO driver fixes and updates - lots of tiny coding style cleanups for staging drivers - vc04_services major reworks and cleanups We had 3 set of drivers move out of staging in this round as well: - wilc1000 wireless driver moved out of staging - speakup moved out of staging - most USB driver moved out of staging Full details are in the shortlog. All of these have been in linux-next with no reported issues. The last few changes here were to resolve reported linux-next issues, and they seem to have resolved the problems. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCXyv2rA8cZ3JlZ0Brcm9h aC5jb20ACgkQMUfUDdst+yngIgCfZOVj022X+paV81NwvO/TroMDA7oAn1C4XCmY Fxz55oHIyk9lbQxsDhID =ujqG -----END PGP SIGNATURE----- Merge tag 'staging-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging/IIO driver updates from Greg KH: "Here is the large set of Staging and IIO driver patches for 5.9-rc1. Lots of churn here, but overall the size increase in lines added is small, while adding a load of new IIO drivers. Major things in here: - lots and lots of IIO new drivers and frameworks added - IIO driver fixes and updates - lots of tiny coding style cleanups for staging drivers - vc04_services major reworks and cleanups We had 3 set of drivers move out of staging in this round as well: - wilc1000 wireless driver moved out of staging - speakup moved out of staging - most USB driver moved out of staging Full details are in the shortlog. All of these have been in linux-next with no reported issues. The last few changes here were to resolve reported linux-next issues, and they seem to have resolved the problems" * tag 'staging-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (428 commits) staging: most: fix up movement of USB driver staging: rts5208: clear alignment style issues staging: r8188eu: replace rtw_netdev_priv define with inline function staging: netlogic: clear alignment style issues staging: android: ashmem: Fix lockdep warning for write operation drivers: most: add USB adapter driver staging: most: Use %pM format specifier for MAC addresses staging: ks7010: Use %pM format specifier for MAC addresses staging: qlge: qlge_dbg: removed comment repition staging: wfx: Use flex_array_size() helper in memcpy() staging: rtl8723bs: Align macro definitions staging: rtl8723bs: Clean up function declations staging: rtl8723bs: Fix coding style errors drivers: staging: audio: Fix the missing header file for helper file staging: greybus: audio: Enable GB codec, audio module compilation. staging: greybus: audio: Add helper APIs for dynamic audio modules staging: greybus: audio: Resolve compilation error in topology parser staging: greybus: audio: Resolve compilation errors for GB codec module staging: greybus: audio: Maintain jack list within GB Audio module staging: greybus: audio: Update snd_jack FW usage as per new APIs ...
This commit is contained in:
commit
c0c419c045
|
@ -1569,7 +1569,8 @@ What: /sys/bus/iio/devices/iio:deviceX/in_concentrationX_voc_raw
|
|||
KernelVersion: 4.3
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Raw (unscaled no offset etc.) percentage reading of a substance.
|
||||
Raw (unscaled no offset etc.) reading of a substance. Units
|
||||
after application of scale and offset are percents.
|
||||
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_resistance_raw
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_resistanceX_raw
|
||||
|
|
20
Documentation/ABI/testing/sysfs-bus-iio-icm42600
Normal file
20
Documentation/ABI/testing/sysfs-bus-iio-icm42600
Normal file
|
@ -0,0 +1,20 @@
|
|||
What: /sys/bus/iio/devices/iio:deviceX/in_accel_x_calibbias
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_accel_y_calibbias
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_accel_z_calibbias
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_x_calibbias
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_y_calibbias
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_z_calibbias
|
||||
KernelVersion: 5.8
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Hardware applied calibration offset (assumed to fix production
|
||||
inaccuracies). Values represent a real physical offset expressed
|
||||
in SI units (m/s^2 for accelerometer and rad/s for gyroscope).
|
||||
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_accel_calibbias_available
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_calibbias_available
|
||||
KernelVersion: 5.8
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Range of available values for hardware offset. Values in SI
|
||||
units (m/s^2 for accelerometer and rad/s for gyroscope).
|
34
Documentation/ABI/testing/sysfs-bus-iio-scd30
Normal file
34
Documentation/ABI/testing/sysfs-bus-iio-scd30
Normal file
|
@ -0,0 +1,34 @@
|
|||
What: /sys/bus/iio/devices/iio:deviceX/calibration_auto_enable
|
||||
Date: June 2020
|
||||
KernelVersion: 5.8
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Contaminants build-up in the measurement chamber or optical
|
||||
elements deterioration leads to sensor drift.
|
||||
|
||||
One can compensate for sensor drift by using automatic self
|
||||
calibration procedure (asc).
|
||||
|
||||
Writing 1 or 0 to this attribute will respectively activate or
|
||||
deactivate asc.
|
||||
|
||||
Upon reading current asc status is returned.
|
||||
|
||||
What: /sys/bus/iio/devices/iio:deviceX/calibration_forced_value
|
||||
Date: June 2020
|
||||
KernelVersion: 5.8
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Contaminants build-up in the measurement chamber or optical
|
||||
elements deterioration leads to sensor drift.
|
||||
|
||||
One can compensate for sensor drift by using forced
|
||||
recalibration (frc). This is useful in case there's known
|
||||
co2 reference available nearby the sensor.
|
||||
|
||||
Picking value from the range [400 1 2000] and writing it to the
|
||||
sensor will set frc.
|
||||
|
||||
Upon reading current frc value is returned. Note that after
|
||||
power cycling default value (i.e 400) is returned even though
|
||||
internally sensor had recalibrated itself.
|
|
@ -1531,7 +1531,7 @@ The Free Software Foundation may publish new, revised versions
|
|||
of the GNU Free Documentation License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns. See
|
||||
http://www.gnu.org/copyleft/.
|
||||
https://www.gnu.org/copyleft/.
|
||||
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
|
@ -12,8 +12,8 @@ maintainers:
|
|||
description: |
|
||||
Analog Devices ADXL345/ADXL375 3-Axis Digital Accelerometers that supports
|
||||
both I2C & SPI interfaces.
|
||||
http://www.analog.com/en/products/mems/accelerometers/adxl345.html
|
||||
http://www.analog.com/en/products/sensors-mems/accelerometers/adxl375.html
|
||||
https://www.analog.com/en/products/mems/accelerometers/adxl345.html
|
||||
https://www.analog.com/en/products/sensors-mems/accelerometers/adxl375.html
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
Kionix KXSD9 Accelerometer device tree bindings
|
||||
|
||||
Required properties:
|
||||
- compatible: should be set to "kionix,kxsd9"
|
||||
- reg: i2c slave address
|
||||
|
||||
Optional properties:
|
||||
- vdd-supply: The input supply for VDD
|
||||
- iovdd-supply: The input supply for IOVDD
|
||||
- interrupts: The movement detection interrupt
|
||||
- mount-matrix: See mount-matrix.txt
|
||||
|
||||
Example:
|
||||
|
||||
kxsd9@18 {
|
||||
compatible = "kionix,kxsd9";
|
||||
reg = <0x18>;
|
||||
interrupt-parent = <&foo>;
|
||||
interrupts = <57 IRQ_TYPE_EDGE_FALLING>;
|
||||
iovdd-supply = <&bar>;
|
||||
vdd-supply = <&baz>;
|
||||
};
|
|
@ -0,0 +1,65 @@
|
|||
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/iio/accel/kionix,kxsd9.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Kionix KXSD9 Accelerometer
|
||||
|
||||
maintainers:
|
||||
- Jonathan Cameron <jic23@kernel.org>
|
||||
|
||||
description: |
|
||||
3 axis 12 bit accelerometer with +-8G range on all axes. Also has a
|
||||
12 bit auxiliary ADC channel. Interface is either SPI or I2C.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: kionix,kxsd9
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
vdd-supply: true
|
||||
iovdd-supply: true
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
mount-matrix:
|
||||
description: an optional 3x3 mounting rotation matrix.
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
||||
examples:
|
||||
- |
|
||||
# include <dt-bindings/interrupt-controller/irq.h>
|
||||
i2c {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
accel@18 {
|
||||
compatible = "kionix,kxsd9";
|
||||
reg = <0x18>;
|
||||
iovdd-supply = <&iovdd>;
|
||||
vdd-supply = <&vdd>;
|
||||
interrupts = <57 IRQ_TYPE_EDGE_FALLING>;
|
||||
mount-matrix = "-0.984807753012208", "0", "-0.173648177666930",
|
||||
"0", "-1", "0",
|
||||
"-0.173648177666930", "0", "0.984807753012208";
|
||||
};
|
||||
};
|
||||
- |
|
||||
# include <dt-bindings/interrupt-controller/irq.h>
|
||||
spi {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
accel@0 {
|
||||
compatible = "kionix,kxsd9";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <10000000>;
|
||||
};
|
||||
};
|
||||
...
|
|
@ -1,49 +0,0 @@
|
|||
* Ingenic JZ47xx ADC controller IIO bindings
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible: Should be one of:
|
||||
* ingenic,jz4725b-adc
|
||||
* ingenic,jz4740-adc
|
||||
* ingenic,jz4770-adc
|
||||
- reg: ADC controller registers location and length.
|
||||
- clocks: phandle to the SoC's ADC clock.
|
||||
- clock-names: Must be set to "adc".
|
||||
- #io-channel-cells: Must be set to <1> to indicate channels are selected
|
||||
by index.
|
||||
|
||||
ADC clients must use the format described in iio-bindings.txt, giving
|
||||
a phandle and IIO specifier pair ("io-channels") to the ADC controller.
|
||||
|
||||
Example:
|
||||
|
||||
#include <dt-bindings/iio/adc/ingenic,adc.h>
|
||||
|
||||
adc: adc@10070000 {
|
||||
compatible = "ingenic,jz4740-adc";
|
||||
#io-channel-cells = <1>;
|
||||
|
||||
reg = <0x10070000 0x30>;
|
||||
|
||||
clocks = <&cgu JZ4740_CLK_ADC>;
|
||||
clock-names = "adc";
|
||||
|
||||
interrupt-parent = <&intc>;
|
||||
interrupts = <18>;
|
||||
};
|
||||
|
||||
adc-keys {
|
||||
...
|
||||
compatible = "adc-keys";
|
||||
io-channels = <&adc INGENIC_ADC_AUX>;
|
||||
io-channel-names = "buttons";
|
||||
...
|
||||
};
|
||||
|
||||
battery {
|
||||
...
|
||||
compatible = "ingenic,jz4740-battery";
|
||||
io-channels = <&adc INGENIC_ADC_BATTERY>;
|
||||
io-channel-names = "battery";
|
||||
...
|
||||
};
|
71
Documentation/devicetree/bindings/iio/adc/ingenic,adc.yaml
Normal file
71
Documentation/devicetree/bindings/iio/adc/ingenic,adc.yaml
Normal file
|
@ -0,0 +1,71 @@
|
|||
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
||||
# Copyright 2019-2020 Artur Rojek
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: "http://devicetree.org/schemas/iio/adc/ingenic,adc.yaml#"
|
||||
$schema: "http://devicetree.org/meta-schemas/core.yaml#"
|
||||
|
||||
title: Ingenic JZ47xx ADC controller IIO bindings
|
||||
|
||||
maintainers:
|
||||
- Artur Rojek <contact@artur-rojek.eu>
|
||||
|
||||
description: >
|
||||
Industrial I/O subsystem bindings for ADC controller found in
|
||||
Ingenic JZ47xx SoCs.
|
||||
|
||||
ADC clients must use the format described in iio-bindings.txt, giving
|
||||
a phandle and IIO specifier pair ("io-channels") to the ADC controller.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- ingenic,jz4725b-adc
|
||||
- ingenic,jz4740-adc
|
||||
- ingenic,jz4770-adc
|
||||
|
||||
'#io-channel-cells':
|
||||
const: 1
|
||||
description:
|
||||
Must be set to <1> to indicate channels are selected by index.
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
clocks:
|
||||
maxItems: 1
|
||||
|
||||
clock-names:
|
||||
items:
|
||||
- const: adc
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- '#io-channel-cells'
|
||||
- reg
|
||||
- clocks
|
||||
- clock-names
|
||||
- interrupts
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/clock/jz4740-cgu.h>
|
||||
#include <dt-bindings/iio/adc/ingenic,adc.h>
|
||||
|
||||
adc@10070000 {
|
||||
compatible = "ingenic,jz4740-adc";
|
||||
#io-channel-cells = <1>;
|
||||
|
||||
reg = <0x10070000 0x30>;
|
||||
|
||||
clocks = <&cgu JZ4740_CLK_ADC>;
|
||||
clock-names = "adc";
|
||||
|
||||
interrupt-parent = <&intc>;
|
||||
interrupts = <18>;
|
||||
};
|
|
@ -1,173 +0,0 @@
|
|||
Qualcomm's SPMI PMIC ADC
|
||||
|
||||
- SPMI PMIC voltage ADC (VADC) provides interface to clients to read
|
||||
voltage. The VADC is a 15-bit sigma-delta ADC.
|
||||
- SPMI PMIC5 voltage ADC (ADC) provides interface to clients to read
|
||||
voltage. The VADC is a 16-bit sigma-delta ADC.
|
||||
|
||||
VADC node:
|
||||
|
||||
- compatible:
|
||||
Usage: required
|
||||
Value type: <string>
|
||||
Definition: Should contain "qcom,spmi-vadc".
|
||||
Should contain "qcom,spmi-adc5" for PMIC5 ADC driver.
|
||||
Should contain "qcom,spmi-adc-rev2" for PMIC rev2 ADC driver.
|
||||
Should contain "qcom,pms405-adc" for PMS405 PMIC
|
||||
|
||||
- reg:
|
||||
Usage: required
|
||||
Value type: <prop-encoded-array>
|
||||
Definition: VADC base address in the SPMI PMIC register map.
|
||||
|
||||
- #address-cells:
|
||||
Usage: required
|
||||
Value type: <u32>
|
||||
Definition: Must be one. Child node 'reg' property should define ADC
|
||||
channel number.
|
||||
|
||||
- #size-cells:
|
||||
Usage: required
|
||||
Value type: <u32>
|
||||
Definition: Must be zero.
|
||||
|
||||
- #io-channel-cells:
|
||||
Usage: required
|
||||
Value type: <u32>
|
||||
Definition: Must be one. For details about IIO bindings see:
|
||||
Documentation/devicetree/bindings/iio/iio-bindings.txt
|
||||
|
||||
- interrupts:
|
||||
Usage: optional
|
||||
Value type: <prop-encoded-array>
|
||||
Definition: End of conversion interrupt.
|
||||
|
||||
Channel node properties:
|
||||
|
||||
- reg:
|
||||
Usage: required
|
||||
Value type: <u32>
|
||||
Definition: ADC channel number.
|
||||
See include/dt-bindings/iio/qcom,spmi-vadc.h
|
||||
|
||||
- label:
|
||||
Usage: required for "qcom,spmi-adc5" and "qcom,spmi-adc-rev2"
|
||||
Value type: <empty>
|
||||
Definition: ADC input of the platform as seen in the schematics.
|
||||
For thermistor inputs connected to generic AMUX or GPIO inputs
|
||||
these can vary across platform for the same pins. Hence select
|
||||
the platform schematics name for this channel.
|
||||
|
||||
- qcom,decimation:
|
||||
Usage: optional
|
||||
Value type: <u32>
|
||||
Definition: This parameter is used to decrease ADC sampling rate.
|
||||
Quicker measurements can be made by reducing decimation ratio.
|
||||
- For compatible property "qcom,spmi-vadc", valid values are
|
||||
512, 1024, 2048, 4096. If property is not found, default value
|
||||
of 512 will be used.
|
||||
- For compatible property "qcom,spmi-adc5", valid values are 250, 420
|
||||
and 840. If property is not found, default value of 840 is used.
|
||||
- For compatible property "qcom,spmi-adc-rev2", valid values are 256,
|
||||
512 and 1024. If property is not present, default value is 1024.
|
||||
|
||||
- qcom,pre-scaling:
|
||||
Usage: optional
|
||||
Value type: <u32 array>
|
||||
Definition: Used for scaling the channel input signal before the signal is
|
||||
fed to VADC. The configuration for this node is to know the
|
||||
pre-determined ratio and use it for post scaling. Select one from
|
||||
the following options.
|
||||
<1 1>, <1 3>, <1 4>, <1 6>, <1 20>, <1 8>, <10 81>, <1 10>
|
||||
If property is not found default value depending on chip will be used.
|
||||
|
||||
- qcom,ratiometric:
|
||||
Usage: optional
|
||||
Value type: <empty>
|
||||
Definition: Channel calibration type.
|
||||
- For compatible property "qcom,spmi-vadc", if this property is
|
||||
specified VADC will use the VDD reference (1.8V) and GND for
|
||||
channel calibration. If property is not found, channel will be
|
||||
calibrated with 0.625V and 1.25V reference channels, also
|
||||
known as absolute calibration.
|
||||
- For compatible property "qcom,spmi-adc5" and "qcom,spmi-adc-rev2",
|
||||
if this property is specified VADC will use the VDD reference
|
||||
(1.875V) and GND for channel calibration. If property is not found,
|
||||
channel will be calibrated with 0V and 1.25V reference channels,
|
||||
also known as absolute calibration.
|
||||
|
||||
- qcom,hw-settle-time:
|
||||
Usage: optional
|
||||
Value type: <u32>
|
||||
Definition: Time between AMUX getting configured and the ADC starting
|
||||
conversion. The 'hw_settle_time' is an index used from valid values
|
||||
and programmed in hardware to achieve the hardware settling delay.
|
||||
- For compatible property "qcom,spmi-vadc" and "qcom,spmi-adc-rev2",
|
||||
Delay = 100us * (hw_settle_time) for hw_settle_time < 11,
|
||||
and 2ms * (hw_settle_time - 10) otherwise.
|
||||
Valid values are: 0, 100, 200, 300, 400, 500, 600, 700, 800,
|
||||
900 us and 1, 2, 4, 6, 8, 10 ms.
|
||||
If property is not found, channel will use 0us.
|
||||
- For compatible property "qcom,spmi-adc5", delay = 15us for
|
||||
value 0, 100us * (value) for values < 11,
|
||||
and 2ms * (value - 10) otherwise.
|
||||
Valid values are: 15, 100, 200, 300, 400, 500, 600, 700, 800,
|
||||
900 us and 1, 2, 4, 6, 8, 10 ms
|
||||
Certain controller digital versions have valid values of
|
||||
15, 100, 200, 300, 400, 500, 600, 700, 1, 2, 4, 8, 16, 32, 64, 128 ms
|
||||
If property is not found, channel will use 15us.
|
||||
|
||||
- qcom,avg-samples:
|
||||
Usage: optional
|
||||
Value type: <u32>
|
||||
Definition: Number of samples to be used for measurement.
|
||||
Averaging provides the option to obtain a single measurement
|
||||
from the ADC that is an average of multiple samples. The value
|
||||
selected is 2^(value).
|
||||
- For compatible property "qcom,spmi-vadc", valid values
|
||||
are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512
|
||||
If property is not found, 1 sample will be used.
|
||||
- For compatible property "qcom,spmi-adc5" and "qcom,spmi-adc-rev2",
|
||||
valid values are: 1, 2, 4, 8, 16
|
||||
If property is not found, 1 sample will be used.
|
||||
|
||||
NOTE:
|
||||
|
||||
For compatible property "qcom,spmi-vadc" following channels, also known as
|
||||
reference point channels, are used for result calibration and their channel
|
||||
configuration nodes should be defined:
|
||||
VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV,
|
||||
VADC_GND_REF and VADC_VDD_VADC.
|
||||
|
||||
Example:
|
||||
|
||||
#include <dt-bindings/iio/qcom,spmi-vadc.h>
|
||||
#include <linux/irq.h>
|
||||
/* ... */
|
||||
|
||||
/* VADC node */
|
||||
pmic_vadc: vadc@3100 {
|
||||
compatible = "qcom,spmi-vadc";
|
||||
reg = <0x3100>;
|
||||
interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
#io-channel-cells = <1>;
|
||||
io-channel-ranges;
|
||||
|
||||
/* Channel node */
|
||||
adc-chan@VADC_LR_MUX10_USB_ID {
|
||||
reg = <VADC_LR_MUX10_USB_ID>;
|
||||
qcom,decimation = <512>;
|
||||
qcom,ratiometric;
|
||||
qcom,hw-settle-time = <200>;
|
||||
qcom,avg-samples = <1>;
|
||||
qcom,pre-scaling = <1 3>;
|
||||
};
|
||||
};
|
||||
|
||||
/* IIO client node */
|
||||
usb {
|
||||
io-channels = <&pmic_vadc VADC_LR_MUX10_USB_ID>;
|
||||
io-channel-names = "vadc";
|
||||
};
|
278
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml
Normal file
278
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml
Normal file
|
@ -0,0 +1,278 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/iio/adc/qcom,spmi-vadc.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Qualcomm's SPMI PMIC ADC
|
||||
|
||||
maintainers:
|
||||
- Andy Gross <agross@kernel.org>
|
||||
- Bjorn Andersson <bjorn.andersson@linaro.org>
|
||||
|
||||
description: |
|
||||
SPMI PMIC voltage ADC (VADC) provides interface to clients to read
|
||||
voltage. The VADC is a 15-bit sigma-delta ADC.
|
||||
SPMI PMIC5/PMIC7 voltage ADC (ADC) provides interface to clients to read
|
||||
voltage. The VADC is a 16-bit sigma-delta ADC.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
oneOf:
|
||||
- items:
|
||||
- const: qcom,pms405-adc
|
||||
- const: qcom,spmi-adc-rev2
|
||||
|
||||
- items:
|
||||
- enum:
|
||||
- qcom,spmi-vadc
|
||||
- qcom,spmi-adc5
|
||||
- qcom,spmi-adc-rev2
|
||||
- qcom,spmi-adc7
|
||||
|
||||
reg:
|
||||
description: VADC base address in the SPMI PMIC register map
|
||||
maxItems: 1
|
||||
|
||||
'#address-cells':
|
||||
const: 1
|
||||
|
||||
'#size-cells':
|
||||
const: 0
|
||||
|
||||
'#io-channel-cells':
|
||||
const: 1
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
description:
|
||||
End of conversion interrupt.
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- '#address-cells'
|
||||
- '#size-cells'
|
||||
- '#io-channel-cells'
|
||||
|
||||
patternProperties:
|
||||
"^.*@[0-9a-f]+$":
|
||||
type: object
|
||||
description: |
|
||||
Represents the external channels which are connected to the ADC.
|
||||
For compatible property "qcom,spmi-vadc" following channels, also known as
|
||||
reference point channels, are used for result calibration and their channel
|
||||
configuration nodes should be defined:
|
||||
VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV,
|
||||
VADC_GND_REF and VADC_VDD_VADC.
|
||||
|
||||
properties:
|
||||
reg:
|
||||
description: |
|
||||
ADC channel number.
|
||||
See include/dt-bindings/iio/qcom,spmi-vadc.h
|
||||
For PMIC7 ADC, the channel numbers are specified separately per PMIC
|
||||
in the PMIC-specific files in include/dt-bindings/iio/.
|
||||
|
||||
label:
|
||||
$ref: /schemas/types.yaml#/definitions/string
|
||||
description: |
|
||||
ADC input of the platform as seen in the schematics.
|
||||
For thermistor inputs connected to generic AMUX or GPIO inputs
|
||||
these can vary across platform for the same pins. Hence select
|
||||
the platform schematics name for this channel.
|
||||
|
||||
qcom,decimation:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: |
|
||||
This parameter is used to decrease ADC sampling rate.
|
||||
Quicker measurements can be made by reducing decimation ratio.
|
||||
|
||||
qcom,pre-scaling:
|
||||
description: |
|
||||
Used for scaling the channel input signal before the signal is
|
||||
fed to VADC. The configuration for this node is to know the
|
||||
pre-determined ratio and use it for post scaling. It is a pair of
|
||||
integers, denoting the numerator and denominator of the fraction by which
|
||||
input signal is multiplied. For example, <1 3> indicates the signal is scaled
|
||||
down to 1/3 of its value before ADC measurement.
|
||||
If property is not found default value depending on chip will be used.
|
||||
allOf:
|
||||
- $ref: /schemas/types.yaml#/definitions/uint32-array
|
||||
oneOf:
|
||||
- items:
|
||||
- const: 1
|
||||
- enum: [ 1, 3, 4, 6, 20, 8, 10 ]
|
||||
|
||||
- items:
|
||||
- const: 10
|
||||
- const: 81
|
||||
|
||||
qcom,ratiometric:
|
||||
description: |
|
||||
Channel calibration type.
|
||||
- For compatible property "qcom,spmi-vadc", if this property is
|
||||
specified VADC will use the VDD reference (1.8V) and GND for
|
||||
channel calibration. If property is not found, channel will be
|
||||
calibrated with 0.625V and 1.25V reference channels, also
|
||||
known as absolute calibration.
|
||||
- For compatible property "qcom,spmi-adc5", "qcom,spmi-adc7" and
|
||||
"qcom,spmi-adc-rev2", if this property is specified VADC will use
|
||||
the VDD reference (1.875V) and GND for channel calibration. If
|
||||
property is not found, channel will be calibrated with 0V and 1.25V
|
||||
reference channels, also known as absolute calibration.
|
||||
type: boolean
|
||||
|
||||
qcom,hw-settle-time:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: |
|
||||
Time between AMUX getting configured and the ADC starting
|
||||
conversion. The 'hw_settle_time' is an index used from valid values
|
||||
and programmed in hardware to achieve the hardware settling delay.
|
||||
|
||||
qcom,avg-samples:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: |
|
||||
Number of samples to be used for measurement.
|
||||
Averaging provides the option to obtain a single measurement
|
||||
from the ADC that is an average of multiple samples. The value
|
||||
selected is 2^(value).
|
||||
|
||||
required:
|
||||
- reg
|
||||
|
||||
allOf:
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
const: qcom,spmi-vadc
|
||||
|
||||
then:
|
||||
patternProperties:
|
||||
"^.*@[0-9a-f]+$":
|
||||
properties:
|
||||
qcom,decimation:
|
||||
enum: [ 512, 1024, 2048, 4096 ]
|
||||
default: 512
|
||||
|
||||
qcom,hw-settle-time:
|
||||
enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
|
||||
4, 6, 8, 10 ]
|
||||
default: 0
|
||||
|
||||
qcom,avg-samples:
|
||||
enum: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 ]
|
||||
default: 1
|
||||
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
const: qcom,spmi-adc-rev2
|
||||
|
||||
then:
|
||||
patternProperties:
|
||||
"^.*@[0-9a-f]+$":
|
||||
properties:
|
||||
qcom,decimation:
|
||||
enum: [ 256, 512, 1024 ]
|
||||
default: 1024
|
||||
|
||||
qcom,hw-settle-time:
|
||||
enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
|
||||
4, 6, 8, 10 ]
|
||||
default: 0
|
||||
|
||||
qcom,avg-samples:
|
||||
enum: [ 1, 2, 4, 8, 16 ]
|
||||
default: 1
|
||||
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
const: qcom,spmi-adc5
|
||||
|
||||
then:
|
||||
patternProperties:
|
||||
"^.*@[0-9a-f]+$":
|
||||
properties:
|
||||
qcom,decimation:
|
||||
enum: [ 250, 420, 840 ]
|
||||
default: 840
|
||||
|
||||
qcom,hw-settle-time:
|
||||
enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
|
||||
4, 6, 8, 10, 16, 32, 64, 128 ]
|
||||
default: 15
|
||||
|
||||
qcom,avg-samples:
|
||||
enum: [ 1, 2, 4, 8, 16 ]
|
||||
default: 1
|
||||
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
const: qcom,spmi-adc7
|
||||
|
||||
then:
|
||||
patternProperties:
|
||||
"^.*@[0-9a-f]+$":
|
||||
properties:
|
||||
qcom,decimation:
|
||||
enum: [ 85, 340, 1360 ]
|
||||
default: 1360
|
||||
|
||||
qcom,hw-settle-time:
|
||||
enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000,
|
||||
8000, 16000, 32000, 64000, 128000 ]
|
||||
default: 15
|
||||
|
||||
qcom,avg-samples:
|
||||
enum: [ 1, 2, 4, 8, 16 ]
|
||||
default: 1
|
||||
|
||||
examples:
|
||||
- |
|
||||
spmi_bus {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
/* VADC node */
|
||||
pmic_vadc: adc@3100 {
|
||||
compatible = "qcom,spmi-vadc";
|
||||
reg = <0x3100>;
|
||||
interrupts = <0x0 0x31 0x0 0x1>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
#io-channel-cells = <1>;
|
||||
io-channel-ranges;
|
||||
|
||||
/* Channel node */
|
||||
adc-chan@39 {
|
||||
reg = <0x39>;
|
||||
qcom,decimation = <512>;
|
||||
qcom,ratiometric;
|
||||
qcom,hw-settle-time = <200>;
|
||||
qcom,avg-samples = <1>;
|
||||
qcom,pre-scaling = <1 3>;
|
||||
};
|
||||
|
||||
adc-chan@9 {
|
||||
reg = <0x9>;
|
||||
};
|
||||
|
||||
adc-chan@a {
|
||||
reg = <0xa>;
|
||||
};
|
||||
|
||||
adc-chan@e {
|
||||
reg = <0xe>;
|
||||
};
|
||||
|
||||
adc-chan@f {
|
||||
reg = <0xf>;
|
||||
};
|
||||
};
|
||||
};
|
45
Documentation/devicetree/bindings/iio/adc/ti,ads8688.yaml
Normal file
45
Documentation/devicetree/bindings/iio/adc/ti,ads8688.yaml
Normal file
|
@ -0,0 +1,45 @@
|
|||
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/iio/adc/ti,ads8688.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Texas Instruments' ADS8684 and ADS8688 ADC chip
|
||||
|
||||
maintainers:
|
||||
- Sean Nyekjaer <sean@geanix.com>
|
||||
|
||||
description: |
|
||||
SPI 16bit ADCs with 4/8 channels.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- ti,ads8684
|
||||
- ti,ads8688
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
vref-supply:
|
||||
description: Optional external reference. If not supplied, assume
|
||||
REFSEL input tied low to enable the internal reference.
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
||||
examples:
|
||||
- |
|
||||
spi {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
adc@0 {
|
||||
compatible = "ti,ads8688";
|
||||
reg = <0>;
|
||||
vref-supply = <&vdd_supply>;
|
||||
spi-max-frequency = <1000000>;
|
||||
};
|
||||
};
|
||||
...
|
|
@ -1,20 +0,0 @@
|
|||
* Texas Instruments' ADS8684 and ADS8688 ADC chip
|
||||
|
||||
Required properties:
|
||||
- compatible: Should be "ti,ads8684" or "ti,ads8688"
|
||||
- reg: spi chip select number for the device
|
||||
|
||||
Recommended properties:
|
||||
- spi-max-frequency: Definition as per
|
||||
Documentation/devicetree/bindings/spi/spi-bus.txt
|
||||
|
||||
Optional properties:
|
||||
- vref-supply: The regulator supply for ADC reference voltage
|
||||
|
||||
Example:
|
||||
adc@0 {
|
||||
compatible = "ti,ads8688";
|
||||
reg = <0>;
|
||||
vref-supply = <&vdd_supply>;
|
||||
spi-max-frequency = <1000000>;
|
||||
};
|
|
@ -0,0 +1,68 @@
|
|||
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/iio/chemical/sensirion,scd30.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Sensirion SCD30 carbon dioxide sensor
|
||||
|
||||
maintainers:
|
||||
- Tomasz Duszynski <tomasz.duszynski@octakon.com>
|
||||
|
||||
description: |
|
||||
Air quality sensor capable of measuring co2 concentration, temperature
|
||||
and relative humidity.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- sensirion,scd30
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
vdd-supply: true
|
||||
|
||||
sensirion,sel-gpios:
|
||||
description: GPIO connected to the SEL line
|
||||
maxItems: 1
|
||||
|
||||
sensirion,pwm-gpios:
|
||||
description: GPIO connected to the PWM line
|
||||
maxItems: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
# include <dt-bindings/interrupt-controller/irq.h>
|
||||
i2c {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
co2-sensor@61 {
|
||||
compatible = "sensirion,scd30";
|
||||
reg = <0x61>;
|
||||
vdd-supply = <&vdd>;
|
||||
interrupt-parent = <&gpio0>;
|
||||
interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
};
|
||||
- |
|
||||
# include <dt-bindings/interrupt-controller/irq.h>
|
||||
serial {
|
||||
co2-sensor {
|
||||
compatible = "sensirion,scd30";
|
||||
vdd-supply = <&vdd>;
|
||||
interrupt-parent = <&gpio0>;
|
||||
interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
};
|
||||
|
||||
...
|
|
@ -6,7 +6,7 @@ Is is programmable through an SPI interface.
|
|||
|
||||
The internal DACs are loaded when the LOADDACS pin is pulled down.
|
||||
|
||||
http://www.ti.com/lit/ds/sbas106/sbas106.pdf
|
||||
https://www.ti.com/lit/ds/sbas106/sbas106.pdf
|
||||
|
||||
Required Properties:
|
||||
- compatible: Should be one of:
|
||||
|
|
|
@ -9,7 +9,7 @@ specifier is an array of one or more cells identifying the IIO
|
|||
output on a device. The length of an IIO specifier is defined by the
|
||||
value of a #io-channel-cells property in the IIO provider node.
|
||||
|
||||
[1] http://marc.info/?l=linux-iio&m=135902119507483&w=2
|
||||
[1] https://marc.info/?l=linux-iio&m=135902119507483&w=2
|
||||
|
||||
==IIO providers==
|
||||
|
||||
|
|
|
@ -37,6 +37,15 @@ properties:
|
|||
set if the specified interrupt pin should be configured as
|
||||
open drain. If not set, defaults to push-pull.
|
||||
|
||||
vdd-supply:
|
||||
description: provide VDD power to the sensor.
|
||||
|
||||
vddio-supply:
|
||||
description: provide VDD IO power to the sensor.
|
||||
|
||||
mount-matrix:
|
||||
description: an optional 3x3 mounting rotation matrix
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
@ -52,9 +61,14 @@ examples:
|
|||
bmi160@68 {
|
||||
compatible = "bosch,bmi160";
|
||||
reg = <0x68>;
|
||||
vdd-supply = <&pm8916_l17>;
|
||||
vddio-supply = <&pm8916_l6>;
|
||||
interrupt-parent = <&gpio4>;
|
||||
interrupts = <12 IRQ_TYPE_EDGE_RISING>;
|
||||
interrupt-names = "INT1";
|
||||
mount-matrix = "0", "1", "0",
|
||||
"-1", "0", "0",
|
||||
"0", "0", "1";
|
||||
};
|
||||
};
|
||||
- |
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/iio/imu/invensense,icm42600.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: InvenSense ICM-426xx Inertial Measurement Unit
|
||||
|
||||
maintainers:
|
||||
- Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
|
||||
|
||||
description: |
|
||||
6-axis MotionTracking device that combines a 3-axis gyroscope and a 3-axis
|
||||
accelerometer.
|
||||
|
||||
It has a configurable host interface that supports I3C, I2C and SPI serial
|
||||
communication, features a 2kB FIFO and 2 programmable interrupts with
|
||||
ultra-low-power wake-on-motion support to minimize system power consumption.
|
||||
|
||||
Other industry-leading features include InvenSense on-chip APEX Motion
|
||||
Processing engine for gesture recognition, activity classification, and
|
||||
pedometer, along with programmable digital filters, and an embedded
|
||||
temperature sensor.
|
||||
|
||||
https://invensense.tdk.com/wp-content/uploads/2020/03/DS-000292-ICM-42605-v1.4.pdf
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- invensense,icm42600
|
||||
- invensense,icm42602
|
||||
- invensense,icm42605
|
||||
- invensense,icm42622
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
drive-open-drain:
|
||||
type: boolean
|
||||
|
||||
vdd-supply:
|
||||
description: Regulator that provides power to the sensor
|
||||
|
||||
vddio-supply:
|
||||
description: Regulator that provides power to the bus
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- interrupts
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
i2c0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
icm42605@68 {
|
||||
compatible = "invensense,icm42605";
|
||||
reg = <0x68>;
|
||||
interrupt-parent = <&gpio2>;
|
||||
interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
|
||||
vdd-supply = <&vdd>;
|
||||
vddio-supply = <&vddio>;
|
||||
};
|
||||
};
|
||||
- |
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
spi0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
icm42602@0 {
|
||||
compatible = "invensense,icm42602";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <24000000>;
|
||||
spi-cpha;
|
||||
spi-cpol;
|
||||
interrupt-parent = <&gpio1>;
|
||||
interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
|
||||
vdd-supply = <&vdd>;
|
||||
vddio-supply = <&vddio>;
|
||||
};
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
* Avago APDS9300 ambient light sensor
|
||||
|
||||
http://www.avagotech.com/docs/AV02-1077EN
|
||||
https://www.avagotech.com/docs/AV02-1077EN
|
||||
|
||||
Required properties:
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
* Avago APDS9960 gesture/RGB/ALS/proximity sensor
|
||||
|
||||
http://www.avagotech.com/docs/AV02-4191EN
|
||||
https://www.avagotech.com/docs/AV02-4191EN
|
||||
|
||||
Required properties:
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ the optional generation of IIO events on rising/falling light threshold changes
|
|||
requires the use of interrupts. Without interrupts, only the simple reading
|
||||
of the current light value is supported through the IIO API.
|
||||
|
||||
http://www.ti.com/product/opt3001
|
||||
https://www.ti.com/product/opt3001
|
||||
|
||||
Required properties:
|
||||
- compatible: should be "ti,opt3001"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
STMicro VL6180 - ALS, range and proximity sensor
|
||||
|
||||
Link to datasheet: http://www.st.com/resource/en/datasheet/vl6180x.pdf
|
||||
Link to datasheet: https://www.st.com/resource/en/datasheet/vl6180x.pdf
|
||||
|
||||
Required properties:
|
||||
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
* AsahiKASEI AK8975 magnetometer sensor
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible : should be "asahi-kasei,ak8975"
|
||||
- reg : the I2C address of the magnetometer
|
||||
|
||||
Optional properties:
|
||||
|
||||
- gpios : should be device tree identifier of the magnetometer DRDY pin
|
||||
- vdd-supply: an optional regulator that needs to be on to provide VDD
|
||||
- mount-matrix: an optional 3x3 mounting rotation matrix
|
||||
|
||||
Example:
|
||||
|
||||
ak8975@c {
|
||||
compatible = "asahi-kasei,ak8975";
|
||||
reg = <0x0c>;
|
||||
gpios = <&gpj0 7 0>;
|
||||
vdd-supply = <&ldo_3v3_gnss>;
|
||||
mount-matrix = "-0.984807753012208", /* x0 */
|
||||
"0", /* y0 */
|
||||
"-0.173648177666930", /* z0 */
|
||||
"0", /* x1 */
|
||||
"-1", /* y1 */
|
||||
"0", /* z1 */
|
||||
"-0.173648177666930", /* x2 */
|
||||
"0", /* y2 */
|
||||
"0.984807753012208"; /* z2 */
|
||||
};
|
|
@ -0,0 +1,83 @@
|
|||
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/iio/magnetometer/asahi-kasei,ak8975.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: AsahiKASEI AK8975 magnetometer sensor
|
||||
|
||||
maintainers:
|
||||
- Jonathan Albrieux <jonathan.albrieux@gmail.com>
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
oneOf:
|
||||
- enum:
|
||||
- asahi-kasei,ak8975
|
||||
- asahi-kasei,ak8963
|
||||
- asahi-kasei,ak09911
|
||||
- asahi-kasei,ak09912
|
||||
- enum:
|
||||
- ak8975
|
||||
- ak8963
|
||||
- ak09911
|
||||
- ak09912
|
||||
deprecated: true
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
gpios:
|
||||
maxItems: 1
|
||||
description: |
|
||||
AK8975 has a "Data ready" pin (DRDY) which informs that data
|
||||
is ready to be read and is possible to listen on it. If used,
|
||||
this should be active high. Prefer interrupt over this.
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
description: interrupt for DRDY pin. Triggered on rising edge.
|
||||
|
||||
vdd-supply:
|
||||
description: |
|
||||
an optional regulator that needs to be on to provide VDD power to
|
||||
the sensor.
|
||||
|
||||
mount-matrix:
|
||||
description: an optional 3x3 mounting rotation matrix.
|
||||
|
||||
reset-gpios:
|
||||
description: |
|
||||
an optional pin needed for AK09911 to set the reset state. This should
|
||||
be usually active low
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
i2c {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
magnetometer@c {
|
||||
compatible = "asahi-kasei,ak8975";
|
||||
reg = <0x0c>;
|
||||
interrupt-parent = <&gpio6>;
|
||||
interrupts = <15 IRQ_TYPE_EDGE_RISING>;
|
||||
vdd-supply = <&ldo_3v3_gnss>;
|
||||
reset-gpios = <&msmgpio 111 GPIO_ACTIVE_LOW>;
|
||||
mount-matrix = "-0.984807753012208", /* x0 */
|
||||
"0", /* y0 */
|
||||
"-0.173648177666930", /* z0 */
|
||||
"0", /* x1 */
|
||||
"-1", /* y1 */
|
||||
"0", /* z1 */
|
||||
"-0.173648177666930", /* x2 */
|
||||
"0", /* y2 */
|
||||
"0.984807753012208"; /* z2 */
|
||||
};
|
||||
};
|
|
@ -4,7 +4,11 @@ http://ae-bst.resource.bosch.com/media/products/dokumente/bmc150/BST-BMC150-DS00
|
|||
|
||||
Required properties:
|
||||
|
||||
- compatible : should be "bosch,bmc150_magn"
|
||||
- compatible : should be one of:
|
||||
"bosch,bmc150_magn"
|
||||
"bosch,bmc156_magn"
|
||||
"bosch,bmm150"
|
||||
"bosch,bmm150_magn" (DEPRECATED, use bosch,bmm150)
|
||||
- reg : the I2C address of the magnetometer
|
||||
|
||||
Optional properties:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
* Microchip MCP41010/41050/41100/42010/42050/42100 Digital Potentiometer
|
||||
|
||||
Datasheet publicly available at:
|
||||
http://ww1.microchip.com/downloads/en/devicedoc/11195c.pdf
|
||||
https://ww1.microchip.com/downloads/en/devicedoc/11195c.pdf
|
||||
|
||||
The node for this driver must be a child node of a SPI controller, hence
|
||||
all mandatory properties described in
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
* Texas Instruments LMP91000 series of potentiostats
|
||||
|
||||
LMP91000: http://www.ti.com/lit/ds/symlink/lmp91000.pdf
|
||||
LMP91002: http://www.ti.com/lit/ds/symlink/lmp91002.pdf
|
||||
LMP91000: https://www.ti.com/lit/ds/symlink/lmp91000.pdf
|
||||
LMP91002: https://www.ti.com/lit/ds/symlink/lmp91002.pdf
|
||||
|
||||
Required properties:
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ description: |
|
|||
Bindings for the All Sensors DLH series pressure sensors.
|
||||
|
||||
Specifications about the sensors can be found at:
|
||||
http://www.allsensors.com/cad/DS-0355_Rev_B.PDF
|
||||
https://www.allsensors.com/cad/DS-0355_Rev_B.PDF
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
|
|
|
@ -17,9 +17,9 @@ description: |
|
|||
until it is received once again
|
||||
|
||||
Specifications about the devices can be found at:
|
||||
http://www.robot-electronics.co.uk/htm/srf04tech.htm
|
||||
https://www.robot-electronics.co.uk/htm/srf04tech.htm
|
||||
|
||||
http://www.maxbotix.com/documents/LV-MaxSonar-EZ_Datasheet.pdf
|
||||
https://www.maxbotix.com/documents/LV-MaxSonar-EZ_Datasheet.pdf
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
|
|
|
@ -52,14 +52,20 @@ properties:
|
|||
|
||||
patternProperties:
|
||||
"^timer@[0-2]$":
|
||||
description: The timer block channels that are used as timers.
|
||||
description: The timer block channels that are used as timers or counters.
|
||||
type: object
|
||||
properties:
|
||||
compatible:
|
||||
const: atmel,tcb-timer
|
||||
items:
|
||||
- enum:
|
||||
- atmel,tcb-timer
|
||||
- microchip,tcb-capture
|
||||
reg:
|
||||
description:
|
||||
List of channels to use for this particular timer.
|
||||
List of channels to use for this particular timer. In Microchip TCB capture
|
||||
mode channels are registered as a counter devices, for the qdec mode TCB0's
|
||||
channel <0> and <1> are required.
|
||||
|
||||
minItems: 1
|
||||
maxItems: 3
|
||||
|
||||
|
@ -153,3 +159,23 @@ examples:
|
|||
reg = <1>;
|
||||
};
|
||||
};
|
||||
/* TCB0 Capture with QDEC: */
|
||||
timer@f800c000 {
|
||||
compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <0xfff7c000 0x100>;
|
||||
interrupts = <18 4>;
|
||||
clocks = <&tcb0_clk>, <&clk32k>;
|
||||
clock-names = "t0_clk", "slow_clk";
|
||||
|
||||
timer@0 {
|
||||
compatible = "microchip,tcb-capture";
|
||||
reg = <0>, <1>;
|
||||
};
|
||||
|
||||
timer@2 {
|
||||
compatible = "atmel,tcb-timer";
|
||||
reg = <2>;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -262,7 +262,7 @@ the system.
|
|||
Counter Counts may be allocated via counter_count structures, and
|
||||
respective Counter Signal associations (Synapses) made via
|
||||
counter_synapse structures. Associated counter_synapse structures are
|
||||
stored as an array and set to the the synapses array member of the
|
||||
stored as an array and set to the synapses array member of the
|
||||
respective counter_count structure. These counter_count structures are
|
||||
set to the counts array member of an allocated counter_device structure
|
||||
before the Counter is registered to the system.
|
||||
|
|
|
@ -88,7 +88,7 @@ fields in iio_chan_spec definition::
|
|||
The driver implementing the accelerometer described above will have the
|
||||
following channel definition::
|
||||
|
||||
struct struct iio_chan_spec accel_channels[] = {
|
||||
struct iio_chan_spec accel_channels[] = {
|
||||
{
|
||||
.type = IIO_ACCEL,
|
||||
.modified = 1,
|
||||
|
|
38
MAINTAINERS
38
MAINTAINERS
|
@ -9036,6 +9036,14 @@ F: include/dt-bindings/interconnect/
|
|||
F: include/linux/interconnect-provider.h
|
||||
F: include/linux/interconnect.h
|
||||
|
||||
INVENSENSE ICM-426xx IMU DRIVER
|
||||
M: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
|
||||
L: linux-iio@vger.kernel.org
|
||||
S: Maintained
|
||||
W https://invensense.tdk.com/
|
||||
F: Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
|
||||
F: drivers/iio/imu/inv_icm42600/
|
||||
|
||||
INVENSENSE MPU-3050 GYROSCOPE DRIVER
|
||||
M: Linus Walleij <linus.walleij@linaro.org>
|
||||
L: linux-iio@vger.kernel.org
|
||||
|
@ -11411,7 +11419,6 @@ F: Documentation/devicetree/bindings/pwm/atmel-pwm.txt
|
|||
F: drivers/pwm/pwm-atmel.c
|
||||
|
||||
MICROCHIP SAMA5D2-COMPATIBLE ADC DRIVER
|
||||
M: Ludovic Desroches <ludovic.desroches@microchip.com>
|
||||
M: Eugen Hristev <eugen.hristev@microchip.com>
|
||||
L: linux-iio@vger.kernel.org
|
||||
S: Supported
|
||||
|
@ -15472,6 +15479,15 @@ S: Maintained
|
|||
F: drivers/misc/phantom.c
|
||||
F: include/uapi/linux/phantom.h
|
||||
|
||||
SENSIRION SCD30 CARBON DIOXIDE SENSOR DRIVER
|
||||
M: Tomasz Duszynski <tomasz.duszynski@octakon.com>
|
||||
S: Maintained
|
||||
F: Documentation/devicetree/bindings/iio/chemical/sensirion,scd30.yaml
|
||||
F: drivers/iio/chemical/scd30.h
|
||||
F: drivers/iio/chemical/scd30_core.c
|
||||
F: drivers/iio/chemical/scd30_i2c.c
|
||||
F: drivers/iio/chemical/scd30_serial.c
|
||||
|
||||
SENSIRION SPS30 AIR POLLUTION SENSOR DRIVER
|
||||
M: Tomasz Duszynski <tduszyns@gmail.com>
|
||||
S: Maintained
|
||||
|
@ -16171,6 +16187,16 @@ Q: https://patchwork.kernel.org/project/linux-sparse/list/
|
|||
B: https://bugzilla.kernel.org/enter_bug.cgi?component=Sparse&product=Tools
|
||||
F: include/linux/compiler.h
|
||||
|
||||
SPEAKUP CONSOLE SPEECH DRIVER
|
||||
M: William Hubbs <w.d.hubbs@gmail.com>
|
||||
M: Chris Brannon <chris@the-brannons.com>
|
||||
M: Kirk Reiser <kirk@reisers.ca>
|
||||
M: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||
L: speakup@linux-speakup.org
|
||||
S: Odd Fixes
|
||||
W: http://www.linux-speakup.org/
|
||||
F: drivers/accessibility/speakup/
|
||||
|
||||
SPEAR CLOCK FRAMEWORK SUPPORT
|
||||
M: Viresh Kumar <vireshk@kernel.org>
|
||||
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
|
||||
|
@ -16358,16 +16384,6 @@ L: linux-fbdev@vger.kernel.org
|
|||
S: Maintained
|
||||
F: drivers/staging/sm750fb/
|
||||
|
||||
STAGING - SPEAKUP CONSOLE SPEECH DRIVER
|
||||
M: William Hubbs <w.d.hubbs@gmail.com>
|
||||
M: Chris Brannon <chris@the-brannons.com>
|
||||
M: Kirk Reiser <kirk@reisers.ca>
|
||||
M: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||
L: speakup@linux-speakup.org
|
||||
S: Odd Fixes
|
||||
W: http://www.linux-speakup.org/
|
||||
F: drivers/staging/speakup/
|
||||
|
||||
STAGING - VIA VT665X DRIVERS
|
||||
M: Forest Bond <forest@alittletooquiet.net>
|
||||
S: Odd Fixes
|
||||
|
|
|
@ -31,4 +31,6 @@ config A11Y_BRAILLE_CONSOLE
|
|||
|
||||
If unsure, say N.
|
||||
|
||||
source "drivers/accessibility/speakup/Kconfig"
|
||||
|
||||
endif # ACCESSIBILITY
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
obj-y += braille/
|
||||
obj-$(CONFIG_SPEAKUP) += speakup/
|
||||
|
|
22
drivers/accessibility/speakup/TODO
Normal file
22
drivers/accessibility/speakup/TODO
Normal file
|
@ -0,0 +1,22 @@
|
|||
Speakup project home: http://www.linux-speakup.org
|
||||
|
||||
Mailing List: speakup@linux-speakup.org
|
||||
|
||||
Speakup is a kernel based screen review package for the linux operating
|
||||
system. It allows blind users to interact with applications on the
|
||||
linux console by means of synthetic speech.
|
||||
|
||||
Currently, speakup has one issue we know of.
|
||||
|
||||
It seems to only happen on SMP systems. It seems that text in the output buffer
|
||||
gets garbled because a lock is not set. This bug happens regularly, but no one
|
||||
has been able to find a situation which produces it consistently.
|
||||
|
||||
Patches, suggestions, corrections, etc, are definitely welcome.
|
||||
|
||||
We prefer that you contact us on the mailing list; however, if you do
|
||||
not want to subscribe to a mailing list, send your email to all of the
|
||||
following:
|
||||
|
||||
okash.khawaja@gmail.com, w.d.hubbs@gmail.com, chris@the-brannons.com,
|
||||
kirk@reisers.ca and samuel.thibault@ens-lyon.org.
|
|
@ -1554,7 +1554,6 @@ static int quad8_probe(struct device *dev, unsigned int id)
|
|||
indio_dev->num_channels = ARRAY_SIZE(quad8_channels);
|
||||
indio_dev->channels = quad8_channels;
|
||||
indio_dev->name = dev_name(dev);
|
||||
indio_dev->dev.parent = dev;
|
||||
|
||||
/* Initialize Counter device and driver data */
|
||||
quad8iio = iio_priv(indio_dev);
|
||||
|
|
|
@ -70,4 +70,15 @@ config FTM_QUADDEC
|
|||
To compile this driver as a module, choose M here: the
|
||||
module will be called ftm-quaddec.
|
||||
|
||||
config MICROCHIP_TCB_CAPTURE
|
||||
tristate "Microchip Timer Counter Capture driver"
|
||||
depends on HAS_IOMEM && OF
|
||||
select REGMAP_MMIO
|
||||
help
|
||||
Select this option to enable the Microchip Timer Counter Block
|
||||
capture driver.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called microchip-tcb-capture.
|
||||
|
||||
endif # COUNTER
|
||||
|
|
|
@ -10,3 +10,4 @@ obj-$(CONFIG_STM32_TIMER_CNT) += stm32-timer-cnt.o
|
|||
obj-$(CONFIG_STM32_LPTIMER_CNT) += stm32-lptimer-cnt.o
|
||||
obj-$(CONFIG_TI_EQEP) += ti-eqep.o
|
||||
obj-$(CONFIG_FTM_QUADDEC) += ftm-quaddec.o
|
||||
obj-$(CONFIG_MICROCHIP_TCB_CAPTURE) += microchip-tcb-capture.o
|
||||
|
|
397
drivers/counter/microchip-tcb-capture.c
Normal file
397
drivers/counter/microchip-tcb-capture.c
Normal file
|
@ -0,0 +1,397 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Copyright (C) 2020 Microchip
|
||||
*
|
||||
* Author: Kamel Bouhara <kamel.bouhara@bootlin.com>
|
||||
*/
|
||||
#include <linux/clk.h>
|
||||
#include <linux/counter.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <soc/at91/atmel_tcb.h>
|
||||
|
||||
#define ATMEL_TC_CMR_MASK (ATMEL_TC_LDRA_RISING | ATMEL_TC_LDRB_FALLING | \
|
||||
ATMEL_TC_ETRGEDG_RISING | ATMEL_TC_LDBDIS | \
|
||||
ATMEL_TC_LDBSTOP)
|
||||
|
||||
#define ATMEL_TC_QDEN BIT(8)
|
||||
#define ATMEL_TC_POSEN BIT(9)
|
||||
|
||||
struct mchp_tc_data {
|
||||
const struct atmel_tcb_config *tc_cfg;
|
||||
struct counter_device counter;
|
||||
struct regmap *regmap;
|
||||
int qdec_mode;
|
||||
int num_channels;
|
||||
int channel[2];
|
||||
bool trig_inverted;
|
||||
};
|
||||
|
||||
enum mchp_tc_count_function {
|
||||
MCHP_TC_FUNCTION_INCREASE,
|
||||
MCHP_TC_FUNCTION_QUADRATURE,
|
||||
};
|
||||
|
||||
static enum counter_count_function mchp_tc_count_functions[] = {
|
||||
[MCHP_TC_FUNCTION_INCREASE] = COUNTER_COUNT_FUNCTION_INCREASE,
|
||||
[MCHP_TC_FUNCTION_QUADRATURE] = COUNTER_COUNT_FUNCTION_QUADRATURE_X4,
|
||||
};
|
||||
|
||||
enum mchp_tc_synapse_action {
|
||||
MCHP_TC_SYNAPSE_ACTION_NONE = 0,
|
||||
MCHP_TC_SYNAPSE_ACTION_RISING_EDGE,
|
||||
MCHP_TC_SYNAPSE_ACTION_FALLING_EDGE,
|
||||
MCHP_TC_SYNAPSE_ACTION_BOTH_EDGE
|
||||
};
|
||||
|
||||
static enum counter_synapse_action mchp_tc_synapse_actions[] = {
|
||||
[MCHP_TC_SYNAPSE_ACTION_NONE] = COUNTER_SYNAPSE_ACTION_NONE,
|
||||
[MCHP_TC_SYNAPSE_ACTION_RISING_EDGE] = COUNTER_SYNAPSE_ACTION_RISING_EDGE,
|
||||
[MCHP_TC_SYNAPSE_ACTION_FALLING_EDGE] = COUNTER_SYNAPSE_ACTION_FALLING_EDGE,
|
||||
[MCHP_TC_SYNAPSE_ACTION_BOTH_EDGE] = COUNTER_SYNAPSE_ACTION_BOTH_EDGES,
|
||||
};
|
||||
|
||||
static struct counter_signal mchp_tc_count_signals[] = {
|
||||
{
|
||||
.id = 0,
|
||||
.name = "Channel A",
|
||||
},
|
||||
{
|
||||
.id = 1,
|
||||
.name = "Channel B",
|
||||
}
|
||||
};
|
||||
|
||||
static struct counter_synapse mchp_tc_count_synapses[] = {
|
||||
{
|
||||
.actions_list = mchp_tc_synapse_actions,
|
||||
.num_actions = ARRAY_SIZE(mchp_tc_synapse_actions),
|
||||
.signal = &mchp_tc_count_signals[0]
|
||||
},
|
||||
{
|
||||
.actions_list = mchp_tc_synapse_actions,
|
||||
.num_actions = ARRAY_SIZE(mchp_tc_synapse_actions),
|
||||
.signal = &mchp_tc_count_signals[1]
|
||||
}
|
||||
};
|
||||
|
||||
static int mchp_tc_count_function_get(struct counter_device *counter,
|
||||
struct counter_count *count,
|
||||
size_t *function)
|
||||
{
|
||||
struct mchp_tc_data *const priv = counter->priv;
|
||||
|
||||
if (priv->qdec_mode)
|
||||
*function = MCHP_TC_FUNCTION_QUADRATURE;
|
||||
else
|
||||
*function = MCHP_TC_FUNCTION_INCREASE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mchp_tc_count_function_set(struct counter_device *counter,
|
||||
struct counter_count *count,
|
||||
size_t function)
|
||||
{
|
||||
struct mchp_tc_data *const priv = counter->priv;
|
||||
u32 bmr, cmr;
|
||||
|
||||
regmap_read(priv->regmap, ATMEL_TC_BMR, &bmr);
|
||||
regmap_read(priv->regmap, ATMEL_TC_REG(priv->channel[0], CMR), &cmr);
|
||||
|
||||
/* Set capture mode */
|
||||
cmr &= ~ATMEL_TC_WAVE;
|
||||
|
||||
switch (function) {
|
||||
case MCHP_TC_FUNCTION_INCREASE:
|
||||
priv->qdec_mode = 0;
|
||||
/* Set highest rate based on whether soc has gclk or not */
|
||||
bmr &= ~(ATMEL_TC_QDEN | ATMEL_TC_POSEN);
|
||||
if (priv->tc_cfg->has_gclk)
|
||||
cmr |= ATMEL_TC_TIMER_CLOCK2;
|
||||
else
|
||||
cmr |= ATMEL_TC_TIMER_CLOCK1;
|
||||
/* Setup the period capture mode */
|
||||
cmr |= ATMEL_TC_CMR_MASK;
|
||||
cmr &= ~(ATMEL_TC_ABETRG | ATMEL_TC_XC0);
|
||||
break;
|
||||
case MCHP_TC_FUNCTION_QUADRATURE:
|
||||
if (!priv->tc_cfg->has_qdec)
|
||||
return -EINVAL;
|
||||
/* In QDEC mode settings both channels 0 and 1 are required */
|
||||
if (priv->num_channels < 2 || priv->channel[0] != 0 ||
|
||||
priv->channel[1] != 1) {
|
||||
pr_err("Invalid channels number or id for quadrature mode\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
priv->qdec_mode = 1;
|
||||
bmr |= ATMEL_TC_QDEN | ATMEL_TC_POSEN;
|
||||
cmr |= ATMEL_TC_ETRGEDG_RISING | ATMEL_TC_ABETRG | ATMEL_TC_XC0;
|
||||
break;
|
||||
}
|
||||
|
||||
regmap_write(priv->regmap, ATMEL_TC_BMR, bmr);
|
||||
regmap_write(priv->regmap, ATMEL_TC_REG(priv->channel[0], CMR), cmr);
|
||||
|
||||
/* Enable clock and trigger counter */
|
||||
regmap_write(priv->regmap, ATMEL_TC_REG(priv->channel[0], CCR),
|
||||
ATMEL_TC_CLKEN | ATMEL_TC_SWTRG);
|
||||
|
||||
if (priv->qdec_mode) {
|
||||
regmap_write(priv->regmap,
|
||||
ATMEL_TC_REG(priv->channel[1], CMR), cmr);
|
||||
regmap_write(priv->regmap,
|
||||
ATMEL_TC_REG(priv->channel[1], CCR),
|
||||
ATMEL_TC_CLKEN | ATMEL_TC_SWTRG);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mchp_tc_count_signal_read(struct counter_device *counter,
|
||||
struct counter_signal *signal,
|
||||
enum counter_signal_value *val)
|
||||
{
|
||||
struct mchp_tc_data *const priv = counter->priv;
|
||||
bool sigstatus;
|
||||
u32 sr;
|
||||
|
||||
regmap_read(priv->regmap, ATMEL_TC_REG(priv->channel[0], SR), &sr);
|
||||
|
||||
if (priv->trig_inverted)
|
||||
sigstatus = (sr & ATMEL_TC_MTIOB);
|
||||
else
|
||||
sigstatus = (sr & ATMEL_TC_MTIOA);
|
||||
|
||||
*val = sigstatus ? COUNTER_SIGNAL_HIGH : COUNTER_SIGNAL_LOW;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mchp_tc_count_action_get(struct counter_device *counter,
|
||||
struct counter_count *count,
|
||||
struct counter_synapse *synapse,
|
||||
size_t *action)
|
||||
{
|
||||
struct mchp_tc_data *const priv = counter->priv;
|
||||
u32 cmr;
|
||||
|
||||
regmap_read(priv->regmap, ATMEL_TC_REG(priv->channel[0], CMR), &cmr);
|
||||
|
||||
*action = MCHP_TC_SYNAPSE_ACTION_NONE;
|
||||
|
||||
if (cmr & ATMEL_TC_ETRGEDG_NONE)
|
||||
*action = MCHP_TC_SYNAPSE_ACTION_NONE;
|
||||
else if (cmr & ATMEL_TC_ETRGEDG_RISING)
|
||||
*action = MCHP_TC_SYNAPSE_ACTION_RISING_EDGE;
|
||||
else if (cmr & ATMEL_TC_ETRGEDG_FALLING)
|
||||
*action = MCHP_TC_SYNAPSE_ACTION_FALLING_EDGE;
|
||||
else if (cmr & ATMEL_TC_ETRGEDG_BOTH)
|
||||
*action = MCHP_TC_SYNAPSE_ACTION_BOTH_EDGE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mchp_tc_count_action_set(struct counter_device *counter,
|
||||
struct counter_count *count,
|
||||
struct counter_synapse *synapse,
|
||||
size_t action)
|
||||
{
|
||||
struct mchp_tc_data *const priv = counter->priv;
|
||||
u32 edge = ATMEL_TC_ETRGEDG_NONE;
|
||||
|
||||
/* QDEC mode is rising edge only */
|
||||
if (priv->qdec_mode)
|
||||
return -EINVAL;
|
||||
|
||||
switch (action) {
|
||||
case MCHP_TC_SYNAPSE_ACTION_NONE:
|
||||
edge = ATMEL_TC_ETRGEDG_NONE;
|
||||
break;
|
||||
case MCHP_TC_SYNAPSE_ACTION_RISING_EDGE:
|
||||
edge = ATMEL_TC_ETRGEDG_RISING;
|
||||
break;
|
||||
case MCHP_TC_SYNAPSE_ACTION_FALLING_EDGE:
|
||||
edge = ATMEL_TC_ETRGEDG_FALLING;
|
||||
break;
|
||||
case MCHP_TC_SYNAPSE_ACTION_BOTH_EDGE:
|
||||
edge = ATMEL_TC_ETRGEDG_BOTH;
|
||||
break;
|
||||
}
|
||||
|
||||
return regmap_write_bits(priv->regmap,
|
||||
ATMEL_TC_REG(priv->channel[0], CMR),
|
||||
ATMEL_TC_ETRGEDG, edge);
|
||||
}
|
||||
|
||||
static int mchp_tc_count_read(struct counter_device *counter,
|
||||
struct counter_count *count,
|
||||
unsigned long *val)
|
||||
{
|
||||
struct mchp_tc_data *const priv = counter->priv;
|
||||
u32 cnt;
|
||||
|
||||
regmap_read(priv->regmap, ATMEL_TC_REG(priv->channel[0], CV), &cnt);
|
||||
*val = cnt;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct counter_count mchp_tc_counts[] = {
|
||||
{
|
||||
.id = 0,
|
||||
.name = "Timer Counter",
|
||||
.functions_list = mchp_tc_count_functions,
|
||||
.num_functions = ARRAY_SIZE(mchp_tc_count_functions),
|
||||
.synapses = mchp_tc_count_synapses,
|
||||
.num_synapses = ARRAY_SIZE(mchp_tc_count_synapses),
|
||||
},
|
||||
};
|
||||
|
||||
static struct counter_ops mchp_tc_ops = {
|
||||
.signal_read = mchp_tc_count_signal_read,
|
||||
.count_read = mchp_tc_count_read,
|
||||
.function_get = mchp_tc_count_function_get,
|
||||
.function_set = mchp_tc_count_function_set,
|
||||
.action_get = mchp_tc_count_action_get,
|
||||
.action_set = mchp_tc_count_action_set
|
||||
};
|
||||
|
||||
static const struct atmel_tcb_config tcb_rm9200_config = {
|
||||
.counter_width = 16,
|
||||
};
|
||||
|
||||
static const struct atmel_tcb_config tcb_sam9x5_config = {
|
||||
.counter_width = 32,
|
||||
};
|
||||
|
||||
static const struct atmel_tcb_config tcb_sama5d2_config = {
|
||||
.counter_width = 32,
|
||||
.has_gclk = true,
|
||||
.has_qdec = true,
|
||||
};
|
||||
|
||||
static const struct atmel_tcb_config tcb_sama5d3_config = {
|
||||
.counter_width = 32,
|
||||
.has_qdec = true,
|
||||
};
|
||||
|
||||
static const struct of_device_id atmel_tc_of_match[] = {
|
||||
{ .compatible = "atmel,at91rm9200-tcb", .data = &tcb_rm9200_config, },
|
||||
{ .compatible = "atmel,at91sam9x5-tcb", .data = &tcb_sam9x5_config, },
|
||||
{ .compatible = "atmel,sama5d2-tcb", .data = &tcb_sama5d2_config, },
|
||||
{ .compatible = "atmel,sama5d3-tcb", .data = &tcb_sama5d3_config, },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static void mchp_tc_clk_remove(void *ptr)
|
||||
{
|
||||
clk_disable_unprepare((struct clk *)ptr);
|
||||
}
|
||||
|
||||
static int mchp_tc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
const struct atmel_tcb_config *tcb_config;
|
||||
const struct of_device_id *match;
|
||||
struct mchp_tc_data *priv;
|
||||
char clk_name[7];
|
||||
struct regmap *regmap;
|
||||
struct clk *clk[3];
|
||||
int channel;
|
||||
int ret, i;
|
||||
|
||||
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
platform_set_drvdata(pdev, priv);
|
||||
|
||||
match = of_match_node(atmel_tc_of_match, np->parent);
|
||||
tcb_config = match->data;
|
||||
if (!tcb_config) {
|
||||
dev_err(&pdev->dev, "No matching parent node found\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
regmap = syscon_node_to_regmap(np->parent);
|
||||
if (IS_ERR(priv->regmap))
|
||||
return PTR_ERR(priv->regmap);
|
||||
|
||||
/* max. channels number is 2 when in QDEC mode */
|
||||
priv->num_channels = of_property_count_u32_elems(np, "reg");
|
||||
if (priv->num_channels < 0) {
|
||||
dev_err(&pdev->dev, "Invalid or missing channel\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Register channels and initialize clocks */
|
||||
for (i = 0; i < priv->num_channels; i++) {
|
||||
ret = of_property_read_u32_index(np, "reg", i, &channel);
|
||||
if (ret < 0 || channel > 2)
|
||||
return -ENODEV;
|
||||
|
||||
priv->channel[i] = channel;
|
||||
|
||||
snprintf(clk_name, sizeof(clk_name), "t%d_clk", channel);
|
||||
|
||||
clk[i] = of_clk_get_by_name(np->parent, clk_name);
|
||||
if (IS_ERR(clk[i])) {
|
||||
/* Fallback to t0_clk */
|
||||
clk[i] = of_clk_get_by_name(np->parent, "t0_clk");
|
||||
if (IS_ERR(clk[i]))
|
||||
return PTR_ERR(clk[i]);
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(clk[i]);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = devm_add_action_or_reset(&pdev->dev,
|
||||
mchp_tc_clk_remove,
|
||||
clk[i]);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dev_dbg(&pdev->dev,
|
||||
"Initialized capture mode on channel %d\n",
|
||||
channel);
|
||||
}
|
||||
|
||||
priv->tc_cfg = tcb_config;
|
||||
priv->regmap = regmap;
|
||||
priv->counter.name = dev_name(&pdev->dev);
|
||||
priv->counter.parent = &pdev->dev;
|
||||
priv->counter.ops = &mchp_tc_ops;
|
||||
priv->counter.num_counts = ARRAY_SIZE(mchp_tc_counts);
|
||||
priv->counter.counts = mchp_tc_counts;
|
||||
priv->counter.num_signals = ARRAY_SIZE(mchp_tc_count_signals);
|
||||
priv->counter.signals = mchp_tc_count_signals;
|
||||
priv->counter.priv = priv;
|
||||
|
||||
return devm_counter_register(&pdev->dev, &priv->counter);
|
||||
}
|
||||
|
||||
static const struct of_device_id mchp_tc_dt_ids[] = {
|
||||
{ .compatible = "microchip,tcb-capture", },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, mchp_tc_dt_ids);
|
||||
|
||||
static struct platform_driver mchp_tc_driver = {
|
||||
.probe = mchp_tc_probe,
|
||||
.driver = {
|
||||
.name = "microchip-tcb-capture",
|
||||
.of_match_table = mchp_tc_dt_ids,
|
||||
},
|
||||
};
|
||||
module_platform_driver(mchp_tc_driver);
|
||||
|
||||
MODULE_AUTHOR("Kamel Bouhara <kamel.bouhara@bootlin.com>");
|
||||
MODULE_DESCRIPTION("Microchip TCB Capture driver");
|
||||
MODULE_LICENSE("GPL v2");
|
|
@ -648,7 +648,6 @@ static int stm32_lptim_cnt_probe(struct platform_device *pdev)
|
|||
|
||||
/* Initialize IIO device */
|
||||
indio_dev->name = dev_name(&pdev->dev);
|
||||
indio_dev->dev.parent = &pdev->dev;
|
||||
indio_dev->dev.of_node = pdev->dev.of_node;
|
||||
indio_dev->info = &stm32_lptim_cnt_iio_info;
|
||||
if (ddata->has_encoder)
|
||||
|
|
|
@ -116,18 +116,24 @@ config BMA400
|
|||
tristate "Bosch BMA400 3-Axis Accelerometer Driver"
|
||||
select REGMAP
|
||||
select BMA400_I2C if I2C
|
||||
select BMA400_SPI if SPI
|
||||
help
|
||||
Say Y here if you want to build a driver for the Bosch BMA400
|
||||
triaxial acceleration sensor.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called bma400_core and you will also get
|
||||
bma400_i2c if I2C is enabled.
|
||||
bma400_i2c if I2C is enabled and bma400_spi if SPI is
|
||||
enabled.
|
||||
|
||||
config BMA400_I2C
|
||||
tristate
|
||||
depends on BMA400
|
||||
|
||||
config BMA400_SPI
|
||||
tristate
|
||||
depends on BMA400
|
||||
|
||||
config BMC150_ACCEL
|
||||
tristate "Bosch BMC150 Accelerometer Driver"
|
||||
select IIO_BUFFER
|
||||
|
|
|
@ -16,6 +16,7 @@ obj-$(CONFIG_BMA180) += bma180.o
|
|||
obj-$(CONFIG_BMA220) += bma220_spi.o
|
||||
obj-$(CONFIG_BMA400) += bma400_core.o
|
||||
obj-$(CONFIG_BMA400_I2C) += bma400_i2c.o
|
||||
obj-$(CONFIG_BMA400_SPI) += bma400_spi.o
|
||||
obj-$(CONFIG_BMC150_ACCEL) += bmc150-accel-core.o
|
||||
obj-$(CONFIG_BMC150_ACCEL_I2C) += bmc150-accel-i2c.o
|
||||
obj-$(CONFIG_BMC150_ACCEL_SPI) += bmc150-accel-spi.o
|
||||
|
|
|
@ -271,7 +271,6 @@ static int adis16201_probe(struct spi_device *spi)
|
|||
spi_set_drvdata(spi, indio_dev);
|
||||
|
||||
indio_dev->name = spi->dev.driver->name;
|
||||
indio_dev->dev.parent = &spi->dev;
|
||||
indio_dev->info = &adis16201_info;
|
||||
|
||||
indio_dev->channels = adis16201_channels;
|
||||
|
|
|
@ -282,7 +282,6 @@ static int adis16209_probe(struct spi_device *spi)
|
|||
spi_set_drvdata(spi, indio_dev);
|
||||
|
||||
indio_dev->name = spi->dev.driver->name;
|
||||
indio_dev->dev.parent = &spi->dev;
|
||||
indio_dev->info = &adis16209_info;
|
||||
indio_dev->channels = adis16209_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(adis16209_channels);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* Copyright (c) 2017 Eva Rachel Retuya <eraretuya@gmail.com>
|
||||
*
|
||||
* Datasheet: http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf
|
||||
* Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
@ -246,7 +246,6 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap,
|
|||
return ret;
|
||||
}
|
||||
|
||||
indio_dev->dev.parent = dev;
|
||||
indio_dev->name = name;
|
||||
indio_dev->info = &adxl345_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
|
|
@ -795,13 +795,9 @@ static int adxl372_buffer_postenable(struct iio_dev *indio_dev)
|
|||
unsigned int mask;
|
||||
int i, ret;
|
||||
|
||||
ret = iio_triggered_buffer_postenable(indio_dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = adxl372_set_interrupts(st, ADXL372_INT1_MAP_FIFO_FULL_MSK, 0);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
return ret;
|
||||
|
||||
mask = *indio_dev->active_scan_mask;
|
||||
|
||||
|
@ -810,10 +806,8 @@ static int adxl372_buffer_postenable(struct iio_dev *indio_dev)
|
|||
break;
|
||||
}
|
||||
|
||||
if (i == ARRAY_SIZE(adxl372_axis_lookup_table)) {
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
if (i == ARRAY_SIZE(adxl372_axis_lookup_table))
|
||||
return -EINVAL;
|
||||
|
||||
st->fifo_format = adxl372_axis_lookup_table[i].fifo_format;
|
||||
st->fifo_set_size = bitmap_weight(indio_dev->active_scan_mask,
|
||||
|
@ -833,14 +827,10 @@ static int adxl372_buffer_postenable(struct iio_dev *indio_dev)
|
|||
if (ret < 0) {
|
||||
st->fifo_mode = ADXL372_FIFO_BYPASSED;
|
||||
adxl372_set_interrupts(st, 0, 0);
|
||||
goto err;
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
iio_triggered_buffer_predisable(indio_dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int adxl372_buffer_predisable(struct iio_dev *indio_dev)
|
||||
|
@ -851,7 +841,7 @@ static int adxl372_buffer_predisable(struct iio_dev *indio_dev)
|
|||
st->fifo_mode = ADXL372_FIFO_BYPASSED;
|
||||
adxl372_configure_fifo(st);
|
||||
|
||||
return iio_triggered_buffer_predisable(indio_dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct iio_buffer_setup_ops adxl372_buffer_ops = {
|
||||
|
@ -938,7 +928,6 @@ int adxl372_probe(struct device *dev, struct regmap *regmap,
|
|||
indio_dev->channels = adxl372_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(adxl372_channels);
|
||||
indio_dev->available_scan_masks = adxl372_channel_masks;
|
||||
indio_dev->dev.parent = dev;
|
||||
indio_dev->name = name;
|
||||
indio_dev->info = &adxl372_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_SOFTWARE;
|
||||
|
|
|
@ -1038,7 +1038,6 @@ static int bma180_probe(struct i2c_client *client,
|
|||
goto err_chip_disable;
|
||||
|
||||
mutex_init(&data->mutex);
|
||||
indio_dev->dev.parent = dev;
|
||||
indio_dev->channels = data->part_info->channels;
|
||||
indio_dev->num_channels = data->part_info->num_channels;
|
||||
indio_dev->name = id->name;
|
||||
|
|
|
@ -237,7 +237,6 @@ static int bma220_probe(struct spi_device *spi)
|
|||
spi_set_drvdata(spi, indio_dev);
|
||||
mutex_init(&data->lock);
|
||||
|
||||
indio_dev->dev.parent = &spi->dev;
|
||||
indio_dev->info = &bma220_info;
|
||||
indio_dev->name = BMA220_DEVICE_NAME;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
@ -309,12 +308,14 @@ static const struct spi_device_id bma220_spi_id[] = {
|
|||
{}
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
static const struct acpi_device_id bma220_acpi_id[] = {
|
||||
{"BMA0220", 0},
|
||||
{}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(spi, bma220_spi_id);
|
||||
#endif
|
||||
|
||||
static struct spi_driver bma220_driver = {
|
||||
.driver = {
|
||||
|
|
|
@ -816,7 +816,6 @@ int bma400_probe(struct device *dev, struct regmap *regmap, const char *name)
|
|||
return ret;
|
||||
|
||||
mutex_init(&data->mutex);
|
||||
indio_dev->dev.parent = dev;
|
||||
indio_dev->name = name;
|
||||
indio_dev->info = &bma400_info;
|
||||
indio_dev->channels = bma400_channels;
|
||||
|
|
120
drivers/iio/accel/bma400_spi.c
Normal file
120
drivers/iio/accel/bma400_spi.c
Normal file
|
@ -0,0 +1,120 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* SPI IIO driver for Bosch BMA400 triaxial acceleration sensor.
|
||||
*
|
||||
* Copyright 2020 Dan Robertson <dan@dlrobertson.com>
|
||||
*
|
||||
*/
|
||||
#include <linux/bits.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
||||
#include "bma400.h"
|
||||
|
||||
#define BMA400_MAX_SPI_READ 2
|
||||
#define BMA400_SPI_READ_BUFFER_SIZE (BMA400_MAX_SPI_READ + 1)
|
||||
|
||||
static int bma400_regmap_spi_read(void *context,
|
||||
const void *reg, size_t reg_size,
|
||||
void *val, size_t val_size)
|
||||
{
|
||||
struct device *dev = context;
|
||||
struct spi_device *spi = to_spi_device(dev);
|
||||
u8 result[BMA400_SPI_READ_BUFFER_SIZE];
|
||||
ssize_t status;
|
||||
|
||||
if (val_size > BMA400_MAX_SPI_READ)
|
||||
return -EINVAL;
|
||||
|
||||
status = spi_write_then_read(spi, reg, 1, result, val_size + 1);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
/*
|
||||
* From the BMA400 datasheet:
|
||||
*
|
||||
* > For a basic read operation two bytes have to be read and the first
|
||||
* > has to be dropped and the second byte must be interpreted.
|
||||
*/
|
||||
memcpy(val, result + 1, val_size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bma400_regmap_spi_write(void *context, const void *data,
|
||||
size_t count)
|
||||
{
|
||||
struct device *dev = context;
|
||||
struct spi_device *spi = to_spi_device(dev);
|
||||
|
||||
return spi_write(spi, data, count);
|
||||
}
|
||||
|
||||
static struct regmap_bus bma400_regmap_bus = {
|
||||
.read = bma400_regmap_spi_read,
|
||||
.write = bma400_regmap_spi_write,
|
||||
.read_flag_mask = BIT(7),
|
||||
.max_raw_read = BMA400_MAX_SPI_READ,
|
||||
};
|
||||
|
||||
static int bma400_spi_probe(struct spi_device *spi)
|
||||
{
|
||||
const struct spi_device_id *id = spi_get_device_id(spi);
|
||||
struct regmap *regmap;
|
||||
unsigned int val;
|
||||
int ret;
|
||||
|
||||
regmap = devm_regmap_init(&spi->dev, &bma400_regmap_bus,
|
||||
&spi->dev, &bma400_regmap_config);
|
||||
if (IS_ERR(regmap)) {
|
||||
dev_err(&spi->dev, "failed to create regmap\n");
|
||||
return PTR_ERR(regmap);
|
||||
}
|
||||
|
||||
/*
|
||||
* Per the bma400 datasheet, the first SPI read may
|
||||
* return garbage. As the datasheet recommends, the
|
||||
* chip ID register will be read here and checked
|
||||
* again in the following probe.
|
||||
*/
|
||||
ret = regmap_read(regmap, BMA400_CHIP_ID_REG, &val);
|
||||
if (ret)
|
||||
dev_err(&spi->dev, "Failed to read chip id register\n");
|
||||
|
||||
return bma400_probe(&spi->dev, regmap, id->name);
|
||||
}
|
||||
|
||||
static int bma400_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
return bma400_remove(&spi->dev);
|
||||
}
|
||||
|
||||
static const struct spi_device_id bma400_spi_ids[] = {
|
||||
{ "bma400", 0 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(spi, bma400_spi_ids);
|
||||
|
||||
static const struct of_device_id bma400_of_spi_match[] = {
|
||||
{ .compatible = "bosch,bma400" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, bma400_of_spi_match);
|
||||
|
||||
static struct spi_driver bma400_spi_driver = {
|
||||
.driver = {
|
||||
.name = "bma400",
|
||||
.of_match_table = bma400_of_spi_match,
|
||||
},
|
||||
.probe = bma400_spi_probe,
|
||||
.remove = bma400_spi_remove,
|
||||
.id_table = bma400_spi_ids,
|
||||
};
|
||||
|
||||
module_spi_driver(bma400_spi_driver);
|
||||
MODULE_AUTHOR("Dan Robertson <dan@dlrobertson.com>");
|
||||
MODULE_DESCRIPTION("Bosch BMA400 triaxial acceleration sensor (SPI)");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -1411,7 +1411,7 @@ static int bmc150_accel_buffer_postenable(struct iio_dev *indio_dev)
|
|||
int ret = 0;
|
||||
|
||||
if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED)
|
||||
return iio_triggered_buffer_postenable(indio_dev);
|
||||
return 0;
|
||||
|
||||
mutex_lock(&data->mutex);
|
||||
|
||||
|
@ -1443,7 +1443,7 @@ static int bmc150_accel_buffer_predisable(struct iio_dev *indio_dev)
|
|||
struct bmc150_accel_data *data = iio_priv(indio_dev);
|
||||
|
||||
if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED)
|
||||
return iio_triggered_buffer_predisable(indio_dev);
|
||||
return 0;
|
||||
|
||||
mutex_lock(&data->mutex);
|
||||
|
||||
|
@ -1574,7 +1574,6 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
|
|||
|
||||
mutex_init(&data->mutex);
|
||||
|
||||
indio_dev->dev.parent = dev;
|
||||
indio_dev->channels = data->chip_info->channels;
|
||||
indio_dev->num_channels = data->chip_info->num_channels;
|
||||
indio_dev->name = name ? name : data->chip_info->name;
|
||||
|
|
|
@ -33,6 +33,11 @@
|
|||
*/
|
||||
#define ACCEL_LEGACY_NSCALE 9586168
|
||||
|
||||
/*
|
||||
* Sensor frequency is hard-coded to 10Hz.
|
||||
*/
|
||||
static const int cros_ec_legacy_sample_freq[] = { 10, 0 };
|
||||
|
||||
static int cros_ec_accel_legacy_read_cmd(struct iio_dev *indio_dev,
|
||||
unsigned long scan_mask, s16 *data)
|
||||
{
|
||||
|
@ -96,6 +101,11 @@ static int cros_ec_accel_legacy_read(struct iio_dev *indio_dev,
|
|||
*val = 0;
|
||||
ret = IIO_VAL_INT;
|
||||
break;
|
||||
case IIO_CHAN_INFO_SAMP_FREQ:
|
||||
*val = cros_ec_legacy_sample_freq[0];
|
||||
*val2 = cros_ec_legacy_sample_freq[1];
|
||||
ret = IIO_VAL_INT_PLUS_MICRO;
|
||||
break;
|
||||
default:
|
||||
ret = cros_ec_sensors_core_read(st, chan, val, val2,
|
||||
mask);
|
||||
|
@ -120,9 +130,39 @@ static int cros_ec_accel_legacy_write(struct iio_dev *indio_dev,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* cros_ec_accel_legacy_read_avail() - get available values
|
||||
* @indio_dev: pointer to state information for device
|
||||
* @chan: channel specification structure table
|
||||
* @vals: list of available values
|
||||
* @type: type of data returned
|
||||
* @length: number of data returned in the array
|
||||
* @mask: specifies which values to be requested
|
||||
*
|
||||
* Return: an error code or IIO_AVAIL_LIST
|
||||
*/
|
||||
static int cros_ec_accel_legacy_read_avail(struct iio_dev *indio_dev,
|
||||
struct iio_chan_spec const *chan,
|
||||
const int **vals,
|
||||
int *type,
|
||||
int *length,
|
||||
long mask)
|
||||
{
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_SAMP_FREQ:
|
||||
*length = ARRAY_SIZE(cros_ec_legacy_sample_freq);
|
||||
*vals = cros_ec_legacy_sample_freq;
|
||||
*type = IIO_VAL_INT_PLUS_MICRO;
|
||||
return IIO_AVAIL_LIST;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static const struct iio_info cros_ec_accel_legacy_info = {
|
||||
.read_raw = &cros_ec_accel_legacy_read,
|
||||
.write_raw = &cros_ec_accel_legacy_write,
|
||||
.read_avail = &cros_ec_accel_legacy_read_avail,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -142,7 +182,11 @@ static const struct iio_info cros_ec_accel_legacy_info = {
|
|||
.info_mask_separate = \
|
||||
BIT(IIO_CHAN_INFO_RAW) | \
|
||||
BIT(IIO_CHAN_INFO_CALIBBIAS), \
|
||||
.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SCALE), \
|
||||
.info_mask_shared_by_all = \
|
||||
BIT(IIO_CHAN_INFO_SCALE) | \
|
||||
BIT(IIO_CHAN_INFO_SAMP_FREQ), \
|
||||
.info_mask_shared_by_all_available = \
|
||||
BIT(IIO_CHAN_INFO_SAMP_FREQ), \
|
||||
.ext_info = cros_ec_sensors_ext_info, \
|
||||
.scan_type = { \
|
||||
.sign = 's', \
|
||||
|
|
|
@ -120,7 +120,6 @@ static int da280_probe(struct i2c_client *client,
|
|||
data->client = client;
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->info = &da280_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->channels = da280_channels;
|
||||
|
|
|
@ -231,7 +231,6 @@ static int da311_probe(struct i2c_client *client,
|
|||
data->client = client;
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->info = &da311_info;
|
||||
indio_dev->name = "da311";
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
|
|
@ -161,7 +161,6 @@ static int dmard06_probe(struct i2c_client *client,
|
|||
dmard06->chip_id = ret;
|
||||
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->name = DMARD06_DRV_NAME;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->channels = dmard06_channels;
|
||||
|
|
|
@ -116,7 +116,6 @@ static int dmard09_probe(struct i2c_client *client,
|
|||
}
|
||||
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->name = DMARD09_DRV_NAME;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->channels = dmard09_channels;
|
||||
|
|
|
@ -196,7 +196,6 @@ static int dmard10_probe(struct i2c_client *client,
|
|||
data->client = client;
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->info = &dmard10_info;
|
||||
indio_dev->name = "dmard10";
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user