Second round of IIO fixes for the 3.14 cycle.
Another mixed bag, including some that were not in round 1 because they applied to elements that went in during the merge window whereas round 1 predated that. I have been effectively out of action for 3 weeks so will take a little while to catch up with my backlog. * mag3110 - report busy in read_raw / write_raw when buffered capture is underway to avoid either changing the characteristics of the capture or causing capture issues by reading data destined for the buffer. * mag3110 - fix a failure to specify leading zeros when formatting a decimal number. * lradc - fix a buffer overflow and incorrect reporting of scale for voltage channel 15 * lradc - drop some scale_available attributes for elements that don't actually exist. These could otherwise cause some interesting issues for userspace. * ad799x - a typo in the events information mask resulted in some nasty crashes on failed probes. * ak8975 - fix scale attribute output to avoid incorrect intepretation of readings in userspace. * adis16400 - make sure the timestamp is the last element in all channel_spec arrays as this assumption is made by the buffer filling code, but was not true previously. * bma180 - correctly use modifiers to distinguish the channels rather than indexes. This brings the abi inline with the standard option for 3 axis accelerometers. * max1363 - use devm_regulator_get_optional instead of the non optional case to allow the device to successfully probe when a regulator is not specified. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJS9ofvAAoJEFSFNJnE9BaIH0wP/007ZKzhsuEzi6eRufxrNcfq TJDIJlGTMwNBozIva1dXvazpcbcPzVnpWuvaVZ35ENDd5G1CKwfb6iI0jVAfD211 RW+EyV2us8HNCATWewVfaHYVbiCZ5e/73rgt+IwKgiClmiw2vWLL+Y5c1ZNpIwm8 j4xKeB/fIse4UeruJeTbdUuSQHn9rO5LEBx0R+/WpqML2SbUVynGo7oU4oa/q0H0 OfFbNC/l59vT2WvWHaLvVK9lChg8nHlhN3VK2FITDF/Mb6kyB8nZTpOu2MBT9eIP 3zrO+jtIJxRmzxKhmZm7rX0h5CfYtIosFUJge8c3mAUxvDuQ/kKPorHAM5Fjxhz5 TF20fEUmOFBL60tYGI27MptMJbpfJ/jJeNBOYxGi2ytSOMH01j8rxTDGGUhuGnUd gOT9M/C5PexMkRHAu+soKTyJ8s9xK1+V2Ng2g6Z6Dp44tSXeMS0UYA4q6XhQ3QQF /ACIp/6rRrJAZkkHOu6msarzQ6bNIOK73YxfVNHO41VU12yhljzF7LyxYwohe0Dk EircHAp3SqTNgIfl835YZxNpejcQ8f7sXvKa5RMK+UBMhfiA7T+k0WQHmeaDI42H EYX2k0i+lDQ1a/MS9IQ5i+cMN00Ia/3UzFADYyuLSrc0kXBwIQUvjtaekrvPI0Ue 7UQF2yyP/wzqw3GUoP1F =MjtB -----END PGP SIGNATURE----- Merge tag 'iio-fixes-for-3.14b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus Jonathan writes: Second round of IIO fixes for the 3.14 cycle. Another mixed bag, including some that were not in round 1 because they applied to elements that went in during the merge window whereas round 1 predated that. I have been effectively out of action for 3 weeks so will take a little while to catch up with my backlog. * mag3110 - report busy in read_raw / write_raw when buffered capture is underway to avoid either changing the characteristics of the capture or causing capture issues by reading data destined for the buffer. * mag3110 - fix a failure to specify leading zeros when formatting a decimal number. * lradc - fix a buffer overflow and incorrect reporting of scale for voltage channel 15 * lradc - drop some scale_available attributes for elements that don't actually exist. These could otherwise cause some interesting issues for userspace. * ad799x - a typo in the events information mask resulted in some nasty crashes on failed probes. * ak8975 - fix scale attribute output to avoid incorrect intepretation of readings in userspace. * adis16400 - make sure the timestamp is the last element in all channel_spec arrays as this assumption is made by the buffer filling code, but was not true previously. * bma180 - correctly use modifiers to distinguish the channels rather than indexes. This brings the abi inline with the standard option for 3 axis accelerometers. * max1363 - use devm_regulator_get_optional instead of the non optional case to allow the device to successfully probe when a regulator is not specified.
This commit is contained in:
commit
a0f4525202
|
@ -447,14 +447,14 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
|
|||
{ },
|
||||
};
|
||||
|
||||
#define BMA180_CHANNEL(_index) { \
|
||||
#define BMA180_CHANNEL(_axis) { \
|
||||
.type = IIO_ACCEL, \
|
||||
.indexed = 1, \
|
||||
.channel = (_index), \
|
||||
.modified = 1, \
|
||||
.channel2 = IIO_MOD_##_axis, \
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
|
||||
BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY), \
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
|
||||
.scan_index = (_index), \
|
||||
.scan_index = AXIS_##_axis, \
|
||||
.scan_type = { \
|
||||
.sign = 's', \
|
||||
.realbits = 14, \
|
||||
|
@ -465,10 +465,10 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
|
|||
}
|
||||
|
||||
static const struct iio_chan_spec bma180_channels[] = {
|
||||
BMA180_CHANNEL(AXIS_X),
|
||||
BMA180_CHANNEL(AXIS_Y),
|
||||
BMA180_CHANNEL(AXIS_Z),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(4),
|
||||
BMA180_CHANNEL(X),
|
||||
BMA180_CHANNEL(Y),
|
||||
BMA180_CHANNEL(Z),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(3),
|
||||
};
|
||||
|
||||
static irqreturn_t bma180_trigger_handler(int irq, void *p)
|
||||
|
|
|
@ -1560,7 +1560,7 @@ static int max1363_probe(struct i2c_client *client,
|
|||
st->client = client;
|
||||
|
||||
st->vref_uv = st->chip_info->int_vref_mv * 1000;
|
||||
vref = devm_regulator_get(&client->dev, "vref");
|
||||
vref = devm_regulator_get_optional(&client->dev, "vref");
|
||||
if (!IS_ERR(vref)) {
|
||||
int vref_uv;
|
||||
|
||||
|
|
|
@ -189,6 +189,7 @@ enum {
|
|||
ADIS16300_SCAN_INCLI_X,
|
||||
ADIS16300_SCAN_INCLI_Y,
|
||||
ADIS16400_SCAN_ADC,
|
||||
ADIS16400_SCAN_TIMESTAMP,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_IIO_BUFFER
|
||||
|
|
|
@ -632,7 +632,7 @@ static const struct iio_chan_spec adis16400_channels[] = {
|
|||
ADIS16400_MAGN_CHAN(Z, ADIS16400_ZMAGN_OUT, 14),
|
||||
ADIS16400_TEMP_CHAN(ADIS16400_TEMP_OUT, 12),
|
||||
ADIS16400_AUX_ADC_CHAN(ADIS16400_AUX_ADC, 12),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(12)
|
||||
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||
};
|
||||
|
||||
static const struct iio_chan_spec adis16448_channels[] = {
|
||||
|
@ -659,7 +659,7 @@ static const struct iio_chan_spec adis16448_channels[] = {
|
|||
},
|
||||
},
|
||||
ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(11)
|
||||
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||
};
|
||||
|
||||
static const struct iio_chan_spec adis16350_channels[] = {
|
||||
|
@ -677,7 +677,7 @@ static const struct iio_chan_spec adis16350_channels[] = {
|
|||
ADIS16400_MOD_TEMP_CHAN(X, ADIS16350_XTEMP_OUT, 12),
|
||||
ADIS16400_MOD_TEMP_CHAN(Y, ADIS16350_YTEMP_OUT, 12),
|
||||
ADIS16400_MOD_TEMP_CHAN(Z, ADIS16350_ZTEMP_OUT, 12),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(11)
|
||||
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||
};
|
||||
|
||||
static const struct iio_chan_spec adis16300_channels[] = {
|
||||
|
@ -690,7 +690,7 @@ static const struct iio_chan_spec adis16300_channels[] = {
|
|||
ADIS16400_AUX_ADC_CHAN(ADIS16300_AUX_ADC, 12),
|
||||
ADIS16400_INCLI_CHAN(X, ADIS16300_PITCH_OUT, 13),
|
||||
ADIS16400_INCLI_CHAN(Y, ADIS16300_ROLL_OUT, 13),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(14)
|
||||
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||
};
|
||||
|
||||
static const struct iio_chan_spec adis16334_channels[] = {
|
||||
|
@ -701,7 +701,7 @@ static const struct iio_chan_spec adis16334_channels[] = {
|
|||
ADIS16400_ACCEL_CHAN(Y, ADIS16400_YACCL_OUT, 14),
|
||||
ADIS16400_ACCEL_CHAN(Z, ADIS16400_ZACCL_OUT, 14),
|
||||
ADIS16400_TEMP_CHAN(ADIS16350_XTEMP_OUT, 12),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(8)
|
||||
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||
};
|
||||
|
||||
static struct attribute *adis16400_attributes[] = {
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
#define AK8975_MAX_CONVERSION_TIMEOUT 500
|
||||
#define AK8975_CONVERSION_DONE_POLL_TIME 10
|
||||
#define AK8975_DATA_READY_TIMEOUT ((100*HZ)/1000)
|
||||
#define RAW_TO_GAUSS(asa) ((((asa) + 128) * 3000) / 256)
|
||||
|
||||
/*
|
||||
* Per-instance context data for the device.
|
||||
|
@ -265,15 +266,15 @@ static int ak8975_setup(struct i2c_client *client)
|
|||
*
|
||||
* Since 1uT = 0.01 gauss, our final scale factor becomes:
|
||||
*
|
||||
* Hadj = H * ((ASA + 128) / 256) * 3/10 * 100
|
||||
* Hadj = H * ((ASA + 128) * 30 / 256
|
||||
* Hadj = H * ((ASA + 128) / 256) * 3/10 * 1/100
|
||||
* Hadj = H * ((ASA + 128) * 0.003) / 256
|
||||
*
|
||||
* Since ASA doesn't change, we cache the resultant scale factor into the
|
||||
* device context in ak8975_setup().
|
||||
*/
|
||||
data->raw_to_gauss[0] = ((data->asa[0] + 128) * 30) >> 8;
|
||||
data->raw_to_gauss[1] = ((data->asa[1] + 128) * 30) >> 8;
|
||||
data->raw_to_gauss[2] = ((data->asa[2] + 128) * 30) >> 8;
|
||||
data->raw_to_gauss[0] = RAW_TO_GAUSS(data->asa[0]);
|
||||
data->raw_to_gauss[1] = RAW_TO_GAUSS(data->asa[1]);
|
||||
data->raw_to_gauss[2] = RAW_TO_GAUSS(data->asa[2]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -428,8 +429,9 @@ static int ak8975_read_raw(struct iio_dev *indio_dev,
|
|||
case IIO_CHAN_INFO_RAW:
|
||||
return ak8975_read_axis(indio_dev, chan->address, val);
|
||||
case IIO_CHAN_INFO_SCALE:
|
||||
*val = data->raw_to_gauss[chan->address];
|
||||
return IIO_VAL_INT;
|
||||
*val = 0;
|
||||
*val2 = data->raw_to_gauss[chan->address];
|
||||
return IIO_VAL_INT_PLUS_MICRO;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ static ssize_t mag3110_show_int_plus_micros(char *buf,
|
|||
|
||||
while (n-- > 0)
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
"%d.%d ", vals[n][0], vals[n][1]);
|
||||
"%d.%06d ", vals[n][0], vals[n][1]);
|
||||
|
||||
/* replace trailing space by newline */
|
||||
buf[len - 1] = '\n';
|
||||
|
@ -154,6 +154,9 @@ static int mag3110_read_raw(struct iio_dev *indio_dev,
|
|||
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
if (iio_buffer_enabled(indio_dev))
|
||||
return -EBUSY;
|
||||
|
||||
switch (chan->type) {
|
||||
case IIO_MAGN: /* in 0.1 uT / LSB */
|
||||
ret = mag3110_read(data, buffer);
|
||||
|
@ -199,6 +202,9 @@ static int mag3110_write_raw(struct iio_dev *indio_dev,
|
|||
struct mag3110_data *data = iio_priv(indio_dev);
|
||||
int rate;
|
||||
|
||||
if (iio_buffer_enabled(indio_dev))
|
||||
return -EBUSY;
|
||||
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_SAMP_FREQ:
|
||||
rate = mag3110_get_samp_freq_index(data, val, val2);
|
||||
|
|
|
@ -393,7 +393,7 @@ static const struct iio_event_spec ad799x_events[] = {
|
|||
}, {
|
||||
.type = IIO_EV_TYPE_THRESH,
|
||||
.dir = IIO_EV_DIR_FALLING,
|
||||
.mask_separate = BIT(IIO_EV_INFO_VALUE),
|
||||
.mask_separate = BIT(IIO_EV_INFO_VALUE) |
|
||||
BIT(IIO_EV_INFO_ENABLE),
|
||||
}, {
|
||||
.type = IIO_EV_TYPE_THRESH,
|
||||
|
|
|
@ -1035,8 +1035,6 @@ SHOW_SCALE_AVAILABLE_ATTR(4);
|
|||
SHOW_SCALE_AVAILABLE_ATTR(5);
|
||||
SHOW_SCALE_AVAILABLE_ATTR(6);
|
||||
SHOW_SCALE_AVAILABLE_ATTR(7);
|
||||
SHOW_SCALE_AVAILABLE_ATTR(8);
|
||||
SHOW_SCALE_AVAILABLE_ATTR(9);
|
||||
SHOW_SCALE_AVAILABLE_ATTR(10);
|
||||
SHOW_SCALE_AVAILABLE_ATTR(11);
|
||||
SHOW_SCALE_AVAILABLE_ATTR(12);
|
||||
|
@ -1053,8 +1051,6 @@ static struct attribute *mxs_lradc_attributes[] = {
|
|||
&iio_dev_attr_in_voltage5_scale_available.dev_attr.attr,
|
||||
&iio_dev_attr_in_voltage6_scale_available.dev_attr.attr,
|
||||
&iio_dev_attr_in_voltage7_scale_available.dev_attr.attr,
|
||||
&iio_dev_attr_in_voltage8_scale_available.dev_attr.attr,
|
||||
&iio_dev_attr_in_voltage9_scale_available.dev_attr.attr,
|
||||
&iio_dev_attr_in_voltage10_scale_available.dev_attr.attr,
|
||||
&iio_dev_attr_in_voltage11_scale_available.dev_attr.attr,
|
||||
&iio_dev_attr_in_voltage12_scale_available.dev_attr.attr,
|
||||
|
@ -1613,7 +1609,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
|
|||
* of the array.
|
||||
*/
|
||||
scale_uv = ((u64)lradc->vref_mv[i] * 100000000) >>
|
||||
(iio->channels[i].scan_type.realbits - s);
|
||||
(LRADC_RESOLUTION - s);
|
||||
lradc->scale_avail[i][s].nano =
|
||||
do_div(scale_uv, 100000000) * 10;
|
||||
lradc->scale_avail[i][s].integer = scale_uv;
|
||||
|
|
Loading…
Reference in New Issue