devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leonard Crestez <leonard.crestez@nxp.com>
To: Chanwoo Choi <cw00.choi@samsung.com>,
	Georgi Djakov <georgi.djakov@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>,
	Alexandre Bailon <abailon@baylibre.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Jacky Bai <ping.bai@nxp.com>, Anson Huang <anson.huang@nxp.com>,
	Abel Vesa <abel.vesa@nxp.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Saravana Kannan <saravanak@google.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Aisheng Dong <aisheng.dong@nxp.com>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Matthias Kaehlcke <mka@chromium.org>,
	Angus Ainslie <angus@akkea.ca>,
	Martin Kepplinger <martink@posteo.de>,
	Silvano Di Ninno <silvano.dininno@nxp.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	dl-linux-imx <linux-imx@nxp.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH RFC v6 3/9] PM / devfreq: imx: Register interconnect device
Date: Wed, 18 Dec 2019 10:13:44 +0000	[thread overview]
Message-ID: <VI1PR04MB7023DAC69C8B4B7CF144F29EEE530@VI1PR04MB7023.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 60fe19c6-6e73-4133-ed7e-a13a875589c0@samsung.com

On 17.12.2019 02:55, Chanwoo Choi wrote:
> On 12/17/19 12:00 AM, Leonard Crestez wrote:
>> On 13.12.2019 06:22, Chanwoo Choi wrote:
>>> Hi,
>>>
>>> On 11/15/19 5:09 AM, Leonard Crestez wrote:
>>>> There is no single device which can represent the imx interconnect.
>>>> Instead of adding a virtual one just make the main &noc act as the
>>>> global interconnect provider.
>>>>
>>>> The imx interconnect provider driver will scale the NOC and DDRC based
>>>> on bandwidth request. More scalable nodes can be added in the future,
>>>> for example for audio/display/vpu/gpu NICs.
>>>>
>>>> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
>>>> ---
>>>>    drivers/devfreq/imx-devfreq.c | 37 +++++++++++++++++++++++++++++++++++
>>>>    1 file changed, 37 insertions(+)
>>>>
>>>> diff --git a/drivers/devfreq/imx-devfreq.c b/drivers/devfreq/imx-devfreq.c
>>>> index 620b344e87aa..585d340c0f6e 100644
>>>> --- a/drivers/devfreq/imx-devfreq.c
>>>> +++ b/drivers/devfreq/imx-devfreq.c
>>>> @@ -15,10 +15,11 @@
>>>>    struct imx_devfreq {
>>>>    	struct devfreq_dev_profile profile;
>>>>    	struct devfreq *devfreq;
>>>>    	struct clk *clk;
>>>>    	struct devfreq_passive_data passive_data;
>>>> +	struct platform_device *icc_pdev;
>>>>    };
>>>>    
>>>>    static int imx_devfreq_target(struct device *dev,
>>>>    			      unsigned long *freq, u32 flags)
>>>>    {
>>>> @@ -60,11 +61,40 @@ static int imx_devfreq_get_dev_status(struct device *dev,
>>>>    	return 0;
>>>>    }
>>>>    
>>>>    static void imx_devfreq_exit(struct device *dev)
>>>>    {
>>>> +	struct imx_devfreq *priv = dev_get_drvdata(dev);
>>>> +
>>>>    	dev_pm_opp_of_remove_table(dev);
>>>> +	platform_device_unregister(priv->icc_pdev);
>>>> +}
>>>> +
>>>> +/* imx_devfreq_init_icc() - register matching icc provider if required */
>>>> +static int imx_devfreq_init_icc(struct device *dev)
>>>> +{
>>>> +	struct imx_devfreq *priv = dev_get_drvdata(dev);
>>>> +	const char *icc_driver_name;
>>>> +
>>>> +	if (!IS_ENABLED(CONFIG_INTERCONNECT_IMX))
>>>> +		return 0;
>>>
>>> It is not proper to check the enable state of CONFIG_INTERCONNECT_IMX configuration
>>> on device driver. Why don't you add the 'select CONFIG_INTERCONNECT_IMX' on Kconfig?
>>
>> Because it's optional.
>>
>> You can disable interconnect support and just tweak frequencies using
>> the devfreq sysfs API. But indeed would only really be useful for debugging.
> 
> Even if it's optional, I don't prefer to use 'IS_ENABLED' macro.
> 
> Generally, add or delete the property or value at DT file
> to either enable or disable the some feature provided by device driver
> instead of checking the configuration.
> 
> If user adds the property/value related to interconnect
> and imx-bus.c configuration is enabled, the behavior
> related to interconnect on imx-bus.c doesn't work. It make some confusion.

Maybe I could print a warning if #interconnect-cells is present but 
CONFIG_INTERCONNECT_IMX is off?

An explicit select in Kconfig seems like a pointless limitation but in 
practice it would almost never be useful to build one without the other.

> The imx-bus.c have to add the 'select CONFIG_INTERCONNECT_IMX'
> and hand over the right which use the interconnect feature or not, to user.
> 
> If there are any requirement to add the additional property
> to check whether interconnect feature will be used or not,
> you can add the extra property. But, I think that it is enough
> to check the '#interconnect-cells'.
> 
> In result, I think that it is right to decide the usage of feature
> of device driver by user on Devicetree.
> 
>>
>>>> +	if (!of_get_property(dev->of_node, "#interconnect-cells", 0))
>>>> +		return 0;
>>>> +
>>>> +	icc_driver_name = of_device_get_match_data(dev);
>>>> +	if (!icc_driver_name)
>>>> +		return 0;
>>>> +
>>>> +	priv->icc_pdev = platform_device_register_data(
>>>> +			dev, icc_driver_name, 0, NULL, 0);
>>>> +	if (IS_ERR(priv->icc_pdev)) {
>>>> +		dev_err(dev, "failed to register icc provider %s: %ld\n",
>>>> +				icc_driver_name, PTR_ERR(priv->devfreq));
>>>> +		return PTR_ERR(priv->devfreq);
>>>> +	}
>>>> +
>>>> +	return 0;
>>>>    }
>>>>    
>>>>    static int imx_devfreq_probe(struct platform_device *pdev)
>>>>    {
>>>>    	struct device *dev = &pdev->dev;
>>>> @@ -120,18 +150,25 @@ static int imx_devfreq_probe(struct platform_device *pdev)
>>>>    		ret = PTR_ERR(priv->devfreq);
>>>>    		dev_err(dev, "failed to add devfreq device: %d\n", ret);
>>>>    		goto err;
>>>>    	}
>>>>    
>>>> +	ret = imx_devfreq_init_icc(dev);
>>>> +	if (ret)
>>>> +		goto err;
>>>> +
>>>>    	return 0;
>>>>    
>>>>    err:
>>>>    	dev_pm_opp_of_remove_table(dev);
>>>>    	return ret;
>>>>    }
>>>>    
>>>>    static const struct of_device_id imx_devfreq_of_match[] = {
>>>> +	{ .compatible = "fsl,imx8mq-noc", .data = "imx8mq-interconnect", },
>>>> +	{ .compatible = "fsl,imx8mm-noc", .data = "imx8mm-interconnect", },
>>>> +	{ .compatible = "fsl,imx8mn-noc", .data = "imx8mn-interconnect", },
>>>>    	{ .compatible = "fsl,imx8m-noc", },
>>>>    	{ .compatible = "fsl,imx8m-nic", },
>>>>    	{ /* sentinel */ },
>>>>    };
>>>>    MODULE_DEVICE_TABLE(of, imx_devfreq_of_match);
>>
>>
> 
> 


  reply	other threads:[~2019-12-18 10:13 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 20:09 [PATCH RFC v6 0/9] interconnect: Add imx support via devfreq Leonard Crestez
2019-11-14 20:09 ` [PATCH RFC v6 1/9] dt-bindings: interconnect: Add bindings for imx8m noc Leonard Crestez
2019-12-16  1:12   ` Chanwoo Choi
2019-12-16  3:25     ` Chanwoo Choi
2019-12-16 15:09       ` Leonard Crestez
2019-12-17  0:15         ` Chanwoo Choi
2019-12-19 14:31           ` Leonard Crestez
2019-12-19 15:55             ` Chanwoo Choi
2019-12-19 19:11               ` Leonard Crestez
2019-11-14 20:09 ` [PATCH RFC v6 2/9] PM / devfreq: Add generic imx bus scaling driver Leonard Crestez
2019-11-20 14:08   ` Angus Ainslie
2019-11-20 15:04     ` Leonard Crestez
2019-11-20 15:29       ` Marco Felsch
2019-11-20 15:41       ` Angus Ainslie
2019-11-20 16:30         ` Leonard Crestez
2019-11-20 16:38           ` Angus Ainslie
2019-11-20 18:02             ` Leonard Crestez
2020-02-04  9:45               ` Martin Kepplinger
2020-02-13 10:53                 ` Martin Kepplinger
2019-12-13  1:30   ` Chanwoo Choi
2019-12-13  1:51     ` Chanwoo Choi
2019-12-16  1:06       ` Chanwoo Choi
2019-12-16 14:57         ` Leonard Crestez
2019-12-17  0:41           ` Chanwoo Choi
2019-12-17 21:05             ` Leonard Crestez
2019-12-18  3:15               ` Chanwoo Choi
2019-12-18 10:10                 ` Leonard Crestez
2019-12-18 10:46                   ` Chanwoo Choi
2019-12-18 17:06                     ` Chanwoo Choi
2019-11-14 20:09 ` [PATCH RFC v6 3/9] PM / devfreq: imx: Register interconnect device Leonard Crestez
2019-12-13  4:28   ` Chanwoo Choi
2019-12-16 15:00     ` Leonard Crestez
2019-12-17  1:02       ` Chanwoo Choi
2019-12-18 10:13         ` Leonard Crestez [this message]
2019-12-18 11:05           ` Chanwoo Choi
2019-12-18 17:13             ` Leonard Crestez
2019-12-19  7:07               ` Chanwoo Choi
2019-11-14 20:09 ` [PATCH RFC v6 4/9] interconnect: Add imx core driver Leonard Crestez
2019-12-12  7:29   ` Georgi Djakov
2019-12-19  0:18     ` Leonard Crestez
2019-11-14 20:09 ` [PATCH RFC v6 5/9] interconnect: imx: Add platform driver for imx8mm Leonard Crestez
2019-12-12  7:35   ` Georgi Djakov
2019-12-16 14:35     ` Leonard Crestez
2019-11-14 20:09 ` [PATCH RFC v6 6/9] interconnect: imx: Add platform driver for imx8mq Leonard Crestez
2019-11-14 20:09 ` [PATCH RFC v6 7/9] interconnect: imx: Add platform driver for imx8mn Leonard Crestez
2019-11-14 20:09 ` [PATCH RFC v6 8/9] arm64: dts: imx8m: Add NOC nodes Leonard Crestez
2019-11-14 20:09 ` [PATCH RFC v6 9/9] arm64: dts: imx8m: Add interconnect provider properties Leonard Crestez
2019-12-11  9:53 ` [PATCH RFC v6 0/9] interconnect: Add imx support via devfreq Leonard Crestez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1PR04MB7023DAC69C8B4B7CF144F29EEE530@VI1PR04MB7023.eurprd04.prod.outlook.com \
    --to=leonard.crestez@nxp.com \
    --cc=abailon@baylibre.com \
    --cc=abel.vesa@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=angus@akkea.ca \
    --cc=anson.huang@nxp.com \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=georgi.djakov@linaro.org \
    --cc=kernel@pengutronix.de \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=martink@posteo.de \
    --cc=mka@chromium.org \
    --cc=mturquette@baylibre.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=ping.bai@nxp.com \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=saravanak@google.com \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=silvano.dininno@nxp.com \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).