diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-10-15 09:46:23 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-10-15 09:46:23 -0700 |
commit | ade7afe3e606f9f6ff0e6deefce140157f75540b (patch) | |
tree | 14be1cde214ed46179c23c007cbdc2e98bc2a381 /drivers/iio/dac/ti-dac5571.c | |
parent | 3e4fb4346c781068610d03c12b16c0cfb0fd24a3 (diff) | |
parent | e1f13c879a7c21bd207dc6242455e8e3a1e88b40 (diff) | |
download | linux-ade7afe3e606f9f6ff0e6deefce140157f75540b.tar.bz2 |
Merge tag 'staging-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging / IIO driver updates from Greg KH:
"Here is the large set of staging and IIO driver updates for 5.10-rc1.
Included in here are:
- new IIO drivers
- new IIO driver frameworks
- various IIO driver fixes and updates
- IIO device tree conversions to yaml
- so many minor staging driver coding style cleanups
- most cdev driver moved out of staging
- no staging drivers added or removed
Full details are in the shortlog.
All of these have been in linux-next for a while with no reported
issues"
* tag 'staging-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (476 commits)
staging: comedi: check validity of wMaxPacketSize of usb endpoints found
staging: wfx: improve robustness of wfx_get_hw_rate()
staging: wfx: drop unicode characters from strings
staging: wfx: gpiod_get_value() can return an error
staging: wfx: increase robustness of hif_generic_confirm()
staging: wfx: wfx_init_common() returns NULL on error
staging: wfx: standardize the error when vif does not exist
staging: wfx: check memory allocation
staging: wfx: improve error handling of hif_join()
staging: dpaa2-switch: add a dpaa2_switch prefix to all functions in ethsw.c
staging: dpaa2-switch: add a dpaa2_switch_ prefix to all functions in ethsw-ethtool.c
staging: rtl8188eu: Fix long lines
dt-bindings: staging: wfx: silabs,wfx yaml conversion
staging: wfx: update copyrights dates
staging: wfx: fix QoS priority for slow buses
staging: wfx: fix BA sessions for older firmwares
staging: wfx: remove remaining code of 'secure link' feature
staging: wfx: fix handling of MMIC error
staging: vchiq: Fix list_for_each exit tests
staging: greybus: use __force when assigning __u8 value to snd_ctl_elem_type_t
...
Diffstat (limited to 'drivers/iio/dac/ti-dac5571.c')
-rw-r--r-- | drivers/iio/dac/ti-dac5571.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/drivers/iio/dac/ti-dac5571.c b/drivers/iio/dac/ti-dac5571.c index 00fc7db8eb65..d3295767a079 100644 --- a/drivers/iio/dac/ti-dac5571.c +++ b/drivers/iio/dac/ti-dac5571.c @@ -18,8 +18,7 @@ #include <linux/iio/iio.h> #include <linux/i2c.h> #include <linux/module.h> -#include <linux/of_device.h> -#include <linux/of.h> +#include <linux/mod_devicetable.h> #include <linux/regulator/consumer.h> enum chip_id { @@ -47,8 +46,8 @@ struct dac5571_data { struct mutex lock; struct regulator *vref; u16 val[4]; - bool powerdown; - u8 powerdown_mode; + bool powerdown[4]; + u8 powerdown_mode[4]; struct dac5571_spec const *spec; int (*dac5571_cmd)(struct dac5571_data *data, int channel, u16 val); int (*dac5571_pwrdwn)(struct dac5571_data *data, int channel, u8 pwrdwn); @@ -125,7 +124,7 @@ static int dac5571_get_powerdown_mode(struct iio_dev *indio_dev, { struct dac5571_data *data = iio_priv(indio_dev); - return data->powerdown_mode; + return data->powerdown_mode[chan->channel]; } static int dac5571_set_powerdown_mode(struct iio_dev *indio_dev, @@ -135,17 +134,17 @@ static int dac5571_set_powerdown_mode(struct iio_dev *indio_dev, struct dac5571_data *data = iio_priv(indio_dev); int ret = 0; - if (data->powerdown_mode == mode) + if (data->powerdown_mode[chan->channel] == mode) return 0; mutex_lock(&data->lock); - if (data->powerdown) { + if (data->powerdown[chan->channel]) { ret = data->dac5571_pwrdwn(data, chan->channel, DAC5571_POWERDOWN(mode)); if (ret) goto out; } - data->powerdown_mode = mode; + data->powerdown_mode[chan->channel] = mode; out: mutex_unlock(&data->lock); @@ -167,7 +166,7 @@ static ssize_t dac5571_read_powerdown(struct iio_dev *indio_dev, { struct dac5571_data *data = iio_priv(indio_dev); - return sprintf(buf, "%d\n", data->powerdown); + return sprintf(buf, "%d\n", data->powerdown[chan->channel]); } static ssize_t dac5571_write_powerdown(struct iio_dev *indio_dev, @@ -183,19 +182,20 @@ static ssize_t dac5571_write_powerdown(struct iio_dev *indio_dev, if (ret) return ret; - if (data->powerdown == powerdown) + if (data->powerdown[chan->channel] == powerdown) return len; mutex_lock(&data->lock); if (powerdown) ret = data->dac5571_pwrdwn(data, chan->channel, - DAC5571_POWERDOWN(data->powerdown_mode)); + DAC5571_POWERDOWN(data->powerdown_mode[chan->channel])); else - ret = data->dac5571_cmd(data, chan->channel, data->val[0]); + ret = data->dac5571_cmd(data, chan->channel, + data->val[chan->channel]); if (ret) goto out; - data->powerdown = powerdown; + data->powerdown[chan->channel] = powerdown; out: mutex_unlock(&data->lock); @@ -209,9 +209,9 @@ static const struct iio_chan_spec_ext_info dac5571_ext_info[] = { .name = "powerdown", .read = dac5571_read_powerdown, .write = dac5571_write_powerdown, - .shared = IIO_SHARED_BY_TYPE, + .shared = IIO_SEPARATE, }, - IIO_ENUM("powerdown_mode", IIO_SHARED_BY_TYPE, &dac5571_powerdown_mode), + IIO_ENUM("powerdown_mode", IIO_SEPARATE, &dac5571_powerdown_mode), IIO_ENUM_AVAILABLE("powerdown_mode", &dac5571_powerdown_mode), {}, }; @@ -276,7 +276,7 @@ static int dac5571_write_raw(struct iio_dev *indio_dev, if (val >= (1 << data->spec->resolution) || val < 0) return -EINVAL; - if (data->powerdown) + if (data->powerdown[chan->channel]) return -EBUSY; mutex_lock(&data->lock); @@ -383,7 +383,6 @@ static int dac5571_remove(struct i2c_client *i2c) return 0; } -#ifdef CONFIG_OF static const struct of_device_id dac5571_of_id[] = { {.compatible = "ti,dac5571"}, {.compatible = "ti,dac6571"}, @@ -397,7 +396,6 @@ static const struct of_device_id dac5571_of_id[] = { {} }; MODULE_DEVICE_TABLE(of, dac5571_of_id); -#endif static const struct i2c_device_id dac5571_id[] = { {"dac5571", single_8bit}, @@ -416,7 +414,7 @@ MODULE_DEVICE_TABLE(i2c, dac5571_id); static struct i2c_driver dac5571_driver = { .driver = { .name = "ti-dac5571", - .of_match_table = of_match_ptr(dac5571_of_id), + .of_match_table = dac5571_of_id, }, .probe = dac5571_probe, .remove = dac5571_remove, |