Patch "iio: adc: at91-sama5d2_adc: disable/prepare buffer on suspend/resume" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    iio: adc: at91-sama5d2_adc: disable/prepare buffer on suspend/resume

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iio-adc-at91-sama5d2_adc-disable-prepare-buffer-on-s.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f811f5ff1d2f878de3ab4b2d003d7be526d6bd2a
Author: Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>
Date:   Wed Aug 3 13:28:40 2022 +0300

    iio: adc: at91-sama5d2_adc: disable/prepare buffer on suspend/resume
    
    [ Upstream commit 808175e21d9b7f866eda742e8970f27b78afe5db ]
    
    In case triggered buffers are enabled while system is suspended they will
    not work anymore after resume. For this call at91_adc_buffer_postdisable()
    on suspend and at91_adc_buffer_prepare() on resume. On tests it has been
    seen that at91_adc_buffer_postdisable() call is not necessary but it has
    been kept because it also does the book keeping for DMA. On resume path
    there is no need to call at91_adc_configure_touch() as it is embedded in
    at91_adc_buffer_prepare().
    
    Fixes: 073c662017f2f ("iio: adc: at91-sama5d2_adc: add support for DMA")
    Signed-off-by: Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220803102855.2191070-5-claudiu.beznea@xxxxxxxxxxxxx
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index ef6dc85024c1..250b78ee1625 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -1907,6 +1907,9 @@ static __maybe_unused int at91_adc_suspend(struct device *dev)
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(indio_dev);
 
+	if (iio_buffer_enabled(indio_dev))
+		at91_adc_buffer_postdisable(indio_dev);
+
 	/*
 	 * Do a sofware reset of the ADC before we go to suspend.
 	 * this will ensure that all pins are free from being muxed by the ADC
@@ -1950,14 +1953,11 @@ static __maybe_unused int at91_adc_resume(struct device *dev)
 	if (!iio_buffer_enabled(indio_dev))
 		return 0;
 
-	/* check if we are enabling triggered buffer or the touchscreen */
-	if (at91_adc_current_chan_is_touch(indio_dev))
-		return at91_adc_configure_touch(st, true);
-	else
-		return at91_adc_configure_trigger(st->trig, true);
+	ret = at91_adc_buffer_prepare(indio_dev);
+	if (ret)
+		goto vref_disable_resume;
 
-	/* not needed but more explicit */
-	return 0;
+	return at91_adc_configure_trigger(st->trig, true);
 
 vref_disable_resume:
 	regulator_disable(st->vref);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux