Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3413626ybf; Tue, 3 Mar 2020 05:39:13 -0800 (PST) X-Google-Smtp-Source: ADFU+vtAQYX1nIw719v0FcgD63EyjtvcOXO9PwbYq7//ITD9fQCNAMzrop8Bpo5bdjMRNXR1nLMI X-Received: by 2002:aca:4d47:: with SMTP id a68mr2292064oib.145.1583242752974; Tue, 03 Mar 2020 05:39:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583242752; cv=none; d=google.com; s=arc-20160816; b=Ymp3ZlRtyfxy1VbS5BEkZn2iAPsyqW7lqe65xNR9LMhtti6MJ6oGZcYjJm/5XUcpOB Z+6RgipKt9sBA8M/P4SaTuM3dx3qvrZ5Vlusv61x3aFzcjdviY0Z7mjtg44up9k67Nkn whc0/twqKu3KLGjkgU0V8CtSlWZie7C8J/UNW6bOodAN+nYGioNCWv6im5sXlAmQOyPg cs5jeAF6l2Z/Bzvln8lswGbO/pmDQa/YEb9pgtzn5f/C+OfGnOJMC3Abvo4C75zt37Yq CXViY50yMk9TPq5eEIYIWaNBJYI1MCMDwpOzujznTLbqup+zgJvcjjxluPGshqhihWdS 8kNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=x1haolJvTMTs4qAKKQpFP8pY7Ez4bO8I0NW3W3vGhjY=; b=WbDkv0NupquTNFlB8ZfvzPHVF6hpwC98EWrNdxgETj3I2F3g6ZRXddE3OvcHShjukY Eh4RqmP0IW9v3oJHZdm/RZnoBeKLXYIqB/3QtSo6fMV6Jsu0c+uAUK544UlcYHeI6PKD UP+Ot3hgBjLzEkmvpNVahvNnfokIFXX0hiyK89TmgMKoSykqzi/ET4RRiuEEImISqyex dpQQdNOi40bXIK1h8he6rxoH4c2LNl6/4MIhKDcCeFZJQP64mYc5Ei1N2QgTI56QsNdU wqQMIrr28/tWnwJSt3LGxt/BSMKmdbSNlEYcJNeDdsx4ZwOK5FnjmPf6fXtQyVvDflSN BcKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OuocMO5b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i5si8278548oif.211.2020.03.03.05.39.01; Tue, 03 Mar 2020 05:39:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OuocMO5b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728916AbgCCNRf (ORCPT + 99 others); Tue, 3 Mar 2020 08:17:35 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54545 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728124AbgCCNRf (ORCPT ); Tue, 3 Mar 2020 08:17:35 -0500 Received: by mail-wm1-f67.google.com with SMTP id i9so1733810wml.4; Tue, 03 Mar 2020 05:17:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=x1haolJvTMTs4qAKKQpFP8pY7Ez4bO8I0NW3W3vGhjY=; b=OuocMO5bejjzlYN7dgw8I+8i7eYd2hQHN4Z6zRclkIyqy204aGYP9hBgL0OfmqkUs2 VwkGfDLA7OjW5W7CCKViNtEZZaKACTs29/be0YTbgm/2tmmJdc+zsgurpV68PSrI4n0y qZGu/h11pBgohxtCnuw9NS+/rL/fghbF5xQ9vGE6m3ZCWB4kYe1/SQko1ja8UCdmqBMb wMtj0pF8zR9m+qrZJof85tZdKOtQBz+s9o0hc2wRsHqnPExf3XHgaNSMhvoJxkLgV23j plKLYqojWrxfJGa8HkPldn1PPKxCakR7AHxQ8v1Qd88GfCwh9lu8b/GzjTgtAxKvVLgD qWIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x1haolJvTMTs4qAKKQpFP8pY7Ez4bO8I0NW3W3vGhjY=; b=gjspNOzcHZj56hjMed/8JCTBxZsPZwpCkIM7lgp/4uPNljMOpLKG23PiDi8c7VQGzw kmVUGdn8vlhkZGlXz23YIDt5SvsArRHgjn02dB3vMBJqOtdvtHs3w3+eROtKQb1LrzuC AgZWYREP4zY2MFxYoAY/xFjHhP3ngMhotxOYQrkOi6naU+ZDwQ/lJX01tRrCEV5EEQSN bi0tMn718w52MGdWq2nmvma9qlK2nMJdBHEWsREWlLg26S46aL8sOMk0fSoyhOt47xoq ClqUzO9yNJwiO6KrSYAOpIAjT7UQ3aR1Cu4gEfGQrbrhIJx1eIK/sOnAXzdF7u0mow/D 73nw== X-Gm-Message-State: ANhLgQ2Slm0ctOd3oKSXotO7GLcXNDMmzPivSscGjq7sayVWFBG1x7DM g19vBjvnXcuHGbRkbzmclbfxyvN5NtkjszSKuVM= X-Received: by 2002:a1c:9e51:: with SMTP id h78mr4179705wme.44.1583241453088; Tue, 03 Mar 2020 05:17:33 -0800 (PST) MIME-Version: 1.0 References: <20200302205700.29746-1-daniel.baluta@oss.nxp.com> <20200302205700.29746-3-daniel.baluta@oss.nxp.com> In-Reply-To: From: Daniel Baluta Date: Tue, 3 Mar 2020 15:17:21 +0200 Message-ID: Subject: Re: [RFC PATCH 2/2] ASoC: SOF: Use multi PM domains helpers To: "Sridharan, Ranjani" Cc: Daniel Baluta , rjw@rjwysocki.net, "Brown, Len" , Pavel Machek , Aisheng Dong , Ulf Hansson , Fabio Estevam , Linux-ALSA , linux-pm@vger.kernel.org, Greg KH , Sascha Hauer , khilman@kernel.org, Ranjani Sridharan , Linux Kernel Mailing List , Daniel Baluta , Pierre-Louis Bossart , Paul Olaru , dl-linux-imx , Pengutronix Kernel Team , Shawn Guo , "S.j. Wang" , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 2, 2020 at 11:26 PM Sridharan, Ranjani wrote: > > > > On Mon, Mar 2, 2020 at 1:00 PM Daniel Baluta wrote: >> >> From: Daniel Baluta >> >> Use dev_multi_pm_attach / dev_multi_pm_detach instead of the hardcoded >> version. >> >> Signed-off-by: Daniel Baluta >> --- >> 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.