From patchwork Tue Feb 14 17:31:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3111785wrn; Tue, 14 Feb 2023 09:41:45 -0800 (PST) X-Google-Smtp-Source: AK7set+bDYOYp1f85v/G3lS9d9T6FK5Xb75+c5hV0cHuiH+yJ1QIP4F5g294Jf/LO8P7jYjfc0EQ X-Received: by 2002:a62:4e57:0:b0:577:272f:fdb with SMTP id c84-20020a624e57000000b00577272f0fdbmr2134964pfb.29.1676396505116; Tue, 14 Feb 2023 09:41:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676396505; cv=none; d=google.com; s=arc-20160816; b=S+mdMWn9imEVZOj2GBuLY/NmU/Gjid8K790/y8y7as5nw5XCNOJw2q1sd4+pGxzyWq oUg8q3TN8nY4mrljHZhBLdB72eVZN3RTCsz/98M3+NZAjTTbYxEivoWggoS4VvA4JZcI Ligj5MCkO1oURKtQp5ZxrCMlwZEpoaeuGUX/nhlMim+UskbMc6TjSpXZ4TTHf1Kov6gK 8fqHN4GCBzukqGn36kekr7qNf51+6HkFS3n86icAlnjXr+xCezZbpQGPEQVOUb55hfzU s8V+maqr6uzwDDLcHlh7LwBrAoqU+3TvIDw+nPLpdhLZkZizi2qbVNsG9BBrdOj7uPQ2 M+GQ== 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=c7mTIcBAt9xKjMEqRxhkyslwv9ImP8F3/zPYA7ZjQgc=; b=g0MbQfr9Zv9i5clxJgbywLOl8y7jio2jHhFkPqvILRybtVcaInSE8kWuIEhCK//HcK 59PWkSIRhsbtBOScwhHHsx71Vd49A0kuGfjMoQxSwN1fo/56YDzVGhu+1fjFNwemVba/ OAAJZTL2kOATYe/MlsKJTkTpXYI0gZzICfCGF51fhtkdhIFMuAHcUZ8vMCVlvoDDB3/S KBc4FTVMztZy36niba4RpJbVFdIL1jBEwyfQ4LUQc6VJ0F0IeK4BHrhCmIjmg42MLQOH Jya3fhA/lsG17imioKwEDxtv6IkgIYBzBSAG3DcSRoy91hMc7Rt6AMoAh1SGOJS2HQNv m/Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zz7CuboN; 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 w20-20020a627b14000000b005a8dcaeba57si2359649pfc.371.2023.02.14.09.41.31; Tue, 14 Feb 2023 09:41:45 -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=Zz7CuboN; 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 S232844AbjBNRd1 (ORCPT + 99 others); Tue, 14 Feb 2023 12:33:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233143AbjBNRdI (ORCPT ); Tue, 14 Feb 2023 12:33:08 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29D5E2F7BF for ; Tue, 14 Feb 2023 09:32:36 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id lf10so10057496ejc.5 for ; Tue, 14 Feb 2023 09:32:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c7mTIcBAt9xKjMEqRxhkyslwv9ImP8F3/zPYA7ZjQgc=; b=Zz7CuboNHAWxl6q+hJmpjx8lB5Xi4d+tF70/vbE9hZpGX4KJoN6E5BaaBvsVppY8Pb hNt19jDlIb5ybaLwQbw+EF94Ui2RXSrCuifWL/raIV65/nFlfgMdo5Cgn03hTdj2eVGm vdIZEUjRbQMxzVTmE5dJmj3GDBysMaF3EaCu2jFRr8x25qYMIeEReBOW4N7HttWuABuu o55GXFTzD3TgHopbKSM2GYHhzxk5SeCQJNydS/hM+b/btdS/QqwjTUvT9jfN5fAutJM2 RcwRBnn1ddYzEWZ7TXeBF+ccbCgkbpIT6qX/sOaqFy65akDck6mtTW/Yx8ZLj4enlPTw 0CuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c7mTIcBAt9xKjMEqRxhkyslwv9ImP8F3/zPYA7ZjQgc=; b=EMMksInkosDnERZd62sCi2WgoUCTj9DaBl9eExV+njRgoYHK6OuVxwOEfMr5p79Inq HPcyuWGPdUgD+HDW3gV3z7Z3tXPKEzeuLUh4jVqnCCq2MhzYtF21h51UaMMc7bgaz+Lx +SPoI/cchOXgq1yNWUoqhwyX2Og3FoeN36/q6xoyFwYZvoct9AlkHw/SIHl+U4bO32Mj ealnvcMJzlxYeoUonNE1aubI4rv4asi1B+kLgu/vtP0/sUpwO+cjNcSTxr2WYc0rl2GH mME/BiukzPScLxNbkSizaz31la7F96OerLUuaRdtv154liHCgT5PMZoAf2jSiUvL5LYq wwdw== X-Gm-Message-State: AO0yUKUiJl/Vfc7RU+BIlFk+nqX/Cm9UeyYfCUldBFA2FOW+qb90uCfA kAPIYfQLbN9yu3r+O3bDGO0Jng== X-Received: by 2002:a17:906:3b87:b0:881:a3ec:2b43 with SMTP id u7-20020a1709063b8700b00881a3ec2b43mr3475091ejf.56.1676395953957; Tue, 14 Feb 2023 09:32:33 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id w8-20020a50c448000000b0049668426aa6sm8325787edf.24.2023.02.14.09.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 09:32:33 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Akhil P Oommen , Chia-I Wu , Douglas Anderson , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 14/14] drm/msm/a6xx: Add A610 speedbin support Date: Tue, 14 Feb 2023 18:31:45 +0100 Message-Id: <20230214173145.2482651-15-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214173145.2482651-1-konrad.dybcio@linaro.org> References: <20230214173145.2482651-1-konrad.dybcio@linaro.org> 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_NONE, SPF_HELO_NONE,SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757829141943047427?= X-GMAIL-MSGID: =?utf-8?q?1757829141943047427?= A610 is implemented on at least three SoCs: SM6115 (bengal), SM6125 (trinket) and SM6225 (khaje). Trinket does not support speed binning (only a single SKU exists) and we don't yet support khaje upstream. Hence, add a fuse mapping table for bengal to allow for per-chip frequency limiting. Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 94b4d93619ed..f2679f9cc137 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2082,6 +2082,30 @@ static bool a6xx_progress(struct msm_gpu *gpu, struct msm_ringbuffer *ring) return progress; } +static u32 a610_get_speed_bin(u32 fuse) +{ + /* + * There are (at least) three SoCs implementing A610: SM6125 (trinket), + * SM6115 (bengal) and SM6225 (khaje). Trinket does not have speedbinning, + * as only a single SKU exists and we don't support khaje upstream yet. + * Hence, this matching table is only valid for bengal and can be easily + * expanded if need be. + */ + + if (fuse == 0) + return 0; + else if (fuse == 206) + return 1; + else if (fuse == 200) + return 2; + else if (fuse == 157) + return 3; + else if (fuse == 127) + return 4; + + return UINT_MAX; +} + static u32 a618_get_speed_bin(u32 fuse) { if (fuse == 0) @@ -2178,6 +2202,9 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse) { u32 val = UINT_MAX; + if (adreno_cmp_rev(ADRENO_REV(6, 1, 0, ANY_ID), rev)) + val = a610_get_speed_bin(fuse); + if (adreno_cmp_rev(ADRENO_REV(6, 1, 8, ANY_ID), rev)) val = a618_get_speed_bin(fuse);