[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<CY4PR03MB33992F19FF780FF86234426A9B7E2@CY4PR03MB3399.namprd03.prod.outlook.com>
Date: Tue, 8 Oct 2024 10:48:07 +0000
From: "Miclaus, Antoniu" <Antoniu.Miclaus@...log.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
CC: Jonathan Cameron <jic23@...nel.org>, Lars-Peter Clausen <lars@...afoo.de>,
"Hennerich, Michael" <Michael.Hennerich@...log.com>,
Rob Herring
<robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley
<conor+dt@...nel.org>, "Sa, Nuno" <Nuno.Sa@...log.com>,
Olivier Moysan
<olivier.moysan@...s.st.com>,
Uwe Kleine-König
<ukleinek@...nel.org>,
Andy Shevchenko <andy@...nel.org>,
David Lechner
<dlechner@...libre.com>,
"Schmitt, Marcelo" <Marcelo.Schmitt@...log.com>,
Mike Looijmans <mike.looijmans@...ic.nl>,
Marius Cristea
<marius.cristea@...rochip.com>,
Dumitru Ceclan <mitrutzceclan@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Alisa-Dariana Roman <alisadariana@...il.com>,
Ivan Mikhaylov
<fr0st61te@...il.com>,
"Cuciurean, Sergiu" <Sergiu.Cuciurean@...log.com>,
"Bogdan, Dragos" <Dragos.Bogdan@...log.com>,
"linux-iio@...r.kernel.org"
<linux-iio@...r.kernel.org>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>,
"linux-pwm@...r.kernel.org"
<linux-pwm@...r.kernel.org>
Subject: RE: [PATCH v2 6/7] iio: adc: ad485x: add ad485x driver
> > +static int ad485x_get_calibscale(struct ad485x_state *st, int ch, int *val, int
> *val2)
> > +{
> > + unsigned int reg_val;
> > + int gain;
>
> Should be u8 gain[2] and...
As discussed in previous patch series, the bulk operations won't work for these
chips. The CS needs to be raised between each byte read/written.
Therefore using u8 gain[2] here and in other places will be just an extra populated
array since regmap_read requires `unsigned int` as input.
For the set functions indeed it is feasible since you can pass u8 directly to regmap_write.
Regards,
Antoniu
> > + int ret;
> > +
> > + guard(mutex)(&st->lock);
> > +
> > + ret = regmap_read(st->regmap, AD485X_REG_CHX_GAIN_MSB(ch),
> > + ®_val);
> > + if (ret)
> > + return ret;
> > +
> > + gain = (reg_val & 0xFF) << 8;
> > +
> > + ret = regmap_read(st->regmap, AD485X_REG_CHX_GAIN_LSB(ch),
> > + ®_val);
> > + if (ret)
> > + return ret;
> > +
> > + gain |= reg_val & 0xFF;
>
...
Powered by blists - more mailing lists