> On Sat, 25 Jan 2025 14:54:44 +0000 > Sam Winchenbach <swinchenbach@xxxxxxxx> wrote: > > > 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. > > I can see this as a valid micro optimization but I'm struggling a bit > on how you can use the device if the pull up is weak enough that > you can't read data back from it. Does the reset in some way > solve that? > > Having asked for the fixes tag, I'm less sure on whether this is a fix. > > Antoniu, I'd also like your input on this one! > Indeed, this can be considered as a "bug". I had a look over the datasheet and the SDO line is disabled by default. So the `update_bits` doesn't quite make sense in this scenario. > > > > 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: f34fe888ad05 ("iio:filter:admv8818: add support for ADMV8818") > > > > No blank line here. Fixes is part of the tags block that various scripts > scan. > > > Signed-off-by: Sam Winchenbach <swinchenbach@xxxxxxxx> > > --- > > drivers/iio/filter/admv8818.c | 14 ++++---------- > > 1 file changed, 4 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/iio/filter/admv8818.c b/drivers/iio/filter/admv8818.c > > index 195e58bc4..9cd1eee84 100644 > > --- a/drivers/iio/filter/admv8818.c > > +++ b/drivers/iio/filter/admv8818.c > > @@ -577,21 +577,15 @@ static int admv8818_init(struct admv8818_state > *st) > > struct spi_device *spi = st->spi; > > unsigned int chip_id; > > > > - ret = regmap_update_bits(st->regmap, > ADMV8818_REG_SPI_CONFIG_A, > > - ADMV8818_SOFTRESET_N_MSK | > > - ADMV8818_SOFTRESET_MSK, > > - > FIELD_PREP(ADMV8818_SOFTRESET_N_MSK, 1) | > > - FIELD_PREP(ADMV8818_SOFTRESET_MSK, > 1)); > > + ret = regmap_write(st->regmap, ADMV8818_REG_SPI_CONFIG_A, > > + ADMV8818_SOFTRESET_N_MSK | > ADMV8818_SOFTRESET_MSK); > > if (ret) { > > dev_err(&spi->dev, "ADMV8818 Soft Reset failed.\n"); > > return ret; > > } > > > > - ret = regmap_update_bits(st->regmap, > ADMV8818_REG_SPI_CONFIG_A, > > - ADMV8818_SDOACTIVE_N_MSK | > > - ADMV8818_SDOACTIVE_MSK, > > - > FIELD_PREP(ADMV8818_SDOACTIVE_N_MSK, 1) | > > - FIELD_PREP(ADMV8818_SDOACTIVE_MSK, > 1)); > > + ret = regmap_write(st->regmap, ADMV8818_REG_SPI_CONFIG_A, > > + ADMV8818_SDOACTIVE_N_MSK | > ADMV8818_SDOACTIVE_MSK); > > if (ret) { > > dev_err(&spi->dev, "ADMV8818 SDO Enable failed.\n"); > > return ret;