From patchwork Tue Feb 28 10:27:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 62407 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2934471wrd; Tue, 28 Feb 2023 02:32:32 -0800 (PST) X-Google-Smtp-Source: AK7set/gXeEGYtQbuAXPZSoR37VvTEbGb3MyQ6dpXsFL/0oLGtEG2xpsmNRRxIRpCo5O4oF+Ht/Y X-Received: by 2002:a17:906:9f19:b0:8b1:3131:76e9 with SMTP id fy25-20020a1709069f1900b008b1313176e9mr3628151ejc.46.1677580352076; Tue, 28 Feb 2023 02:32:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677580352; cv=none; d=google.com; s=arc-20160816; b=zYYDqAvCcvSpxp+hehuWEI1MMlKnE2c8O8Qeuzp0V/c2ZcnxAqxkGVleKIR5b/sos0 Lp69wMPTNwIbacDHJXzsx9t5IDyzgas4fHFCcSJ9GFx33FbSblUvHrFpiVuGBWz9HWnb 6o4mX/6IR/lCm1ZG7rFDWSt4iEXopPdOQT/7ze5hVAYaWJC/Tre6m8TrFIhEWt0WvP69 qnX0aUMTmgzHX4dMCTe5i7qKMdVPuXhmDG57YAHWd6p/6KsOsRMZdbxTehk4j+i7f0Gt 90bx8WUXDr5/J4X4cKhlF6ia7dLDK5o4PIWdUy4Tf1J81ZV36g1pQ7Iw2d3qdjIRvPfc MLEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kJkPXXd0E1FJFKrycqmi608Pd6u8FQxFygP/oYqBqwk=; b=zsmQxSve5Cm7neBdkiIQyGF95Inp0vHFuIxIYrCoNKLeamNgax4bG/sLvTpMrLpuit fA2ZHSVt8vosEHC9G7KOtBLMD7LnlveU68GyW4e5Jv1wwYuFSQq3vJa7Q87tKKHjQTml F9WFnb2O1Ocyofmhc8Fm7py0Pb9pe1cRs3P4rM07c+yJ8RJwvYo4aos0zmzZXPsPoV7J 1RwakBXGzlCWYOycBKcPr9qjD4mozuz6Wj7bJPN+3sLAE/fQSz2HY/w2xN98xZ6jI1C5 O/Z/bxymCUctlNGJscrJ7lTtNv5X7jmQ9k7oLEsLuDhLphq2UcgJLU17ZYjEzof1nv7n 8A3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Qpy69orn; 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=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd10-20020a170906ce2a00b008cb6722b1f2si1833692ejb.991.2023.02.28.02.32.07; Tue, 28 Feb 2023 02:32:32 -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=@collabora.com header.s=mail header.b=Qpy69orn; 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=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229762AbjB1K16 (ORCPT + 99 others); Tue, 28 Feb 2023 05:27:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231278AbjB1K1f (ORCPT ); Tue, 28 Feb 2023 05:27:35 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 521392DE75; Tue, 28 Feb 2023 02:27:20 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 1ED596602FDD; Tue, 28 Feb 2023 10:27:18 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677580038; bh=d98v4XkYuSdlaBMRVhy8ckf3WPpqfT9gFqNu9PlgtLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qpy69orntrXDViupi8/DK29prpf9GYT8qb8Ln6gnx4JzEs/k1BRLwAvGJ6LXpp+2g /NvsuUea1bUD0csMXDqBkmm33isexWvMquveQqUidIrHovwyW18uj6dzVf1GkvBOcz RQ503puGDYPDuszsHcytrysZoNnwm44fPgNzuY61k/x3xuziscvAB3Te/dOfD1YyW+ YeQWOvIy8w+3CxbtJXSez8BWjG/O8zalaFEEaQqcXJENRlolxLx6ptROUAtT2f6DGO dtGdu3POoMF52pYdQYCwqUtINTTj5etgVLE9b0GEJnCdyG2T0rawleI1FAv89ZxlmA /5ohiGzZ0Oejg== From: AngeloGioacchino Del Regno To: airlied@gmail.com Cc: daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, steven.price@arm.com, alyssa.rosenzweig@collabora.com, matthias.bgg@gmail.com, robh@kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, wenst@chromium.org, AngeloGioacchino Del Regno Subject: [PATCH v4 11/12] drm/panfrost: Add new compatible for Mali on the MT8183 SoC Date: Tue, 28 Feb 2023 11:27:03 +0100 Message-Id: <20230228102704.708150-11-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230228102704.708150-1-angelogioacchino.delregno@collabora.com> References: <20230228102704.708150-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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?1759070495413770675?= X-GMAIL-MSGID: =?utf-8?q?1759070495413770675?= The "mediatek,mt8183-mali" compatible uses platform data that calls for getting (and managing) two regulators ("mali" and "sram") but devfreq does not support this usecase, resulting in DVFS not working. Since a lot of MediaTek SoCs need to set the voltages for the GPU SRAM regulator in a specific relation to the GPU VCORE regulator, a MediaTek SoC specific driver was introduced to automatically satisfy, through coupling, these constraints: this means that there is at all no need to manage both regulators in panfrost but to otherwise just manage the main "mali" (-> gpu vcore) regulator instead. Keeping in mind that we cannot break the ABI, the most sensible route (avoiding hacks and uselessly overcomplicated code) to get a MT8183 node with one power supply was to add a new "mediatek,mt8183b-mali" compatible, which effectively deprecates the former. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Steven Price Reviewed-by: Chen-Yu Tsai Tested-by: Chen-Yu Tsai --- drivers/gpu/drm/panfrost/panfrost_drv.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index 5d25e77e1037..14cdeaeeb5c4 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -654,6 +654,14 @@ static const struct panfrost_compatible amlogic_data = { .vendor_quirk = panfrost_gpu_amlogic_quirk, }; +/* + * The old data with two power supplies for MT8183 is here only to + * keep retro-compatibility with older devicetrees, as DVFS will + * not work with this one. + * + * On new devicetrees please use the _b variant with a single and + * coupled regulators instead. + */ static const char * const mediatek_mt8183_supplies[] = { "mali", "sram", NULL }; static const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" }; static const struct panfrost_compatible mediatek_mt8183_data = { @@ -663,6 +671,14 @@ static const struct panfrost_compatible mediatek_mt8183_data = { .pm_domain_names = mediatek_mt8183_pm_domains, }; +static const char * const mediatek_mt8183_b_supplies[] = { "mali", NULL }; +static const struct panfrost_compatible mediatek_mt8183_b_data = { + .num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) - 1, + .supply_names = mediatek_mt8183_b_supplies, + .num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains), + .pm_domain_names = mediatek_mt8183_pm_domains, +}; + static const char * const mediatek_mt8192_supplies[] = { "mali", NULL }; static const char * const mediatek_mt8192_pm_domains[] = { "core0", "core1", "core2", "core3", "core4" }; @@ -691,6 +707,7 @@ static const struct of_device_id dt_match[] = { { .compatible = "arm,mali-bifrost", .data = &default_data, }, { .compatible = "arm,mali-valhall-jm", .data = &default_data, }, { .compatible = "mediatek,mt8183-mali", .data = &mediatek_mt8183_data }, + { .compatible = "mediatek,mt8183b-mali", .data = &mediatek_mt8183_b_data }, { .compatible = "mediatek,mt8192-mali", .data = &mediatek_mt8192_data }, {} };