Merge tag 'iio-for-5.20b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next
Jonathan writes:
2nd set of IIO new device support, cleanup etc for 5.20
Given the slight delay in the likely start of the merge cycle lets get
a few more things in for IIO. A few late breaking fixes also included.
Bulk in number of patches is mechanical conversion to new PM macros.
New device support
* npcm
- Add support for NPCM8XX with different resolution and voltage references
from previously supported parts.
Tree wide
* pm_ptr()/pm_sleep_ptr()/DEFINE_[SIMPLE/RUNTIME]_DEV_PM_OPS() conversions
- Convert all the low hanging fruit to the new macros. The remaining
cases will need more careful consideration.
Tidy-up, fixes and minor features.
* Documentation
- Fix duplicate ABI definitions and a missing blank line to squash all
remaining docs build issues in IIO.
* core
- Make iio_format_avail_range() handle non IIO_VAL_INT cases.
* core/trigger
- Move the setup of trigger->owner to allocation rather than registration.
There doesn't seem to be any advantage in doing this late and a few bugs
have occurred because of mis-balanced module reference counting.
- coding style fix-ups.
* tests
- Allow kunit tests to be built as a module.
* ad7949
- Fix a reversed error message.
* cio-dac
- Use structures for register map to improve readability.
* cros_ec
- Register fifo callback only after the sensor is registered. Closes
a theoretical race.
* hmc5843
- Duplicate word fix.
* isl29028
- Fix mixed devm_ and non devm_ for iio_device_register().
* max1027
- Fix missing unlocks in error paths.
* rm3100
- Let core code handle setting INDIO_BUFFER_TRIGGERED.
* sca3000
- Fix ordering and buffer size issue.
* sx_common
- Don't use the IIO device to get device properties when the parent struct
device is readily available.
- Allow the IIO core to connect up the firmware node.
* stx104
- Use structures for register map to improve readability.
* vf610-adc
- Add compatible entries for imx6ul and imx6sx with fallback to
fsl,vf610-adc.
* tag 'iio-for-5.20b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (65 commits)
dt-bindings: iio: adc: Add compatible for MT8188
iio: light: isl29028: Fix the warning in isl29028_remove()
iio: accel: sca3300: Extend the trigger buffer from 16 to 32 bytes
iio: fix iio_format_avail_range() printing for none IIO_VAL_INT
iio: adc: max1027: unlock on error path in max1027_read_single_value()
iio: proximity: sx9324: add empty line in front of bullet list
iio: magnetometer: hmc5843: Remove duplicate 'the'
iio: magn: yas530: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
iio: magnetometer: ak8974: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
iio: light: veml6030: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
iio: light: vcnl4035: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
iio: light: vcnl4000: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
iio: light: tsl2591: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
iio: light: tsl2583: Use DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
iio: light: isl29028: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
iio: light: gp2ap002: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
iio: adc: imx8qxp: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
iio: light: us5182: Switch from CONFIG_PM guards to pm_ptr() etc
iio: temperature: ltc2983: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
iio: proximity: cros_ec_mkbp: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
...
This commit is contained in:
@@ -107,6 +107,9 @@ Description:
|
||||
relevant directories. If it affects all of the above
|
||||
then it is to be found in the base device directory.
|
||||
|
||||
The stm32-timer-trigger has the additional characteristic that
|
||||
a sampling_frequency of 0 is defined to stop sampling.
|
||||
|
||||
What: /sys/bus/iio/devices/iio:deviceX/sampling_frequency_available
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_intensity_sampling_frequency_available
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_proximity_sampling_frequency_available
|
||||
|
||||
@@ -5,6 +5,7 @@ Contact: Gwendal Grignou <gwendal@chromium.org>
|
||||
Description:
|
||||
SX9324 has 3 inputs, CS0, CS1 and CS2. Hardware layout
|
||||
defines if the input is
|
||||
|
||||
+ not connected (HZ),
|
||||
+ grounded (GD),
|
||||
+ connected to an antenna where it can act as a base
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
What: /sys/bus/iio/devices/iio:deviceX/fault_oc
|
||||
KernelVersion: 5.1
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Open-circuit fault. The detection of open-circuit faults,
|
||||
such as those caused by broken thermocouple wires.
|
||||
Reading returns either '1' or '0'.
|
||||
|
||||
=== =======================================================
|
||||
'1' An open circuit such as broken thermocouple wires
|
||||
has been detected.
|
||||
'0' No open circuit or broken thermocouple wires are detected
|
||||
=== =======================================================
|
||||
|
||||
What: /sys/bus/iio/devices/iio:deviceX/fault_ovuv
|
||||
KernelVersion: 5.1
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Overvoltage or Undervoltage Input Fault. The internal circuitry
|
||||
is protected from excessive voltages applied to the thermocouple
|
||||
cables by integrated MOSFETs at the T+ and T- inputs, and the
|
||||
BIAS output. These MOSFETs turn off when the input voltage is
|
||||
negative or greater than VDD.
|
||||
|
||||
Reading returns either '1' or '0'.
|
||||
|
||||
=== =======================================================
|
||||
'1' The input voltage is negative or greater than VDD.
|
||||
'0' The input voltage is positive and less than VDD (normal
|
||||
state).
|
||||
=== =======================================================
|
||||
@@ -1,20 +0,0 @@
|
||||
What: /sys/bus/iio/devices/iio:deviceX/fault_ovuv
|
||||
KernelVersion: 5.11
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Overvoltage or Undervoltage Input fault. The internal circuitry
|
||||
is protected from excessive voltages applied to the thermocouple
|
||||
cables at FORCE+, FORCE2, RTDIN+ & RTDIN-. This circuitry turn
|
||||
off when the input voltage is negative or greater than VDD.
|
||||
|
||||
Reading returns '1' if input voltage is negative or greater
|
||||
than VDD, otherwise '0'.
|
||||
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_filter_notch_center_frequency
|
||||
KernelVersion: 5.11
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Notch frequency in Hz for a noise rejection filter. Used i.e for
|
||||
line noise rejection.
|
||||
|
||||
Valid notch filter values are 50 Hz and 60 Hz.
|
||||
@@ -0,0 +1,18 @@
|
||||
What: /sys/bus/iio/devices/iio:deviceX/fault_ovuv
|
||||
KernelVersion: 5.1
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Overvoltage or Undervoltage Input Fault. The internal circuitry
|
||||
is protected from excessive voltages applied to the thermocouple
|
||||
cables. The device can also detect if such a condition occurs.
|
||||
|
||||
Reading returns '1' if input voltage is negative or greater
|
||||
than VDD, otherwise '0'.
|
||||
|
||||
What: /sys/bus/iio/devices/iio:deviceX/fault_oc
|
||||
KernelVersion: 5.1
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Open-circuit fault. The detection of open-circuit faults,
|
||||
such as those caused by broken thermocouple wires.
|
||||
Reading returns '1' if fault, '0' otherwise.
|
||||
@@ -90,14 +90,6 @@ Description:
|
||||
Reading returns the current master modes.
|
||||
Writing set the master mode
|
||||
|
||||
What: /sys/bus/iio/devices/triggerX/sampling_frequency
|
||||
KernelVersion: 4.11
|
||||
Contact: benjamin.gaignard@st.com
|
||||
Description:
|
||||
Reading returns the current sampling frequency.
|
||||
Writing an value different of 0 set and start sampling.
|
||||
Writing 0 stop sampling.
|
||||
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_count0_preset
|
||||
KernelVersion: 4.12
|
||||
Contact: benjamin.gaignard@st.com
|
||||
|
||||
@@ -14,7 +14,14 @@ description:
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: fsl,vf610-adc
|
||||
oneOf:
|
||||
- items:
|
||||
- enum:
|
||||
- fsl,imx6sx-adc
|
||||
- fsl,imx6ul-adc
|
||||
- const: fsl,vf610-adc
|
||||
- items:
|
||||
- const: fsl,vf610-adc
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
@@ -35,6 +35,7 @@ properties:
|
||||
- enum:
|
||||
- mediatek,mt8183-auxadc
|
||||
- mediatek,mt8186-auxadc
|
||||
- mediatek,mt8188-auxadc
|
||||
- mediatek,mt8195-auxadc
|
||||
- mediatek,mt8516-auxadc
|
||||
- const: mediatek,mt8173-auxadc
|
||||
|
||||
@@ -10,11 +10,14 @@ maintainers:
|
||||
- Tomer Maimon <tmaimon77@gmail.com>
|
||||
|
||||
description:
|
||||
The NPCM ADC is a 10-bit converter for eight channel inputs.
|
||||
The NPCM7XX ADC is a 10-bit converter and NPCM8XX ADC is a 12-bit converter,
|
||||
both have eight channel inputs.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: nuvoton,npcm750-adc
|
||||
enum:
|
||||
- nuvoton,npcm750-adc
|
||||
- nuvoton,npcm845-adc
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
@@ -289,20 +289,20 @@ static int bma220_probe(struct spi_device *spi)
|
||||
return devm_iio_device_register(&spi->dev, indio_dev);
|
||||
}
|
||||
|
||||
static __maybe_unused int bma220_suspend(struct device *dev)
|
||||
static int bma220_suspend(struct device *dev)
|
||||
{
|
||||
struct spi_device *spi = to_spi_device(dev);
|
||||
|
||||
return bma220_power(spi, false);
|
||||
}
|
||||
|
||||
static __maybe_unused int bma220_resume(struct device *dev)
|
||||
static int bma220_resume(struct device *dev)
|
||||
{
|
||||
struct spi_device *spi = to_spi_device(dev);
|
||||
|
||||
return bma220_power(spi, true);
|
||||
}
|
||||
static SIMPLE_DEV_PM_OPS(bma220_pm_ops, bma220_suspend, bma220_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(bma220_pm_ops, bma220_suspend, bma220_resume);
|
||||
|
||||
static const struct spi_device_id bma220_spi_id[] = {
|
||||
{"bma220", 0},
|
||||
@@ -318,7 +318,7 @@ MODULE_DEVICE_TABLE(spi, bma220_spi_id);
|
||||
static struct spi_driver bma220_driver = {
|
||||
.driver = {
|
||||
.name = "bma220_spi",
|
||||
.pm = &bma220_pm_ops,
|
||||
.pm = pm_sleep_ptr(&bma220_pm_ops),
|
||||
.acpi_match_table = bma220_acpi_id,
|
||||
},
|
||||
.probe = bma220_probe,
|
||||
|
||||
@@ -215,7 +215,7 @@ static int cros_ec_accel_legacy_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = cros_ec_sensors_core_init(pdev, indio_dev, true,
|
||||
cros_ec_sensors_capture, NULL);
|
||||
cros_ec_sensors_capture);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -235,7 +235,7 @@ static int cros_ec_accel_legacy_probe(struct platform_device *pdev)
|
||||
state->sign[CROS_EC_SENSOR_Z] = -1;
|
||||
}
|
||||
|
||||
return devm_iio_device_register(dev, indio_dev);
|
||||
return cros_ec_sensors_core_register(dev, indio_dev, NULL);
|
||||
}
|
||||
|
||||
static struct platform_driver cros_ec_accel_platform_driver = {
|
||||
|
||||
+19
-11
@@ -52,12 +52,21 @@ enum sca3300_scan_indexes {
|
||||
SCA3300_ACC_Y,
|
||||
SCA3300_ACC_Z,
|
||||
SCA3300_TEMP,
|
||||
SCA3300_TIMESTAMP,
|
||||
SCA3300_INCLI_X,
|
||||
SCA3300_INCLI_Y,
|
||||
SCA3300_INCLI_Z,
|
||||
SCA3300_SCAN_MAX
|
||||
};
|
||||
|
||||
/*
|
||||
* Buffer size max case:
|
||||
* Three accel channels, two bytes per channel.
|
||||
* Temperature channel, two bytes.
|
||||
* Three incli channels, two bytes per channel.
|
||||
* Timestamp channel, eight bytes.
|
||||
*/
|
||||
#define SCA3300_MAX_BUFFER_SIZE (ALIGN(sizeof(s16) * SCA3300_SCAN_MAX, sizeof(s64)) + sizeof(s64))
|
||||
|
||||
#define SCA3300_ACCEL_CHANNEL(index, reg, axis) { \
|
||||
.type = IIO_ACCEL, \
|
||||
.address = reg, \
|
||||
@@ -140,10 +149,10 @@ static const struct iio_chan_spec scl3300_channels[] = {
|
||||
SCA3300_ACCEL_CHANNEL(SCA3300_ACC_Y, 0x2, Y),
|
||||
SCA3300_ACCEL_CHANNEL(SCA3300_ACC_Z, 0x3, Z),
|
||||
SCA3300_TEMP_CHANNEL(SCA3300_TEMP, 0x05),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(4),
|
||||
SCA3300_INCLI_CHANNEL(SCA3300_INCLI_X, 0x09, X),
|
||||
SCA3300_INCLI_CHANNEL(SCA3300_INCLI_Y, 0x0A, Y),
|
||||
SCA3300_INCLI_CHANNEL(SCA3300_INCLI_Z, 0x0B, Z),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(7),
|
||||
};
|
||||
|
||||
static const unsigned long sca3300_scan_masks[] = {
|
||||
@@ -184,7 +193,9 @@ struct sca3300_chip_info {
|
||||
* @spi: SPI device structure
|
||||
* @lock: Data buffer lock
|
||||
* @chip: Sensor chip specific information
|
||||
* @scan: Triggered buffer. Four channel 16-bit data + 64-bit timestamp
|
||||
* @buffer: Triggered buffer:
|
||||
* -SCA3300: 4 channel 16-bit data + 64-bit timestamp
|
||||
* -SCL3300: 7 channel 16-bit data + 64-bit timestamp
|
||||
* @txbuf: Transmit buffer
|
||||
* @rxbuf: Receive buffer
|
||||
*/
|
||||
@@ -192,10 +203,7 @@ struct sca3300_data {
|
||||
struct spi_device *spi;
|
||||
struct mutex lock;
|
||||
const struct sca3300_chip_info *chip;
|
||||
struct {
|
||||
s16 channels[4];
|
||||
s64 ts __aligned(sizeof(s64));
|
||||
} scan;
|
||||
u8 buffer[SCA3300_MAX_BUFFER_SIZE] __aligned(sizeof(s64));
|
||||
u8 txbuf[4] __aligned(IIO_DMA_MINALIGN);
|
||||
u8 rxbuf[4];
|
||||
};
|
||||
@@ -484,21 +492,21 @@ static irqreturn_t sca3300_trigger_handler(int irq, void *p)
|
||||
struct iio_dev *indio_dev = pf->indio_dev;
|
||||
struct sca3300_data *data = iio_priv(indio_dev);
|
||||
int bit, ret, val, i = 0;
|
||||
s16 *channels = (s16 *)data->buffer;
|
||||
|
||||
for_each_set_bit(bit, indio_dev->active_scan_mask,
|
||||
indio_dev->masklength) {
|
||||
ret = sca3300_read_reg(data, sca3300_channels[bit].address,
|
||||
&val);
|
||||
ret = sca3300_read_reg(data, indio_dev->channels[bit].address, &val);
|
||||
if (ret) {
|
||||
dev_err_ratelimited(&data->spi->dev,
|
||||
"failed to read register, error: %d\n", ret);
|
||||
/* handled, but bailing out due to errors */
|
||||
goto out;
|
||||
}
|
||||
data->scan.channels[i++] = val;
|
||||
channels[i++] = val;
|
||||
}
|
||||
|
||||
iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
|
||||
iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
|
||||
iio_get_time_ns(indio_dev));
|
||||
out:
|
||||
iio_trigger_notify_done(indio_dev->trig);
|
||||
|
||||
@@ -400,7 +400,7 @@ static int ad7949_spi_probe(struct spi_device *spi)
|
||||
|
||||
ret = ad7949_spi_init(ad7949_adc);
|
||||
if (ret) {
|
||||
dev_err(dev, "enable to init this device: %d\n", ret);
|
||||
dev_err(dev, "fail to init this device: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -896,7 +896,7 @@ static int ad799x_remove(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused ad799x_suspend(struct device *dev)
|
||||
static int ad799x_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
struct ad799x_state *st = iio_priv(indio_dev);
|
||||
@@ -908,7 +908,7 @@ static int __maybe_unused ad799x_suspend(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused ad799x_resume(struct device *dev)
|
||||
static int ad799x_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
struct ad799x_state *st = iio_priv(indio_dev);
|
||||
@@ -941,7 +941,7 @@ static int __maybe_unused ad799x_resume(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(ad799x_pm_ops, ad799x_suspend, ad799x_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(ad799x_pm_ops, ad799x_suspend, ad799x_resume);
|
||||
|
||||
static const struct i2c_device_id ad799x_id[] = {
|
||||
{ "ad7991", ad7991 },
|
||||
@@ -960,7 +960,7 @@ MODULE_DEVICE_TABLE(i2c, ad799x_id);
|
||||
static struct i2c_driver ad799x_driver = {
|
||||
.driver = {
|
||||
.name = "ad799x",
|
||||
.pm = &ad799x_pm_ops,
|
||||
.pm = pm_sleep_ptr(&ad799x_pm_ops),
|
||||
},
|
||||
.probe = ad799x_probe,
|
||||
.remove = ad799x_remove,
|
||||
|
||||
@@ -2103,7 +2103,7 @@ static int at91_adc_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __maybe_unused int at91_adc_suspend(struct device *dev)
|
||||
static int at91_adc_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct at91_adc_state *st = iio_priv(indio_dev);
|
||||
@@ -2123,7 +2123,7 @@ static __maybe_unused int at91_adc_suspend(struct device *dev)
|
||||
return pinctrl_pm_select_sleep_state(dev);
|
||||
}
|
||||
|
||||
static __maybe_unused int at91_adc_resume(struct device *dev)
|
||||
static int at91_adc_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct at91_adc_state *st = iio_priv(indio_dev);
|
||||
@@ -2169,7 +2169,8 @@ resume_failed:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend, at91_adc_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend,
|
||||
at91_adc_resume);
|
||||
|
||||
static const struct of_device_id at91_adc_dt_match[] = {
|
||||
{
|
||||
@@ -2190,7 +2191,7 @@ static struct platform_driver at91_adc_driver = {
|
||||
.driver = {
|
||||
.name = "at91-sama5d2_adc",
|
||||
.of_match_table = at91_adc_dt_match,
|
||||
.pm = &at91_adc_pm_ops,
|
||||
.pm = pm_sleep_ptr(&at91_adc_pm_ops),
|
||||
},
|
||||
};
|
||||
module_platform_driver(at91_adc_driver)
|
||||
|
||||
@@ -540,14 +540,15 @@ static int imx7d_adc_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_disable, imx7d_adc_enable);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_disable,
|
||||
imx7d_adc_enable);
|
||||
|
||||
static struct platform_driver imx7d_adc_driver = {
|
||||
.probe = imx7d_adc_probe,
|
||||
.driver = {
|
||||
.name = "imx7d_adc",
|
||||
.of_match_table = imx7d_adc_match,
|
||||
.pm = &imx7d_adc_pm_ops,
|
||||
.pm = pm_sleep_ptr(&imx7d_adc_pm_ops),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -417,7 +417,7 @@ static int imx8qxp_adc_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __maybe_unused int imx8qxp_adc_runtime_suspend(struct device *dev)
|
||||
static int imx8qxp_adc_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct imx8qxp_adc *adc = iio_priv(indio_dev);
|
||||
@@ -431,7 +431,7 @@ static __maybe_unused int imx8qxp_adc_runtime_suspend(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __maybe_unused int imx8qxp_adc_runtime_resume(struct device *dev)
|
||||
static int imx8qxp_adc_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct imx8qxp_adc *adc = iio_priv(indio_dev);
|
||||
@@ -468,10 +468,9 @@ err_disable_reg:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops imx8qxp_adc_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
|
||||
SET_RUNTIME_PM_OPS(imx8qxp_adc_runtime_suspend, imx8qxp_adc_runtime_resume, NULL)
|
||||
};
|
||||
static DEFINE_RUNTIME_DEV_PM_OPS(imx8qxp_adc_pm_ops,
|
||||
imx8qxp_adc_runtime_suspend,
|
||||
imx8qxp_adc_runtime_resume, NULL);
|
||||
|
||||
static const struct of_device_id imx8qxp_adc_match[] = {
|
||||
{ .compatible = "nxp,imx8qxp-adc", },
|
||||
@@ -485,7 +484,7 @@ static struct platform_driver imx8qxp_adc_driver = {
|
||||
.driver = {
|
||||
.name = ADC_DRIVER_NAME,
|
||||
.of_match_table = imx8qxp_adc_match,
|
||||
.pm = &imx8qxp_adc_pm_ops,
|
||||
.pm = pm_ptr(&imx8qxp_adc_pm_ops),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -349,8 +349,7 @@ static int max1027_read_single_value(struct iio_dev *indio_dev,
|
||||
if (ret < 0) {
|
||||
dev_err(&indio_dev->dev,
|
||||
"Failed to configure conversion register\n");
|
||||
iio_device_release_direct_mode(indio_dev);
|
||||
return ret;
|
||||
goto release;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -360,11 +359,12 @@ static int max1027_read_single_value(struct iio_dev *indio_dev,
|
||||
*/
|
||||
ret = max1027_wait_eoc(indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto release;
|
||||
|
||||
/* Read result */
|
||||
ret = spi_read(st->spi, st->buffer, (chan->type == IIO_TEMP) ? 4 : 2);
|
||||
|
||||
release:
|
||||
iio_device_release_direct_mode(indio_dev);
|
||||
|
||||
if (ret < 0)
|
||||
|
||||
@@ -1281,22 +1281,22 @@ static int meson_sar_adc_remove(struct platform_device *pdev)
|
||||
return meson_sar_adc_hw_disable(indio_dev);
|
||||
}
|
||||
|
||||
static int __maybe_unused meson_sar_adc_suspend(struct device *dev)
|
||||
static int meson_sar_adc_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
|
||||
return meson_sar_adc_hw_disable(indio_dev);
|
||||
}
|
||||
|
||||
static int __maybe_unused meson_sar_adc_resume(struct device *dev)
|
||||
static int meson_sar_adc_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
|
||||
return meson_sar_adc_hw_enable(indio_dev);
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(meson_sar_adc_pm_ops,
|
||||
meson_sar_adc_suspend, meson_sar_adc_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(meson_sar_adc_pm_ops,
|
||||
meson_sar_adc_suspend, meson_sar_adc_resume);
|
||||
|
||||
static struct platform_driver meson_sar_adc_driver = {
|
||||
.probe = meson_sar_adc_probe,
|
||||
@@ -1304,7 +1304,7 @@ static struct platform_driver meson_sar_adc_driver = {
|
||||
.driver = {
|
||||
.name = "meson-saradc",
|
||||
.of_match_table = meson_sar_adc_of_match,
|
||||
.pm = &meson_sar_adc_pm_ops,
|
||||
.pm = pm_sleep_ptr(&meson_sar_adc_pm_ops),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ static const struct iio_info mt6577_auxadc_info = {
|
||||
.read_raw = &mt6577_auxadc_read_raw,
|
||||
};
|
||||
|
||||
static int __maybe_unused mt6577_auxadc_resume(struct device *dev)
|
||||
static int mt6577_auxadc_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct mt6577_auxadc_device *adc_dev = iio_priv(indio_dev);
|
||||
@@ -234,7 +234,7 @@ static int __maybe_unused mt6577_auxadc_resume(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused mt6577_auxadc_suspend(struct device *dev)
|
||||
static int mt6577_auxadc_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct mt6577_auxadc_device *adc_dev = iio_priv(indio_dev);
|
||||
@@ -330,9 +330,9 @@ static int mt6577_auxadc_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
|
||||
mt6577_auxadc_suspend,
|
||||
mt6577_auxadc_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
|
||||
mt6577_auxadc_suspend,
|
||||
mt6577_auxadc_resume);
|
||||
|
||||
static const struct of_device_id mt6577_auxadc_of_match[] = {
|
||||
{ .compatible = "mediatek,mt2701-auxadc", .data = &mt8173_compat },
|
||||
@@ -349,7 +349,7 @@ static struct platform_driver mt6577_auxadc_driver = {
|
||||
.driver = {
|
||||
.name = "mt6577-auxadc",
|
||||
.of_match_table = mt6577_auxadc_of_match,
|
||||
.pm = &mt6577_auxadc_pm_ops,
|
||||
.pm = pm_sleep_ptr(&mt6577_auxadc_pm_ops),
|
||||
},
|
||||
.probe = mt6577_auxadc_probe,
|
||||
.remove = mt6577_auxadc_remove,
|
||||
|
||||
@@ -11,12 +11,19 @@
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/reset.h>
|
||||
|
||||
struct npcm_adc_info {
|
||||
u32 data_mask;
|
||||
u32 internal_vref;
|
||||
u32 res_bits;
|
||||
};
|
||||
|
||||
struct npcm_adc {
|
||||
bool int_status;
|
||||
u32 adc_sample_hz;
|
||||
@@ -35,6 +42,7 @@ struct npcm_adc {
|
||||
* has finished.
|
||||
*/
|
||||
struct mutex lock;
|
||||
const struct npcm_adc_info *data;
|
||||
};
|
||||
|
||||
/* ADC registers */
|
||||
@@ -53,13 +61,21 @@ struct npcm_adc {
|
||||
#define NPCM_ADCCON_CH(x) ((x) << 24)
|
||||
#define NPCM_ADCCON_DIV_SHIFT 1
|
||||
#define NPCM_ADCCON_DIV_MASK GENMASK(8, 1)
|
||||
#define NPCM_ADC_DATA_MASK(x) ((x) & GENMASK(9, 0))
|
||||
|
||||
#define NPCM_ADC_ENABLE (NPCM_ADCCON_ADC_EN | NPCM_ADCCON_ADC_INT_EN)
|
||||
|
||||
/* ADC General Definition */
|
||||
#define NPCM_RESOLUTION_BITS 10
|
||||
#define NPCM_INT_VREF_MV 2000
|
||||
static const struct npcm_adc_info npxm7xx_adc_info = {
|
||||
.data_mask = GENMASK(9, 0),
|
||||
.internal_vref = 2048,
|
||||
.res_bits = 10,
|
||||
};
|
||||
|
||||
static const struct npcm_adc_info npxm8xx_adc_info = {
|
||||
.data_mask = GENMASK(11, 0),
|
||||
.internal_vref = 1229,
|
||||
.res_bits = 12,
|
||||
};
|
||||
|
||||
#define NPCM_ADC_CHAN(ch) { \
|
||||
.type = IIO_VOLTAGE, \
|
||||
@@ -130,7 +146,8 @@ static int npcm_adc_read(struct npcm_adc *info, int *val, u8 channel)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
*val = NPCM_ADC_DATA_MASK(ioread32(info->regs + NPCM_ADCDATA));
|
||||
*val = ioread32(info->regs + NPCM_ADCDATA);
|
||||
*val &= info->data->data_mask;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -158,9 +175,9 @@ static int npcm_adc_read_raw(struct iio_dev *indio_dev,
|
||||
vref_uv = regulator_get_voltage(info->vref);
|
||||
*val = vref_uv / 1000;
|
||||
} else {
|
||||
*val = NPCM_INT_VREF_MV;
|
||||
*val = info->data->internal_vref;
|
||||
}
|
||||
*val2 = NPCM_RESOLUTION_BITS;
|
||||
*val2 = info->data->res_bits;
|
||||
return IIO_VAL_FRACTIONAL_LOG2;
|
||||
case IIO_CHAN_INFO_SAMP_FREQ:
|
||||
*val = info->adc_sample_hz;
|
||||
@@ -177,7 +194,8 @@ static const struct iio_info npcm_adc_iio_info = {
|
||||
};
|
||||
|
||||
static const struct of_device_id npcm_adc_match[] = {
|
||||
{ .compatible = "nuvoton,npcm750-adc", },
|
||||
{ .compatible = "nuvoton,npcm750-adc", .data = &npxm7xx_adc_info},
|
||||
{ .compatible = "nuvoton,npcm845-adc", .data = &npxm8xx_adc_info},
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, npcm_adc_match);
|
||||
@@ -197,6 +215,10 @@ static int npcm_adc_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
info = iio_priv(indio_dev);
|
||||
|
||||
info->data = device_get_match_data(dev);
|
||||
if (!info->data)
|
||||
return -EINVAL;
|
||||
|
||||
mutex_init(&info->lock);
|
||||
|
||||
info->dev = &pdev->dev;
|
||||
|
||||
@@ -333,7 +333,7 @@ static int stmpe_adc_probe(struct platform_device *pdev)
|
||||
return devm_iio_device_register(&pdev->dev, indio_dev);
|
||||
}
|
||||
|
||||
static int __maybe_unused stmpe_adc_resume(struct device *dev)
|
||||
static int stmpe_adc_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct stmpe_adc *info = iio_priv(indio_dev);
|
||||
@@ -343,7 +343,7 @@ static int __maybe_unused stmpe_adc_resume(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(stmpe_adc_pm_ops, NULL, stmpe_adc_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(stmpe_adc_pm_ops, NULL, stmpe_adc_resume);
|
||||
|
||||
static const struct of_device_id stmpe_adc_ids[] = {
|
||||
{ .compatible = "st,stmpe-adc", },
|
||||
@@ -355,7 +355,7 @@ static struct platform_driver stmpe_adc_driver = {
|
||||
.probe = stmpe_adc_probe,
|
||||
.driver = {
|
||||
.name = "stmpe-adc",
|
||||
.pm = &stmpe_adc_pm_ops,
|
||||
.pm = pm_sleep_ptr(&stmpe_adc_pm_ops),
|
||||
.of_match_table = stmpe_adc_ids,
|
||||
},
|
||||
};
|
||||
|
||||
+50
-24
@@ -16,6 +16,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#define STX104_OUT_CHAN(chan) { \
|
||||
.type = IIO_VOLTAGE, \
|
||||
@@ -44,14 +45,36 @@ static unsigned int num_stx104;
|
||||
module_param_hw_array(base, uint, ioport, &num_stx104, 0);
|
||||
MODULE_PARM_DESC(base, "Apex Embedded Systems STX104 base addresses");
|
||||
|
||||
/**
|
||||
* struct stx104_reg - device register structure
|
||||
* @ssr_ad: Software Strobe Register and ADC Data
|
||||
* @achan: ADC Channel
|
||||
* @dio: Digital I/O
|
||||
* @dac: DAC Channels
|
||||
* @cir_asr: Clear Interrupts and ADC Status
|
||||
* @acr: ADC Control
|
||||
* @pccr_fsh: Pacer Clock Control and FIFO Status MSB
|
||||
* @acfg: ADC Configuration
|
||||
*/
|
||||
struct stx104_reg {
|
||||
u16 ssr_ad;
|
||||
u8 achan;
|
||||
u8 dio;
|
||||
u16 dac[2];
|
||||
u8 cir_asr;
|
||||
u8 acr;
|
||||
u8 pccr_fsh;
|
||||
u8 acfg;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct stx104_iio - IIO device private data structure
|
||||
* @chan_out_states: channels' output states
|
||||
* @base: base port address of the IIO device
|
||||
* @reg: I/O address offset for the device registers
|
||||
*/
|
||||
struct stx104_iio {
|
||||
unsigned int chan_out_states[STX104_NUM_OUT_CHAN];
|
||||
void __iomem *base;
|
||||
struct stx104_reg __iomem *reg;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -64,7 +87,7 @@ struct stx104_iio {
|
||||
struct stx104_gpio {
|
||||
struct gpio_chip chip;
|
||||
spinlock_t lock;
|
||||
void __iomem *base;
|
||||
u8 __iomem *base;
|
||||
unsigned int out_state;
|
||||
};
|
||||
|
||||
@@ -72,6 +95,7 @@ static int stx104_read_raw(struct iio_dev *indio_dev,
|
||||
struct iio_chan_spec const *chan, int *val, int *val2, long mask)
|
||||
{
|
||||
struct stx104_iio *const priv = iio_priv(indio_dev);
|
||||
struct stx104_reg __iomem *const reg = priv->reg;
|
||||
unsigned int adc_config;
|
||||
int adbu;
|
||||
int gain;
|
||||
@@ -79,7 +103,7 @@ static int stx104_read_raw(struct iio_dev *indio_dev,
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_HARDWAREGAIN:
|
||||
/* get gain configuration */
|
||||
adc_config = ioread8(priv->base + 11);
|
||||
adc_config = ioread8(®->acfg);
|
||||
gain = adc_config & 0x3;
|
||||
|
||||
*val = 1 << gain;
|
||||
@@ -91,24 +115,26 @@ static int stx104_read_raw(struct iio_dev *indio_dev,
|
||||
}
|
||||
|
||||
/* select ADC channel */
|
||||
iowrite8(chan->channel | (chan->channel << 4), priv->base + 2);
|
||||
iowrite8(chan->channel | (chan->channel << 4), ®->achan);
|
||||
|
||||
/* trigger ADC sample capture and wait for completion */
|
||||
iowrite8(0, priv->base);
|
||||
while (ioread8(priv->base + 8) & BIT(7));
|
||||
/* trigger ADC sample capture by writing to the 8-bit
|
||||
* Software Strobe Register and wait for completion
|
||||
*/
|
||||
iowrite8(0, ®->ssr_ad);
|
||||
while (ioread8(®->cir_asr) & BIT(7));
|
||||
|
||||
*val = ioread16(priv->base);
|
||||
*val = ioread16(®->ssr_ad);
|
||||
return IIO_VAL_INT;
|
||||
case IIO_CHAN_INFO_OFFSET:
|
||||
/* get ADC bipolar/unipolar configuration */
|
||||
adc_config = ioread8(priv->base + 11);
|
||||
adc_config = ioread8(®->acfg);
|
||||
adbu = !(adc_config & BIT(2));
|
||||
|
||||
*val = -32768 * adbu;
|
||||
return IIO_VAL_INT;
|
||||
case IIO_CHAN_INFO_SCALE:
|
||||
/* get ADC bipolar/unipolar and gain configuration */
|
||||
adc_config = ioread8(priv->base + 11);
|
||||
adc_config = ioread8(®->acfg);
|
||||
adbu = !(adc_config & BIT(2));
|
||||
gain = adc_config & 0x3;
|
||||
|
||||
@@ -130,16 +156,16 @@ static int stx104_write_raw(struct iio_dev *indio_dev,
|
||||
/* Only four gain states (x1, x2, x4, x8) */
|
||||
switch (val) {
|
||||
case 1:
|
||||
iowrite8(0, priv->base + 11);
|
||||
iowrite8(0, &priv->reg->acfg);
|
||||
break;
|
||||
case 2:
|
||||
iowrite8(1, priv->base + 11);
|
||||
iowrite8(1, &priv->reg->acfg);
|
||||
break;
|
||||
case 4:
|
||||
iowrite8(2, priv->base + 11);
|
||||
iowrite8(2, &priv->reg->acfg);
|
||||
break;
|
||||
case 8:
|
||||
iowrite8(3, priv->base + 11);
|
||||
iowrite8(3, &priv->reg->acfg);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
@@ -153,7 +179,7 @@ static int stx104_write_raw(struct iio_dev *indio_dev,
|
||||
return -EINVAL;
|
||||
|
||||
priv->chan_out_states[chan->channel] = val;
|
||||
iowrite16(val, priv->base + 4 + 2 * chan->channel);
|
||||
iowrite16(val, &priv->reg->dac[chan->channel]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -307,15 +333,15 @@ static int stx104_probe(struct device *dev, unsigned int id)
|
||||
}
|
||||
|
||||
priv = iio_priv(indio_dev);
|
||||
priv->base = devm_ioport_map(dev, base[id], STX104_EXTENT);
|
||||
if (!priv->base)
|
||||
priv->reg = devm_ioport_map(dev, base[id], STX104_EXTENT);
|
||||
if (!priv->reg)
|
||||
return -ENOMEM;
|
||||
|
||||
indio_dev->info = &stx104_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
/* determine if differential inputs */
|
||||
if (ioread8(priv->base + 8) & BIT(5)) {
|
||||
if (ioread8(&priv->reg->cir_asr) & BIT(5)) {
|
||||
indio_dev->num_channels = ARRAY_SIZE(stx104_channels_diff);
|
||||
indio_dev->channels = stx104_channels_diff;
|
||||
} else {
|
||||
@@ -326,14 +352,14 @@ static int stx104_probe(struct device *dev, unsigned int id)
|
||||
indio_dev->name = dev_name(dev);
|
||||
|
||||
/* configure device for software trigger operation */
|
||||
iowrite8(0, priv->base + 9);
|
||||
iowrite8(0, &priv->reg->acr);
|
||||
|
||||
/* initialize gain setting to x1 */
|
||||
iowrite8(0, priv->base + 11);
|
||||
iowrite8(0, &priv->reg->acfg);
|
||||
|
||||
/* initialize DAC output to 0V */
|
||||
iowrite16(0, priv->base + 4);
|
||||
iowrite16(0, priv->base + 6);
|
||||
iowrite16(0, &priv->reg->dac[0]);
|
||||
iowrite16(0, &priv->reg->dac[1]);
|
||||
|
||||
stx104gpio->chip.label = dev_name(dev);
|
||||
stx104gpio->chip.parent = dev;
|
||||
@@ -348,7 +374,7 @@ static int stx104_probe(struct device *dev, unsigned int id)
|
||||
stx104gpio->chip.get_multiple = stx104_gpio_get_multiple;
|
||||
stx104gpio->chip.set = stx104_gpio_set;
|
||||
stx104gpio->chip.set_multiple = stx104_gpio_set_multiple;
|
||||
stx104gpio->base = priv->base + 3;
|
||||
stx104gpio->base = &priv->reg->dio;
|
||||
stx104gpio->out_state = 0x0;
|
||||
|
||||
spin_lock_init(&stx104gpio->lock);
|
||||
|
||||
@@ -193,7 +193,7 @@ static int ads124s_reset(struct iio_dev *indio_dev)
|
||||
return 0;
|
||||
};
|
||||
|
||||
static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan)
|
||||
static int ads124s_read(struct iio_dev *indio_dev)
|
||||
{
|
||||
struct ads124s_private *priv = iio_priv(indio_dev);
|
||||
int ret;
|
||||
@@ -242,7 +242,7 @@ static int ads124s_read_raw(struct iio_dev *indio_dev,
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = ads124s_read(indio_dev, chan->channel);
|
||||
ret = ads124s_read(indio_dev);
|
||||
if (ret < 0) {
|
||||
dev_err(&priv->spi->dev, "Read ADC failed\n");
|
||||
goto out;
|
||||
@@ -290,7 +290,7 @@ static irqreturn_t ads124s_trigger_handler(int irq, void *p)
|
||||
if (ret)
|
||||
dev_err(&priv->spi->dev, "Start ADC conversions failed\n");
|
||||
|
||||
priv->buffer[j] = ads124s_read(indio_dev, scan_index);
|
||||
priv->buffer[j] = ads124s_read(indio_dev);
|
||||
ret = ads124s_write_cmd(indio_dev, ADS124S08_STOP_CONV);
|
||||
if (ret)
|
||||
dev_err(&priv->spi->dev, "Stop ADC conversions failed\n");
|
||||
|
||||
@@ -702,7 +702,7 @@ static int tiadc_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused tiadc_suspend(struct device *dev)
|
||||
static int tiadc_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct tiadc_device *adc_dev = iio_priv(indio_dev);
|
||||
@@ -715,7 +715,7 @@ static int __maybe_unused tiadc_suspend(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused tiadc_resume(struct device *dev)
|
||||
static int tiadc_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct tiadc_device *adc_dev = iio_priv(indio_dev);
|
||||
@@ -732,7 +732,7 @@ static int __maybe_unused tiadc_resume(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(tiadc_pm_ops, tiadc_suspend, tiadc_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(tiadc_pm_ops, tiadc_suspend, tiadc_resume);
|
||||
|
||||
static const struct of_device_id ti_adc_dt_ids[] = {
|
||||
{ .compatible = "ti,am3359-adc", },
|
||||
@@ -744,7 +744,7 @@ MODULE_DEVICE_TABLE(of, ti_adc_dt_ids);
|
||||
static struct platform_driver tiadc_driver = {
|
||||
.driver = {
|
||||
.name = "TI-am335x-adc",
|
||||
.pm = &tiadc_pm_ops,
|
||||
.pm = pm_sleep_ptr(&tiadc_pm_ops),
|
||||
.of_match_table = ti_adc_dt_ids,
|
||||
},
|
||||
.probe = tiadc_probe,
|
||||
|
||||
@@ -1421,7 +1421,7 @@ static int ams_probe(struct platform_device *pdev)
|
||||
return devm_iio_device_register(&pdev->dev, indio_dev);
|
||||
}
|
||||
|
||||
static int __maybe_unused ams_suspend(struct device *dev)
|
||||
static int ams_suspend(struct device *dev)
|
||||
{
|
||||
struct ams *ams = iio_priv(dev_get_drvdata(dev));
|
||||
|
||||
@@ -1430,20 +1430,20 @@ static int __maybe_unused ams_suspend(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused ams_resume(struct device *dev)
|
||||
static int ams_resume(struct device *dev)
|
||||
{
|
||||
struct ams *ams = iio_priv(dev_get_drvdata(dev));
|
||||
|
||||
return clk_prepare_enable(ams->clk);
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(ams_pm_ops, ams_suspend, ams_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(ams_pm_ops, ams_suspend, ams_resume);
|
||||
|
||||
static struct platform_driver ams_driver = {
|
||||
.probe = ams_probe,
|
||||
.driver = {
|
||||
.name = "xilinx-ams",
|
||||
.pm = &ams_pm_ops,
|
||||
.pm = pm_sleep_ptr(&ams_pm_ops),
|
||||
.of_match_table = ams_of_match_table,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -107,6 +107,7 @@ int rescale_process_scale(struct rescale *rescale, int scale_type,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(rescale_process_scale, IIO_RESCALE);
|
||||
|
||||
int rescale_process_offset(struct rescale *rescale, int scale_type,
|
||||
int scale, int scale2, int schan_off,
|
||||
@@ -140,6 +141,7 @@ int rescale_process_offset(struct rescale *rescale, int scale_type,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(rescale_process_offset, IIO_RESCALE);
|
||||
|
||||
static int rescale_read_raw(struct iio_dev *indio_dev,
|
||||
struct iio_chan_spec const *chan,
|
||||
|
||||
@@ -551,7 +551,7 @@ static const struct iio_chan_spec scd4x_channels[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static int __maybe_unused scd4x_suspend(struct device *dev)
|
||||
static int scd4x_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct scd4x_state *state = iio_priv(indio_dev);
|
||||
@@ -564,7 +564,7 @@ static int __maybe_unused scd4x_suspend(struct device *dev)
|
||||
return regulator_disable(state->vdd);
|
||||
}
|
||||
|
||||
static int __maybe_unused scd4x_resume(struct device *dev)
|
||||
static int scd4x_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct scd4x_state *state = iio_priv(indio_dev);
|
||||
@@ -577,7 +577,7 @@ static int __maybe_unused scd4x_resume(struct device *dev)
|
||||
return scd4x_send_command(state, CMD_START_MEAS);
|
||||
}
|
||||
|
||||
static __maybe_unused SIMPLE_DEV_PM_OPS(scd4x_pm_ops, scd4x_suspend, scd4x_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(scd4x_pm_ops, scd4x_suspend, scd4x_resume);
|
||||
|
||||
static void scd4x_stop_meas(void *state)
|
||||
{
|
||||
@@ -688,7 +688,7 @@ static struct i2c_driver scd4x_i2c_driver = {
|
||||
.driver = {
|
||||
.name = KBUILD_MODNAME,
|
||||
.of_match_table = scd4x_dt_ids,
|
||||
.pm = &scd4x_pm_ops
|
||||
.pm = pm_sleep_ptr(&scd4x_pm_ops),
|
||||
},
|
||||
.probe = scd4x_probe,
|
||||
};
|
||||
|
||||
@@ -98,7 +98,7 @@ static int cros_ec_lid_angle_probe(struct platform_device *pdev)
|
||||
if (!indio_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = cros_ec_sensors_core_init(pdev, indio_dev, false, NULL, NULL);
|
||||
ret = cros_ec_sensors_core_init(pdev, indio_dev, false, NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -114,7 +114,7 @@ static int cros_ec_lid_angle_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return devm_iio_device_register(dev, indio_dev);
|
||||
return cros_ec_sensors_core_register(dev, indio_dev, NULL);
|
||||
}
|
||||
|
||||
static const struct platform_device_id cros_ec_lid_angle_ids[] = {
|
||||
|
||||
@@ -236,8 +236,7 @@ static int cros_ec_sensors_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = cros_ec_sensors_core_init(pdev, indio_dev, true,
|
||||
cros_ec_sensors_capture,
|
||||
cros_ec_sensors_push_data);
|
||||
cros_ec_sensors_capture);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -298,7 +297,8 @@ static int cros_ec_sensors_probe(struct platform_device *pdev)
|
||||
else
|
||||
state->core.read_ec_sensors_data = cros_ec_sensors_read_cmd;
|
||||
|
||||
return devm_iio_device_register(dev, indio_dev);
|
||||
return cros_ec_sensors_core_register(dev, indio_dev,
|
||||
cros_ec_sensors_push_data);
|
||||
}
|
||||
|
||||
static const struct platform_device_id cros_ec_sensors_ids[] = {
|
||||
|
||||
@@ -228,21 +228,18 @@ static void cros_ec_sensors_core_clean(void *arg)
|
||||
|
||||
/**
|
||||
* cros_ec_sensors_core_init() - basic initialization of the core structure
|
||||
* @pdev: platform device created for the sensors
|
||||
* @pdev: platform device created for the sensor
|
||||
* @indio_dev: iio device structure of the device
|
||||
* @physical_device: true if the device refers to a physical device
|
||||
* @trigger_capture: function pointer to call buffer is triggered,
|
||||
* for backward compatibility.
|
||||
* @push_data: function to call when cros_ec_sensorhub receives
|
||||
* a sample for that sensor.
|
||||
*
|
||||
* Return: 0 on success, -errno on failure.
|
||||
*/
|
||||
int cros_ec_sensors_core_init(struct platform_device *pdev,
|
||||
struct iio_dev *indio_dev,
|
||||
bool physical_device,
|
||||
cros_ec_sensors_capture_t trigger_capture,
|
||||
cros_ec_sensorhub_push_data_cb_t push_data)
|
||||
cros_ec_sensors_capture_t trigger_capture)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct cros_ec_sensors_core_state *state = iio_priv(indio_dev);
|
||||
@@ -340,17 +337,6 @@ int cros_ec_sensors_core_init(struct platform_device *pdev,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = cros_ec_sensorhub_register_push_data(
|
||||
sensor_hub, sensor_platform->sensor_num,
|
||||
indio_dev, push_data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = devm_add_action_or_reset(
|
||||
dev, cros_ec_sensors_core_clean, pdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Timestamp coming from FIFO are in ns since boot. */
|
||||
ret = iio_device_set_clock(indio_dev, CLOCK_BOOTTIME);
|
||||
if (ret)
|
||||
@@ -372,6 +358,46 @@ int cros_ec_sensors_core_init(struct platform_device *pdev,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cros_ec_sensors_core_init);
|
||||
|
||||
/**
|
||||
* cros_ec_sensors_core_register() - Register callback to FIFO and IIO when
|
||||
* sensor is ready.
|
||||
* It must be called at the end of the sensor probe routine.
|
||||
* @dev: device created for the sensor
|
||||
* @indio_dev: iio device structure of the device
|
||||
* @push_data: function to call when cros_ec_sensorhub receives
|
||||
* a sample for that sensor.
|
||||
*
|
||||
* Return: 0 on success, -errno on failure.
|
||||
*/
|
||||
int cros_ec_sensors_core_register(struct device *dev,
|
||||
struct iio_dev *indio_dev,
|
||||
cros_ec_sensorhub_push_data_cb_t push_data)
|
||||
{
|
||||
struct cros_ec_sensor_platform *sensor_platform = dev_get_platdata(dev);
|
||||
struct cros_ec_sensorhub *sensor_hub = dev_get_drvdata(dev->parent);
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct cros_ec_dev *ec = sensor_hub->ec;
|
||||
int ret;
|
||||
|
||||
ret = devm_iio_device_register(dev, indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!push_data ||
|
||||
!cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO))
|
||||
return 0;
|
||||
|
||||
ret = cros_ec_sensorhub_register_push_data(
|
||||
sensor_hub, sensor_platform->sensor_num,
|
||||
indio_dev, push_data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return devm_add_action_or_reset(
|
||||
dev, cros_ec_sensors_core_clean, pdev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cros_ec_sensors_core_register);
|
||||
|
||||
/**
|
||||
* cros_ec_motion_send_host_cmd() - send motion sense host command
|
||||
* @state: pointer to state information for device
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/isa.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#define CIO_DAC_NUM_CHAN 16
|
||||
|
||||
@@ -37,11 +38,11 @@ MODULE_PARM_DESC(base, "Measurement Computing CIO-DAC base addresses");
|
||||
/**
|
||||
* struct cio_dac_iio - IIO device private data structure
|
||||
* @chan_out_states: channels' output states
|
||||
* @base: base port address of the IIO device
|
||||
* @base: base memory address of the DAC device
|
||||
*/
|
||||
struct cio_dac_iio {
|
||||
int chan_out_states[CIO_DAC_NUM_CHAN];
|
||||
void __iomem *base;
|
||||
u16 __iomem *base;
|
||||
};
|
||||
|
||||
static int cio_dac_read_raw(struct iio_dev *indio_dev,
|
||||
@@ -61,7 +62,6 @@ static int cio_dac_write_raw(struct iio_dev *indio_dev,
|
||||
struct iio_chan_spec const *chan, int val, int val2, long mask)
|
||||
{
|
||||
struct cio_dac_iio *const priv = iio_priv(indio_dev);
|
||||
const unsigned int chan_addr_offset = 2 * chan->channel;
|
||||
|
||||
if (mask != IIO_CHAN_INFO_RAW)
|
||||
return -EINVAL;
|
||||
@@ -71,7 +71,7 @@ static int cio_dac_write_raw(struct iio_dev *indio_dev,
|
||||
return -EINVAL;
|
||||
|
||||
priv->chan_out_states[chan->channel] = val;
|
||||
iowrite16(val, priv->base + chan_addr_offset);
|
||||
iowrite16(val, priv->base + chan->channel);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ static int cio_dac_probe(struct device *dev, unsigned int id)
|
||||
indio_dev->name = dev_name(dev);
|
||||
|
||||
/* initialize DAC outputs to 0V */
|
||||
for (i = 0; i < 32; i += 2)
|
||||
for (i = 0; i < CIO_DAC_NUM_CHAN; i++)
|
||||
iowrite16(0, priv->base + i);
|
||||
|
||||
return devm_iio_device_register(dev, indio_dev);
|
||||
|
||||
@@ -171,7 +171,7 @@ static int ds4424_verify_chip(struct iio_dev *indio_dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused ds4424_suspend(struct device *dev)
|
||||
static int ds4424_suspend(struct device *dev)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(client);
|
||||
@@ -189,7 +189,7 @@ static int __maybe_unused ds4424_suspend(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused ds4424_resume(struct device *dev)
|
||||
static int ds4424_resume(struct device *dev)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(client);
|
||||
@@ -206,7 +206,7 @@ static int __maybe_unused ds4424_resume(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(ds4424_pm_ops, ds4424_suspend, ds4424_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(ds4424_pm_ops, ds4424_suspend, ds4424_resume);
|
||||
|
||||
static const struct iio_info ds4424_info = {
|
||||
.read_raw = ds4424_read_raw,
|
||||
@@ -312,7 +312,7 @@ static struct i2c_driver ds4424_driver = {
|
||||
.driver = {
|
||||
.name = "ds4424",
|
||||
.of_match_table = ds4424_of_match,
|
||||
.pm = &ds4424_pm_ops,
|
||||
.pm = pm_sleep_ptr(&ds4424_pm_ops),
|
||||
},
|
||||
.probe = ds4424_probe,
|
||||
.remove = ds4424_remove,
|
||||
|
||||
@@ -137,20 +137,21 @@ static const struct iio_info ltc1660_info = {
|
||||
.write_raw = <c1660_write_raw,
|
||||
};
|
||||
|
||||
static int __maybe_unused ltc1660_suspend(struct device *dev)
|
||||
static int ltc1660_suspend(struct device *dev)
|
||||
{
|
||||
struct ltc1660_priv *priv = iio_priv(spi_get_drvdata(
|
||||
to_spi_device(dev)));
|
||||
return regmap_write(priv->regmap, LTC1660_REG_SLEEP, 0x00);
|
||||
}
|
||||
|
||||
static int __maybe_unused ltc1660_resume(struct device *dev)
|
||||
static int ltc1660_resume(struct device *dev)
|
||||
{
|
||||
struct ltc1660_priv *priv = iio_priv(spi_get_drvdata(
|
||||
to_spi_device(dev)));
|
||||
return regmap_write(priv->regmap, LTC1660_REG_WAKE, 0x00);
|
||||
}
|
||||
static SIMPLE_DEV_PM_OPS(ltc1660_pm_ops, ltc1660_suspend, ltc1660_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(ltc1660_pm_ops, ltc1660_suspend,
|
||||
ltc1660_resume);
|
||||
|
||||
static int ltc1660_probe(struct spi_device *spi)
|
||||
{
|
||||
@@ -233,7 +234,7 @@ static struct spi_driver ltc1660_driver = {
|
||||
.driver = {
|
||||
.name = "ltc1660",
|
||||
.of_match_table = ltc1660_dt_ids,
|
||||
.pm = <c1660_pm_ops,
|
||||
.pm = pm_sleep_ptr(<c1660_pm_ops),
|
||||
},
|
||||
.probe = ltc1660_probe,
|
||||
.remove = ltc1660_remove,
|
||||
|
||||
@@ -100,21 +100,21 @@ static int max517_write_raw(struct iio_dev *indio_dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused max517_suspend(struct device *dev)
|
||||
static int max517_suspend(struct device *dev)
|
||||
{
|
||||
u8 outbuf = COMMAND_PD;
|
||||
|
||||
return i2c_master_send(to_i2c_client(dev), &outbuf, 1);
|
||||
}
|
||||
|
||||
static int __maybe_unused max517_resume(struct device *dev)
|
||||
static int max517_resume(struct device *dev)
|
||||
{
|
||||
u8 outbuf = 0;
|
||||
|
||||
return i2c_master_send(to_i2c_client(dev), &outbuf, 1);
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(max517_pm_ops, max517_suspend, max517_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(max517_pm_ops, max517_suspend, max517_resume);
|
||||
|
||||
static const struct iio_info max517_info = {
|
||||
.read_raw = max517_read_raw,
|
||||
@@ -201,7 +201,7 @@ MODULE_DEVICE_TABLE(i2c, max517_id);
|
||||
static struct i2c_driver max517_driver = {
|
||||
.driver = {
|
||||
.name = MAX517_DRV_NAME,
|
||||
.pm = &max517_pm_ops,
|
||||
.pm = pm_sleep_ptr(&max517_pm_ops),
|
||||
},
|
||||
.probe = max517_probe,
|
||||
.id_table = max517_id,
|
||||
|
||||
@@ -267,7 +267,7 @@ static int max5821_write_raw(struct iio_dev *indio_dev,
|
||||
}
|
||||
}
|
||||
|
||||
static int __maybe_unused max5821_suspend(struct device *dev)
|
||||
static int max5821_suspend(struct device *dev)
|
||||
{
|
||||
u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
|
||||
MAX5821_EXTENDED_DAC_A |
|
||||
@@ -277,7 +277,7 @@ static int __maybe_unused max5821_suspend(struct device *dev)
|
||||
return i2c_master_send(to_i2c_client(dev), outbuf, 2);
|
||||
}
|
||||
|
||||
static int __maybe_unused max5821_resume(struct device *dev)
|
||||
static int max5821_resume(struct device *dev)
|
||||
{
|
||||
u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
|
||||
MAX5821_EXTENDED_DAC_A |
|
||||
@@ -287,7 +287,8 @@ static int __maybe_unused max5821_resume(struct device *dev)
|
||||
return i2c_master_send(to_i2c_client(dev), outbuf, 2);
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend, max5821_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend,
|
||||
max5821_resume);
|
||||
|
||||
static const struct iio_info max5821_info = {
|
||||
.read_raw = max5821_read_raw,
|
||||
@@ -374,7 +375,7 @@ static struct i2c_driver max5821_driver = {
|
||||
.driver = {
|
||||
.name = "max5821",
|
||||
.of_match_table = max5821_of_match,
|
||||
.pm = &max5821_pm_ops,
|
||||
.pm = pm_sleep_ptr(&max5821_pm_ops),
|
||||
},
|
||||
.probe = max5821_probe,
|
||||
.id_table = max5821_id,
|
||||
|
||||
@@ -42,7 +42,7 @@ struct mcp4725_data {
|
||||
struct regulator *vref_reg;
|
||||
};
|
||||
|
||||
static int __maybe_unused mcp4725_suspend(struct device *dev)
|
||||
static int mcp4725_suspend(struct device *dev)
|
||||
{
|
||||
struct mcp4725_data *data = iio_priv(i2c_get_clientdata(
|
||||
to_i2c_client(dev)));
|
||||
@@ -55,7 +55,7 @@ static int __maybe_unused mcp4725_suspend(struct device *dev)
|
||||
return i2c_master_send(data->client, outbuf, 2);
|
||||
}
|
||||
|
||||
static int __maybe_unused mcp4725_resume(struct device *dev)
|
||||
static int mcp4725_resume(struct device *dev)
|
||||
{
|
||||
struct mcp4725_data *data = iio_priv(i2c_get_clientdata(
|
||||
to_i2c_client(dev)));
|
||||
@@ -68,7 +68,8 @@ static int __maybe_unused mcp4725_resume(struct device *dev)
|
||||
|
||||
return i2c_master_send(data->client, outbuf, 2);
|
||||
}
|
||||
static SIMPLE_DEV_PM_OPS(mcp4725_pm_ops, mcp4725_suspend, mcp4725_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(mcp4725_pm_ops, mcp4725_suspend,
|
||||
mcp4725_resume);
|
||||
|
||||
static ssize_t mcp4725_store_eeprom(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t len)
|
||||
@@ -523,7 +524,7 @@ static struct i2c_driver mcp4725_driver = {
|
||||
.driver = {
|
||||
.name = MCP4725_DRV_NAME,
|
||||
.of_match_table = mcp4725_of_match,
|
||||
.pm = &mcp4725_pm_ops,
|
||||
.pm = pm_sleep_ptr(&mcp4725_pm_ops),
|
||||
},
|
||||
.probe = mcp4725_probe,
|
||||
.remove = mcp4725_remove,
|
||||
|
||||
@@ -364,7 +364,7 @@ static int itg3200_remove(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused itg3200_suspend(struct device *dev)
|
||||
static int itg3200_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct itg3200 *st = iio_priv(indio_dev);
|
||||
@@ -375,14 +375,15 @@ static int __maybe_unused itg3200_suspend(struct device *dev)
|
||||
ITG3200_SLEEP);
|
||||
}
|
||||
|
||||
static int __maybe_unused itg3200_resume(struct device *dev)
|
||||
static int itg3200_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
|
||||
return itg3200_initial_setup(indio_dev);
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(itg3200_pm_ops, itg3200_suspend, itg3200_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(itg3200_pm_ops, itg3200_suspend,
|
||||
itg3200_resume);
|
||||
|
||||
static const struct i2c_device_id itg3200_id[] = {
|
||||
{ "itg3200", 0 },
|
||||
@@ -400,7 +401,7 @@ static struct i2c_driver itg3200_driver = {
|
||||
.driver = {
|
||||
.name = "itg3200",
|
||||
.of_match_table = itg3200_of_match,
|
||||
.pm = &itg3200_pm_ops,
|
||||
.pm = pm_sleep_ptr(&itg3200_pm_ops),
|
||||
},
|
||||
.id_table = itg3200_id,
|
||||
.probe = itg3200_probe,
|
||||
|
||||
@@ -408,7 +408,7 @@ static const struct of_device_id afe4403_of_match[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, afe4403_of_match);
|
||||
|
||||
static int __maybe_unused afe4403_suspend(struct device *dev)
|
||||
static int afe4403_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev));
|
||||
struct afe4403_data *afe = iio_priv(indio_dev);
|
||||
@@ -429,7 +429,7 @@ static int __maybe_unused afe4403_suspend(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused afe4403_resume(struct device *dev)
|
||||
static int afe4403_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev));
|
||||
struct afe4403_data *afe = iio_priv(indio_dev);
|
||||
@@ -449,7 +449,8 @@ static int __maybe_unused afe4403_resume(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(afe4403_pm_ops, afe4403_suspend, afe4403_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(afe4403_pm_ops, afe4403_suspend,
|
||||
afe4403_resume);
|
||||
|
||||
static int afe4403_probe(struct spi_device *spi)
|
||||
{
|
||||
@@ -598,7 +599,7 @@ static struct spi_driver afe4403_spi_driver = {
|
||||
.driver = {
|
||||
.name = AFE4403_DRIVER_NAME,
|
||||
.of_match_table = afe4403_of_match,
|
||||
.pm = &afe4403_pm_ops,
|
||||
.pm = pm_sleep_ptr(&afe4403_pm_ops),
|
||||
},
|
||||
.probe = afe4403_probe,
|
||||
.remove = afe4403_remove,
|
||||
|
||||
@@ -415,7 +415,7 @@ static const struct of_device_id afe4404_of_match[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, afe4404_of_match);
|
||||
|
||||
static int __maybe_unused afe4404_suspend(struct device *dev)
|
||||
static int afe4404_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
struct afe4404_data *afe = iio_priv(indio_dev);
|
||||
@@ -436,7 +436,7 @@ static int __maybe_unused afe4404_suspend(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused afe4404_resume(struct device *dev)
|
||||
static int afe4404_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
struct afe4404_data *afe = iio_priv(indio_dev);
|
||||
@@ -456,7 +456,8 @@ static int __maybe_unused afe4404_resume(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(afe4404_pm_ops, afe4404_suspend, afe4404_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(afe4404_pm_ops, afe4404_suspend,
|
||||
afe4404_resume);
|
||||
|
||||
static int afe4404_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
@@ -607,7 +608,7 @@ static struct i2c_driver afe4404_i2c_driver = {
|
||||
.driver = {
|
||||
.name = AFE4404_DRIVER_NAME,
|
||||
.of_match_table = afe4404_of_match,
|
||||
.pm = &afe4404_pm_ops,
|
||||
.pm = pm_sleep_ptr(&afe4404_pm_ops),
|
||||
},
|
||||
.probe = afe4404_probe,
|
||||
.remove = afe4404_remove,
|
||||
|
||||
@@ -812,7 +812,23 @@ static ssize_t iio_format_avail_list(char *buf, const int *vals,
|
||||
|
||||
static ssize_t iio_format_avail_range(char *buf, const int *vals, int type)
|
||||
{
|
||||
return iio_format_list(buf, vals, type, 3, "[", "]");
|
||||
int length;
|
||||
|
||||
/*
|
||||
* length refers to the array size , not the number of elements.
|
||||
* The purpose is to print the range [min , step ,max] so length should
|
||||
* be 3 in case of int, and 6 for other types.
|
||||
*/
|
||||
switch (type) {
|
||||
case IIO_VAL_INT:
|
||||
length = 3;
|
||||
break;
|
||||
default:
|
||||
length = 6;
|
||||
break;
|
||||
}
|
||||
|
||||
return iio_format_list(buf, vals, type, length, "[", "]");
|
||||
}
|
||||
|
||||
static ssize_t iio_read_channel_info_avail(struct device *dev,
|
||||
|
||||
@@ -63,13 +63,10 @@ ATTRIBUTE_GROUPS(iio_trig_dev);
|
||||
|
||||
static struct iio_trigger *__iio_trigger_find_by_name(const char *name);
|
||||
|
||||
int __iio_trigger_register(struct iio_trigger *trig_info,
|
||||
struct module *this_mod)
|
||||
int iio_trigger_register(struct iio_trigger *trig_info)
|
||||
{
|
||||
int ret;
|
||||
|
||||
trig_info->owner = this_mod;
|
||||
|
||||
trig_info->id = ida_alloc(&iio_trigger_ida, GFP_KERNEL);
|
||||
if (trig_info->id < 0)
|
||||
return trig_info->id;
|
||||
@@ -100,7 +97,7 @@ error_unregister_id:
|
||||
ida_free(&iio_trigger_ida, trig_info->id);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(__iio_trigger_register);
|
||||
EXPORT_SYMBOL(iio_trigger_register);
|
||||
|
||||
void iio_trigger_unregister(struct iio_trigger *trig_info)
|
||||
{
|
||||
@@ -367,8 +364,8 @@ struct iio_poll_func
|
||||
va_list vargs;
|
||||
struct iio_poll_func *pf;
|
||||
|
||||
pf = kmalloc(sizeof *pf, GFP_KERNEL);
|
||||
if (pf == NULL)
|
||||
pf = kmalloc(sizeof(*pf), GFP_KERNEL);
|
||||
if (!pf)
|
||||
return NULL;
|
||||
va_start(vargs, fmt);
|
||||
pf->name = kvasprintf(GFP_KERNEL, fmt, vargs);
|
||||
@@ -547,15 +544,16 @@ static void iio_trig_subirqunmask(struct irq_data *d)
|
||||
trig->subirqs[d->irq - trig->subirq_base].enabled = true;
|
||||
}
|
||||
|
||||
static __printf(2, 0)
|
||||
static __printf(3, 0)
|
||||
struct iio_trigger *viio_trigger_alloc(struct device *parent,
|
||||
struct module *this_mod,
|
||||
const char *fmt,
|
||||
va_list vargs)
|
||||
{
|
||||
struct iio_trigger *trig;
|
||||
int i;
|
||||
|
||||
trig = kzalloc(sizeof *trig, GFP_KERNEL);
|
||||
trig = kzalloc(sizeof(*trig), GFP_KERNEL);
|
||||
if (!trig)
|
||||
return NULL;
|
||||
|
||||
@@ -578,6 +576,8 @@ struct iio_trigger *viio_trigger_alloc(struct device *parent,
|
||||
|
||||
INIT_LIST_HEAD(&trig->list);
|
||||
|
||||
trig->owner = this_mod;
|
||||
|
||||
trig->subirq_chip.name = trig->name;
|
||||
trig->subirq_chip.irq_mask = &iio_trig_subirqmask;
|
||||
trig->subirq_chip.irq_unmask = &iio_trig_subirqunmask;
|
||||
@@ -598,8 +598,9 @@ free_trig:
|
||||
}
|
||||
|
||||
/**
|
||||
* iio_trigger_alloc - Allocate a trigger
|
||||
* __iio_trigger_alloc - Allocate a trigger
|
||||
* @parent: Device to allocate iio_trigger for
|
||||
* @this_mod: module allocating the trigger
|
||||
* @fmt: trigger name format. If it includes format
|
||||
* specifiers, the additional arguments following
|
||||
* format are formatted and inserted in the resulting
|
||||
@@ -607,18 +608,20 @@ free_trig:
|
||||
* RETURNS:
|
||||
* Pointer to allocated iio_trigger on success, NULL on failure.
|
||||
*/
|
||||
struct iio_trigger *iio_trigger_alloc(struct device *parent, const char *fmt, ...)
|
||||
struct iio_trigger *__iio_trigger_alloc(struct device *parent,
|
||||
struct module *this_mod,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
struct iio_trigger *trig;
|
||||
va_list vargs;
|
||||
|
||||
va_start(vargs, fmt);
|
||||
trig = viio_trigger_alloc(parent, fmt, vargs);
|
||||
trig = viio_trigger_alloc(parent, this_mod, fmt, vargs);
|
||||
va_end(vargs);
|
||||
|
||||
return trig;
|
||||
}
|
||||
EXPORT_SYMBOL(iio_trigger_alloc);
|
||||
EXPORT_SYMBOL(__iio_trigger_alloc);
|
||||
|
||||
void iio_trigger_free(struct iio_trigger *trig)
|
||||
{
|
||||
@@ -633,10 +636,11 @@ static void devm_iio_trigger_release(struct device *dev, void *res)
|
||||
}
|
||||
|
||||
/**
|
||||
* devm_iio_trigger_alloc - Resource-managed iio_trigger_alloc()
|
||||
* __devm_iio_trigger_alloc - Resource-managed iio_trigger_alloc()
|
||||
* Managed iio_trigger_alloc. iio_trigger allocated with this function is
|
||||
* automatically freed on driver detach.
|
||||
* @parent: Device to allocate iio_trigger for
|
||||
* @this_mod: module allocating the trigger
|
||||
* @fmt: trigger name format. If it includes format
|
||||
* specifiers, the additional arguments following
|
||||
* format are formatted and inserted in the resulting
|
||||
@@ -646,7 +650,9 @@ static void devm_iio_trigger_release(struct device *dev, void *res)
|
||||
* RETURNS:
|
||||
* Pointer to allocated iio_trigger on success, NULL on failure.
|
||||
*/
|
||||
struct iio_trigger *devm_iio_trigger_alloc(struct device *parent, const char *fmt, ...)
|
||||
struct iio_trigger *__devm_iio_trigger_alloc(struct device *parent,
|
||||
struct module *this_mod,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
struct iio_trigger **ptr, *trig;
|
||||
va_list vargs;
|
||||
@@ -658,7 +664,7 @@ struct iio_trigger *devm_iio_trigger_alloc(struct device *parent, const char *fm
|
||||
|
||||
/* use raw alloc_dr for kmalloc caller tracing */
|
||||
va_start(vargs, fmt);
|
||||
trig = viio_trigger_alloc(parent, fmt, vargs);
|
||||
trig = viio_trigger_alloc(parent, this_mod, fmt, vargs);
|
||||
va_end(vargs);
|
||||
if (trig) {
|
||||
*ptr = trig;
|
||||
@@ -669,7 +675,7 @@ struct iio_trigger *devm_iio_trigger_alloc(struct device *parent, const char *fm
|
||||
|
||||
return trig;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_iio_trigger_alloc);
|
||||
EXPORT_SYMBOL_GPL(__devm_iio_trigger_alloc);
|
||||
|
||||
static void devm_iio_trigger_unreg(void *trigger_info)
|
||||
{
|
||||
@@ -677,10 +683,9 @@ static void devm_iio_trigger_unreg(void *trigger_info)
|
||||
}
|
||||
|
||||
/**
|
||||
* __devm_iio_trigger_register - Resource-managed iio_trigger_register()
|
||||
* devm_iio_trigger_register - Resource-managed iio_trigger_register()
|
||||
* @dev: device this trigger was allocated for
|
||||
* @trig_info: trigger to register
|
||||
* @this_mod: module registering the trigger
|
||||
*
|
||||
* Managed iio_trigger_register(). The IIO trigger registered with this
|
||||
* function is automatically unregistered on driver detach. This function
|
||||
@@ -690,19 +695,18 @@ static void devm_iio_trigger_unreg(void *trigger_info)
|
||||
* RETURNS:
|
||||
* 0 on success, negative error number on failure.
|
||||
*/
|
||||
int __devm_iio_trigger_register(struct device *dev,
|
||||
struct iio_trigger *trig_info,
|
||||
struct module *this_mod)
|
||||
int devm_iio_trigger_register(struct device *dev,
|
||||
struct iio_trigger *trig_info)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = __iio_trigger_register(trig_info, this_mod);
|
||||
ret = iio_trigger_register(trig_info);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return devm_add_action_or_reset(dev, devm_iio_trigger_unreg, trig_info);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__devm_iio_trigger_register);
|
||||
EXPORT_SYMBOL_GPL(devm_iio_trigger_register);
|
||||
|
||||
bool iio_trigger_using_own(struct iio_dev *indio_dev)
|
||||
{
|
||||
|
||||
@@ -200,17 +200,17 @@ static int al3010_probe(struct i2c_client *client,
|
||||
return devm_iio_device_register(&client->dev, indio_dev);
|
||||
}
|
||||
|
||||
static int __maybe_unused al3010_suspend(struct device *dev)
|
||||
static int al3010_suspend(struct device *dev)
|
||||
{
|
||||
return al3010_set_pwr(to_i2c_client(dev), false);
|
||||
}
|
||||
|
||||
static int __maybe_unused al3010_resume(struct device *dev)
|
||||
static int al3010_resume(struct device *dev)
|
||||
{
|
||||
return al3010_set_pwr(to_i2c_client(dev), true);
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume);
|
||||
|
||||
static const struct i2c_device_id al3010_id[] = {
|
||||
{"al3010", },
|
||||
@@ -228,7 +228,7 @@ static struct i2c_driver al3010_driver = {
|
||||
.driver = {
|
||||
.name = AL3010_DRV_NAME,
|
||||
.of_match_table = al3010_of_match,
|
||||
.pm = &al3010_pm_ops,
|
||||
.pm = pm_sleep_ptr(&al3010_pm_ops),
|
||||
},
|
||||
.probe = al3010_probe,
|
||||
.id_table = al3010_id,
|
||||
|
||||
@@ -223,17 +223,18 @@ static int al3320a_probe(struct i2c_client *client,
|
||||
return devm_iio_device_register(&client->dev, indio_dev);
|
||||
}
|
||||
|
||||
static int __maybe_unused al3320a_suspend(struct device *dev)
|
||||
static int al3320a_suspend(struct device *dev)
|
||||
{
|
||||
return al3320a_set_pwr(to_i2c_client(dev), false);
|
||||
}
|
||||
|
||||
static int __maybe_unused al3320a_resume(struct device *dev)
|
||||
static int al3320a_resume(struct device *dev)
|
||||
{
|
||||
return al3320a_set_pwr(to_i2c_client(dev), true);
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(al3320a_pm_ops, al3320a_suspend, al3320a_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(al3320a_pm_ops, al3320a_suspend,
|
||||
al3320a_resume);
|
||||
|
||||
static const struct i2c_device_id al3320a_id[] = {
|
||||
{"al3320a", 0},
|
||||
@@ -251,7 +252,7 @@ static struct i2c_driver al3320a_driver = {
|
||||
.driver = {
|
||||
.name = AL3320A_DRV_NAME,
|
||||
.of_match_table = al3320a_of_match,
|
||||
.pm = &al3320a_pm_ops,
|
||||
.pm = pm_sleep_ptr(&al3320a_pm_ops),
|
||||
},
|
||||
.probe = al3320a_probe,
|
||||
.id_table = al3320a_id,
|
||||
|
||||
@@ -755,21 +755,22 @@ static int as73211_probe(struct i2c_client *client)
|
||||
return devm_iio_device_register(dev, indio_dev);
|
||||
}
|
||||
|
||||
static int __maybe_unused as73211_suspend(struct device *dev)
|
||||
static int as73211_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
|
||||
return as73211_power(indio_dev, false);
|
||||
}
|
||||
|
||||
static int __maybe_unused as73211_resume(struct device *dev)
|
||||
static int as73211_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
|
||||
return as73211_power(indio_dev, true);
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(as73211_pm_ops, as73211_suspend, as73211_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(as73211_pm_ops, as73211_suspend,
|
||||
as73211_resume);
|
||||
|
||||
static const struct of_device_id as73211_of_match[] = {
|
||||
{ .compatible = "ams,as73211" },
|
||||
@@ -787,7 +788,7 @@ static struct i2c_driver as73211_driver = {
|
||||
.driver = {
|
||||
.name = AS73211_DRV_NAME,
|
||||
.of_match_table = as73211_of_match,
|
||||
.pm = &as73211_pm_ops,
|
||||
.pm = pm_sleep_ptr(&as73211_pm_ops),
|
||||
},
|
||||
.probe_new = as73211_probe,
|
||||
.id_table = as73211_id,
|
||||
|
||||
@@ -277,7 +277,7 @@ static int bh1750_remove(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused bh1750_suspend(struct device *dev)
|
||||
static int bh1750_suspend(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
struct bh1750_data *data =
|
||||
@@ -294,7 +294,7 @@ static int __maybe_unused bh1750_suspend(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(bh1750_pm_ops, bh1750_suspend, NULL);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(bh1750_pm_ops, bh1750_suspend, NULL);
|
||||
|
||||
static const struct i2c_device_id bh1750_id[] = {
|
||||
{ "bh1710", BH1710 },
|
||||
@@ -320,7 +320,7 @@ static struct i2c_driver bh1750_driver = {
|
||||
.driver = {
|
||||
.name = "bh1750",
|
||||
.of_match_table = bh1750_of_match,
|
||||
.pm = &bh1750_pm_ops,
|
||||
.pm = pm_sleep_ptr(&bh1750_pm_ops),
|
||||
},
|
||||
.probe = bh1750_probe,
|
||||
.remove = bh1750_remove,
|
||||
|
||||
@@ -278,7 +278,7 @@ static int cm3605_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused cm3605_pm_suspend(struct device *dev)
|
||||
static int cm3605_pm_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct cm3605 *cm3605 = iio_priv(indio_dev);
|
||||
@@ -289,7 +289,7 @@ static int __maybe_unused cm3605_pm_suspend(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused cm3605_pm_resume(struct device *dev)
|
||||
static int cm3605_pm_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct cm3605 *cm3605 = iio_priv(indio_dev);
|
||||
@@ -302,11 +302,8 @@ static int __maybe_unused cm3605_pm_resume(struct device *dev)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops cm3605_dev_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(cm3605_pm_suspend,
|
||||
cm3605_pm_resume)
|
||||
};
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(cm3605_dev_pm_ops, cm3605_pm_suspend,
|
||||
cm3605_pm_resume);
|
||||
|
||||
static const struct of_device_id cm3605_of_match[] = {
|
||||
{.compatible = "capella,cm3605"},
|
||||
@@ -318,7 +315,7 @@ static struct platform_driver cm3605_driver = {
|
||||
.driver = {
|
||||
.name = "cm3605",
|
||||
.of_match_table = cm3605_of_match,
|
||||
.pm = &cm3605_dev_pm_ops,
|
||||
.pm = pm_sleep_ptr(&cm3605_dev_pm_ops),
|
||||
},
|
||||
.probe = cm3605_probe,
|
||||
.remove = cm3605_remove,
|
||||
|
||||
@@ -182,8 +182,7 @@ static int cros_ec_light_prox_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = cros_ec_sensors_core_init(pdev, indio_dev, true,
|
||||
cros_ec_sensors_capture,
|
||||
cros_ec_sensors_push_data);
|
||||
cros_ec_sensors_capture);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -239,7 +238,8 @@ static int cros_ec_light_prox_probe(struct platform_device *pdev)
|
||||
|
||||
state->core.read_ec_sensors_data = cros_ec_sensors_read_cmd;
|
||||
|
||||
return devm_iio_device_register(dev, indio_dev);
|
||||
return cros_ec_sensors_core_register(dev, indio_dev,
|
||||
cros_ec_sensors_push_data);
|
||||
}
|
||||
|
||||
static const struct platform_device_id cros_ec_light_prox_ids[] = {
|
||||
|
||||
@@ -635,7 +635,7 @@ static int gp2ap002_remove(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused gp2ap002_runtime_suspend(struct device *dev)
|
||||
static int gp2ap002_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct gp2ap002 *gp2ap002 = iio_priv(indio_dev);
|
||||
@@ -660,7 +660,7 @@ static int __maybe_unused gp2ap002_runtime_suspend(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused gp2ap002_runtime_resume(struct device *dev)
|
||||
static int gp2ap002_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct gp2ap002 *gp2ap002 = iio_priv(indio_dev);
|
||||
@@ -691,12 +691,8 @@ static int __maybe_unused gp2ap002_runtime_resume(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops gp2ap002_dev_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
|
||||
pm_runtime_force_resume)
|
||||
SET_RUNTIME_PM_OPS(gp2ap002_runtime_suspend,
|
||||
gp2ap002_runtime_resume, NULL)
|
||||
};
|
||||
static DEFINE_RUNTIME_DEV_PM_OPS(gp2ap002_dev_pm_ops, gp2ap002_runtime_suspend,
|
||||
gp2ap002_runtime_resume, NULL);
|
||||
|
||||
static const struct i2c_device_id gp2ap002_id_table[] = {
|
||||
{ "gp2ap002", 0 },
|
||||
@@ -715,7 +711,7 @@ static struct i2c_driver gp2ap002_driver = {
|
||||
.driver = {
|
||||
.name = "gp2ap002",
|
||||
.of_match_table = gp2ap002_of_match,
|
||||
.pm = &gp2ap002_dev_pm_ops,
|
||||
.pm = pm_ptr(&gp2ap002_dev_pm_ops),
|
||||
},
|
||||
.probe = gp2ap002_probe,
|
||||
.remove = gp2ap002_remove,
|
||||
|
||||
@@ -625,7 +625,7 @@ static int isl29028_probe(struct i2c_client *client,
|
||||
ISL29028_POWER_OFF_DELAY_MS);
|
||||
pm_runtime_use_autosuspend(&client->dev);
|
||||
|
||||
ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev);
|
||||
ret = iio_device_register(indio_dev);
|
||||
if (ret < 0) {
|
||||
dev_err(&client->dev,
|
||||
"%s(): iio registration failed with error %d\n",
|
||||
@@ -651,7 +651,7 @@ static int isl29028_remove(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused isl29028_suspend(struct device *dev)
|
||||
static int isl29028_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
struct isl29028_chip *chip = iio_priv(indio_dev);
|
||||
@@ -666,7 +666,7 @@ static int __maybe_unused isl29028_suspend(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused isl29028_resume(struct device *dev)
|
||||
static int isl29028_resume(struct device *dev)
|
||||
{
|
||||
/**
|
||||
* The specific component (ALS/IR or proximity) will enable itself as
|
||||
@@ -676,11 +676,8 @@ static int __maybe_unused isl29028_resume(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops isl29028_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
|
||||
pm_runtime_force_resume)
|
||||
SET_RUNTIME_PM_OPS(isl29028_suspend, isl29028_resume, NULL)
|
||||
};
|
||||
static DEFINE_RUNTIME_DEV_PM_OPS(isl29028_pm_ops, isl29028_suspend,
|
||||
isl29028_resume, NULL);
|
||||
|
||||
static const struct i2c_device_id isl29028_id[] = {
|
||||
{"isl29028", 0},
|
||||
@@ -700,7 +697,7 @@ MODULE_DEVICE_TABLE(of, isl29028_of_match);
|
||||
static struct i2c_driver isl29028_driver = {
|
||||
.driver = {
|
||||
.name = "isl29028",
|
||||
.pm = &isl29028_pm_ops,
|
||||
.pm = pm_ptr(&isl29028_pm_ops),
|
||||
.of_match_table = isl29028_of_match,
|
||||
},
|
||||
.probe = isl29028_probe,
|
||||
|
||||
@@ -888,7 +888,7 @@ static int tsl2583_remove(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused tsl2583_suspend(struct device *dev)
|
||||
static int tsl2583_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
struct tsl2583_chip *chip = iio_priv(indio_dev);
|
||||
@@ -903,7 +903,7 @@ static int __maybe_unused tsl2583_suspend(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused tsl2583_resume(struct device *dev)
|
||||
static int tsl2583_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
struct tsl2583_chip *chip = iio_priv(indio_dev);
|
||||
@@ -918,11 +918,8 @@ static int __maybe_unused tsl2583_resume(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops tsl2583_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
|
||||
pm_runtime_force_resume)
|
||||
SET_RUNTIME_PM_OPS(tsl2583_suspend, tsl2583_resume, NULL)
|
||||
};
|
||||
static DEFINE_RUNTIME_DEV_PM_OPS(tsl2583_pm_ops, tsl2583_suspend,
|
||||
tsl2583_resume, NULL);
|
||||
|
||||
static const struct i2c_device_id tsl2583_idtable[] = {
|
||||
{ "tsl2580", 0 },
|
||||
@@ -944,7 +941,7 @@ MODULE_DEVICE_TABLE(of, tsl2583_of_match);
|
||||
static struct i2c_driver tsl2583_driver = {
|
||||
.driver = {
|
||||
.name = "tsl2583",
|
||||
.pm = &tsl2583_pm_ops,
|
||||
.pm = pm_ptr(&tsl2583_pm_ops),
|
||||
.of_match_table = tsl2583_of_match,
|
||||
},
|
||||
.id_table = tsl2583_idtable,
|
||||
|
||||
@@ -1019,7 +1019,7 @@ static const struct iio_info tsl2591_info_no_irq = {
|
||||
.read_avail = tsl2591_read_available,
|
||||
};
|
||||
|
||||
static int __maybe_unused tsl2591_suspend(struct device *dev)
|
||||
static int tsl2591_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct tsl2591_chip *chip = iio_priv(indio_dev);
|
||||
@@ -1032,7 +1032,7 @@ static int __maybe_unused tsl2591_suspend(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused tsl2591_resume(struct device *dev)
|
||||
static int tsl2591_resume(struct device *dev)
|
||||
{
|
||||
int power_state = TSL2591_PWR_ON | TSL2591_ENABLE_ALS;
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
@@ -1049,10 +1049,8 @@ static int __maybe_unused tsl2591_resume(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops tsl2591_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
|
||||
SET_RUNTIME_PM_OPS(tsl2591_suspend, tsl2591_resume, NULL)
|
||||
};
|
||||
static DEFINE_RUNTIME_DEV_PM_OPS(tsl2591_pm_ops, tsl2591_suspend,
|
||||
tsl2591_resume, NULL);
|
||||
|
||||
static irqreturn_t tsl2591_event_handler(int irq, void *private)
|
||||
{
|
||||
@@ -1213,7 +1211,7 @@ MODULE_DEVICE_TABLE(of, tsl2591_of_match);
|
||||
static struct i2c_driver tsl2591_driver = {
|
||||
.driver = {
|
||||
.name = "tsl2591",
|
||||
.pm = &tsl2591_pm_ops,
|
||||
.pm = pm_ptr(&tsl2591_pm_ops),
|
||||
.of_match_table = tsl2591_of_match,
|
||||
},
|
||||
.probe_new = tsl2591_probe
|
||||
|
||||
@@ -922,7 +922,6 @@ static int us5182d_remove(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM)
|
||||
static int us5182d_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
@@ -945,11 +944,10 @@ static int us5182d_resume(struct device *dev)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct dev_pm_ops us5182d_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume)
|
||||
SET_RUNTIME_PM_OPS(us5182d_suspend, us5182d_resume, NULL)
|
||||
SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume)
|
||||
RUNTIME_PM_OPS(us5182d_suspend, us5182d_resume, NULL)
|
||||
};
|
||||
|
||||
static const struct acpi_device_id us5182d_acpi_match[] = {
|
||||
@@ -975,7 +973,7 @@ MODULE_DEVICE_TABLE(of, us5182d_of_match);
|
||||
static struct i2c_driver us5182d_driver = {
|
||||
.driver = {
|
||||
.name = US5182D_DRV_NAME,
|
||||
.pm = &us5182d_pm_ops,
|
||||
.pm = pm_ptr(&us5182d_pm_ops),
|
||||
.of_match_table = us5182d_of_match,
|
||||
.acpi_match_table = ACPI_PTR(us5182d_acpi_match),
|
||||
},
|
||||
|
||||
@@ -1130,7 +1130,7 @@ static int vcnl4000_remove(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused vcnl4000_runtime_suspend(struct device *dev)
|
||||
static int vcnl4000_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
struct vcnl4000_data *data = iio_priv(indio_dev);
|
||||
@@ -1138,7 +1138,7 @@ static int __maybe_unused vcnl4000_runtime_suspend(struct device *dev)
|
||||
return data->chip_spec->set_power_state(data, false);
|
||||
}
|
||||
|
||||
static int __maybe_unused vcnl4000_runtime_resume(struct device *dev)
|
||||
static int vcnl4000_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
struct vcnl4000_data *data = iio_priv(indio_dev);
|
||||
@@ -1146,17 +1146,13 @@ static int __maybe_unused vcnl4000_runtime_resume(struct device *dev)
|
||||
return data->chip_spec->set_power_state(data, true);
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops vcnl4000_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
|
||||
pm_runtime_force_resume)
|
||||
SET_RUNTIME_PM_OPS(vcnl4000_runtime_suspend,
|
||||
vcnl4000_runtime_resume, NULL)
|
||||
};
|
||||
static DEFINE_RUNTIME_DEV_PM_OPS(vcnl4000_pm_ops, vcnl4000_runtime_suspend,
|
||||
vcnl4000_runtime_resume, NULL);
|
||||
|
||||
static struct i2c_driver vcnl4000_driver = {
|
||||
.driver = {
|
||||
.name = VCNL4000_DRV_NAME,
|
||||
.pm = &vcnl4000_pm_ops,
|
||||
.pm = pm_ptr(&vcnl4000_pm_ops),
|
||||
.of_match_table = vcnl_4000_of_match,
|
||||
},
|
||||
.probe = vcnl4000_probe,
|
||||
|
||||
@@ -620,7 +620,7 @@ static int vcnl4035_remove(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused vcnl4035_runtime_suspend(struct device *dev)
|
||||
static int vcnl4035_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
struct vcnl4035_data *data = iio_priv(indio_dev);
|
||||
@@ -632,7 +632,7 @@ static int __maybe_unused vcnl4035_runtime_suspend(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused vcnl4035_runtime_resume(struct device *dev)
|
||||
static int vcnl4035_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
struct vcnl4035_data *data = iio_priv(indio_dev);
|
||||
@@ -649,12 +649,8 @@ static int __maybe_unused vcnl4035_runtime_resume(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops vcnl4035_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
|
||||
pm_runtime_force_resume)
|
||||
SET_RUNTIME_PM_OPS(vcnl4035_runtime_suspend,
|
||||
vcnl4035_runtime_resume, NULL)
|
||||
};
|
||||
static DEFINE_RUNTIME_DEV_PM_OPS(vcnl4035_pm_ops, vcnl4035_runtime_suspend,
|
||||
vcnl4035_runtime_resume, NULL);
|
||||
|
||||
static const struct i2c_device_id vcnl4035_id[] = {
|
||||
{ "vcnl4035", 0 },
|
||||
@@ -671,7 +667,7 @@ MODULE_DEVICE_TABLE(of, vcnl4035_of_match);
|
||||
static struct i2c_driver vcnl4035_driver = {
|
||||
.driver = {
|
||||
.name = VCNL4035_DRV_NAME,
|
||||
.pm = &vcnl4035_pm_ops,
|
||||
.pm = pm_ptr(&vcnl4035_pm_ops),
|
||||
.of_match_table = vcnl4035_of_match,
|
||||
},
|
||||
.probe = vcnl4035_probe,
|
||||
|
||||
@@ -846,7 +846,7 @@ static int veml6030_probe(struct i2c_client *client,
|
||||
return devm_iio_device_register(&client->dev, indio_dev);
|
||||
}
|
||||
|
||||
static int __maybe_unused veml6030_runtime_suspend(struct device *dev)
|
||||
static int veml6030_runtime_suspend(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
@@ -859,7 +859,7 @@ static int __maybe_unused veml6030_runtime_suspend(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused veml6030_runtime_resume(struct device *dev)
|
||||
static int veml6030_runtime_resume(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||
@@ -872,12 +872,8 @@ static int __maybe_unused veml6030_runtime_resume(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops veml6030_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
|
||||
pm_runtime_force_resume)
|
||||
SET_RUNTIME_PM_OPS(veml6030_runtime_suspend,
|
||||
veml6030_runtime_resume, NULL)
|
||||
};
|
||||
static DEFINE_RUNTIME_DEV_PM_OPS(veml6030_pm_ops, veml6030_runtime_suspend,
|
||||
veml6030_runtime_resume, NULL);
|
||||
|
||||
static const struct of_device_id veml6030_of_match[] = {
|
||||
{ .compatible = "vishay,veml6030" },
|
||||
@@ -895,7 +891,7 @@ static struct i2c_driver veml6030_driver = {
|
||||
.driver = {
|
||||
.name = "veml6030",
|
||||
.of_match_table = veml6030_of_match,
|
||||
.pm = &veml6030_pm_ops,
|
||||
.pm = pm_ptr(&veml6030_pm_ops),
|
||||
},
|
||||
.probe = veml6030_probe,
|
||||
.id_table = veml6030_id,
|
||||
|
||||
@@ -985,7 +985,7 @@ static int ak8974_remove(struct i2c_client *i2c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused ak8974_runtime_suspend(struct device *dev)
|
||||
static int ak8974_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct ak8974 *ak8974 =
|
||||
iio_priv(i2c_get_clientdata(to_i2c_client(dev)));
|
||||
@@ -996,7 +996,7 @@ static int __maybe_unused ak8974_runtime_suspend(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused ak8974_runtime_resume(struct device *dev)
|
||||
static int ak8974_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct ak8974 *ak8974 =
|
||||
iio_priv(i2c_get_clientdata(to_i2c_client(dev)));
|
||||
@@ -1024,12 +1024,8 @@ out_regulator_disable:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops ak8974_dev_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
|
||||
pm_runtime_force_resume)
|
||||
SET_RUNTIME_PM_OPS(ak8974_runtime_suspend,
|
||||
ak8974_runtime_resume, NULL)
|
||||
};
|
||||
static DEFINE_RUNTIME_DEV_PM_OPS(ak8974_dev_pm_ops, ak8974_runtime_suspend,
|
||||
ak8974_runtime_resume, NULL);
|
||||
|
||||
static const struct i2c_device_id ak8974_id[] = {
|
||||
{"ami305", 0 },
|
||||
@@ -1050,7 +1046,7 @@ MODULE_DEVICE_TABLE(of, ak8974_of_match);
|
||||
static struct i2c_driver ak8974_driver = {
|
||||
.driver = {
|
||||
.name = "ak8974",
|
||||
.pm = &ak8974_dev_pm_ops,
|
||||
.pm = pm_ptr(&ak8974_dev_pm_ops),
|
||||
.of_match_table = ak8974_of_match,
|
||||
},
|
||||
.probe = ak8974_probe,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Device driver for the the HMC5843 multi-chip module designed
|
||||
* Device driver for the HMC5843 multi-chip module designed
|
||||
* for low field magnetic sensing.
|
||||
*
|
||||
* Copyright (C) 2010 Texas Instruments
|
||||
|
||||
@@ -544,7 +544,7 @@ int rm3100_common_probe(struct device *dev, struct regmap *regmap, int irq)
|
||||
indio_dev->info = &rm3100_info;
|
||||
indio_dev->channels = rm3100_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(rm3100_channels);
|
||||
indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_TRIGGERED;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
if (!irq)
|
||||
data->use_interrupt = false;
|
||||
|
||||
@@ -965,7 +965,7 @@ static int yas5xx_remove(struct i2c_client *i2c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused yas5xx_runtime_suspend(struct device *dev)
|
||||
static int yas5xx_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct yas5xx *yas5xx = iio_priv(indio_dev);
|
||||
@@ -976,7 +976,7 @@ static int __maybe_unused yas5xx_runtime_suspend(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused yas5xx_runtime_resume(struct device *dev)
|
||||
static int yas5xx_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct yas5xx *yas5xx = iio_priv(indio_dev);
|
||||
@@ -1011,12 +1011,8 @@ out_reset:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops yas5xx_dev_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
|
||||
pm_runtime_force_resume)
|
||||
SET_RUNTIME_PM_OPS(yas5xx_runtime_suspend,
|
||||
yas5xx_runtime_resume, NULL)
|
||||
};
|
||||
static DEFINE_RUNTIME_DEV_PM_OPS(yas5xx_dev_pm_ops, yas5xx_runtime_suspend,
|
||||
yas5xx_runtime_resume, NULL);
|
||||
|
||||
static const struct i2c_device_id yas5xx_id[] = {
|
||||
{"yas530", },
|
||||
@@ -1038,7 +1034,7 @@ static struct i2c_driver yas5xx_driver = {
|
||||
.driver = {
|
||||
.name = "yas5xx",
|
||||
.of_match_table = yas5xx_of_match,
|
||||
.pm = &yas5xx_dev_pm_ops,
|
||||
.pm = pm_ptr(&yas5xx_dev_pm_ops),
|
||||
},
|
||||
.probe = yas5xx_probe,
|
||||
.remove = yas5xx_remove,
|
||||
|
||||
@@ -139,8 +139,7 @@ static int cros_ec_baro_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = cros_ec_sensors_core_init(pdev, indio_dev, true,
|
||||
cros_ec_sensors_capture,
|
||||
cros_ec_sensors_push_data);
|
||||
cros_ec_sensors_capture);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -185,7 +184,8 @@ static int cros_ec_baro_probe(struct platform_device *pdev)
|
||||
|
||||
state->core.read_ec_sensors_data = cros_ec_sensors_read_cmd;
|
||||
|
||||
return devm_iio_device_register(dev, indio_dev);
|
||||
return cros_ec_sensors_core_register(dev, indio_dev,
|
||||
cros_ec_sensors_push_data);
|
||||
}
|
||||
|
||||
static const struct platform_device_id cros_ec_baro_ids[] = {
|
||||
|
||||
@@ -184,7 +184,7 @@ static const struct iio_info cros_ec_mkbp_proximity_info = {
|
||||
.write_event_config = cros_ec_mkbp_proximity_write_event_config,
|
||||
};
|
||||
|
||||
static __maybe_unused int cros_ec_mkbp_proximity_resume(struct device *dev)
|
||||
static int cros_ec_mkbp_proximity_resume(struct device *dev)
|
||||
{
|
||||
struct cros_ec_mkbp_proximity_data *data = dev_get_drvdata(dev);
|
||||
struct cros_ec_device *ec = data->ec;
|
||||
@@ -201,8 +201,8 @@ static __maybe_unused int cros_ec_mkbp_proximity_resume(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(cros_ec_mkbp_proximity_pm_ops, NULL,
|
||||
cros_ec_mkbp_proximity_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(cros_ec_mkbp_proximity_pm_ops, NULL,
|
||||
cros_ec_mkbp_proximity_resume);
|
||||
|
||||
static int cros_ec_mkbp_proximity_probe(struct platform_device *pdev)
|
||||
{
|
||||
@@ -260,7 +260,7 @@ static struct platform_driver cros_ec_mkbp_proximity_driver = {
|
||||
.driver = {
|
||||
.name = "cros-ec-mkbp-proximity",
|
||||
.of_match_table = cros_ec_mkbp_proximity_of_match,
|
||||
.pm = &cros_ec_mkbp_proximity_pm_ops,
|
||||
.pm = pm_sleep_ptr(&cros_ec_mkbp_proximity_pm_ops),
|
||||
},
|
||||
.probe = cros_ec_mkbp_proximity_probe,
|
||||
.remove = cros_ec_mkbp_proximity_remove,
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
* Common part of most Semtech SAR sensor.
|
||||
*/
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
#include <linux/delay.h>
|
||||
@@ -434,7 +433,7 @@ static void sx_common_regulator_disable(void *_data)
|
||||
|
||||
#define SX_COMMON_SOFT_RESET 0xde
|
||||
|
||||
static int sx_common_init_device(struct iio_dev *indio_dev)
|
||||
static int sx_common_init_device(struct device *dev, struct iio_dev *indio_dev)
|
||||
{
|
||||
struct sx_common_data *data = iio_priv(indio_dev);
|
||||
struct sx_common_reg_default tmp;
|
||||
@@ -456,8 +455,7 @@ static int sx_common_init_device(struct iio_dev *indio_dev)
|
||||
|
||||
/* Program defaults from constant or BIOS. */
|
||||
for (i = 0; i < data->chip_info->num_default_regs; i++) {
|
||||
initval = data->chip_info->ops.get_default_reg(&indio_dev->dev,
|
||||
i, &tmp);
|
||||
initval = data->chip_info->ops.get_default_reg(dev, i, &tmp);
|
||||
ret = regmap_write(data->regmap, initval->reg, initval->def);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -520,8 +518,6 @@ int sx_common_probe(struct i2c_client *client,
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "error reading WHOAMI\n");
|
||||
|
||||
ACPI_COMPANION_SET(&indio_dev->dev, ACPI_COMPANION(dev));
|
||||
indio_dev->dev.of_node = client->dev.of_node;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
indio_dev->channels = data->chip_info->iio_channels;
|
||||
@@ -530,7 +526,7 @@ int sx_common_probe(struct i2c_client *client,
|
||||
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
|
||||
ret = sx_common_init_device(indio_dev);
|
||||
ret = sx_common_init_device(dev, indio_dev);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Unable to initialize sensor\n");
|
||||
|
||||
|
||||
@@ -1534,7 +1534,7 @@ static int ltc2983_probe(struct spi_device *spi)
|
||||
return devm_iio_device_register(&spi->dev, indio_dev);
|
||||
}
|
||||
|
||||
static int __maybe_unused ltc2983_resume(struct device *dev)
|
||||
static int ltc2983_resume(struct device *dev)
|
||||
{
|
||||
struct ltc2983_data *st = spi_get_drvdata(to_spi_device(dev));
|
||||
int dummy;
|
||||
@@ -1545,14 +1545,15 @@ static int __maybe_unused ltc2983_resume(struct device *dev)
|
||||
return ltc2983_setup(st, false);
|
||||
}
|
||||
|
||||
static int __maybe_unused ltc2983_suspend(struct device *dev)
|
||||
static int ltc2983_suspend(struct device *dev)
|
||||
{
|
||||
struct ltc2983_data *st = spi_get_drvdata(to_spi_device(dev));
|
||||
|
||||
return regmap_write(st->regmap, LTC2983_STATUS_REG, LTC2983_SLEEP);
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(ltc2983_pm_ops, ltc2983_suspend, ltc2983_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(ltc2983_pm_ops, ltc2983_suspend,
|
||||
ltc2983_resume);
|
||||
|
||||
static const struct spi_device_id ltc2983_id_table[] = {
|
||||
{ "ltc2983" },
|
||||
@@ -1570,7 +1571,7 @@ static struct spi_driver ltc2983_driver = {
|
||||
.driver = {
|
||||
.name = "ltc2983",
|
||||
.of_match_table = ltc2983_of_match,
|
||||
.pm = <c2983_pm_ops,
|
||||
.pm = pm_sleep_ptr(<c2983_pm_ops),
|
||||
},
|
||||
.probe = ltc2983_probe,
|
||||
.id_table = ltc2983_id_table,
|
||||
|
||||
@@ -5,15 +5,25 @@
|
||||
|
||||
# Keep in alphabetical order
|
||||
config IIO_RESCALE_KUNIT_TEST
|
||||
bool "Test IIO rescale conversion functions"
|
||||
depends on KUNIT=y && IIO_RESCALE=y
|
||||
tristate "Test IIO rescale conversion functions" if !KUNIT_ALL_TESTS
|
||||
depends on KUNIT && IIO_RESCALE
|
||||
default KUNIT_ALL_TESTS
|
||||
help
|
||||
If you want to run tests on the iio-rescale code say Y here.
|
||||
Build unit tests for the iio-rescale code.
|
||||
|
||||
This takes advantage of ARCH=um to run tests and should be used by
|
||||
developers to tests their changes to the rescaling logic.
|
||||
For more information on KUnit and unit tests in general, please refer
|
||||
to the KUnit documentation in Documentation/dev-tools/kunit/.
|
||||
|
||||
config IIO_TEST_FORMAT
|
||||
bool "Test IIO formatting functions"
|
||||
depends on KUNIT=y
|
||||
If unsure, say N.
|
||||
|
||||
config IIO_FORMAT_KUNIT_TEST
|
||||
tristate "Test IIO formatting functions" if !KUNIT_ALL_TESTS
|
||||
depends on KUNIT
|
||||
default KUNIT_ALL_TESTS
|
||||
help
|
||||
build unit tests for the IIO formatting functions.
|
||||
|
||||
For more information on KUnit and unit tests in general, please refer
|
||||
to the KUnit documentation in Documentation/dev-tools/kunit/.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
|
||||
# Keep in alphabetical order
|
||||
obj-$(CONFIG_IIO_RESCALE_KUNIT_TEST) += iio-test-rescale.o
|
||||
obj-$(CONFIG_IIO_TEST_FORMAT) += iio-test-format.o
|
||||
obj-$(CONFIG_IIO_FORMAT_KUNIT_TEST) += iio-test-format.o
|
||||
CFLAGS_iio-test-format.o += $(DISABLE_STRUCTLEAK_PLUGIN)
|
||||
|
||||
@@ -265,3 +265,7 @@ static struct kunit_suite iio_format_test_suite = {
|
||||
.test_cases = iio_format_test_cases,
|
||||
};
|
||||
kunit_test_suite(iio_format_test_suite);
|
||||
|
||||
MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
|
||||
MODULE_DESCRIPTION("Test IIO formatting functions");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
||||
@@ -708,3 +708,8 @@ static struct kunit_suite iio_rescale_test_suite = {
|
||||
.test_cases = iio_rescale_test_cases,
|
||||
};
|
||||
kunit_test_suite(iio_rescale_test_suite);
|
||||
|
||||
MODULE_AUTHOR("Liam Beguin <liambeguin@gmail.com>");
|
||||
MODULE_DESCRIPTION("Test IIO rescale conversion functions");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_IMPORT_NS(IIO_RESCALE);
|
||||
|
||||
@@ -93,8 +93,11 @@ int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev, unsigned long scan_mask,
|
||||
struct platform_device;
|
||||
int cros_ec_sensors_core_init(struct platform_device *pdev,
|
||||
struct iio_dev *indio_dev, bool physical_device,
|
||||
cros_ec_sensors_capture_t trigger_capture,
|
||||
cros_ec_sensorhub_push_data_cb_t push_data);
|
||||
cros_ec_sensors_capture_t trigger_capture);
|
||||
|
||||
int cros_ec_sensors_core_register(struct device *dev,
|
||||
struct iio_dev *indio_dev,
|
||||
cros_ec_sensorhub_push_data_cb_t push_data);
|
||||
|
||||
irqreturn_t cros_ec_sensors_capture(int irq, void *p);
|
||||
int cros_ec_sensors_push_data(struct iio_dev *indio_dev,
|
||||
|
||||
@@ -727,10 +727,13 @@ static inline void *iio_priv(const struct iio_dev *indio_dev)
|
||||
|
||||
void iio_device_free(struct iio_dev *indio_dev);
|
||||
struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv);
|
||||
__printf(2, 3)
|
||||
struct iio_trigger *devm_iio_trigger_alloc(struct device *parent,
|
||||
const char *fmt, ...);
|
||||
|
||||
#define devm_iio_trigger_alloc(parent, fmt, ...) \
|
||||
__devm_iio_trigger_alloc((parent), THIS_MODULE, (fmt), ##__VA_ARGS__)
|
||||
__printf(3, 4)
|
||||
struct iio_trigger *__devm_iio_trigger_alloc(struct device *parent,
|
||||
struct module *this_mod,
|
||||
const char *fmt, ...);
|
||||
/**
|
||||
* iio_get_debugfs_dentry() - helper function to get the debugfs_dentry
|
||||
* @indio_dev: IIO device structure for device
|
||||
|
||||
+10
-11
@@ -131,16 +131,10 @@ static inline void *iio_trigger_get_drvdata(struct iio_trigger *trig)
|
||||
* iio_trigger_register() - register a trigger with the IIO core
|
||||
* @trig_info: trigger to be registered
|
||||
**/
|
||||
#define iio_trigger_register(trig_info) \
|
||||
__iio_trigger_register((trig_info), THIS_MODULE)
|
||||
int __iio_trigger_register(struct iio_trigger *trig_info,
|
||||
struct module *this_mod);
|
||||
int iio_trigger_register(struct iio_trigger *trig_info);
|
||||
|
||||
#define devm_iio_trigger_register(dev, trig_info) \
|
||||
__devm_iio_trigger_register((dev), (trig_info), THIS_MODULE)
|
||||
int __devm_iio_trigger_register(struct device *dev,
|
||||
struct iio_trigger *trig_info,
|
||||
struct module *this_mod);
|
||||
int devm_iio_trigger_register(struct device *dev,
|
||||
struct iio_trigger *trig_info);
|
||||
|
||||
/**
|
||||
* iio_trigger_unregister() - unregister a trigger from the core
|
||||
@@ -168,8 +162,13 @@ void iio_trigger_poll_chained(struct iio_trigger *trig);
|
||||
|
||||
irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
|
||||
|
||||
__printf(2, 3)
|
||||
struct iio_trigger *iio_trigger_alloc(struct device *parent, const char *fmt, ...);
|
||||
#define iio_trigger_alloc(parent, fmt, ...) \
|
||||
__iio_trigger_alloc((parent), THIS_MODULE, (fmt), ##__VA_ARGS__)
|
||||
|
||||
__printf(3, 4)
|
||||
struct iio_trigger *__iio_trigger_alloc(struct device *parent,
|
||||
struct module *this_mod,
|
||||
const char *fmt, ...);
|
||||
void iio_trigger_free(struct iio_trigger *trig);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user