mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/2] drm: fsl-dcu: Use dev_err_probe
@ 2024-09-26  5:55 Alexander Stein
  2024-09-26  5:55 ` [PATCH v2 2/2] drm: fsl-dcu: enable PIXCLK on LS1021A Alexander Stein
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Alexander Stein @ 2024-09-26  5:55 UTC (permalink / raw)
  To: Stefan Agner, Alison Wang, David Airlie, Daniel Vetter,
	Matthias Schiffer, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Simona Vetter
  Cc: Alexander Stein, dri-devel, linux-kernel

fsl_dcu_drm_modeset_init can return -EPROBE_DEFER, so use dev_err_probe
to remove an invalid error message and add it to deferral description.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
Changes in v2:
* None

 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index ab6c0c6cd0e2e..dd820f19482ad 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -103,10 +103,8 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 	int ret;
 
 	ret = fsl_dcu_drm_modeset_init(fsl_dev);
-	if (ret < 0) {
-		dev_err(dev->dev, "failed to initialize mode setting\n");
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(dev->dev, ret, "failed to initialize mode setting\n");
 
 	ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
 	if (ret < 0) {
-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] drm: fsl-dcu: enable PIXCLK on LS1021A
  2024-09-26  5:55 [PATCH v2 1/2] drm: fsl-dcu: Use dev_err_probe Alexander Stein
@ 2024-09-26  5:55 ` Alexander Stein
  2024-09-26  6:05   ` Dmitry Baryshkov
  2024-09-26  6:06 ` [PATCH v2 1/2] drm: fsl-dcu: Use dev_err_probe Dmitry Baryshkov
  2024-10-19 14:57 ` Dmitry Baryshkov
  2 siblings, 1 reply; 9+ messages in thread
From: Alexander Stein @ 2024-09-26  5:55 UTC (permalink / raw)
  To: Stefan Agner, Alison Wang, David Airlie, Daniel Vetter,
	Matthias Schiffer, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Simona Vetter
  Cc: dri-devel, linux-kernel, Alexander Stein

From: Matthias Schiffer <matthias.schiffer@tq-group.com>

The PIXCLK needs to be enabled in SCFG before accessing certain DCU
registers, or the access will hang. For simplicity, the PIXCLK is enabled
unconditionally, resulting in increased power consumption.

Signed-off-by: Matthias Schiffer <matthias.schiffer@tq-group.com>
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
Changes in v2:
* Add note about power consumption in commit message
* Add note about power consumption in comment
* Fix alignment

 drivers/gpu/drm/fsl-dcu/Kconfig           |  1 +
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 15 +++++++++++++++
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h |  3 +++
 3 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/fsl-dcu/Kconfig b/drivers/gpu/drm/fsl-dcu/Kconfig
index 5ca71ef873259..c9ee98693b48a 100644
--- a/drivers/gpu/drm/fsl-dcu/Kconfig
+++ b/drivers/gpu/drm/fsl-dcu/Kconfig
@@ -8,6 +8,7 @@ config DRM_FSL_DCU
 	select DRM_PANEL
 	select REGMAP_MMIO
 	select VIDEOMODE_HELPERS
+	select MFD_SYSCON if SOC_LS1021A
 	help
 	  Choose this option if you have an Freescale DCU chipset.
 	  If M is selected the module will be called fsl-dcu-drm.
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index dd820f19482ad..63da55fe2eaf8 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -100,12 +100,27 @@ static void fsl_dcu_irq_uninstall(struct drm_device *dev)
 static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 {
 	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
+	struct regmap *scfg;
 	int ret;
 
 	ret = fsl_dcu_drm_modeset_init(fsl_dev);
 	if (ret < 0)
 		return dev_err_probe(dev->dev, ret, "failed to initialize mode setting\n");
 
+	scfg = syscon_regmap_lookup_by_compatible("fsl,ls1021a-scfg");
+	if (PTR_ERR(scfg) != -ENODEV) {
+		/*
+		 * For simplicity, enable the PIXCLK unconditionally,
+		 * resulting in increased power consumption. Disabling
+		 * the clock in PM or on unload could be implemented as
+		 * a future improvement.
+		 */
+		ret = regmap_update_bits(scfg, SCFG_PIXCLKCR, SCFG_PIXCLKCR_PXCEN,
+					 SCFG_PIXCLKCR_PXCEN);
+		if (ret < 0)
+			return dev_err_probe(dev->dev, ret, "failed to enable pixclk\n");
+	}
+
 	ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
 	if (ret < 0) {
 		dev_err(dev->dev, "failed to initialize vblank\n");
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
index e2049a0e8a92a..566396013c04a 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
@@ -160,6 +160,9 @@
 #define FSL_DCU_ARGB4444		12
 #define FSL_DCU_YUV422			14
 
+#define SCFG_PIXCLKCR			0x28
+#define SCFG_PIXCLKCR_PXCEN		BIT(31)
+
 #define VF610_LAYER_REG_NUM		9
 #define LS1021A_LAYER_REG_NUM		10
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] drm: fsl-dcu: enable PIXCLK on LS1021A
  2024-09-26  5:55 ` [PATCH v2 2/2] drm: fsl-dcu: enable PIXCLK on LS1021A Alexander Stein
@ 2024-09-26  6:05   ` Dmitry Baryshkov
  2024-09-26 14:09     ` Alexander Stein
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Baryshkov @ 2024-09-26  6:05 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Stefan Agner, Alison Wang, David Airlie, Daniel Vetter,
	Matthias Schiffer, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Simona Vetter, dri-devel, linux-kernel

On Thu, Sep 26, 2024 at 07:55:51AM GMT, Alexander Stein wrote:
> From: Matthias Schiffer <matthias.schiffer@tq-group.com>
> 
> The PIXCLK needs to be enabled in SCFG before accessing certain DCU
> registers, or the access will hang. For simplicity, the PIXCLK is enabled
> unconditionally, resulting in increased power consumption.

By this description it looks like a fix. What is the first broken
commit? It needs to be mentioned in the Fixes: tag. Or is it hat
existing devices have been enabling SCFG in some other way?

> 
> Signed-off-by: Matthias Schiffer <matthias.schiffer@tq-group.com>
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> Changes in v2:
> * Add note about power consumption in commit message
> * Add note about power consumption in comment
> * Fix alignment
> 

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] drm: fsl-dcu: Use dev_err_probe
  2024-09-26  5:55 [PATCH v2 1/2] drm: fsl-dcu: Use dev_err_probe Alexander Stein
  2024-09-26  5:55 ` [PATCH v2 2/2] drm: fsl-dcu: enable PIXCLK on LS1021A Alexander Stein
@ 2024-09-26  6:06 ` Dmitry Baryshkov
  2024-10-19 14:57 ` Dmitry Baryshkov
  2 siblings, 0 replies; 9+ messages in thread
From: Dmitry Baryshkov @ 2024-09-26  6:06 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Stefan Agner, Alison Wang, David Airlie, Daniel Vetter,
	Matthias Schiffer, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Simona Vetter, dri-devel, linux-kernel

On Thu, Sep 26, 2024 at 07:55:50AM GMT, Alexander Stein wrote:
> fsl_dcu_drm_modeset_init can return -EPROBE_DEFER, so use dev_err_probe
> to remove an invalid error message and add it to deferral description.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> Changes in v2:
> * None
> 
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] drm: fsl-dcu: enable PIXCLK on LS1021A
  2024-09-26  6:05   ` Dmitry Baryshkov
@ 2024-09-26 14:09     ` Alexander Stein
  2024-09-26 23:13       ` Dmitry Baryshkov
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander Stein @ 2024-09-26 14:09 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Stefan Agner, Alison Wang, David Airlie, Daniel Vetter,
	Matthias Schiffer, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Simona Vetter, dri-devel, linux-kernel

Hi Dmitry,

Am Donnerstag, 26. September 2024, 08:05:56 CEST schrieb Dmitry Baryshkov:
> On Thu, Sep 26, 2024 at 07:55:51AM GMT, Alexander Stein wrote:
> > From: Matthias Schiffer <matthias.schiffer@tq-group.com>
> > 
> > The PIXCLK needs to be enabled in SCFG before accessing certain DCU
> > registers, or the access will hang. For simplicity, the PIXCLK is enabled
> > unconditionally, resulting in increased power consumption.
> 
> By this description it looks like a fix. What is the first broken
> commit? It needs to be mentioned in the Fixes: tag. Or is it hat
> existing devices have been enabling SCFG in some other way?

We discussed this internally and it seems this never worked, unless PIXCLK
was already enabled in SCFG by a different way, e.g. firmware, etc.

Best regards,
Alexander

> > 
> > Signed-off-by: Matthias Schiffer <matthias.schiffer@tq-group.com>
> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > ---
> > Changes in v2:
> > * Add note about power consumption in commit message
> > * Add note about power consumption in comment
> > * Fix alignment
> > 
> 
> 


-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] drm: fsl-dcu: enable PIXCLK on LS1021A
  2024-09-26 14:09     ` Alexander Stein
@ 2024-09-26 23:13       ` Dmitry Baryshkov
  2024-10-17  6:50         ` Alexander Stein
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Baryshkov @ 2024-09-26 23:13 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Stefan Agner, Alison Wang, David Airlie, Daniel Vetter,
	Matthias Schiffer, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Simona Vetter, dri-devel, linux-kernel

On Thu, Sep 26, 2024 at 04:09:03PM GMT, Alexander Stein wrote:
> Hi Dmitry,
> 
> Am Donnerstag, 26. September 2024, 08:05:56 CEST schrieb Dmitry Baryshkov:
> > On Thu, Sep 26, 2024 at 07:55:51AM GMT, Alexander Stein wrote:
> > > From: Matthias Schiffer <matthias.schiffer@tq-group.com>
> > > 
> > > The PIXCLK needs to be enabled in SCFG before accessing certain DCU
> > > registers, or the access will hang. For simplicity, the PIXCLK is enabled
> > > unconditionally, resulting in increased power consumption.
> > 
> > By this description it looks like a fix. What is the first broken
> > commit? It needs to be mentioned in the Fixes: tag. Or is it hat
> > existing devices have been enabling SCFG in some other way?
> 
> We discussed this internally and it seems this never worked, unless PIXCLK
> was already enabled in SCFG by a different way, e.g. firmware, etc.

My bet was on the firmware, but I never touched Layerscape platforms.
Anyway,

Fixes: 109eee2f2a18 ("drm/layerscape: Add Freescale DCU DRM driver")
Acked-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>


> 
> Best regards,
> Alexander
> 
> > > 
> > > Signed-off-by: Matthias Schiffer <matthias.schiffer@tq-group.com>
> > > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > > ---
> > > Changes in v2:
> > > * Add note about power consumption in commit message
> > > * Add note about power consumption in comment
> > > * Fix alignment
> > > 
> > 
> > 
> 
> 
> -- 
> TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
> Amtsgericht München, HRB 105018
> Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
> http://www.tq-group.com/
> 
> 

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] drm: fsl-dcu: enable PIXCLK on LS1021A
  2024-09-26 23:13       ` Dmitry Baryshkov
@ 2024-10-17  6:50         ` Alexander Stein
  2024-10-19 14:30           ` Dmitry Baryshkov
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander Stein @ 2024-10-17  6:50 UTC (permalink / raw)
  To: Stefan Agner, Alison Wang, David Airlie, Maarten Lankhorst,
	Maxime Ripard, Simona Vetter
  Cc: Dmitry Baryshkov, Daniel Vetter, Matthias Schiffer,
	Thomas Zimmermann, dri-devel, linux-kernel

Hi everyone,

Am Freitag, 27. September 2024, 01:13:57 CEST schrieb Dmitry Baryshkov:
> On Thu, Sep 26, 2024 at 04:09:03PM GMT, Alexander Stein wrote:
> > Hi Dmitry,
> > 
> > Am Donnerstag, 26. September 2024, 08:05:56 CEST schrieb Dmitry Baryshkov:
> > > On Thu, Sep 26, 2024 at 07:55:51AM GMT, Alexander Stein wrote:
> > > > From: Matthias Schiffer <matthias.schiffer@tq-group.com>
> > > > 
> > > > The PIXCLK needs to be enabled in SCFG before accessing certain DCU
> > > > registers, or the access will hang. For simplicity, the PIXCLK is enabled
> > > > unconditionally, resulting in increased power consumption.
> > > 
> > > By this description it looks like a fix. What is the first broken
> > > commit? It needs to be mentioned in the Fixes: tag. Or is it hat
> > > existing devices have been enabling SCFG in some other way?
> > 
> > We discussed this internally and it seems this never worked, unless PIXCLK
> > was already enabled in SCFG by a different way, e.g. firmware, etc.
> 
> My bet was on the firmware, but I never touched Layerscape platforms.
> Anyway,
> 
> Fixes: 109eee2f2a18 ("drm/layerscape: Add Freescale DCU DRM driver")
> Acked-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Any additional feedback?

Best regards,
Alexander
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] drm: fsl-dcu: enable PIXCLK on LS1021A
  2024-10-17  6:50         ` Alexander Stein
@ 2024-10-19 14:30           ` Dmitry Baryshkov
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Baryshkov @ 2024-10-19 14:30 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Stefan Agner, Alison Wang, David Airlie, Maarten Lankhorst,
	Maxime Ripard, Simona Vetter, Daniel Vetter, Matthias Schiffer,
	Thomas Zimmermann, dri-devel, linux-kernel

On Thu, Oct 17, 2024 at 08:50:43AM +0200, Alexander Stein wrote:
> Hi everyone,
> 
> Am Freitag, 27. September 2024, 01:13:57 CEST schrieb Dmitry Baryshkov:
> > On Thu, Sep 26, 2024 at 04:09:03PM GMT, Alexander Stein wrote:
> > > Hi Dmitry,
> > > 
> > > Am Donnerstag, 26. September 2024, 08:05:56 CEST schrieb Dmitry Baryshkov:
> > > > On Thu, Sep 26, 2024 at 07:55:51AM GMT, Alexander Stein wrote:
> > > > > From: Matthias Schiffer <matthias.schiffer@tq-group.com>
> > > > > 
> > > > > The PIXCLK needs to be enabled in SCFG before accessing certain DCU
> > > > > registers, or the access will hang. For simplicity, the PIXCLK is enabled
> > > > > unconditionally, resulting in increased power consumption.
> > > > 
> > > > By this description it looks like a fix. What is the first broken
> > > > commit? It needs to be mentioned in the Fixes: tag. Or is it hat
> > > > existing devices have been enabling SCFG in some other way?
> > > 
> > > We discussed this internally and it seems this never worked, unless PIXCLK
> > > was already enabled in SCFG by a different way, e.g. firmware, etc.
> > 
> > My bet was on the firmware, but I never touched Layerscape platforms.
> > Anyway,
> > 
> > Fixes: 109eee2f2a18 ("drm/layerscape: Add Freescale DCU DRM driver")
> > Acked-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> 
> Any additional feedback?

No response from Stefan and Alison for nearly a month...

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] drm: fsl-dcu: Use dev_err_probe
  2024-09-26  5:55 [PATCH v2 1/2] drm: fsl-dcu: Use dev_err_probe Alexander Stein
  2024-09-26  5:55 ` [PATCH v2 2/2] drm: fsl-dcu: enable PIXCLK on LS1021A Alexander Stein
  2024-09-26  6:06 ` [PATCH v2 1/2] drm: fsl-dcu: Use dev_err_probe Dmitry Baryshkov
@ 2024-10-19 14:57 ` Dmitry Baryshkov
  2 siblings, 0 replies; 9+ messages in thread
From: Dmitry Baryshkov @ 2024-10-19 14:57 UTC (permalink / raw)
  To: Stefan Agner, Alison Wang, David Airlie, Matthias Schiffer,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Simona Vetter, Simona Vetter, Alexander Stein
  Cc: dri-devel, linux-kernel

On Thu, 26 Sep 2024 07:55:50 +0200, Alexander Stein wrote:
> fsl_dcu_drm_modeset_init can return -EPROBE_DEFER, so use dev_err_probe
> to remove an invalid error message and add it to deferral description.
> 
> 

Applied to drm-misc-next, thanks!

[1/2] drm: fsl-dcu: Use dev_err_probe
      commit: 5b7abfb20ba15c0d6c52672874b99d9564ca876b
[2/2] drm: fsl-dcu: enable PIXCLK on LS1021A
      commit: ffcde9e44d3e18fde3d18bfff8d9318935413bfd

Best regards,
-- 
With best wishes
Dmitry


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-10-19 14:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-26  5:55 [PATCH v2 1/2] drm: fsl-dcu: Use dev_err_probe Alexander Stein
2024-09-26  5:55 ` [PATCH v2 2/2] drm: fsl-dcu: enable PIXCLK on LS1021A Alexander Stein
2024-09-26  6:05   ` Dmitry Baryshkov
2024-09-26 14:09     ` Alexander Stein
2024-09-26 23:13       ` Dmitry Baryshkov
2024-10-17  6:50         ` Alexander Stein
2024-10-19 14:30           ` Dmitry Baryshkov
2024-09-26  6:06 ` [PATCH v2 1/2] drm: fsl-dcu: Use dev_err_probe Dmitry Baryshkov
2024-10-19 14:57 ` Dmitry Baryshkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®