All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Wei Ni <wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	mikko.perttunen-/1wQRMveznE@public.gmane.org,
	swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH V1 08/10] thermal: tegra: add PM support
Date: Wed, 13 Jan 2016 16:55:40 +0100	[thread overview]
Message-ID: <20160113155540.GH2588@ulmo> (raw)
In-Reply-To: <1452672043-475-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1643 bytes --]

On Wed, Jan 13, 2016 at 04:00:43PM +0800, Wei Ni wrote:
> Add suspend/resume function in soctherm driver.
> And enable it for Tegra124 and Tegra210.
> 
> Signed-off-by: Wei Ni <wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/thermal/tegra/tegra124_soctherm.c |   9 ++
>  drivers/thermal/tegra/tegra210_soctherm.c |   9 ++
>  drivers/thermal/tegra/tegra_soctherm.c    | 154 +++++++++++++++++++++---------
>  drivers/thermal/tegra/tegra_soctherm.h    |   5 +
>  4 files changed, 130 insertions(+), 47 deletions(-)

This all looks like it'd be a better candidate for runtime PM. The
implementation would be mostly the same, except that you'd need to
add a few more things to tegra_soctherm_probe() and use the runtime
PM API to enable/disable the device (clocks, resets, ...). System
sleep should then be taken care of automatically.

Another comment irrespective of that...

> diff --git a/drivers/thermal/tegra/tegra124_soctherm.c b/drivers/thermal/tegra/tegra124_soctherm.c
> index 13d7f4e3a3d7..04cb419dbabc 100644
> --- a/drivers/thermal/tegra/tegra124_soctherm.c
> +++ b/drivers/thermal/tegra/tegra124_soctherm.c
> @@ -205,6 +205,14 @@ static const struct of_device_id tegra124_soctherm_of_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, tegra_soctherm_of_match);
>  
> +#ifdef CONFIG_PM_SLEEP
> +static SIMPLE_DEV_PM_OPS(tegra124_soctherm_pm,
> +			 soctherm_suspend, soctherm_resume);
> +#define TEGRA124_SOC_THERM_PM      (&tegra124_soctherm_pm)
> +#else
> +#define TEGRA124_SOC_THERM_PM      NULL
> +#endif

I wouldn't bother with the #ifdef, just always define the structure.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Wei Ni <wni@nvidia.com>
Cc: rui.zhang@intel.com, mikko.perttunen@kapsi.fi,
	swarren@wwwdotorg.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V1 08/10] thermal: tegra: add PM support
Date: Wed, 13 Jan 2016 16:55:40 +0100	[thread overview]
Message-ID: <20160113155540.GH2588@ulmo> (raw)
In-Reply-To: <1452672043-475-1-git-send-email-wni@nvidia.com>

[-- Attachment #1: Type: text/plain, Size: 1614 bytes --]

On Wed, Jan 13, 2016 at 04:00:43PM +0800, Wei Ni wrote:
> Add suspend/resume function in soctherm driver.
> And enable it for Tegra124 and Tegra210.
> 
> Signed-off-by: Wei Ni <wni@nvidia.com>
> ---
>  drivers/thermal/tegra/tegra124_soctherm.c |   9 ++
>  drivers/thermal/tegra/tegra210_soctherm.c |   9 ++
>  drivers/thermal/tegra/tegra_soctherm.c    | 154 +++++++++++++++++++++---------
>  drivers/thermal/tegra/tegra_soctherm.h    |   5 +
>  4 files changed, 130 insertions(+), 47 deletions(-)

This all looks like it'd be a better candidate for runtime PM. The
implementation would be mostly the same, except that you'd need to
add a few more things to tegra_soctherm_probe() and use the runtime
PM API to enable/disable the device (clocks, resets, ...). System
sleep should then be taken care of automatically.

Another comment irrespective of that...

> diff --git a/drivers/thermal/tegra/tegra124_soctherm.c b/drivers/thermal/tegra/tegra124_soctherm.c
> index 13d7f4e3a3d7..04cb419dbabc 100644
> --- a/drivers/thermal/tegra/tegra124_soctherm.c
> +++ b/drivers/thermal/tegra/tegra124_soctherm.c
> @@ -205,6 +205,14 @@ static const struct of_device_id tegra124_soctherm_of_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, tegra_soctherm_of_match);
>  
> +#ifdef CONFIG_PM_SLEEP
> +static SIMPLE_DEV_PM_OPS(tegra124_soctherm_pm,
> +			 soctherm_suspend, soctherm_resume);
> +#define TEGRA124_SOC_THERM_PM      (&tegra124_soctherm_pm)
> +#else
> +#define TEGRA124_SOC_THERM_PM      NULL
> +#endif

I wouldn't bother with the #ifdef, just always define the structure.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-01-13 15:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-13  8:00 [PATCH V1 08/10] thermal: tegra: add PM support Wei Ni
2016-01-13  8:00 ` Wei Ni
     [not found] ` <1452672043-475-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-01-13 15:55   ` Thierry Reding [this message]
2016-01-13 15:55     ` Thierry Reding
2016-01-15  9:51     ` Wei Ni
2016-01-15  9:51       ` Wei Ni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160113155540.GH2588@ulmo \
    --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mikko.perttunen-/1wQRMveznE@public.gmane.org \
    --cc=rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.