Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3422635imu; Mon, 7 Jan 2019 03:08:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/UxuhLdeO/B3rFdBEuz75HRpCf+9LDhd9LQA+CXmcd75ZQNTu09frAKhSrB5g2H5zKj5UED X-Received: by 2002:a62:f247:: with SMTP id y7mr62670581pfl.25.1546859295993; Mon, 07 Jan 2019 03:08:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546859295; cv=none; d=google.com; s=arc-20160816; b=I21r01vIDR58u+FpjbzKMc6yWvh17A8pswi1ZXswkQGTzZPM7U2ABfNLRJn6ziaEzp O4XTKc4SYUAibeTs4sfeGaG7qznX8TkkmGKAskSkLHXqh6XDZXofZdjTSv80PT4EnJo+ CanqD8I4OMav3oxTF+iaOso7Jyi7FTvBN2EzziL/ZhssntxD08G1ZatAo8ZiX5bAFurC MzJ1spY2dD2OsgTMwfSu1r8QIR+78sujzNf/qP5ncBRtuDEjsjWY/Y1aM89GNF14pekh wx4StnM8f8oRWLWfKfGg+g/2oXi0VnD1Nqk9zzLSnN82pNPODYSxVPMEe6ktVqx0QY1w YYOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=xlAauCzKCv4POHtiODLTNaQ6BqNV5GKmC4WCuLddmBg=; b=xwj8lgRj6N4V6JCPVZRQyBfWXT9iD9JHp69RQm55j6MyusaHa0P3XrahxGprJnYgdN J94AibtAcJafSPIcr4ExMjxEa9U2Zc4U7LL6EzmIaStQeU+9pRsxX697zl6RQ1CwR5Mi CDF9TFXKE4QGt/OwGT6ym1lQIbtHuI3mf/Xn/gYb+U0bgMudoNaj84mxK9x0rukcgNf6 RioYjmum2RB9QwY2/SmQIG23SkHypTq8KVSGtWweb+AeQC9VrTdx7okxEetQwtCkU7fl Y8JMGtmvF1/mHvr/+UptXOK0UYw4dtKTzzh9Bm7Jf0F5v87cC6PhCRTy8Fd9G5V4Pc20 jpHg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si48428129plt.356.2019.01.07.03.08.01; Mon, 07 Jan 2019 03:08:15 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726999AbfAGLGl (ORCPT + 99 others); Mon, 7 Jan 2019 06:06:41 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:12387 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726885AbfAGLGl (ORCPT ); Mon, 7 Jan 2019 06:06:41 -0500 X-UUID: c588567d3af34ac49ad05aa871210393-20190107 X-UUID: c588567d3af34ac49ad05aa871210393-20190107 Received: from mtkmrs01.mediatek.inc [(172.21.131.159)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1233337545; Mon, 07 Jan 2019 19:06:35 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 7 Jan 2019 19:06:34 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 7 Jan 2019 19:06:34 +0800 Message-ID: <1546859194.6818.129.camel@mtksdaap41> Subject: Re: [RFC RESEND PATCH 3/7] soc: mediatek: add support for the performance state From: Henry Chen To: Stephen Boyd CC: Matthias Brugger , Rob Herring , Ulf Hansson , Viresh Kumar , Mark Rutland , Fan Chen , Weiyi Lu , James Liao , Kees Cook , , , , , Date: Mon, 7 Jan 2019 19:06:34 +0800 In-Reply-To: <154655622671.15366.9695869469694306752@swboyd.mtv.corp.google.com> References: <1546438198-1677-1-git-send-email-henryc.chen@mediatek.com> <1546438198-1677-4-git-send-email-henryc.chen@mediatek.com> <154655622671.15366.9695869469694306752@swboyd.mtv.corp.google.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2019-01-03 at 14:57 -0800, Stephen Boyd wrote: > 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? OK > > > + > > +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? It used to notifier the DVFSRC driver that performance stat was changed. > > > + > > 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. ok, I will follow the new property from Rajendra. > > + > > + 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,