On Fr, 2026-08-28 at 15:47 +0200, Michal Wilczynski wrote:
> Add the parent driver for the monolithic JH7110 HDMI IP block.
> 
> This driver binds to the starfive,jh7110-hdmi-subsystem node. It maps the
> shared register block, creates a regmap, and calls
> devm_of_platform_populate() to create its hdmi_phy and hdmi_controller
> child devices, which retrieve the shared regmap from this parent.
> 
> The NoC display-bus clock and reset gate access to the whole vout register
> region, and this subsystem's PHY child is the first device there to touch
> registers. Enable the bus before populating the children; PD_VOUT is
> handled by genpd through the power-domains property.
> 
> Co-developed-by: Dominique Belhachemi <[email protected]>
> Signed-off-by: Dominique Belhachemi <[email protected]>
> Signed-off-by: Michal Wilczynski <[email protected]>
> ---
>  drivers/soc/Kconfig                          |   1 +
>  drivers/soc/Makefile                         |   1 +
>  drivers/soc/starfive/Kconfig                 |  27 +++++++
>  drivers/soc/starfive/Makefile                |   2 +
>  drivers/soc/starfive/jh7110-hdmi-subsystem.c | 114 
> +++++++++++++++++++++++++++
>  5 files changed, 145 insertions(+)
> 
[...]
> diff --git a/drivers/soc/starfive/jh7110-hdmi-subsystem.c 
> b/drivers/soc/starfive/jh7110-hdmi-subsystem.c
> new file mode 100644
> index 
> 0000000000000000000000000000000000000000..d893c1c29f98b072b09d261343d3317dbf4c75fe
> --- /dev/null
> +++ b/drivers/soc/starfive/jh7110-hdmi-subsystem.c
> @@ -0,0 +1,114 @@
[...]
> +static int starfive_hdmi_subsys_probe(struct platform_device *pdev)
> +{
> +     struct device *dev = &pdev->dev;
> +     struct reset_control *bus_rst;
> +     void __iomem *regs;
> +     struct regmap *regmap;
> +     struct clk *bus_clk;
> +     int ret;
> +
> +     /*
> +      * The NoC display-bus clock and reset gate access to the whole vout
> +      * register region, and this subsystem's PHY child is the first device 
> in
> +      * that region to touch registers. Bring the bus up here before
> +      * populating the children; PD_VOUT is powered on by genpd through the
> +      * power-domains property.
> +      */
> +     bus_clk = devm_clk_get(dev, NULL);
> +     if (IS_ERR(bus_clk))
> +             return dev_err_probe(dev, PTR_ERR(bus_clk),
> +                                  "Failed to get NoC bus clock\n");
> +
> +     ret = clk_prepare_enable(bus_clk);
> +     if (ret)
> +             return dev_err_probe(dev, ret, "Failed to enable NoC bus 
> clock\n");
> +
> +     ret = devm_add_action_or_reset(dev, starfive_hdmi_subsys_clk_disable, 
> bus_clk);
> +     if (ret)
> +             return ret;

You can simplify this with devm_clk_get_enabled().

> +     bus_rst = devm_reset_control_get_exclusive(dev, NULL);
> +     if (IS_ERR(bus_rst))
> +             return dev_err_probe(dev, PTR_ERR(bus_rst),
> +                                  "Failed to get NoC bus reset\n");
> +
> +     ret = reset_control_deassert(bus_rst);
> +     if (ret)
> +             return dev_err_probe(dev, ret, "Failed to deassert NoC bus 
> reset\n");
> +
> +     ret = devm_add_action_or_reset(dev, starfive_hdmi_subsys_rst_assert, 
> bus_rst);
> +     if (ret)
> +             return ret;

You can simplify this with
devm_reset_control_get_exclusive_deasserted().

regards
Philipp

Reply via email to