Skip to content

Commit 22638b6

Browse files
Sam Winchenbachgregkh
authored andcommitted
iio: filter: admv8818: Force initialization of SDO
commit cc2c3540d9477a9931fb0fd851fcaeba524a5b35 upstream. When a weak pull-up is present on the SDO line, regmap_update_bits fails to write both the SOFTRESET and SDOACTIVE bits because it incorrectly reads them as already set. Since the soft reset disables the SDO line, performing a read-modify-write operation on ADI_SPI_CONFIG_A to enable the SDO line doesn't make sense. This change directly writes to the register instead of using regmap_update_bits. Fixes: f34fe88 ("iio:filter:admv8818: add support for ADMV8818") Signed-off-by: Sam Winchenbach <[email protected]> Link: https://patch.msgid.link/SA1P110MB106904C961B0F3FAFFED74C0BCF5A@SA1P110MB1069.NAMP110.PROD.OUTLOOK.COM Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 524f29d commit 22638b6

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/iio/filter/admv8818.c

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

530-
ret = regmap_update_bits(st->regmap, ADMV8818_REG_SPI_CONFIG_A,
531-
ADMV8818_SOFTRESET_N_MSK |
532-
ADMV8818_SOFTRESET_MSK,
533-
FIELD_PREP(ADMV8818_SOFTRESET_N_MSK, 1) |
534-
FIELD_PREP(ADMV8818_SOFTRESET_MSK, 1));
530+
ret = regmap_write(st->regmap, ADMV8818_REG_SPI_CONFIG_A,
531+
ADMV8818_SOFTRESET_N_MSK | ADMV8818_SOFTRESET_MSK);
535532
if (ret) {
536533
dev_err(&spi->dev, "ADMV8818 Soft Reset failed.\n");
537534
return ret;
538535
}
539536

540-
ret = regmap_update_bits(st->regmap, ADMV8818_REG_SPI_CONFIG_A,
541-
ADMV8818_SDOACTIVE_N_MSK |
542-
ADMV8818_SDOACTIVE_MSK,
543-
FIELD_PREP(ADMV8818_SDOACTIVE_N_MSK, 1) |
544-
FIELD_PREP(ADMV8818_SDOACTIVE_MSK, 1));
537+
ret = regmap_write(st->regmap, ADMV8818_REG_SPI_CONFIG_A,
538+
ADMV8818_SDOACTIVE_N_MSK | ADMV8818_SDOACTIVE_MSK);
545539
if (ret) {
546540
dev_err(&spi->dev, "ADMV8818 SDO Enable failed.\n");
547541
return ret;

0 commit comments

Comments
 (0)