Skip to content

Commit e45e07c

Browse files
committed
Merge tag 'iio-fixes-for-6.14a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-linus
Jonathan writes: IIO: 1st set of fixes for the 6.14 cycle hid-sensors - Fix an ABI issue that occurred when we gained multiple proximity sensor support. adi,adi-axi-adc - Fix missing pwm-names inItems entry in dt binding. adi,ad3552r - Make sure to clear the reset bit in the status flag so future resets can be detected. adi,ad7192 - Fix use of value where it should be bit(value) to select channel. adi,ad7606 - Fix up reporting of wrong available scales. adi,admv8818 - Force SDO line to be initialized without relying on it already being intialized to read back current register value. atmel,sama5d2 - Fix wrong number of bits reported for readings from sama7g5 avago,apds9306 - Fix wrong scaling of scale values (missing a few zeros). microchip,pac1921 - Fix resource leak by moving ACPI_FREE() call up a few lines. tyhx,hx9023s - Fix a use after free caused by releasing firmware a few lines early. * tag 'iio-fixes-for-6.14a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: iio: filter: admv8818: Force initialization of SDO iio: adc: ad7606: fix wrong scale available dt-bindings: iio: dac: adi-axi-adc: fix ad7606 pwm-names iio: dac: ad3552r: clear reset status flag iio: adc: ad7192: fix channel select iio: hid-sensor-prox: Split difference from multiple channels iio: proximity: Fix use-after-free in hx9023s_send_cfg() iio: adc: at91-sama5d2_adc: fix sama7g5 realbits value iio: adc: pac1921: Move ACPI_FREE() to cover all branches iio: light: apds9306: fix max_scale_nano values
2 parents a64dcfb + cc2c354 commit e45e07c

File tree

10 files changed

+62
-47
lines changed

10 files changed

+62
-47
lines changed

Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ properties:
146146
maxItems: 2
147147

148148
pwm-names:
149+
minItems: 1
149150
items:
150151
- const: convst1
151152
- const: convst2

drivers/iio/adc/ad7192.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ static int ad7192_update_scan_mode(struct iio_dev *indio_dev, const unsigned lon
10841084

10851085
conf &= ~AD7192_CONF_CHAN_MASK;
10861086
for_each_set_bit(i, scan_mask, 8)
1087-
conf |= FIELD_PREP(AD7192_CONF_CHAN_MASK, i);
1087+
conf |= FIELD_PREP(AD7192_CONF_CHAN_MASK, BIT(i));
10881088

10891089
ret = ad_sd_write_reg(&st->sd, AD7192_REG_CONF, 3, conf);
10901090
if (ret < 0)

drivers/iio/adc/ad7606.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ static int ad7606_read_avail(struct iio_dev *indio_dev,
10471047

10481048
cs = &st->chan_scales[ch];
10491049
*vals = (int *)cs->scale_avail;
1050-
*length = cs->num_scales;
1050+
*length = cs->num_scales * 2;
10511051
*type = IIO_VAL_INT_PLUS_MICRO;
10521052

10531053
return IIO_AVAIL_LIST;

drivers/iio/adc/at91-sama5d2_adc.c

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,15 @@ static const struct at91_adc_reg_layout sama7g5_layout = {
329329
#define AT91_HWFIFO_MAX_SIZE_STR "128"
330330
#define AT91_HWFIFO_MAX_SIZE 128
331331

332-
#define AT91_SAMA5D2_CHAN_SINGLE(index, num, addr) \
332+
#define AT91_SAMA_CHAN_SINGLE(index, num, addr, rbits) \
333333
{ \
334334
.type = IIO_VOLTAGE, \
335335
.channel = num, \
336336
.address = addr, \
337337
.scan_index = index, \
338338
.scan_type = { \
339339
.sign = 'u', \
340-
.realbits = 14, \
340+
.realbits = rbits, \
341341
.storagebits = 16, \
342342
}, \
343343
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
@@ -350,7 +350,13 @@ static const struct at91_adc_reg_layout sama7g5_layout = {
350350
.indexed = 1, \
351351
}
352352

353-
#define AT91_SAMA5D2_CHAN_DIFF(index, num, num2, addr) \
353+
#define AT91_SAMA5D2_CHAN_SINGLE(index, num, addr) \
354+
AT91_SAMA_CHAN_SINGLE(index, num, addr, 14)
355+
356+
#define AT91_SAMA7G5_CHAN_SINGLE(index, num, addr) \
357+
AT91_SAMA_CHAN_SINGLE(index, num, addr, 16)
358+
359+
#define AT91_SAMA_CHAN_DIFF(index, num, num2, addr, rbits) \
354360
{ \
355361
.type = IIO_VOLTAGE, \
356362
.differential = 1, \
@@ -360,7 +366,7 @@ static const struct at91_adc_reg_layout sama7g5_layout = {
360366
.scan_index = index, \
361367
.scan_type = { \
362368
.sign = 's', \
363-
.realbits = 14, \
369+
.realbits = rbits, \
364370
.storagebits = 16, \
365371
}, \
366372
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
@@ -373,6 +379,12 @@ static const struct at91_adc_reg_layout sama7g5_layout = {
373379
.indexed = 1, \
374380
}
375381

382+
#define AT91_SAMA5D2_CHAN_DIFF(index, num, num2, addr) \
383+
AT91_SAMA_CHAN_DIFF(index, num, num2, addr, 14)
384+
385+
#define AT91_SAMA7G5_CHAN_DIFF(index, num, num2, addr) \
386+
AT91_SAMA_CHAN_DIFF(index, num, num2, addr, 16)
387+
376388
#define AT91_SAMA5D2_CHAN_TOUCH(num, name, mod) \
377389
{ \
378390
.type = IIO_POSITIONRELATIVE, \
@@ -666,30 +678,30 @@ static const struct iio_chan_spec at91_sama5d2_adc_channels[] = {
666678
};
667679

668680
static const struct iio_chan_spec at91_sama7g5_adc_channels[] = {
669-
AT91_SAMA5D2_CHAN_SINGLE(0, 0, 0x60),
670-
AT91_SAMA5D2_CHAN_SINGLE(1, 1, 0x64),
671-
AT91_SAMA5D2_CHAN_SINGLE(2, 2, 0x68),
672-
AT91_SAMA5D2_CHAN_SINGLE(3, 3, 0x6c),
673-
AT91_SAMA5D2_CHAN_SINGLE(4, 4, 0x70),
674-
AT91_SAMA5D2_CHAN_SINGLE(5, 5, 0x74),
675-
AT91_SAMA5D2_CHAN_SINGLE(6, 6, 0x78),
676-
AT91_SAMA5D2_CHAN_SINGLE(7, 7, 0x7c),
677-
AT91_SAMA5D2_CHAN_SINGLE(8, 8, 0x80),
678-
AT91_SAMA5D2_CHAN_SINGLE(9, 9, 0x84),
679-
AT91_SAMA5D2_CHAN_SINGLE(10, 10, 0x88),
680-
AT91_SAMA5D2_CHAN_SINGLE(11, 11, 0x8c),
681-
AT91_SAMA5D2_CHAN_SINGLE(12, 12, 0x90),
682-
AT91_SAMA5D2_CHAN_SINGLE(13, 13, 0x94),
683-
AT91_SAMA5D2_CHAN_SINGLE(14, 14, 0x98),
684-
AT91_SAMA5D2_CHAN_SINGLE(15, 15, 0x9c),
685-
AT91_SAMA5D2_CHAN_DIFF(16, 0, 1, 0x60),
686-
AT91_SAMA5D2_CHAN_DIFF(17, 2, 3, 0x68),
687-
AT91_SAMA5D2_CHAN_DIFF(18, 4, 5, 0x70),
688-
AT91_SAMA5D2_CHAN_DIFF(19, 6, 7, 0x78),
689-
AT91_SAMA5D2_CHAN_DIFF(20, 8, 9, 0x80),
690-
AT91_SAMA5D2_CHAN_DIFF(21, 10, 11, 0x88),
691-
AT91_SAMA5D2_CHAN_DIFF(22, 12, 13, 0x90),
692-
AT91_SAMA5D2_CHAN_DIFF(23, 14, 15, 0x98),
681+
AT91_SAMA7G5_CHAN_SINGLE(0, 0, 0x60),
682+
AT91_SAMA7G5_CHAN_SINGLE(1, 1, 0x64),
683+
AT91_SAMA7G5_CHAN_SINGLE(2, 2, 0x68),
684+
AT91_SAMA7G5_CHAN_SINGLE(3, 3, 0x6c),
685+
AT91_SAMA7G5_CHAN_SINGLE(4, 4, 0x70),
686+
AT91_SAMA7G5_CHAN_SINGLE(5, 5, 0x74),
687+
AT91_SAMA7G5_CHAN_SINGLE(6, 6, 0x78),
688+
AT91_SAMA7G5_CHAN_SINGLE(7, 7, 0x7c),
689+
AT91_SAMA7G5_CHAN_SINGLE(8, 8, 0x80),
690+
AT91_SAMA7G5_CHAN_SINGLE(9, 9, 0x84),
691+
AT91_SAMA7G5_CHAN_SINGLE(10, 10, 0x88),
692+
AT91_SAMA7G5_CHAN_SINGLE(11, 11, 0x8c),
693+
AT91_SAMA7G5_CHAN_SINGLE(12, 12, 0x90),
694+
AT91_SAMA7G5_CHAN_SINGLE(13, 13, 0x94),
695+
AT91_SAMA7G5_CHAN_SINGLE(14, 14, 0x98),
696+
AT91_SAMA7G5_CHAN_SINGLE(15, 15, 0x9c),
697+
AT91_SAMA7G5_CHAN_DIFF(16, 0, 1, 0x60),
698+
AT91_SAMA7G5_CHAN_DIFF(17, 2, 3, 0x68),
699+
AT91_SAMA7G5_CHAN_DIFF(18, 4, 5, 0x70),
700+
AT91_SAMA7G5_CHAN_DIFF(19, 6, 7, 0x78),
701+
AT91_SAMA7G5_CHAN_DIFF(20, 8, 9, 0x80),
702+
AT91_SAMA7G5_CHAN_DIFF(21, 10, 11, 0x88),
703+
AT91_SAMA7G5_CHAN_DIFF(22, 12, 13, 0x90),
704+
AT91_SAMA7G5_CHAN_DIFF(23, 14, 15, 0x98),
693705
IIO_CHAN_SOFT_TIMESTAMP(24),
694706
AT91_SAMA5D2_CHAN_TEMP(AT91_SAMA7G5_ADC_TEMP_CHANNEL, "temp", 0xdc),
695707
};

drivers/iio/adc/pac1921.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,11 +1198,11 @@ static int pac1921_match_acpi_device(struct iio_dev *indio_dev)
11981198

11991199
label = devm_kstrdup(dev, status->package.elements[0].string.pointer,
12001200
GFP_KERNEL);
1201+
ACPI_FREE(status);
12011202
if (!label)
12021203
return -ENOMEM;
12031204

12041205
indio_dev->label = label;
1205-
ACPI_FREE(status);
12061206

12071207
return 0;
12081208
}

drivers/iio/dac/ad3552r.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,12 @@ static int ad3552r_reset(struct ad3552r_desc *dac)
410410
return ret;
411411
}
412412

413+
/* Clear reset error flag, see ad3552r manual, rev B table 38. */
414+
ret = ad3552r_write_reg(dac, AD3552R_REG_ADDR_ERR_STATUS,
415+
AD3552R_MASK_RESET_STATUS);
416+
if (ret)
417+
return ret;
418+
413419
return ad3552r_update_reg_field(dac,
414420
AD3552R_REG_ADDR_INTERFACE_CONFIG_A,
415421
AD3552R_MASK_ADDR_ASCENSION,

drivers/iio/filter/admv8818.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -574,21 +574,15 @@ static int admv8818_init(struct admv8818_state *st)
574574
struct spi_device *spi = st->spi;
575575
unsigned int chip_id;
576576

577-
ret = regmap_update_bits(st->regmap, ADMV8818_REG_SPI_CONFIG_A,
578-
ADMV8818_SOFTRESET_N_MSK |
579-
ADMV8818_SOFTRESET_MSK,
580-
FIELD_PREP(ADMV8818_SOFTRESET_N_MSK, 1) |
581-
FIELD_PREP(ADMV8818_SOFTRESET_MSK, 1));
577+
ret = regmap_write(st->regmap, ADMV8818_REG_SPI_CONFIG_A,
578+
ADMV8818_SOFTRESET_N_MSK | ADMV8818_SOFTRESET_MSK);
582579
if (ret) {
583580
dev_err(&spi->dev, "ADMV8818 Soft Reset failed.\n");
584581
return ret;
585582
}
586583

587-
ret = regmap_update_bits(st->regmap, ADMV8818_REG_SPI_CONFIG_A,
588-
ADMV8818_SDOACTIVE_N_MSK |
589-
ADMV8818_SDOACTIVE_MSK,
590-
FIELD_PREP(ADMV8818_SDOACTIVE_N_MSK, 1) |
591-
FIELD_PREP(ADMV8818_SDOACTIVE_MSK, 1));
584+
ret = regmap_write(st->regmap, ADMV8818_REG_SPI_CONFIG_A,
585+
ADMV8818_SDOACTIVE_N_MSK | ADMV8818_SDOACTIVE_MSK);
592586
if (ret) {
593587
dev_err(&spi->dev, "ADMV8818 SDO Enable failed.\n");
594588
return ret;

drivers/iio/light/apds9306.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ static const struct part_id_gts_multiplier apds9306_gts_mul[] = {
108108
{
109109
.part_id = 0xB1,
110110
.max_scale_int = 16,
111-
.max_scale_nano = 3264320,
111+
.max_scale_nano = 326432000,
112112
}, {
113113
.part_id = 0xB3,
114114
.max_scale_int = 14,
115-
.max_scale_nano = 9712000,
115+
.max_scale_nano = 97120000,
116116
},
117117
};
118118

drivers/iio/light/hid-sensor-prox.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ static const u32 prox_sensitivity_addresses[] = {
4949
#define PROX_CHANNEL(_is_proximity, _channel) \
5050
{\
5151
.type = _is_proximity ? IIO_PROXIMITY : IIO_ATTENTION,\
52-
.info_mask_separate = _is_proximity ? BIT(IIO_CHAN_INFO_RAW) :\
53-
BIT(IIO_CHAN_INFO_PROCESSED),\
54-
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |\
52+
.info_mask_separate = \
53+
(_is_proximity ? BIT(IIO_CHAN_INFO_RAW) :\
54+
BIT(IIO_CHAN_INFO_PROCESSED)) |\
55+
BIT(IIO_CHAN_INFO_OFFSET) |\
5556
BIT(IIO_CHAN_INFO_SCALE) |\
5657
BIT(IIO_CHAN_INFO_SAMP_FREQ) |\
5758
BIT(IIO_CHAN_INFO_HYSTERESIS),\

drivers/iio/proximity/hx9023s.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,12 +1036,13 @@ static int hx9023s_send_cfg(const struct firmware *fw, struct hx9023s_data *data
10361036
return -ENOMEM;
10371037

10381038
memcpy(bin->data, fw->data, fw->size);
1039-
release_firmware(fw);
10401039

10411040
bin->fw_size = fw->size;
10421041
bin->fw_ver = bin->data[FW_VER_OFFSET];
10431042
bin->reg_count = get_unaligned_le16(bin->data + FW_REG_CNT_OFFSET);
10441043

1044+
release_firmware(fw);
1045+
10451046
return hx9023s_bin_load(data, bin);
10461047
}
10471048

0 commit comments

Comments
 (0)