[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <154655622671.15366.9695869469694306752@swboyd.mtv.corp.google.com>
Date: Thu, 03 Jan 2019 14:57:06 -0800
From: Stephen Boyd <sboyd@...nel.org>
To: Henry Chen <henryc.chen@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
Viresh Kumar <vireshk@...nel.org>
Cc: Mark Rutland <mark.rutland@....com>,
Fan Chen <fan.chen@...iatek.com>,
Weiyi Lu <weiyi.lu@...iatek.com>,
James Liao <jamesjj.liao@...iatek.com>,
Kees Cook <keescook@...omium.org>, linux-pm@...r.kernel.org,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
Henry Chen <henryc.chen@...iatek.com>
Subject: Re: [RFC RESEND PATCH 3/7] soc: mediatek: add support for the performance state
Quoting Henry Chen (2019-01-02 06:09:54)
> @@ -187,6 +190,18 @@ struct scp_soc_data {
> bool bus_prot_reg_update;
> };
>
> +BLOCKING_NOTIFIER_HEAD(scpsys_notifier_list);
static?
> +
> +int register_scpsys_notifier(struct notifier_block *nb)
> +{
> + return blocking_notifier_chain_register(&scpsys_notifier_list, nb);
> +}
> +
> +int unregister_scpsys_notifier(struct notifier_block *nb)
> +{
> + return blocking_notifier_chain_unregister(&scpsys_notifier_list, nb);
> +}
What is the notifier for?
> +
> static int scpsys_domain_is_on(struct scp_domain *scpd)
> {
> struct scp *scp = scpd->scp;
> @@ -536,6 +551,48 @@ static void init_clks(struct platform_device *pdev, struct clk **clk)
> clk[i] = devm_clk_get(&pdev->dev, clk_names[i]);
> }
>
> +static int mtk_pd_set_performance(struct generic_pm_domain *genpd,
> + unsigned int state)
> +{
> + int i;
> + struct scp_domain *scpd =
> + container_of(genpd, struct scp_domain, genpd);
> + struct scp_event_data scpe;
> + struct scp *scp = scpd->scp;
> + struct genpd_onecell_data *pd_data = &scp->pd_data;
> +
> + for (i = 0; i < pd_data->num_domains; i++) {
> + if (genpd == pd_data->domains[i]) {
> + dev_dbg(scp->dev, "%d. %s = %d\n",
> + i, genpd->name, state);
> + break;
> + }
> + }
> +
> + scpe.event_type = MTK_SCPSYS_PSTATE;
> + scpe.genpd = genpd;
> + scpe.domain_id = i;
> + blocking_notifier_call_chain(&scpsys_notifier_list, state, &scpe);
> +
> + return 0;
> +}
> +
> +static unsigned int mtk_pd_get_performance(struct generic_pm_domain *genpd,
> + struct dev_pm_opp *opp)
> +{
> + struct device_node *np;
> + unsigned int state;
> +
> + np = dev_pm_opp_get_of_node(opp);
> +
> + if (of_property_read_u32(np, "mtk,level", &state))
> + return 0;
> +
> + of_node_put(np);
The generic API that Rajendra is adding I guess will become even more
generic by assuming some sort of property like 'opp-level' or
'performance-state' that is just some raw number.
> +
> + return state;
> +}
> +
> static struct scp *init_scp(struct platform_device *pdev,
> const struct scp_domain_data *scp_domain_data, int num,
> const struct scp_ctrl_reg *scp_ctrl_reg,
Powered by blists - more mailing lists