1st set of IIO fixes for the 6.10 cycle.

The usual mixed bag of old and new driver bugs plus one core issue that
 highlighted we have some documentation issues that we need to fix
 as a follow up action.
 
 core in kernel interface
 - Wrong return value documentation didn't help with an error in
   a cleanup. Result is that thermal is failing to read the temperature.
 
 adi,ad3552r
 - Fix DT binding output range sign error.
 adi,ad5592r
 - Wrong scaling on temperature channel.
 adi,ad7173
 - Driver assumed all supported devices had input buffers. Make sure not to
   enable them on the ad7176-2 which doesn't.
 - Add some missing device names for recently added models.
 - Drop an unneeded zero index on the single temperature channel.
 - Clear buffered capture specific control bit when returning to on
   demand sampling which otherwise no longer works.
 - Make sampling frequency per channel rather than just setting it for the
   first channel.
 adi,ad9467
 - Capital S for sign of channel whereas ABI is lowercase.
 bosch,bmi323
 - Make sure to release the trigger even on error paths in the trigger
   handler as otherwise there is no path to recover.
 bosch,bmp280
 - Avoid an overflow in calculating the temperature.
 invensense,timestamp helper
 - Fix case where ODR is being switched to the existing ODR an update that
   never finishes.
 - Fix an issue with the timestamp being updated whilst still handling
   previous interrupt (icm42600 and mpu6050)
 invensense,icm42600
 - Don't update the watermark parameters twice.
 melexis,mlx90635
 - Fix variable returned as error code.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmZeHp8RHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FogknBAAnVx5ADxlraen76Vt0lVLHCeWIZULTxPQ
 4g/TQdUx80ybIBeM1D+SD2YNknnfK1cT8kYiNmQtoyuCRxoAJyuMRrydv4YRVCkm
 e1eldY9mMbrXv1D5MCIzsMDAkvc93VOAgdEu7n/fwmWZjdQU9pLKrI6Wf3mNC46D
 2TULGfxS+Uli4NVwrZnC0BkznUGfvpVf5elzJvmG+WaFIDD8+UManM3ms6f7wrNQ
 22wi8FqB1pacVuZ+NI4NF48M9SRZPcu0oOHFOMHE3+baG0vmZwqrdK0faIoFn83T
 vuyM+oaSJo9JWocDpHvT0jjoXffnJ+Ickx/3UOp+l/VJBBQ1NYdgLO2NnVX2E0JM
 zpLPHHSeoiVarw7GwnY/GrsG8ZkQDaUzUgyYfG9o0ZB+qkY79ntpJAsJfvyjBNmo
 5OPYbZC6ZjpYG9LC/XXcBjHhRro2mY1OCY+/NMC9ACGlzf2fx5SU5pvG9lFL9kYI
 tu7wuAQ/7hWA7ztvo9qwGLfjWQwS57Ils/6Cpc+qS+ugdRp4p0Bfj9diRvumThuM
 YIpodYcaQeiC9EtCxm+51nHKOHtYR21Jy78G7rJJGmM2yaVA4wuUeaTAKE56Lv/I
 HJr3fAUPNFJM65ZRsbI5kxBq9xhc17zun7Z3mwVZaJYFDNrW6yVGzjNZPNbOFjCs
 G40ICIu8ERs=
 =FGo4
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-6.10a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-linus

Jonathan writes:

1st set of IIO fixes for the 6.10 cycle.

The usual mixed bag of old and new driver bugs plus one core issue that
highlighted we have some documentation issues that we need to fix
as a follow up action.

core in kernel interface
- Wrong return value documentation didn't help with an error in
  a cleanup. Result is that thermal is failing to read the temperature.

adi,ad3552r
- Fix DT binding output range sign error.
adi,ad5592r
- Wrong scaling on temperature channel.
adi,ad7173
- Driver assumed all supported devices had input buffers. Make sure not to
  enable them on the ad7176-2 which doesn't.
- Add some missing device names for recently added models.
- Drop an unneeded zero index on the single temperature channel.
- Clear buffered capture specific control bit when returning to on
  demand sampling which otherwise no longer works.
- Make sampling frequency per channel rather than just setting it for the
  first channel.
adi,ad9467
- Capital S for sign of channel whereas ABI is lowercase.
bosch,bmi323
- Make sure to release the trigger even on error paths in the trigger
  handler as otherwise there is no path to recover.
bosch,bmp280
- Avoid an overflow in calculating the temperature.
invensense,timestamp helper
- Fix case where ODR is being switched to the existing ODR an update that
  never finishes.
- Fix an issue with the timestamp being updated whilst still handling
  previous interrupt (icm42600 and mpu6050)
invensense,icm42600
- Don't update the watermark parameters twice.
melexis,mlx90635
- Fix variable returned as error code.

* tag 'iio-fixes-for-6.10a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: inkern: fix channel read regression
  iio: imu: inv_mpu6050: stabilized timestamping in interrupt
  iio: adc: ad7173: Fix sampling frequency setting
  iio: adc: ad7173: Clear append status bit
  iio: imu: inv_icm42600: delete unneeded update watermark call
  iio: imu: inv_icm42600: stabilized timestamp in interrupt
  iio: invensense: fix odr switching to same value
  iio: adc: ad7173: Remove index from temp channel
  iio: adc: ad7173: Add ad7173_device_info names
  iio: adc: ad7173: fix buffers enablement for ad7176-2
  iio: temperature: mlx90635: Fix ERR_PTR dereference in mlx90635_probe()
  iio: imu: bmi323: Fix trigger notification in case of error
  iio: dac: ad5592r: fix temperature channel scaling value
  iio: pressure: bmp280: Fix BMP580 temperature reading
  dt-bindings: iio: dac: fix ad354xr output range
  iio: adc: ad9467: fix scan type sign
This commit is contained in:
Greg Kroah-Hartman 2024-06-07 21:05:39 +02:00
commit 8f40af3197
16 changed files with 63 additions and 46 deletions

View File

@ -139,7 +139,7 @@ allOf:
Voltage output range of the channel as <minimum, maximum> Voltage output range of the channel as <minimum, maximum>
Required connections: Required connections:
Rfb1x for: 0 to 2.5 V; 0 to 3V; 0 to 5 V; Rfb1x for: 0 to 2.5 V; 0 to 3V; 0 to 5 V;
Rfb2x for: 0 to 10 V; 2.5 to 7.5V; -5 to 5 V; Rfb2x for: 0 to 10 V; -2.5 to 7.5V; -5 to 5 V;
oneOf: oneOf:
- items: - items:
- const: 0 - const: 0

View File

@ -145,6 +145,7 @@ struct ad7173_device_info {
unsigned int id; unsigned int id;
char *name; char *name;
bool has_temp; bool has_temp;
bool has_input_buf;
bool has_int_ref; bool has_int_ref;
bool has_ref2; bool has_ref2;
u8 num_gpios; u8 num_gpios;
@ -212,18 +213,21 @@ static const struct ad7173_device_info ad7173_device_info[] = {
.num_configs = 4, .num_configs = 4,
.num_gpios = 2, .num_gpios = 2,
.has_temp = true, .has_temp = true,
.has_input_buf = true,
.has_int_ref = true, .has_int_ref = true,
.clock = 2 * HZ_PER_MHZ, .clock = 2 * HZ_PER_MHZ,
.sinc5_data_rates = ad7173_sinc5_data_rates, .sinc5_data_rates = ad7173_sinc5_data_rates,
.num_sinc5_data_rates = ARRAY_SIZE(ad7173_sinc5_data_rates), .num_sinc5_data_rates = ARRAY_SIZE(ad7173_sinc5_data_rates),
}, },
[ID_AD7172_4] = { [ID_AD7172_4] = {
.name = "ad7172-4",
.id = AD7172_4_ID, .id = AD7172_4_ID,
.num_inputs = 9, .num_inputs = 9,
.num_channels = 8, .num_channels = 8,
.num_configs = 8, .num_configs = 8,
.num_gpios = 4, .num_gpios = 4,
.has_temp = false, .has_temp = false,
.has_input_buf = true,
.has_ref2 = true, .has_ref2 = true,
.clock = 2 * HZ_PER_MHZ, .clock = 2 * HZ_PER_MHZ,
.sinc5_data_rates = ad7173_sinc5_data_rates, .sinc5_data_rates = ad7173_sinc5_data_rates,
@ -237,6 +241,7 @@ static const struct ad7173_device_info ad7173_device_info[] = {
.num_configs = 8, .num_configs = 8,
.num_gpios = 4, .num_gpios = 4,
.has_temp = true, .has_temp = true,
.has_input_buf = true,
.has_int_ref = true, .has_int_ref = true,
.has_ref2 = true, .has_ref2 = true,
.clock = 2 * HZ_PER_MHZ, .clock = 2 * HZ_PER_MHZ,
@ -251,18 +256,21 @@ static const struct ad7173_device_info ad7173_device_info[] = {
.num_configs = 4, .num_configs = 4,
.num_gpios = 2, .num_gpios = 2,
.has_temp = true, .has_temp = true,
.has_input_buf = true,
.has_int_ref = true, .has_int_ref = true,
.clock = 16 * HZ_PER_MHZ, .clock = 16 * HZ_PER_MHZ,
.sinc5_data_rates = ad7175_sinc5_data_rates, .sinc5_data_rates = ad7175_sinc5_data_rates,
.num_sinc5_data_rates = ARRAY_SIZE(ad7175_sinc5_data_rates), .num_sinc5_data_rates = ARRAY_SIZE(ad7175_sinc5_data_rates),
}, },
[ID_AD7175_8] = { [ID_AD7175_8] = {
.name = "ad7175-8",
.id = AD7175_8_ID, .id = AD7175_8_ID,
.num_inputs = 17, .num_inputs = 17,
.num_channels = 16, .num_channels = 16,
.num_configs = 8, .num_configs = 8,
.num_gpios = 4, .num_gpios = 4,
.has_temp = true, .has_temp = true,
.has_input_buf = true,
.has_int_ref = true, .has_int_ref = true,
.has_ref2 = true, .has_ref2 = true,
.clock = 16 * HZ_PER_MHZ, .clock = 16 * HZ_PER_MHZ,
@ -277,18 +285,21 @@ static const struct ad7173_device_info ad7173_device_info[] = {
.num_configs = 4, .num_configs = 4,
.num_gpios = 2, .num_gpios = 2,
.has_temp = false, .has_temp = false,
.has_input_buf = false,
.has_int_ref = true, .has_int_ref = true,
.clock = 16 * HZ_PER_MHZ, .clock = 16 * HZ_PER_MHZ,
.sinc5_data_rates = ad7175_sinc5_data_rates, .sinc5_data_rates = ad7175_sinc5_data_rates,
.num_sinc5_data_rates = ARRAY_SIZE(ad7175_sinc5_data_rates), .num_sinc5_data_rates = ARRAY_SIZE(ad7175_sinc5_data_rates),
}, },
[ID_AD7177_2] = { [ID_AD7177_2] = {
.name = "ad7177-2",
.id = AD7177_ID, .id = AD7177_ID,
.num_inputs = 5, .num_inputs = 5,
.num_channels = 4, .num_channels = 4,
.num_configs = 4, .num_configs = 4,
.num_gpios = 2, .num_gpios = 2,
.has_temp = true, .has_temp = true,
.has_input_buf = true,
.has_int_ref = true, .has_int_ref = true,
.clock = 16 * HZ_PER_MHZ, .clock = 16 * HZ_PER_MHZ,
.odr_start_value = AD7177_ODR_START_VALUE, .odr_start_value = AD7177_ODR_START_VALUE,
@ -532,6 +543,7 @@ static int ad7173_append_status(struct ad_sigma_delta *sd, bool append)
unsigned int interface_mode = st->interface_mode; unsigned int interface_mode = st->interface_mode;
int ret; int ret;
interface_mode &= ~AD7173_INTERFACE_DATA_STAT;
interface_mode |= AD7173_INTERFACE_DATA_STAT_EN(append); interface_mode |= AD7173_INTERFACE_DATA_STAT_EN(append);
ret = ad_sd_write_reg(&st->sd, AD7173_REG_INTERFACE_MODE, 2, interface_mode); ret = ad_sd_write_reg(&st->sd, AD7173_REG_INTERFACE_MODE, 2, interface_mode);
if (ret) if (ret)
@ -705,7 +717,7 @@ static int ad7173_write_raw(struct iio_dev *indio_dev,
{ {
struct ad7173_state *st = iio_priv(indio_dev); struct ad7173_state *st = iio_priv(indio_dev);
struct ad7173_channel_config *cfg; struct ad7173_channel_config *cfg;
unsigned int freq, i, reg; unsigned int freq, i;
int ret; int ret;
ret = iio_device_claim_direct_mode(indio_dev); ret = iio_device_claim_direct_mode(indio_dev);
@ -721,16 +733,7 @@ static int ad7173_write_raw(struct iio_dev *indio_dev,
cfg = &st->channels[chan->address].cfg; cfg = &st->channels[chan->address].cfg;
cfg->odr = i; cfg->odr = i;
cfg->live = false;
if (!cfg->live)
break;
ret = ad_sd_read_reg(&st->sd, AD7173_REG_FILTER(cfg->cfg_slot), 2, &reg);
if (ret)
break;
reg &= ~AD7173_FILTER_ODR0_MASK;
reg |= FIELD_PREP(AD7173_FILTER_ODR0_MASK, i);
ret = ad_sd_write_reg(&st->sd, AD7173_REG_FILTER(cfg->cfg_slot), 2, reg);
break; break;
default: default:
@ -792,8 +795,7 @@ static const struct iio_chan_spec ad7173_channel_template = {
.type = IIO_VOLTAGE, .type = IIO_VOLTAGE,
.indexed = 1, .indexed = 1,
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
BIT(IIO_CHAN_INFO_SCALE), BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_SAMP_FREQ),
.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),
.scan_type = { .scan_type = {
.sign = 'u', .sign = 'u',
.realbits = 24, .realbits = 24,
@ -804,12 +806,11 @@ static const struct iio_chan_spec ad7173_channel_template = {
static const struct iio_chan_spec ad7173_temp_iio_channel_template = { static const struct iio_chan_spec ad7173_temp_iio_channel_template = {
.type = IIO_TEMP, .type = IIO_TEMP,
.indexed = 1,
.channel = AD7173_AIN_TEMP_POS, .channel = AD7173_AIN_TEMP_POS,
.channel2 = AD7173_AIN_TEMP_NEG, .channel2 = AD7173_AIN_TEMP_NEG,
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET), BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET) |
.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), BIT(IIO_CHAN_INFO_SAMP_FREQ),
.scan_type = { .scan_type = {
.sign = 'u', .sign = 'u',
.realbits = 24, .realbits = 24,
@ -932,7 +933,7 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
AD7173_CH_ADDRESS(chan_arr[chan_index].channel, AD7173_CH_ADDRESS(chan_arr[chan_index].channel,
chan_arr[chan_index].channel2); chan_arr[chan_index].channel2);
chan_st_priv->cfg.bipolar = false; chan_st_priv->cfg.bipolar = false;
chan_st_priv->cfg.input_buf = true; chan_st_priv->cfg.input_buf = st->info->has_input_buf;
chan_st_priv->cfg.ref_sel = AD7173_SETUP_REF_SEL_INT_REF; chan_st_priv->cfg.ref_sel = AD7173_SETUP_REF_SEL_INT_REF;
st->adc_mode |= AD7173_ADC_MODE_REF_EN; st->adc_mode |= AD7173_ADC_MODE_REF_EN;
@ -989,7 +990,7 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
chan_st_priv->ain = AD7173_CH_ADDRESS(ain[0], ain[1]); chan_st_priv->ain = AD7173_CH_ADDRESS(ain[0], ain[1]);
chan_st_priv->chan_reg = chan_index; chan_st_priv->chan_reg = chan_index;
chan_st_priv->cfg.input_buf = true; chan_st_priv->cfg.input_buf = st->info->has_input_buf;
chan_st_priv->cfg.odr = 0; chan_st_priv->cfg.odr = 0;
chan_st_priv->cfg.bipolar = fwnode_property_read_bool(child, "bipolar"); chan_st_priv->cfg.bipolar = fwnode_property_read_bool(child, "bipolar");

View File

@ -243,11 +243,11 @@ static void __ad9467_get_scale(struct ad9467_state *st, int index,
} }
static const struct iio_chan_spec ad9434_channels[] = { static const struct iio_chan_spec ad9434_channels[] = {
AD9467_CHAN(0, 0, 12, 'S'), AD9467_CHAN(0, 0, 12, 's'),
}; };
static const struct iio_chan_spec ad9467_channels[] = { static const struct iio_chan_spec ad9467_channels[] = {
AD9467_CHAN(0, 0, 16, 'S'), AD9467_CHAN(0, 0, 16, 's'),
}; };
static const struct ad9467_chip_info ad9467_chip_tbl = { static const struct ad9467_chip_info ad9467_chip_tbl = {

View File

@ -60,11 +60,15 @@ EXPORT_SYMBOL_NS_GPL(inv_sensors_timestamp_init, IIO_INV_SENSORS_TIMESTAMP);
int inv_sensors_timestamp_update_odr(struct inv_sensors_timestamp *ts, int inv_sensors_timestamp_update_odr(struct inv_sensors_timestamp *ts,
uint32_t period, bool fifo) uint32_t period, bool fifo)
{ {
uint32_t mult;
/* when FIFO is on, prevent odr change if one is already pending */ /* when FIFO is on, prevent odr change if one is already pending */
if (fifo && ts->new_mult != 0) if (fifo && ts->new_mult != 0)
return -EAGAIN; return -EAGAIN;
ts->new_mult = period / ts->chip.clock_period; mult = period / ts->chip.clock_period;
if (mult != ts->mult)
ts->new_mult = mult;
return 0; return 0;
} }

View File

@ -415,7 +415,7 @@ static int ad5592r_read_raw(struct iio_dev *iio_dev,
s64 tmp = *val * (3767897513LL / 25LL); s64 tmp = *val * (3767897513LL / 25LL);
*val = div_s64_rem(tmp, 1000000000LL, val2); *val = div_s64_rem(tmp, 1000000000LL, val2);
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_NANO;
} }
mutex_lock(&st->lock); mutex_lock(&st->lock);

View File

@ -1391,7 +1391,7 @@ static irqreturn_t bmi323_trigger_handler(int irq, void *p)
&data->buffer.channels, &data->buffer.channels,
ARRAY_SIZE(data->buffer.channels)); ARRAY_SIZE(data->buffer.channels));
if (ret) if (ret)
return IRQ_NONE; goto out;
} else { } else {
for_each_set_bit(bit, indio_dev->active_scan_mask, for_each_set_bit(bit, indio_dev->active_scan_mask,
BMI323_CHAN_MAX) { BMI323_CHAN_MAX) {
@ -1400,13 +1400,14 @@ static irqreturn_t bmi323_trigger_handler(int irq, void *p)
&data->buffer.channels[index++], &data->buffer.channels[index++],
BMI323_BYTES_PER_SAMPLE); BMI323_BYTES_PER_SAMPLE);
if (ret) if (ret)
return IRQ_NONE; goto out;
} }
} }
iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer, iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer,
iio_get_time_ns(indio_dev)); iio_get_time_ns(indio_dev));
out:
iio_trigger_notify_done(indio_dev->trig); iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED; return IRQ_HANDLED;

View File

@ -130,10 +130,6 @@ static int inv_icm42600_accel_update_scan_mode(struct iio_dev *indio_dev,
/* update data FIFO write */ /* update data FIFO write */
inv_sensors_timestamp_apply_odr(ts, 0, 0, 0); inv_sensors_timestamp_apply_odr(ts, 0, 0, 0);
ret = inv_icm42600_buffer_set_fifo_en(st, fifo_en | st->fifo.en); ret = inv_icm42600_buffer_set_fifo_en(st, fifo_en | st->fifo.en);
if (ret)
goto out_unlock;
ret = inv_icm42600_buffer_update_watermark(st);
out_unlock: out_unlock:
mutex_unlock(&st->lock); mutex_unlock(&st->lock);

View File

@ -222,10 +222,15 @@ int inv_icm42600_buffer_update_watermark(struct inv_icm42600_state *st)
latency_accel = period_accel * wm_accel; latency_accel = period_accel * wm_accel;
/* 0 value for watermark means that the sensor is turned off */ /* 0 value for watermark means that the sensor is turned off */
if (wm_gyro == 0 && wm_accel == 0)
return 0;
if (latency_gyro == 0) { if (latency_gyro == 0) {
watermark = wm_accel; watermark = wm_accel;
st->fifo.watermark.eff_accel = wm_accel;
} else if (latency_accel == 0) { } else if (latency_accel == 0) {
watermark = wm_gyro; watermark = wm_gyro;
st->fifo.watermark.eff_gyro = wm_gyro;
} else { } else {
/* compute the smallest latency that is a multiple of both */ /* compute the smallest latency that is a multiple of both */
if (latency_gyro <= latency_accel) if (latency_gyro <= latency_accel)
@ -241,6 +246,13 @@ int inv_icm42600_buffer_update_watermark(struct inv_icm42600_state *st)
watermark = latency / period; watermark = latency / period;
if (watermark < 1) if (watermark < 1)
watermark = 1; watermark = 1;
/* update effective watermark */
st->fifo.watermark.eff_gyro = latency / period_gyro;
if (st->fifo.watermark.eff_gyro < 1)
st->fifo.watermark.eff_gyro = 1;
st->fifo.watermark.eff_accel = latency / period_accel;
if (st->fifo.watermark.eff_accel < 1)
st->fifo.watermark.eff_accel = 1;
} }
/* compute watermark value in bytes */ /* compute watermark value in bytes */
@ -514,7 +526,7 @@ int inv_icm42600_buffer_fifo_parse(struct inv_icm42600_state *st)
/* handle gyroscope timestamp and FIFO data parsing */ /* handle gyroscope timestamp and FIFO data parsing */
if (st->fifo.nb.gyro > 0) { if (st->fifo.nb.gyro > 0) {
ts = &gyro_st->ts; ts = &gyro_st->ts;
inv_sensors_timestamp_interrupt(ts, st->fifo.nb.gyro, inv_sensors_timestamp_interrupt(ts, st->fifo.watermark.eff_gyro,
st->timestamp.gyro); st->timestamp.gyro);
ret = inv_icm42600_gyro_parse_fifo(st->indio_gyro); ret = inv_icm42600_gyro_parse_fifo(st->indio_gyro);
if (ret) if (ret)
@ -524,7 +536,7 @@ int inv_icm42600_buffer_fifo_parse(struct inv_icm42600_state *st)
/* handle accelerometer timestamp and FIFO data parsing */ /* handle accelerometer timestamp and FIFO data parsing */
if (st->fifo.nb.accel > 0) { if (st->fifo.nb.accel > 0) {
ts = &accel_st->ts; ts = &accel_st->ts;
inv_sensors_timestamp_interrupt(ts, st->fifo.nb.accel, inv_sensors_timestamp_interrupt(ts, st->fifo.watermark.eff_accel,
st->timestamp.accel); st->timestamp.accel);
ret = inv_icm42600_accel_parse_fifo(st->indio_accel); ret = inv_icm42600_accel_parse_fifo(st->indio_accel);
if (ret) if (ret)
@ -577,6 +589,9 @@ int inv_icm42600_buffer_init(struct inv_icm42600_state *st)
unsigned int val; unsigned int val;
int ret; int ret;
st->fifo.watermark.eff_gyro = 1;
st->fifo.watermark.eff_accel = 1;
/* /*
* Default FIFO configuration (bits 7 to 5) * Default FIFO configuration (bits 7 to 5)
* - use invalid value * - use invalid value

View File

@ -32,6 +32,8 @@ struct inv_icm42600_fifo {
struct { struct {
unsigned int gyro; unsigned int gyro;
unsigned int accel; unsigned int accel;
unsigned int eff_gyro;
unsigned int eff_accel;
} watermark; } watermark;
size_t count; size_t count;
struct { struct {

View File

@ -537,6 +537,7 @@ static int inv_icm42600_irq_init(struct inv_icm42600_state *st, int irq,
if (ret) if (ret)
return ret; return ret;
irq_type |= IRQF_ONESHOT;
return devm_request_threaded_irq(dev, irq, inv_icm42600_irq_timestamp, return devm_request_threaded_irq(dev, irq, inv_icm42600_irq_timestamp,
inv_icm42600_irq_handler, irq_type, inv_icm42600_irq_handler, irq_type,
"inv_icm42600", st); "inv_icm42600", st);

View File

@ -130,10 +130,6 @@ static int inv_icm42600_gyro_update_scan_mode(struct iio_dev *indio_dev,
/* update data FIFO write */ /* update data FIFO write */
inv_sensors_timestamp_apply_odr(ts, 0, 0, 0); inv_sensors_timestamp_apply_odr(ts, 0, 0, 0);
ret = inv_icm42600_buffer_set_fifo_en(st, fifo_en | st->fifo.en); ret = inv_icm42600_buffer_set_fifo_en(st, fifo_en | st->fifo.en);
if (ret)
goto out_unlock;
ret = inv_icm42600_buffer_update_watermark(st);
out_unlock: out_unlock:
mutex_unlock(&st->lock); mutex_unlock(&st->lock);

View File

@ -100,8 +100,8 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
goto end_session; goto end_session;
/* Each FIFO data contains all sensors, so same number for FIFO and sensor data */ /* Each FIFO data contains all sensors, so same number for FIFO and sensor data */
fifo_period = NSEC_PER_SEC / INV_MPU6050_DIVIDER_TO_FIFO_RATE(st->chip_config.divider); fifo_period = NSEC_PER_SEC / INV_MPU6050_DIVIDER_TO_FIFO_RATE(st->chip_config.divider);
inv_sensors_timestamp_interrupt(&st->timestamp, nb, pf->timestamp); inv_sensors_timestamp_interrupt(&st->timestamp, 1, pf->timestamp);
inv_sensors_timestamp_apply_odr(&st->timestamp, fifo_period, nb, 0); inv_sensors_timestamp_apply_odr(&st->timestamp, fifo_period, 1, 0);
/* clear internal data buffer for avoiding kernel data leak */ /* clear internal data buffer for avoiding kernel data leak */
memset(data, 0, sizeof(data)); memset(data, 0, sizeof(data));

View File

@ -300,6 +300,7 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev, int irq_type)
if (!st->trig) if (!st->trig)
return -ENOMEM; return -ENOMEM;
irq_type |= IRQF_ONESHOT;
ret = devm_request_threaded_irq(&indio_dev->dev, st->irq, ret = devm_request_threaded_irq(&indio_dev->dev, st->irq,
&inv_mpu6050_interrupt_timestamp, &inv_mpu6050_interrupt_timestamp,
&inv_mpu6050_interrupt_handle, &inv_mpu6050_interrupt_handle,

View File

@ -721,7 +721,7 @@ int iio_read_channel_processed_scale(struct iio_channel *chan, int *val,
return ret; return ret;
*val *= scale; *val *= scale;
return 0; return ret;
} else { } else {
ret = iio_channel_read(chan, val, NULL, IIO_CHAN_INFO_RAW); ret = iio_channel_read(chan, val, NULL, IIO_CHAN_INFO_RAW);
if (ret < 0) if (ret < 0)

View File

@ -1394,12 +1394,12 @@ static int bmp580_read_temp(struct bmp280_data *data, int *val, int *val2)
/* /*
* Temperature is returned in Celsius degrees in fractional * Temperature is returned in Celsius degrees in fractional
* form down 2^16. We rescale by x1000 to return milli Celsius * form down 2^16. We rescale by x1000 to return millidegrees
* to respect IIO ABI. * Celsius to respect IIO ABI.
*/ */
*val = raw_temp * 1000; raw_temp = sign_extend32(raw_temp, 23);
*val2 = 16; *val = ((s64)raw_temp * 1000) / (1 << 16);
return IIO_VAL_FRACTIONAL_LOG2; return IIO_VAL_INT;
} }
static int bmp580_read_press(struct bmp280_data *data, int *val, int *val2) static int bmp580_read_press(struct bmp280_data *data, int *val, int *val2)

View File

@ -947,9 +947,9 @@ static int mlx90635_probe(struct i2c_client *client)
"failed to allocate regmap\n"); "failed to allocate regmap\n");
regmap_ee = devm_regmap_init_i2c(client, &mlx90635_regmap_ee); regmap_ee = devm_regmap_init_i2c(client, &mlx90635_regmap_ee);
if (IS_ERR(regmap)) if (IS_ERR(regmap_ee))
return dev_err_probe(&client->dev, PTR_ERR(regmap), return dev_err_probe(&client->dev, PTR_ERR(regmap_ee),
"failed to allocate regmap\n"); "failed to allocate EEPROM regmap\n");
mlx90635 = iio_priv(indio_dev); mlx90635 = iio_priv(indio_dev);
i2c_set_clientdata(client, indio_dev); i2c_set_clientdata(client, indio_dev);