From patchwork Sat May 20 12:19:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 96794 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp342054vqo; Sat, 20 May 2023 05:50:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ44sK+pAl+tlOixqHqiZCDGBC+eSDLqifrBBFr+SRroEF3dAAW1ZDeuI0XvYPsRMoEaenaF X-Received: by 2002:a17:902:82c4:b0:1ae:72fc:a625 with SMTP id u4-20020a17090282c400b001ae72fca625mr6185632plz.37.1684587002502; Sat, 20 May 2023 05:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684587002; cv=none; d=google.com; s=arc-20160816; b=Ix8UXsQwH+G+Eosq8ZNtvPAnXDiqppEDF0jQ/5kIdzY1tRms6j/kNAM8x0ZxGvZnoC NpK2/oWE3seWjSA2IrFj1EN3tgakIqMCh0kPyKBDbmv7qq9IBI3t1mm6tLOHxYTVUlC4 rdmgukPc0MY/9+nZwcxJuXc9TBBY+PSqN+SEF+lG8u8Cj9ls0zdYLFU6uyUFC8rWyzVY zCmQ6gW9HlFNHHln48HCSDQdJASBliVSGk/U+xPakLn+dZzlNCvV5DD2YmqEH+n8GoEk c1U3cL0QceEIdDggrqzNIgCdP4JTJokHw7Nt8WXLlF2PgRpoDHLadA9LnNv/5Tq0Aeip f0lA== 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=VGVJDUVzLD/MSS0RtIw1KV+SoY/TdXx+81YSilsEy4I=; b=XdA8to82rU1fSzxKnzJ0Z208ejQXoSHkO/rEp1xyxUSQgypiyi/V9wkgVEsxQFqFiV oMs+p76sbfZphEbbp8+FFwUlDpD7ft/pbilKtWbWPfvf9JLJrqu349/07RebbOjLnyxX OOvYLxv4N+BlpjmlUIasq0eLdaJcyV1l/5OjsJFunnQujpisSAGIgXZv/F+3ElYiuA8x ybX8tsdTS6S6jo3lqdnp063II6HOvMIcFDXIbCCmA9TzHDX5EkICOnj0q6/OaNWxFF0u 1Ahn7kTttEkNY2KcLCQA4jXgV/tITsOloCspqr0rz+UkaxeK3ISndc4JDNoMftlyqTyG l7SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hxrpeuCS; 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 r12-20020a170902be0c00b001ab13016a76si1322509pls.601.2023.05.20.05.49.48; Sat, 20 May 2023 05:50:02 -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=hxrpeuCS; 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 S232042AbjETMVq (ORCPT + 99 others); Sat, 20 May 2023 08:21:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231892AbjETMUx (ORCPT ); Sat, 20 May 2023 08:20:53 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 918291722 for ; Sat, 20 May 2023 05:20:18 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4efe8b3f3f7so4755884e87.2 for ; Sat, 20 May 2023 05:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684585214; x=1687177214; 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=VGVJDUVzLD/MSS0RtIw1KV+SoY/TdXx+81YSilsEy4I=; b=hxrpeuCSCHVlpA+2MThbj6OBvovY9fnTj/JGHkFH3cfAA4nmLGW4mXSf6YAwE26wmf oLpt9v6z6MKePbU4M3H6Fr+oiB5E53NoQXlDmAIfcXrCi2UEBO3QLL0YGnrpH/0agsI7 43KIquRD6tK+h7ATC/Ym+/htnr4y1yvXEmpCJ0ql3J4+6JM5v8v5fK864zrSk69/cz1G tAlEDkgIe+UKHoUFuK0uPXCqC/377FNnA9hR7ThuI4rtjeLySm6DBBHNyswliDG6Vqq4 9GZ4cd4+cgrZ1VwOqyIbpUqSlefXZ9q/mwZklolvbt7nPCRTlNjd1Eu2+9kUGtdlYN82 2hbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684585214; x=1687177214; 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=VGVJDUVzLD/MSS0RtIw1KV+SoY/TdXx+81YSilsEy4I=; b=NfX81Jb9Flc3RUrUvtcE3eM6A0DdpnmVWX3cwZrLKcXvC49U4RC/i/WceSyH7ocoZj WKNPQI8zJqaNYGXkVDtHwsnpxU4V6ZRdcdBIrrVxXZx0u0vNLYOgcvYmiiWODqVr3K7H ESfzkhwJy+LXwgVNL3wpRbTBbGCqPhzhNTy5PzKfG7zMMWoOoBsJYn/tsiRWDzKtM+Ub VuG6CsQTUv1kYIUaezHqIyC1+V296OBC3o/e1ImbdY2FSnm9pah3H4IYm5n6rIR2IgCq N5TSRuw7rtxcseqyux5kGPEzOwYJFovEmsHySXA6hrOjTU0LmIhKsSk+bI6mhNzK8Cmn b2fA== X-Gm-Message-State: AC+VfDyM1Iddfv4x8MEz1PQel59ik4kzwuRa/CDlXeAtNwZnIsmmhFf+ zZsribwKciIZ7dCugBPxDq/Mgw== X-Received: by 2002:ac2:539a:0:b0:4f2:769a:120e with SMTP id g26-20020ac2539a000000b004f2769a120emr1581950lfh.2.1684585214408; Sat, 20 May 2023 05:20:14 -0700 (PDT) Received: from [192.168.1.101] (abxi58.neoplus.adsl.tpnet.pl. [83.9.2.58]) by smtp.gmail.com with ESMTPSA id y6-20020ac24466000000b004f37bd02a89sm244766lfl.287.2023.05.20.05.20.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 May 2023 05:20:14 -0700 (PDT) From: Konrad Dybcio Date: Sat, 20 May 2023 14:19:57 +0200 Subject: [PATCH v7 17/18] drm/msm/a6xx: Add A619_holi speedbin support MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v7-17-ecc7aab83556@linaro.org> References: <20230223-topic-gmuwrapper-v7-0-ecc7aab83556@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v7-0-ecc7aab83556@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=1684585186; l=2033; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=JE+me8wGwvbnigS+vGj1riDnfhLDy9pbL1Nubu9j+Dc=; b=dT0oolqAVMMfgO9v3OoI1L7wZfY6VcvoXmE+KZnvpMRRrSkLeeK/PGZdVcbjn4ZCPycmZ21nx xGdZfeBZUmFCKCLxETbmTMGf8f1a8qxk/0opUNcKMwsqX6hphWypB3w 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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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?1766417500847556158?= X-GMAIL-MSGID: =?utf-8?q?1766417500847556158?= 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. Reviewed-by: Dmitry Baryshkov 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 5ad19978390c..c07b25fc2bd9 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2114,6 +2114,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) @@ -2174,6 +2202,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);