[PATCH 2/2] pmdomain: imx93-blk-ctrl: Extract PHY as shared domain for DSI/CSI

Frank Li Frank.li at oss.nxp.com
Tue Jun 9 08:09:27 PDT 2026


On Tue, Jun 09, 2026 at 02:26:41PM +0800, Guoniu Zhou wrote:
>
> The MIPI DSI and CSI domains share control bits for clock and reset, which
> can lead to incorrect behavior if one domain disables the shared resource
> while the other is still active.
>
> To fix the issue, introduce a shared MIPI PHY power domain to own the
> common resources and make DSI and CSI its subdomains. This ensures the
> shared bits are properly managed and not disabled while still in use.
>
> Fixes: e9aa77d413c9 ("soc: imx: add i.MX93 media blk ctrl driver")
> Cc: stable at vger.kernel.org
> Signed-off-by: Guoniu Zhou <guoniu.zhou at oss.nxp.com>
> ---

Reviewed-by: Frank Li <Frank.Li at nxp.com>

>  drivers/pmdomain/imx/imx93-blk-ctrl.c | 60 +++++++++++++++++++++++++++++++++--
>  1 file changed, 58 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pmdomain/imx/imx93-blk-ctrl.c b/drivers/pmdomain/imx/imx93-blk-ctrl.c
> index 1afc78b034fa..243ce939ba68 100644
> --- a/drivers/pmdomain/imx/imx93-blk-ctrl.c
> +++ b/drivers/pmdomain/imx/imx93-blk-ctrl.c
> @@ -48,6 +48,8 @@
>
>  #define PRIO(X)                        (X)
>
> +#define BLK_CTRL_NO_PARENT     UINT_MAX
> +
>  struct imx93_blk_ctrl_domain;
>
>  struct imx93_blk_ctrl {
> @@ -68,12 +70,18 @@ struct imx93_blk_ctrl_qos {
>         u32 cfg_prio;
>  };
>
> +struct imx93_blk_ctrl_subdomain_link {
> +       struct generic_pm_domain *parent;
> +       struct generic_pm_domain *subdomain;
> +};
> +
>  struct imx93_blk_ctrl_domain_data {
>         const char *name;
>         const char * const *clk_names;
>         int num_clks;
>         u32 rst_mask;
>         u32 clk_mask;
> +       u32 parent;
>         int num_qos;
>         struct imx93_blk_ctrl_qos qos[DOMAIN_MAX_QOS];
>  };
> @@ -203,6 +211,13 @@ static void imx93_release_pm_genpd(void *data)
>         pm_genpd_remove(genpd);
>  }
>
> +static void imx93_release_subdomain(void *data)
> +{
> +       struct imx93_blk_ctrl_subdomain_link *link = data;
> +
> +       pm_genpd_remove_subdomain(link->parent, link->subdomain);
> +}
> +
>  static struct lock_class_key blk_ctrl_genpd_lock_class;
>
>  static int imx93_blk_ctrl_probe(struct platform_device *pdev)
> @@ -302,6 +317,34 @@ static int imx93_blk_ctrl_probe(struct platform_device *pdev)
>                 bc->onecell_data.domains[i] = &domain->genpd;
>         }
>
> +       for (i = 0; i < bc_data->num_domains; i++) {
> +               struct imx93_blk_ctrl_domain *domain = &bc->domains[i];
> +               const struct imx93_blk_ctrl_domain_data *data = domain->data;
> +               struct imx93_blk_ctrl_subdomain_link *link;
> +
> +               if (bc_data->skip_mask & BIT(i) ||
> +                   data->parent == BLK_CTRL_NO_PARENT)
> +                       continue;
> +
> +               link = devm_kzalloc(dev, sizeof(*link), GFP_KERNEL);
> +               if (!link)
> +                       return -ENOMEM;
> +
> +               link->parent = &bc->domains[data->parent].genpd;
> +               link->subdomain = &domain->genpd;
> +
> +               ret = pm_genpd_add_subdomain(&bc->domains[data->parent].genpd,
> +                                            &domain->genpd);
> +               if (ret)
> +                       return dev_err_probe(dev, ret, "failed to add subdomain %s\n",
> +                                            domain->genpd.name);
> +
> +               ret = devm_add_action_or_reset(dev, imx93_release_subdomain, link);
> +               if (ret)
> +                       return dev_err_probe(dev, ret,
> +                                            "failed to add subdomain release callback\n");
> +       }
> +
>         ret = devm_pm_runtime_enable(dev);
>         if (ret)
>                 return dev_err_probe(dev, ret, "failed to enable pm-runtime\n");
> @@ -326,8 +369,9 @@ static const struct imx93_blk_ctrl_domain_data imx93_media_blk_ctl_domain_data[]
>                 .name = "mediablk-mipi-dsi",
>                 .clk_names = (const char *[]){ "dsi" },
>                 .num_clks = 1,
> -               .rst_mask = BIT(11) | BIT(12),
> -               .clk_mask = BIT(11) | BIT(12),
> +               .rst_mask = BIT(11),
> +               .clk_mask = BIT(11),
> +               .parent = IMX93_MEDIABLK_PD_MIPI_PHY,
>         },
>         [IMX93_MEDIABLK_PD_MIPI_CSI] = {
>                 .name = "mediablk-mipi-csi",
> @@ -335,6 +379,7 @@ static const struct imx93_blk_ctrl_domain_data imx93_media_blk_ctl_domain_data[]
>                 .num_clks = 2,
>                 .rst_mask = BIT(9) | BIT(10),
>                 .clk_mask = BIT(9) | BIT(10),
> +               .parent = IMX93_MEDIABLK_PD_MIPI_PHY,
>         },
>         [IMX93_MEDIABLK_PD_PXP] = {
>                 .name = "mediablk-pxp",
> @@ -342,6 +387,7 @@ static const struct imx93_blk_ctrl_domain_data imx93_media_blk_ctl_domain_data[]
>                 .num_clks = 1,
>                 .rst_mask = BIT(7) | BIT(8),
>                 .clk_mask = BIT(7) | BIT(8),
> +               .parent = BLK_CTRL_NO_PARENT,
>                 .num_qos = 2,
>                 .qos = {
>                         {
> @@ -363,6 +409,7 @@ static const struct imx93_blk_ctrl_domain_data imx93_media_blk_ctl_domain_data[]
>                 .num_clks = 2,
>                 .rst_mask = BIT(4) | BIT(5) | BIT(6),
>                 .clk_mask = BIT(4) | BIT(5) | BIT(6),
> +               .parent = BLK_CTRL_NO_PARENT,
>                 .num_qos = 1,
>                 .qos = {
>                         {
> @@ -379,6 +426,7 @@ static const struct imx93_blk_ctrl_domain_data imx93_media_blk_ctl_domain_data[]
>                 .num_clks = 1,
>                 .rst_mask = BIT(2) | BIT(3),
>                 .clk_mask = BIT(2) | BIT(3),
> +               .parent = BLK_CTRL_NO_PARENT,
>                 .num_qos = 4,
>                 .qos = {
>                         {
> @@ -404,6 +452,14 @@ static const struct imx93_blk_ctrl_domain_data imx93_media_blk_ctl_domain_data[]
>                         }
>                 }
>         },
> +       [IMX93_MEDIABLK_PD_MIPI_PHY] = {
> +               .name = "mediablk-mipi-phy",
> +               .clk_names = NULL,
> +               .num_clks = 0,
> +               .rst_mask = BIT(12),
> +               .clk_mask = BIT(12),
> +               .parent = BLK_CTRL_NO_PARENT,
> +       },
>  };
>
>  static const struct regmap_range imx93_media_blk_ctl_yes_ranges[] = {
>
> --
> 2.34.1
>
>



More information about the linux-arm-kernel mailing list