Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2256705rwl; Sat, 1 Apr 2023 04:57:34 -0700 (PDT) X-Google-Smtp-Source: AKy350aJnVQ++bgXHrL0vNPzVYW1w3QXri9DtWoB4DdHMFU+8IaoLWqOPauHL1ICOl9g4uThe1CK X-Received: by 2002:a17:907:a50d:b0:878:481c:c49b with SMTP id vr13-20020a170907a50d00b00878481cc49bmr35307084ejc.1.1680350254382; Sat, 01 Apr 2023 04:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680350254; cv=none; d=google.com; s=arc-20160816; b=e7PKJH83fbUYSjY2fZZbX5v3JjlZ16D6VsRfo9VmFqv+Cg4wEqCmHGpAhdDwlIzwEA fLkNIs5N0zEXuyY4ciXCTGh0cWw+YefFXioB92A1Y8pi+/UCAeRkAhbl5i3sPe+HAaRf 9Vc4QM7YDlNcswTbl62XTqQjTA9bx+LDjEJJBlUGrChUMr2fQDt7DxEatnPqUWo4sVZ2 bXHuomaNvk/uqWZks5ZG18HqvvcWIMeVTbxlRLWn+5bX95bA1VaoAbjJWWEi3k8hmaPR uoeGSSUDvrejMvF0phu3a+M6OEFBiyEnMQ9hvnnYPjBlSSJABjsevcFin04IbpnOrmLi e7cw== 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=PvltTppQ4ytNI2iYvcugGpbwqcOyX8AShb2FaDucEqw=; b=r8epgapavQIExASk8//tTknckaFDdRPZPcj4XiWp3pEr6IpFCJrX/LcUjEHxN03lPI IZO++IAcagTC6wedG8OLp+z/TN8FjFHliJU7p+d1RD6fXTzdWKK9BnNilyQHPvIpmzdp Kv79SuqXRU9VUdGps4AFYBWJZD6Lacx8z6Y5jIdLX2PIZK2aWZJsNhmc5RBAA3krN3TO 9L8LuENvemcRdXBV/PTyUyiNLAehEplQ0VYbr0U9rZogNSkuxQGnRx/lTrD6g4U5VK7M d/BAO0c/xHkvWSuANaQYoa3BlEK6vIvJjizZdNLDA1+h4dvyGdBBE13peOVJLVUu6bg8 a3fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ihi5GmzE; 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 c6-20020a170906340600b0093a142182f3si3930155ejb.400.2023.04.01.04.57.10; Sat, 01 Apr 2023 04:57:34 -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=ihi5GmzE; 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 S229940AbjDAL4O (ORCPT + 99 others); Sat, 1 Apr 2023 07:56:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230062AbjDALzv (ORCPT ); Sat, 1 Apr 2023 07:55:51 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B2D024AFD for ; Sat, 1 Apr 2023 04:55:30 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id j11so32196105lfg.13 for ; Sat, 01 Apr 2023 04:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680350129; 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=PvltTppQ4ytNI2iYvcugGpbwqcOyX8AShb2FaDucEqw=; b=ihi5GmzEWv+VcAzvHfPcBqkwlEsowoxk6+WHE7CwZQS+/SHgEFgKpnHsdQnG+Ab7PT 5qo+R699O5MLKGhG9k3gW4dxJlNkeBQU5KlgcYobFXhkgCXV5Y9kCaqm1YZ9DqHEC9EY kf9VdX/TJSOsEnl7KbjrH+liuFucia+1jgHaN9ZJssfYYDaz2wibtce+7dOLK/0jmFrS eekaC3fa6d1TeizoG6IHfoHO1fE6RDhr817M4iLG9GEqHHgEYcELJrybFC/Hzu5VZeU0 XQH121nP4g1Fr/Hje2FbVL5lbPH+pQZLxoqKV4zlmnny+9jWxBkm4mYqUBXB1tOEc0uu QUgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680350129; 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=PvltTppQ4ytNI2iYvcugGpbwqcOyX8AShb2FaDucEqw=; b=s6El+Ck00jsGuvi5GEV0tsrNRqVvkBCHALWjEXr+DlBCFnHiULPikRefYjjoyYsNgq 5osnN0wUMpM/G5AbwTU8KXVOkOFpmJYcPFNG2/Kp1cb1+sr2ZJR9YyAAh2XhpcvRl57s csoHBiO4ICQeDrl6TZbRXTaTN+p5/DrT5g6dhXAyvvKqdg0AG9pP6CrU1EQu8i/OiUue 1VsXmAue+5hCkI/TzJHpxd9GmsVbKRZThrYW+mX4Vq0nTTa/nw9d0GvdHCTK77BDU0aN KNuK34dlNzTJh5HlokIvPt+Hc1aaS1ab+njPlPhXC5ePqL6MyikM2jzfVMzFkOkUd4+U Hybg== X-Gm-Message-State: AAQBX9eK+935rNrLB5H0D8W5v/sET0N9ruw3ws5w5JM53V9S8JQ3U9jZ kS3gczU8Dxd8+lCbxXtgfzbjxw== X-Received: by 2002:ac2:5288:0:b0:4eb:2d47:602 with SMTP id q8-20020ac25288000000b004eb2d470602mr2203727lfm.59.1680350129586; Sat, 01 Apr 2023 04:55:29 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Apr 2023 04:55:29 -0700 (PDT) From: Konrad Dybcio Date: Sat, 01 Apr 2023 13:54:51 +0200 Subject: [PATCH v6 14/15] drm/msm/a6xx: Add A619_holi speedbin support MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230223-topic-gmuwrapper-v6-14-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=2033; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=TnC1uZLteG174FfRp1Tk1pi+iYNuA1vsyt7TElivWgM=; b=q0RiUq5vPj5sHbjyimWm1HIHMcjymEkY+z2mS91KK5DtNd2pLzHtIBFkJ00F2F6/yBV5FQvHu5NK ov4d3OHFDf9jaPJPJhJTc4/u4Ra63DzEiU/mtPGdDoZWZk5zJc4/ 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 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 6c84ef82e504..f692f540c13c 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2112,6 +2112,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) @@ -2171,6 +2199,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); -- 2.40.0