diff mbox series

[V3,2/2] drm/panel: nv3051d: Add Support for Anbernic 351V

Message ID 20231002193016.139452-3-macroalpha82@gmail.com (mailing list archive)
State New, archived
Headers show
Series Support Anbernic RG351V Panel | expand

Commit Message

Chris Morgan Oct. 2, 2023, 7:30 p.m. UTC
From: Chris Morgan <macromorgan@hotmail.com>

Add support for the Anbernic 351V. Just like the 353 series the
underlying vendor is unknown/unmarked (at least not visible in a
non-destructive manner). The panel had slightly different init
sequences and timings in the BSP kernel, but works fine with the
same ones used in the existing driver. The panel will not work without
the inclusion of the MIPI_DSI_CLOCK_NON_CONTINUOUS flag, and this flag
prevents the 353 series from working correctly, so a new compatible
string is added.

Tested colors and timings using modetest and all seem to work identical
to the 353 otherwise.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
 drivers/gpu/drm/panel/panel-newvision-nv3051d.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Jessica Zhang Oct. 2, 2023, 8:33 p.m. UTC | #1
On 10/2/2023 12:30 PM, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> Add support for the Anbernic 351V. Just like the 353 series the
> underlying vendor is unknown/unmarked (at least not visible in a
> non-destructive manner). The panel had slightly different init
> sequences and timings in the BSP kernel, but works fine with the
> same ones used in the existing driver. The panel will not work without
> the inclusion of the MIPI_DSI_CLOCK_NON_CONTINUOUS flag, and this flag
> prevents the 353 series from working correctly, so a new compatible
> string is added.
> 
> Tested colors and timings using modetest and all seem to work identical
> to the 353 otherwise.
> 
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> ---
>   drivers/gpu/drm/panel/panel-newvision-nv3051d.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
> index ad98dd9322b4..f644dbc8ee8a 100644
> --- a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
> +++ b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
> @@ -354,6 +354,7 @@ static const struct drm_panel_funcs panel_nv3051d_funcs = {
>   static int panel_nv3051d_probe(struct mipi_dsi_device *dsi)
>   {
>   	struct device *dev = &dsi->dev;
> +	struct device_node *np = dev->of_node;

Hi Chris,

Thanks for the patch.

It mostly looks good to me, but just one question here -- why not pass 
in `dev->of_node` directly into `of_device_is_compatible()`?

Thanks,

Jessica Zhang

>   	struct panel_nv3051d *ctx;
>   	int ret;
>   
> @@ -388,6 +389,13 @@ static int panel_nv3051d_probe(struct mipi_dsi_device *dsi)
>   	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
>   			  MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET;
>   
> +	/*
> +	 * The panel in the RG351V is identical to the 353P, except it
> +	 * requires MIPI_DSI_CLOCK_NON_CONTINUOUS to operate correctly.
> +	 */
> +	if (of_device_is_compatible(np, "anbernic,rg351v-panel"))
> +		dsi->mode_flags |= MIPI_DSI_CLOCK_NON_CONTINUOUS; > +
>   	drm_panel_init(&ctx->panel, &dsi->dev, &panel_nv3051d_funcs,
>   		       DRM_MODE_CONNECTOR_DSI);
>   
> -- 
> 2.34.1
>
Chris Morgan Oct. 2, 2023, 11:27 p.m. UTC | #2
On Mon, Oct 02, 2023 at 01:33:03PM -0700, Jessica Zhang wrote:
> 
> 
> On 10/2/2023 12:30 PM, Chris Morgan wrote:
> > From: Chris Morgan <macromorgan@hotmail.com>
> > 
> > Add support for the Anbernic 351V. Just like the 353 series the
> > underlying vendor is unknown/unmarked (at least not visible in a
> > non-destructive manner). The panel had slightly different init
> > sequences and timings in the BSP kernel, but works fine with the
> > same ones used in the existing driver. The panel will not work without
> > the inclusion of the MIPI_DSI_CLOCK_NON_CONTINUOUS flag, and this flag
> > prevents the 353 series from working correctly, so a new compatible
> > string is added.
> > 
> > Tested colors and timings using modetest and all seem to work identical
> > to the 353 otherwise.
> > 
> > Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> > ---
> >   drivers/gpu/drm/panel/panel-newvision-nv3051d.c | 8 ++++++++
> >   1 file changed, 8 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
> > index ad98dd9322b4..f644dbc8ee8a 100644
> > --- a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
> > +++ b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
> > @@ -354,6 +354,7 @@ static const struct drm_panel_funcs panel_nv3051d_funcs = {
> >   static int panel_nv3051d_probe(struct mipi_dsi_device *dsi)
> >   {
> >   	struct device *dev = &dsi->dev;
> > +	struct device_node *np = dev->of_node;
> 
> Hi Chris,
> 
> Thanks for the patch.
> 
> It mostly looks good to me, but just one question here -- why not pass in
> `dev->of_node` directly into `of_device_is_compatible()`?

It was an oversight on my part. I'll modify and resend, sorry about that.

Thank you.

> 
> Thanks,
> 
> Jessica Zhang
> 
> >   	struct panel_nv3051d *ctx;
> >   	int ret;
> > @@ -388,6 +389,13 @@ static int panel_nv3051d_probe(struct mipi_dsi_device *dsi)
> >   	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
> >   			  MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET;
> > +	/*
> > +	 * The panel in the RG351V is identical to the 353P, except it
> > +	 * requires MIPI_DSI_CLOCK_NON_CONTINUOUS to operate correctly.
> > +	 */
> > +	if (of_device_is_compatible(np, "anbernic,rg351v-panel"))
> > +		dsi->mode_flags |= MIPI_DSI_CLOCK_NON_CONTINUOUS; > +
> >   	drm_panel_init(&ctx->panel, &dsi->dev, &panel_nv3051d_funcs,
> >   		       DRM_MODE_CONNECTOR_DSI);
> > -- 
> > 2.34.1
> >
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
index ad98dd9322b4..f644dbc8ee8a 100644
--- a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
+++ b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
@@ -354,6 +354,7 @@  static const struct drm_panel_funcs panel_nv3051d_funcs = {
 static int panel_nv3051d_probe(struct mipi_dsi_device *dsi)
 {
 	struct device *dev = &dsi->dev;
+	struct device_node *np = dev->of_node;
 	struct panel_nv3051d *ctx;
 	int ret;
 
@@ -388,6 +389,13 @@  static int panel_nv3051d_probe(struct mipi_dsi_device *dsi)
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
 			  MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET;
 
+	/*
+	 * The panel in the RG351V is identical to the 353P, except it
+	 * requires MIPI_DSI_CLOCK_NON_CONTINUOUS to operate correctly.
+	 */
+	if (of_device_is_compatible(np, "anbernic,rg351v-panel"))
+		dsi->mode_flags |= MIPI_DSI_CLOCK_NON_CONTINUOUS;
+
 	drm_panel_init(&ctx->panel, &dsi->dev, &panel_nv3051d_funcs,
 		       DRM_MODE_CONNECTOR_DSI);