Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Guoniu Zhou <guoniu.zhou@oss.nxp.com>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Frank Li <Frank.Li@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>, Ulf Hansson <ulfh@kernel.org>,
	Peng Fan <peng.fan@nxp.com>, Shawn Guo <shawnguo@kernel.org>,
	devicetree@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 2/2] pmdomain: imx93-blk-ctrl: Extract PHY as shared domain for DSI/CSI
Date: Tue, 9 Jun 2026 10:09:27 -0500	[thread overview]
Message-ID: <aigsp1VYu1tE6AFR@SMW015318> (raw)
In-Reply-To: <20260609-pm_imx93-v1-2-d06c004b0f51@oss.nxp.com>

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@vger.kernel.org
> Signed-off-by: Guoniu Zhou <guoniu.zhou@oss.nxp.com>
> ---

Reviewed-by: Frank Li <Frank.Li@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
>
>


      reply	other threads:[~2026-06-09 15:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09  6:26 [PATCH 0/2] pmdomain: imx93: Fix shared MIPI PHY resource management Guoniu Zhou
2026-06-09  6:26 ` [PATCH 1/2] dt-bindings: power: imx93: Add MIPI PHY power domain Guoniu Zhou
2026-06-09 14:52   ` Frank Li
2026-06-09 15:13   ` Krzysztof Kozlowski
2026-06-09  6:26 ` [PATCH 2/2] pmdomain: imx93-blk-ctrl: Extract PHY as shared domain for DSI/CSI Guoniu Zhou
2026-06-09 15:09   ` Frank Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aigsp1VYu1tE6AFR@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=guoniu.zhou@oss.nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox