From patchwork Thu Feb 23 12:06:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 60943 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp276686wrd; Thu, 23 Feb 2023 04:10:56 -0800 (PST) X-Google-Smtp-Source: AK7set/MzRFBpcFo2PJVhCnBi7Fd+kUxqXCMbqdADWfIdUYQ8HzDI6vQ7JNrcgzqUT8s+Fb23XOW X-Received: by 2002:a17:902:680e:b0:19c:13d2:44c5 with SMTP id h14-20020a170902680e00b0019c13d244c5mr11544897plk.3.1677154255755; Thu, 23 Feb 2023 04:10:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677154255; cv=none; d=google.com; s=arc-20160816; b=lmtAsqo79Sa7e+WEqNLaU24kjtyX6Fd5AxLZAbo0b/1lB+x6NRhucnNJg1cgJKUIVH pw8FFQwPwlYPArEdjpx6wP8bOC/dpN8gNXdCdDPfM6X5qCeqwzqG1WvbTYXyD691djN7 X4JymzkJX/FFrZSawk2DyyzY/KAd1nrqD/JpF+l+2YRaElTjUy2Jrs/oo3xWLsSwaUPM G8ZT/maf3P8RjmLxjXr/RV3XctsKpUsWof62KexQnEgvIOs/C5xAfto8GU22uYoBhdJI HDc4iVIJ0rUN5aAT4VxGBF1HQgeXjH052OdtNb7Y3evAllQ+iKaCUKU8yhX8elP1u2y+ SZlg== 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=C4+BbvaxTKosi1VX2ZfgyFw5uKrIVyEHJTEyhGEltZ8=; b=bfH0Smy5t18UApnx52AQ2UjFt2r6KuLeMy6UnayrC+/PH5lMjGzMjakZ/U80cxF3Fn iFh9ORHZ/BVaCbwAehvEs9AWendYI8w2mSej2tUgzk3nh74sa/YOoe/Ci0m0kIr/SiVq ODhZXXUIWdmHHdjE1aZ/9FmSsj1rgkl9a2MmcvaUktM4EyF/nARmPGo3WSJ/Z2qicJid u0jb8M7PPtOln9zv0S5eZE8HrFWQU53Ri5r1L2WeqiIWkcQX4wqcJBpURjZOF6gto84d hOnQHScyvZ/oRKJ6aWVi60+/LWTyMCA6R9aUD6FIrLy5bIr2RKv67JElwlRLOXlG4Eih 5XFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y2jcSJHh; 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 k11-20020a170902c40b00b0019ab5ce607dsi18058832plk.593.2023.02.23.04.10.42; Thu, 23 Feb 2023 04:10:55 -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=Y2jcSJHh; 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 S234152AbjBWMHx (ORCPT + 99 others); Thu, 23 Feb 2023 07:07:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233963AbjBWMH2 (ORCPT ); Thu, 23 Feb 2023 07:07:28 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 934F654A1F for ; Thu, 23 Feb 2023 04:07:08 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id r27so11391657lfe.10 for ; Thu, 23 Feb 2023 04:07:08 -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=C4+BbvaxTKosi1VX2ZfgyFw5uKrIVyEHJTEyhGEltZ8=; b=Y2jcSJHhF5U7EQu4pplmwN6DCqvLxec404zwfZZnPgxsphRj/bZKem0lSAXaMsKAPF 4IVbe4H2jrX3UZbOoh3MyeDnq8yRX3crwsGY0UDg8F8wo1yxX+KiFtRiWeP9OTwhaSHq mU3xs1HoR0dgTBhQjEv1e4VUvDqucQ1JVcdLXEeKnsvVSmZbelyiiaGNZy4ilyFoW4LF fcXKmYY7Mh5f5yV3b+mA3S1dUsnPcfd9hm+IL/kC8X7lOwANQFIpXQYMnlSZnAE8EU0m tB0VOaJ7j2XemYKYIO3cverm+e45CmLb9TN0zsXKm7H/4I7Blpvbpgai+dZUIc7glGGU feAQ== 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=C4+BbvaxTKosi1VX2ZfgyFw5uKrIVyEHJTEyhGEltZ8=; b=O9b5RW7Zt5wN8CbHRA+1vIiuDcIMmk4RXpFlF1bx3uMJXH+xIhcLic6xZpQ5I04Alk lHK/vwJ5EC+RiRCHrAUo+gEgIbSB8BLUaJM8ldIG0IWbnY3HxZfLk4kPHD312LaBLgUZ s/GJX4J1YYcx7I8SvBmlrzpo+RS93U3fOyAhHp4wEzLBFrMJNY0WYnaYtIfcWAc7lGPd 4wChKkoENc40cZenMoW5FRKMKm22q4stl0fm8MoZTk8ZIh0SSe+05F3Hcoga1GKf3PMo 98lmQ4x0d+S5V5gKuwkNtvMtgkqOp1LbtTso+5UjHsbCBZCZtjb8uEpO2Z/AyRxPBoKC o41A== X-Gm-Message-State: AO0yUKVHG4WywmqjvvfimdenQHvRvrVoWue1gH/RfR1a8TstYf3UfKd2 UU6ZP/PgeZD2wye1/8OUuMEDig== X-Received: by 2002:ac2:54ab:0:b0:4ce:e95c:f300 with SMTP id w11-20020ac254ab000000b004cee95cf300mr3781292lfk.39.1677154028161; Thu, 23 Feb 2023 04:07:08 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 04:07:07 -0800 (PST) From: Konrad Dybcio Date: Thu, 23 Feb 2023 13:06:49 +0100 Subject: [PATCH v3 15/15] drm/msm/a6xx: Add A610 speedbin support MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v3-15-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=1852; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=gmn1Idn/yrEmcHwFxm5qk9hU1gD03yCxhKSKpAQYKug=; b=6S8Wn5QB1UAWFq1YBi3uGUxAV7PpjS5h2hGvXXaJ1yZCevQezsRpJqu0PBnlHJn+L2usM1ipmYK9 ml6T9bHWATtmbl+C50XUojlihXpuGxw3y8/01fMYjx91UqJg0ouL 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?1758623700649243728?= X-GMAIL-MSGID: =?utf-8?q?1758623700649243728?= 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. Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- 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 81f99f8d1978..f78077abb886 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2151,6 +2151,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) @@ -2247,6 +2271,9 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_gpu *adreno_gpu, u3 { u32 val = UINT_MAX; + if (adreno_is_a610(adreno_gpu)) + val = a610_get_speed_bin(fuse); + if (adreno_is_a618(adreno_gpu)) val = a618_get_speed_bin(fuse);