Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp280087imu; Thu, 3 Jan 2019 19:44:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN7vf5nu+pnAAnLdPKMYbQX8jCyG3lt2FsqXB9PJN0KK0xOFEJnPEVTyt+nK7b7Z+dMRW5Vn X-Received: by 2002:a65:4381:: with SMTP id m1mr275441pgp.358.1546573475333; Thu, 03 Jan 2019 19:44:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546573475; cv=none; d=google.com; s=arc-20160816; b=nTht/UdK5TLZAx4+3zEWmKuTzoOq40oVgdr7BmuSr6znpvoxAwQ7hld6d2AtisxGAF 65WDC2+QlpE8dRGUQ1kaw6/evL3LFPhi7xvTHwQwWyXRA4XT/aisNDadFWHKcF7x1IiF B6OaFSnd7CRhNffkOeVbCVM7JFkqTTZKCZgitQ2TpuG3xm0LSBZ827SveVOdpf1iZGIB 3cJw1OdLhEG4uAiBEFFvahdUJpcSHcUWFpdvjAm8XDcMJ/nIsDP4SKiGfzAqkviVKmo+ l978KUA/+xmPMWiQrDB7WVK6GL9ltQopXkBdvLsOAzNPzEY3lKSoyd4X05KjUKH69Dcr iESw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:references:user-agent :from:in-reply-to:to:cc:subject:content-transfer-encoding :mime-version:dkim-signature; bh=Q68KtBQRJgc8PwEyistpsyjU0GyfJ77ixE8BaGYxP6k=; b=JEgkTh45wDVY8GPHlEShPHMfCEF+jxXWb7Kmz9yPAZk/Y3ktu0plqB1CnjTBUm8pvW w5id3eR7KV7N6VtMmmztRUwyX/0QPZl7CYV+a8dDl5c0klX91PgiIgZkGhpRWvy7Xyf/ idLPu2auu3sEXmSTkM0pMcY+BymExAk1IQ3ZQxSCNyKOoND97zsqC66XIm4cnN33UK/X vmu0Yy5uOUP0/huOO/JxqUK707CN7gE70d30pGHcaxMEUUGtz04aFk1P9xj3U9rYrQz/ j1+mYiggOfpPMMzZ67SpXy+lzd/QqePR+1KEIM3omrlo3CGR1BkwN15bCB11TYfd6jSU mcSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Z9TTGFEE; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si33917336pgf.136.2019.01.03.19.44.19; Thu, 03 Jan 2019 19:44:35 -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=@kernel.org header.s=default header.b=Z9TTGFEE; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726206AbfACW5J (ORCPT + 99 others); Thu, 3 Jan 2019 17:57:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:45748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726122AbfACW5I (ORCPT ); Thu, 3 Jan 2019 17:57:08 -0500 Received: from localhost (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9FFBC21479; Thu, 3 Jan 2019 22:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546556227; bh=sVYZSZnSZtHY9vTnHtjEpk8aBl6O5BQi9VAoiasp9aA=; h=Subject:Cc:To:In-Reply-To:From:References:Date:From; b=Z9TTGFEE74nC8MmHYmkPzvzDaE078+CdpAopt+L+1lEx9PHiXuxmCkdvCdbO5A/rD oadF2rmkcQT5V/W6SlbCQDiYof5Q0t1KEOH4SHioxEgg/umOyVle4FJZyByGSxfIG2 YH7MbaWB1ZpSDh+EO9ZgDANrSRPjHK7HI24ACDAs= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Re: [RFC RESEND PATCH 3/7] soc: mediatek: add support for the performance state Cc: Mark Rutland , Fan Chen , Weiyi Lu , James Liao , Kees Cook , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Henry Chen To: Henry Chen , Matthias Brugger , Rob Herring , Ulf Hansson , Viresh Kumar In-Reply-To: <1546438198-1677-4-git-send-email-henryc.chen@mediatek.com> From: Stephen Boyd User-Agent: alot/0.8 References: <1546438198-1677-1-git-send-email-henryc.chen@mediatek.com> <1546438198-1677-4-git-send-email-henryc.chen@mediatek.com> Message-ID: <154655622671.15366.9695869469694306752@swboyd.mtv.corp.google.com> Date: Thu, 03 Jan 2019 14:57:06 -0800 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Henry Chen (2019-01-02 06:09:54) > @@ -187,6 +190,18 @@ struct scp_soc_data { > bool bus_prot_reg_update; > }; > =20 > +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 =3D scpd->scp; > @@ -536,6 +551,48 @@ static void init_clks(struct platform_device *pdev, = struct clk **clk) > clk[i] =3D devm_clk_get(&pdev->dev, clk_names[i]); > } > =20 > +static int mtk_pd_set_performance(struct generic_pm_domain *genpd, > + unsigned int state) > +{ > + int i; > + struct scp_domain *scpd =3D > + container_of(genpd, struct scp_domain, genpd); > + struct scp_event_data scpe; > + struct scp *scp =3D scpd->scp; > + struct genpd_onecell_data *pd_data =3D &scp->pd_data; > + > + for (i =3D 0; i < pd_data->num_domains; i++) { > + if (genpd =3D=3D pd_data->domains[i]) { > + dev_dbg(scp->dev, "%d. %s =3D %d\n", > + i, genpd->name, state); > + break; > + } > + } > + > + scpe.event_type =3D MTK_SCPSYS_PSTATE; > + scpe.genpd =3D genpd; > + scpe.domain_id =3D i; > + blocking_notifier_call_chain(&scpsys_notifier_list, state, &scpe); > + > + return 0; > +} > + > +static unsigned int mtk_pd_get_performance(struct generic_pm_domain *gen= pd, > + struct dev_pm_opp *opp) > +{ > + struct device_node *np; > + unsigned int state; > + > + np =3D 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, in= t num, > const struct scp_ctrl_reg *scp_ctrl_reg,