From patchwork Tue Mar 14 15:28: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: 69703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1830552wrd; Tue, 14 Mar 2023 08:40:26 -0700 (PDT) X-Google-Smtp-Source: AK7set+Yg/x7pspZvBTFh/pUL7Y7P0GbTvJcJ4sJS+jObi2qaa+rqeIFKyjqyfGDhzx+osfj6tN0 X-Received: by 2002:a05:6a20:7d86:b0:c6:bd82:ea2d with SMTP id v6-20020a056a207d8600b000c6bd82ea2dmr53963407pzj.2.1678808426564; Tue, 14 Mar 2023 08:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678808426; cv=none; d=google.com; s=arc-20160816; b=frANajqc9mJGHQo6VD+jmweewhz0/yPrpPjckKZ41JumpNTrU+Jb9JzJXu3Yiu+MJV xVWmBgy3r35/lgjopSN4IztX47ERwRQZT+2bqTYuS62NOAoCf5tOfOTkbxzhThnrqSX9 OlEwl0/5CGknQOrNuMJ0+0wqG2zoy96sy+tP5wnJCOIP4wSCNwj0obrb1tYeDcrUqsV4 C8XkY4Jrx1EYiWN2btBLLGqLnHz0TCFGYeWe+cOYSDL9ovkD9N6I1jfbLqpXE7ySHm55 xr7eD/JVPGOz2l9QRYGAGr13xLrZDDsj/2YnMXa1IZvQ/VPNzWdqj1sRaX61Xr1Wiazj Y/uw== 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=/rMi4z3KYpk1VOXDtleM/+v4nMkai2X+NZaj5fWAot0=; b=M2E5GdUkfSHJuSWqCfd0m9SKOM1S112SBcZGfZ2SN2AXy5M5ZXK7jVw1kn56Too+iH ikz/zf8gwEZcWfuQM4I494urOjwIOeYNppSn1zmTCrR0qGZXNPMOHPy60q8iFU2E96bI aBvoNrg5IMpCtBmFEFlsp4b4laVhJZwk18AOIExEKWOvFlTAHwWg7R8tTPu0Ocrc9WnM c0wdU2I1kYYA6ZRbZj6+j3yA1eTXDMnH3nxol2/xy6FJW9Wo8tkZlRrDfIIX/6RXKxud lB68e1MUl22ibyF+XSpPADiJ3u51/yp9czW/XGeezpFW7SNsdtwkRDX0A1ltQo2+HmeM IqFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GV/tteMa"; 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 j30-20020a63595e000000b004fbfeed0848si2373696pgm.798.2023.03.14.08.40.10; Tue, 14 Mar 2023 08:40:26 -0700 (PDT) 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="GV/tteMa"; 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 S231704AbjCNPaO (ORCPT + 99 others); Tue, 14 Mar 2023 11:30:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231690AbjCNP3X (ORCPT ); Tue, 14 Mar 2023 11:29:23 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88C6C62DAF for ; Tue, 14 Mar 2023 08:29:02 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id h9so16425051ljq.2 for ; Tue, 14 Mar 2023 08:29:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807741; 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=/rMi4z3KYpk1VOXDtleM/+v4nMkai2X+NZaj5fWAot0=; b=GV/tteMajEXLkq7QRWvhGA9tMlhuJp/N2TPtYTY0YtLZQlTqkOTuIJ+KJwU0HqvSND xGSr/TymnSrZqWdGV3dGwJHCHSX1GpSUcYgNQe/A8PGmW7SKKznrUpk5ALLQAEMeG9rx /XG2RkujzSZ+Ciah38NKKTrq7vN5WRpzPlvjCFFRy/bNyFYfVt8Ef5kxiuulvIT59XoI vXAa566h15OVTxr35Iz+0GhOW2Nhhnr+7TqUu03lv+f2t6bBBKynYOG4NnrqcVpOFWKJ Zy+TVLtPGwdAQWe9s5RudeIOFXfuel+dLMcI4I3dKyvLmaAfUblEGKcxmRuzgLfwKDD1 HIdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807741; 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=/rMi4z3KYpk1VOXDtleM/+v4nMkai2X+NZaj5fWAot0=; b=VJAXRSQxNz/iNAH6fdBct89K6AN7Qk7TDcnM9eA3MGd01dMoVgQeamP+L2GBRILUkJ LqL3UNh9OLBmPDFT7NOqAUtYRfcNPn5mXH0ahLiFHPhqFWqAK15ied3nXSgkfFTHIkPP 1YSzF+Wz60D1pC6YbKzj6BogMLK7Ji2HdrYVd7ZSNDb6xEVDfc9cNMXFxerpUEgjgMQY noZ05SeIiM9H5Nhjt6x6c/Z3HyTss7TOg8zOr9NSMoJBLC5J/XESMlnB2cuwNLfWEeCE Lw3j1JMLA9SZCsFsH6XWMcLdXJAI0502KZ2Jd515d7yt65iQA7Lg1eGcxLzkpkSyeXLW 4bdA== X-Gm-Message-State: AO0yUKXgv2ydy5MTJYXBsjwJjl6vxzzykBurbGtHO9tpKT0ODXOTpS6F s4ESQbhataVizdONIXVQVdwijg== X-Received: by 2002:a2e:3610:0:b0:295:acb9:8610 with SMTP id d16-20020a2e3610000000b00295acb98610mr12822310lja.25.1678807740930; Tue, 14 Mar 2023 08:29:00 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:29:00 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:45 +0100 Subject: [PATCH v4 14/14] drm/msm/a6xx: Add A610 speedbin support MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-14-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@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 , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=1852; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=ZWxWz95kNFsOaOSTnUEHkUaKyj0DdIwF1Eu3I3PdtGk=; b=KpKsSEXRQhg/MQJAmTRWDZjQlF+2ofojhmqZlx7eSqwxni5o+DCOvcHjBxCErE0ijWM2Fb5c/ZYL mYoD898IBUAF5lQbLmP9ZrsLEqozfQMp+QSYOnwJjDo2iYl97Y1+ X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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?1760358225138016667?= X-GMAIL-MSGID: =?utf-8?q?1760358225138016667?= 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 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 27b96a335039..f9f1a6c50f65 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2136,6 +2136,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) @@ -2232,6 +2256,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);