Skip to content

Commit bd77b87

Browse files
laeyraudstevenprice-arm
authored andcommitted
drm/panfrost: Commonize Mediatek power domain array definitions
In the panfrost driver, the platform data of several Mediatek SoC declares and uses several different power domains arrays according to GPU core number present in the SoC: - mediatek_mt8186_pm_domains (2 cores) - mediatek_mt8183_pm_domains (3 cores) - mediatek_mt8192_pm_domains (5 cores) As they all are fixed arrays, starting with the same entries and the platform data also has a power domains array length field (num_pm_domains), they can be replaced by a single array, containing all entries, if the num_pm_domains field of the platform data is also set to the matching core number. So, create a generic power domain array (mediatek_pm_domains) and use it in the mt8183(b), mt8186, mt8188 and mt8192 platform data instead. Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com> Reviewed-by: Steven Price <steven.price@arm.com> Signed-off-by: Steven Price <steven.price@arm.com> Link: https://lore.kernel.org/r/20250509-mt8370-enable-gpu-v6-3-2833888cb1d3@collabora.com
1 parent 6905b0d commit bd77b87

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

drivers/gpu/drm/panfrost/panfrost_drv.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,8 @@ static const struct panfrost_compatible amlogic_data = {
866866
.vendor_quirk = panfrost_gpu_amlogic_quirk,
867867
};
868868

869+
static const char * const mediatek_pm_domains[] = { "core0", "core1", "core2",
870+
"core3", "core4" };
869871
/*
870872
* The old data with two power supplies for MT8183 is here only to
871873
* keep retro-compatibility with older devicetrees, as DVFS will
@@ -875,48 +877,43 @@ static const struct panfrost_compatible amlogic_data = {
875877
* coupled regulators instead.
876878
*/
877879
static const char * const legacy_supplies[] = { "mali", "sram", NULL };
878-
static const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" };
879880
static const struct panfrost_compatible mediatek_mt8183_data = {
880881
.num_supplies = ARRAY_SIZE(legacy_supplies) - 1,
881882
.supply_names = legacy_supplies,
882-
.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
883-
.pm_domain_names = mediatek_mt8183_pm_domains,
883+
.num_pm_domains = 3,
884+
.pm_domain_names = mediatek_pm_domains,
884885
};
885886

886887
static const struct panfrost_compatible mediatek_mt8183_b_data = {
887888
.num_supplies = ARRAY_SIZE(default_supplies) - 1,
888889
.supply_names = default_supplies,
889-
.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
890-
.pm_domain_names = mediatek_mt8183_pm_domains,
890+
.num_pm_domains = 3,
891+
.pm_domain_names = mediatek_pm_domains,
891892
.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
892893
};
893894

894-
static const char * const mediatek_mt8186_pm_domains[] = { "core0", "core1" };
895895
static const struct panfrost_compatible mediatek_mt8186_data = {
896896
.num_supplies = ARRAY_SIZE(default_supplies) - 1,
897897
.supply_names = default_supplies,
898-
.num_pm_domains = ARRAY_SIZE(mediatek_mt8186_pm_domains),
899-
.pm_domain_names = mediatek_mt8186_pm_domains,
898+
.num_pm_domains = 2,
899+
.pm_domain_names = mediatek_pm_domains,
900900
.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
901901
};
902902

903-
/* MT8188 uses the same power domains and power supplies as MT8183 */
904903
static const struct panfrost_compatible mediatek_mt8188_data = {
905904
.num_supplies = ARRAY_SIZE(default_supplies) - 1,
906905
.supply_names = default_supplies,
907-
.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
908-
.pm_domain_names = mediatek_mt8183_pm_domains,
906+
.num_pm_domains = 3,
907+
.pm_domain_names = mediatek_pm_domains,
909908
.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
910909
.gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
911910
};
912911

913-
static const char * const mediatek_mt8192_pm_domains[] = { "core0", "core1", "core2",
914-
"core3", "core4" };
915912
static const struct panfrost_compatible mediatek_mt8192_data = {
916913
.num_supplies = ARRAY_SIZE(default_supplies) - 1,
917914
.supply_names = default_supplies,
918-
.num_pm_domains = ARRAY_SIZE(mediatek_mt8192_pm_domains),
919-
.pm_domain_names = mediatek_mt8192_pm_domains,
915+
.num_pm_domains = 5,
916+
.pm_domain_names = mediatek_pm_domains,
920917
.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
921918
.gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
922919
};

0 commit comments

Comments
 (0)