From patchwork Thu Jan 27 03:39:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Lu X-Patchwork-Id: 12726259 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 51BC6C433EF for ; Thu, 27 Jan 2022 03:51:35 +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=JqYuBfXLgLx/BVPn7M8eMBeyrr9MRRTVSrS14ktQLWU=; b=XYaI7sacda6wLY 3v33zz8R/MK4bL2pG7VeYB7OcQHtLbzY8mggp3SwlK+dhsDBARWJCNVRQP/ZL2MSK3XyrZFFxC2LY 4/eV6WIQFuWQcUD2YjAeaQ77usW80V/HSeTjPsph/Ddxk9fbsRhjmUJIEeVMKN2ZsFeN/cRx/XPTo DNpFwkzkt7vGTL6MQ1DQCTIxpZ37zhVT25GgBlQUhNljkVjR63bjytqAzv/pwqdTNiGNoFT2pRbtC hXc+jdkOLhzgvEhI1lP82182p/kuhZ3IgVt11N5ATKF5Bm4u2e+enM8VapvzP5ZySSt2+0eQyf6Rw rC3RhygMh2TCD4nF8q6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCvnd-00EHId-2W; Thu, 27 Jan 2022 03:50:17 +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 1nCvnP-00EHGZ-SZ; Thu, 27 Jan 2022 03:50:05 +0000 X-UUID: efedf4d6422644a3a6c4bb8fcd94e2b6-20220126 X-UUID: efedf4d6422644a3a6c4bb8fcd94e2b6-20220126 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2116470541; Wed, 26 Jan 2022 20:50:01 -0700 Received: from mtkmbs10n2.mediatek.inc (172.21.101.183) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 26 Jan 2022 19:39:59 -0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.3; Thu, 27 Jan 2022 11:39:57 +0800 Received: from mtksdaap41.mediatek.inc (172.21.77.4) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 27 Jan 2022 11:39:57 +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 , Xiaoqing Liu , Charles Yang , Angus Lin , Mark Rutland , Nishanth Menon , Roger Lu , , , , , , , Guenter Roeck Subject: [PATCH v22 0/7] soc: mediatek: SVS: introduce MTK SVS engine Date: Thu, 27 Jan 2022 11:39:49 +0800 Message-ID: <20220127033956.24585-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-20220126_195003_954675_42E02CDB X-CRM114-Status: GOOD ( 11.36 ) 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 v21: - Rebase to kernel 5.17-rc1. - Remove unnecessary "maxItems" from nvmem-cells in mtk-svs.yaml. - Move svs_platform_data definition to the beginning of the file for increased readability. - For better performance purpose, we add "thermal_zone_device" memeber in svs bank structure and cache it at driver probe time. - Remove svs_get_zone_temperature() and call thermal_zone_get_temp() directly when we needs to read temperature. - Drop mt8192 svs node patch and we'll submit another complete mt8192.dtsi patch including mt8192 svs node. - Replace mask7_0 with GENMASK macro and bits8/reg_bytes with corresponding definition. - Separate definition with "register common configuration" and "related setting" for better categorization. - Remove redundant codes including "svsb->suspended concept" and refine comments. - Move devm_regulator_get_optional() to svs_bank_resource_setup() for better understanding. Roger Lu (7): [v22,1/7] dt-bindings: soc: mediatek: add mtk svs dt-bindings [v22,2/7] arm64: dts: mt8183: add svs device information [v22,3/7] soc: mediatek: SVS: introduce MTK SVS engine [v22,4/7] soc: mediatek: SVS: add monitor mode [v22,5/7] soc: mediatek: SVS: add debug commands [v22,6/7] dt-bindings: soc: mediatek: add mt8192 svs dt-bindings [v22,7/7] soc: mediatek: SVS: add mt8192 SVS GPU driver .../bindings/soc/mediatek/mtk-svs.yaml | 91 + arch/arm64/boot/dts/mediatek/mt8183.dtsi | 16 + drivers/soc/mediatek/Kconfig | 10 + drivers/soc/mediatek/Makefile | 1 + drivers/soc/mediatek/mtk-svs.c | 2439 +++++++++++++++++ 5 files changed, 2557 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mtk-svs.yaml create mode 100644 drivers/soc/mediatek/mtk-svs.c