[PATCH v3 2/3] drivers: bus: simple-pm-bus: Use clocks

Geert Uytterhoeven geert at linux-m68k.org
Fri Aug 12 02:49:23 PDT 2022


Hi Liu,

On Thu, Aug 4, 2022 at 8:10 AM Liu Ying <victor.liu at 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 at 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?

> +
> +       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.

> +
> +       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 at glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



More information about the linux-arm-kernel mailing list