linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* DRM Driver implementation question
@ 2019-09-16 13:55 Gareth Williams
  2019-09-17  4:38 ` Yoshihiro Shimoda
  0 siblings, 1 reply; 5+ messages in thread
From: Gareth Williams @ 2019-09-16 13:55 UTC (permalink / raw)
  To: laurent.pinchart, kieran.bingham+renesas
  Cc: dri-devel, linux-kernel, linux-renesas-soc, Geert Uytterhoeven,
	Phil Edworthy, Fabrizio Castro

Hi Laurent/Kieran,

I need to upstream a driver for a display controller that within its registers memory region contains registers related to a PWM device. The PWM device is for controlling the backlight of the display.
Ideally, I would like to create a separated driver for the PWM, so that I can re-use "pwm-backlight", but since the registers for the PWM are right in the middle of the registers for the display controller I would need to ioremap the memory region for the PWM registers region twice, once from the display controller driver, and once from the PWM driver.
Do you think that the double ioremap would be acceptable upstream?

Kind Regards,

Gareth	

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

* RE: DRM Driver implementation question
  2019-09-16 13:55 DRM Driver implementation question Gareth Williams
@ 2019-09-17  4:38 ` Yoshihiro Shimoda
  2019-09-17 15:27   ` Gareth Williams
  0 siblings, 1 reply; 5+ messages in thread
From: Yoshihiro Shimoda @ 2019-09-17  4:38 UTC (permalink / raw)
  To: Gareth Williams
  Cc: dri-devel, linux-kernel, linux-renesas-soc, Geert Uytterhoeven,
	Phil Edworthy, Fabrizio Castro, laurent.pinchart,
	kieran.bingham+renesas

Hi Gareth,

> From: Gareth Williams, Sent: Monday, September 16, 2019 10:56 PM
> 
> Hi Laurent/Kieran,
> 
> I need to upstream a driver for a display controller that within its registers memory region contains registers related
> to a PWM device. The PWM device is for controlling the backlight of the display.
> Ideally, I would like to create a separated driver for the PWM, so that I can re-use "pwm-backlight", but since the registers
> for the PWM are right in the middle of the registers for the display controller I would need to ioremap the memory region
> for the PWM registers region twice, once from the display controller driver, and once from the PWM driver.
> Do you think that the double ioremap would be acceptable upstream?

I think that an MFD driver can support such hardware. I checked Documentation/devicetree/bindings/mfd roughly,
and then atmel-hlcdc.txt seems to have a display controller and a PWM device.

Best regards,
Yoshihiro Shimoda


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

* RE: DRM Driver implementation question
  2019-09-17  4:38 ` Yoshihiro Shimoda
@ 2019-09-17 15:27   ` Gareth Williams
  2019-09-18 13:03     ` Laurent Pinchart
  0 siblings, 1 reply; 5+ messages in thread
From: Gareth Williams @ 2019-09-17 15:27 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: dri-devel, linux-kernel, linux-renesas-soc, Geert Uytterhoeven,
	Phil Edworthy, Fabrizio Castro, laurent.pinchart,
	kieran.bingham+renesas

Hi Yoshihiro,

This looks like an elegant solution that I can implement.
Many thanks for pointing me in a good direction.

> From: Yoshihiro Shimoda, Sent: Tuesday, September 17, 2019 05:39 PM
> 
> Hi Gareth,
> 
> > From: Gareth Williams, Sent: Monday, September 16, 2019 10:56 PM
> >
> > Hi Laurent/Kieran,
> >
> > I need to upstream a driver for a display controller that within its
> > registers memory region contains registers related to a PWM device. The
> PWM device is for controlling the backlight of the display.
> > Ideally, I would like to create a separated driver for the PWM, so
> > that I can re-use "pwm-backlight", but since the registers for the PWM
> > are right in the middle of the registers for the display controller I would
> need to ioremap the memory region for the PWM registers region twice,
> once from the display controller driver, and once from the PWM driver.
> > Do you think that the double ioremap would be acceptable upstream?
> 
> I think that an MFD driver can support such hardware. I checked
> Documentation/devicetree/bindings/mfd roughly, and then atmel-hlcdc.txt
> seems to have a display controller and a PWM device.
> 
> Best regards,
> Yoshihiro Shimoda

Best Regards,

Gareth Williams

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

* Re: DRM Driver implementation question
  2019-09-17 15:27   ` Gareth Williams
@ 2019-09-18 13:03     ` Laurent Pinchart
  2019-09-18 14:34       ` Gareth Williams
  0 siblings, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2019-09-18 13:03 UTC (permalink / raw)
  To: Gareth Williams
  Cc: Yoshihiro Shimoda, dri-devel, linux-kernel, linux-renesas-soc,
	Geert Uytterhoeven, Phil Edworthy, Fabrizio Castro,
	kieran.bingham+renesas

Hi Gareth,

Sorry for the delayed response, I was travelling for the Linux Plumbers
Conference followed by a code camp.

On Tue, Sep 17, 2019 at 03:27:34PM +0000, Gareth Williams wrote:
> Hi Yoshihiro,
> 
> This looks like an elegant solution that I can implement.
> Many thanks for pointing me in a good direction.
> 
> > From: Yoshihiro Shimoda, Sent: Tuesday, September 17, 2019 05:39 PM
> > 
> > Hi Gareth,
> > 
> > > From: Gareth Williams, Sent: Monday, September 16, 2019 10:56 PM
> > >
> > > Hi Laurent/Kieran,
> > >
> > > I need to upstream a driver for a display controller that within its
> > > registers memory region contains registers related to a PWM
> > > device. The PWM device is for controlling the backlight of the
> > > display.
> > >
> > > Ideally, I would like to create a separated driver for the PWM, so
> > > that I can re-use "pwm-backlight", but since the registers for the PWM
> > > are right in the middle of the registers for the display
> > > controller I would need to ioremap the memory region for the PWM
> > > registers region twice, once from the display controller driver,
> > > and once from the PWM driver.
> > >
> > > Do you think that the double ioremap would be acceptable upstream?
> > 
> > I think that an MFD driver can support such hardware. I checked
> > Documentation/devicetree/bindings/mfd roughly, and then atmel-hlcdc.txt
> > seems to have a display controller and a PWM device.

While MFD should technically work, I think it's quite overkill. You
could instead bundle both the display controller and the PWM controller
in the same driver. The driver would create both a DRM/KMS device and a
PWM device. The DT node for your device would contain a #pwm-cells
property and could thus be referenced as a PWM controller by the
backlight using the pwms property.

-- 
Regards,

Laurent Pinchart

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

* RE: DRM Driver implementation question
  2019-09-18 13:03     ` Laurent Pinchart
@ 2019-09-18 14:34       ` Gareth Williams
  0 siblings, 0 replies; 5+ messages in thread
From: Gareth Williams @ 2019-09-18 14:34 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Yoshihiro Shimoda, dri-devel, linux-kernel, linux-renesas-soc,
	Geert Uytterhoeven, Phil Edworthy, Fabrizio Castro,
	kieran.bingham+renesas

Hi Laurent,

On Wed, Sep 18, 2019 at 04:04:34PM +0000, Laurent Pinchart wrote:
> 
> Hi Gareth,
> 
> Sorry for the delayed response, I was travelling for the Linux 
> Plumbers Conference followed by a code camp.
> 
> On Tue, Sep 17, 2019 at 03:27:34PM +0000, Gareth Williams wrote:
> > Hi Yoshihiro,
> >
> > This looks like an elegant solution that I can implement.
> > Many thanks for pointing me in a good direction.
> >
> > > From: Yoshihiro Shimoda, Sent: Tuesday, September 17, 2019 05:39 
> > > PM
> > >
> > > Hi Gareth,
> > >
> > > > From: Gareth Williams, Sent: Monday, September 16, 2019 10:56 PM
> > > >
> > > > Hi Laurent/Kieran,
> > > >
> > > > I need to upstream a driver for a display controller that within 
> > > > its registers memory region contains registers related to a PWM 
> > > > device. The PWM device is for controlling the backlight of the 
> > > > display.
> > > >
> > > > Ideally, I would like to create a separated driver for the PWM, 
> > > > so that I can re-use "pwm-backlight", but since the registers 
> > > > for the PWM are right in the middle of the registers for the 
> > > > display controller I would need to ioremap the memory region for 
> > > > the PWM registers region twice, once from the display controller 
> > > > driver, and once from the PWM driver.
> > > >
> > > > Do you think that the double ioremap would be acceptable upstream?
> > >
> > > I think that an MFD driver can support such hardware. I checked 
> > > Documentation/devicetree/bindings/mfd roughly, and then 
> > > atmel-hlcdc.txt seems to have a display controller and a PWM device.
> 
> While MFD should technically work, I think it's quite overkill. You 
> could instead bundle both the display controller and the PWM 
> controller in the same driver. The driver would create both a DRM/KMS 
> device and a PWM device. The DT node for your device would contain a 
> #pwm-cells property and could thus be referenced as a PWM controller 
> by the backlight using the pwms property.
This makes sense, many thanks for pointing me in the direction.

> 
> --
> Regards,
> 
> Laurent Pinchart

Kind Regards,

Gareth Williams

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

end of thread, other threads:[~2019-09-18 14:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-16 13:55 DRM Driver implementation question Gareth Williams
2019-09-17  4:38 ` Yoshihiro Shimoda
2019-09-17 15:27   ` Gareth Williams
2019-09-18 13:03     ` Laurent Pinchart
2019-09-18 14:34       ` Gareth Williams

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).