Re: [RFC PATCH 2/2] ASoC: SOF: Use multi PM domains helpers

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

 



On Mon, Mar 2, 2020 at 11:26 PM Sridharan, Ranjani
<ranjani.sridharan@xxxxxxxxx> wrote:
>
>
>
> On Mon, Mar 2, 2020 at 1:00 PM Daniel Baluta <daniel.baluta@xxxxxxxxxxx> wrote:
>>
>> From: Daniel Baluta <daniel.baluta@xxxxxxx>
>>
>> Use dev_multi_pm_attach / dev_multi_pm_detach instead of the hardcoded
>> version.
>>
>> Signed-off-by: Daniel Baluta <daniel.baluta@xxxxxxx>
>> ---
>>  sound/soc/sof/imx/imx8.c | 54 +++++-----------------------------------
>>  1 file changed, 6 insertions(+), 48 deletions(-)
>>
>> diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
>> index b692752b2178..ca740538a2d5 100644
>> --- a/sound/soc/sof/imx/imx8.c
>> +++ b/sound/soc/sof/imx/imx8.c
>> @@ -51,10 +51,7 @@ struct imx8_priv {
>>         struct imx_sc_ipc *sc_ipc;
>>
>>         /* Power domain handling */
>> -       int num_domains;
>> -       struct device **pd_dev;
>> -       struct device_link **link;
>> -
>> +       struct dev_multi_pm_domain_data *mpd;
>>  };
>>
>>  static void imx8_get_reply(struct snd_sof_dev *sdev)
>> @@ -207,7 +204,6 @@ static int imx8_probe(struct snd_sof_dev *sdev)
>>         struct resource res;
>>         u32 base, size;
>>         int ret = 0;
>> -       int i;
>>
>>         priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
>>         if (!priv)
>> @@ -218,39 +214,9 @@ static int imx8_probe(struct snd_sof_dev *sdev)
>>         priv->sdev = sdev;
>>
>>         /* power up device associated power domains */
>> -       priv->num_domains = of_count_phandle_with_args(np, "power-domains",
>> -                                                      "#power-domain-cells");
>> -       if (priv->num_domains < 0) {
>> -               dev_err(sdev->dev, "no power-domains property in %pOF\n", np);
>> -               return priv->num_domains;
>> -       }
>> -
>> -       priv->pd_dev = devm_kmalloc_array(&pdev->dev, priv->num_domains,
>> -                                         sizeof(*priv->pd_dev), GFP_KERNEL);
>> -       if (!priv->pd_dev)
>> -               return -ENOMEM;
>> -
>> -       priv->link = devm_kmalloc_array(&pdev->dev, priv->num_domains,
>> -                                       sizeof(*priv->link), GFP_KERNEL);
>> -       if (!priv->link)
>> -               return -ENOMEM;
>> -
>> -       for (i = 0; i < priv->num_domains; i++) {
>> -               priv->pd_dev[i] = dev_pm_domain_attach_by_id(&pdev->dev, i);
>> -               if (IS_ERR(priv->pd_dev[i])) {
>> -                       ret = PTR_ERR(priv->pd_dev[i]);
>> -                       goto exit_unroll_pm;
>> -               }
>> -               priv->link[i] = device_link_add(&pdev->dev, priv->pd_dev[i],
>> -                                               DL_FLAG_STATELESS |
>> -                                               DL_FLAG_PM_RUNTIME |
>> -                                               DL_FLAG_RPM_ACTIVE);
>> -               if (!priv->link[i]) {
>> -                       ret = -ENOMEM;
>> -                       dev_pm_domain_detach(priv->pd_dev[i], false);
>> -                       goto exit_unroll_pm;
>> -               }
>> -       }
>> +       priv->mpd = dev_multi_pm_attach(&pdev->dev);
>> +       if (IS_ERR(priv->mpd))
>> +               return PTR_ERR(priv->mpd);
>>
>>         ret = imx_scu_get_handle(&priv->sc_ipc);
>>         if (ret) {
>> @@ -329,25 +295,17 @@ static int imx8_probe(struct snd_sof_dev *sdev)
>>  exit_pdev_unregister:
>>         platform_device_unregister(priv->ipc_dev);
>>  exit_unroll_pm:
>
> Can we also rename the label to exit_pm_detach maybe? It is no longer an unroll anymore right?

Sure, will do in v2.



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux