* [PATCH v3] iio: adc: ad7606: fix serial register access
@ 2025-04-18 18:37 Angelo Dureghello
2025-05-05 11:35 ` Angelo Dureghello
0 siblings, 1 reply; 3+ messages in thread
From: Angelo Dureghello @ 2025-04-18 18:37 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
David Lechner, Nuno Sá,
Andy Shevchenko, Beniamin Bia
Cc: Jonathan Cameron, linux-iio, linux-kernel, Angelo Dureghello
From: Angelo Dureghello <adureghello@baylibre.com>
Fix register read/write routine as per datasheet.
When reading multiple consecutive registers, only the first one is read
properly. This is due to missing chip select deassert and assert again
between first and second 16bit transfer, as shown in the datasheet
AD7606C-16, rev 0, figure 110.
Fixes: f2a22e1e172f ("iio: adc: ad7606: Add support for software mode for ad7616")
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
---
Changes in v3:
- fix typo in commit descritpion.
- Link to v2: https://lore.kernel.org/r/20250418-wip-bl-ad7606-fix-reg-access-v2-1-8b1ade67e185@baylibre.com
Changes in v2:
- improve bug description.
- Link to v1: https://lore.kernel.org/r/20250417-wip-bl-ad7606-fix-reg-access-v1-1-0ce341f3cfc3@baylibre.com
---
drivers/iio/adc/ad7606_spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c
index 997be483ebb93293481b922e13ece4edb47e940a..bd05357a542cf7234d5bb6b718829d6b720262cd 100644
--- a/drivers/iio/adc/ad7606_spi.c
+++ b/drivers/iio/adc/ad7606_spi.c
@@ -103,7 +103,7 @@ static int ad7606_spi_reg_read(struct ad7606_state *st, unsigned int addr)
{
.tx_buf = &st->d16[0],
.len = 2,
- .cs_change = 0,
+ .cs_change = 1,
}, {
.rx_buf = &st->d16[1],
.len = 2,
---
base-commit: 8dc6b228d746b1a900bed28568defb2266fa4c43
change-id: 20250417-wip-bl-ad7606-fix-reg-access-729c21478d1f
Best regards,
--
Angelo Dureghello <adureghello@baylibre.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v3] iio: adc: ad7606: fix serial register access
2025-04-18 18:37 [PATCH v3] iio: adc: ad7606: fix serial register access Angelo Dureghello
@ 2025-05-05 11:35 ` Angelo Dureghello
2025-05-05 12:15 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Angelo Dureghello @ 2025-05-05 11:35 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
David Lechner, Nuno Sá,
Andy Shevchenko, Beniamin Bia, linux-iio, linux-kernel
Hi Jonathan,
any news on this patch ? I would need it to proceed on other new ad7606
features,
Thanks a lot,
angelo
On 18.04.2025 20:37, Angelo Dureghello wrote:
> From: Angelo Dureghello <adureghello@baylibre.com>
>
> Fix register read/write routine as per datasheet.
>
> When reading multiple consecutive registers, only the first one is read
> properly. This is due to missing chip select deassert and assert again
> between first and second 16bit transfer, as shown in the datasheet
> AD7606C-16, rev 0, figure 110.
>
> Fixes: f2a22e1e172f ("iio: adc: ad7606: Add support for software mode for ad7616")
> Reviewed-by: David Lechner <dlechner@baylibre.com>
> Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
> ---
> Changes in v3:
> - fix typo in commit descritpion.
> - Link to v2: https://lore.kernel.org/r/20250418-wip-bl-ad7606-fix-reg-access-v2-1-8b1ade67e185@baylibre.com
>
> Changes in v2:
> - improve bug description.
> - Link to v1: https://lore.kernel.org/r/20250417-wip-bl-ad7606-fix-reg-access-v1-1-0ce341f3cfc3@baylibre.com
> ---
> drivers/iio/adc/ad7606_spi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c
> index 997be483ebb93293481b922e13ece4edb47e940a..bd05357a542cf7234d5bb6b718829d6b720262cd 100644
> --- a/drivers/iio/adc/ad7606_spi.c
> +++ b/drivers/iio/adc/ad7606_spi.c
> @@ -103,7 +103,7 @@ static int ad7606_spi_reg_read(struct ad7606_state *st, unsigned int addr)
> {
> .tx_buf = &st->d16[0],
> .len = 2,
> - .cs_change = 0,
> + .cs_change = 1,
> }, {
> .rx_buf = &st->d16[1],
> .len = 2,
>
> ---
> base-commit: 8dc6b228d746b1a900bed28568defb2266fa4c43
> change-id: 20250417-wip-bl-ad7606-fix-reg-access-729c21478d1f
>
> Best regards,
> --
> Angelo Dureghello <adureghello@baylibre.com>
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v3] iio: adc: ad7606: fix serial register access
2025-05-05 11:35 ` Angelo Dureghello
@ 2025-05-05 12:15 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2025-05-05 12:15 UTC (permalink / raw)
To: Angelo Dureghello
Cc: Jonathan Cameron, Lars-Peter Clausen, Michael Hennerich,
David Lechner, Nuno Sá,
Andy Shevchenko, Beniamin Bia, linux-iio, linux-kernel
On Mon, 5 May 2025 13:35:06 +0200
Angelo Dureghello <adureghello@baylibre.com> wrote:
> Hi Jonathan,
>
> any news on this patch ? I would need it to proceed on other new ad7606
> features,
>
Oops. I applied this and marked it as such in patchwork but didn't
reply to the mail. Sorry! It was in the pull request Greg took last week
for fixes but hasn't quite made it to upstream yet.
Just list it as a dependency in cover letter for new feature patches.
Jonathan
> Thanks a lot,
> angelo
>
> On 18.04.2025 20:37, Angelo Dureghello wrote:
> > From: Angelo Dureghello <adureghello@baylibre.com>
> >
> > Fix register read/write routine as per datasheet.
> >
> > When reading multiple consecutive registers, only the first one is read
> > properly. This is due to missing chip select deassert and assert again
> > between first and second 16bit transfer, as shown in the datasheet
> > AD7606C-16, rev 0, figure 110.
> >
> > Fixes: f2a22e1e172f ("iio: adc: ad7606: Add support for software mode for ad7616")
> > Reviewed-by: David Lechner <dlechner@baylibre.com>
> > Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
> > ---
> > Changes in v3:
> > - fix typo in commit descritpion.
> > - Link to v2: https://lore.kernel.org/r/20250418-wip-bl-ad7606-fix-reg-access-v2-1-8b1ade67e185@baylibre.com
> >
> > Changes in v2:
> > - improve bug description.
> > - Link to v1: https://lore.kernel.org/r/20250417-wip-bl-ad7606-fix-reg-access-v1-1-0ce341f3cfc3@baylibre.com
> > ---
> > drivers/iio/adc/ad7606_spi.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c
> > index 997be483ebb93293481b922e13ece4edb47e940a..bd05357a542cf7234d5bb6b718829d6b720262cd 100644
> > --- a/drivers/iio/adc/ad7606_spi.c
> > +++ b/drivers/iio/adc/ad7606_spi.c
> > @@ -103,7 +103,7 @@ static int ad7606_spi_reg_read(struct ad7606_state *st, unsigned int addr)
> > {
> > .tx_buf = &st->d16[0],
> > .len = 2,
> > - .cs_change = 0,
> > + .cs_change = 1,
> > }, {
> > .rx_buf = &st->d16[1],
> > .len = 2,
> >
> > ---
> > base-commit: 8dc6b228d746b1a900bed28568defb2266fa4c43
> > change-id: 20250417-wip-bl-ad7606-fix-reg-access-729c21478d1f
> >
> > Best regards,
> > --
> > Angelo Dureghello <adureghello@baylibre.com>
> >
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-05 12:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-18 18:37 [PATCH v3] iio: adc: ad7606: fix serial register access Angelo Dureghello
2025-05-05 11:35 ` Angelo Dureghello
2025-05-05 12:15 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®