From patchwork Thu Mar 16 10:20:40 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: 70717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp401473wrt; Thu, 16 Mar 2023 03:32:57 -0700 (PDT) X-Google-Smtp-Source: AK7set8pu+uOpiE3RgBV6JHjTWvOHn3Qeg3TRO95W3QHgJX7/zqUQPYa08LzvBpZaN0N7haV9g+b X-Received: by 2002:a17:903:2850:b0:19a:7f4b:3ef6 with SMTP id kq16-20020a170903285000b0019a7f4b3ef6mr2563537plb.3.1678962777444; Thu, 16 Mar 2023 03:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678962777; cv=none; d=google.com; s=arc-20160816; b=sERSSJMGAEcy+rhBI96DDnMI6jeyOEasfeBLXuSYeJJT+QMraije70zgJUSJIE23Xv Xk+QyzZul2JeNGbRiGuM5pdOM/0wLYEJVVUrafCf78RsYnu0ahUAEb3ZIBYKL+95udJ+ 1N0yoWTsGEcVznnHoyU/FFvat1upnNG7rXh4J6/AfLLkVVFB2LCJ5gJsdpUidO45ng7p GZuCIWzCLfYxL9SVmh9Ioh+DrNKujB2rdPY6VZXZXMU4Q5mIPFX1I8339DkxehJv6Lqc Iv/NboM2vyB3jsELsNlFo3OeAWLpKspoFNvNekJnc+0vl1bIzZ08ll8P//sk5mXveOu/ FALA== 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=SkWIcQMfXmIedj0FqFpfLTXOof7ONZKZBfHtu4sGqNI=; b=0tzY9KsnnvrSSEN2SQuOu+0BNGH23BYYTNKxRP/zZBXKiD1ntmtxnrIV4vAYH+zDQC NfDvbvlvCFIAVZS5HduCpadjHqlRrF6Uf0/S1yeMyRzCB1kcraPZnK7Pt/+rOhQvRYwY omYSAjdqw0QMxm4ayh8BFTESryUULLL60ByLKn3LqgVg/9nb2mo4VmPPSCl9whQxkv0V ku+GK0u5mVuy1HPvwGPH7QAqKwBkKJM4KQ/F8lLMktbm0zsdBd3CEv8UjL4dQtaecLQn qwyvqaMmucf9NEDGDSHNds5oLx6ioksZcIAoJm9+EMqvOv5TT5wXxRXdwAgCfrjomnvj /AOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=CmOentXJ; 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=QUARANTINE sp=QUARANTINE 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 d15-20020a170902728f00b001a05a1735d5si7713458pll.403.2023.03.16.03.32.39; Thu, 16 Mar 2023 03:32:57 -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=@collabora.com header.s=mail header.b=CmOentXJ; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231326AbjCPKV4 (ORCPT + 99 others); Thu, 16 Mar 2023 06:21:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231137AbjCPKVQ (ORCPT ); Thu, 16 Mar 2023 06:21:16 -0400 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 0E4AABDD08; Thu, 16 Mar 2023 03:21:01 -0700 (PDT) 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 1797366030AA; Thu, 16 Mar 2023 10:20:55 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1678962055; bh=lEySQxwP+CBzmjLe1Ez9oQHJ1wF/3PthJcz2r8dmYDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CmOentXJT+KPr7n9fi+2MDCN9eA3JjDJSnGJbJ06B2ipD5GxazaCZ7c16Tyt+ReGM 9tzHzUTQuPdYS2V8jfwVebQYT4RuEWgeHQA04tqgXFiWjD7+sDOnp8JixJEB/ohvbj GmU2FbIAxbYAnDCHUXxsJmunQoB9ASfx5JI+1iQK1XMJOmcXvO/1AAavxHMVKRjx86 qeu+X/HAomJ8hEobxCUh1rIgN5SaatpYuJcQydfB5MwXh0D0/fAvdXXhjN8APoSx7f SwijZdQomMhXJkuoXC8bGoyTwbPwGvU/tiYbgyuX233UWEPyK//40tOGx2geBELVfO f3PRz1uFlrtWw== 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 v5 11/12] drm/panfrost: Add new compatible for Mali on the MT8183 SoC Date: Thu, 16 Mar 2023 11:20:40 +0100 Message-Id: <20230316102041.210269-12-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230316102041.210269-1-angelogioacchino.delregno@collabora.com> References: <20230316102041.210269-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?1760520072999837042?= X-GMAIL-MSGID: =?utf-8?q?1760520072999837042?= 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 45c4accb6a1e..4f39b410302c 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -647,6 +647,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 = { @@ -656,6 +664,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" }; @@ -684,6 +700,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 }, {} };