drm/rockchip: lvds: probe logging improvements
Subsystems (4)
Heiko Stuebner
maintainercover drm/rockchip: lvds: probe logging improvements
Getting the panel already uses dev_err_probe to stay silent, when the panel just probes later, and the lvds defers.
But the phy needed on px30, also has the capability to probe after the lvds. So make the rest of the lvds probe/bind logic also use more modern logging than DRM_DEV_ERR, that is deprecated anyway.
Heiko Stuebner (2):
drm/rockchip: lvds: move pclk preparation in with clk_get drm/rockchip: lvds: Hide scary error messages on probe deferral
drivers/gpu/drm/rockchip/rockchip_lvds.c | 76 +++++++++--------------- 1 file changed, 28 insertions(+), 48 deletions(-)
Signature · 1 line
2.47.2
Heiko Stuebner
maintainerPATCH 1/2 drm/rockchip: lvds: move pclk preparation in with clk_get
From: Heiko Stuebner <[email protected]>
The LVDS block needs a separate pclk only on some socs, so currently requests and prepares it in the soc-specific probe function, but common code is required to unprepare it in the error path or on driver remove.
While this works because clk_unprepare just does nothing if clk is NULL, this mismatch of who is responsible still is not very nice. The clock-framework already has a helper for clk-get-and-prepare even with devres support in devm_clk_get_prepared().
This will get and prepare the clock and also unprepare it on driver removal, saving the driver from having to handle it "manually".
--- drivers/gpu/drm/rockchip/rockchip_lvds.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
drivers/gpu/drm/rockchip/rockchip_lvds.c +2 -15
@@ -448,13 +448,11 @@ struct drm_encoder_helper_funcs px30_lvds_encoder_helper_funcs = {static int rk3288_lvds_probe (struct platform_device *pdev,struct rockchip_lvds *lvds) { -int ret; - lvds->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (lvds->regs))return PTR_ERR (lvds->regs); - lvds->pclk =devm_clk_get (lvds->dev,"pclk_lvds" ); + lvds->pclk =devm_clk_get_prepared (lvds->dev,"pclk_lvds" );if (IS_ERR (lvds->pclk)) {DRM_DEV_ERROR (lvds->dev,"could not get pclk_lvds\n" );return PTR_ERR (lvds->pclk);
@@ -480,12 +478,6 @@ static int rk3288_lvds_probe(struct platform_device *pdev, } } - ret =clk_prepare (lvds->pclk); -if (ret <0 ) { -DRM_DEV_ERROR (lvds->dev,"failed to prepare pclk_lvds\n" ); -return ret; - } -return 0 ; }
@@ -728,20 +720,15 @@ static int rockchip_lvds_probe(struct platform_device *pdev)dev_set_drvdata (dev, lvds); ret =component_add (&pdev->dev, &rockchip_lvds_component_ops); -if (ret <0 ) { +if (ret <0 )DRM_DEV_ERROR (dev,"failed to add component\n" ); -clk_unprepare (lvds->pclk); - }return ret; }static void rockchip_lvds_remove (struct platform_device *pdev) { -struct rockchip_lvds *lvds =platform_get_drvdata (pdev); -component_del (&pdev->dev, &rockchip_lvds_component_ops); -clk_unprepare (lvds->pclk); }struct platform_driver rockchip_lvds_driver = {
Signature · 1 line
2.47.2
Heiko Stuebner
maintainerPATCH 2/2 drm/rockchip: lvds: Hide scary error messages on probe deferral
In reply to Heiko StuebnerFrom: Heiko Stuebner <[email protected]>
Commit 52d11c863ac9 ("drm/rockchip: lvds: do not print scary message when probing defer") already started hiding scary messages that are not relevant if the requested supply just returned EPROBE_DEFER, but there are more possible sources - like the phy.
So modernize the whole logging in the probe path by replacing the remaining deprecated DRM_DEV_ERROR with appropriate dev_err(_probe) and drm_err calls.
The distinction here is that all messages talking about mishaps of the lvds element use dev_err(_probe) while messages caused by interaction with the main Rockchip drm-device use drm_err.
--- drivers/gpu/drm/rockchip/rockchip_lvds.c | 59 +++++++++++------------- 1 file changed, 26 insertions(+), 33 deletions(-)
drivers/gpu/drm/rockchip/rockchip_lvds.c +26 -33
@@ -453,10 +453,9 @@ static int rk3288_lvds_probe(struct platform_device *pdev,return PTR_ERR (lvds->regs); lvds->pclk =devm_clk_get_prepared (lvds->dev,"pclk_lvds" ); -if (IS_ERR (lvds->pclk)) { -DRM_DEV_ERROR (lvds->dev,"could not get pclk_lvds\n" ); -return PTR_ERR (lvds->pclk); - } +if (IS_ERR (lvds->pclk)) +return dev_err_probe (lvds->dev,PTR_ERR (lvds->pclk), +"could not get pclk_lvds\n" ); lvds->pins =devm_kzalloc (lvds->dev,sizeof (*lvds->pins),GFP_KERNEL );
@@ -465,14 +464,14 @@ static int rk3288_lvds_probe(struct platform_device *pdev, lvds->pins->p =devm_pinctrl_get (lvds->dev);if (IS_ERR (lvds->pins->p)) { -DRM_DEV_ERROR (lvds->dev,"no pinctrl handle\n" ); +dev_err (lvds->dev,"no pinctrl handle\n" );devm_kfree (lvds->dev, lvds->pins); lvds->pins =NULL ; }else { lvds->pins->default_state =pinctrl_lookup_state (lvds->pins->p,"lcdc" );if (IS_ERR (lvds->pins->default_state)) { -DRM_DEV_ERROR (lvds->dev,"no default pinctrl state\n" ); +dev_err (lvds->dev,"no default pinctrl state\n" );devm_kfree (lvds->dev, lvds->pins); lvds->pins =NULL ; }
@@ -547,11 +546,10 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, lvds->drm_dev = drm_dev; port =of_graph_get_port_by_id (dev->of_node,1 ); -if (!port) { -DRM_DEV_ERROR (dev, -"can't found port point, please init lvds panel port!\n" ); -return -EINVAL ; - } +if (!port) +return dev_err_probe (dev, -EINVAL , +"can't found port point, please init lvds panel port!\n" ); +for_each_child_of_node (port, endpoint) { child_count++;of_property_read_u32 (endpoint,"reg" , &endpoint_id);
@@ -563,7 +561,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, } }if (!child_count) { -DRM_DEV_ERROR (dev,"lvds port does not have any children\n" ); +dev_err (dev,"lvds port does not have any children\n" ); ret = -EINVAL ; goto err_put_port; }else if (ret) {
@@ -581,7 +579,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, lvds->output =rockchip_lvds_name_to_output (name);if (lvds->output <0 ) { -DRM_DEV_ERROR (dev,"invalid output type [%s]\n" , name); +dev_err (dev,"invalid output type [%s]\n" , name); ret = lvds->output; goto err_put_remote; }
@@ -593,7 +591,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, lvds->format =rockchip_lvds_name_to_format (name);if (lvds->format <0 ) { -DRM_DEV_ERROR (dev,"invalid data-mapping format [%s]\n" , name); +dev_err (dev,"invalid data-mapping format [%s]\n" , name); ret = lvds->format; goto err_put_remote; }
@@ -604,8 +602,8 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, ret =drm_simple_encoder_init (drm_dev, encoder,DRM_MODE_ENCODER_LVDS );if (ret <0 ) { -DRM_DEV_ERROR (drm_dev->dev, -"failed to initialize encoder: %d\n" , ret); +drm_err (drm_dev, +"failed to initialize encoder: %d\n" , ret); goto err_put_remote; }
@@ -618,8 +616,8 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, &rockchip_lvds_connector_funcs, DRM_MODE_CONNECTOR_LVDS);if (ret <0 ) { -DRM_DEV_ERROR (drm_dev->dev, -"failed to initialize connector: %d\n" , ret); +drm_err (drm_dev, +"failed to initialize connector: %d\n" , ret); goto err_free_encoder; }
@@ -633,9 +631,9 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, connector =drm_bridge_connector_init (lvds->drm_dev, encoder);if (IS_ERR (connector)) { -DRM_DEV_ERROR (drm_dev->dev, -"failed to initialize bridge connector: %pe\n" , - connector); +drm_err (drm_dev, +"failed to initialize bridge connector: %pe\n" , + connector); ret =PTR_ERR (connector); goto err_free_encoder; }
@@ -643,8 +641,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, ret =drm_connector_attach_encoder (connector, encoder);if (ret <0 ) { -DRM_DEV_ERROR (drm_dev->dev, -"failed to attach encoder: %d\n" , ret); +drm_err (drm_dev,"failed to attach encoder: %d\n" , ret); goto err_free_connector; }
@@ -706,24 +703,20 @@ static int rockchip_lvds_probe(struct platform_device *pdev) lvds->grf =syscon_regmap_lookup_by_phandle (dev->of_node,"rockchip,grf" ); -if (IS_ERR (lvds->grf)) { -DRM_DEV_ERROR (dev,"missing rockchip,grf property\n" ); -return PTR_ERR (lvds->grf); - } +if (IS_ERR (lvds->grf)) +return dev_err_probe (dev,PTR_ERR (lvds->grf),"missing rockchip,grf property\n" ); ret = lvds->soc_data->probe (pdev, lvds); -if (ret) { -DRM_DEV_ERROR (dev,"Platform initialization failed\n" ); -return ret; - } +if (ret) +return dev_err_probe (dev, ret,"Platform initialization failed\n" );dev_set_drvdata (dev, lvds); ret =component_add (&pdev->dev, &rockchip_lvds_component_ops);if (ret <0 ) -DRM_DEV_ERROR (dev,"failed to add component\n" ); +return dev_err_probe (dev, ret,"failed to add component\n" ); -return ret; +return 0 ; }static void rockchip_lvds_remove (struct platform_device *pdev)
Signature · 1 line
2.47.2
Re: [PATCH 1/2] drm/rockchip: lvds: move pclk preparation in with clk_get
In reply to Heiko StuebnerHi Heiko,
Quoted 11 lines · Heiko Stuebner
From: Heiko Stuebner <[email protected]>
The LVDS block needs a separate pclk only on some socs, so currently requests and prepares it in the soc-specific probe function, but common code is required to unprepare it in the error path or on driver remove.
While this works because
clk_unpreparejust does nothing if clk is NULL, this mismatch of who is responsible still is not very nice. The clock-framework already has a helper for clk-get-and-prepare even with devres support indevm_clk_get_prepared().
Quoted 4 lines
This will get and prepare the clock and also unprepare it on driver removal, saving the driver from having to handle it "manually".
Signed-off-by Heiko Stuebner <[email protected]>
Small nitpick below.
Quoted 12 lines
--- drivers/gpu/drm/rockchip/rockchip_lvds.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)drivers/gpu/drm/rockchip/rockchip_lvds.c +0
-0@@ -448,13 +448,11 @@ struct drm_encoder_helper_funcs px30_lvds_encoder_helper_funcs = {static int rk3288_lvds_probe (struct platform_device *pdev,struct rockchip_lvds *lvds) {
drivers/gpu/drm/rockchip/rockchip_lvds.c struct drm_encoder_helper_funcs px30_lvds_encoder_helper_funcs = { · line 457
Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_lvds.c +1
-3-int ret; - lvds->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (lvds->regs))return PTR_ERR (lvds->regs); - lvds->pclk =devm_clk_get (lvds->dev,"pclk_lvds" ); + lvds->pclk =devm_clk_get_prepared (lvds->dev,"pclk_lvds" );if (IS_ERR (lvds->pclk)) {DRM_DEV_ERROR (lvds->dev,"could not get pclk_lvds\n" );
Should we say
Could not get or prepare pclk_lvds\n
instead?
Thanks!
Quentin
Re: [PATCH 2/2] drm/rockchip: lvds: Hide scary error messages on probe deferral
In reply to Heiko StuebnerHi Heiko,
Quoted 72 lines · Heiko Stuebner
From: Heiko Stuebner <[email protected]>
Commit
52d11c863ac9("drm/rockchip: lvds: do not print scary message when probing defer") already started hiding scary messages that are not relevant if the requested supply just returnedEPROBE_DEFER, but there are more possible sources - like the phy.So modernize the whole logging in the probe path by replacing the remaining deprecated
DRM_DEV_ERRORwith appropriatedev_err(_probe)anddrm_errcalls.The distinction here is that all messages talking about mishaps of the lvds element use
dev_err(_probe)while messages caused by interaction with the main Rockchip drm-device usedrm_err.Signed-off-by Heiko Stuebner <[email protected]>--- drivers/gpu/drm/rockchip/rockchip_lvds.c | 59 +++++++++++------------- 1 file changed, 26 insertions(+), 33 deletions(-)drivers/gpu/drm/rockchip/rockchip_lvds.c +9
-11@@ -453,10 +453,9 @@ static int rk3288_lvds_probe(struct platform_device *pdev,return PTR_ERR (lvds->regs); lvds->pclk =devm_clk_get_prepared (lvds->dev,"pclk_lvds" ); -if (IS_ERR (lvds->pclk)) { -DRM_DEV_ERROR (lvds->dev,"could not get pclk_lvds\n" ); -return PTR_ERR (lvds->pclk); - } +if (IS_ERR (lvds->pclk)) +return dev_err_probe (lvds->dev,PTR_ERR (lvds->pclk), +"could not get pclk_lvds\n" ); lvds->pins =devm_kzalloc (lvds->dev,sizeof (*lvds->pins),GFP_KERNEL );@@ -465,14 +464,14 @@ static int rk3288_lvds_probe(struct platform_device *pdev, lvds->pins->p =devm_pinctrl_get (lvds->dev);if (IS_ERR (lvds->pins->p)) { -DRM_DEV_ERROR (lvds->dev,"no pinctrl handle\n" ); +dev_err (lvds->dev,"no pinctrl handle\n" );devm_kfree (lvds->dev, lvds->pins); lvds->pins =NULL ; }else { lvds->pins->default_state =pinctrl_lookup_state (lvds->pins->p,"lcdc" );if (IS_ERR (lvds->pins->default_state)) { -DRM_DEV_ERROR (lvds->dev,"no default pinctrl state\n" ); +dev_err (lvds->dev,"no default pinctrl state\n" );devm_kfree (lvds->dev, lvds->pins); lvds->pins =NULL ; }@@ -547,11 +546,10 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, lvds->drm_dev = drm_dev; port =of_graph_get_port_by_id (dev->of_node,1 ); -if (!port) { -DRM_DEV_ERROR (dev, -"can't found port point, please init lvds panel port!\n" ); -return -EINVAL ; - } +if (!port) +return dev_err_probe (dev, -EINVAL , +"can't found port point, please init lvds panel port!\n" ); +for_each_child_of_node (port, endpoint) { child_count++;of_property_read_u32 (endpoint,"reg" , &endpoint_id);
drivers/gpu/drm/rockchip/rockchip_lvds.c static int rockchip_lvds_bind(struct device *dev, struct device *master, · line 565
Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_lvds.c +1
-1@@ -563,7 +561,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, } }if (!child_count) { -DRM_DEV_ERROR (dev,"lvds port does not have any children\n" ); +dev_err (dev,"lvds port does not have any children\n" ); ret = -EINVAL ;
What about
ret = dev_err_probe(dev, -EINVAL, "lvds port does not have any children\n")
?
drivers/gpu/drm/rockchip/rockchip_lvds.c static int rockchip_lvds_bind(struct device *dev, struct device *master, · line 583
Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_lvds.c +1
-1goto err_put_port; }else if (ret) {@@ -581,7 +579,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, lvds->output =rockchip_lvds_name_to_output (name);if (lvds->output <0 ) { -DRM_DEV_ERROR (dev,"invalid output type [%s]\n" , name); +dev_err (dev,"invalid output type [%s]\n" , name); ret = lvds->output;
ret = dev_err_probe(dev, lvds->output, "invalid output type [%s]\n", name);
maybe?
drivers/gpu/drm/rockchip/rockchip_lvds.c static int rockchip_lvds_bind(struct device *dev, struct device *master, · line 595
Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_lvds.c +1
-1goto err_put_remote; }@@ -593,7 +591,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, lvds->format =rockchip_lvds_name_to_format (name);if (lvds->format <0 ) { -DRM_DEV_ERROR (dev,"invalid data-mapping format [%s]\n" , name); +dev_err (dev,"invalid data-mapping format [%s]\n" , name); ret = lvds->format;
ret = dev_err_probe(dev, lvds->format, "invalid data-mapping format [%s]\n", name);
maybe?
drivers/gpu/drm/rockchip/rockchip_lvds.c static int rockchip_lvds_bind(struct device *dev, struct device *master, · line 606
Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_lvds.c +2
-2goto err_put_remote; }@@ -604,8 +602,8 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, ret =drm_simple_encoder_init (drm_dev, encoder,DRM_MODE_ENCODER_LVDS );if (ret <0 ) { -DRM_DEV_ERROR (drm_dev->dev, -"failed to initialize encoder: %d\n" , ret); +drm_err (drm_dev, +"failed to initialize encoder: %d\n" , ret);
All the above are using dev_err, but starting here, it's drm_err, is that on purpose?
Quoted 15 lines
drivers/gpu/drm/rockchip/rockchip_lvds.c +2
-2goto err_put_remote; }@@ -618,8 +616,8 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, &rockchip_lvds_connector_funcs, DRM_MODE_CONNECTOR_LVDS);if (ret <0 ) { -DRM_DEV_ERROR (drm_dev->dev, -"failed to initialize connector: %d\n" , ret); +drm_err (drm_dev, +"failed to initialize connector: %d\n" , ret); goto err_free_encoder; }
drivers/gpu/drm/rockchip/rockchip_lvds.c static int rockchip_lvds_bind(struct device *dev, struct device *master, · line 637
Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_lvds.c +3
-3@@ -633,9 +631,9 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, connector =drm_bridge_connector_init (lvds->drm_dev, encoder);if (IS_ERR (connector)) { -DRM_DEV_ERROR (drm_dev->dev, -"failed to initialize bridge connector: %pe\n" , - connector); +drm_err (drm_dev, +"failed to initialize bridge connector: %pe\n" , + connector); ret =PTR_ERR (connector);
What about using dev_err_probe() here as well?
Looks ok to me otherwise!
Cheers,
Quentin
Heiko Stübner
maintainerRe: [PATCH 2/2] drm/rockchip: lvds: Hide scary error messages on probe deferral
Am Freitag, 28. Februar 2025, 18:42:32 MEZ schrieb Quentin Schulz:
Quoted 22 lines
Hi Heiko,
Quoted 19 lines · Heiko Stuebner
From: Heiko Stuebner <[email protected]>
Commit
52d11c863ac9("drm/rockchip: lvds: do not print scary message when probing defer") already started hiding scary messages that are not relevant if the requested supply just returnedEPROBE_DEFER, but there are more possible sources - like the phy.So modernize the whole logging in the probe path by replacing the remaining deprecated
DRM_DEV_ERRORwith appropriatedev_err(_probe)anddrm_errcalls.The distinction here is that all messages talking about mishaps of the lvds element use
dev_err(_probe)while messages caused by interaction with the main Rockchip drm-device usedrm_err.Signed-off-by Heiko Stuebner <[email protected]>(quoted diff) +0
-0@@ -604,8 +602,8 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master,
Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_lvds.c static int rockchip_lvds_bind(struct device *dev, struct device *master, · line 606
Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_lvds.c +2
-2ret =drm_simple_encoder_init (drm_dev, encoder,DRM_MODE_ENCODER_LVDS );if (ret <0 ) { -DRM_DEV_ERROR (drm_dev->dev, -"failed to initialize encoder: %d\n" , ret); +drm_err (drm_dev, +"failed to initialize encoder: %d\n" , ret);All the above are using
dev_err, but starting here, it'sdrm_err, is that on purpose?
The last paragraph of the commit message was supposed to explain that (which it seemingly did poorly :-) ) :
Quoted 3 lines
Quoted 3 lines
The distinction here is that all messages talking about mishaps of the lvds element use
dev_err(_probe)while messages caused by interaction with the main Rockchip drm-device usedrm_err.
Re: [PATCH 2/2] drm/rockchip: lvds: Hide scary error messages on probe deferral
Hi Heiko,
Quoted 33 lines · Heiko Stübner
Am Freitag, 28. Februar 2025, 18:42:32 MEZ schrieb Quentin Schulz:
Quoted 22 lines
Hi Heiko,
Quoted 19 lines · Heiko Stuebner
From: Heiko Stuebner <[email protected]>
Commit
52d11c863ac9("drm/rockchip: lvds: do not print scary message when probing defer") already started hiding scary messages that are not relevant if the requested supply just returnedEPROBE_DEFER, but there are more possible sources - like the phy.So modernize the whole logging in the probe path by replacing the remaining deprecated
DRM_DEV_ERRORwith appropriatedev_err(_probe)anddrm_errcalls.The distinction here is that all messages talking about mishaps of the lvds element use
dev_err(_probe)while messages caused by interaction with the main Rockchip drm-device usedrm_err.Signed-off-by Heiko Stuebner <[email protected]>(quoted diff) +0
-0@@ -604,8 +602,8 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master,Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_lvds.c static int rockchip_lvds_bind(struct device *dev, struct device *master, · line 606
Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_lvds.c +2
-2ret =drm_simple_encoder_init (drm_dev, encoder,DRM_MODE_ENCODER_LVDS );if (ret <0 ) { -DRM_DEV_ERROR (drm_dev->dev, -"failed to initialize encoder: %d\n" , ret); +drm_err (drm_dev, +"failed to initialize encoder: %d\n" , ret);All the above are using
dev_err, but starting here, it'sdrm_err, is that on purpose?
Quoted 3 lines
The last paragraph of the commit message was supposed to explain that (which it seemingly did poorly :-) ) :
Mmmm someone didn't read that commit log entirely. That someone apologizes for the noise.
Cheers,
Quentin