Skip to content

RFC phy: mediatek: phy-mtk-hdmi: Use regmap to manipulate hdmi registers

Luca Leonardo Scorcia dri-devel linux-arm-kernel linux-mediatek linux-phy lkml llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest1 patch 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1phy: mediatek: phy-mtk-hdmi: Use regmap to manipulate hdmi registersdrivers/phy/mediatek/phy-mtk-hdmi-mt2701.c drivers/phy/mediatek/phy-mtk-hdmi-mt8173.c drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c +2 more+235 -2331 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/1] phy: mediatek: phy-mtk-hdmi: Use regmap to manipulate hdmi registers

While working on MediaTek mt8167 HDMI support I noticed that on some SoCs like mt8167 and mt8173 the registers used by HDMI PHY are actually inside the memory space mapped by the apmixedsys driver. On mt8173 this driver maps its memory using of_iomap, while on mt8167 it currently uses devm_platform_ioremap_resource. The current phy_hdmi_mtk uses devm_platform_ioremap_resource too, which causes a conflict between the two at probe:

hdmi-phy: error -EBUSY: can't request region for resource [mem 0x10018300-0x1001831f]

In patch [1] I initially proposed to use the same approach of mt8173 in mt8167 too. While working Sashiko correctly pointed out that it never unmaps its memory during remove [2], even on mt8173. It is of course possible to add code for that, but it would mean creating a dedicated drvdata structure, and it seems a little invasive. Using the devm_* functions is certainly cleaner.

This patch goes in the opposite direction - it converts all register access for mtk hdmi phy to the regmap_* functions and obtains the regmap using device_node_to_regmap, which internally uses iomap and does not trigger the conflict. This way memory can still be managed by the apmixedsys driver using the devm_* and the HDMI phy only gets a regmap.

This patch has been tested on mt8167 only. Unfortunately I have no devices with the other SoCs that are touched by this refactoring, so I am sending it as a RFC to gather feedback from more experienced kernel devs.

[1] https://lore.kernel.org/linux-mediatek/[email protected]/T/#u
[2] https://sashiko.dev/#/patchset/20261010115539.9237-1-l.scorcia%40gmail.com

Luca Leonardo Scorcia (1):
phy: mediatek: phy-mtk-hdmi: Use regmap to manipulate hdmi registers

 drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c | 145 ++++++++--------
 drivers/phy/mediatek/phy-mtk-hdmi-mt8173.c | 133 +++++++--------
 drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 185 ++++++++++-----------
 drivers/phy/mediatek/phy-mtk-hdmi.c        |   2 +-
 drivers/phy/mediatek/phy-mtk-hdmi.h        |   3 +-
 5 files changed, 235 insertions(+), 233 deletions(-)
Signature · 1 line
2.43.0