From: Heiko Stuebner <heiko@sntech.de>
To: Neil Armstrong <neil.armstrong@linaro.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Philipp Zabel <p.zabel@pengutronix.de>,
Emil Renner Berthing <kernel@esmil.dk>,
Hal Feng <hal.feng@starfivetech.com>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Dominique Belhachemi <db@domibel.de>, Andy Yan <andyshrk@163.com>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Yakir Yang <kuankuan.y@gmail.com>,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Michal Wilczynski <m.wilczynski@samsung.com>,
Conor Dooley <conor@kernel.org>,
William Qiu <william.qiu@starfivetech.com>,
Xingyu Wu <xingyu.wu@starfivetech.com>,
Sandy Huang <hjc@rock-chips.com>,
Manivannan Sadhasivam <mani@kernel.org>,
Michal Wilczynski <m.wilczynski@samsung.com>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org,
linux-riscv@lists.infradead.org,
"Marek Szyprowski" <m.szyprowski@samsung.com>,
"Maud Spierings" <maud_spierings@murena.io>,
"Graham Markall" <hello@big-grey.co.uk>,
"Icenowy Zheng" <zhengxingda@iscas.ac.cn>,
"Chaoyi Chen" <chaoyi.chen@rock-chips.com>,
"Joshua Peisach" <jpeisach@ubuntu.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Byron Stanoszek" <gandalf@winds.org>,
OOHehir <oo.hehir@gmail.com>
Subject: Re: [PATCH v6 09/18] drm/bridge: inno-hdmi: Allow the register map to come from a parent
Date: Fri, 30 Oct 2026 19:01:08 +0100 [thread overview]
Message-ID: <3194397.687JKscXgg@phil> (raw)
In-Reply-To: <20261029-jh7110-clean-send-v6-9-759594e43acf@samsung.com>
Am Donnerstag, 29. Oktober 2026, 08:53:43 Mitteleuropäische Normalzeit schrieb Michal Wilczynski:
> On some SoCs the HDMI controller does not own its register window. The
> StarFive JH7110 documents one 64 KB block, u0_hdmitx, that holds both
> the controller and the PHY, so the parent device maps it and owns the
> regmap while the two children share it.
>
> Use a regmap supplied by the parent device when there is one, and keep
> mapping our own resource when there is not, so platforms that own their
> register window are unaffected.
>
> Reviewed-by: Joshua Peisach <jpeisach@ubuntu.com>
> Tested-by: Byron Stanoszek <gandalf@winds.org>
> Tested-by: OOHehir <oo.hehir@gmail.com>
> Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
> ---
> drivers/gpu/drm/bridge/inno-hdmi.c | 31 ++++++++++++++++++++++++++++---
> 1 file changed, 28 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c
> index 222f6522844ee60ae9a07ab2dcca748dbf7403e4..a8905bf627a224d7e3918514195f1810164dc26f 100644
> --- a/drivers/gpu/drm/bridge/inno-hdmi.c
> +++ b/drivers/gpu/drm/bridge/inno-hdmi.c
> @@ -397,6 +397,7 @@ struct inno_hdmi {
> struct clk *pclk;
> struct clk *refclk;
> void __iomem *regs;
> + struct regmap *regmap;
> struct regmap *grf;
>
> struct inno_hdmi_i2c *i2c;
> @@ -470,11 +471,25 @@ static int inno_hdmi_find_phy_config(struct inno_hdmi *hdmi,
>
> static inline u8 hdmi_readb(struct inno_hdmi *hdmi, u16 offset)
> {
> + u32 val;
> +
> + if (hdmi->regmap) {
> + if (regmap_read(hdmi->regmap, offset * 4, &val))
> + return 0;
> +
> + return val;
> + }
> +
> return readl_relaxed(hdmi->regs + (offset) * 0x04);
> }
>
> static inline void hdmi_writeb(struct inno_hdmi *hdmi, u16 offset, u32 val)
> {
> + if (hdmi->regmap) {
> + regmap_write(hdmi->regmap, offset * 4, val);
> + return;
> + }
> +
> writel_relaxed(val, hdmi->regs + (offset) * 0x04);
> }
>
> @@ -1101,9 +1116,19 @@ struct inno_hdmi *inno_hdmi_probe(struct platform_device *pdev,
> hdmi->dev = dev;
> hdmi->plat_data = plat_data;
>
> - hdmi->regs = devm_platform_ioremap_resource(pdev, 0);
> - if (IS_ERR(hdmi->regs))
> - return ERR_CAST(hdmi->regs);
> + /*
> + * On platforms where the controller shares a register space with
> + * other blocks, the parent owns the regmap. Fall back to mapping
> + * our own resource where it does not.
> + */
> + if (dev->parent)
> + hdmi->regmap = dev_get_regmap(dev->parent, NULL);
> +
> + if (!hdmi->regmap) {
> + hdmi->regs = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(hdmi->regs))
> + return ERR_CAST(hdmi->regs);
> + }
why can't you just also use a mmio regmap here? Because with this change
the driver now has 2 competing register interfaces and you need those
conditionals all the time.
Just convert the existing user to also use a regmap please.
Heiko
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2026-10-30 18:02 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20261029075352eucas1p28bb0b14e03ab247dfbbee4843e1332ba@eucas1p2.samsung.com>
2026-10-29 7:53 ` [PATCH v6 00/18] drm: starfive: jh7110: Enable display subsystem Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 01/18] drm/bridge: inno-hdmi: fix swapped HSYNC and VSYNC polarity Michal Wilczynski
2026-10-30 17:38 ` Heiko Stuebner
2026-10-29 7:53 ` [PATCH v6 02/18] drm/bridge: inno-hdmi: Don't dereference a NULL drm_device on hotplug Michal Wilczynski
2026-10-30 17:43 ` Heiko Stuebner
2026-10-30 17:44 ` Heiko Stuebner
2026-10-29 7:53 ` [PATCH v6 03/18] dt-bindings: display: bridge: Add starfive,jh7110-inno-hdmi-controller Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 04/18] dt-bindings: soc: starfive: Add starfive,jh7110-hdmi-subsystem Michal Wilczynski
2026-10-29 17:38 ` Rob Herring (Arm)
2026-10-29 17:53 ` Michal Wilczynski
2026-10-29 18:30 ` Rob Herring
2026-10-29 23:06 ` Conor Dooley
2026-10-29 7:53 ` [PATCH v6 05/18] dt-bindings: soc: starfive: Add starfive,jh7110-vout-syscon Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 06/18] dt-bindings: display: verisilicon: Add starfive,jh7110-dc8200 Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 07/18] dt-bindings: soc: starfive: Add starfive,jh7110-vout-subsystem Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 08/18] drm/bridge: inno-hdmi: Split probe out of bind Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 09/18] drm/bridge: inno-hdmi: Allow the register map to come from a parent Michal Wilczynski
2026-10-30 18:01 ` Heiko Stuebner [this message]
2026-10-29 7:53 ` [PATCH v6 10/18] drm/bridge: inno-hdmi: Add .disable platform operation Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 11/18] drm/bridge: inno-hdmi: Add .mode_valid " Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 12/18] drm/bridge: inno-hdmi: Make the PHY configuration table optional Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 13/18] drm/bridge: inno-hdmi: Make the register clock source selectable Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 14/18] soc: starfive: Add jh7110-hdmi-subsystem driver Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 15/18] soc: starfive: Add jh7110-vout-subsystem driver Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 16/18] drm/bridge: starfive: Add JH7110 HDMI controller driver Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 17/18] riscv: dts: starfive: jh7110: Update DT for display subsystem Michal Wilczynski
2026-10-29 7:53 ` [PATCH v6 18/18] MAINTAINERS: Add StarFive JH7110 display subsystem entry Michal Wilczynski
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=3194397.687JKscXgg@phil \
--to=heiko@sntech.de \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=alex@ghiti.fr \
--cc=andrzej.hajda@intel.com \
--cc=andyshrk@163.com \
--cc=aou@eecs.berkeley.edu \
--cc=chaoyi.chen@rock-chips.com \
--cc=conor@kernel.org \
--cc=db@domibel.de \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gandalf@winds.org \
--cc=hal.feng@starfivetech.com \
--cc=hello@big-grey.co.uk \
--cc=hjc@rock-chips.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=jpeisach@ubuntu.com \
--cc=kernel@esmil.dk \
--cc=krzk+dt@kernel.org \
--cc=kuankuan.y@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=luca.ceresoli@bootlin.com \
--cc=m.szyprowski@samsung.com \
--cc=m.wilczynski@samsung.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mani@kernel.org \
--cc=maud_spierings@murena.io \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=oo.hehir@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=rfoss@kernel.org \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--cc=u.kleine-koenig@baylibre.com \
--cc=william.qiu@starfivetech.com \
--cc=xingyu.wu@starfivetech.com \
--cc=zhengxingda@iscas.ac.cn \
/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