mbox series

[v2,0/7] BL035-RGB-002 3.5" LCD sunxi DRM support

Message ID 20181101200045.6078-1-contact@paulk.fr
Headers show
Series BL035-RGB-002 3.5" LCD sunxi DRM support | expand

Message

Paul Kocialkowski Nov. 1, 2018, 8 p.m. UTC
The series adds support for the BL035-RGB-002 LCD panel and the required
device-tree bindings for using it on the BananaPi M1.

Only the changes related to the DRM driver and the panel are submitted
for merge, which does not include the two final commits.

Changes since v1:
* Used the full name of the panel for dt bindings;
* Removed helper to match flags in order to only retrieve the connector
  once, as it was already done.
* Made the bus flags checking possible without a panel;

Paul Kocialkowski (7):
  drm/sun4i: tcon: Pass encoder instead of using panel for RGB setup
  drm/sun4i: tcon: Support an active-low DE signal with RGB interface
  dt-bindings: Add vendor prefix for LeMaker
  dt-bindings: Add bindings for the LeMaker BL035-RGB-002 LCD panel
  drm/panel: simple: Add support for the LeMaker BL035-RGB-002 3.5" LCD
  ARM: dts: sun7i: Add pinmux configuration for LCD0 RGB888 pins
  ARM: dts: sun7i-a20-bananapi: Add bindings for the LeMaker 3.5" LCD

 .../display/panel/lemaker,bl035-rgb-002.txt   |  7 ++
 .../devicetree/bindings/vendor-prefixes.txt   |  1 +
 arch/arm/boot/dts/sun7i-a20-bananapi.dts      | 89 +++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20.dtsi              | 11 +++
 drivers/gpu/drm/panel/panel-simple.c          | 27 ++++++
 drivers/gpu/drm/sun4i/sun4i_tcon.c            | 29 +++---
 drivers/gpu/drm/sun4i/sun4i_tcon.h            |  1 +
 7 files changed, 151 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/panel/lemaker,bl035-rgb-002.txt

Comments

Paul Kocialkowski Nov. 1, 2018, 8:33 p.m. UTC | #1
Hi,

Le jeudi 01 novembre 2018 à 21:00 +0100, Paul Kocialkowski a écrit :
> The series adds support for the BL035-RGB-002 LCD panel and the required
> device-tree bindings for using it on the BananaPi M1.
> 
> Only the changes related to the DRM driver and the panel are submitted
> for merge, which does not include the two final commits.
> 
> Changes since v1:
> * Used the full name of the panel for dt bindings;
> * Removed helper to match flags in order to only retrieve the connector
>   once, as it was already done.
> * Made the bus flags checking possible without a panel;

I forgot to mention that the last patch (not for merge) was untested.

> Paul Kocialkowski (7):
>   drm/sun4i: tcon: Pass encoder instead of using panel for RGB setup
>   drm/sun4i: tcon: Support an active-low DE signal with RGB interface
>   dt-bindings: Add vendor prefix for LeMaker
>   dt-bindings: Add bindings for the LeMaker BL035-RGB-002 LCD panel
>   drm/panel: simple: Add support for the LeMaker BL035-RGB-002 3.5" LCD
>   ARM: dts: sun7i: Add pinmux configuration for LCD0 RGB888 pins
>   ARM: dts: sun7i-a20-bananapi: Add bindings for the LeMaker 3.5" LCD
> 
>  .../display/panel/lemaker,bl035-rgb-002.txt   |  7 ++
>  .../devicetree/bindings/vendor-prefixes.txt   |  1 +
>  arch/arm/boot/dts/sun7i-a20-bananapi.dts      | 89 +++++++++++++++++++
>  arch/arm/boot/dts/sun7i-a20.dtsi              | 11 +++
>  drivers/gpu/drm/panel/panel-simple.c          | 27 ++++++
>  drivers/gpu/drm/sun4i/sun4i_tcon.c            | 29 +++---
>  drivers/gpu/drm/sun4i/sun4i_tcon.h            |  1 +
>  7 files changed, 151 insertions(+), 14 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/display/panel/lemaker,bl035-rgb-002.txt
>
Maxime Ripard Nov. 5, 2018, 8:59 a.m. UTC | #2
Hi,

On Thu, Nov 01, 2018 at 09:00:39PM +0100, Paul Kocialkowski wrote:
> Features such as dithering and pixel data edge configuration currently
> rely on the panel registered with the TCON driver. However, bridges are
> also supported in addition panels.
> 
> Instead of retrieving the connector from the panel, pass the encoder
> from the calling function, as is done for other interfaces.
> 
> The connector is then retrieved from the encoder with the dedicated
> helper. Even in the case of bridges, the connector is registered with
> the encoder from our driver and is accessible when iterating connectors.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> ---
>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 22 +++++++++-------------
>  1 file changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> index f949287d926c..262ffb6b0f82 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -478,8 +478,11 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
>  }
>  
>  static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
> +				     const struct drm_encoder *encoder,
>  				     const struct drm_display_mode *mode)
>  {
> +	struct drm_connector *connector = sun4i_tcon_get_connector(encoder);
> +	struct drm_display_info display_info = connector->display_info;
>  	unsigned int bp, hsync, vsync;
>  	u8 clk_delay;
>  	u32 val = 0;
> @@ -491,8 +494,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
>  	sun4i_tcon0_mode_set_common(tcon, mode);
>  
>  	/* Set dithering if needed */
> -	if (tcon->panel)
> -		sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);
> +	sun4i_tcon0_mode_set_dithering(tcon, connector);
>  
>  	/* Adjust clock delay */
>  	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
> @@ -556,17 +558,11 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
>  	 * Following code is a way to avoid quirks all around TCON
>  	 * and DOTCLOCK drivers.
>  	 */
> -	if (tcon->panel) {
> -		struct drm_panel *panel = tcon->panel;
> -		struct drm_connector *connector = panel->connector;
> -		struct drm_display_info display_info = connector->display_info;
> -
> -		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
> -			clk_set_phase(tcon->dclk, 240);
> +	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
> +		clk_set_phase(tcon->dclk, 240);
>  
> -		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
> -			clk_set_phase(tcon->dclk, 0);
> -	}
> +	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
> +		clk_set_phase(tcon->dclk, 0);

You're doing multiple things here: you're changing the function API,
and then moving the display info checks outside of the tcon->panel
condition.

You should do two separate patches for that.

Maxime
Paul Kocialkowski Nov. 5, 2018, 10:21 a.m. UTC | #3
Hi,

Le lundi 05 novembre 2018 à 09:59 +0100, Maxime Ripard a écrit :
> Hi,
> 
> On Thu, Nov 01, 2018 at 09:00:39PM +0100, Paul Kocialkowski wrote:
> > Features such as dithering and pixel data edge configuration currently
> > rely on the panel registered with the TCON driver. However, bridges are
> > also supported in addition panels.
> > 
> > Instead of retrieving the connector from the panel, pass the encoder
> > from the calling function, as is done for other interfaces.
> > 
> > The connector is then retrieved from the encoder with the dedicated
> > helper. Even in the case of bridges, the connector is registered with
> > the encoder from our driver and is accessible when iterating connectors.
> > 
> > Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> > ---
> >  drivers/gpu/drm/sun4i/sun4i_tcon.c | 22 +++++++++-------------
> >  1 file changed, 9 insertions(+), 13 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > index f949287d926c..262ffb6b0f82 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > @@ -478,8 +478,11 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
> >  }
> >  
> >  static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
> > +				     const struct drm_encoder *encoder,
> >  				     const struct drm_display_mode *mode)
> >  {
> > +	struct drm_connector *connector = sun4i_tcon_get_connector(encoder);
> > +	struct drm_display_info display_info = connector->display_info;
> >  	unsigned int bp, hsync, vsync;
> >  	u8 clk_delay;
> >  	u32 val = 0;
> > @@ -491,8 +494,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
> >  	sun4i_tcon0_mode_set_common(tcon, mode);
> >  
> >  	/* Set dithering if needed */
> > -	if (tcon->panel)
> > -		sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);
> > +	sun4i_tcon0_mode_set_dithering(tcon, connector);
> >  
> >  	/* Adjust clock delay */
> >  	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
> > @@ -556,17 +558,11 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
> >  	 * Following code is a way to avoid quirks all around TCON
> >  	 * and DOTCLOCK drivers.
> >  	 */
> > -	if (tcon->panel) {
> > -		struct drm_panel *panel = tcon->panel;
> > -		struct drm_connector *connector = panel->connector;
> > -		struct drm_display_info display_info = connector->display_info;
> > -
> > -		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
> > -			clk_set_phase(tcon->dclk, 240);
> > +	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
> > +		clk_set_phase(tcon->dclk, 240);
> >  
> > -		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
> > -			clk_set_phase(tcon->dclk, 0);
> > -	}
> > +	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
> > +		clk_set_phase(tcon->dclk, 0);
> 
> You're doing multiple things here: you're changing the function API,
> and then moving the display info checks outside of the tcon->panel
> condition.
> 
> You should do two separate patches for that.

Thanks, I'll do that in the next revision then.

Cheers,

Paul