linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
To: Chris Zhong <zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
	groeck-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	wulf-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
	briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org,
	dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org
Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v2 1/2] phy: rockchip-typec: add pm runtime support
Date: Thu, 8 Sep 2016 10:54:34 +0530	[thread overview]
Message-ID: <57D0F612.10702@ti.com> (raw)
In-Reply-To: <1473289577-14101-1-git-send-email-zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>

Hi,

On Thursday 08 September 2016 04:36 AM, Chris Zhong wrote:
> Adds pm_runtime support for rockchip Type-C, so that power domain is
> enabled only when there is a transaction going on to help save power.
> 
> Signed-off-by: Chris Zhong <zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
> 
> Changes in v2:
> -- add pm_runtime_put_sync in err case
> 
>  drivers/phy/phy-rockchip-typec.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/phy/phy-rockchip-typec.c b/drivers/phy/phy-rockchip-typec.c
> index fb58a27..0b2f528 100644
> --- a/drivers/phy/phy-rockchip-typec.c
> +++ b/drivers/phy/phy-rockchip-typec.c
> @@ -552,6 +552,12 @@ static int tcphy_phy_init(struct rockchip_typec_phy *tcphy, u8 mode)
>  		goto err_clk_core;
>  	}
>  
> +	ret = pm_runtime_get_sync(tcphy->dev);
> +	if (ret < 0) {
> +		dev_err(tcphy->dev, "cannot get pm runtime %d\n", ret);
> +		goto err_clk_ref;
> +	}

phy_core will do get_sync for you if.. <see below>
> +
>  	reset_control_deassert(tcphy->tcphy_rst);
>  
>  	property_enable(tcphy, &cfg->typec_conn_dir, tcphy->flip);
> @@ -600,8 +606,10 @@ static int tcphy_phy_init(struct rockchip_typec_phy *tcphy, u8 mode)
>  	return 0;
>  
>  err_wait_pma:
> +	pm_runtime_put_sync(tcphy->dev);
>  	reset_control_assert(tcphy->uphy_rst);
>  	reset_control_assert(tcphy->tcphy_rst);
> +err_clk_ref:
>  	clk_disable_unprepare(tcphy->clk_ref);
>  err_clk_core:
>  	clk_disable_unprepare(tcphy->clk_core);
> @@ -610,6 +618,7 @@ err_clk_core:
>  
>  static void tcphy_phy_deinit(struct rockchip_typec_phy *tcphy)
>  {
> +	pm_runtime_put_sync(tcphy->dev);
>  	reset_control_assert(tcphy->tcphy_rst);
>  	reset_control_assert(tcphy->uphy_rst);
>  	reset_control_assert(tcphy->pipe_rst);
> @@ -987,6 +996,15 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
>  		return PTR_ERR(phy_provider);
>  	}
>  
> +	pm_runtime_enable(dev);

... pm_runtime_enable is invoked before phy_create.

Thanks
Kishon

  parent reply	other threads:[~2016-09-08  5:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-07 23:06 [PATCH v2 1/2] phy: rockchip-typec: add pm runtime support Chris Zhong
2016-09-07 23:06 ` [PATCH v2 2/2] arm64: dts: rk3399: add powerdomain for typec Chris Zhong
     [not found]   ` <1473289577-14101-2-git-send-email-zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-09-08 15:16     ` Heiko Stuebner
     [not found] ` <1473289577-14101-1-git-send-email-zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-09-08  5:24   ` Kishon Vijay Abraham I [this message]
     [not found]     ` <57D0F612.10702-l0cyMroinI0@public.gmane.org>
2016-09-08  5:57       ` [RESEND PATCH v3 1/2] phy: rockchip-typec: add pm runtime support Chris Zhong
2016-09-08 15:31         ` Guenter Roeck

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=57D0F612.10702@ti.com \
    --to=kishon-l0cymroini0@public.gmane.org \
    --cc=briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=groeck-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
    --cc=kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=wulf-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=zyw-TNX95d0MmH7DzftRWevZcw@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 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).