From patchwork Thu Feb 23 12:06:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 60942 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp276411wrd; Thu, 23 Feb 2023 04:10:23 -0800 (PST) X-Google-Smtp-Source: AK7set/dUhA9iesWUNW6hZV3xgbNtiYmUMFOY2FrzwddWhHRucf9vhIqVe3AgkTYdfxb7bSJy6/h X-Received: by 2002:a17:906:7488:b0:8a9:e5c2:e3b8 with SMTP id e8-20020a170906748800b008a9e5c2e3b8mr18229895ejl.2.1677154223648; Thu, 23 Feb 2023 04:10:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677154223; cv=none; d=google.com; s=arc-20160816; b=YU1qvhh4Iz9JgVtE2eYwtR/gNqRfVNvmHHNLIPKbgF9FrPAz6NDxKjOSOnZ6qPSIOp cgj8a9MCXLCaGTFn94W0RkIYQ8Yth4w5MBkZ1qyy4dQk1Sgu9E58giEuXC5xMAKcRVEj cEpa7rp5Ojt8mA/U90wLwY0YhOtiO73LAC8hWD4CKe5dxAjxKL5LIaKmDkyGfdD3d8iA Uez7Zhr9jhU7cbqSnL1JcyMhV/Xa6Vnn/HjzaZSpeHXZEbw6V0xUd6ID5Ob33RNBsc97 Opms/pyv+PYePWzt5fv0XkQ2Oibav11dhhtbGQyk93zAXonNQ2CkuWwHIgnNO9yE5qKU Vgug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=uSXIYjxNwQB5rC697KFH22B37Wkj2tNCcehY+B4TiSY=; b=kb7jEl27xpa+pyOXIjbHLfEsKG8/pgWgYHTfb5sK9k2QiRbAscB8EQaNU3kHWmTd25 DoL++1tfiDgAoZkJl3IHBBa5s7nDDPEKpem6P6c5A2OKTcRz5Dsn2LiJgjvL1UCxCfkR eZbLTbFtrEtXEa5XeLPfqqbbrpJ0+2Fd2vwOWsM4nswo+2vL3ybgclGLDGYGcxS3Db7r kCVXGUedXE/Nfgd8zxpdC0WH05LJZpok3N+XaEGFwnm9npK35xuk9v3pr2cSj6RxMLEv UWvwVqIE8Fc7ZIIdvQxKfWTa+dsNi3NYq20bsWL0ET7iNAvWC0clIaYAlBGF/YV1q2gv ImiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Psnw1sT6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ep17-20020a1709069b5100b008b17d4012c0si19089988ejc.145.2023.02.23.04.10.00; Thu, 23 Feb 2023 04:10:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Psnw1sT6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234019AbjBWMHv (ORCPT + 99 others); Thu, 23 Feb 2023 07:07:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234214AbjBWMH1 (ORCPT ); Thu, 23 Feb 2023 07:07:27 -0500 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E653255C0E for ; Thu, 23 Feb 2023 04:07:06 -0800 (PST) Received: by mail-lj1-x229.google.com with SMTP id h9so10499231ljq.2 for ; Thu, 23 Feb 2023 04:07:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=uSXIYjxNwQB5rC697KFH22B37Wkj2tNCcehY+B4TiSY=; b=Psnw1sT6NYQB65Gw4hVD+6qknVqFCL+OTzW+fcAVAHrxMhpLxwnvPL3eTr8JxPz99w 36ONyLp1ha+EF1B5YvEoQpWMOQTTFxDPUcy1RRnPvFdI7jZwelKqtUxioL4yT/ukkeiq 076vZB4Uvew3aYuXw76kQ/2bigVyg6L0tsX4MuS2D7e6DDMmtEElEzzd+Wgnvdx4ftPU qeBhEgNtdHk/9JEe/H0JGnwqA1znmNmvD7Doc592jRrD9d+lDFlZd0t2DQWJHT8VLhls 03B3oHFdoPgPyqE6OQGRhjP+ihFwAM7wRltJvEIbj8m3FVZMV1VRwEkE0S3S7UMkAfYY RsvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uSXIYjxNwQB5rC697KFH22B37Wkj2tNCcehY+B4TiSY=; b=SSHMboQNsayudYuFiulfTmk87nN1bzdSLtUojKc3b45kfm9j3b0uSBmC5DCbEQQCW+ zU3K4ebOre1PJMNVivVhhZOUbpyb5SHm20DSj3pjbnv1evLKZTiejOxr9J9SDVpb07zL BsOYgGalzsEfjff3MPK0RfeUnxgIzm4FOK2I8Mt4AxyRuNOAdFDCC2kCkMm2N4MVoqDb fSd5JG38P3NpzsEro9zsuAZj89+ivn+WLI0n5LHO83gHvi+CnmioL+O92bzPrmjaXMx6 H27oMbVFMPBnAMYAbr+0IJwh3wTcj57PU+KwoUpdMKBiUNnbN9Au+RgFhAeYbxUy1+7r xFxA== X-Gm-Message-State: AO0yUKVrqkUepxvpgrd/68hPqguJ5XF3pakg3fBvLyjRsDTDL22dZ3Fz rXDeOdiy4EALqy7oiiHys1N/lQ== X-Received: by 2002:a05:651c:106:b0:293:315a:7bf with SMTP id a6-20020a05651c010600b00293315a07bfmr5309917ljb.23.1677154026481; Thu, 23 Feb 2023 04:07:06 -0800 (PST) Received: from [192.168.1.101] (abxi151.neoplus.adsl.tpnet.pl. [83.9.2.151]) by smtp.gmail.com with ESMTPSA id h23-20020a2ea497000000b0029599744c02sm414838lji.75.2023.02.23.04.07.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 04:07:06 -0800 (PST) From: Konrad Dybcio Date: Thu, 23 Feb 2023 13:06:48 +0100 Subject: [PATCH v3 14/15] drm/msm/a6xx: Add A619_holi speedbin support MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v3-14-5be55a336819@linaro.org> References: <20230223-topic-gmuwrapper-v3-0-5be55a336819@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v3-0-5be55a336819@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1677154003; l=1972; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=vvT7USAtDT475uQ6rC2hStDRDcbJP8m6WcfL8eku2dk=; b=vn8ZUf8ziT2rGzu3gkbCADd22G9dr4oBxmjAlpq1d+ChSxrwFHoyBTxlp4nLoBmJlDwM81pccaGu TegrqfQTCOsZSDD26iJBhEJU7FqtGiz+nTGSWjFv0NTUMNPUC8jr X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= 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_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758623667271740363?= X-GMAIL-MSGID: =?utf-8?q?1758623667271740363?= A619_holi is implemented on at least two SoCs: SM4350 (holi) and SM6375 (blair). This is what seems to be a first occurrence of this happening, but it's easy to overcome by guarding the SoC-specific fuse values with of_machine_is_compatible(). Do just that to enable frequency limiting on these SoCs. Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index d49b649ebecf..81f99f8d1978 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2163,6 +2163,34 @@ static u32 a618_get_speed_bin(u32 fuse) return UINT_MAX; } +static u32 a619_holi_get_speed_bin(u32 fuse) +{ + /* + * There are (at least) two SoCs implementing A619_holi: SM4350 (holi) + * and SM6375 (blair). Limit the fuse matching to the corresponding + * SoC to prevent bogus frequency setting (as improbable as it may be, + * given unexpected fuse values are.. unexpected! But still possible.) + */ + + if (fuse == 0) + return 0; + + if (of_machine_is_compatible("qcom,sm4350")) { + if (fuse == 138) + return 1; + else if (fuse == 92) + return 2; + } else if (of_machine_is_compatible("qcom,sm6375")) { + if (fuse == 190) + return 1; + else if (fuse == 177) + return 2; + } else + pr_warn("Unknown SoC implementing A619_holi!\n"); + + return UINT_MAX; +} + static u32 a619_get_speed_bin(u32 fuse) { if (fuse == 0) @@ -2222,6 +2250,9 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_gpu *adreno_gpu, u3 if (adreno_is_a618(adreno_gpu)) val = a618_get_speed_bin(fuse); + else if (adreno_is_a619_holi(adreno_gpu)) + val = a619_holi_get_speed_bin(fuse); + else if (adreno_is_a619(adreno_gpu)) val = a619_get_speed_bin(fuse);