mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-23 08:35:19 -05:00
3rd set of IIO fixes for the 6.1 cycle.
Usual mixed bunch of driver fixes.
* sw-triggers
- Fix failure to cleanup up list registration in an error path.
* aspeed,adc
- Drop the trim valid dts property as it doesn't account for unprogrammed
OTP and that can be easily detected without it.
* avago,apds9960:
- Fix register address for gesture gain.
* bosch,bma400
- Fix a memory leak in an error path.
* rohm,rpr0521
- Fix missing dependency on IIO_BUFFER/IIO_TRIGGERED_BUFFER.
* ti,afe4403/4404
- Fix out of band read by moving reads down to where they are used.
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmN1MQsRHGppYzIzQGtl
cm5lbC5vcmcACgkQVIU0mcT0Fohxkg//XsdJcZCSwzLsnMiV96Fd1oRzkyaemzC2
jC9kXdQfrKo86G3Sahkg1jZ7EmBb1So9vYQ7V6iLuyzVLBt4asqiraazk9yPFdNH
E/YJQ3hpTR5FXnFTqfkAcgW1cHwgh1gNZ6NcOorArXEpO0Gp+yYgk6quENzy54Zm
9DfPnPGyPFixWIaUStFaOdMS0x6M3EY8CF1TIkAsYOFaxI9Nd5NPTVIKK1CW8bak
5rnXIqwr+5JQf7NPr3dSWiJ3j6ShaEYmH9ynfhTd/56Bkq+2LKKBo+ooNbTszR7n
jnA7p/ltd/48c/YnwY8wZP2k0/l/OfB0Xe0OLdSdttIceV/gbddA8aPihFrAgYTy
9HPzzYdVo8tGEP7xZzSpYT3uH4uJxXardf7Usa6/eKDzoaUzuDTGrbyycYKGaB73
QP2h1dl8uUIOHnSrr3ET5Q90eQEiDZxyprR4/Y+z8P9My9bj58o17PNF1MnsEgMB
uP6qdiMfhIC30EUTNtDVY28uLgjyHFApuvVWfw4Hzrakv48p8onQw/kad0cusimE
VTjZIcYhf7KNksxH4gIqr72zvwka3CCIps5yXisS1/YJ+8CZBYGHANqxiYcWHwks
rFhC4/nXLHs18j5qySPtjIRPFRdooGJ3FkDv/U06Br51wX++KbPR6wuChCAUyLjy
n+7aubn6LxE=
=3kVB
-----END PGP SIGNATURE-----
Merge tag 'iio-fixes-for-6.1c' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next
Jonathan writes:
"3rd set of IIO fixes for the 6.1 cycle.
Usual mixed bunch of driver fixes.
* sw-triggers
- Fix failure to cleanup up list registration in an error path.
* aspeed,adc
- Drop the trim valid dts property as it doesn't account for unprogrammed
OTP and that can be easily detected without it.
* avago,apds9960:
- Fix register address for gesture gain.
* bosch,bma400
- Fix a memory leak in an error path.
* rohm,rpr0521
- Fix missing dependency on IIO_BUFFER/IIO_TRIGGERED_BUFFER.
* ti,afe4403/4404
- Fix out of band read by moving reads down to where they are
used."
* tag 'iio-fixes-for-6.1c' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
dt-bindings: iio: adc: Remove the property "aspeed,trim-data-valid"
iio: adc: aspeed: Remove the trim valid dts property.
iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails
iio: accel: bma400: Fix memory leak in bma400_get_steps_reg()
iio: light: rpr0521: add missing Kconfig dependencies
iio: health: afe4404
: Fix oob read in afe4404_[read|write]_raw
iio: health: afe4403: Fix oob read in afe4403_read_raw
iio: light: apds9960: fix wrong register for gesture gain
This commit is contained in:
commit
634c5fa1e3
8 changed files with 31 additions and 28 deletions
|
@ -62,13 +62,6 @@ properties:
|
|||
description:
|
||||
Inform the driver that last channel will be used to sensor battery.
|
||||
|
||||
aspeed,trim-data-valid:
|
||||
type: boolean
|
||||
description: |
|
||||
The ADC reference voltage can be calibrated to obtain the trimming
|
||||
data which will be stored in otp. This property informs the driver that
|
||||
the data store in the otp is valid.
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
|
|
@ -805,8 +805,10 @@ static int bma400_get_steps_reg(struct bma400_data *data, int *val)
|
|||
|
||||
ret = regmap_bulk_read(data->regmap, BMA400_STEP_CNT0_REG,
|
||||
steps_raw, BMA400_STEP_RAW_LEN);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
kfree(steps_raw);
|
||||
return ret;
|
||||
}
|
||||
*val = get_unaligned_le24(steps_raw);
|
||||
kfree(steps_raw);
|
||||
return IIO_VAL_INT;
|
||||
|
|
|
@ -202,6 +202,8 @@ static int aspeed_adc_set_trim_data(struct iio_dev *indio_dev)
|
|||
((scu_otp) &
|
||||
(data->model_data->trim_locate->field)) >>
|
||||
__ffs(data->model_data->trim_locate->field);
|
||||
if (!trimming_val)
|
||||
trimming_val = 0x8;
|
||||
}
|
||||
dev_dbg(data->dev,
|
||||
"trimming val = %d, offset = %08x, fields = %08x\n",
|
||||
|
@ -563,12 +565,9 @@ static int aspeed_adc_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (of_find_property(data->dev->of_node, "aspeed,trim-data-valid",
|
||||
NULL)) {
|
||||
ret = aspeed_adc_set_trim_data(indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
ret = aspeed_adc_set_trim_data(indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (of_find_property(data->dev->of_node, "aspeed,battery-sensing",
|
||||
NULL)) {
|
||||
|
|
|
@ -245,14 +245,14 @@ static int afe4403_read_raw(struct iio_dev *indio_dev,
|
|||
int *val, int *val2, long mask)
|
||||
{
|
||||
struct afe4403_data *afe = iio_priv(indio_dev);
|
||||
unsigned int reg = afe4403_channel_values[chan->address];
|
||||
unsigned int field = afe4403_channel_leds[chan->address];
|
||||
unsigned int reg, field;
|
||||
int ret;
|
||||
|
||||
switch (chan->type) {
|
||||
case IIO_INTENSITY:
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
reg = afe4403_channel_values[chan->address];
|
||||
ret = afe4403_read(afe, reg, val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -262,6 +262,7 @@ static int afe4403_read_raw(struct iio_dev *indio_dev,
|
|||
case IIO_CURRENT:
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
field = afe4403_channel_leds[chan->address];
|
||||
ret = regmap_field_read(afe->fields[field], val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
|
@ -250,20 +250,20 @@ static int afe4404_read_raw(struct iio_dev *indio_dev,
|
|||
int *val, int *val2, long mask)
|
||||
{
|
||||
struct afe4404_data *afe = iio_priv(indio_dev);
|
||||
unsigned int value_reg = afe4404_channel_values[chan->address];
|
||||
unsigned int led_field = afe4404_channel_leds[chan->address];
|
||||
unsigned int offdac_field = afe4404_channel_offdacs[chan->address];
|
||||
unsigned int value_reg, led_field, offdac_field;
|
||||
int ret;
|
||||
|
||||
switch (chan->type) {
|
||||
case IIO_INTENSITY:
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
value_reg = afe4404_channel_values[chan->address];
|
||||
ret = regmap_read(afe->regmap, value_reg, val);
|
||||
if (ret)
|
||||
return ret;
|
||||
return IIO_VAL_INT;
|
||||
case IIO_CHAN_INFO_OFFSET:
|
||||
offdac_field = afe4404_channel_offdacs[chan->address];
|
||||
ret = regmap_field_read(afe->fields[offdac_field], val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -273,6 +273,7 @@ static int afe4404_read_raw(struct iio_dev *indio_dev,
|
|||
case IIO_CURRENT:
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
led_field = afe4404_channel_leds[chan->address];
|
||||
ret = regmap_field_read(afe->fields[led_field], val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -295,19 +296,20 @@ static int afe4404_write_raw(struct iio_dev *indio_dev,
|
|||
int val, int val2, long mask)
|
||||
{
|
||||
struct afe4404_data *afe = iio_priv(indio_dev);
|
||||
unsigned int led_field = afe4404_channel_leds[chan->address];
|
||||
unsigned int offdac_field = afe4404_channel_offdacs[chan->address];
|
||||
unsigned int led_field, offdac_field;
|
||||
|
||||
switch (chan->type) {
|
||||
case IIO_INTENSITY:
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_OFFSET:
|
||||
offdac_field = afe4404_channel_offdacs[chan->address];
|
||||
return regmap_field_write(afe->fields[offdac_field], val);
|
||||
}
|
||||
break;
|
||||
case IIO_CURRENT:
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
led_field = afe4404_channel_leds[chan->address];
|
||||
return regmap_field_write(afe->fields[led_field], val);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -58,8 +58,12 @@ int iio_register_sw_trigger_type(struct iio_sw_trigger_type *t)
|
|||
|
||||
t->group = configfs_register_default_group(iio_triggers_group, t->name,
|
||||
&iio_trigger_type_group_type);
|
||||
if (IS_ERR(t->group))
|
||||
if (IS_ERR(t->group)) {
|
||||
mutex_lock(&iio_trigger_types_lock);
|
||||
list_del(&t->list);
|
||||
mutex_unlock(&iio_trigger_types_lock);
|
||||
ret = PTR_ERR(t->group);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -293,6 +293,8 @@ config RPR0521
|
|||
tristate "ROHM RPR0521 ALS and proximity sensor driver"
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
select IIO_BUFFER
|
||||
select IIO_TRIGGERED_BUFFER
|
||||
help
|
||||
Say Y here if you want to build support for ROHM's RPR0521
|
||||
ambient light and proximity sensor device.
|
||||
|
|
|
@ -54,9 +54,6 @@
|
|||
#define APDS9960_REG_CONTROL_PGAIN_MASK_SHIFT 2
|
||||
|
||||
#define APDS9960_REG_CONFIG_2 0x90
|
||||
#define APDS9960_REG_CONFIG_2_GGAIN_MASK 0x60
|
||||
#define APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT 5
|
||||
|
||||
#define APDS9960_REG_ID 0x92
|
||||
|
||||
#define APDS9960_REG_STATUS 0x93
|
||||
|
@ -77,6 +74,9 @@
|
|||
#define APDS9960_REG_GCONF_1_GFIFO_THRES_MASK_SHIFT 6
|
||||
|
||||
#define APDS9960_REG_GCONF_2 0xa3
|
||||
#define APDS9960_REG_GCONF_2_GGAIN_MASK 0x60
|
||||
#define APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT 5
|
||||
|
||||
#define APDS9960_REG_GOFFSET_U 0xa4
|
||||
#define APDS9960_REG_GOFFSET_D 0xa5
|
||||
#define APDS9960_REG_GPULSE 0xa6
|
||||
|
@ -396,9 +396,9 @@ static int apds9960_set_pxs_gain(struct apds9960_data *data, int val)
|
|||
}
|
||||
|
||||
ret = regmap_update_bits(data->regmap,
|
||||
APDS9960_REG_CONFIG_2,
|
||||
APDS9960_REG_CONFIG_2_GGAIN_MASK,
|
||||
idx << APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT);
|
||||
APDS9960_REG_GCONF_2,
|
||||
APDS9960_REG_GCONF_2_GGAIN_MASK,
|
||||
idx << APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT);
|
||||
if (!ret)
|
||||
data->pxs_gain = idx;
|
||||
mutex_unlock(&data->lock);
|
||||
|
|
Loading…
Add table
Reference in a new issue