linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: atmel-hlcdc: Support inverting the pixel clock polarity
@ 2023-06-09 14:48 Miquel Raynal
       [not found] ` <20230610200515.GA1041001@ravnborg.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Miquel Raynal @ 2023-06-09 14:48 UTC (permalink / raw)
  To: Sam Ravnborg, Boris Brezillon, David Airlie, Daniel Vetter,
	dri-devel
  Cc: Alexandre Belloni, Thomas Petazzoni, Miquel Raynal,
	Claudiu Beznea, linux-arm-kernel

On the SoC host controller, the pixel clock can be:
* standard: data is launched on the rising edge
* inverted: data is launched on the falling edge

Some panels may need the inverted option to be used so let's support
this DRM flag.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---

Hello, this change was tested on a Sama5d36 based custom board with a
panel not behaving correctly if the pixel clock was not inverted.
Cheers, Miquèl

 .../gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c    | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
index 58184cd6ab0b..cc5cf4c2faf7 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
@@ -68,7 +68,11 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
 	struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
 	struct regmap *regmap = crtc->dc->hlcdc->regmap;
 	struct drm_display_mode *adj = &c->state->adjusted_mode;
+	struct drm_encoder *encoder = NULL, *en_iter;
+	struct drm_connector *connector = NULL;
 	struct atmel_hlcdc_crtc_state *state;
+	struct drm_device *ddev = c->dev;
+	struct drm_connector_list_iter iter;
 	unsigned long mode_rate;
 	struct videomode vm;
 	unsigned long prate;
@@ -76,6 +80,23 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
 	unsigned int cfg = 0;
 	int div, ret;
 
+	/* get encoder from crtc */
+	drm_for_each_encoder(en_iter, ddev) {
+		if (en_iter->crtc == c) {
+			encoder = en_iter;
+			break;
+		}
+	}
+
+	if (encoder) {
+		/* Get the connector from encoder */
+		drm_connector_list_iter_begin(ddev, &iter);
+		drm_for_each_connector_iter(connector, &iter)
+			if (connector->encoder == encoder)
+				break;
+		drm_connector_list_iter_end(&iter);
+	}
+
 	ret = clk_prepare_enable(crtc->dc->hlcdc->sys_clk);
 	if (ret)
 		return;
@@ -134,6 +155,10 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
 
 	cfg |= ATMEL_HLCDC_CLKDIV(div);
 
+	if (connector &&
+	    connector->display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE)
+		cfg |= ATMEL_HLCDC_CLKPOL;
+
 	regmap_update_bits(regmap, ATMEL_HLCDC_CFG(0), mask, cfg);
 
 	state = drm_crtc_state_to_atmel_hlcdc_crtc_state(c->state);
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm: atmel-hlcdc: Support inverting the pixel clock polarity
       [not found] ` <20230610200515.GA1041001@ravnborg.org>
@ 2023-07-12 15:57   ` Miquel Raynal
  2023-08-07  9:12   ` Miquel Raynal
  1 sibling, 0 replies; 8+ messages in thread
From: Miquel Raynal @ 2023-07-12 15:57 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Alexandre Belloni, Thomas Petazzoni, Boris Brezillon, dri-devel,
	Daniel Vetter, David Airlie, Claudiu Beznea, linux-arm-kernel

Hello,

sam@ravnborg.org wrote on Sat, 10 Jun 2023 22:05:15 +0200:

> On Fri, Jun 09, 2023 at 04:48:43PM +0200, Miquel Raynal wrote:
> > On the SoC host controller, the pixel clock can be:
> > * standard: data is launched on the rising edge
> > * inverted: data is launched on the falling edge
> > 
> > Some panels may need the inverted option to be used so let's support
> > this DRM flag.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>  
> 
> Hi Miquel,
> 
> the patch is:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
> I hope someone else can pick it up and apply it to drm-misc as
> my drm-misc setup is hopelessly outdated atm.

Looks like nobody picked this up yet, can someone take it? Let me know
if you want me to send it again.

Thanks,
Miquèl

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm: atmel-hlcdc: Support inverting the pixel clock polarity
       [not found] ` <20230610200515.GA1041001@ravnborg.org>
  2023-07-12 15:57   ` Miquel Raynal
@ 2023-08-07  9:12   ` Miquel Raynal
  2023-08-07 16:52     ` Sam Ravnborg
  1 sibling, 1 reply; 8+ messages in thread
From: Miquel Raynal @ 2023-08-07  9:12 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Alexandre Belloni, Thomas Petazzoni, Boris Brezillon, dri-devel,
	Daniel Vetter, David Airlie, Claudiu Beznea, linux-arm-kernel

Hi Sam,

sam@ravnborg.org wrote on Sat, 10 Jun 2023 22:05:15 +0200:

> On Fri, Jun 09, 2023 at 04:48:43PM +0200, Miquel Raynal wrote:
> > On the SoC host controller, the pixel clock can be:
> > * standard: data is launched on the rising edge
> > * inverted: data is launched on the falling edge
> > 
> > Some panels may need the inverted option to be used so let's support
> > this DRM flag.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>  
> 
> Hi Miquel,
> 
> the patch is:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
> I hope someone else can pick it up and apply it to drm-misc as
> my drm-misc setup is hopelessly outdated atm.

I haven't been noticed this patch was picked-up, is your tree still
outdated or can you take care of it?

Thanks a lot,
Miquèl

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm: atmel-hlcdc: Support inverting the pixel clock polarity
  2023-08-07  9:12   ` Miquel Raynal
@ 2023-08-07 16:52     ` Sam Ravnborg
  2023-08-08  6:33       ` Miquel Raynal
  0 siblings, 1 reply; 8+ messages in thread
From: Sam Ravnborg @ 2023-08-07 16:52 UTC (permalink / raw)
  To: Miquel Raynal, rfoss, Neil Armstrong, Douglas Anderson
  Cc: Alexandre Belloni, Thomas Petazzoni, Boris Brezillon, dri-devel,
	Daniel Vetter, David Airlie, Claudiu Beznea, linux-arm-kernel

Hi Miquel,

On Mon, Aug 07, 2023 at 11:12:46AM +0200, Miquel Raynal wrote:
> Hi Sam,
> 
> sam@ravnborg.org wrote on Sat, 10 Jun 2023 22:05:15 +0200:
> 
> > On Fri, Jun 09, 2023 at 04:48:43PM +0200, Miquel Raynal wrote:
> > > On the SoC host controller, the pixel clock can be:
> > > * standard: data is launched on the rising edge
> > > * inverted: data is launched on the falling edge
> > > 
> > > Some panels may need the inverted option to be used so let's support
> > > this DRM flag.
> > > 
> > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>  
> > 
> > Hi Miquel,
> > 
> > the patch is:
> > Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> > 
> > I hope someone else can pick it up and apply it to drm-misc as
> > my drm-misc setup is hopelessly outdated atm.
> 
> I haven't been noticed this patch was picked-up, is your tree still
> outdated or can you take care of it?

I am still hopelessly behind on stuff.
I copied a few people on this mail that I hope can help.

Link to the original patch:
https://lore.kernel.org/dri-devel/20230609144843.851327-1-miquel.raynal@bootlin.com/

	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm: atmel-hlcdc: Support inverting the pixel clock polarity
  2023-08-07 16:52     ` Sam Ravnborg
@ 2023-08-08  6:33       ` Miquel Raynal
  2023-08-10  6:45         ` Boris Brezillon
  0 siblings, 1 reply; 8+ messages in thread
From: Miquel Raynal @ 2023-08-08  6:33 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, Alexandre Belloni, rfoss, Thomas Petazzoni,
	Boris Brezillon, Douglas Anderson, dri-devel, Daniel Vetter,
	David Airlie, Claudiu Beznea, linux-arm-kernel

Hi Sam,

sam@ravnborg.org wrote on Mon, 7 Aug 2023 18:52:45 +0200:

> Hi Miquel,
> 
> On Mon, Aug 07, 2023 at 11:12:46AM +0200, Miquel Raynal wrote:
> > Hi Sam,
> > 
> > sam@ravnborg.org wrote on Sat, 10 Jun 2023 22:05:15 +0200:
> >   
> > > On Fri, Jun 09, 2023 at 04:48:43PM +0200, Miquel Raynal wrote:  
> > > > On the SoC host controller, the pixel clock can be:
> > > > * standard: data is launched on the rising edge
> > > > * inverted: data is launched on the falling edge
> > > > 
> > > > Some panels may need the inverted option to be used so let's support
> > > > this DRM flag.
> > > > 
> > > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>    
> > > 
> > > Hi Miquel,
> > > 
> > > the patch is:
> > > Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> > > 
> > > I hope someone else can pick it up and apply it to drm-misc as
> > > my drm-misc setup is hopelessly outdated atm.  
> > 
> > I haven't been noticed this patch was picked-up, is your tree still
> > outdated or can you take care of it?  
> 
> I am still hopelessly behind on stuff.

No problem.

> I copied a few people on this mail that I hope can help.

Nice, thanks a lot!

> Link to the original patch:
> https://lore.kernel.org/dri-devel/20230609144843.851327-1-miquel.raynal@bootlin.com/
> 
> 	Sam

Let me know in case it's easier if I re-send it.

Thanks,
Miquèl

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm: atmel-hlcdc: Support inverting the pixel clock polarity
  2023-08-08  6:33       ` Miquel Raynal
@ 2023-08-10  6:45         ` Boris Brezillon
  2023-08-10 17:31           ` Sam Ravnborg
  0 siblings, 1 reply; 8+ messages in thread
From: Boris Brezillon @ 2023-08-10  6:45 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Neil Armstrong, Alexandre Belloni, rfoss, Thomas Petazzoni,
	Boris Brezillon, Sam Ravnborg, Douglas Anderson, dri-devel,
	Daniel Vetter, David Airlie, Claudiu Beznea, linux-arm-kernel

On Tue, 8 Aug 2023 08:33:38 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Hi Sam,
> 
> sam@ravnborg.org wrote on Mon, 7 Aug 2023 18:52:45 +0200:
> 
> > Hi Miquel,
> > 
> > On Mon, Aug 07, 2023 at 11:12:46AM +0200, Miquel Raynal wrote:  
> > > Hi Sam,
> > > 
> > > sam@ravnborg.org wrote on Sat, 10 Jun 2023 22:05:15 +0200:
> > >     
> > > > On Fri, Jun 09, 2023 at 04:48:43PM +0200, Miquel Raynal wrote:    
> > > > > On the SoC host controller, the pixel clock can be:
> > > > > * standard: data is launched on the rising edge
> > > > > * inverted: data is launched on the falling edge
> > > > > 
> > > > > Some panels may need the inverted option to be used so let's support
> > > > > this DRM flag.
> > > > > 
> > > > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>      
> > > > 
> > > > Hi Miquel,
> > > > 
> > > > the patch is:
> > > > Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> > > > 
> > > > I hope someone else can pick it up and apply it to drm-misc as
> > > > my drm-misc setup is hopelessly outdated atm.    
> > > 
> > > I haven't been noticed this patch was picked-up, is your tree still
> > > outdated or can you take care of it?    
> > 
> > I am still hopelessly behind on stuff.  
> 
> No problem.

I queued it to drm-misc-next this morning.

Regards,

Boris

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm: atmel-hlcdc: Support inverting the pixel clock polarity
  2023-08-10  6:45         ` Boris Brezillon
@ 2023-08-10 17:31           ` Sam Ravnborg
  2023-08-11  5:53             ` Miquel Raynal
  0 siblings, 1 reply; 8+ messages in thread
From: Sam Ravnborg @ 2023-08-10 17:31 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Neil Armstrong, Alexandre Belloni, rfoss, Thomas Petazzoni,
	Boris Brezillon, Douglas Anderson, dri-devel, Daniel Vetter,
	Miquel Raynal, David Airlie, Claudiu Beznea, linux-arm-kernel

> I queued it to drm-misc-next this morning.

Thanks Boris!

	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm: atmel-hlcdc: Support inverting the pixel clock polarity
  2023-08-10 17:31           ` Sam Ravnborg
@ 2023-08-11  5:53             ` Miquel Raynal
  0 siblings, 0 replies; 8+ messages in thread
From: Miquel Raynal @ 2023-08-11  5:53 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, Alexandre Belloni, rfoss, Thomas Petazzoni,
	Boris Brezillon, Douglas Anderson, dri-devel, Boris Brezillon,
	Daniel Vetter, David Airlie, Claudiu Beznea, linux-arm-kernel

Hi Boris,

sam@ravnborg.org wrote on Thu, 10 Aug 2023 19:31:25 +0200:

> > I queued it to drm-misc-next this morning.  

Yeah, thanks a lot!

Cheers,
Miquèl

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-08-11  5:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-09 14:48 [PATCH] drm: atmel-hlcdc: Support inverting the pixel clock polarity Miquel Raynal
     [not found] ` <20230610200515.GA1041001@ravnborg.org>
2023-07-12 15:57   ` Miquel Raynal
2023-08-07  9:12   ` Miquel Raynal
2023-08-07 16:52     ` Sam Ravnborg
2023-08-08  6:33       ` Miquel Raynal
2023-08-10  6:45         ` Boris Brezillon
2023-08-10 17:31           ` Sam Ravnborg
2023-08-11  5:53             ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).