From: Jernej Skrabec <jernej.skrabec@gmail.com>
To: mripard@kernel.org, wens@csie.org
Cc: airlied@gmail.com, daniel@ffwll.ch, samuel@sholland.org,
dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
Jernej Skrabec <jernej.skrabec@gmail.com>
Subject: [PATCH 7/7] drm/sun4i: dw-hdmi: check for phy device first
Date: Sun, 24 Sep 2023 21:26:04 +0200 [thread overview]
Message-ID: <20230924192604.3262187-8-jernej.skrabec@gmail.com> (raw)
In-Reply-To: <20230924192604.3262187-1-jernej.skrabec@gmail.com>
Let's check for phy device first. Since it uses much of the same clocks
and resets it also lowers amount of possible deferred probes.
While at it, don't report error for deferred phy probe.
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 35 +++++++++++++--------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
index 41f815a1faec..c1becd964326 100644
--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
@@ -173,11 +173,24 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
struct device_node *phy_node;
struct drm_encoder *encoder;
struct sun8i_dw_hdmi *hdmi;
+ struct sun8i_hdmi_phy *phy;
int ret;
if (!pdev->dev.of_node)
return -ENODEV;
+ phy_node = of_parse_phandle(dev->of_node, "phys", 0);
+ if (!phy_node) {
+ dev_err(dev, "Can't find PHY phandle\n");
+ return -EINVAL;
+ }
+
+ phy = sun8i_hdmi_phy_get(phy_node);
+ of_node_put(phy_node);
+ if (IS_ERR(phy))
+ return dev_err_probe(dev, PTR_ERR(phy),
+ "Couldn't get the HDMI PHY\n");
+
hdmi = drmm_kzalloc(drm, sizeof(*hdmi), GFP_KERNEL);
if (!hdmi)
return -ENOMEM;
@@ -185,6 +198,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
plat_data = &hdmi->plat_data;
hdmi->dev = &pdev->dev;
encoder = &hdmi->encoder;
+ hdmi->phy = phy;
hdmi->quirks = of_device_get_match_data(dev);
@@ -232,22 +246,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
goto err_assert_ctrl_reset;
}
- phy_node = of_parse_phandle(dev->of_node, "phys", 0);
- if (!phy_node) {
- dev_err(dev, "Can't found PHY phandle\n");
- ret = -EINVAL;
- goto err_disable_clk_tmds;
- }
-
- hdmi->phy = sun8i_hdmi_phy_get(phy_node);
- of_node_put(phy_node);
- if (IS_ERR(hdmi->phy)) {
- dev_err(dev, "Couldn't get the HDMI PHY\n");
- ret = PTR_ERR(hdmi->phy);
- goto err_disable_clk_tmds;
- }
-
- ret = sun8i_hdmi_phy_init(hdmi->phy);
+ ret = sun8i_hdmi_phy_init(phy);
if (ret)
goto err_disable_clk_tmds;
@@ -259,7 +258,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
plat_data->mode_valid = hdmi->quirks->mode_valid;
plat_data->use_drm_infoframe = hdmi->quirks->use_drm_infoframe;
plat_data->output_port = 1;
- sun8i_hdmi_phy_set_ops(hdmi->phy, plat_data);
+ sun8i_hdmi_phy_set_ops(phy, plat_data);
platform_set_drvdata(pdev, hdmi);
@@ -310,7 +309,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
drm_bridge_remove(&hdmi->enc_bridge);
dw_hdmi_remove(hdmi->hdmi);
err_deinit_phy:
- sun8i_hdmi_phy_deinit(hdmi->phy);
+ sun8i_hdmi_phy_deinit(phy);
err_disable_clk_tmds:
clk_disable_unprepare(hdmi->clk_tmds);
err_assert_ctrl_reset:
--
2.42.0
next prev parent reply other threads:[~2023-09-24 19:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-24 19:25 [PATCH 0/7] drm/sun4i: dw-hdmi: Fix initialization & refactor Jernej Skrabec
2023-09-24 19:25 ` [PATCH 1/7] drm/sun4i: dw-hdmi: Deinit PHY in fail path Jernej Skrabec
2023-09-25 7:43 ` Maxime Ripard
2023-09-24 19:25 ` [PATCH 2/7] drm/sun4i: dw-hdmi: Remove double encoder cleanup Jernej Skrabec
2023-09-25 7:44 ` Maxime Ripard
2023-09-24 19:26 ` [PATCH 3/7] drm/sun4i: dw-hdmi: Switch to bridge functions Jernej Skrabec
2023-09-25 7:57 ` Maxime Ripard
2023-09-25 15:29 ` Jernej Škrabec
2023-10-05 8:42 ` Maxime Ripard
2023-09-24 19:26 ` [PATCH 4/7] drm/sun4i: Don't show error for deferred probes Jernej Skrabec
2023-09-25 7:45 ` Maxime Ripard
2023-09-24 19:26 ` [PATCH 5/7] drm/sun4i: dw-hdmi: Split driver registration Jernej Skrabec
2023-09-25 2:35 ` kernel test robot
2023-09-25 7:47 ` Maxime Ripard
2023-09-25 15:07 ` Jernej Škrabec
2023-10-05 8:43 ` Maxime Ripard
2023-10-13 19:50 ` Jernej Škrabec
2023-09-25 16:40 ` kernel test robot
2023-09-24 19:26 ` [PATCH 6/7] drm/sun4i: dw-hdmi: Make sun8i_hdmi_phy_get() more intuitive Jernej Skrabec
2023-09-24 19:26 ` Jernej Skrabec [this message]
2023-09-25 7:50 ` [PATCH 7/7] drm/sun4i: dw-hdmi: check for phy device first Maxime Ripard
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=20230924192604.3262187-8-jernej.skrabec@gmail.com \
--to=jernej.skrabec@gmail.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mripard@kernel.org \
--cc=samuel@sholland.org \
--cc=wens@csie.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