diff mbox series

[3/4] iio: adc: mediatek: SET_LATE_SYSTEM_SLEEP_PM_OPS support

Message ID 1557994247-16739-4-git-send-email-chun-hung.wu@mediatek.com (mailing list archive)
State New, archived
Headers show
Series iio: adc: mediatek: add mt6765 driver support | expand

Commit Message

Chun-Hung Wu (巫駿宏) May 16, 2019, 8:10 a.m. UTC
Move suspend/resume to late_suspend and
early_resume to gurantee users can use auxadc
driver at suspend/resume stage.

Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
---
 drivers/iio/adc/mt6577_auxadc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Jonathan Cameron May 18, 2019, 10:35 a.m. UTC | #1
On Thu, 16 May 2019 16:10:46 +0800
Chun-Hung Wu <chun-hung.wu@mediatek.com> wrote:

>   Move suspend/resume to late_suspend and
> early_resume to gurantee users can use auxadc
guarantee

> driver at suspend/resume stage.
No problem with the patch content, but we need a reason why they may
want to do so?

Thanks,

Jonathan
> 
> Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
> ---
>  drivers/iio/adc/mt6577_auxadc.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c
> index e1bdcc0..58d7cb2 100644
> --- a/drivers/iio/adc/mt6577_auxadc.c
> +++ b/drivers/iio/adc/mt6577_auxadc.c
> @@ -326,9 +326,10 @@ static int mt6577_auxadc_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
> -			 mt6577_auxadc_suspend,
> -			 mt6577_auxadc_resume);
> +static const struct dev_pm_ops mt6577_auxadc_pm_ops = {
> +	SET_LATE_SYSTEM_SLEEP_PM_OPS(mt6577_auxadc_suspend,
> +				     mt6577_auxadc_resume)
> +};
>  
>  static const struct of_device_id mt6577_auxadc_of_match[] = {
>  	{ .compatible = "mediatek,mt2701-auxadc", .data = &mt8173_compat},
Chun-Hung Wu (巫駿宏) May 20, 2019, 6:03 a.m. UTC | #2
Hi Jonathan:

  Thanks for the prompt reply,

On Sat, 2019-05-18 at 11:35 +0100, Jonathan Cameron wrote:
> On Thu, 16 May 2019 16:10:46 +0800
> Chun-Hung Wu <chun-hung.wu@mediatek.com> wrote:
> 
> >   Move suspend/resume to late_suspend and
> > early_resume to gurantee users can use auxadc
> guarantee
> 
will fix it in next version.
> > driver at suspend/resume stage.
> No problem with the patch content, but we need a reason why they may
> want to do so?
Our thermal drivers uses auxadc at suspend/resume stage.
In order to avoid auxadc suspended prior to thermal driver,
we move auxadc to late_suspend and early_resume.

Thanks,
Chun-Hung
> 
> Thanks,
> 
> Jonathan
> > 
> > Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
> > ---
> >  drivers/iio/adc/mt6577_auxadc.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c
> > index e1bdcc0..58d7cb2 100644
> > --- a/drivers/iio/adc/mt6577_auxadc.c
> > +++ b/drivers/iio/adc/mt6577_auxadc.c
> > @@ -326,9 +326,10 @@ static int mt6577_auxadc_remove(struct platform_device *pdev)
> >  	return 0;
> >  }
> >  
> > -static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
> > -			 mt6577_auxadc_suspend,
> > -			 mt6577_auxadc_resume);
> > +static const struct dev_pm_ops mt6577_auxadc_pm_ops = {
> > +	SET_LATE_SYSTEM_SLEEP_PM_OPS(mt6577_auxadc_suspend,
> > +				     mt6577_auxadc_resume)
> > +};
> >  
> >  static const struct of_device_id mt6577_auxadc_of_match[] = {
> >  	{ .compatible = "mediatek,mt2701-auxadc", .data = &mt8173_compat},
>
Matthias Brugger May 22, 2019, 4:28 p.m. UTC | #3
On 20/05/2019 08:03, Chun-Hung Wu wrote:
> Hi Jonathan:
> 
>   Thanks for the prompt reply,
> 
> On Sat, 2019-05-18 at 11:35 +0100, Jonathan Cameron wrote:
>> On Thu, 16 May 2019 16:10:46 +0800
>> Chun-Hung Wu <chun-hung.wu@mediatek.com> wrote:
>>
>>>   Move suspend/resume to late_suspend and
>>> early_resume to gurantee users can use auxadc
>> guarantee
>>
> will fix it in next version.
>>> driver at suspend/resume stage.
>> No problem with the patch content, but we need a reason why they may
>> want to do so?
> Our thermal drivers uses auxadc at suspend/resume stage.
> In order to avoid auxadc suspended prior to thermal driver,
> we move auxadc to late_suspend and early_resume.
> 

That sounds like a user of device_links [1] to me.

[1] https://www.kernel.org/doc/html/latest/driver-api/device_link.html

> Thanks,
> Chun-Hung
>>
>> Thanks,
>>
>> Jonathan
>>>
>>> Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
>>> ---
>>>  drivers/iio/adc/mt6577_auxadc.c | 7 ++++---
>>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c
>>> index e1bdcc0..58d7cb2 100644
>>> --- a/drivers/iio/adc/mt6577_auxadc.c
>>> +++ b/drivers/iio/adc/mt6577_auxadc.c
>>> @@ -326,9 +326,10 @@ static int mt6577_auxadc_remove(struct platform_device *pdev)
>>>  	return 0;
>>>  }
>>>  
>>> -static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
>>> -			 mt6577_auxadc_suspend,
>>> -			 mt6577_auxadc_resume);
>>> +static const struct dev_pm_ops mt6577_auxadc_pm_ops = {
>>> +	SET_LATE_SYSTEM_SLEEP_PM_OPS(mt6577_auxadc_suspend,
>>> +				     mt6577_auxadc_resume)
>>> +};
>>>  
>>>  static const struct of_device_id mt6577_auxadc_of_match[] = {
>>>  	{ .compatible = "mediatek,mt2701-auxadc", .data = &mt8173_compat},
>>
> 
>
Chun-Hung Wu (巫駿宏) May 28, 2019, 10:59 a.m. UTC | #4
Hi Matthias:

  Thanks for your suggestion, I think device_links is a good way to
make dependency of module's suspend/resume order.

Hi Jonathan:

  Is it ok to keep using late_suspend and early_resume, or do you think
it's better to use device_links?

Thanks,
Chun-Hung
On Wed, 2019-05-22 at 18:28 +0200, Matthias Brugger wrote:
> 
> On 20/05/2019 08:03, Chun-Hung Wu wrote:
> > Hi Jonathan:
> > 
> >   Thanks for the prompt reply,
> > 
> > On Sat, 2019-05-18 at 11:35 +0100, Jonathan Cameron wrote:
> >> On Thu, 16 May 2019 16:10:46 +0800
> >> Chun-Hung Wu <chun-hung.wu@mediatek.com> wrote:
> >>
> >>>   Move suspend/resume to late_suspend and
> >>> early_resume to gurantee users can use auxadc
> >> guarantee
> >>
> > will fix it in next version.
> >>> driver at suspend/resume stage.
> >> No problem with the patch content, but we need a reason why they may
> >> want to do so?
> > Our thermal drivers uses auxadc at suspend/resume stage.
> > In order to avoid auxadc suspended prior to thermal driver,
> > we move auxadc to late_suspend and early_resume.
> > 
> 
> That sounds like a user of device_links [1] to me.
> 
> [1] https://www.kernel.org/doc/html/latest/driver-api/device_link.html
> 
> > Thanks,
> > Chun-Hung
> >>
> >> Thanks,
> >>
> >> Jonathan
> >>>
> >>> Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
> >>> ---
> >>>  drivers/iio/adc/mt6577_auxadc.c | 7 ++++---
> >>>  1 file changed, 4 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c
> >>> index e1bdcc0..58d7cb2 100644
> >>> --- a/drivers/iio/adc/mt6577_auxadc.c
> >>> +++ b/drivers/iio/adc/mt6577_auxadc.c
> >>> @@ -326,9 +326,10 @@ static int mt6577_auxadc_remove(struct platform_device *pdev)
> >>>  	return 0;
> >>>  }
> >>>  
> >>> -static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
> >>> -			 mt6577_auxadc_suspend,
> >>> -			 mt6577_auxadc_resume);
> >>> +static const struct dev_pm_ops mt6577_auxadc_pm_ops = {
> >>> +	SET_LATE_SYSTEM_SLEEP_PM_OPS(mt6577_auxadc_suspend,
> >>> +				     mt6577_auxadc_resume)
> >>> +};
> >>>  
> >>>  static const struct of_device_id mt6577_auxadc_of_match[] = {
> >>>  	{ .compatible = "mediatek,mt2701-auxadc", .data = &mt8173_compat},
> >>
> > 
> >
Jonathan Cameron June 6, 2019, 3:46 p.m. UTC | #5
On Tue, 28 May 2019 18:59:56 +0800
Chun-Hung Wu <chun-hung.wu@mediatek.com> wrote:

> Hi Matthias:
> 
>   Thanks for your suggestion, I think device_links is a good way to
> make dependency of module's suspend/resume order.
> 
> Hi Jonathan:
> 
>   Is it ok to keep using late_suspend and early_resume, or do you think
> it's better to use device_links?
I think device links would be preferable as the reasoning becomes explicit.
As I understand them they are also a less fragile solution.

Thanks,

Jonathan

> 
> Thanks,
> Chun-Hung
> On Wed, 2019-05-22 at 18:28 +0200, Matthias Brugger wrote:
> > 
> > On 20/05/2019 08:03, Chun-Hung Wu wrote:  
> > > Hi Jonathan:
> > > 
> > >   Thanks for the prompt reply,
> > > 
> > > On Sat, 2019-05-18 at 11:35 +0100, Jonathan Cameron wrote:  
> > >> On Thu, 16 May 2019 16:10:46 +0800
> > >> Chun-Hung Wu <chun-hung.wu@mediatek.com> wrote:
> > >>  
> > >>>   Move suspend/resume to late_suspend and
> > >>> early_resume to gurantee users can use auxadc  
> > >> guarantee
> > >>  
> > > will fix it in next version.  
> > >>> driver at suspend/resume stage.  
> > >> No problem with the patch content, but we need a reason why they may
> > >> want to do so?  
> > > Our thermal drivers uses auxadc at suspend/resume stage.
> > > In order to avoid auxadc suspended prior to thermal driver,
> > > we move auxadc to late_suspend and early_resume.
> > >   
> > 
> > That sounds like a user of device_links [1] to me.
> > 
> > [1] https://www.kernel.org/doc/html/latest/driver-api/device_link.html
> >   
> > > Thanks,
> > > Chun-Hung  
> > >>
> > >> Thanks,
> > >>
> > >> Jonathan  
> > >>>
> > >>> Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
> > >>> ---
> > >>>  drivers/iio/adc/mt6577_auxadc.c | 7 ++++---
> > >>>  1 file changed, 4 insertions(+), 3 deletions(-)
> > >>>
> > >>> diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c
> > >>> index e1bdcc0..58d7cb2 100644
> > >>> --- a/drivers/iio/adc/mt6577_auxadc.c
> > >>> +++ b/drivers/iio/adc/mt6577_auxadc.c
> > >>> @@ -326,9 +326,10 @@ static int mt6577_auxadc_remove(struct platform_device *pdev)
> > >>>  	return 0;
> > >>>  }
> > >>>  
> > >>> -static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
> > >>> -			 mt6577_auxadc_suspend,
> > >>> -			 mt6577_auxadc_resume);
> > >>> +static const struct dev_pm_ops mt6577_auxadc_pm_ops = {
> > >>> +	SET_LATE_SYSTEM_SLEEP_PM_OPS(mt6577_auxadc_suspend,
> > >>> +				     mt6577_auxadc_resume)
> > >>> +};
> > >>>  
> > >>>  static const struct of_device_id mt6577_auxadc_of_match[] = {
> > >>>  	{ .compatible = "mediatek,mt2701-auxadc", .data = &mt8173_compat},  
> > >>  
> > > 
> > >   
> 
>
diff mbox series

Patch

diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c
index e1bdcc0..58d7cb2 100644
--- a/drivers/iio/adc/mt6577_auxadc.c
+++ b/drivers/iio/adc/mt6577_auxadc.c
@@ -326,9 +326,10 @@  static int mt6577_auxadc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
-			 mt6577_auxadc_suspend,
-			 mt6577_auxadc_resume);
+static const struct dev_pm_ops mt6577_auxadc_pm_ops = {
+	SET_LATE_SYSTEM_SLEEP_PM_OPS(mt6577_auxadc_suspend,
+				     mt6577_auxadc_resume)
+};
 
 static const struct of_device_id mt6577_auxadc_of_match[] = {
 	{ .compatible = "mediatek,mt2701-auxadc", .data = &mt8173_compat},