[4/5] iio: adc: ti_am335x_adc: Disable ADC during suspend unconditionally
diff mbox

Message ID 20180630103318.25355-5-vigneshr@ti.com
State New
Headers show

Commit Message

Vignesh Raghavendra June 30, 2018, 10:33 a.m. UTC
Parent MFD device takes care of enabling ADC interface whenever
touchscreen is marked wakeup capable. Therefore, unconditionally disable
ADC interface during system suspend to save power in case of system with
just ADC and no TSC.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 drivers/iio/adc/ti_am335x_adc.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Comments

Jonathan Cameron June 30, 2018, 3:18 p.m. UTC | #1
On Sat, 30 Jun 2018 16:03:17 +0530
Vignesh R <vigneshr@ti.com> wrote:

> Parent MFD device takes care of enabling ADC interface whenever
> touchscreen is marked wakeup capable. Therefore, unconditionally disable
> ADC interface during system suspend to save power in case of system with
> just ADC and no TSC.
> 
> Signed-off-by: Vignesh R <vigneshr@ti.com>

This sounds like a sensible change to me.   Is it applicable without the
rest of the series?  If so I'll take it through IIO.  If the answer
is that it needs to go with the rest then

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Thanks,

Jonathan
> ---
>  drivers/iio/adc/ti_am335x_adc.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index 80df5a377d30..cafb1dcadc48 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -693,16 +693,12 @@ static int __maybe_unused tiadc_suspend(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct tiadc_device *adc_dev = iio_priv(indio_dev);
> -	struct ti_tscadc_dev *tscadc_dev;
>  	unsigned int idle;
>  
> -	tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
> -	if (!device_may_wakeup(tscadc_dev->dev)) {
> -		idle = tiadc_readl(adc_dev, REG_CTRL);
> -		idle &= ~(CNTRLREG_TSCSSENB);
> -		tiadc_writel(adc_dev, REG_CTRL, (idle |
> -				CNTRLREG_POWERDOWN));
> -	}
> +	idle = tiadc_readl(adc_dev, REG_CTRL);
> +	idle &= ~(CNTRLREG_TSCSSENB);
> +	tiadc_writel(adc_dev, REG_CTRL, (idle |
> +			CNTRLREG_POWERDOWN));
>  
>  	return 0;
>  }

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vignesh Raghavendra July 4, 2018, 2:40 p.m. UTC | #2
On Saturday 30 June 2018 08:48 PM, Jonathan Cameron wrote:
> On Sat, 30 Jun 2018 16:03:17 +0530
> Vignesh R <vigneshr@ti.com> wrote:
> 
>> Parent MFD device takes care of enabling ADC interface whenever
>> touchscreen is marked wakeup capable. Therefore, unconditionally disable
>> ADC interface during system suspend to save power in case of system with
>> just ADC and no TSC.
>>
>> Signed-off-by: Vignesh R <vigneshr@ti.com>
> 
> This sounds like a sensible change to me.   Is it applicable without the
> rest of the series?  If so I'll take it through IIO.  If the answer
> is that it needs to go with the rest then
> 

This patch as such does not have any compile time dependencies on other
patches, but I would like Dmitry's opinion on the series before being
merged.

> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 

Thanks!


Regards
Vignesh

> Thanks,
> 
> Jonathan
>> ---
>>  drivers/iio/adc/ti_am335x_adc.c | 12 ++++--------
>>  1 file changed, 4 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
>> index 80df5a377d30..cafb1dcadc48 100644
>> --- a/drivers/iio/adc/ti_am335x_adc.c
>> +++ b/drivers/iio/adc/ti_am335x_adc.c
>> @@ -693,16 +693,12 @@ static int __maybe_unused tiadc_suspend(struct device *dev)
>>  {
>>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>>  	struct tiadc_device *adc_dev = iio_priv(indio_dev);
>> -	struct ti_tscadc_dev *tscadc_dev;
>>  	unsigned int idle;
>>  
>> -	tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
>> -	if (!device_may_wakeup(tscadc_dev->dev)) {
>> -		idle = tiadc_readl(adc_dev, REG_CTRL);
>> -		idle &= ~(CNTRLREG_TSCSSENB);
>> -		tiadc_writel(adc_dev, REG_CTRL, (idle |
>> -				CNTRLREG_POWERDOWN));
>> -	}
>> +	idle = tiadc_readl(adc_dev, REG_CTRL);
>> +	idle &= ~(CNTRLREG_TSCSSENB);
>> +	tiadc_writel(adc_dev, REG_CTRL, (idle |
>> +			CNTRLREG_POWERDOWN));
>>  
>>  	return 0;
>>  }
>
Lee Jones Oct. 9, 2018, 10:30 a.m. UTC | #3
On Sat, 30 Jun 2018, Vignesh R wrote:

> Parent MFD device takes care of enabling ADC interface whenever
> touchscreen is marked wakeup capable. Therefore, unconditionally disable
> ADC interface during system suspend to save power in case of system with
> just ADC and no TSC.
> 
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
>  drivers/iio/adc/ti_am335x_adc.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)

Applied, thanks.

Patch
diff mbox

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 80df5a377d30..cafb1dcadc48 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -693,16 +693,12 @@  static int __maybe_unused tiadc_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
-	struct ti_tscadc_dev *tscadc_dev;
 	unsigned int idle;
 
-	tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
-	if (!device_may_wakeup(tscadc_dev->dev)) {
-		idle = tiadc_readl(adc_dev, REG_CTRL);
-		idle &= ~(CNTRLREG_TSCSSENB);
-		tiadc_writel(adc_dev, REG_CTRL, (idle |
-				CNTRLREG_POWERDOWN));
-	}
+	idle = tiadc_readl(adc_dev, REG_CTRL);
+	idle &= ~(CNTRLREG_TSCSSENB);
+	tiadc_writel(adc_dev, REG_CTRL, (idle |
+			CNTRLREG_POWERDOWN));
 
 	return 0;
 }