stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] iio: adc: at91-sama5d2_adc: fix differential channels in" failed to apply to 4.14-stable tree
@ 2020-03-23 14:17 gregkh
  2020-03-23 16:20 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2020-03-23 14:17 UTC (permalink / raw)
  To: eugen.hristev, Jonathan.Cameron, Stable; +Cc: stable


The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From a500f3bd787f8224341e44b238f318c407b10897 Mon Sep 17 00:00:00 2001
From: Eugen Hristev <eugen.hristev@microchip.com>
Date: Tue, 28 Jan 2020 12:57:39 +0000
Subject: [PATCH] iio: adc: at91-sama5d2_adc: fix differential channels in
 triggered mode

The differential channels require writing the channel offset register (COR).
Otherwise they do not work in differential mode.
The configuration of COR is missing in triggered mode.

Fixes: 5e1a1da0f8c9 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index a5c7771227d5..9d96f7d08b95 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -723,6 +723,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
 
 	for_each_set_bit(bit, indio->active_scan_mask, indio->num_channels) {
 		struct iio_chan_spec const *chan = at91_adc_chan_get(indio, bit);
+		u32 cor;
 
 		if (!chan)
 			continue;
@@ -731,6 +732,20 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
 		    chan->type == IIO_PRESSURE)
 			continue;
 
+		if (state) {
+			cor = at91_adc_readl(st, AT91_SAMA5D2_COR);
+
+			if (chan->differential)
+				cor |= (BIT(chan->channel) |
+					BIT(chan->channel2)) <<
+					AT91_SAMA5D2_COR_DIFF_OFFSET;
+			else
+				cor &= ~(BIT(chan->channel) <<
+				       AT91_SAMA5D2_COR_DIFF_OFFSET);
+
+			at91_adc_writel(st, AT91_SAMA5D2_COR, cor);
+		}
+
 		if (state) {
 			at91_adc_writel(st, AT91_SAMA5D2_CHER,
 					BIT(chan->channel));


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: FAILED: patch "[PATCH] iio: adc: at91-sama5d2_adc: fix differential channels in" failed to apply to 4.14-stable tree
  2020-03-23 14:17 FAILED: patch "[PATCH] iio: adc: at91-sama5d2_adc: fix differential channels in" failed to apply to 4.14-stable tree gregkh
@ 2020-03-23 16:20 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2020-03-23 16:20 UTC (permalink / raw)
  To: gregkh; +Cc: eugen.hristev, Jonathan.Cameron, Stable

On Mon, Mar 23, 2020 at 03:17:46PM +0100, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 4.14-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From a500f3bd787f8224341e44b238f318c407b10897 Mon Sep 17 00:00:00 2001
>From: Eugen Hristev <eugen.hristev@microchip.com>
>Date: Tue, 28 Jan 2020 12:57:39 +0000
>Subject: [PATCH] iio: adc: at91-sama5d2_adc: fix differential channels in
> triggered mode
>
>The differential channels require writing the channel offset register (COR).
>Otherwise they do not work in differential mode.
>The configuration of COR is missing in triggered mode.
>
>Fixes: 5e1a1da0f8c9 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support")
>Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
>Cc: <Stable@vger.kernel.org>
>Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

This patch depended on f0c8d1f6dc8e ("iio: adc: at91-sama5d2_adc: fix
channel configuration for differential channels") which is itself a
stable tagged commit, so I took it too.

Both depended on 073c662017f2 ("iio: adc: at91-sama5d2_adc: add support
for DMA"). I've fixed them up to remove the DMA bits and queued for
4.14.

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-23 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 14:17 FAILED: patch "[PATCH] iio: adc: at91-sama5d2_adc: fix differential channels in" failed to apply to 4.14-stable tree gregkh
2020-03-23 16:20 ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).