diff mbox series

drm/panfrost: Drop redundant Mediatek driver data

Message ID 20250118160645.78473-1-krzysztof.kozlowski@linaro.org (mailing list archive)
State New
Headers show
Series drm/panfrost: Drop redundant Mediatek driver data | expand

Commit Message

Krzysztof Kozlowski Jan. 18, 2025, 4:06 p.m. UTC
mediatek_mt8192_supplies are exactly the same as
mediatek_mt8183_b_supplies.  mediatek_mt8188_data is exactly the same as
&mediatek_mt8183_b_data.  There is never point in duplicating all these
structures - it only raises questions or encourages bugs when someone
updates one variant without changing the other.  Drop duplicated code.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

Comments

AngeloGioacchino Del Regno Jan. 20, 2025, 12:58 p.m. UTC | #1
Il 18/01/25 17:06, Krzysztof Kozlowski ha scritto:
> mediatek_mt8192_supplies are exactly the same as
> mediatek_mt8183_b_supplies.  mediatek_mt8188_data is exactly the same as
> &mediatek_mt8183_b_data.  There is never point in duplicating all these
> structures - it only raises questions or encourages bugs when someone
> updates one variant without changing the other.  Drop duplicated code.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

The reason why these are different is that 8183 and 8192 have different
GPU architectures, where the former is bifrost and the latter is valhall.

Regardless, even if there actually was a reason for that, I agree about
this deduplication here, as the architecture is anyway made clear by the
devicetree bindings for those SoCs.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Cheers!
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 0f3935556ac7..12ccc5a11c0e 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -817,21 +817,11 @@  static const struct panfrost_compatible mediatek_mt8186_data = {
 	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
 };
 
-/* MT8188 uses the same power domains and power supplies as MT8183 */
-static const struct panfrost_compatible mediatek_mt8188_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,
-	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
-};
-
-static const char * const mediatek_mt8192_supplies[] = { "mali", NULL };
 static const char * const mediatek_mt8192_pm_domains[] = { "core0", "core1", "core2",
 							   "core3", "core4" };
 static const struct panfrost_compatible mediatek_mt8192_data = {
-	.num_supplies = ARRAY_SIZE(mediatek_mt8192_supplies) - 1,
-	.supply_names = mediatek_mt8192_supplies,
+	.num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) - 1,
+	.supply_names = mediatek_mt8183_b_supplies,
 	.num_pm_domains = ARRAY_SIZE(mediatek_mt8192_pm_domains),
 	.pm_domain_names = mediatek_mt8192_pm_domains,
 	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
@@ -857,7 +847,7 @@  static const struct of_device_id dt_match[] = {
 	{ .compatible = "mediatek,mt8183-mali", .data = &mediatek_mt8183_data },
 	{ .compatible = "mediatek,mt8183b-mali", .data = &mediatek_mt8183_b_data },
 	{ .compatible = "mediatek,mt8186-mali", .data = &mediatek_mt8186_data },
-	{ .compatible = "mediatek,mt8188-mali", .data = &mediatek_mt8188_data },
+	{ .compatible = "mediatek,mt8188-mali", .data = &mediatek_mt8183_b_data },
 	{ .compatible = "mediatek,mt8192-mali", .data = &mediatek_mt8192_data },
 	{}
 };