[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b52430cc-1216-8b3e-baec-7d3fffc1274a@gmail.com>
Date: Wed, 15 Sep 2021 12:29:20 +0900
From: Chanwoo Choi <cwchoi00@...il.com>
To: Abel Vesa <abel.vesa@....com>, Rob Herring <robh@...nel.org>,
Dong Aisheng <aisheng.dong@....com>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
"catalin.marinas@....com" <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
MyungJoo Ham <myungjoo.ham@...sung.com>,
Kyungmin Park <kyungmin.park@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Georgi Djakov <djakov@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Ulf Hansson <ulf.hansson@...aro.org>,
Ahmad Fatoum <a.fatoum@...gutronix.de>
Cc: Pengutronix Kernel Team <kernel@...gutronix.de>,
linux-serial@...r.kernel.org, NXP Linux Team <linux-imx@....com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
devicetree@...r.kernel.org, linux-pm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [RFC 05/19] devfreq: imx8m-ddrc: Use the opps acquired from EL3
Hi,
OPP is mandatory for devfreq driver. Also, must need to add
the OPP levels to devicetree file, it is better to show
the supported OPP list for the developer who don't know
the detailed background of driver. If there are no any
critical issue. I prefer the existing approach for the readability.
On 21. 9. 14. 오전 2:38, Abel Vesa wrote:
> i.MX8M platforms get their dram OPPs from the EL3.
> We don't need to duplicate that in the kernel dram dts node.
> We should just trust the OPPs provided by the EL3.
>
> Signed-off-by: Abel Vesa <abel.vesa@....com>
> ---
> drivers/devfreq/imx8m-ddrc.c | 50 +++---------------------------------
> 1 file changed, 3 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/devfreq/imx8m-ddrc.c b/drivers/devfreq/imx8m-ddrc.c
> index 583123bf2100..f18a5c3c1c03 100644
> --- a/drivers/devfreq/imx8m-ddrc.c
> +++ b/drivers/devfreq/imx8m-ddrc.c
> @@ -321,38 +321,9 @@ static int imx8m_ddrc_init_freq_info(struct device *dev)
> if (freq->dram_core_parent_index == 2 &&
> freq->dram_alt_parent_index == 0)
> return -ENODEV;
> - }
> -
> - return 0;
> -}
> -
> -static int imx8m_ddrc_check_opps(struct device *dev)
> -{
> - struct imx8m_ddrc *priv = dev_get_drvdata(dev);
> - struct imx8m_ddrc_freq *freq_info;
> - struct dev_pm_opp *opp;
> - unsigned long freq;
> - int i, opp_count;
> -
> - /* Enumerate DT OPPs and disable those not supported by firmware */
> - opp_count = dev_pm_opp_get_opp_count(dev);
> - if (opp_count < 0)
> - return opp_count;
> - for (i = 0, freq = 0; i < opp_count; ++i, ++freq) {
> - opp = dev_pm_opp_find_freq_ceil(dev, &freq);
> - if (IS_ERR(opp)) {
> - dev_err(dev, "Failed enumerating OPPs: %ld\n",
> - PTR_ERR(opp));
> - return PTR_ERR(opp);
> - }
> - dev_pm_opp_put(opp);
>
> - freq_info = imx8m_ddrc_find_freq(priv, freq);
> - if (!freq_info) {
> - dev_info(dev, "Disable unsupported OPP %luHz %luMT/s\n",
> - freq, DIV_ROUND_CLOSEST(freq, 250000));
> - dev_pm_opp_disable(dev, freq);
> - }
> + if (dev_pm_opp_add(dev, freq->rate * 250000, 0))
> + return -ENODEV;
> }
>
> return 0;
> @@ -360,7 +331,6 @@ static int imx8m_ddrc_check_opps(struct device *dev)
>
> static void imx8m_ddrc_exit(struct device *dev)
> {
> - dev_pm_opp_of_remove_table(dev);
> }
>
> static int imx8m_ddrc_probe(struct platform_device *pdev)
> @@ -407,16 +377,7 @@ static int imx8m_ddrc_probe(struct platform_device *pdev)
> return ret;
> }
>
> - ret = dev_pm_opp_of_add_table(dev);
> - if (ret < 0) {
> - dev_err(dev, "failed to get OPP table\n");
> - return ret;
> - }
> -
> - ret = imx8m_ddrc_check_opps(dev);
> - if (ret < 0)
> - goto err;
> -
> + priv->profile.polling_ms = 1000;
This change is not related to role of this patch.
Need to make the separate patch.
> priv->profile.target = imx8m_ddrc_target;
> priv->profile.exit = imx8m_ddrc_exit;
> priv->profile.get_cur_freq = imx8m_ddrc_get_cur_freq;
> @@ -427,13 +388,8 @@ static int imx8m_ddrc_probe(struct platform_device *pdev)
> if (IS_ERR(priv->devfreq)) {
> ret = PTR_ERR(priv->devfreq);
> dev_err(dev, "failed to add devfreq device: %d\n", ret);
> - goto err;
> }
>
> - return 0;
> -
> -err:
> - dev_pm_opp_of_remove_table(dev);
> return ret;
> }
>
>
--
Best Regards,
Samsung Electronics
Chanwoo Choi
Powered by blists - more mailing lists