From patchwork Fri Jan 7 09:51:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Lu X-Patchwork-Id: 12706432 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 0CAE1C433F5 for ; Fri, 7 Jan 2022 09:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=5lhJMoTXt/VdreViSi9ub/pCB/I9W6DW5R9kaB2ZB9o=; b=YSwVWtoCf0mVVI W+bU3yAd7vcxeLQ3ghOWBdLFutJTN4Ft2JFXS70CxWDtiSpJDQwRz1t6etm+lBmrKhDSfHxKF/YbA eP021VzfMvKVvdjlbUQHeGkYCzLVhuwND0LMgzKDeSmI+GsDTVVKCWQTLD6U/i0BXI8SXXoemul8R lfjbixxjjcsJo3Ka7A/otNo4L1TEdI0HLyeWHZgQW9ZO7yElsdK7wzlnhivW8pmWCal0j0z0Ijp7X pXDjHBqrYNTGAELCPOv+P5EFntolrf+kLm/oC0l8AhKxVg+JPNTPi4ETolERz/arHBHDff9xXLxKI wkDQpZEuI613mZMkSHFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5lxE-003AND-K0; Fri, 07 Jan 2022 09:54:36 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5lv1-003966-TR; Fri, 07 Jan 2022 09:52:21 +0000 X-UUID: d241ae1c9a8d4f96a1542242e00df552-20220107 X-UUID: d241ae1c9a8d4f96a1542242e00df552-20220107 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1000683658; Fri, 07 Jan 2022 02:52:17 -0700 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 7 Jan 2022 01:52:16 -0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkexhb02.mediatek.inc (172.21.101.103) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 7 Jan 2022 17:52:01 +0800 Received: from mtksdaap41.mediatek.inc (172.21.77.4) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 7 Jan 2022 17:52:00 +0800 From: Roger Lu To: Matthias Brugger , Enric Balletbo Serra , Kevin Hilman , Rob Herring , Nicolas Boichat , Stephen Boyd , Philipp Zabel CC: Fan Chen , HenryC Chen , YT Lee , Xiaoqing Liu , Charles Yang , Angus Lin , Mark Rutland , Nishanth Menon , Roger Lu , , , , , , , Guenter Roeck Subject: [PATCH v21 0/8] soc: mediatek: SVS: introduce MTK SVS engine Date: Fri, 7 Jan 2022 17:51:52 +0800 Message-ID: <20220107095200.4389-1-roger.lu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220107_015219_984123_753A26ED X-CRM114-Status: GOOD ( 13.14 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The Smart Voltage Scaling(SVS) engine is a piece of hardware which calculates suitable SVS bank voltages to OPP voltage table. Then, DVFS driver could apply those SVS bank voltages to PMIC/Buck when receiving OPP_EVENT_ADJUST_VOLTAGE. 1. SVS driver uses OPP adjust event in [1] to update OPP table voltage part. 2. SVS driver gets thermal/GPU device by node [2][3] and CPU device by get_cpu_device(). After retrieving subsys device, SVS driver calls device_link_add() to make sure probe/suspend callback priority. [1] https://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git/commit/?h=opp/linux-next&id=25cb20a212a1f989385dfe23230817e69c62bee5 [2] https://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git/commit/?h=opp/linux-next&id=b325ce39785b1408040d90365a6ab1aa36e94f87 [3] https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/commit/?h=v5.16-next/dts64&id=a8168cebf1bca1b5269e8a7eb2626fb76814d6e2 change since v20: - Rebase to kernel 5.16-rc1 - Separate mt8183 svs as two patches for minimun version support. patch1 (init01 ~ init02) and patch2 (mon mode). - Remove unused flags in each patch. - Move @SVSB_PHASE_ERROR before @SVSB_PHASE_INIT01 for order correctness. - Reorder the struct member comment and coding for the consistenty. Also revise the ambiguous comments. - Use [writel,readl]_relaxed instead of [writel,readl]. - Fix ->efuse_parsing() not return "false" mistake. - Move more commen settings out of svs bank structure for shrinking data structure size. - Split up the "get platform data" and "platform probe" behavior. - Change the naming of "svs_is_supported()" to "svs_is_efuse_data_correct()" for better understanding. - SVSB_DC_SIGNED_BIT is configured as BIT(15) instead of 0x8000. - Add the missing variables comments back in the structure. - Add define "MAX_OPP_ENTRIES" for representing opp total count. - Add more kernel log description when error happens. - Add missing error handler when using nvmem_cell_read(). Roger Lu (8): [v21,1/8] dt-bindings: soc: mediatek: add mtk svs dt-bindings [v21,2/8] arm64: dts: mt8183: add svs device information [v21,3/8] soc: mediatek: SVS: introduce MTK SVS engine [v21,4/8] soc: mediatek: SVS: add monitor mode [v21,5/8] soc: mediatek: SVS: add debug commands [v21,6/8] dt-bindings: soc: mediatek: add mt8192 svs dt-bindings [v21,7/8] arm64: dts: mt8192: add svs device information [v21,8/8] soc: mediatek: SVS: add mt8192 SVS GPU driver .../bindings/soc/mediatek/mtk-svs.yaml | 92 + arch/arm64/boot/dts/mediatek/mt8183.dtsi | 16 + arch/arm64/boot/dts/mediatek/mt8192.dtsi | 39 + drivers/soc/mediatek/Kconfig | 10 + drivers/soc/mediatek/Makefile | 1 + drivers/soc/mediatek/mtk-svs.c | 2461 +++++++++++++++++ 6 files changed, 2619 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mtk-svs.yaml create mode 100644 drivers/soc/mediatek/mtk-svs.c