Re: [PATCH v13 14/35] drm/tegra: gr3d: Support generic power domain and runtime PM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 27 Sept 2021 at 00:42, Dmitry Osipenko <digetx@xxxxxxxxx> wrote:
>
> Add runtime power management and support generic power domains.
>
> Tested-by: Peter Geis <pgwipeout@xxxxxxxxx> # Ouya T30
> Tested-by: Paul Fertser <fercerpav@xxxxxxxxx> # PAZ00 T20
> Tested-by: Nicolas Chauvet <kwizart@xxxxxxxxx> # PAZ00 T20 and TK1 T124
> Tested-by: Matt Merhar <mattmerhar@xxxxxxxxxxxxxx> # Ouya T30
> Signed-off-by: Dmitry Osipenko <digetx@xxxxxxxxx>
> ---
>  drivers/gpu/drm/tegra/gr3d.c | 388 ++++++++++++++++++++++++++++++-----

[...]

> +
> +static int gr3d_probe(struct platform_device *pdev)
> +{
> +       struct host1x_syncpt **syncpts;
> +       struct gr3d *gr3d;
> +       unsigned int i;
> +       int err;
> +
> +       gr3d = devm_kzalloc(&pdev->dev, sizeof(*gr3d), GFP_KERNEL);
> +       if (!gr3d)
> +               return -ENOMEM;
> +
> +       platform_set_drvdata(pdev, gr3d);
> +
> +       gr3d->soc = of_device_get_match_data(&pdev->dev);
> +
> +       syncpts = devm_kzalloc(&pdev->dev, sizeof(*syncpts), GFP_KERNEL);
> +       if (!syncpts)
> +               return -ENOMEM;
> +
> +       err = gr3d_get_clocks(&pdev->dev, gr3d);
> +       if (err)
> +               return err;
> +
> +       err = gr3d_get_resets(&pdev->dev, gr3d);
> +       if (err)
> +               return err;
> +
> +       err = gr3d_init_power(&pdev->dev, gr3d);
> +       if (err)
> +               return err;
> +
>         INIT_LIST_HEAD(&gr3d->client.base.list);
>         gr3d->client.base.ops = &gr3d_client_ops;
>         gr3d->client.base.dev = &pdev->dev;
> @@ -352,20 +552,36 @@ static int gr3d_probe(struct platform_device *pdev)
>         gr3d->client.version = gr3d->soc->version;
>         gr3d->client.ops = &gr3d_ops;
>
> +       pm_runtime_enable(&pdev->dev);
> +       pm_runtime_use_autosuspend(&pdev->dev);
> +       pm_runtime_set_autosuspend_delay(&pdev->dev, 200);
> +
> +       err = devm_pm_opp_register_set_opp_helper(&pdev->dev, gr3d_set_opp);
> +       if (err)
> +               goto disable_rpm;
> +
> +       err = devm_tegra_core_dev_init_opp_table_common(&pdev->dev);
> +       if (err)
> +               goto disable_rpm;
> +
>         err = host1x_client_register(&gr3d->client.base);
>         if (err < 0) {
>                 dev_err(&pdev->dev, "failed to register host1x client: %d\n",
>                         err);
> -               return err;
> +               goto disable_rpm;
>         }
>
>         /* initialize address register map */
>         for (i = 0; i < ARRAY_SIZE(gr3d_addr_regs); i++)
>                 set_bit(gr3d_addr_regs[i], gr3d->addr_regs);
>
> -       platform_set_drvdata(pdev, gr3d);
> -
>         return 0;
> +
> +disable_rpm:
> +       pm_runtime_dont_use_autosuspend(&pdev->dev);
> +       pm_runtime_disable(&pdev->dev);

Similar comment as for patch13.

> +
> +       return err;
>  }
>
>  static int gr3d_remove(struct platform_device *pdev)
> @@ -380,23 +596,83 @@ static int gr3d_remove(struct platform_device *pdev)
>                 return err;
>         }
>
> -       if (gr3d->clk_secondary) {
> -               reset_control_assert(gr3d->rst_secondary);
> -               tegra_powergate_power_off(TEGRA_POWERGATE_3D1);
> -               clk_disable_unprepare(gr3d->clk_secondary);
> +       pm_runtime_dont_use_autosuspend(&pdev->dev);
> +       pm_runtime_disable(&pdev->dev);

Similar comment as for patch13. You may want to use
pm_runtime_force_suspend() in favor of pm_runtime_disable().

> +
> +       return 0;
> +}

[...]

I was looking for a call to dev_pm_opp_set_rate(), but couldn't find
it. Isn't that needed when changing the rate of the clock?

Kind regards
Uffe



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux