Commit 70dddeee authored by Octavian Purdila's avatar Octavian Purdila Committed by Jonathan Cameron

iio: fix drivers that check buffer->scan_mask

If the in-kernel push interface is used we may have a different masks
on the device buffer and the kernel buffer and in this case the device
should generate data for the reunion of the buffers, which is
available at indio_dev->active_scan_mask.

Compiled tested only except for bmc150-accel which was tested at
runtime with the hardware.
Signed-off-by: default avatarOctavian Purdila <octavian.purdila@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent abe46b89
...@@ -659,7 +659,7 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p) ...@@ -659,7 +659,7 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)
mutex_lock(&data->mutex); mutex_lock(&data->mutex);
for_each_set_bit(bit, indio_dev->buffer->scan_mask, for_each_set_bit(bit, indio_dev->active_scan_mask,
indio_dev->masklength) { indio_dev->masklength) {
ret = bma180_get_data_reg(data, bit); ret = bma180_get_data_reg(data, bit);
if (ret < 0) { if (ret < 0) {
......
...@@ -986,7 +986,7 @@ static irqreturn_t bmc150_accel_trigger_handler(int irq, void *p) ...@@ -986,7 +986,7 @@ static irqreturn_t bmc150_accel_trigger_handler(int irq, void *p)
int bit, ret, i = 0; int bit, ret, i = 0;
mutex_lock(&data->mutex); mutex_lock(&data->mutex);
for_each_set_bit(bit, indio_dev->buffer->scan_mask, for_each_set_bit(bit, indio_dev->active_scan_mask,
indio_dev->masklength) { indio_dev->masklength) {
ret = i2c_smbus_read_word_data(data->client, ret = i2c_smbus_read_word_data(data->client,
BMC150_ACCEL_AXIS_TO_REG(bit)); BMC150_ACCEL_AXIS_TO_REG(bit));
......
...@@ -956,7 +956,7 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p) ...@@ -956,7 +956,7 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p)
mutex_lock(&data->mutex); mutex_lock(&data->mutex);
for_each_set_bit(bit, indio_dev->buffer->scan_mask, for_each_set_bit(bit, indio_dev->active_scan_mask,
indio_dev->masklength) { indio_dev->masklength) {
ret = kxcjk1013_get_acc_reg(data, bit); ret = kxcjk1013_get_acc_reg(data, bit);
if (ret < 0) { if (ret < 0) {
......
...@@ -544,7 +544,6 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) ...@@ -544,7 +544,6 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
{ {
struct iio_dev *idev = iio_trigger_get_drvdata(trig); struct iio_dev *idev = iio_trigger_get_drvdata(trig);
struct at91_adc_state *st = iio_priv(idev); struct at91_adc_state *st = iio_priv(idev);
struct iio_buffer *buffer = idev->buffer;
struct at91_adc_reg_desc *reg = st->registers; struct at91_adc_reg_desc *reg = st->registers;
u32 status = at91_adc_readl(st, reg->trigger_register); u32 status = at91_adc_readl(st, reg->trigger_register);
int value; int value;
...@@ -564,7 +563,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) ...@@ -564,7 +563,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
at91_adc_writel(st, reg->trigger_register, at91_adc_writel(st, reg->trigger_register,
status | value); status | value);
for_each_set_bit(bit, buffer->scan_mask, for_each_set_bit(bit, idev->active_scan_mask,
st->num_channels) { st->num_channels) {
struct iio_chan_spec const *chan = idev->channels + bit; struct iio_chan_spec const *chan = idev->channels + bit;
at91_adc_writel(st, AT91_ADC_CHER, at91_adc_writel(st, AT91_ADC_CHER,
...@@ -579,7 +578,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) ...@@ -579,7 +578,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
at91_adc_writel(st, reg->trigger_register, at91_adc_writel(st, reg->trigger_register,
status & ~value); status & ~value);
for_each_set_bit(bit, buffer->scan_mask, for_each_set_bit(bit, idev->active_scan_mask,
st->num_channels) { st->num_channels) {
struct iio_chan_spec const *chan = idev->channels + bit; struct iio_chan_spec const *chan = idev->channels + bit;
at91_adc_writel(st, AT91_ADC_CHDR, at91_adc_writel(st, AT91_ADC_CHDR,
......
...@@ -188,12 +188,11 @@ static int tiadc_buffer_preenable(struct iio_dev *indio_dev) ...@@ -188,12 +188,11 @@ static int tiadc_buffer_preenable(struct iio_dev *indio_dev)
static int tiadc_buffer_postenable(struct iio_dev *indio_dev) static int tiadc_buffer_postenable(struct iio_dev *indio_dev)
{ {
struct tiadc_device *adc_dev = iio_priv(indio_dev); struct tiadc_device *adc_dev = iio_priv(indio_dev);
struct iio_buffer *buffer = indio_dev->buffer;
unsigned int enb = 0; unsigned int enb = 0;
u8 bit; u8 bit;
tiadc_step_config(indio_dev); tiadc_step_config(indio_dev);
for_each_set_bit(bit, buffer->scan_mask, adc_dev->channels) for_each_set_bit(bit, indio_dev->active_scan_mask, adc_dev->channels)
enb |= (get_adc_step_bit(adc_dev, bit) << 1); enb |= (get_adc_step_bit(adc_dev, bit) << 1);
adc_dev->buffer_en_ch_steps = enb; adc_dev->buffer_en_ch_steps = enb;
......
...@@ -822,7 +822,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p) ...@@ -822,7 +822,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)
int bit, ret, i = 0; int bit, ret, i = 0;
mutex_lock(&data->mutex); mutex_lock(&data->mutex);
for_each_set_bit(bit, indio_dev->buffer->scan_mask, for_each_set_bit(bit, indio_dev->active_scan_mask,
indio_dev->masklength) { indio_dev->masklength) {
ret = i2c_smbus_read_word_data(data->client, ret = i2c_smbus_read_word_data(data->client,
BMG160_AXIS_TO_REG(bit)); BMG160_AXIS_TO_REG(bit));
......
...@@ -1227,7 +1227,7 @@ static irqreturn_t kmx61_trigger_handler(int irq, void *p) ...@@ -1227,7 +1227,7 @@ static irqreturn_t kmx61_trigger_handler(int irq, void *p)
base = KMX61_MAG_XOUT_L; base = KMX61_MAG_XOUT_L;
mutex_lock(&data->lock); mutex_lock(&data->lock);
for_each_set_bit(bit, indio_dev->buffer->scan_mask, for_each_set_bit(bit, indio_dev->active_scan_mask,
indio_dev->masklength) { indio_dev->masklength) {
ret = kmx61_read_measurement(data, base, bit); ret = kmx61_read_measurement(data, base, bit);
if (ret < 0) { if (ret < 0) {
......
...@@ -494,7 +494,7 @@ static irqreturn_t sx9500_trigger_handler(int irq, void *private) ...@@ -494,7 +494,7 @@ static irqreturn_t sx9500_trigger_handler(int irq, void *private)
mutex_lock(&data->mutex); mutex_lock(&data->mutex);
for_each_set_bit(bit, indio_dev->buffer->scan_mask, for_each_set_bit(bit, indio_dev->active_scan_mask,
indio_dev->masklength) { indio_dev->masklength) {
ret = sx9500_read_proximity(data, &indio_dev->channels[bit], ret = sx9500_read_proximity(data, &indio_dev->channels[bit],
&val); &val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment