Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp368287pxf; Thu, 18 Mar 2021 02:16:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyuZg8+We2RymvoY8z+uqL8MYtFEyCn8L9wLM6zCCZkp+25j/31m/ZSvIBjNDmFz0US9h3 X-Received: by 2002:aa7:dd97:: with SMTP id g23mr2377778edv.154.1616058961413; Thu, 18 Mar 2021 02:16:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616058961; cv=none; d=google.com; s=arc-20160816; b=MxjsfALHWU9FGOxAtaE4Mz35w+ogM1ELN3SrWDcX0EYrhEtIXJT+KEedfffS3Ulu9S QlcdqSglgNhrTJFnrbYDqeYwHZGtLq0zU+u1NCsUXfeP4wQSycBI8W/fdymf7v11Xs1G YsyK2wkj3BtYtFMQYquo0+LGNF3Fuma91IFmBTjrEnFjx2gRApSjRWudXGAfEB4NFsdE 63VfsqJVEw18gWgA/NKPsy8e3Ikvd+yw1NrWNwu5psPWv34AW16h6gLeSfm2hrscCDrL 1cmb/9QIfI6bXobYca5YRN38Zfz/VkA0yMUjYXEGKg/qXsn/Bb+hn7b5EYahUy3kpZd6 Eyhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:date:message-id:subject:from:references:cc :to:dkim-signature; bh=Uiv09UGTwFa3RRLsvY7QxQvxRJLPKqm4niX7REF+uBI=; b=YMImmk4b6ik6YVBehzPoT1ttj8qA9bTaatQFgHguWnXI6rwA8cIHjorcgo3HrC2E3p /J8zFCUEECfMu99TNY/RvXA0IrIJb9F+tDnXKtnaHQGk/Ik9HennTvAFQyj5n5D22ykL tCm5r9bZjIu0T7Tl5qMwGpDeQHxPiwvBaQyX7iQ3HXs5HlTHEU0WzgXQN/1cRq+Cy9U5 lcVNihTVW6wi0eJs1TWOFfaGst/Ia4/fxAlLU6wY9vzMSvwLbcwYBJbYmdbfNFKrzmvE j+ZGjF02LocxpMwtLiV4mMVa7W5yq0c3M+KRPrbYyOAc0hT4cp9G9OfoyqY2jwQEcLTL WolQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=coPhGBtI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j27si1106604edy.231.2021.03.18.02.15.38; Thu, 18 Mar 2021 02:16:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=coPhGBtI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbhCRJOo (ORCPT + 99 others); Thu, 18 Mar 2021 05:14:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229540AbhCRJO1 (ORCPT ); Thu, 18 Mar 2021 05:14:27 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7998DC06175F for ; Thu, 18 Mar 2021 02:14:27 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id j18so4678056wra.2 for ; Thu, 18 Mar 2021 02:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=to:cc:references:from:subject:message-id:date:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=Uiv09UGTwFa3RRLsvY7QxQvxRJLPKqm4niX7REF+uBI=; b=coPhGBtIDCp11up6qLgepezHxSY9MAu+TIL4HmsjE1SENNt1EVWlXvVyN4/KFhHvND ZWEfg4iOZxb5sdttHrJQyfNcNKxiLHvhk5SHivOpsOaL+s1XROwwR79ZZn3g+Al3BusC DbUooT4K6XGJXBE+wAqn1msIvpva4OwXZEQeW1c3vFRKBxJ5MIX2/0Nj2m4XHNrzqLot XANEtb6ctkGxDim4PP3+ZcTUIhSTGgg0FxsHBJckeSgQwEQO2g+RDstg+VOeGVTv2WIX 3ITK+0hRnIW4P4n7Gr+Zy+1rY7qWgmc+efNrUw3q6ceHH1f3lqU1GXZUpYRcB4SpDVBa oDBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Uiv09UGTwFa3RRLsvY7QxQvxRJLPKqm4niX7REF+uBI=; b=t3fzwTTHbyHNS6o4in1gUA5jEdtfd7VJJHqOS6nvFRwZdQ0fbZiSrgFaUsuR78l3Dh lIE8YCMFfa+y4QzdfIDr6J/QiyXVusl86foYgRJZT+yuC9KfvutPlsr93TSzRpUMs0Wu QMyfagbF5Xj5JYHRU40QbVXPkHAN4289zd76e8UVR4Q3DFD6GM+BGlXHldIC6AzlW1z2 T7MVa1QCfV4i5WT856hDrM1CoaNm3YZE7IY9m3x7r4IIqu5uAuMw2NpSzjYpE4WOj5xq Kt24KbLDnoI/PSWtPrgpIOgLSmAU5B4DXNvrfMGxn9w49ALMbcOEVaRla0cVeJ8eCd6r YNvQ== X-Gm-Message-State: AOAM530pavlaBfpIQisjXFHaLfz1DmYlOAg/M1NxTtvE7G2+MGrE7Mge h0jqbgr9Uw8X0CCR9DqzkQVURw== X-Received: by 2002:adf:c64a:: with SMTP id u10mr8561102wrg.412.1616058866201; Thu, 18 Mar 2021 02:14:26 -0700 (PDT) Received: from [10.44.66.8] ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id l8sm2122201wrx.83.2021.03.18.02.14.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Mar 2021 02:14:25 -0700 (PDT) To: Henry Chen , Rob Herring , Matthias Brugger , Stephen Boyd , Ryan Case Cc: Mark Rutland , Nicolas Boichat , Fan Chen , James Liao , Arvin Wang , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org References: <1614656863-8530-1-git-send-email-henryc.chen@mediatek.com> <1614656863-8530-4-git-send-email-henryc.chen@mediatek.com> From: Georgi Djakov Subject: Re: [PATCH V9 03/12] soc: mediatek: add driver for dvfsrc support Message-ID: Date: Thu, 18 Mar 2021 11:14:22 +0200 MIME-Version: 1.0 In-Reply-To: <1614656863-8530-4-git-send-email-henryc.chen@mediatek.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Henry, On 3/2/21 05:47, Henry Chen wrote: > Add dvfsrc driver for MT6873/MT8183/MT8192 > > Signed-off-by: Henry Chen > --- > drivers/soc/mediatek/Kconfig | 11 + > drivers/soc/mediatek/Makefile | 1 + > drivers/soc/mediatek/mtk-dvfsrc.c | 421 ++++++++++++++++++++++++++++++++ > include/linux/soc/mediatek/mtk_dvfsrc.h | 35 +++ > 4 files changed, 468 insertions(+) > create mode 100644 drivers/soc/mediatek/mtk-dvfsrc.c > create mode 100644 include/linux/soc/mediatek/mtk_dvfsrc.h > > diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig > index fdd8bc0..2dcf023 100644 > --- a/drivers/soc/mediatek/Kconfig > +++ b/drivers/soc/mediatek/Kconfig > @@ -26,6 +26,17 @@ config MTK_DEVAPC > The violation information is logged for further analysis or > countermeasures. > > +config MTK_DVFSRC > + tristate "MediaTek DVFSRC Support" > + depends on ARCH_MEDIATEK I'm wondering whether adding COMPILE_TEST would make sense here, but it's also fine as is. > + help > + Say yes here to add support for the MediaTek DVFSRC (dynamic voltage > + and frequency scaling resource collector) found > + on different MediaTek SoCs. The DVFSRC is a proprietary > + hardware which is used to collect all the requests from > + system and turn into the decision of minimum Vcore voltage > + and minimum DRAM frequency to fulfill those requests. > + > config MTK_INFRACFG > bool "MediaTek INFRACFG Support" > select REGMAP > diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile > index b6908db..4ead103 100644 > --- a/drivers/soc/mediatek/Makefile > +++ b/drivers/soc/mediatek/Makefile [..] > +void mtk_dvfsrc_send_request(const struct device *dev, u32 cmd, u64 data) > +{ > + int ret, state; > + struct mtk_dvfsrc *dvfsrc = dev_get_drvdata(dev); > + > + dev_dbg(dvfsrc->dev, "cmd: %d, data: %llu\n", cmd, data); > + > + switch (cmd) { > + case MTK_DVFSRC_CMD_BW_REQUEST: > + dvfsrc->dvd->set_dram_bw(dvfsrc, data); > + return; > + case MTK_DVFSRC_CMD_PEAK_BW_REQUEST: > + if (dvfsrc->dvd->set_dram_peak_bw) > + dvfsrc->dvd->set_dram_peak_bw(dvfsrc, data); > + return; > + case MTK_DVFSRC_CMD_OPP_REQUEST: > + if (dvfsrc->dvd->set_opp_level) > + dvfsrc->dvd->set_opp_level(dvfsrc, data); > + break; > + case MTK_DVFSRC_CMD_VCORE_REQUEST: > + dvfsrc->dvd->set_vcore_level(dvfsrc, data); > + break; > + case MTK_DVFSRC_CMD_HRTBW_REQUEST: > + if (dvfsrc->dvd->set_dram_hrtbw) > + dvfsrc->dvd->set_dram_hrtbw(dvfsrc, data); > + else > + return; > + break; > + case MTK_DVFSRC_CMD_VSCP_REQUEST: > + dvfsrc->dvd->set_vscp_level(dvfsrc, data); > + break; > + default: > + dev_err(dvfsrc->dev, "unknown command: %d\n", cmd); > + return; > + } > + > + /* DVFSRC need to wait at least 2T(~196ns) to handle request > + * after recieving command Nit: s/recieving/receiving/ Thanks, Georgi