diff mbox

[PATCHv16,0/7] of: add display helper

Message ID 201301092012.01985.marex@denx.de (mailing list archive)
State New, archived
Headers show

Commit Message

Marek Vasut Jan. 9, 2013, 7:12 p.m. UTC
Dear Steffen Trumtrar,

> Hi!
> 
> Finally, right in time before the end of the world on friday, v16 of the
> display helpers.

I tested this on 3.8-rc1 (next 20130103) with the imx drm driver. After adding 
the following piece of code (quick hack), this works just fine. Thanks!

        if (imxpd->edid) {
@@ -72,6 +73,15 @@ static int imx_pd_connector_get_modes(struct drm_connector 
*connector)
                num_modes++;
        }
 
+       if (np) {
+               struct drm_display_mode *mode = drm_mode_create(connector->dev);
+               of_get_drm_display_mode(np, &imxpd->mode, 0);
+               drm_mode_copy(mode, &imxpd->mode);
+               mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
+               drm_mode_probed_add(connector, mode);
+               num_modes++;
+       }
+
        return num_modes;
 }

Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Steffen Trumtrar Jan. 9, 2013, 7:39 p.m. UTC | #1
Hi!

On Wed, Jan 09, 2013 at 08:12:01PM +0100, Marek Vasut wrote:
> Dear Steffen Trumtrar,
> 
> I tested this on 3.8-rc1 (next 20130103) with the imx drm driver. After adding 
> the following piece of code (quick hack), this works just fine. Thanks!
> 
> diff --git a/drivers/staging/imx-drm/parallel-display.c b/drivers/staging/imx-
> drm/parallel-display.c
> index a8064fc..e45002a 100644
> --- a/drivers/staging/imx-drm/parallel-display.c
> +++ b/drivers/staging/imx-drm/parallel-display.c
> @@ -57,6 +57,7 @@ static void imx_pd_connector_destroy(struct drm_connector 
> *connector)
>  static int imx_pd_connector_get_modes(struct drm_connector *connector)
>  {
>         struct imx_parallel_display *imxpd = con_to_imxpd(connector);
> +       struct device_node *np = imxpd->dev->of_node;
>         int num_modes = 0;
>  
>         if (imxpd->edid) {
> @@ -72,6 +73,15 @@ static int imx_pd_connector_get_modes(struct drm_connector 
> *connector)
>                 num_modes++;
>         }
>  
> +       if (np) {
> +               struct drm_display_mode *mode = drm_mode_create(connector->dev);
> +               of_get_drm_display_mode(np, &imxpd->mode, 0);
> +               drm_mode_copy(mode, &imxpd->mode);
> +               mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
> +               drm_mode_probed_add(connector, mode);
> +               num_modes++;
> +       }
> +
>         return num_modes;
>  }
> 

Nice! I haven't tried the parallel display, but I think Philipp Zabel might
already have a patch for it. If not, I will definitly keep your patch in my
topic branch.

Regards,
Steffen
Marek Vasut Jan. 9, 2013, 7:56 p.m. UTC | #2
Dear Steffen Trumtrar,

> Hi!
> 
> On Wed, Jan 09, 2013 at 08:12:01PM +0100, Marek Vasut wrote:
> > Dear Steffen Trumtrar,
> > 
> > I tested this on 3.8-rc1 (next 20130103) with the imx drm driver. After
> > adding the following piece of code (quick hack), this works just fine.
> > Thanks!
> > 
> > diff --git a/drivers/staging/imx-drm/parallel-display.c
> > b/drivers/staging/imx- drm/parallel-display.c
> > index a8064fc..e45002a 100644
> > --- a/drivers/staging/imx-drm/parallel-display.c
> > +++ b/drivers/staging/imx-drm/parallel-display.c
> > @@ -57,6 +57,7 @@ static void imx_pd_connector_destroy(struct
> > drm_connector *connector)
> > 
> >  static int imx_pd_connector_get_modes(struct drm_connector *connector)
> >  {
> >  
> >         struct imx_parallel_display *imxpd = con_to_imxpd(connector);
> > 
> > +       struct device_node *np = imxpd->dev->of_node;
> > 
> >         int num_modes = 0;
> >         
> >         if (imxpd->edid) {
> > 
> > @@ -72,6 +73,15 @@ static int imx_pd_connector_get_modes(struct
> > drm_connector *connector)
> > 
> >                 num_modes++;
> >         
> >         }
> > 
> > +       if (np) {
> > +               struct drm_display_mode *mode =
> > drm_mode_create(connector->dev); +              
> > of_get_drm_display_mode(np, &imxpd->mode, 0);
> > +               drm_mode_copy(mode, &imxpd->mode);
> > +               mode->type |= DRM_MODE_TYPE_DRIVER |
> > DRM_MODE_TYPE_PREFERRED, +               drm_mode_probed_add(connector,
> > mode);
> > +               num_modes++;
> > +       }
> > +
> > 
> >         return num_modes;
> >  
> >  }
> 
> Nice! I haven't tried the parallel display, but I think Philipp Zabel might
> already have a patch for it. If not, I will definitly keep your patch in my
> topic branch.

Works like charm here.

Make sure to adjust the patch and check for the return value of 
of_get_drm_display_mode(np, &imxpd->mode, 0); call, that's probably the only 
issue that needs fixing in that hack. Checking if np != NULL might not hurt 
either. I can roll you a real patch if it helps.

Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/staging/imx-drm/parallel-display.c b/drivers/staging/imx-
drm/parallel-display.c
index a8064fc..e45002a 100644
--- a/drivers/staging/imx-drm/parallel-display.c
+++ b/drivers/staging/imx-drm/parallel-display.c
@@ -57,6 +57,7 @@  static void imx_pd_connector_destroy(struct drm_connector 
*connector)
 static int imx_pd_connector_get_modes(struct drm_connector *connector)
 {
        struct imx_parallel_display *imxpd = con_to_imxpd(connector);
+       struct device_node *np = imxpd->dev->of_node;
        int num_modes = 0;