You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'staging-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver tree update from Greg Kroah-Hartman:
"Here's the big staging driver tree update for 3.10-rc1
This update contains loads of comedi driver cleanups and fixes in
here, iio updates, android driver changes, and other various staging
driver cleanups.
Thanks to some drivers being removed, and the comedi driver cleanups,
we have removed more code than we added:
627 files changed, 65145 insertions(+), 76321 deletions(-)
which is always nice to see.
All of these have been in linux-next for a while."
* tag 'staging-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (940 commits)
staging: comedi: ni_labpc: fix legacy driver build
staging: comedi: das800: cleanup the cio-das802/16 fifo comments
staging: comedi: das800: rename CamelCase vars in das800_ai_do_cmd()
staging: comedi: das800: tidy up the private data
staging: comedi: das800: tidy up das800_interrupt()
staging: comedi: das800: tidy up das800_ai_insn_read()
staging: comedi: das800: tidy up das800_di_insn_bits()
staging: comedi: das800: tidy up das800_do_insn_bits()
staging: comedi: das800: remove extra divisor calculation call
staging: comedi: das800: rename {enable,disable}_das800
staging: comedi: das800: tidy up subdevice init
staging: comedi: das800: allow attaching without interrupt support
staging: comedi: das800: interrupts are required for async command support
staging: comedi: das800: tidy up das800_ai_do_cmdtest()
staging: comedi: das800: remove 'volatile' on private data variables
staging: comedi: das800: cleanup the boardinfo
staging: comedi: das800: cleanup range table declarations
staging: comedi: das800: introduce das800_ind_{write, read}()
staging: comedi: das800: remove forward declarations
staging: comedi: das800: move das800_set_frequency()
...
This commit is contained in:
@@ -14,9 +14,19 @@ Required properties:
|
||||
- atmel,adc-status-register: Offset of the Interrupt Status Register
|
||||
- atmel,adc-trigger-register: Offset of the Trigger Register
|
||||
- atmel,adc-vref: Reference voltage in millivolts for the conversions
|
||||
- atmel,adc-res: List of resolution in bits supported by the ADC. List size
|
||||
must be two at least.
|
||||
- atmel,adc-res-names: Contains one identifier string for each resolution
|
||||
in atmel,adc-res property. "lowres" and "highres"
|
||||
identifiers are required.
|
||||
|
||||
Optional properties:
|
||||
- atmel,adc-use-external: Boolean to enable of external triggers
|
||||
- atmel,adc-use-res: String corresponding to an identifier from
|
||||
atmel,adc-res-names property. If not specified, the highest
|
||||
resolution will be used.
|
||||
- atmel,adc-sleep-mode: Boolean to enable sleep mode when no conversion
|
||||
- atmel,adc-sample-hold-time: Sample and Hold Time in microseconds
|
||||
|
||||
Optional trigger Nodes:
|
||||
- Required properties:
|
||||
@@ -40,6 +50,9 @@ adc0: adc@fffb0000 {
|
||||
atmel,adc-trigger-register = <0x08>;
|
||||
atmel,adc-use-external;
|
||||
atmel,adc-vref = <3300>;
|
||||
atmel,adc-res = <8 10>;
|
||||
atmel,adc-res-names = "lowres", "highres";
|
||||
atmel,adc-use-res = "lowres";
|
||||
|
||||
trigger@0 {
|
||||
trigger-name = "external-rising";
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
Samsung Exynos Analog to Digital Converter bindings
|
||||
|
||||
The devicetree bindings are for the new ADC driver written for
|
||||
Exynos4 and upward SoCs from Samsung.
|
||||
|
||||
New driver handles the following
|
||||
1. Supports ADC IF found on EXYNOS4412/EXYNOS5250
|
||||
and future SoCs from Samsung
|
||||
2. Add ADC driver under iio/adc framework
|
||||
3. Also adds the Documentation for device tree bindings
|
||||
|
||||
Required properties:
|
||||
- compatible: Must be "samsung,exynos-adc-v1"
|
||||
for exynos4412/5250 controllers.
|
||||
Must be "samsung,exynos-adc-v2" for
|
||||
future controllers.
|
||||
- reg: Contains ADC register address range (base address and
|
||||
length) and the address of the phy enable register.
|
||||
- interrupts: Contains the interrupt information for the timer. The
|
||||
format is being dependent on which interrupt controller
|
||||
the Samsung device uses.
|
||||
- #io-channel-cells = <1>; As ADC has multiple outputs
|
||||
- clocks From common clock binding: handle to adc clock.
|
||||
- clock-names From common clock binding: Shall be "adc".
|
||||
- vdd-supply VDD input supply.
|
||||
|
||||
Note: child nodes can be added for auto probing from device tree.
|
||||
|
||||
Example: adding device info in dtsi file
|
||||
|
||||
adc: adc@12D10000 {
|
||||
compatible = "samsung,exynos-adc-v1";
|
||||
reg = <0x12D10000 0x100>, <0x10040718 0x4>;
|
||||
interrupts = <0 106 0>;
|
||||
#io-channel-cells = <1>;
|
||||
io-channel-ranges;
|
||||
|
||||
clocks = <&clock 303>;
|
||||
clock-names = "adc";
|
||||
|
||||
vdd-supply = <&buck5_reg>;
|
||||
};
|
||||
|
||||
|
||||
Example: Adding child nodes in dts file
|
||||
|
||||
adc@12D10000 {
|
||||
|
||||
/* NTC thermistor is a hwmon device */
|
||||
ncp15wb473@0 {
|
||||
compatible = "ntc,ncp15wb473";
|
||||
pullup-uV = <1800000>;
|
||||
pullup-ohm = <47000>;
|
||||
pulldown-ohm = <0>;
|
||||
io-channels = <&adc 4>;
|
||||
};
|
||||
};
|
||||
|
||||
Note: Does not apply to ADC driver under arch/arm/plat-samsung/
|
||||
Note: The child node can be added under the adc node or separately.
|
||||
@@ -0,0 +1,97 @@
|
||||
This binding is derived from clock bindings, and based on suggestions
|
||||
from Lars-Peter Clausen [1].
|
||||
|
||||
Sources of IIO channels can be represented by any node in the device
|
||||
tree. Those nodes are designated as IIO providers. IIO consumer
|
||||
nodes use a phandle and IIO specifier pair to connect IIO provider
|
||||
outputs to IIO inputs. Similar to the gpio specifiers, an IIO
|
||||
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
|
||||
|
||||
==IIO providers==
|
||||
|
||||
Required properties:
|
||||
#io-channel-cells: Number of cells in an IIO specifier; Typically 0 for nodes
|
||||
with a single IIO output and 1 for nodes with multiple
|
||||
IIO outputs.
|
||||
|
||||
Example for a simple configuration with no trigger:
|
||||
|
||||
adc: voltage-sensor@35 {
|
||||
compatible = "maxim,max1139";
|
||||
reg = <0x35>;
|
||||
#io-channel-cells = <1>;
|
||||
};
|
||||
|
||||
Example for a configuration with trigger:
|
||||
|
||||
adc@35 {
|
||||
compatible = "some-vendor,some-adc";
|
||||
reg = <0x35>;
|
||||
|
||||
adc1: iio-device@0 {
|
||||
#io-channel-cells = <1>;
|
||||
/* other properties */
|
||||
};
|
||||
adc2: iio-device@1 {
|
||||
#io-channel-cells = <1>;
|
||||
/* other properties */
|
||||
};
|
||||
};
|
||||
|
||||
==IIO consumers==
|
||||
|
||||
Required properties:
|
||||
io-channels: List of phandle and IIO specifier pairs, one pair
|
||||
for each IIO input to the device. Note: if the
|
||||
IIO provider specifies '0' for #io-channel-cells,
|
||||
then only the phandle portion of the pair will appear.
|
||||
|
||||
Optional properties:
|
||||
io-channel-names:
|
||||
List of IIO input name strings sorted in the same
|
||||
order as the io-channels property. Consumers drivers
|
||||
will use io-channel-names to match IIO input names
|
||||
with IIO specifiers.
|
||||
io-channel-ranges:
|
||||
Empty property indicating that child nodes can inherit named
|
||||
IIO channels from this node. Useful for bus nodes to provide
|
||||
and IIO channel to their children.
|
||||
|
||||
For example:
|
||||
|
||||
device {
|
||||
io-channels = <&adc 1>, <&ref 0>;
|
||||
io-channel-names = "vcc", "vdd";
|
||||
};
|
||||
|
||||
This represents a device with two IIO inputs, named "vcc" and "vdd".
|
||||
The vcc channel is connected to output 1 of the &adc device, and the
|
||||
vdd channel is connected to output 0 of the &ref device.
|
||||
|
||||
==Example==
|
||||
|
||||
adc: max1139@35 {
|
||||
compatible = "maxim,max1139";
|
||||
reg = <0x35>;
|
||||
#io-channel-cells = <1>;
|
||||
};
|
||||
|
||||
...
|
||||
|
||||
iio_hwmon {
|
||||
compatible = "iio-hwmon";
|
||||
io-channels = <&adc 0>, <&adc 1>, <&adc 2>,
|
||||
<&adc 3>, <&adc 4>, <&adc 5>,
|
||||
<&adc 6>, <&adc 7>, <&adc 8>,
|
||||
<&adc 9>;
|
||||
};
|
||||
|
||||
some_consumer {
|
||||
compatible = "some-consumer";
|
||||
io-channels = <&adc 10>, <&adc 11>;
|
||||
io-channel-names = "adc1", "adc2";
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
Platform DesignWare HS OTG USB 2.0 controller
|
||||
-----------------------------------------------------
|
||||
|
||||
Required properties:
|
||||
- compatible : "snps,dwc2"
|
||||
- reg : Should contain 1 register range (address and length)
|
||||
- interrupts : Should contain 1 interrupt
|
||||
|
||||
Example:
|
||||
|
||||
usb@101c0000 {
|
||||
compatible = "ralink,rt3050-usb, snps,dwc2";
|
||||
reg = <0x101c0000 40000>;
|
||||
interrupts = <18>;
|
||||
};
|
||||
@@ -26,7 +26,7 @@ Required properties:
|
||||
- crtc: the crtc this display is connected to, see below
|
||||
Optional properties:
|
||||
- interface_pix_fmt: How this display is connected to the
|
||||
crtc. Currently supported types: "rgb24", "rgb565"
|
||||
crtc. Currently supported types: "rgb24", "rgb565", "bgr666"
|
||||
- edid: verbatim EDID data block describing attached display.
|
||||
- ddc: phandle describing the i2c bus handling the display data
|
||||
channel
|
||||
|
||||
+12
@@ -2459,6 +2459,12 @@ M: Matthew Garrett <mjg59@srcf.ucam.org>
|
||||
S: Maintained
|
||||
F: drivers/platform/x86/dell-wmi.c
|
||||
|
||||
DESIGNWARE USB2 DRD IP DRIVER
|
||||
M: Paul Zimmerman <paulz@synopsys.com>
|
||||
L: linux-usb@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/staging/dwc2/
|
||||
|
||||
DESIGNWARE USB3 DRD IP DRIVER
|
||||
M: Felipe Balbi <balbi@ti.com>
|
||||
L: linux-usb@vger.kernel.org
|
||||
@@ -7933,6 +7939,12 @@ T: git git://repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git
|
||||
S: Maintained
|
||||
F: drivers/platform/x86/thinkpad_acpi.c
|
||||
|
||||
TI BANDGAP AND THERMAL DRIVER
|
||||
M: Eduardo Valentin <eduardo.valentin@ti.com>
|
||||
L: linux-pm@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/staging/omap-thermal/
|
||||
|
||||
TI FLASH MEDIA INTERFACE DRIVER
|
||||
M: Alex Dubov <oakad@yahoo.com>
|
||||
S: Maintained
|
||||
|
||||
@@ -519,6 +519,15 @@ config SENSORS_IBMPEX
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called ibmpex.
|
||||
|
||||
config SENSORS_IIO_HWMON
|
||||
tristate "Hwmon driver that uses channels specified via iio maps"
|
||||
depends on IIO
|
||||
help
|
||||
This is a platform driver that in combination with a suitable
|
||||
map allows IIO devices to provide basic hwmon functionality
|
||||
for those channels specified in the map. This map can be provided
|
||||
either via platform data or the device tree bindings.
|
||||
|
||||
config SENSORS_IT87
|
||||
tristate "ITE IT87xx and compatibles"
|
||||
depends on !PPC
|
||||
|
||||
@@ -67,6 +67,7 @@ obj-$(CONFIG_SENSORS_ULTRA45) += ultra45_env.o
|
||||
obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o
|
||||
obj-$(CONFIG_SENSORS_IBMAEM) += ibmaem.o
|
||||
obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o
|
||||
obj-$(CONFIG_SENSORS_IIO_HWMON) += iio_hwmon.o
|
||||
obj-$(CONFIG_SENSORS_INA209) += ina209.o
|
||||
obj-$(CONFIG_SENSORS_INA2XX) += ina2xx.o
|
||||
obj-$(CONFIG_SENSORS_IT87) += it87.o
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/hwmon.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/hwmon-sysfs.h>
|
||||
#include <linux/iio/consumer.h>
|
||||
#include <linux/iio/types.h>
|
||||
@@ -58,7 +59,12 @@ static ssize_t iio_hwmon_read_val(struct device *dev,
|
||||
static ssize_t show_name(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
return sprintf(buf, "iio_hwmon\n");
|
||||
const char *name = "iio_hwmon";
|
||||
|
||||
if (dev->of_node && dev->of_node->name)
|
||||
name = dev->of_node->name;
|
||||
|
||||
return sprintf(buf, "%s\n", name);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
|
||||
@@ -60,28 +60,28 @@ static const struct iio_chan_spec accel_3d_channels[] = {
|
||||
.type = IIO_ACCEL,
|
||||
.modified = 1,
|
||||
.channel2 = IIO_MOD_X,
|
||||
.info_mask = IIO_CHAN_INFO_OFFSET_SHARED_BIT |
|
||||
IIO_CHAN_INFO_SCALE_SHARED_BIT |
|
||||
IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT |
|
||||
IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT,
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
|
||||
BIT(IIO_CHAN_INFO_SCALE) |
|
||||
BIT(IIO_CHAN_INFO_SAMP_FREQ) |
|
||||
BIT(IIO_CHAN_INFO_HYSTERESIS),
|
||||
.scan_index = CHANNEL_SCAN_INDEX_X,
|
||||
}, {
|
||||
.type = IIO_ACCEL,
|
||||
.modified = 1,
|
||||
.channel2 = IIO_MOD_Y,
|
||||
.info_mask = IIO_CHAN_INFO_OFFSET_SHARED_BIT |
|
||||
IIO_CHAN_INFO_SCALE_SHARED_BIT |
|
||||
IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT |
|
||||
IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT,
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
|
||||
BIT(IIO_CHAN_INFO_SCALE) |
|
||||
BIT(IIO_CHAN_INFO_SAMP_FREQ) |
|
||||
BIT(IIO_CHAN_INFO_HYSTERESIS),
|
||||
.scan_index = CHANNEL_SCAN_INDEX_Y,
|
||||
}, {
|
||||
.type = IIO_ACCEL,
|
||||
.modified = 1,
|
||||
.channel2 = IIO_MOD_Z,
|
||||
.info_mask = IIO_CHAN_INFO_OFFSET_SHARED_BIT |
|
||||
IIO_CHAN_INFO_SCALE_SHARED_BIT |
|
||||
IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT |
|
||||
IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT,
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
|
||||
BIT(IIO_CHAN_INFO_SCALE) |
|
||||
BIT(IIO_CHAN_INFO_SAMP_FREQ) |
|
||||
BIT(IIO_CHAN_INFO_HYSTERESIS),
|
||||
.scan_index = CHANNEL_SCAN_INDEX_Z,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -177,8 +177,8 @@ error_ret:
|
||||
.type = IIO_ACCEL, \
|
||||
.modified = 1, \
|
||||
.channel2 = IIO_MOD_##axis, \
|
||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
|
||||
IIO_CHAN_INFO_SCALE_SHARED_BIT, \
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
|
||||
.address = KXSD9_REG_##axis, \
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ static const struct iio_chan_spec kxsd9_channels[] = {
|
||||
KXSD9_ACCEL_CHAN(X), KXSD9_ACCEL_CHAN(Y), KXSD9_ACCEL_CHAN(Z),
|
||||
{
|
||||
.type = IIO_VOLTAGE,
|
||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT,
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
|
||||
.indexed = 1,
|
||||
.address = KXSD9_REG_AUX,
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
int st_accel_trig_set_state(struct iio_trigger *trig, bool state)
|
||||
{
|
||||
struct iio_dev *indio_dev = trig->private_data;
|
||||
struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);
|
||||
|
||||
return st_sensors_set_dataready_irq(indio_dev, state);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,18 @@ config AD7298
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called ad7298.
|
||||
|
||||
config AD7923
|
||||
tristate "Analog Devices AD7923 and similar ADCs driver"
|
||||
depends on SPI
|
||||
select IIO_BUFFER
|
||||
select IIO_TRIGGERED_BUFFER
|
||||
help
|
||||
Say yes here to build support for Analog Devices
|
||||
AD7904, AD7914, AD7923, AD7924 4 Channel ADCs.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called ad7923.
|
||||
|
||||
config AD7791
|
||||
tristate "Analog Devices AD7791 ADC driver"
|
||||
depends on SPI
|
||||
@@ -91,6 +103,14 @@ config AT91_ADC
|
||||
help
|
||||
Say yes here to build support for Atmel AT91 ADC.
|
||||
|
||||
config EXYNOS_ADC
|
||||
bool "Exynos ADC driver support"
|
||||
depends on OF
|
||||
help
|
||||
Core support for the ADC block found in the Samsung EXYNOS series
|
||||
of SoCs for drivers such as the touchscreen and hwmon to use to share
|
||||
this resource.
|
||||
|
||||
config LP8788_ADC
|
||||
bool "LP8788 ADC driver"
|
||||
depends on MFD_LP8788
|
||||
|
||||
@@ -5,11 +5,13 @@
|
||||
obj-$(CONFIG_AD_SIGMA_DELTA) += ad_sigma_delta.o
|
||||
obj-$(CONFIG_AD7266) += ad7266.o
|
||||
obj-$(CONFIG_AD7298) += ad7298.o
|
||||
obj-$(CONFIG_AD7923) += ad7923.o
|
||||
obj-$(CONFIG_AD7476) += ad7476.o
|
||||
obj-$(CONFIG_AD7791) += ad7791.o
|
||||
obj-$(CONFIG_AD7793) += ad7793.o
|
||||
obj-$(CONFIG_AD7887) += ad7887.o
|
||||
obj-$(CONFIG_AT91_ADC) += at91_adc.o
|
||||
obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o
|
||||
obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o
|
||||
obj-$(CONFIG_MAX1363) += max1363.o
|
||||
obj-$(CONFIG_TI_ADC081C) += ti-adc081c.o
|
||||
|
||||
@@ -201,9 +201,9 @@ static int ad7266_read_raw(struct iio_dev *indio_dev,
|
||||
.indexed = 1, \
|
||||
.channel = (_chan), \
|
||||
.address = (_chan), \
|
||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT \
|
||||
| IIO_CHAN_INFO_SCALE_SHARED_BIT \
|
||||
| IIO_CHAN_INFO_OFFSET_SHARED_BIT, \
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) \
|
||||
| BIT(IIO_CHAN_INFO_OFFSET), \
|
||||
.scan_index = (_chan), \
|
||||
.scan_type = { \
|
||||
.sign = (_sign), \
|
||||
@@ -249,9 +249,9 @@ static AD7266_DECLARE_SINGLE_ENDED_CHANNELS_FIXED(s, 's');
|
||||
.channel = (_chan) * 2, \
|
||||
.channel2 = (_chan) * 2 + 1, \
|
||||
.address = (_chan), \
|
||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT \
|
||||
| IIO_CHAN_INFO_SCALE_SHARED_BIT \
|
||||
| IIO_CHAN_INFO_OFFSET_SHARED_BIT, \
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) \
|
||||
| BIT(IIO_CHAN_INFO_OFFSET), \
|
||||
.scan_index = (_chan), \
|
||||
.scan_type = { \
|
||||
.sign = _sign, \
|
||||
|
||||
@@ -63,8 +63,8 @@ struct ad7298_state {
|
||||
.type = IIO_VOLTAGE, \
|
||||
.indexed = 1, \
|
||||
.channel = index, \
|
||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
|
||||
IIO_CHAN_INFO_SCALE_SHARED_BIT, \
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
|
||||
.address = index, \
|
||||
.scan_index = index, \
|
||||
.scan_type = { \
|
||||
@@ -80,9 +80,9 @@ static const struct iio_chan_spec ad7298_channels[] = {
|
||||
.type = IIO_TEMP,
|
||||
.indexed = 1,
|
||||
.channel = 0,
|
||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||
IIO_CHAN_INFO_SCALE_SEPARATE_BIT |
|
||||
IIO_CHAN_INFO_OFFSET_SEPARATE_BIT,
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
|
||||
BIT(IIO_CHAN_INFO_SCALE) |
|
||||
BIT(IIO_CHAN_INFO_OFFSET),
|
||||
.address = AD7298_CH_TEMP,
|
||||
.scan_index = -1,
|
||||
.scan_type = {
|
||||
|
||||
@@ -140,12 +140,12 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#define _AD7476_CHAN(bits, _shift, _info_mask) \
|
||||
#define _AD7476_CHAN(bits, _shift, _info_mask_sep) \
|
||||
{ \
|
||||
.type = IIO_VOLTAGE, \
|
||||
.indexed = 1, \
|
||||
.info_mask = _info_mask | \
|
||||
IIO_CHAN_INFO_SCALE_SHARED_BIT, \
|
||||
.info_mask_separate = _info_mask_sep, \
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
|
||||
.scan_type = { \
|
||||
.sign = 'u', \
|
||||
.realbits = (bits), \
|
||||
@@ -156,9 +156,9 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,
|
||||
}
|
||||
|
||||
#define AD7476_CHAN(bits) _AD7476_CHAN((bits), 13 - (bits), \
|
||||
IIO_CHAN_INFO_RAW_SEPARATE_BIT)
|
||||
BIT(IIO_CHAN_INFO_RAW))
|
||||
#define AD7940_CHAN(bits) _AD7476_CHAN((bits), 15 - (bits), \
|
||||
IIO_CHAN_INFO_RAW_SEPARATE_BIT)
|
||||
BIT(IIO_CHAN_INFO_RAW))
|
||||
#define AD7091R_CHAN(bits) _AD7476_CHAN((bits), 16 - (bits), 0)
|
||||
|
||||
static const struct ad7476_chip_info ad7476_chip_info_tbl[] = {
|
||||
|
||||
@@ -207,8 +207,8 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = {
|
||||
.type = IIO_VOLTAGE,
|
||||
.indexed = 1,
|
||||
.channel = 1,
|
||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||
IIO_CHAN_INFO_SCALE_SHARED_BIT,
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
|
||||
.address = 1,
|
||||
.scan_index = 1,
|
||||
.scan_type = IIO_ST('u', 12, 16, 0),
|
||||
@@ -217,8 +217,8 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = {
|
||||
.type = IIO_VOLTAGE,
|
||||
.indexed = 1,
|
||||
.channel = 0,
|
||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||
IIO_CHAN_INFO_SCALE_SHARED_BIT,
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
|
||||
.address = 0,
|
||||
.scan_index = 0,
|
||||
.scan_type = IIO_ST('u', 12, 16, 0),
|
||||
|
||||
@@ -0,0 +1,383 @@
|
||||
/*
|
||||
* AD7904/AD7914/AD7923/AD7924 SPI ADC driver
|
||||
*
|
||||
* Copyright 2011 Analog Devices Inc (from AD7923 Driver)
|
||||
* Copyright 2012 CS Systemes d'Information
|
||||
*
|
||||
* Licensed under the GPL-2.
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/sysfs.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
#include <linux/iio/iio.h>
|
||||
#include <linux/iio/sysfs.h>
|
||||
#include <linux/iio/buffer.h>
|
||||
#include <linux/iio/trigger_consumer.h>
|
||||
#include <linux/iio/triggered_buffer.h>
|
||||
|
||||
#define AD7923_WRITE_CR (1 << 11) /* write control register */
|
||||
#define AD7923_RANGE (1 << 1) /* range to REFin */
|
||||
#define AD7923_CODING (1 << 0) /* coding is straight binary */
|
||||
#define AD7923_PM_MODE_AS (1) /* auto shutdown */
|
||||
#define AD7923_PM_MODE_FS (2) /* full shutdown */
|
||||
#define AD7923_PM_MODE_OPS (3) /* normal operation */
|
||||
#define AD7923_CHANNEL_0 (0) /* analog input 0 */
|
||||
#define AD7923_CHANNEL_1 (1) /* analog input 1 */
|
||||
#define AD7923_CHANNEL_2 (2) /* analog input 2 */
|
||||
#define AD7923_CHANNEL_3 (3) /* analog input 3 */
|
||||
#define AD7923_SEQUENCE_OFF (0) /* no sequence fonction */
|
||||
#define AD7923_SEQUENCE_PROTECT (2) /* no interrupt write cycle */
|
||||
#define AD7923_SEQUENCE_ON (3) /* continuous sequence */
|
||||
|
||||
#define AD7923_MAX_CHAN 4
|
||||
|
||||
#define AD7923_PM_MODE_WRITE(mode) (mode << 4) /* write mode */
|
||||
#define AD7923_CHANNEL_WRITE(channel) (channel << 6) /* write channel */
|
||||
#define AD7923_SEQUENCE_WRITE(sequence) (((sequence & 1) << 3) \
|
||||
+ ((sequence & 2) << 9))
|
||||
/* write sequence fonction */
|
||||
/* left shift for CR : bit 11 transmit in first */
|
||||
#define AD7923_SHIFT_REGISTER 4
|
||||
|
||||
/* val = value, dec = left shift, bits = number of bits of the mask */
|
||||
#define EXTRACT(val, dec, bits) ((val >> dec) & ((1 << bits) - 1))
|
||||
|
||||
struct ad7923_state {
|
||||
struct spi_device *spi;
|
||||
struct spi_transfer ring_xfer[5];
|
||||
struct spi_transfer scan_single_xfer[2];
|
||||
struct spi_message ring_msg;
|
||||
struct spi_message scan_single_msg;
|
||||
|
||||
struct regulator *reg;
|
||||
|
||||
unsigned int settings;
|
||||
|
||||
/*
|
||||
* DMA (thus cache coherency maintenance) requires the
|
||||
* transfer buffers to live in their own cache lines.
|
||||
*/
|
||||
__be16 rx_buf[4] ____cacheline_aligned;
|
||||
__be16 tx_buf[4];
|
||||
};
|
||||
|
||||
struct ad7923_chip_info {
|
||||
const struct iio_chan_spec *channels;
|
||||
unsigned int num_channels;
|
||||
};
|
||||
|
||||
enum ad7923_id {
|
||||
AD7904,
|
||||
AD7914,
|
||||
AD7924,
|
||||
};
|
||||
|
||||
#define AD7923_V_CHAN(index, bits) \
|
||||
{ \
|
||||
.type = IIO_VOLTAGE, \
|
||||
.indexed = 1, \
|
||||
.channel = index, \
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
|
||||
.address = index, \
|
||||
.scan_index = index, \
|
||||
.scan_type = { \
|
||||
.sign = 'u', \
|
||||
.realbits = (bits), \
|
||||
.storagebits = 16, \
|
||||
.endianness = IIO_BE, \
|
||||
}, \
|
||||
}
|
||||
|
||||
#define DECLARE_AD7923_CHANNELS(name, bits) \
|
||||
const struct iio_chan_spec name ## _channels[] = { \
|
||||
AD7923_V_CHAN(0, bits), \
|
||||
AD7923_V_CHAN(1, bits), \
|
||||
AD7923_V_CHAN(2, bits), \
|
||||
AD7923_V_CHAN(3, bits), \
|
||||
IIO_CHAN_SOFT_TIMESTAMP(4), \
|
||||
}
|
||||
|
||||
static DECLARE_AD7923_CHANNELS(ad7904, 8);
|
||||
static DECLARE_AD7923_CHANNELS(ad7914, 10);
|
||||
static DECLARE_AD7923_CHANNELS(ad7924, 12);
|
||||
|
||||
static const struct ad7923_chip_info ad7923_chip_info[] = {
|
||||
[AD7904] = {
|
||||
.channels = ad7904_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7904_channels),
|
||||
},
|
||||
[AD7914] = {
|
||||
.channels = ad7914_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7914_channels),
|
||||
},
|
||||
[AD7924] = {
|
||||
.channels = ad7924_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7924_channels),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* ad7923_update_scan_mode() setup the spi transfer buffer for the new scan mask
|
||||
**/
|
||||
static int ad7923_update_scan_mode(struct iio_dev *indio_dev,
|
||||
const unsigned long *active_scan_mask)
|
||||
{
|
||||
struct ad7923_state *st = iio_priv(indio_dev);
|
||||
int i, cmd, len;
|
||||
|
||||
len = 0;
|
||||
for_each_set_bit(i, active_scan_mask, AD7923_MAX_CHAN) {
|
||||
cmd = AD7923_WRITE_CR | AD7923_CHANNEL_WRITE(i) |
|
||||
AD7923_SEQUENCE_WRITE(AD7923_SEQUENCE_OFF) |
|
||||
st->settings;
|
||||
cmd <<= AD7923_SHIFT_REGISTER;
|
||||
st->tx_buf[len++] = cpu_to_be16(cmd);
|
||||
}
|
||||
/* build spi ring message */
|
||||
st->ring_xfer[0].tx_buf = &st->tx_buf[0];
|
||||
st->ring_xfer[0].len = len;
|
||||
st->ring_xfer[0].cs_change = 1;
|
||||
|
||||
spi_message_init(&st->ring_msg);
|
||||
spi_message_add_tail(&st->ring_xfer[0], &st->ring_msg);
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
st->ring_xfer[i + 1].rx_buf = &st->rx_buf[i];
|
||||
st->ring_xfer[i + 1].len = 2;
|
||||
st->ring_xfer[i + 1].cs_change = 1;
|
||||
spi_message_add_tail(&st->ring_xfer[i + 1], &st->ring_msg);
|
||||
}
|
||||
/* make sure last transfer cs_change is not set */
|
||||
st->ring_xfer[i + 1].cs_change = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ad7923_trigger_handler() bh of trigger launched polling to ring buffer
|
||||
*
|
||||
* Currently there is no option in this driver to disable the saving of
|
||||
* timestamps within the ring.
|
||||
**/
|
||||
static irqreturn_t ad7923_trigger_handler(int irq, void *p)
|
||||
{
|
||||
struct iio_poll_func *pf = p;
|
||||
struct iio_dev *indio_dev = pf->indio_dev;
|
||||
struct ad7923_state *st = iio_priv(indio_dev);
|
||||
s64 time_ns = 0;
|
||||
int b_sent;
|
||||
|
||||
b_sent = spi_sync(st->spi, &st->ring_msg);
|
||||
if (b_sent)
|
||||
goto done;
|
||||
|
||||
if (indio_dev->scan_timestamp) {
|
||||
time_ns = iio_get_time_ns();
|
||||
memcpy((u8 *)st->rx_buf + indio_dev->scan_bytes - sizeof(s64),
|
||||
&time_ns, sizeof(time_ns));
|
||||
}
|
||||
|
||||
iio_push_to_buffers(indio_dev, (u8 *)st->rx_buf);
|
||||
|
||||
done:
|
||||
iio_trigger_notify_done(indio_dev->trig);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int ad7923_scan_direct(struct ad7923_state *st, unsigned ch)
|
||||
{
|
||||
int ret, cmd;
|
||||
|
||||
cmd = AD7923_WRITE_CR | AD7923_CHANNEL_WRITE(ch) |
|
||||
AD7923_SEQUENCE_WRITE(AD7923_SEQUENCE_OFF) |
|
||||
st->settings;
|
||||
cmd <<= AD7923_SHIFT_REGISTER;
|
||||
st->tx_buf[0] = cpu_to_be16(cmd);
|
||||
|
||||
ret = spi_sync(st->spi, &st->scan_single_msg);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return be16_to_cpu(st->rx_buf[0]);
|
||||
}
|
||||
|
||||
static int ad7923_get_range(struct ad7923_state *st)
|
||||
{
|
||||
int vref;
|
||||
|
||||
vref = regulator_get_voltage(st->reg);
|
||||
if (vref < 0)
|
||||
return vref;
|
||||
|
||||
vref /= 1000;
|
||||
|
||||
if (!(st->settings & AD7923_RANGE))
|
||||
vref *= 2;
|
||||
|
||||
return vref;
|
||||
}
|
||||
|
||||
static int ad7923_read_raw(struct iio_dev *indio_dev,
|
||||
struct iio_chan_spec const *chan,
|
||||
int *val,
|
||||
int *val2,
|
||||
long m)
|
||||
{
|
||||
int ret;
|
||||
struct ad7923_state *st = iio_priv(indio_dev);
|
||||
|
||||
switch (m) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
mutex_lock(&indio_dev->mlock);
|
||||
if (iio_buffer_enabled(indio_dev))
|
||||
ret = -EBUSY;
|
||||
else
|
||||
ret = ad7923_scan_direct(st, chan->address);
|
||||
mutex_unlock(&indio_dev->mlock);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (chan->address == EXTRACT(ret, 12, 4))
|
||||
*val = EXTRACT(ret, 0, 12);
|
||||
else
|
||||
return -EIO;
|
||||
|
||||
return IIO_VAL_INT;
|
||||
case IIO_CHAN_INFO_SCALE:
|
||||
ret = ad7923_get_range(st);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
*val = ret;
|
||||
*val2 = chan->scan_type.realbits;
|
||||
return IIO_VAL_FRACTIONAL_LOG2;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static const struct iio_info ad7923_info = {
|
||||
.read_raw = &ad7923_read_raw,
|
||||
.update_scan_mode = ad7923_update_scan_mode,
|
||||
.driver_module = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int ad7923_probe(struct spi_device *spi)
|
||||
{
|
||||
struct ad7923_state *st;
|
||||
struct iio_dev *indio_dev = iio_device_alloc(sizeof(*st));
|
||||
const struct ad7923_chip_info *info;
|
||||
int ret;
|
||||
|
||||
if (indio_dev == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
st = iio_priv(indio_dev);
|
||||
|
||||
spi_set_drvdata(spi, indio_dev);
|
||||
|
||||
st->spi = spi;
|
||||
st->settings = AD7923_CODING | AD7923_RANGE |
|
||||
AD7923_PM_MODE_WRITE(AD7923_PM_MODE_OPS);
|
||||
|
||||
info = &ad7923_chip_info[spi_get_device_id(spi)->driver_data];
|
||||
|
||||
indio_dev->name = spi_get_device_id(spi)->name;
|
||||
indio_dev->dev.parent = &spi->dev;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->channels = info->channels;
|
||||
indio_dev->num_channels = info->num_channels;
|
||||
indio_dev->info = &ad7923_info;
|
||||
|
||||
/* Setup default message */
|
||||
|
||||
st->scan_single_xfer[0].tx_buf = &st->tx_buf[0];
|
||||
st->scan_single_xfer[0].len = 2;
|
||||
st->scan_single_xfer[0].cs_change = 1;
|
||||
st->scan_single_xfer[1].rx_buf = &st->rx_buf[0];
|
||||
st->scan_single_xfer[1].len = 2;
|
||||
|
||||
spi_message_init(&st->scan_single_msg);
|
||||
spi_message_add_tail(&st->scan_single_xfer[0], &st->scan_single_msg);
|
||||
spi_message_add_tail(&st->scan_single_xfer[1], &st->scan_single_msg);
|
||||
|
||||
st->reg = regulator_get(&spi->dev, "refin");
|
||||
if (IS_ERR(st->reg)) {
|
||||
ret = PTR_ERR(st->reg);
|
||||
goto error_free;
|
||||
}
|
||||
ret = regulator_enable(st->reg);
|
||||
if (ret)
|
||||
goto error_put_reg;
|
||||
|
||||
ret = iio_triggered_buffer_setup(indio_dev, NULL,
|
||||
&ad7923_trigger_handler, NULL);
|
||||
if (ret)
|
||||
goto error_disable_reg;
|
||||
|
||||
ret = iio_device_register(indio_dev);
|
||||
if (ret)
|
||||
goto error_cleanup_ring;
|
||||
|
||||
return 0;
|
||||
|
||||
error_cleanup_ring:
|
||||
iio_triggered_buffer_cleanup(indio_dev);
|
||||
error_disable_reg:
|
||||
regulator_disable(st->reg);
|
||||
error_put_reg:
|
||||
regulator_put(st->reg);
|
||||
error_free:
|
||||
iio_device_free(indio_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ad7923_remove(struct spi_device *spi)
|
||||
{
|
||||
struct iio_dev *indio_dev = spi_get_drvdata(spi);
|
||||
struct ad7923_state *st = iio_priv(indio_dev);
|
||||
|
||||
iio_device_unregister(indio_dev);
|
||||
iio_triggered_buffer_cleanup(indio_dev);
|
||||
regulator_disable(st->reg);
|
||||
regulator_put(st->reg);
|
||||
iio_device_free(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spi_device_id ad7923_id[] = {
|
||||
{"ad7904", AD7904},
|
||||
{"ad7914", AD7914},
|
||||
{"ad7923", AD7924},
|
||||
{"ad7924", AD7924},
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(spi, ad7923_id);
|
||||
|
||||
static struct spi_driver ad7923_driver = {
|
||||
.driver = {
|
||||
.name = "ad7923",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = ad7923_probe,
|
||||
.remove = ad7923_remove,
|
||||
.id_table = ad7923_id,
|
||||
};
|
||||
module_spi_driver(ad7923_driver);
|
||||
|
||||
MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
|
||||
MODULE_AUTHOR("Patrick Vasseur <patrick.vasseur@c-s.fr>");
|
||||
MODULE_DESCRIPTION("Analog Devices AD7904/AD7914/AD7923/AD7924 ADC");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
@@ -470,7 +470,7 @@ static int ad_sd_probe_trigger(struct iio_dev *indio_dev)
|
||||
disable_irq_nosync(sigma_delta->spi->irq);
|
||||
}
|
||||
sigma_delta->trig->dev.parent = &sigma_delta->spi->dev;
|
||||
sigma_delta->trig->private_data = sigma_delta;
|
||||
iio_trigger_set_drvdata(sigma_delta->trig, sigma_delta);
|
||||
|
||||
ret = iio_trigger_register(sigma_delta->trig);
|
||||
if (ret)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user