From patchwork Tue Feb 21 15:37: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: 60146 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp80009wrd; Tue, 21 Feb 2023 07:46:22 -0800 (PST) X-Google-Smtp-Source: AK7set+kQ1YTVtrEsMCjM9BQ91ZL/RG9XXw6O8UPgLAyPYNNUWJ9ClLNG8lQV4lMO8akjr2anpui X-Received: by 2002:a05:6a20:6910:b0:cb:ac6c:139d with SMTP id q16-20020a056a20691000b000cbac6c139dmr700208pzj.9.1676994382266; Tue, 21 Feb 2023 07:46:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676994382; cv=none; d=google.com; s=arc-20160816; b=EZmAIQtcahLmnmoVoXXxufz47NEYaU/gXEpA+j/6ecTVGobeHIDogBlBVhSoMi+D4n 5VAm80SPMXAj2giK28lh8zycyrlI+7tTxuU5zXOB41kyU9pNgfruEYxZ+oKfSWy9YQXz 1C1m3FSHsSauiJmh6gtyJNOMW1OO5+oFCLyo3xyRVnntG/1FS9/GPm8ZUiDm3UkJECQn pXqL+C5itsSBjP8RS2t1vsHQYwsJtfxTZhQMNPVNxKxiiZFWx5KsTiflmNShpaw5Q+NP cOLL8YnvwEe2aQAjKNi6DMvXIbZtUdk8JJXws+sOf0Bt/Ntdvw9LjHdTGF1yZZXG96ut UJWw== 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=gF+rqWe7cd3zQB4nBWSUoxIqB2oVnbqG7Gv9YyL/L1V2D3gLx1T/3wwPKCEyr7bnv5 PDZSXPIEF2JbPpyvxaEuGXg6j7jcWimtU25b5tWD9fV8HJwfTaRw1Gr8MFXdck0mBdG3 ixpDwLB6W4+DcVUNe3ZJoiuJALfNMK9q5SB8QV+g8LzP3nnZtkxj2ZfhZdNb4KRcXybP yEEen/gYunCE7VNFja1V7bORo4mWJrV+LLU0bnp3sJOmD2gev1D0XknVZc+SfuDkjnne 1Li8Hre/acIdxKIQrxsgtaPGwMx/hUxlpfl7/Aj/QWRncnJQ90gwS8gqekZd+jeJG3p6 K29w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=UzrE+LbQ; 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 l185-20020a6388c2000000b00502d8244110si2530852pgd.638.2023.02.21.07.46.04; Tue, 21 Feb 2023 07:46:22 -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=UzrE+LbQ; 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 S233721AbjBUPiV (ORCPT + 99 others); Tue, 21 Feb 2023 10:38:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234606AbjBUPiD (ORCPT ); Tue, 21 Feb 2023 10:38:03 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07A2E2BF3A; Tue, 21 Feb 2023 07:37:54 -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 E3C9666021D3; Tue, 21 Feb 2023 15:37:52 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1676993873; bh=d98v4XkYuSdlaBMRVhy8ckf3WPpqfT9gFqNu9PlgtLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UzrE+LbQ/q/0oEUfdmGWDjpM6NnJzjiNqoBtqiibNwJyOF6/8O7KN8y54F0CMgd9y stIgTD8qLHyWnvwds8ShWi8WDhOJdDF8LXMThS8yUsuTwO9XvQfQVafex2aLd3OczH WAmHckmNQJcvQhmyKFYTlguwycU553zByLkDfXZ+aSJiuhLiR77aKQk6pS/Lu1sesA W1xqD0lj0CWJIjhbpjlBN/1pxG8rP08/Rt78pgudRFgmG8PUOa7rQM6OcJbNnCOXs6 6BQAyJzAdFlIxXawaNBxgj800LlZwNc6FMLN0k2sGuxI5QKkBhGtGYygRhnIXmyG3R sN4UBYv7JHEfQ== 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 v2 10/10] drm/panfrost: Add new compatible for Mali on the MT8183 SoC Date: Tue, 21 Feb 2023 16:37:40 +0100 Message-Id: <20230221153740.1620529-11-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230221153740.1620529-1-angelogioacchino.delregno@collabora.com> References: <20230221153740.1620529-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?1758456061067628745?= X-GMAIL-MSGID: =?utf-8?q?1758456061067628745?= 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 --- 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 }, {} };