From patchwork Thu Apr 18 09:41:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13634409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 936F5C4345F for ; Thu, 18 Apr 2024 09:41:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=r8d6mnE7+hPSh0Mk7VKhE3VCtahlq5NS7EkrB20/oSI=; b=BSAsHjhx69xnHZWfvFg49eqIIo S0Go19gKWA2CSw6XVq6n8d5FGtOjwggHs6i0N+TQiJMV41QErUKdlEfsLqz/30w1HsxWhh2ZYiwv4 qYPMXKUoHEa52fO6VTMfpm2VrYsKaujr8xYaRmnnAhF4wMFpB9uOB/xw10scsTgBofgkHaDuoWAT0 jZEjlXMYUsISqGuqWNjvQukW7ILFFKBcrjAPjdbg97Yq6V0mtV/GzD37eITUYzZ6M/6GDlp2dhLE1 GDZDhgiZ+Ura1Xu+hDVLHOgdJqi15jvuCxV/Q5rdQjnLjTOlIqMD4gPlaS9D3lHm2dpVpvJHULHNZ 9qC/JnWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxOH1-00000001f6l-12i5; Thu, 18 Apr 2024 09:41:43 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxOGw-00000001f48-3MUd; Thu, 18 Apr 2024 09:41:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1713433297; bh=hFQgS0y1SNEgK7HqXNBkFa3l46N6E9skYre0Rm4VYPs=; h=From:To:Cc:Subject:Date:From; b=E2bDjD6ZJ+MhelyfG3GJcuf0ZV3Lqt0u+QtxwNillZfmy39HR765iM3VF0eSK7mOE p/JvJoFz8d1zOGb+pQZDXO5F7quh4MsuJrjMWR+w8ZbvfwRaNHCUb8blSDUpMXlloG ZVnOw2vu9NJMlWK0fIDkWmA5R8/TyXnwesj5ki90JNtCKIeKXk3qoO+YP231s7zGIH u4YrtOm0Y3oLvmrDGsJV8njBrh6LucCpClORDvyMIgKZn85gyiqmgsZezpUQzKFAhh 1pSZC4uWxyfXLdED3eb99wvysqyTapkGDn7GamivnUGdJ85/VF3EVQrPN6O5/874zL 2320XQtnewoKg== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 034173782145; Thu, 18 Apr 2024 09:41:35 +0000 (UTC) From: AngeloGioacchino Del Regno To: djakov@kernel.org Cc: robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, lgirdwood@gmail.com, broonie@kernel.org, keescook@chromium.org, gustavoars@kernel.org, henryc.chen@mediatek.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kernel@collabora.com, wenst@chromium.org, amergnat@baylibre.com Subject: [PATCH v4 0/7] MediaTek DVFSRC Bus Bandwidth and Regulator knobs Date: Thu, 18 Apr 2024 11:41:27 +0200 Message-ID: <20240418094134.203330-1-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240418_024139_138697_7E14B4C3 X-CRM114-Status: GOOD ( 19.69 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Changes in v4: - Updated patch [3/7] to actually remove address/size cells as the old version got unexpectedly pushed in v3. Changes in v3: - Removed examples from interconnect and regulator bindings and kept example node with interconnect and regulator in the main DVFSRC binding as suggested - Removed 'reg' from interconnect and regulator, removed both address and size cells from the main DVFSRC binding as that was not really needed - Added anyOf-required entries in the regulator binding as it doesn't make sense to probe it without any regulator subnode Changes in v2: - Fixed issues with regulator binding about useless quotes and wrong binding path (oops) - Removed useless 'items' from DVFSRC main binding - Allowed address/size cells to DVFSRC main binding to resolve validation issues on the regulator and interconnect bindings - Changed dvfsrc node name to `system-controller`, as the DVFSRC is actually able to control multiple system components. - Added a commit to remove mtk-dvfs-regulator.c before adding the new, refactored regulator driver This series adds support for the MediaTek Dynamic Voltage and Frequency Scaling Resource Controller (DVFSRC), found on many MediaTek SoCs. This hardware collects requests from both software and the various remote processors embededd into the SoC, and decides about a minimum operating voltage and a minimum DRAM frequency to fulfill those requests, in an effort to provide the best achievable performance per watt. Such hardware IP is capable of transparently performing direct register R/W on all of the DVFSRC-controlled regulators and SoC bandwidth knobs. Summarizing how the DVFSRC works for Interconnect: ICC provider ICC Nodes ---- ---- _________ |CPU | |--- |VPU | _____ | |----- ---- | ---- | |->| DRAM | ---- | ---- |DRAM |->|scheduler|----- |GPU | |--- |DISP| | |->| (EMI) | ---- | ---- |_____|->|_________|---. ----- | ---- /|\ `-|MMSYS|--|--- |VDEC| | ----- | ---- | | ---- | change DRAM freq |--- |VENC| -------- | ---- SMC --> | DVFSRC | | ---- -------- |--- |IMG | | ---- | ---- |--- |CAM | ---- ...and for regulators, it's simply... SMC -> DVFSRC -> Regulator voltage decider -> (vreg) Registers R/W Please note that this series is based on an old (abandoned) series from MediaTek [1], and reuses some parts of the code found in that. Besides, included in this series, there's also a refactoring of the mtk-dvfsrc-regulator driver, which never got compiled at all, and would not build anyway because of missing headers and typos: that commit did not get any Fixes tag because, well, backporting makes no sense at all as the DVFSRC support - which is critical for that driver to work - is introduced with *this series*! :-) P.S.: The DVFSRC regulator is a requirement for the MediaTek UFSHCI controller's crypto boost feature, which is already upstream but lacking the actual regulator to work....... :-) [1]: https://lore.kernel.org/all/20210812085846.2628-1-dawei.chien@mediatek.com/ AngeloGioacchino Del Regno (7): dt-bindings: regulator: Add bindings for MediaTek DVFSRC Regulators dt-bindings: interconnect: Add MediaTek EMI Interconnect bindings dt-bindings: soc: mediatek: Add DVFSRC bindings for MT8183 and MT8195 soc: mediatek: Add MediaTek DVFS Resource Collector (DVFSRC) driver regulator: Remove mtk-dvfsrc-regulator.c regulator: Add refactored mtk-dvfsrc-regulator driver interconnect: mediatek: Add MediaTek MT8183/8195 EMI Interconnect driver .../interconnect/mediatek,mt8183-emi.yaml | 51 ++ .../mediatek,mt6873-dvfsrc-regulator.yaml | 43 ++ .../soc/mediatek/mediatek,mt8183-dvfsrc.yaml | 83 +++ drivers/interconnect/Kconfig | 1 + drivers/interconnect/Makefile | 1 + drivers/interconnect/mediatek/Kconfig | 32 + drivers/interconnect/mediatek/Makefile | 5 + drivers/interconnect/mediatek/icc-emi.c | 153 +++++ drivers/interconnect/mediatek/icc-emi.h | 40 ++ drivers/interconnect/mediatek/mt8183.c | 143 +++++ drivers/interconnect/mediatek/mt8195.c | 339 +++++++++++ drivers/regulator/mtk-dvfsrc-regulator.c | 242 ++++---- drivers/soc/mediatek/Kconfig | 11 + drivers/soc/mediatek/Makefile | 1 + drivers/soc/mediatek/mtk-dvfsrc.c | 551 ++++++++++++++++++ .../interconnect/mediatek,mt8183.h | 23 + .../interconnect/mediatek,mt8195.h | 44 ++ include/linux/soc/mediatek/dvfsrc.h | 36 ++ include/linux/soc/mediatek/mtk_sip_svc.h | 3 + 19 files changed, 1672 insertions(+), 130 deletions(-) create mode 100644 Documentation/devicetree/bindings/interconnect/mediatek,mt8183-emi.yaml create mode 100644 Documentation/devicetree/bindings/regulator/mediatek,mt6873-dvfsrc-regulator.yaml create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,mt8183-dvfsrc.yaml create mode 100644 drivers/interconnect/mediatek/Kconfig create mode 100644 drivers/interconnect/mediatek/Makefile create mode 100644 drivers/interconnect/mediatek/icc-emi.c create mode 100644 drivers/interconnect/mediatek/icc-emi.h create mode 100644 drivers/interconnect/mediatek/mt8183.c create mode 100644 drivers/interconnect/mediatek/mt8195.c create mode 100644 drivers/soc/mediatek/mtk-dvfsrc.c create mode 100644 include/dt-bindings/interconnect/mediatek,mt8183.h create mode 100644 include/dt-bindings/interconnect/mediatek,mt8195.h create mode 100644 include/linux/soc/mediatek/dvfsrc.h