[PATCH v6 09/14] media: iris: Use power domain type to look up pd_devs index

From: Vishnu Reddy

Date: Fri May 15 2026 - 07:54:52 EST


The pmdomain_tbl was a array of strings holding only the power domain
names. Callers had to pass a pd_devs[] pointer indexed directly by the
platform_pm_domain_type enum value to iris_enable_power_domains() and
iris_disable_power_domains().

A future platform may need to introduce a new enum value that aliases
an existing one (e.g. IRIS_VCODEC1_POWER_DOMAIN aliasing the
IRIS_VPP0_HW_POWER_DOMAIN on Glymur), which would break the assumption
that enum values map 1:1 to pd_devs[] indices.

To fix this, replace the string array with a new struct platform_pd_data
that pairs each power domain name with its platform_pm_domain_type. Add
a helper iris_get_pd_index_by_type() that walks this table and returns
the correct pd_devs[] index for a given type.

Update iris_enable_power_domains() and iris_disable_power_domains()
to accept a platform_pm_domain_type instead of a struct device pointer.
They now call the helper internally to resolve the index, removing the
need for callers to do the index lookup themselves.

This prepares the driver for adding new platforms where power domain enum
values cannot be used directly as pd_devs[] indices.

Reviewed-by: Vikash Garodia <vikash.garodia@xxxxxxxxxxxxxxxx>
Signed-off-by: Vishnu Reddy <busanna.reddy@xxxxxxxxxxxxxxxx>
---
.../platform/qcom/iris/iris_platform_common.h | 9 +++-
.../media/platform/qcom/iris/iris_platform_vpu2.c | 18 +++++---
.../media/platform/qcom/iris/iris_platform_vpu3x.c | 24 ++++++----
drivers/media/platform/qcom/iris/iris_probe.c | 4 +-
drivers/media/platform/qcom/iris/iris_resources.c | 43 +++++++++++++++++-
drivers/media/platform/qcom/iris/iris_resources.h | 6 ++-
drivers/media/platform/qcom/iris/iris_vpu3x.c | 7 ++-
drivers/media/platform/qcom/iris/iris_vpu4x.c | 52 ++++++++--------------
drivers/media/platform/qcom/iris/iris_vpu_common.c | 23 +++++-----
9 files changed, 115 insertions(+), 71 deletions(-)

diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/drivers/media/platform/qcom/iris/iris_platform_common.h
index 07cc0ce25b84..1d757cb8e9e1 100644
--- a/drivers/media/platform/qcom/iris/iris_platform_common.h
+++ b/drivers/media/platform/qcom/iris/iris_platform_common.h
@@ -70,6 +70,12 @@ struct platform_clk_data {
const char *clk_name;
};

+struct platform_pd_data {
+ enum platform_pm_domain_type *pd_types;
+ const char * const *pd_names;
+ u32 pd_count;
+};
+
struct tz_cp_config {
u32 cp_start;
u32 cp_size;
@@ -270,8 +276,7 @@ struct iris_platform_data {
unsigned int icc_tbl_size;
const struct bw_info *bw_tbl_dec;
unsigned int bw_tbl_dec_size;
- const char * const *pmdomain_tbl;
- unsigned int pmdomain_tbl_size;
+ const struct platform_pd_data *pmdomain_tbl;
const char * const *opp_pd_tbl;
unsigned int opp_pd_tbl_size;
const struct platform_clk_data *clk_tbl;
diff --git a/drivers/media/platform/qcom/iris/iris_platform_vpu2.c b/drivers/media/platform/qcom/iris/iris_platform_vpu2.c
index 41986af8313b..bcf873829fd3 100644
--- a/drivers/media/platform/qcom/iris/iris_platform_vpu2.c
+++ b/drivers/media/platform/qcom/iris/iris_platform_vpu2.c
@@ -62,7 +62,17 @@ static const struct icc_info iris_icc_info_vpu2[] = {

static const char * const iris_clk_reset_table_vpu2[] = { "bus", "core" };

-static const char * const iris_pmdomain_table_vpu2[] = { "venus", "vcodec0" };
+static const struct platform_pd_data iris_pmdomain_table_vpu2 = {
+ .pd_types = (enum platform_pm_domain_type []) {
+ IRIS_CTRL_POWER_DOMAIN,
+ IRIS_VCODEC_POWER_DOMAIN,
+ },
+ .pd_names = (const char *[]) {
+ "venus",
+ "vcodec0",
+ },
+ .pd_count = 2,
+};

static const struct tz_cp_config tz_cp_config_vpu2[] = {
{
@@ -80,8 +90,7 @@ const struct iris_platform_data sc7280_data = {
.icc_tbl_size = ARRAY_SIZE(iris_icc_info_vpu2),
.bw_tbl_dec = sc7280_bw_table_dec,
.bw_tbl_dec_size = ARRAY_SIZE(sc7280_bw_table_dec),
- .pmdomain_tbl = iris_pmdomain_table_vpu2,
- .pmdomain_tbl_size = ARRAY_SIZE(iris_pmdomain_table_vpu2),
+ .pmdomain_tbl = &iris_pmdomain_table_vpu2,
.opp_pd_tbl = sc7280_opp_pd_table,
.opp_pd_tbl_size = ARRAY_SIZE(sc7280_opp_pd_table),
.clk_tbl = sc7280_clk_table,
@@ -111,8 +120,7 @@ const struct iris_platform_data sm8250_data = {
.clk_rst_tbl_size = ARRAY_SIZE(iris_clk_reset_table_vpu2),
.bw_tbl_dec = sm8250_bw_table_dec,
.bw_tbl_dec_size = ARRAY_SIZE(sm8250_bw_table_dec),
- .pmdomain_tbl = iris_pmdomain_table_vpu2,
- .pmdomain_tbl_size = ARRAY_SIZE(iris_pmdomain_table_vpu2),
+ .pmdomain_tbl = &iris_pmdomain_table_vpu2,
.opp_pd_tbl = sm8250_opp_pd_table,
.opp_pd_tbl_size = ARRAY_SIZE(sm8250_opp_pd_table),
.clk_tbl = sm8250_clk_table,
diff --git a/drivers/media/platform/qcom/iris/iris_platform_vpu3x.c b/drivers/media/platform/qcom/iris/iris_platform_vpu3x.c
index c249ff827541..8a0f67d1a74a 100644
--- a/drivers/media/platform/qcom/iris/iris_platform_vpu3x.c
+++ b/drivers/media/platform/qcom/iris/iris_platform_vpu3x.c
@@ -72,7 +72,17 @@ static const struct bw_info iris_bw_table_dec_vpu3x[] = {
{ ((1920 * 1080) / 256) * 30, 294000 },
};

-static const char * const iris_pmdomain_table_vpu3x[] = { "venus", "vcodec0" };
+static const struct platform_pd_data iris_pmdomain_table_vpu3x = {
+ .pd_types = (enum platform_pm_domain_type []) {
+ IRIS_CTRL_POWER_DOMAIN,
+ IRIS_VCODEC_POWER_DOMAIN,
+ },
+ .pd_names = (const char *[]) {
+ "venus",
+ "vcodec0",
+ },
+ .pd_count = 2,
+};

static const char * const iris_opp_pd_table_vpu3x[] = { "mxc", "mmcx" };

@@ -103,8 +113,7 @@ const struct iris_platform_data qcs8300_data = {
.clk_rst_tbl_size = ARRAY_SIZE(sm8550_clk_reset_table),
.bw_tbl_dec = iris_bw_table_dec_vpu3x,
.bw_tbl_dec_size = ARRAY_SIZE(iris_bw_table_dec_vpu3x),
- .pmdomain_tbl = iris_pmdomain_table_vpu3x,
- .pmdomain_tbl_size = ARRAY_SIZE(iris_pmdomain_table_vpu3x),
+ .pmdomain_tbl = &iris_pmdomain_table_vpu3x,
.opp_pd_tbl = iris_opp_pd_table_vpu3x,
.opp_pd_tbl_size = ARRAY_SIZE(iris_opp_pd_table_vpu3x),
.clk_tbl = sm8550_clk_table,
@@ -132,8 +141,7 @@ const struct iris_platform_data sm8550_data = {
.clk_rst_tbl_size = ARRAY_SIZE(sm8550_clk_reset_table),
.bw_tbl_dec = iris_bw_table_dec_vpu3x,
.bw_tbl_dec_size = ARRAY_SIZE(iris_bw_table_dec_vpu3x),
- .pmdomain_tbl = iris_pmdomain_table_vpu3x,
- .pmdomain_tbl_size = ARRAY_SIZE(iris_pmdomain_table_vpu3x),
+ .pmdomain_tbl = &iris_pmdomain_table_vpu3x,
.opp_pd_tbl = iris_opp_pd_table_vpu3x,
.opp_pd_tbl_size = ARRAY_SIZE(iris_opp_pd_table_vpu3x),
.clk_tbl = sm8550_clk_table,
@@ -169,8 +177,7 @@ const struct iris_platform_data sm8650_data = {
.controller_rst_tbl_size = ARRAY_SIZE(sm8650_controller_reset_table),
.bw_tbl_dec = iris_bw_table_dec_vpu3x,
.bw_tbl_dec_size = ARRAY_SIZE(iris_bw_table_dec_vpu3x),
- .pmdomain_tbl = iris_pmdomain_table_vpu3x,
- .pmdomain_tbl_size = ARRAY_SIZE(iris_pmdomain_table_vpu3x),
+ .pmdomain_tbl = &iris_pmdomain_table_vpu3x,
.opp_pd_tbl = iris_opp_pd_table_vpu3x,
.opp_pd_tbl_size = ARRAY_SIZE(iris_opp_pd_table_vpu3x),
.clk_tbl = sm8550_clk_table,
@@ -198,8 +205,7 @@ const struct iris_platform_data sm8750_data = {
.clk_rst_tbl_size = ARRAY_SIZE(sm8750_clk_reset_table),
.bw_tbl_dec = iris_bw_table_dec_vpu3x,
.bw_tbl_dec_size = ARRAY_SIZE(iris_bw_table_dec_vpu3x),
- .pmdomain_tbl = iris_pmdomain_table_vpu3x,
- .pmdomain_tbl_size = ARRAY_SIZE(iris_pmdomain_table_vpu3x),
+ .pmdomain_tbl = &iris_pmdomain_table_vpu3x,
.opp_pd_tbl = iris_opp_pd_table_vpu3x,
.opp_pd_tbl_size = ARRAY_SIZE(iris_opp_pd_table_vpu3x),
.clk_tbl = sm8750_clk_table,
diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
index 12596c9a3cbf..3f2fc4e197c2 100644
--- a/drivers/media/platform/qcom/iris/iris_probe.c
+++ b/drivers/media/platform/qcom/iris/iris_probe.c
@@ -44,8 +44,8 @@ static int iris_init_power_domains(struct iris_core *core)
int ret;

struct dev_pm_domain_attach_data iris_pd_data = {
- .pd_names = core->iris_platform_data->pmdomain_tbl,
- .num_pd_names = core->iris_platform_data->pmdomain_tbl_size,
+ .pd_names = core->iris_platform_data->pmdomain_tbl->pd_names,
+ .num_pd_names = core->iris_platform_data->pmdomain_tbl->pd_count,
.pd_flags = PD_FLAG_NO_DEV_LINK,
};

diff --git a/drivers/media/platform/qcom/iris/iris_resources.c b/drivers/media/platform/qcom/iris/iris_resources.c
index 773f6548370a..cc61dc038598 100644
--- a/drivers/media/platform/qcom/iris/iris_resources.c
+++ b/drivers/media/platform/qcom/iris/iris_resources.c
@@ -70,10 +70,42 @@ int iris_opp_set_rate(struct device *dev, unsigned long freq)
return dev_pm_opp_set_opp(dev, opp);
}

-int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev)
+static int iris_get_pd_index_by_type(struct iris_core *core, enum platform_pm_domain_type pd_type)
{
+ const struct platform_pd_data *pd_tbl;
+ u32 i;
+
+ pd_tbl = core->iris_platform_data->pmdomain_tbl;
+
+ for (i = 0; i < pd_tbl->pd_count; i++) {
+ if (pd_tbl->pd_types[i] == pd_type)
+ return i;
+ }
+
+ return -EINVAL;
+}
+
+int iris_genpd_set_hwmode(struct iris_core *core, enum platform_pm_domain_type pd_type, bool hwmode)
+{
+ int pd_index = iris_get_pd_index_by_type(core, pd_type);
+
+ if (pd_index < 0)
+ return pd_index;
+
+ return dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[pd_index], hwmode);
+}
+
+int iris_enable_power_domains(struct iris_core *core, enum platform_pm_domain_type pd_type)
+{
+ int pd_index = iris_get_pd_index_by_type(core, pd_type);
+ struct device *pd_dev;
int ret;

+ if (pd_index < 0)
+ return pd_index;
+
+ pd_dev = core->pmdomain_tbl->pd_devs[pd_index];
+
ret = iris_opp_set_rate(core->dev, ULONG_MAX);
if (ret)
return ret;
@@ -85,10 +117,17 @@ int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev)
return ret;
}

-int iris_disable_power_domains(struct iris_core *core, struct device *pd_dev)
+int iris_disable_power_domains(struct iris_core *core, enum platform_pm_domain_type pd_type)
{
+ int pd_index = iris_get_pd_index_by_type(core, pd_type);
+ struct device *pd_dev;
int ret;

+ if (pd_index < 0)
+ return pd_index;
+
+ pd_dev = core->pmdomain_tbl->pd_devs[pd_index];
+
ret = iris_opp_set_rate(core->dev, 0);
if (ret)
return ret;
diff --git a/drivers/media/platform/qcom/iris/iris_resources.h b/drivers/media/platform/qcom/iris/iris_resources.h
index 6bfbd2dc6db0..d5692e4694b1 100644
--- a/drivers/media/platform/qcom/iris/iris_resources.h
+++ b/drivers/media/platform/qcom/iris/iris_resources.h
@@ -9,11 +9,13 @@
struct iris_core;

int iris_opp_set_rate(struct device *dev, unsigned long freq);
-int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev);
-int iris_disable_power_domains(struct iris_core *core, struct device *pd_dev);
+int iris_enable_power_domains(struct iris_core *core, enum platform_pm_domain_type pd_type);
+int iris_disable_power_domains(struct iris_core *core, enum platform_pm_domain_type pd_type);
int iris_unset_icc_bw(struct iris_core *core);
int iris_set_icc_bw(struct iris_core *core, unsigned long icc_bw);
int iris_disable_unprepare_clock(struct iris_core *core, enum platform_clk_type clk_type);
int iris_prepare_enable_clock(struct iris_core *core, enum platform_clk_type clk_type);
+int iris_genpd_set_hwmode(struct iris_core *core, enum platform_pm_domain_type pd_type,
+ bool hwmode);

#endif
diff --git a/drivers/media/platform/qcom/iris/iris_vpu3x.c b/drivers/media/platform/qcom/iris/iris_vpu3x.c
index c1355ff74a64..39e9c78c3a69 100644
--- a/drivers/media/platform/qcom/iris/iris_vpu3x.c
+++ b/drivers/media/platform/qcom/iris/iris_vpu3x.c
@@ -208,7 +208,7 @@ static int iris_vpu33_power_off_controller(struct iris_core *core)
iris_disable_unprepare_clock(core, IRIS_CTRL_CLK);

disable_power:
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_CTRL_POWER_DOMAIN);
iris_disable_unprepare_clock(core, IRIS_AXI_VCODEC_CLK);

return 0;
@@ -218,8 +218,7 @@ static int iris_vpu35_power_on_hw(struct iris_core *core)
{
int ret;

- ret = iris_enable_power_domains(core,
- core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN]);
+ ret = iris_enable_power_domains(core, IRIS_VCODEC_POWER_DOMAIN);
if (ret)
return ret;

@@ -242,7 +241,7 @@ static int iris_vpu35_power_on_hw(struct iris_core *core)
err_disable_axi_vcodec_clk:
iris_disable_unprepare_clock(core, IRIS_AXI_VCODEC_CLK);
err_disable_power:
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_VCODEC_POWER_DOMAIN);

return ret;
}
diff --git a/drivers/media/platform/qcom/iris/iris_vpu4x.c b/drivers/media/platform/qcom/iris/iris_vpu4x.c
index 5abd19a3d2f8..541e156d2e87 100644
--- a/drivers/media/platform/qcom/iris/iris_vpu4x.c
+++ b/drivers/media/platform/qcom/iris/iris_vpu4x.c
@@ -27,28 +27,24 @@ static int iris_vpu4x_genpd_set_hwmode(struct iris_core *core, bool hw_mode, u32
{
int ret;

- ret = dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN],
- hw_mode);
+ ret = iris_genpd_set_hwmode(core, IRIS_VCODEC_POWER_DOMAIN, hw_mode);
if (ret)
return ret;

if (!(efuse_value & DISABLE_VIDEO_VPP0_BIT)) {
- ret = dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs
- [IRIS_VCODEC_VPP0_POWER_DOMAIN], hw_mode);
+ ret = iris_genpd_set_hwmode(core, IRIS_VCODEC_VPP0_POWER_DOMAIN, hw_mode);
if (ret)
goto restore_hw_domain_mode;
}

if (!(efuse_value & DISABLE_VIDEO_VPP1_BIT)) {
- ret = dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs
- [IRIS_VCODEC_VPP1_POWER_DOMAIN], hw_mode);
+ ret = iris_genpd_set_hwmode(core, IRIS_VCODEC_VPP1_POWER_DOMAIN, hw_mode);
if (ret)
goto restore_vpp0_domain_mode;
}

if (!(efuse_value & DISABLE_VIDEO_APV_BIT)) {
- ret = dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs
- [IRIS_APV_HW_POWER_DOMAIN], hw_mode);
+ ret = iris_genpd_set_hwmode(core, IRIS_APV_HW_POWER_DOMAIN, hw_mode);
if (ret)
goto restore_vpp1_domain_mode;
}
@@ -57,14 +53,12 @@ static int iris_vpu4x_genpd_set_hwmode(struct iris_core *core, bool hw_mode, u32

restore_vpp1_domain_mode:
if (!(efuse_value & DISABLE_VIDEO_VPP1_BIT))
- dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[IRIS_VCODEC_VPP1_POWER_DOMAIN],
- !hw_mode);
+ iris_genpd_set_hwmode(core, IRIS_VCODEC_VPP1_POWER_DOMAIN, !hw_mode);
restore_vpp0_domain_mode:
if (!(efuse_value & DISABLE_VIDEO_VPP0_BIT))
- dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[IRIS_VCODEC_VPP0_POWER_DOMAIN],
- !hw_mode);
+ iris_genpd_set_hwmode(core, IRIS_VCODEC_VPP0_POWER_DOMAIN, !hw_mode);
restore_hw_domain_mode:
- dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN], !hw_mode);
+ iris_genpd_set_hwmode(core, IRIS_VCODEC_POWER_DOMAIN, !hw_mode);

return ret;
}
@@ -73,8 +67,7 @@ static int iris_vpu4x_power_on_apv(struct iris_core *core)
{
int ret;

- ret = iris_enable_power_domains(core,
- core->pmdomain_tbl->pd_devs[IRIS_APV_HW_POWER_DOMAIN]);
+ ret = iris_enable_power_domains(core, IRIS_APV_HW_POWER_DOMAIN);
if (ret)
return ret;

@@ -85,7 +78,7 @@ static int iris_vpu4x_power_on_apv(struct iris_core *core)
return 0;

disable_apv_hw_power_domain:
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_APV_HW_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_APV_HW_POWER_DOMAIN);

return ret;
}
@@ -140,7 +133,7 @@ static void iris_vpu4x_power_off_apv(struct iris_core *core)

disable_clocks_and_power:
iris_disable_unprepare_clock(core, IRIS_APV_HW_CLK);
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_APV_HW_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_APV_HW_POWER_DOMAIN);
}

static void iris_vpu4x_ahb_sync_reset_apv(struct iris_core *core)
@@ -227,21 +220,18 @@ static int iris_vpu4x_power_on_hardware(struct iris_core *core)
u32 efuse_value = readl(core->reg_base + WRAPPER_EFUSE_MONITOR);
int ret;

- ret = iris_enable_power_domains(core,
- core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN]);
+ ret = iris_enable_power_domains(core, IRIS_VCODEC_POWER_DOMAIN);
if (ret)
return ret;

if (!(efuse_value & DISABLE_VIDEO_VPP0_BIT)) {
- ret = iris_enable_power_domains(core, core->pmdomain_tbl->pd_devs
- [IRIS_VCODEC_VPP0_POWER_DOMAIN]);
+ ret = iris_enable_power_domains(core, IRIS_VCODEC_VPP0_POWER_DOMAIN);
if (ret)
goto disable_vcodec_power_domain;
}

if (!(efuse_value & DISABLE_VIDEO_VPP1_BIT)) {
- ret = iris_enable_power_domains(core, core->pmdomain_tbl->pd_devs
- [IRIS_VCODEC_VPP1_POWER_DOMAIN]);
+ ret = iris_enable_power_domains(core, IRIS_VCODEC_VPP1_POWER_DOMAIN);
if (ret)
goto disable_vpp0_power_domain;
}
@@ -262,14 +252,12 @@ static int iris_vpu4x_power_on_hardware(struct iris_core *core)
iris_vpu4x_disable_hardware_clocks(core, efuse_value);
disable_vpp1_power_domain:
if (!(efuse_value & DISABLE_VIDEO_VPP1_BIT))
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs
- [IRIS_VCODEC_VPP1_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_VCODEC_VPP1_POWER_DOMAIN);
disable_vpp0_power_domain:
if (!(efuse_value & DISABLE_VIDEO_VPP0_BIT))
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs
- [IRIS_VCODEC_VPP0_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_VCODEC_VPP0_POWER_DOMAIN);
disable_vcodec_power_domain:
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_VCODEC_POWER_DOMAIN);

return ret;
}
@@ -340,14 +328,12 @@ static void iris_vpu4x_power_off_hardware(struct iris_core *core)
iris_vpu4x_disable_hardware_clocks(core, efuse_value);

if (!(efuse_value & DISABLE_VIDEO_VPP1_BIT))
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs
- [IRIS_VCODEC_VPP1_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_VCODEC_VPP1_POWER_DOMAIN);

if (!(efuse_value & DISABLE_VIDEO_VPP0_BIT))
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs
- [IRIS_VCODEC_VPP0_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_VCODEC_VPP0_POWER_DOMAIN);

- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_VCODEC_POWER_DOMAIN);
}

static int iris_vpu4x_set_hwmode(struct iris_core *core)
diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.c b/drivers/media/platform/qcom/iris/iris_vpu_common.c
index 8b06bd346b83..1dd3eedb58e8 100644
--- a/drivers/media/platform/qcom/iris/iris_vpu_common.c
+++ b/drivers/media/platform/qcom/iris/iris_vpu_common.c
@@ -213,15 +213,15 @@ int iris_vpu_power_off_controller(struct iris_core *core)
iris_disable_unprepare_clock(core, IRIS_AHB_CLK);
iris_disable_unprepare_clock(core, IRIS_CTRL_CLK);
iris_disable_unprepare_clock(core, IRIS_AXI_VCODEC_CLK);
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_CTRL_POWER_DOMAIN);

return 0;
}

void iris_vpu_power_off_hw(struct iris_core *core)
{
- dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN], false);
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN]);
+ iris_genpd_set_hwmode(core, IRIS_VCODEC_POWER_DOMAIN, false);
+ iris_disable_power_domains(core, IRIS_VCODEC_POWER_DOMAIN);
iris_disable_unprepare_clock(core, IRIS_VCODEC_AHB_CLK);
iris_disable_unprepare_clock(core, IRIS_VCODEC_CLK);
}
@@ -242,7 +242,7 @@ int iris_vpu_power_on_controller(struct iris_core *core)
u32 rst_tbl_size = core->iris_platform_data->clk_rst_tbl_size;
int ret;

- ret = iris_enable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN]);
+ ret = iris_enable_power_domains(core, IRIS_CTRL_POWER_DOMAIN);
if (ret)
return ret;

@@ -269,7 +269,7 @@ int iris_vpu_power_on_controller(struct iris_core *core)
err_disable_axi_vcodec_clock:
iris_disable_unprepare_clock(core, IRIS_AXI_VCODEC_CLK);
err_disable_power:
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_CTRL_POWER_DOMAIN);

return ret;
}
@@ -278,8 +278,7 @@ int iris_vpu_power_on_hw(struct iris_core *core)
{
int ret;

- ret = iris_enable_power_domains(core,
- core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN]);
+ ret = iris_enable_power_domains(core, IRIS_VCODEC_POWER_DOMAIN);
if (ret)
return ret;

@@ -296,14 +295,14 @@ int iris_vpu_power_on_hw(struct iris_core *core)
err_disable_vcodec_clock:
iris_disable_unprepare_clock(core, IRIS_VCODEC_CLK);
err_disable_power:
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_VCODEC_POWER_DOMAIN);

return ret;
}

int iris_vpu_set_hwmode(struct iris_core *core)
{
- return dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN], true);
+ return iris_genpd_set_hwmode(core, IRIS_VCODEC_POWER_DOMAIN, true);
}

int iris_vpu_switch_to_hwmode(struct iris_core *core)
@@ -368,7 +367,7 @@ int iris_vpu35_vpu4x_power_off_controller(struct iris_core *core)
iris_disable_unprepare_clock(core, IRIS_CTRL_FREERUN_CLK);
iris_disable_unprepare_clock(core, IRIS_AXI_CTRL_CLK);

- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_CTRL_POWER_DOMAIN);

reset_control_bulk_reset(clk_rst_tbl_size, core->resets);

@@ -379,7 +378,7 @@ int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core)
{
int ret;

- ret = iris_enable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN]);
+ ret = iris_enable_power_domains(core, IRIS_CTRL_POWER_DOMAIN);
if (ret)
return ret;

@@ -402,7 +401,7 @@ int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core)
err_disable_axi_ctrl_clk:
iris_disable_unprepare_clock(core, IRIS_AXI_CTRL_CLK);
err_disable_power:
- iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN]);
+ iris_disable_power_domains(core, IRIS_CTRL_POWER_DOMAIN);

return ret;
}

--
2.34.1