From patchwork Tue Nov 21 12:50:36 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: 167732 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp595971vqb; Tue, 21 Nov 2023 04:54:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IG7LH+WYgDYxnR/fnAEWTpH3T9TXS4hZ++xp68pr72QXvBt4H+lRBmJkpZlbE/kd/9cMWzS X-Received: by 2002:a05:6a20:2585:b0:18a:fbd1:8e6d with SMTP id k5-20020a056a20258500b0018afbd18e6dmr1011419pzd.27.1700571291968; Tue, 21 Nov 2023 04:54:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700571291; cv=none; d=google.com; s=arc-20160816; b=U2aXPQK91NilVkUHdpoaEj69kk/2f2ZfYbhJb6ZdLZyjD0Kl+Ztv8A5xLoQ6dewEqa TMZZUM2bqR0YsvPur8N7dtrGS7LEW7eEOGzwXjxuPI8l6Qtj/Sjp+MNkboqTVjgdeHkK Z8YW4qxzcT+Uv8rGRBVnMDFqMEl/4IljUfsy6+jsLVB2zN87zXfMyyAYQrpqkTMilfbl bYC0+XFgiU9/jHIOzmLZhmDblCTVdc0weU1gxVGGL5QdTo6nM63kLAouyVEvhZB8ZEkp sHx+BY+IdEdQgncrbJUrXQ8J4moXCDU0O1gfs4plgduZHpbYLjDLkPkQl1WIBZD9JC9A Je/w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IQLIJg24znIa486HfA91r6jHZp1ttD5Q9cgFHZ3g7XU=; fh=m5p6pcg3y47Sg5VKYWXj0f0nOzgFq4l5+GGYwGce+t4=; b=Oecq2Cp/CJs49IZdff4up890YyPgjYLN+K4BvKvrFXLR7FN4EJA4OEyt6BkPsY0Upu Mrx/q+U1CyDeqBfqftRsokrGxD4qbKh7uvRrngYGzyFDwX+p1tS0vjdEoz4uYmNQq4QV sQWNcYYN7hxWMedmfY6trjx20/+f7nR4JrNPo1VTax1BDpNSwmiEa1fc/Us0j3ClBeAx +41IxBCNAOwKfqsA0b9gCoeNJ9X4ypCLdZLBDuK5Zp1g7MA3PcWS7B7kgrK/0dhrqk7c 9Pvx2Bjexzf11Ezd9ltGQSvtXGcql0UzJLohMvciP47w6ZZ7p/Ftf2JHcO7OLG9g3KK7 DMvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=JME8J0fO; 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 fb27-20020a056a002d9b00b006cb901a87c4si4806278pfb.376.2023.11.21.04.54.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 04:54:51 -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=JME8J0fO; 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 46497804DDBA; Tue, 21 Nov 2023 04:51:46 -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 S234018AbjKUMv3 (ORCPT + 99 others); Tue, 21 Nov 2023 07:51:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233865AbjKUMvO (ORCPT ); Tue, 21 Nov 2023 07:51:14 -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 073D7D7B; Tue, 21 Nov 2023 04:51:04 -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 E7F0D6607325; Tue, 21 Nov 2023 12:51:02 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1700571063; bh=zNfya3IwOleE3gv7u+f222r6Eh2oBHfy4LgRig9Wjl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JME8J0fOzBllttmy6YP2f3UBamsismPO7cYy+ESjToe7kho7iYAUsR25Z+1uEKcm7 KE8sn6k9kq99YUINIwIybXl4NCC8KPJHC1sMS1SgspPRyMUqjWCJ4JsCEMdxEvazGl 3E0+17hF4SP9Pgo6WuYdMQj3W8NnNC7qddBmZphikoPsjgwZ6bla6gouBP3ZdMnoom 4r8/B0JZYS2FIupPHmwhvf/xfvYJfuAcesxMzeMUfAavkcocd0qAzDfUNOBw0ILJx5 5/SIUjAmJoP3xrsz4CW9iYKYMqcFM3j7Kg6DElPz6z1WpYHwpsTuvMlNLcTiDAxzsH P7ZPHcrhlUg+Q== 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 v3 12/20] soc: mediatek: mtk-svs: Commonize MT8192 probe function for MT8186 Date: Tue, 21 Nov 2023 13:50:36 +0100 Message-ID: <20231121125044.78642-13-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231121125044.78642-1-angelogioacchino.delregno@collabora.com> References: <20231121125044.78642-1-angelogioacchino.delregno@collabora.com> 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 04:51:46 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783178243000752061 X-GMAIL-MSGID: 1783178243000752061 Include the additions of svs_mt8186_platform_probe() in the common svs_mt8192_platform_probe() function, remove the former, and use the latter as .probe() callback for MT8186. Signed-off-by: AngeloGioacchino Del Regno --- drivers/soc/mediatek/mtk-svs.c | 44 ++++++---------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c index e7df3a577b4c..cd5064683506 100644 --- a/drivers/soc/mediatek/mtk-svs.c +++ b/drivers/soc/mediatek/mtk-svs.c @@ -2119,7 +2119,6 @@ static struct device *svs_add_device_link(struct svs_platform *svsp, static int svs_mt8192_platform_probe(struct svs_platform *svsp) { struct device *dev; - struct svs_bank *svsb; u32 idx; svsp->rst = devm_reset_control_get_optional(svsp->dev, "svs_rst"); @@ -2133,40 +2132,7 @@ static int svs_mt8192_platform_probe(struct svs_platform *svsp) "failed to get lvts device\n"); for (idx = 0; idx < svsp->bank_max; idx++) { - svsb = &svsp->banks[idx]; - - if (svsb->type == SVSB_TYPE_HIGH) - svsb->opp_dev = svs_add_device_link(svsp, "gpu"); - else if (svsb->type == SVSB_TYPE_LOW) - svsb->opp_dev = svs_get_subsys_device(svsp, "gpu"); - - if (IS_ERR(svsb->opp_dev)) - return dev_err_probe(svsp->dev, PTR_ERR(svsb->opp_dev), - "failed to get OPP device for bank %d\n", - idx); - } - - return 0; -} - -static int svs_mt8186_platform_probe(struct svs_platform *svsp) -{ - struct device *dev; - struct svs_bank *svsb; - u32 idx; - - svsp->rst = devm_reset_control_get_optional(svsp->dev, "svs_rst"); - if (IS_ERR(svsp->rst)) - return dev_err_probe(svsp->dev, PTR_ERR(svsp->rst), - "cannot get svs reset control\n"); - - dev = svs_add_device_link(svsp, "thermal-sensor"); - if (IS_ERR(dev)) - return dev_err_probe(svsp->dev, PTR_ERR(dev), - "failed to get lvts device\n"); - - for (idx = 0; idx < svsp->bank_max; idx++) { - svsb = &svsp->banks[idx]; + struct svs_bank *svsb = &svsp->banks[idx]; switch (svsb->sw_id) { case SVSB_SWID_CPU_LITTLE: @@ -2177,7 +2143,11 @@ static int svs_mt8186_platform_probe(struct svs_platform *svsp) svsb->opp_dev = svs_add_device_link(svsp, "cci"); break; case SVSB_SWID_GPU: - svsb->opp_dev = svs_add_device_link(svsp, "gpu"); + if (svsb->type == SVSB_TYPE_LOW) + svsb->opp_dev = svs_get_subsys_device(svsp, "gpu"); + else + svsb->opp_dev = svs_add_device_link(svsp, "gpu"); + break; break; default: dev_err(svsb->dev, "unknown sw_id: %u\n", svsb->sw_id); @@ -2739,7 +2709,7 @@ static const struct svs_platform_data svs_mt8186_platform_data = { .name = "mt8186-svs", .banks = svs_mt8186_banks, .efuse_parsing = svs_common_parse_efuse, - .probe = svs_mt8186_platform_probe, + .probe = svs_mt8192_platform_probe, .regs = svs_regs_v2, .bank_max = ARRAY_SIZE(svs_mt8186_banks), .ts_coeff = SVSB_TS_COEFF_MT8186,