devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Ying <victor.liu@nxp.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Sascha Hauer <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	Saravana Kannan <saravanak@google.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Rob Herring <robh@kernel.org>
Subject: Re: [PATCH v3 2/3] drivers: bus: simple-pm-bus: Use clocks
Date: Fri, 12 Aug 2022 20:25:20 +0800	[thread overview]
Message-ID: <16d50def88afcde1b7323d83e5c9a84d7df0c666.camel@nxp.com> (raw)
In-Reply-To: <CAMuHMdWLJ4t0GVXNWONwcSWuEBV6EuGTm4a2fumA_8dpD7TQuA@mail.gmail.com>

Hi Geert,

On Fri, 2022-08-12 at 11:49 +0200, Geert Uytterhoeven wrote:
> On Thu, Aug 4, 2022 at 8:10 AM Liu Ying <victor.liu@nxp.com> wrote:
> > Simple Power-Managed bus controller may need functional clock(s)
> > to be enabled before child devices connected to the bus can be
> > accessed.  Get the clock(s) as a bulk and enable/disable the
> > clock(s) when the bus is being power managed.
> > 
> > One example is that Freescale i.MX8qxp pixel link MSI bus
> > controller
> > needs MSI clock and AHB clock to be enabled before accessing child
> > devices.
> > 
> > Signed-off-by: Liu Ying <victor.liu@nxp.com>
> > ---
> > v1->v3:
> > * No change.
> 
> Thanks for your patch!
> 
> > --- a/drivers/bus/simple-pm-bus.c
> > +++ b/drivers/bus/simple-pm-bus.c
> > @@ -72,6 +89,42 @@ static int simple_pm_bus_remove(struct
> > platform_device *pdev)
> >         return 0;
> >  }
> > 
> > +static int simple_pm_bus_runtime_suspend(struct device *dev)
> > +{
> > +       struct simple_pm_bus *bus = dev_get_drvdata(dev);
> > +
> > +       if (!bus)
> > +               return 0;
> 
> Can this really happen?

Good question. Should not happen in any cases. pm_runtime_init() sets 
runtime_status to RPM_SUSPENDED and needs_force_resume to 0, so
simple_pm_bus_runtime_{suspend,resume} are only called for
simple-pm-bus, not the others. Unless I miss something, I would remove
the check here and ...

> 
> > +
> > +       clk_bulk_disable_unprepare(bus->num_clks, bus->clks);
> > +
> > +       return 0;
> > +}
> > +
> > +static int simple_pm_bus_runtime_resume(struct device *dev)
> > +{
> > +       struct simple_pm_bus *bus = dev_get_drvdata(dev);
> > +       int ret;
> > +
> > +       if (!bus)
> > +               return 0;
> 
> Likewise.

... here.

> 
> > +
> > +       ret = clk_bulk_prepare_enable(bus->num_clks, bus->clks);
> > +       if (ret) {
> > +               dev_err(dev, "failed to enable clocks: %d\n", ret);
> > +               return ret;
> > +       }
> > +
> > +       return 0;
> > +}
> 
> The rest LGTM, so
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thanks,
Liu Ying


  reply	other threads:[~2022-08-12 12:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04  6:11 [PATCH v3 0/3] drivers: bus: Add Freescale i.MX8qxp pixel link MSI bus support Liu Ying
2022-08-04  6:11 ` [PATCH v3 1/3] drivers: bus: simple-pm-bus: Populate simple MFD child devices Liu Ying
2022-08-04 12:18   ` Rob Herring
2022-08-04 18:26     ` Saravana Kannan
2022-08-05 10:06       ` Liu Ying
2022-08-05 17:55         ` Saravana Kannan
2022-08-06 16:23           ` Liu Ying
2022-08-04  6:11 ` [PATCH v3 2/3] drivers: bus: simple-pm-bus: Use clocks Liu Ying
2022-08-11 12:34   ` Geert Uytterhoeven
2022-08-12  8:13     ` Liu Ying
2022-08-12  8:58       ` Geert Uytterhoeven
2022-08-12  9:42         ` Liu Ying
2022-08-12  9:49   ` Geert Uytterhoeven
2022-08-12 12:25     ` Liu Ying [this message]
2022-08-04  6:11 ` [PATCH v3 3/3] dt-bindings: bus: Add Freescale i.MX8qxp pixel link MSI bus binding Liu Ying
2022-08-04 11:17   ` Krzysztof Kozlowski
2022-08-05 10:18     ` Liu Ying

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=16d50def88afcde1b7323d83e5c9a84d7df0c666.camel@nxp.com \
    --to=victor.liu@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=saravanak@google.com \
    --cc=shawnguo@kernel.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).