From patchwork Tue Nov 21 11:56:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 16864 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp565238vqb; Tue, 21 Nov 2023 03:59:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHm0mFAAG0iMsDVWhDvz3l7xqGONv8hIW+D0uP0b1CF6SEgW0u6eYAtitMAFa9sYB58RGNi X-Received: by 2002:a17:90a:983:b0:280:37c3:3bcf with SMTP id 3-20020a17090a098300b0028037c33bcfmr3764620pjo.13.1700567980347; Tue, 21 Nov 2023 03:59:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700567980; cv=none; d=google.com; s=arc-20160816; b=YpHWy3h7q0gIQ/RkNPWEnJQiBXMGSWidBb+7G+ajZU/A0VGLJJsdo9tbHfqHosa2z/ n4qP/cp7LFKpuSwCUrhu7xjSvK8VtBIPrHpmU3DbvrkjGwPOtEe3cEQRHthNodqQxskS thd/oJwLIXe1wfSc9yTcoQaAtYPB+r+SNkaovKrAXmoZtl0B9AO6IlirxjVRznNy/zCU 43UegwFAQgMGhLhSqjI9HQWNUJhrlZJZJjBYQdHSigqDRPqRQ9z8MLUBGNFsy2RjzSvX Jc+uq2zVVy9CibWBlJAH/CXVvD81ZlnqGrDO5u7e7xjOd04tPQ8c3zWCpRh0lrTGetsr 0VxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hHSfLPyRkXDW3BitmXCCpmumCAXMYnWo+zwUqVBO220=; fh=m5p6pcg3y47Sg5VKYWXj0f0nOzgFq4l5+GGYwGce+t4=; b=W5SoNIBx6xrlrfxT3wwVgV5HCBuejKRvYaAZHwjNpFHvYXcBb3uGaQlEhE7wJWGs6v OBDV6DnzD/ysBDQnAt9FwaNrunYQrV6u4lnPL/I7lNOVVFbbgfzIag7NNQb7ButD/EnO rsXu6eGj0Bi4q3BqmubyLaWPyrMLgtgmdG1qWDr1T/Afkx9lVXSo9ZI7zP1bToZk9qUA Nbcm9DcFcx191APRoawag189yworfpXJS/KheX/VO1MVALAeBlTnX40d3wCEWXlauCoR URNlJ3SurKEdtkdWbPXKgxQ6uS9Tz8VrZXkaOwvkW23lFYhutj6xJVJ9zT3xY6weL9hp ZlkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=dR5aJJ2W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id mw12-20020a17090b4d0c00b0027cef9ad081si12969102pjb.164.2023.11.21.03.59.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 03:59:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=dR5aJJ2W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4A1A380D31F8; Tue, 21 Nov 2023 03:57:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233997AbjKUL45 (ORCPT + 99 others); Tue, 21 Nov 2023 06:56:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234625AbjKUL4k (ORCPT ); Tue, 21 Nov 2023 06:56:40 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DE5492; Tue, 21 Nov 2023 03:56:33 -0800 (PST) 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 madras.collabora.co.uk (Postfix) with ESMTPSA id 01C9F6607286; Tue, 21 Nov 2023 11:56:30 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1700567791; bh=n/QwQ/VSC58UKI+cZu75pBr4SUUF9z59vdJN4z8NLnc=; h=From:To:Cc:Subject:Date:From; b=dR5aJJ2W6ufYnNy+jo2wFOFXWbjt4WdKVz1g/0y0p/qTaFVCoUKcY0/3E8lqAaeTW bm5W1BUBrDFsNOufuYq32f7iOdH5cCR3eg6nxuRNOPwgucODmRUiNfDtbNGHpfv9sP OSPbAenSl5suOgw/rekOTp1CueyPACYgtYYsg+lUk7RqYYjSzaK68eRaxAphC5nGxL jRyV84K4metj/B14TdvGNEaYIWLJxR2xPbl96kO4bISNi2XWomktGRMI8uDe+n/ngU +6/tFu40o0sf12/jwHh+4V45KErteXcukGNKIcaiamYyU3z8+LkFX8pVwNSpgfqQga hZdYVmdqZvecQ== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, robh+dt@kernel.org, angelogioacchino.delregno@collabora.com, p.zabel@pengutronix.de, 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 Subject: [PATCH v2 00/20] MediaTek SVS driver partial refactoring Date: Tue, 21 Nov 2023 12:56:04 +0100 Message-ID: <20231121115624.56855-1-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 03:57:02 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783174770277656666 X-GMAIL-MSGID: 1783174770277656666 Changes in v2: - Fixed some style issues in patch [18/20] This is a partial refactoring of the MediaTek Smart Voltage Scaling driver. Long story short: this driver never worked as expected on any platform because of various issues so in this series there are some changes that will break compatibility with older device trees (of which, only MT8183 ever had the SVS node), but those are acceptable because... it never really worked fine anyway, so there's no regression. This series was tested on MT8186, MT8192, MT8195 Chromebooks. Depends on MT8192 thermal node: https://lore.kernel.org/lkml/20231017190545.157282-5-bero@baylibre.com/ MT8186 and MT8195 SVS support: https://lore.kernel.org/all/20231011034307.24641-1-chun-jen.tseng@mediatek.com/ Note: one commit was omitted because I haven't got feedback yet on the thermal-zones devicetree consumers implementation at [1], but I still wanted to send this series to the lists to get feedback. Please keep in mind that the one omitted commit is supposed to go on top of this series anyway, and that an useful example of how the SVS node will look with the DT thermal zones is provided at [1]. [1]: https://lore.kernel.org/all/20231115144857.424005-1-angelogioacchino.delregno@collabora.com/ AngeloGioacchino Del Regno (20): arm64: dts: mediatek: mt8183: Change iospaces for thermal and svs soc: mediatek: mtk-svs: Subtract offset from regs_v2 to avoid conflict soc: mediatek: mtk-svs: Convert sw_id and type to enumerations soc: mediatek: mtk-svs: Build bank name string dynamically soc: mediatek: mtk-svs: Reduce memory footprint of struct svs_bank soc: mediatek: mtk-svs: Change the thermal sensor device name soc: mediatek: mtk-svs: Add a map to retrieve fused values soc: mediatek: mtk-svs: Add SVS-Thermal coefficient to SoC platform data soc: mediatek: mtk-svs: Move t-calibration-data retrieval to svs_probe() soc: mediatek: mtk-svs: Commonize efuse parse function for most SoCs soc: mediatek: mtk-svs: Drop supplementary svs per-bank pointer soc: mediatek: mtk-svs: Commonize MT8192 probe function for MT8186 soc: mediatek: mtk-svs: Remove redundant print in svs_get_efuse_data soc: mediatek: mtk-svs: Compress of_device_id entries soc: mediatek: mtk-svs: Cleanup of svs_probe() function soc: mediatek: mtk-svs: Check if SVS mode is available in the beginning soc: mediatek: mtk-svs: Use ULONG_MAX to compare floor frequency soc: mediatek: mtk-svs: Constify runtime-immutable members of svs_bank arm64: dts: mediatek: mt8192: Add Smart Voltage Scaling node arm64: dts: mediatek: mt8195: Add SVS node and reduce LVTS_AP iospace arch/arm64/boot/dts/mediatek/mt8183.dtsi | 26 +- arch/arm64/boot/dts/mediatek/mt8192.dtsi | 12 + arch/arm64/boot/dts/mediatek/mt8195.dtsi | 17 +- drivers/soc/mediatek/mtk-svs.c | 1996 +++++++++++----------- 4 files changed, 993 insertions(+), 1058 deletions(-)