Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2256860rwl; Sat, 1 Apr 2023 04:57:48 -0700 (PDT) X-Google-Smtp-Source: AKy350ZuRTz7erpWGoI/78eXMVCD6HmrikZVTFZ4YxjkpYK5AM8VD2z8rQCtKlP+P5YbVuv+YEEX X-Received: by 2002:a05:6a21:99aa:b0:d9:1fa9:c59a with SMTP id ve42-20020a056a2199aa00b000d91fa9c59amr13557139pzb.8.1680350267888; Sat, 01 Apr 2023 04:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680350267; cv=none; d=google.com; s=arc-20160816; b=kT4JpBCGXIuPr3BWCYd3hlB7OdRVsDLDzXwQVO+MdWZiYYZJwyQMQWGshdZN0EQBKM CwzXm9okYLRlUkIb/FSGz2B9wNO2LcDMhVQD6uB6X2IRgYCmrPiNlPo7yNnrprnjUpl7 8jfqfjgoZcgGADQuGnN+/ZeDfaKzy7jRAVTEWRGlXDk5c9ZxrlGhr4D1RnV3nPmDDw6B 2qvj2g5FBHOpG4Q+AXgKDtKIlYQ20F8tcEPCTErTjYGjsKVkWLudndjEzi9i0jiwcNYK UnXYNyp/V5TGHUZSLeEehTegXNKa4h/GjvouQ/llskuWATqwgaJrqC9jFn7zzUTCGI70 3/rQ== 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=l7iaKrmXzAocug0zm1BXOXimd3i27ycjAt6X7axyt1c=; b=neXUztTwQAt9do/JDrn4qReWP2GOdwQYIPT4r5+MJftLBu5cGP7R5xr+fO4EhRAOuF NPb33gxhfW/snPtNqY2/UfVTMIkyjKZncjvt8O0PuiANm806w9sXld7vpISZGY0I+OS+ DOBRVvmlxrWZbYrNo/qAO/J+1ckOvkx1E+M0TbhPhv0fOdCyOHafOO08eS5JtDKs3KOx 1oSZbR4Ezfb1RjlqNN8zHMU0px556f4YlTcmX0f0Zrv0w0o/ZPSgUe2R2qihIcmoDa44 Ky2ofM8QqBPVvCIRCiR0mB7UFGFSxhxBmzmEP2JGJKsrK/2CfXWF2BQzdIPZPZTurCIG 6+rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=huSfh3WP; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a6557ce000000b005073e3342eesi4641281pgr.143.2023.04.01.04.57.36; Sat, 01 Apr 2023 04:57:47 -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=huSfh3WP; 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 S229832AbjDAL4a (ORCPT + 99 others); Sat, 1 Apr 2023 07:56:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbjDALz4 (ORCPT ); Sat, 1 Apr 2023 07:55:56 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6F96265A4 for ; Sat, 1 Apr 2023 04:55:39 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id h25so32233699lfv.6 for ; Sat, 01 Apr 2023 04:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680350132; 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=l7iaKrmXzAocug0zm1BXOXimd3i27ycjAt6X7axyt1c=; b=huSfh3WPWOS2hUfnr6lymatuU4DazhafyQESbHCwz8Ux2BCzKiKR3v5FqeLRU7ZiaG lgvVM230rE0+NDVKiljZYLo75J16DwD20JogzRb4tvNyNqXe4Ou4ku0kHLPlnOX1M0ZM 9qG/mRyuVeib84/v6csmnNde7gUfbYKX4aRuoqas9hSBjUMHDzLR9Pnx3oscWpKSojmW XhqVJ87ULKEBcdD+UaCFWSLTlnAm29es/bjn0unZqNZMgXVkT5dXgzWJGf6pt7iQE4/G j4v/VZjeXhogtWAVq9cFlfGQVNQqc9cxXxAA9pzpJ5rdI8VUqvy65zPSnoO5nwEwkkir kppA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680350132; 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=l7iaKrmXzAocug0zm1BXOXimd3i27ycjAt6X7axyt1c=; b=AbPKvbhT1EZvSNXLqaQ0txqDUBxNsgKQCSuEJHXb5967H6i3S9LHPa0hPSEHdfhHqh fm7RA7/ZYVrlv0v23KBxLxUPMkLGuo638gnjQ5nA1vDNTVwGdl9HagCzb2+SCz7K+7PH kr7LhpX30Ui4aJkP13MhhZF22s9Igtcqz11haQmb6oaWWcjXSkhhb39ixBt0IGUczm8C /blzkRNE5bJ/ns7/OUISXx3z/yqeTqlbj0CLaS5uIieLJiHPEtqdgBq5qzOlIuB/LLHQ XlbqBwM96vzQeXFdpCzRwGYMSUfvMoSpTFQpn1+RafKmPxhK71JW8yDiR37G3y7RSm1M sW3w== X-Gm-Message-State: AAQBX9fd/89Dlqzb/9KoTliIaS8rKQO1nrWlJyf77Yur1eNEE5PwtR8h PO8uMWtbSnS4XxXhZDI0wi2f8g== X-Received: by 2002:ac2:43a4:0:b0:4ea:f526:5bee with SMTP id t4-20020ac243a4000000b004eaf5265beemr7893904lfl.11.1680350132632; Sat, 01 Apr 2023 04:55:32 -0700 (PDT) Received: from [192.168.1.101] (abxj225.neoplus.adsl.tpnet.pl. [83.9.3.225]) by smtp.gmail.com with ESMTPSA id w8-20020ac254a8000000b004e83f386878sm786737lfk.153.2023.04.01.04.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Apr 2023 04:55:32 -0700 (PDT) From: Konrad Dybcio Date: Sat, 01 Apr 2023 13:54:52 +0200 Subject: [PATCH v6 15/15] drm/msm/a6xx: Add A610 speedbin support MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230223-topic-gmuwrapper-v6-15-2034115bb60c@linaro.org> References: <20230223-topic-gmuwrapper-v6-0-2034115bb60c@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v6-0-2034115bb60c@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.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1680350084; l=1852; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=/AkqnGngmcLmZe0/0dqCMVNhVeDNpUZqOtTS2j9nX1Q=; b=usbd75h1G/MzZMxQHI2wq6t4BEKTNhpk+Isjf6v/HYYNAGutNoR1I0u4FRvYOZtYxNIEFB5z0ccu bEdbYbPfDgPxI6HxpJwVMuOz7DB944fAMB/nw7uB9a+8Ff7nuHQO X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=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 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 f692f540c13c..e3be878afbb0 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2100,6 +2100,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) @@ -2196,6 +2220,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); -- 2.40.0