Re: [PATCH 2/2] drm: lcdif: Add i.MX93 LCDIF support

2023-01-23 Thread Lothar Waßmann
Hi,

On Mon, 23 Jan 2023 15:23:58 +0800 Liu Ying wrote:
> The LCDIF embedded in i.MX93 SoC is essentially the same to those
> in i.MX8mp SoC.  However, i.MX93 LCDIF may connect with MIPI DSI
> controller through LCDIF cross line pattern(controlled by mediamix
> blk-ctrl) or connect with LVDS display bridge(LDB) directly or a
> parallel display(also through mediamix blk-ctrl), so add multiple
> encoders(with DRM_MODE_ENCODER_NONE encoder type) support in the
> LCDIF DRM driver and find a bridge to attach the relevant encoder's
> chain when needed.  While at it, derive lcdif_crtc_state structure
> from drm_crtc_state structure to introduce bus_format and bus_flags
> states so that the next downstream bridges may use consistent bus
> format and bus flags.
> 
> Signed-off-by: Liu Ying 
> ---
>  drivers/gpu/drm/mxsfb/lcdif_drv.c |  73 +--
>  drivers/gpu/drm/mxsfb/lcdif_drv.h |   6 +-
>  drivers/gpu/drm/mxsfb/lcdif_kms.c | 206 --
>  3 files changed, 208 insertions(+), 77 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c 
> b/drivers/gpu/drm/mxsfb/lcdif_drv.c
> index cc2ceb301b96..4d41f6b6eb14 100644
> --- a/drivers/gpu/drm/mxsfb/lcdif_drv.c
> +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c
> @@ -9,13 +9,16 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -38,21 +41,70 @@ static const struct drm_mode_config_helper_funcs 
> lcdif_mode_config_helpers = {
>   .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm,
>  };
>  
> +static const struct drm_encoder_funcs lcdif_encoder_funcs = {
> + .destroy = drm_encoder_cleanup,
> +};
> +
>  static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif)
>  {
> - struct drm_device *drm = lcdif->drm;
> + struct device *dev = lcdif->drm->dev;
> + struct device_node *ep;
>   struct drm_bridge *bridge;
>   int ret;
>  
> - bridge = devm_drm_of_get_bridge(drm->dev, drm->dev->of_node, 0, 0);
> - if (IS_ERR(bridge))
> - return PTR_ERR(bridge);
> -
> - ret = drm_bridge_attach(>encoder, bridge, NULL, 0);
> - if (ret)
> - return dev_err_probe(drm->dev, ret, "Failed to attach 
> bridge\n");
> -
> - lcdif->bridge = bridge;
> + for_each_endpoint_of_node(dev->of_node, ep) {
> + struct device_node *remote;
> + struct of_endpoint of_ep;
> + struct drm_encoder *encoder;
> +
> + remote = of_graph_get_remote_port_parent(ep);
> + if (!remote || !of_device_is_available(remote)) {
'!remote ||' is redundant, since of_device_is_available already checks
for a NULL pointer.

[...]

> diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c 
> b/drivers/gpu/drm/mxsfb/lcdif_kms.c
> index 262bc43b1079..ba36447ed900 100644
> --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c
> +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c
[...]
> @@ -529,6 +580,46 @@ static void lcdif_crtc_atomic_disable(struct drm_crtc 
> *crtc,
>   pm_runtime_put_sync(drm->dev);
>  }
>  
> +static void lcdif_crtc_reset(struct drm_crtc *crtc)
> +{
> + struct lcdif_crtc_state *state;
> +
> + if (crtc->state)
> + __drm_atomic_helper_crtc_destroy_state(crtc->state);
> +
> + kfree(to_lcdif_crtc_state(crtc->state));
>
If crtc-state can be NULL at this point, this will only work as long as
'base' is the first member of the lcdif_crtc_state struct (which
currently is the case, but there is no guarantee that this will always
be this way), otherwise the if clause above is not needed.



Lothar Waßmann


Re: [RESENT PATCH] drm/panel: support Innolux P097PFG panel

2017-12-04 Thread Lothar Waßmann
Hi,

On Thu, 30 Nov 2017 14:14:40 +0800 Lin Huang wrote:
> Support Innolux P097PFG 9.7" 1536x2048 TFT LCD panel,
> it refactor Innolux P079ZCA panel driver, let it support
> multi panel, and add support P097PFG panel in this driver.
> 
> Signed-off-by: Lin Huang <h...@rock-chips.com>
> 
> ---
>  drivers/gpu/drm/panel/panel-innolux-p079zca.c | 178 
> --
>  1 file changed, 136 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c 
> b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> index 6ba9344..a40798f 100644
> --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
[...]
> @@ -209,20 +284,39 @@ static const struct drm_panel_funcs innolux_panel_funcs 
> = {
>  };
>  
>  static const struct of_device_id innolux_of_match[] = {
> - { .compatible = "innolux,p079zca", },
> - { }
> + { .compatible = "innolux,p079zca",
> +   .data = _p079zca_panel_desc
> + },
> + { .compatible = "innolux,p097pfg",
> +   .data = _p097pfg_panel_desc
> + }
>  };
>
This hunk deletes the empty entry which is required as an end of list
marker!


Lothar Waßmann
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/bridge: Fix lvds-encoder since the panel_bridge rework.

2017-11-15 Thread Lothar Waßmann
Hi,

On Tue, 14 Nov 2017 11:16:47 -0800 Eric Anholt wrote:
> The panel_bridge bridge attaches to the panel's OF node, not the
> lvds-encoder's node.  Put in a little no-op bridge of our own so that
> our consumers can still find a bridge where they expect.
> 
> This also fixes an unintended unregistration and leak of the
> panel-bridge on module remove.
> 
> Signed-off-by: Eric Anholt <e...@anholt.net>
> Fixes: 13dfc0540a57 ("drm/bridge: Refactor out the panel wrapper from the 
> lvds-encoder bri
> dge.")
> ---
> 
> Note: I haven't actually tested this patch!  Hope it helps, though.
> 
>  drivers/gpu/drm/bridge/lvds-encoder.c | 48 
> ++-
>  1 file changed, 41 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/lvds-encoder.c 
> b/drivers/gpu/drm/bridge/lvds-encoder.c
> index 0903ba574f61..75b0d3f6e4de 100644
> --- a/drivers/gpu/drm/bridge/lvds-encoder.c
> +++ b/drivers/gpu/drm/bridge/lvds-encoder.c
> @@ -13,13 +13,37 @@
>  
>  #include 
>  
> +struct lvds_encoder {
> + struct drm_bridge bridge;
> + struct drm_bridge *panel_bridge;
> +};
> +
> +static int lvds_encoder_attach(struct drm_bridge *bridge)
> +{
> + struct lvds_encoder *lvds_encoder = container_of(bridge,
> +  struct lvds_encoder,
> +  bridge);
> +
> + return drm_bridge_attach(bridge->encoder, lvds_encoder->panel_bridge,
> +  bridge);
> +}
> +
> +static struct drm_bridge_funcs funcs = {
> + .attach = lvds_encoder_attach,
> +};
> +
>  static int lvds_encoder_probe(struct platform_device *pdev)
>  {
>   struct device_node *port;
>   struct device_node *endpoint;
>   struct device_node *panel_node;
>   struct drm_panel *panel;
> - struct drm_bridge *bridge;
> + struct lvds_encoder *lvds_encoder;
> +
> + lvds_encoder = devm_kzalloc(>dev, sizeof(*lvds_encoder),
> + GFP_KERNEL);
> + if (!lvds_encoder)
> + return -ENOMEM;
>  
>   /* Locate the panel DT node. */
>   port = of_graph_get_port_by_id(pdev->dev.of_node, 1);
> @@ -49,20 +73,30 @@ static int lvds_encoder_probe(struct platform_device 
> *pdev)
>   return -EPROBE_DEFER;
>   }
>  
> - bridge = drm_panel_bridge_add(panel, DRM_MODE_CONNECTOR_LVDS);
> - if (IS_ERR(bridge))
> - return PTR_ERR(bridge);
> + lvds_encoder->panel_bridge =
> + devm_drm_panel_bridge_add(>dev,
> +   panel, DRM_MODE_CONNECTOR_LVDS);
> + if (IS_ERR(lvds_encoder->panel_bridge))
> + return PTR_ERR(lvds_encoder->panel_bridge);
> +
> + /* The panel_bridge bridge is attached to the panel's of_node,
> +  * but we need a bridge attached to our of_node for our user
> +  * to look up.
> +  */
> + lvds_encoder->bridge.of_node = pdev->dev.of_node;
> + lvds_encoder->bridge.funcs = 
> + drm_bridge_add(_encoder->bridge);
>  
> - platform_set_drvdata(pdev, bridge);
> + platform_set_drvdata(pdev, lvds_encoder);
>  
>   return 0;
>  }
>  
>  static int lvds_encoder_remove(struct platform_device *pdev)
>  {
> - struct drm_bridge *bridge = platform_get_drvdata(pdev);
> + struct lvds_encoder *lvds_encoder = platform_get_drvdata(pdev);
>  
> - drm_bridge_remove(bridge);
> + drm_bridge_remove(_encoder->bridge);
>  
>   return 0;
>  }
>
Tested-by: Lothar Waßmann <l...@karo-electronics.de>


Lothar Waßmann
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: drivers/gpu/drm/bridge/lvds-encoder.c broken in mainline

2017-11-09 Thread Lothar Waßmann
Hi,

On Wed, 08 Nov 2017 10:18:03 -0800 Eric Anholt wrote:
> Lothar Waßmann <l...@karo-electronics.de> writes:
> 
> > Hi,
> >
> > drivers/gpu/drm/bridge/lvds-encoder.c driver is currently
> > dysfunctional due to:
> > |commit 13dfc0540a575b47b2d640b093ac16e9e09474f6
> > |Author: Eric Anholt <e...@anholt.net>
> > |Date:   Fri Jun 2 13:25:14 2017 -0700
> > |
> > |drm/bridge: Refactor out the panel wrapper from the lvds-encoder 
> > bridge.
> >
> > Also, there is no in-kernel user of this driver, so that it obviously
> > doesn't get tested in any way. There is only one dts file 
> > (r8a7779-marzen.dts)
> > that instantiates this driver, but it has an incomplete OF graph. The 
> > missing
> > link for the OF graph is provided by either r8a77xx-aa104xd12-panel.dtsi or
> > r8a77xx-aa121td01-panel.dtsi, but those files are referenced nowhere in
> > the kernel source.
> >
> > Should the driver be removed or moved to staging, until it is properly
> > fixed?
> 
> I can't see any behavior change about the DT handling in that commit,
> and I didn't intend for there to be any.  Could you help me understand
> what went wrong?
>
With the offending commit applied, the lvds-encoder driver is being
attached to the device associated with the lcd-panel driver's of_node
(panel-simple in my case) rather than the lvds-encoder's of_node.


Lothar Waßmann
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


drivers/gpu/drm/bridge/lvds-encoder.c broken in mainline

2017-11-07 Thread Lothar Waßmann
Hi,

drivers/gpu/drm/bridge/lvds-encoder.c driver is currently
dysfunctional due to:
|commit 13dfc0540a575b47b2d640b093ac16e9e09474f6
|Author: Eric Anholt <e...@anholt.net>
|Date:   Fri Jun 2 13:25:14 2017 -0700
|
|drm/bridge: Refactor out the panel wrapper from the lvds-encoder bridge.

Also, there is no in-kernel user of this driver, so that it obviously
doesn't get tested in any way. There is only one dts file (r8a7779-marzen.dts)
that instantiates this driver, but it has an incomplete OF graph. The missing
link for the OF graph is provided by either r8a77xx-aa104xd12-panel.dtsi or
r8a77xx-aa121td01-panel.dtsi, but those files are referenced nowhere in
the kernel source.

Should the driver be removed or moved to staging, until it is properly
fixed?


Lothar Waßmann
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 4/9] drm/panel: simple: add support for overriding the pixel clock polarity

2017-10-25 Thread Lothar Waßmann
Hi,

On Tue, 17 Oct 2017 14:45:04 +0200 Thierry Reding wrote:
> On Tue, Oct 17, 2017 at 02:25:07PM +0200, Lothar Waßmann wrote:
> > Hi,
> > 
> > On Tue, 17 Oct 2017 14:14:22 +0200 Thierry Reding wrote:
> > > On Wed, Oct 11, 2017 at 01:23:36PM +0200, Lothar Waßmann wrote:
> > > > The Ka-Ro electronics MB7 baseboard has an on-board LCD->LVDS
> > > > converter that requires a fixed pixelclk polarity, no matter what the
> > > > panel's display_mode specifies. Add an option to override the pixelclk
> > > > polarity defined in the panel's display_mode via DTB.
> > > 
> > > I'd argue that the LCD->LVDS converter should be modelled specifically
> > > in DT to handle this case. It could be a implemented as a DRM bridge
> > > driver, for example.
> > > 
> > IMO that's just overkill for a simple chip that is in no way
> > configurable nor detectable by software.
> 
> I suspect that you're not the only one who runs a board that has this
> kind of quirk. If we solve this in a generic way we can point people in
> that direction when they come asking for such a quirk.
> 
> So this could be something very simple that's instantiated using maybe a
> couple of lines of code.
> 
I found the drivers/gpu/drm/bridge/lvds-encoder.c driver which on first
glance is more or less what I would need. But the driver is currently
dysfunctional due to:
|commit 13dfc0540a575b47b2d640b093ac16e9e09474f6
|Author: Eric Anholt <e...@anholt.net>
|Date:   Fri Jun 2 13:25:14 2017 -0700
|
|drm/bridge: Refactor out the panel wrapper from the lvds-encoder bridge.

Also there is no in-kernel user of this driver, so that it obviously
doesn't get tested in any way.
There is only one dts file (r8a7779-marzen.dts) that instantiate this
driver, but it has an incomplete OF graph. The missing link for the
OF graph is provided by either r8a77xx-aa104xd12-panel.dtsi or
r8a77xx-aa121td01-panel.dtsi, but those files are referenced nowhere in
the kernel source.

Reverting the part of the above mentioned patch that touches
lvds-encoder.c makes the driver functional, but I see no way to use
this driver to enforce specific bus_flags for the interface, since the
code is run prior to the simple-panel's initialization, which would
override whatever settings might have been provided by the lvds-encoder
driver.

Can someone enligthen me, how to enforce specific bus_flags/bus_format
settings for an LCD interface driven by the simple-panel driver apart
from doing it in the simple-panel driver itself?


Lothar Waßmann
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/9] drm/panel: simple: simplify display_mode definitions by using macro

2017-10-18 Thread Lothar Waßmann
Hi,

On Tue, 17 Oct 2017 14:09:37 +0200 Thierry Reding wrote:
> On Wed, Oct 11, 2017 at 01:23:34PM +0200, Lothar Waßmann wrote:
> > Use the newly defined macro to generate the display_mode data entries
> > for all panels. This reduces the code size significantly and makes the
> > code more readable.
> > 
> > Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
> > ---
> >  drivers/gpu/drm/panel/panel-simple.c | 799 
> > ++-
> >  1 file changed, 134 insertions(+), 665 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/panel/panel-simple.c 
> > b/drivers/gpu/drm/panel/panel-simple.c
> > index dec639d..fde9c41 100644
> > --- a/drivers/gpu/drm/panel/panel-simple.c
> > +++ b/drivers/gpu/drm/panel/panel-simple.c
> > @@ -89,6 +89,20 @@ struct panel_simple {
> > struct gpio_desc *enable_gpio;
> >  };
> >  
> > +#define SP_DISPLAY_MODE(freq, ha, hfp, hs, hbp, va, vfp, vs, vbp, vr, 
> > flgs) { \
> > +   .clock = freq,  \
> > +   .hdisplay = ha, \
> > +   .hsync_start = (ha) + (hfp),\
> > +   .hsync_end = (ha) + (hfp) + (hs),   \
> > +   .htotal = (ha) + (hfp) + (hs) + (hbp),  \
> > +   .vdisplay = (va),   \
> > +   .vsync_start = (va) + (vfp),\
> > +   .vsync_end = (va) + (vfp) + (vs),   \
> > +   .vtotal = (va) + (vfp) + (vs) + (vbp),  \
> > +   .vrefresh = vr, \
> > +   .flags = flgs,  \
> > +}
> > +
> >  static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
> >  {
> > return container_of(panel, struct panel_simple, base);
> [...]
> > @@ -411,33 +415,9 @@ static const struct panel_desc 
> > ampire_am_480272h3tmqw_t01h = {
> > .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
> >  };
> >  
> > -#define SP_DISPLAY_MODE(freq, ha, hfp, hs, hbp, va, vfp, vs, vbp, vr, 
> > flgs) { \
> > -   .clock = freq,  \
> > -   .hdisplay = ha, \
> > -   .hsync_start = (ha) + (hfp),\
> > -   .hsync_end = (ha) + (hfp) + (hs),   \
> > -   .htotal = (ha) + (hfp) + (hs) + (hbp),  \
> > -   .vdisplay = (va),   \
> > -   .vsync_start = (va) + (vfp),\
> > -   .vsync_end = (va) + (vfp) + (vs),   \
> > -   .vtotal = (va) + (vfp) + (vs) + (vbp),  \
> > -   .vrefresh = vr, \
> > -   .flags = flgs,  \
> > -   }
> 
> Your first patch should put this in the right place to begin with so
> that this patch is really just the conversion.
> 
> Again, I don't think this macro actually improves the way modes are
> defined.
> 
I'm not happy with this panel driver stuff anyway. With the legacy
'display-timings' node that provided the timing data directly in the
DTB, every bootloader could pick up the timing data and feed it to
whatever driver it used for the display.
With the panel driver stuff the whole Linux driver has to be replicated
in the boot loader in order to be able to use the same DTB as Linux for
its HW configuration.
And adding a new panel involves recompiling the kernel and the boot
loader, rather than adding the timing data from the panel's datasheet
into the DTB.


Lothar Waßmann
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/9] drm/panel: simple: simplify display_mode definitions by using macro

2017-10-18 Thread Lothar Waßmann
Hi,

On Tue, 17 Oct 2017 15:08:31 +0200 Thierry Reding wrote:
> On Tue, Oct 17, 2017 at 03:05:16PM +0200, Lothar Waßmann wrote:
> > Hi,
> > 
> > On Tue, 17 Oct 2017 14:09:37 +0200 Thierry Reding wrote:
> > > On Wed, Oct 11, 2017 at 01:23:34PM +0200, Lothar Waßmann wrote:
> > > > Use the newly defined macro to generate the display_mode data entries
> > > > for all panels. This reduces the code size significantly and makes the
> > > > code more readable.
> > > > 
> > > > Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
> > > > ---
> > > >  drivers/gpu/drm/panel/panel-simple.c | 799 
> > > > ++-
> > > >  1 file changed, 134 insertions(+), 665 deletions(-)
> > > > 
> > > > diff --git a/drivers/gpu/drm/panel/panel-simple.c 
> > > > b/drivers/gpu/drm/panel/panel-simple.c
> > > > index dec639d..fde9c41 100644
> > > > --- a/drivers/gpu/drm/panel/panel-simple.c
> > > > +++ b/drivers/gpu/drm/panel/panel-simple.c
> > > > @@ -89,6 +89,20 @@ struct panel_simple {
> > > > struct gpio_desc *enable_gpio;
> > > >  };
> > > >  
> > > > +#define SP_DISPLAY_MODE(freq, ha, hfp, hs, hbp, va, vfp, vs, vbp, vr, 
> > > > flgs) { \
> > > > +   .clock = freq,  
> > > > \
> > > > +   .hdisplay = ha, 
> > > > \
> > > > +   .hsync_start = (ha) + (hfp),
> > > > \
> > > > +   .hsync_end = (ha) + (hfp) + (hs),   
> > > > \
> > > > +   .htotal = (ha) + (hfp) + (hs) + (hbp),  
> > > > \
> > > > +   .vdisplay = (va),   
> > > > \
> > > > +   .vsync_start = (va) + (vfp),
> > > > \
> > > > +   .vsync_end = (va) + (vfp) + (vs),   
> > > > \
> > > > +   .vtotal = (va) + (vfp) + (vs) + (vbp),  
> > > > \
> > > > +   .vrefresh = vr, 
> > > > \
> > > > +   .flags = flgs,  
> > > > \
> > > > +}
> > > > +
> > > >  static inline struct panel_simple *to_panel_simple(struct drm_panel 
> > > > *panel)
> > > >  {
> > > > return container_of(panel, struct panel_simple, base);
> > > [...]
> > > > @@ -411,33 +415,9 @@ static const struct panel_desc 
> > > > ampire_am_480272h3tmqw_t01h = {
> > > > .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
> > > >  };
> > > >  
> > > > -#define SP_DISPLAY_MODE(freq, ha, hfp, hs, hbp, va, vfp, vs, vbp, vr, 
> > > > flgs) { \
> > > > -   .clock = freq,  
> > > > \
> > > > -   .hdisplay = ha, 
> > > > \
> > > > -   .hsync_start = (ha) + (hfp),
> > > > \
> > > > -   .hsync_end = (ha) + (hfp) + (hs),   
> > > > \
> > > > -   .htotal = (ha) + (hfp) + (hs) + (hbp),  
> > > > \
> > > > -   .vdisplay = (va),   
> > > > \
> > > > -   .vsync_start = (va) + (vfp),
> > > > \
> > > > -   .vsync_end = (va) + (vfp) + (vs),   
> > > > \
> > > > -   .vtotal = (va) + (vfp) + (vs) + (vbp),  
> > > > \
> > > > -   .vrefresh = vr, 
> > > > \
> > > > -   .flags = flgs,  
> > > > \
> > > > -   }
> > > 
> > > Your first patch should put this in the right place to begin with so
> > > that this patch is really just the conversion.
> > > 
> > > Again, I don't think this macro actually improves the way modes are
> > > defined.
> > > 
> > I'm 

Re: [PATCH 3/9] drm/panel: simple: make it possible to override LCD bus format

2017-10-18 Thread Lothar Waßmann
Hi,

On Tue, 17 Oct 2017 14:12:40 +0200 Thierry Reding wrote:
> On Wed, Oct 11, 2017 at 01:23:35PM +0200, Lothar Waßmann wrote:
> > The baseboards for the Ka-Ro electronics series of i.MX modules
> > use a 24bit LCD interface, no matter what LCD bus width the SoC on the
> > module provides and what the LCD panel expects. LCDs with 6bit per color
> > will ignore the 2 LSBs of each color lane, and modules using a SoC
> > that provides only 6bit per color, drive the display information on the
> > 6 MSBs of each color lane and tie the 2 LSBs of each color lane to GND.
> > 
> > Thus, no matter what combination of LCD and SoC is used, the LCD port
> > can be used without shuffling bit lanes by always configuring the LCD
> > output to 24bit mode.
> > 
> > Add a function to handle certain quirks of the LCD interface to the
> > panel driver to be able to override the bus format specified in a
> > panel's display_mode.
> 
> I think the above paragraph clearly indicates that this is the wrong
> place to workaround this. You say yourself that the LCD interface has
> quirks that need to be handled, so why do you want to force this
> handling into the panel driver?
> 
The quirk is in the interfacing of the SoM's LCD output to the LCD
panel. Thus it can be handled in either place.

> The panel remains the same, no matter what interface you connect it to.
> 
Because that's just ONE place to change, no matter what LCD driver is
being used.


Lothar Waßmann
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 4/9] drm/panel: simple: add support for overriding the pixel clock polarity

2017-10-18 Thread Lothar Waßmann
Hi,

On Tue, 17 Oct 2017 14:14:22 +0200 Thierry Reding wrote:
> On Wed, Oct 11, 2017 at 01:23:36PM +0200, Lothar Waßmann wrote:
> > The Ka-Ro electronics MB7 baseboard has an on-board LCD->LVDS
> > converter that requires a fixed pixelclk polarity, no matter what the
> > panel's display_mode specifies. Add an option to override the pixelclk
> > polarity defined in the panel's display_mode via DTB.
> 
> I'd argue that the LCD->LVDS converter should be modelled specifically
> in DT to handle this case. It could be a implemented as a DRM bridge
> driver, for example.
> 
IMO that's just overkill for a simple chip that is in no way
configurable nor detectable by software.


Lothar Waßmann
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/9] drm/panel: simple: add a macro for defining display modes in a simpler and less error prone way

2017-10-18 Thread Lothar Waßmann
Hi,

On Tue, 17 Oct 2017 14:08:18 +0200 Thierry Reding wrote:
> On Wed, Oct 11, 2017 at 01:23:33PM +0200, Lothar Waßmann wrote:
> > Create a macro that eases the definition of display mode parameters by
> > accecpting the parameters:
> > freq, hactive, hfront-porch, hsynclen, hback-porch,
> > vactive, vfront-porch, vsynclen, vback-porch, vrefresh
> > that can be usually directly taken from an LCD datasheet.
> > 
> > Put the calculations that are now open coded repeating the same
> > parameters multiple times into the macro expansion.
> > 
> > Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
> > ---
> >  drivers/gpu/drm/panel/panel-simple.c | 14 ++
> >  1 file changed, 14 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/panel/panel-simple.c 
> > b/drivers/gpu/drm/panel/panel-simple.c
> > index 474fa75..dec639d 100644
> > --- a/drivers/gpu/drm/panel/panel-simple.c
> > +++ b/drivers/gpu/drm/panel/panel-simple.c
> > @@ -411,6 +411,20 @@ static const struct panel_desc 
> > ampire_am_480272h3tmqw_t01h = {
> > .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
> >  };
> >  
> > +#define SP_DISPLAY_MODE(freq, ha, hfp, hs, hbp, va, vfp, vs, vbp, vr, 
> > flgs) { \
> > +   .clock = freq,  \
> > +   .hdisplay = ha, \
> > +   .hsync_start = (ha) + (hfp),\
> > +   .hsync_end = (ha) + (hfp) + (hs),   \
> > +   .htotal = (ha) + (hfp) + (hs) + (hbp),  \
> > +   .vdisplay = (va),   \
> > +   .vsync_start = (va) + (vfp),\
> > +   .vsync_end = (va) + (vfp) + (vs),   \
> > +   .vtotal = (va) + (vfp) + (vs) + (vbp),  \
> > +   .vrefresh = vr, \
> > +   .flags = flgs,  \
> > +   }
> 
> I don't think this simplifies anything. It's now completely non-obvious
> which parameter is which, so you actually have to go look at the macro
> definition when you add a new mode to make sure you get them right.
> 
In the original code you have to repeat the same parameters (e.g.
vertical front porch (vfp)) in multiple places which is error prone.


Lothar Waßmann
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 4/9] drm/panel: simple: add support for overriding the pixel clock polarity

2017-10-17 Thread Lothar Waßmann
Hi,

On Mon, 16 Oct 2017 17:13:29 -0500 Rob Herring wrote:
> On Wed, Oct 11, 2017 at 6:23 AM, Lothar Waßmann <l...@karo-electronics.de> 
> wrote:
> > The Ka-Ro electronics MB7 baseboard has an on-board LCD->LVDS
> > converter that requires a fixed pixelclk polarity, no matter what the
> > panel's display_mode specifies. Add an option to override the pixelclk
> > polarity defined in the panel's display_mode via DTB.
> 
> Wouldn't you know the polarity required based on the type of LVDS
> converter chip in front of the panel? Or is that not being described
> because it is "transparent".
> 
Exactly the latter.


Lothar Waßmann
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/2] vgaarb: Select a default VGA device even if there's no legacy VGA

2017-10-13 Thread Lothar Waßmann
info(dev, "no bridge control possible\n");
> > }
> >   
> > +   if (!vga_default_device()) {
> > +   list_for_each_entry(vgadev, _list, list) {
> > +   struct device *dev = >pdev->dev;
> > +   u16 cmd;
> > +
> > +   pdev = vgadev->pdev;
> > +   pci_read_config_word(pdev, PCI_COMMAND, );
> > +   if (cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
> > +   vgaarb_info(dev, "setting as boot device (VGA 
> > legacy resources not available)\n");
> > +   vga_set_default_device(pdev);
> > +   break;
> > +       }
> > +   }
> > +   }
> > +
> > +   if (!vga_default_device()) {
> > +   vgadev = list_first_entry_or_null(_list,
> > + struct vga_device, list);
> > +   if (vgadev) {
> > +   struct device *dev = >pdev->dev;
> > +   vgaarb_info(dev, "setting as boot device (VGA legacy 
> > resources not available)\n");
> > +   vga_set_default_device(pdev);
> 
> Isn't 'pdev' NULL here? shouldn't it be vgadev->pdev instead?
> 
That cannot not happen, though it isn't quite obvious.
'vgadev' will only be non-NULL, when the vga_list isn't empty and in
that case pdev has been set up in the list_for_each_entry() loop above.


Lothar Waßmann
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 7/9] drm/panel: simple: add support for NLT NL12880 12.1" WXGA LVDS panel

2017-10-12 Thread Lothar Waßmann
Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
---
 .../bindings/display/panel/nlt,nl12880bc20.txt | 14 +++
 drivers/gpu/drm/panel/panel-simple.c   | 45 ++
 2 files changed, 59 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/nlt,nl12880bc20.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/nlt,nl12880bc20.txt 
b/Documentation/devicetree/bindings/display/panel/nlt,nl12880bc20.txt
new file mode 100644
index 000..071b065
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/nlt,nl12880bc20.txt
@@ -0,0 +1,14 @@
+NLT Technologies Ltd. NL12880BC20 12.1" WXGA LVDS panel
+
+Note: The output format of the display can be configured via two
+  control pins (FRC, MSL). Depending on the strapping of those
+  pins the appropriate 'compatible' string has to be used.
+
+Required properties:
+- compatible: should be one of:
+   - "nlt,nl12880bc20-spwg-18" for SPWG (18bpp) FRC: Low or open, MSL: Low or 
open
+   - "nlt,nl12880bc20-spwg-24" for SPWG (24bpp) FRC: High, MSL: High
+   - "nlt,nl12880bc20-jeida" for JEIDA  FRC: High, MSL: High
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 0b8fd55..52e0cb6 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1234,6 +1234,42 @@ static const struct panel_desc nlt_nl192108ac18_02d = {
.bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
 };
 
+static const struct drm_display_mode nlt_nl12880bc20_mode =
+   SP_DISPLAY_MODE(71000, 1280, 50, 60, 50, 800, 5, 13, 5, 0, 0);
+
+static const struct panel_desc nlt_nl12880bc20_jeida = {
+   .modes = _nl12880bc20_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 261,
+   .height = 163,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
+};
+
+static const struct panel_desc nlt_nl12880bc20_spwg_18 = {
+   .modes = _nl12880bc20_mode,
+   .num_modes = 1,
+   .bpc = 6,
+   .size = {
+   .width = 261,
+   .height = 163,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
+};
+
+static const struct panel_desc nlt_nl12880bc20_spwg_24 = {
+   .modes = _nl12880bc20_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 261,
+   .height = 163,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+};
+
 static const struct drm_display_mode nvd_9128_mode =
SP_DISPLAY_MODE(29500, 800, 130, 98, 0, 480, 10, 50, 0, 0, 0);
 
@@ -1707,6 +1743,15 @@ static const struct of_device_id platform_of_match[] = {
.compatible = "nlt,nl192108ac18-02d",
.data = _nl192108ac18_02d,
}, {
+   .compatible = "nlt,nl12880bc20-jeida",
+   .data = _nl12880bc20_jeida,
+   }, {
+   .compatible = "nlt,nl12880bc20-spwg-18",
+   .data = _nl12880bc20_spwg_18,
+   }, {
+   .compatible = "nlt,nl12880bc20-spwg-24",
+   .data = _nl12880bc20_spwg_24,
+   }, {
.compatible = "nvd,9128",
.data = _9128,
}, {
-- 
2.1.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 4/9] drm/panel: simple: add support for overriding the pixel clock polarity

2017-10-12 Thread Lothar Waßmann
The Ka-Ro electronics MB7 baseboard has an on-board LCD->LVDS
converter that requires a fixed pixelclk polarity, no matter what the
panel's display_mode specifies. Add an option to override the pixelclk
polarity defined in the panel's display_mode via DTB.

Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
---
 .../bindings/display/panel/simple-panel.txt|  3 +++
 drivers/gpu/drm/panel/panel-simple.c   | 30 ++
 2 files changed, 33 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/panel/simple-panel.txt 
b/Documentation/devicetree/bindings/display/panel/simple-panel.txt
index e2308c3..dcaf9a7 100644
--- a/Documentation/devicetree/bindings/display/panel/simple-panel.txt
+++ b/Documentation/devicetree/bindings/display/panel/simple-panel.txt
@@ -9,6 +9,9 @@ Optional properties:
 - backlight: phandle of the backlight device attached to the panel
 - bus-format-override: override the bus_format setting of the panel's
   display_mode settings
+- pixelclk-active: override the pixelclock polarity defined in the
+  panel's display_mode settings
+
 
 Example:
 
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index f356a7b..7bbb752 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -89,6 +89,12 @@ struct panel_simple {
struct gpio_desc *enable_gpio;
 
u32 bus_fmt_override;
+   u32 quirks;
+};
+
+enum {
+   PANEL_QUIRK_PIXDATA_NEGEDGE = BIT(0),
+   PANEL_QUIRK_PIXDATA_POSEDGE = BIT(1),
 };
 
 #define SP_DISPLAY_MODE(freq, ha, hfp, hs, hbp, va, vfp, vs, vbp, vr, flgs) { \
@@ -110,6 +116,15 @@ static inline struct panel_simple *to_panel_simple(struct 
drm_panel *panel)
return container_of(panel, struct panel_simple, base);
 }
 
+static inline void panel_simple_apply_quirks(struct panel_simple *panel,
+struct drm_display_info *info)
+{
+   if (panel->quirks & PANEL_QUIRK_PIXDATA_NEGEDGE)
+   info->bus_flags |= DRM_BUS_FLAG_PIXDATA_NEGEDGE;
+   if (panel->quirks & PANEL_QUIRK_PIXDATA_POSEDGE)
+   info->bus_flags |= DRM_BUS_FLAG_PIXDATA_POSEDGE;
+}
+
 static int panel_simple_get_fixed_modes(struct panel_simple *panel)
 {
struct drm_connector *connector = panel->base.connector;
@@ -175,6 +190,8 @@ static int panel_simple_get_fixed_modes(struct panel_simple 
*panel)
drm_display_info_set_bus_formats(>display_info,
 >desc->bus_format, 1);
connector->display_info.bus_flags = panel->desc->bus_flags;
+   if (panel->quirks)
+   panel_simple_apply_quirks(panel, >display_info);
 
return num;
 }
@@ -308,6 +325,7 @@ static inline int panel_simple_check_quirks(struct device 
*dev,
struct panel_simple *p)
 {
const char *bus_fmt;
+   u32 clkpol;
 
if (of_property_read_string(dev->of_node, "bus-format-override",
_fmt) == 0) {
@@ -329,6 +347,18 @@ static inline int panel_simple_check_quirks(struct device 
*dev,
bus_fmt);
return p->bus_fmt_override ? 0 : -EINVAL;
}
+
+   if (of_property_read_u32(dev->of_node, "pixelclk-active",
+) == 0) {
+   if (clkpol & ~1) {
+   dev_err(dev,
+   "Invalid value for pixelclk-active: '%u' 
(should be <0> or <1>)\n",
+   clkpol);
+   return -EINVAL;
+   }
+   p->quirks |= clkpol ? PANEL_QUIRK_PIXDATA_POSEDGE :
+   PANEL_QUIRK_PIXDATA_NEGEDGE;
+   }
return 0;
 }
 
-- 
2.1.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 6/9] drm/panel: simple: add support for EDT ET0430 4.3" HVGA panel

2017-10-12 Thread Lothar Waßmann
Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
---
 .../bindings/display/panel/edt,et0430g0dh6.txt|  7 +++
 drivers/gpu/drm/panel/panel-simple.c  | 19 +++
 2 files changed, 26 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/edt,et0430g0dh6.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/edt,et0430g0dh6.txt 
b/Documentation/devicetree/bindings/display/panel/edt,et0430g0dh6.txt
new file mode 100644
index 000..d1bdd1c
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/edt,et0430g0dh6.txt
@@ -0,0 +1,7 @@
+Emerging Display Technology Corp. 4.3" HVGA (480x272) TFT LCD panel
+
+Required properties:
+- compatible: should be "edt,et0430g0dh6"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index f57b463..0b8fd55 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -779,6 +779,22 @@ static const struct panel_desc edt_et0350g0dh6 = {
.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_NEGEDGE,
 };
 
+static const struct drm_display_mode edt_et0430g0dh6_mode =
+   SP_DISPLAY_MODE(9000, 480, 2, 41, 2, 272, 2, 10, 2, 60,
+   DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
+
+static const struct panel_desc edt_et0430g0dh6 = {
+   .modes = _et0430g0dh6_mode,
+   .num_modes = 1,
+   .bpc = 6,
+   .size = {
+   .width = 95,
+   .height = 54,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
+   .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_POSEDGE,
+};
+
 static const struct drm_display_mode edt_et057090dhu_mode =
SP_DISPLAY_MODE(25175, 640, 16, 30, 114, 480, 10, 3, 32, 60,
DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
@@ -1610,6 +1626,9 @@ static const struct of_device_id platform_of_match[] = {
.compatible = "edt,et0350g0dh6",
.data = _et0350g0dh6,
}, {
+   .compatible = "edt,et0430g0dh6",
+   .data = _et0430g0dh6,
+   }, {
.compatible = "edt,et057090dhu",
.data = _et057090dhu,
}, {
-- 
2.1.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 8/9] drm/panel: simple: add support for EDT ETM0700G0EDH6 7" WVGA panel

2017-10-12 Thread Lothar Waßmann
This panel is the same as ETM0700g0DH6 with an inverted pixel clock.

Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
---
 .../bindings/display/panel/edt,etm0700g0edh6.txt  |  9 +
 drivers/gpu/drm/panel/panel-simple.c  | 15 +++
 2 files changed, 24 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/edt,etm0700g0edh6.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/edt,etm0700g0edh6.txt 
b/Documentation/devicetree/bindings/display/panel/edt,etm0700g0edh6.txt
new file mode 100644
index 000..e6e8ef5
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/edt,etm0700g0edh6.txt
@@ -0,0 +1,9 @@
+Emerging Display Technology Corp. ETM0700G0EDH6 7.0" WVGA TFT LCD panel
+
+Required properties:
+- compatible: should be "edt,etm0700g0edh6"
+
+This panel is the same as ETM0700g0DH6 with and inverted pixel clock.
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 52e0cb6..d4d2a89 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -827,6 +827,18 @@ static const struct panel_desc edt_etm0700g0dh6 = {
.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_NEGEDGE,
 };
 
+static const struct panel_desc edt_etm0700g0edh6 = {
+   .modes = _etm0700g0dh6_mode,
+   .num_modes = 1,
+   .bpc = 6,
+   .size = {
+   .width = 152,
+   .height = 91,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
+   .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_POSEDGE,
+};
+
 static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode =
SP_DISPLAY_MODE(32260, 800, 168, 64, 88, 480, 37, 2, 8, 60, 0);
 
@@ -1674,6 +1686,9 @@ static const struct of_device_id platform_of_match[] = {
.compatible = "edt,etm0700g0dh6",
.data = _etm0700g0dh6,
}, {
+   .compatible = "edt,etm0700g0edh6",
+   .data = _etm0700g0edh6,
+   }, {
.compatible = "foxlink,fl500wvr00-a0t",
.data = _fl500wvr00_a0t,
}, {
-- 
2.1.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 9/9] drm/panel: simple: add support for EDT ET1010G0DSA/ETML1010G0DKA 10.1" WXGA LVDS panels

2017-10-12 Thread Lothar Waßmann
This adds support for the Emerging Display Technologies Corporation
10.1" WXGA LVDS panel ET1010G0DSA (without a touch panel) and
ETML1010G0DKA (with capacitive touch panel).

Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
---
 .../bindings/display/panel/edt,et1010g0dsa.txt |  7 +++
 .../bindings/display/panel/edt,etml1010g0dka.txt   |  9 +
 drivers/gpu/drm/panel/panel-simple.c   | 22 ++
 3 files changed, 38 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/edt,et1010g0dsa.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/edt,etml1010g0dka.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/edt,et1010g0dsa.txt 
b/Documentation/devicetree/bindings/display/panel/edt,et1010g0dsa.txt
new file mode 100644
index 000..f76e070
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/edt,et1010g0dsa.txt
@@ -0,0 +1,7 @@
+Emerging Display Technology Corp. ET1010G0DSA 10.1" WXGA TFT LVDS display panel
+
+Required properties:
+- compatible: should be "edt,et1010g0dsa"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
diff --git 
a/Documentation/devicetree/bindings/display/panel/edt,etml1010g0dka.txt 
b/Documentation/devicetree/bindings/display/panel/edt,etml1010g0dka.txt
new file mode 100644
index 000..1413ea9
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/edt,etml1010g0dka.txt
@@ -0,0 +1,9 @@
+Emerging Display Technology Corp. ETML1010G0DKA 10.1" WXGA TFT LVDS display 
panel
+
+Required properties:
+- compatible: should be "edt,etml1010g0dka"
+
+This panel is the same as ET101G0DSA with an integrated capacitive multitouch 
panel.
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index d4d2a89..5154cb9 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -839,6 +839,22 @@ static const struct panel_desc edt_etm0700g0edh6 = {
.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_POSEDGE,
 };
 
+static const struct drm_display_mode edt_et1010g0dsa_mode =
+   SP_DISPLAY_MODE(71100, 1280, 25, 80, 55, 800, 5, 2, 16, 60,
+   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
+
+static const struct panel_desc edt_et1010g0dsa = {
+   .modes = _et1010g0dsa_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 217,
+   .height = 136,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+   .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_NEGEDGE,
+};
+
 static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode =
SP_DISPLAY_MODE(32260, 800, 168, 64, 88, 480, 37, 2, 8, 60, 0);
 
@@ -1683,6 +1699,12 @@ static const struct of_device_id platform_of_match[] = {
.compatible = "edt,et070080dh6",
.data = _etm0700g0dh6,
}, {
+   .compatible = "edt,et1010g0dsa",
+   .data = _et1010g0dsa,
+   }, {
+   .compatible = "edt,etml1010g0dka",
+   .data = _et1010g0dsa,
+   }, {
.compatible = "edt,etm0700g0dh6",
.data = _etm0700g0dh6,
}, {
-- 
2.1.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/9] drm/panel: simple: simplify display_mode definitions by using macro

2017-10-12 Thread Lothar Waßmann
Use the newly defined macro to generate the display_mode data entries
for all panels. This reduces the code size significantly and makes the
code more readable.

Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
---
 drivers/gpu/drm/panel/panel-simple.c | 799 ++-
 1 file changed, 134 insertions(+), 665 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index dec639d..fde9c41 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -89,6 +89,20 @@ struct panel_simple {
struct gpio_desc *enable_gpio;
 };
 
+#define SP_DISPLAY_MODE(freq, ha, hfp, hs, hbp, va, vfp, vs, vbp, vr, flgs) { \
+   .clock = freq,  \
+   .hdisplay = ha, \
+   .hsync_start = (ha) + (hfp),\
+   .hsync_end = (ha) + (hfp) + (hs),   \
+   .htotal = (ha) + (hfp) + (hs) + (hbp),  \
+   .vdisplay = (va),   \
+   .vsync_start = (va) + (vfp),\
+   .vsync_end = (va) + (vfp) + (vs),   \
+   .vtotal = (va) + (vfp) + (vs) + (vbp),  \
+   .vrefresh = vr, \
+   .flags = flgs,  \
+}
+
 static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
 {
return container_of(panel, struct panel_simple, base);
@@ -386,19 +400,9 @@ static void panel_simple_shutdown(struct device *dev)
panel_simple_unprepare(>base);
 }
 
-static const struct drm_display_mode ampire_am_480272h3tmqw_t01h_mode = {
-   .clock = 9000,
-   .hdisplay = 480,
-   .hsync_start = 480 + 2,
-   .hsync_end = 480 + 2 + 41,
-   .htotal = 480 + 2 + 41 + 2,
-   .vdisplay = 272,
-   .vsync_start = 272 + 2,
-   .vsync_end = 272 + 2 + 10,
-   .vtotal = 272 + 2 + 10 + 2,
-   .vrefresh = 60,
-   .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
-};
+static const struct drm_display_mode ampire_am_480272h3tmqw_t01h_mode =
+   SP_DISPLAY_MODE(9000, 480, 2, 41, 2, 272, 2, 10, 2, 60,
+   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
 
 static const struct panel_desc ampire_am_480272h3tmqw_t01h = {
.modes = _am_480272h3tmqw_t01h_mode,
@@ -411,33 +415,9 @@ static const struct panel_desc ampire_am_480272h3tmqw_t01h 
= {
.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
 };
 
-#define SP_DISPLAY_MODE(freq, ha, hfp, hs, hbp, va, vfp, vs, vbp, vr, flgs) { \
-   .clock = freq,  \
-   .hdisplay = ha, \
-   .hsync_start = (ha) + (hfp),\
-   .hsync_end = (ha) + (hfp) + (hs),   \
-   .htotal = (ha) + (hfp) + (hs) + (hbp),  \
-   .vdisplay = (va),   \
-   .vsync_start = (va) + (vfp),\
-   .vsync_end = (va) + (vfp) + (vs),   \
-   .vtotal = (va) + (vfp) + (vs) + (vbp),  \
-   .vrefresh = vr, \
-   .flags = flgs,  \
-   }
-
-static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = {
-   .clock = 3,
-   .hdisplay = 800,
-   .hsync_start = 800 + 0,
-   .hsync_end = 800 + 0 + 255,
-   .htotal = 800 + 0 + 255 + 0,
-   .vdisplay = 480,
-   .vsync_start = 480 + 2,
-   .vsync_end = 480 + 2 + 45,
-   .vtotal = 480 + 2 + 45 + 0,
-   .vrefresh = 60,
-   .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
-};
+static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode =
+   SP_DISPLAY_MODE(3, 800, 0, 255, 0, 480, 2, 45, 0, 60,
+   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
 
 static const struct panel_desc ampire_am800480r3tmqwa1h = {
.modes = _am800480r3tmqwa1h_mode,
@@ -450,18 +430,8 @@ static const struct panel_desc ampire_am800480r3tmqwa1h = {
.bus_format = MEDIA_BUS_FMT_RGB666_1X18,
 };
 
-static const struct drm_display_mode auo_b101aw03_mode = {
-   .clock = 51450,
-   .hdisplay = 1024,
-   .hsync_start = 1024 + 156,
-   .hsync_end = 1024 + 156 + 8,
-   .htotal = 1024 + 156 + 8 + 156,
-   .vdisplay = 600,
-   .vsync_start = 600 + 16,
-   .vsync_end = 600 + 16 + 6,
-   .vtotal = 600 + 16 + 6 + 16,
-   .vrefresh = 60,
-};
+static const struct drm_display_mode auo_b101aw03_mode =
+   SP_DISPLAY_MODE(51450, 1024, 15

[PATCH 3/9] drm/panel: simple: make it possible to override LCD bus format

2017-10-12 Thread Lothar Waßmann
The baseboards for the Ka-Ro electronics series of i.MX modules
use a 24bit LCD interface, no matter what LCD bus width the SoC on the
module provides and what the LCD panel expects. LCDs with 6bit per color
will ignore the 2 LSBs of each color lane, and modules using a SoC
that provides only 6bit per color, drive the display information on the
6 MSBs of each color lane and tie the 2 LSBs of each color lane to GND.

Thus, no matter what combination of LCD and SoC is used, the LCD port
can be used without shuffling bit lanes by always configuring the LCD
output to 24bit mode.

Add a function to handle certain quirks of the LCD interface to the
panel driver to be able to override the bus format specified in a
panel's display_mode.

Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
---
 .../bindings/display/panel/simple-panel.txt|  2 ++
 drivers/gpu/drm/panel/panel-simple.c   | 40 +-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/panel/simple-panel.txt 
b/Documentation/devicetree/bindings/display/panel/simple-panel.txt
index 1341bbf..e2308c3 100644
--- a/Documentation/devicetree/bindings/display/panel/simple-panel.txt
+++ b/Documentation/devicetree/bindings/display/panel/simple-panel.txt
@@ -7,6 +7,8 @@ Optional properties:
 - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
 - enable-gpios: GPIO pin to enable or disable the panel
 - backlight: phandle of the backlight device attached to the panel
+- bus-format-override: override the bus_format setting of the panel's
+  display_mode settings
 
 Example:
 
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index fde9c41..f356a7b 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -87,6 +87,8 @@ struct panel_simple {
struct i2c_adapter *ddc;
 
struct gpio_desc *enable_gpio;
+
+   u32 bus_fmt_override;
 };
 
 #define SP_DISPLAY_MODE(freq, ha, hfp, hs, hbp, va, vfp, vs, vbp, vr, flgs) { \
@@ -165,7 +167,11 @@ static int panel_simple_get_fixed_modes(struct 
panel_simple *panel)
connector->display_info.bpc = panel->desc->bpc;
connector->display_info.width_mm = panel->desc->size.width;
connector->display_info.height_mm = panel->desc->size.height;
-   if (panel->desc->bus_format)
+
+   if (panel->bus_fmt_override)
+   drm_display_info_set_bus_formats(>display_info,
+>bus_fmt_override, 1);
+   else if (panel->desc->bus_format)
drm_display_info_set_bus_formats(>display_info,
 >desc->bus_format, 1);
connector->display_info.bus_flags = panel->desc->bus_flags;
@@ -298,6 +304,34 @@ static int panel_simple_get_timings(struct drm_panel 
*panel,
return p->desc->num_timings;
 }
 
+static inline int panel_simple_check_quirks(struct device *dev,
+   struct panel_simple *p)
+{
+   const char *bus_fmt;
+
+   if (of_property_read_string(dev->of_node, "bus-format-override",
+   _fmt) == 0) {
+   if (strcmp(bus_fmt, "rgb24") == 0)
+   p->bus_fmt_override = MEDIA_BUS_FMT_RGB888_1X24;
+   else if (strcmp(bus_fmt, "rgb666") == 0)
+   p->bus_fmt_override = MEDIA_BUS_FMT_RGB666_1X18;
+   else if (strcmp(bus_fmt, "rgb565") == 0)
+   p->bus_fmt_override = MEDIA_BUS_FMT_RGB565_1X16;
+   else if (strcmp(bus_fmt, "spwg-18") == 0)
+   p->bus_fmt_override = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG;
+   else if (strcmp(bus_fmt, "spwg-24") == 0)
+   p->bus_fmt_override = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;
+   else if (strcmp(bus_fmt, "jeida-24") == 0)
+   p->bus_fmt_override = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
+   else
+   dev_err(dev,
+   "Unsupported bus-format-override value: '%s'\n",
+   bus_fmt);
+   return p->bus_fmt_override ? 0 : -EINVAL;
+   }
+   return 0;
+}
+
 static const struct drm_panel_funcs panel_simple_funcs = {
.disable = panel_simple_disable,
.unprepare = panel_simple_unprepare,
@@ -353,6 +387,10 @@ static int panel_simple_probe(struct device *dev, const 
struct panel_desc *desc)
}
}
 
+   err = panel_simple_check_quirks(dev, panel);
+   if (err)
+   goto free_ddc;
+
drm_panel_init(>base);
panel->base.dev = dev;
panel->base.funcs = _simple_funcs;
-- 
2.1.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 5/9] drm/panel: simple: add support for EDT ET0350 3.5" QVGA panel

2017-10-12 Thread Lothar Waßmann
Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
---
 .../bindings/display/panel/edt,et0350g0dh6.txt|  7 +++
 drivers/gpu/drm/panel/panel-simple.c  | 19 +++
 2 files changed, 26 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/edt,et0350g0dh6.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/edt,et0350g0dh6.txt 
b/Documentation/devicetree/bindings/display/panel/edt,et0350g0dh6.txt
new file mode 100644
index 000..5546221
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/edt,et0350g0dh6.txt
@@ -0,0 +1,7 @@
+Emerging Display Technology Corp. 3.5" QVGA (320x240) TFT LCD panel
+
+Required properties:
+- compatible: should be "edt,et0350g0dh6"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 7bbb752..f57b463 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -763,6 +763,22 @@ static const struct panel_desc chunghwa_claa101wb01 = {
},
 };
 
+static const struct drm_display_mode edt_et0350g0dh6_mode =
+   SP_DISPLAY_MODE(6500, 320, 20, 0, 68, 240, 4, 0, 18, 60,
+   DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
+
+static const struct panel_desc edt_et0350g0dh6 = {
+   .modes = _et0350g0dh6_mode,
+   .num_modes = 1,
+   .bpc = 6,
+   .size = {
+   .width = 70,
+   .height = 53,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
+   .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_NEGEDGE,
+};
+
 static const struct drm_display_mode edt_et057090dhu_mode =
SP_DISPLAY_MODE(25175, 640, 16, 30, 114, 480, 10, 3, 32, 60,
DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
@@ -1591,6 +1607,9 @@ static const struct of_device_id platform_of_match[] = {
.compatible = "chunghwa,claa101wb01",
.data = _claa101wb01
}, {
+   .compatible = "edt,et0350g0dh6",
+   .data = _et0350g0dh6,
+   }, {
.compatible = "edt,et057090dhu",
.data = _et057090dhu,
}, {
-- 
2.1.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/9] drm/panel: simple: add a macro for defining display modes in a simpler and less error prone way

2017-10-12 Thread Lothar Waßmann
Create a macro that eases the definition of display mode parameters by
accecpting the parameters:
freq, hactive, hfront-porch, hsynclen, hback-porch,
vactive, vfront-porch, vsynclen, vback-porch, vrefresh
that can be usually directly taken from an LCD datasheet.

Put the calculations that are now open coded repeating the same
parameters multiple times into the macro expansion.

Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
---
 drivers/gpu/drm/panel/panel-simple.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 474fa75..dec639d 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -411,6 +411,20 @@ static const struct panel_desc ampire_am_480272h3tmqw_t01h 
= {
.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
 };
 
+#define SP_DISPLAY_MODE(freq, ha, hfp, hs, hbp, va, vfp, vs, vbp, vr, flgs) { \
+   .clock = freq,  \
+   .hdisplay = ha, \
+   .hsync_start = (ha) + (hfp),\
+   .hsync_end = (ha) + (hfp) + (hs),   \
+   .htotal = (ha) + (hfp) + (hs) + (hbp),  \
+   .vdisplay = (va),   \
+   .vsync_start = (va) + (vfp),\
+   .vsync_end = (va) + (vfp) + (vs),   \
+   .vtotal = (va) + (vfp) + (vs) + (vbp),  \
+   .vrefresh = vr, \
+   .flags = flgs,  \
+   }
+
 static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = {
.clock = 3,
.hdisplay = 800,
-- 
2.1.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 0/9] drm/panel: simple: improve definition of display modes and add more panels

2017-10-12 Thread Lothar Waßmann
The first two patches of this patchset simplify the definition of
display modes in the driver and make it less error prone.

Patch 3 & 4 add support for overriding certain settings defined in the
panel definitions via DT entries to match up HW interfacing variants.

The remaining patches add support for various panels that may be used
with the Ka-Ro electronics TX module series.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] devicetree/bindings: display: fix reference to Documentation/.../display-timing.txt

2017-08-30 Thread Lothar Waßmann
panel-common.txt references display-timing.txt with an invalid path
('/panel' missing).

Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
---
 Documentation/devicetree/bindings/display/panel/panel-common.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-common.txt 
b/Documentation/devicetree/bindings/display/panel/panel-common.txt
index ec52c47..0603af8 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-common.txt
+++ b/Documentation/devicetree/bindings/display/panel/panel-common.txt
@@ -38,7 +38,7 @@ Display Timings
   require specific display timings. The panel-timing subnode expresses those
   timings as specified in the timing subnode section of the display timing
   bindings defined in
-  Documentation/devicetree/bindings/display/display-timing.txt.
+  Documentation/devicetree/bindings/display/panel/display-timing.txt.
 
 
 Connectivity
-- 
2.1.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] devicetree/bindings: display: fix copy/paste error

2017-08-30 Thread Lothar Waßmann
Adjust the compatible string that was obviously copied from the
mitsubishi,aa121td01.txt file.

Signed-off-by: Lothar Waßmann <l...@karo-electronics.de>
---
 .../devicetree/bindings/display/panel/mitsubishi,aa104xd12.txt  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/Documentation/devicetree/bindings/display/panel/mitsubishi,aa104xd12.txt 
b/Documentation/devicetree/bindings/display/panel/mitsubishi,aa104xd12.txt
index ced0121..6121a5a 100644
--- a/Documentation/devicetree/bindings/display/panel/mitsubishi,aa104xd12.txt
+++ b/Documentation/devicetree/bindings/display/panel/mitsubishi,aa104xd12.txt
@@ -9,7 +9,7 @@ with the following device-specific properties.
 
 Required properties:
 
-- compatible: Shall contain "mitsubishi,aa121td01" and "panel-lvds", in that
+- compatible: Shall contain "mitsubishi,aa104xd12" and "panel-lvds", in that
   order.
 - vcc-supply: Reference to the regulator powering the panel VCC pins.
 
-- 
2.1.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 2/5] arm: dts: Add the burst and esc clock frequency properties to DSI node

2017-03-06 Thread Lothar Waßmann
Hi,

On Mon, 06 Mar 2017 13:42:20 +0900 Hoegeun Kwon wrote:
> The OF graph is not needed because the panel is a child of dsi. Add
>
This is obviously from your patch #5 and doesn't make sense in this
context.

> the burst and esc clock frequency properties to the parent (DSI node).
> 
> Signed-off-by: Hoegeun Kwon <hoegeun.k...@samsung.com>
> Reviewed-by: Andrzej Hajda <a.ha...@samsung.com>
> ---
>  arch/arm/boot/dts/exynos3250-rinato.dts | 2 ++
>  arch/arm/boot/dts/exynos4210-trats.dts  | 2 ++
>  arch/arm/boot/dts/exynos4412-trats2.dts | 2 ++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/exynos3250-rinato.dts 
> b/arch/arm/boot/dts/exynos3250-rinato.dts
> index 548413e..c9f191c 100644
> --- a/arch/arm/boot/dts/exynos3250-rinato.dts
> +++ b/arch/arm/boot/dts/exynos3250-rinato.dts
> @@ -215,6 +215,8 @@
>  _0 {
>   vddcore-supply = <_reg>;
>   vddio-supply = <_reg>;
> + samsung,burst-clock-frequency = <25000>;
> + samsung,esc-clock-frequency = <2000>;
>   samsung,pll-clock-frequency = <2400>;
>   status = "okay";
>  
> diff --git a/arch/arm/boot/dts/exynos4210-trats.dts 
> b/arch/arm/boot/dts/exynos4210-trats.dts
> index 0ca1b4d..1743ca8 100644
> --- a/arch/arm/boot/dts/exynos4210-trats.dts
> +++ b/arch/arm/boot/dts/exynos4210-trats.dts
> @@ -197,6 +197,8 @@
>  _0 {
>   vddcore-supply = <_reg>;
>   vddio-supply = <_reg>;
> + samsung,burst-clock-frequency = <5>;
> + samsung,esc-clock-frequency = <2000>;
>   samsung,pll-clock-frequency = <2400>;
>   status = "okay";
>  
> diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts 
> b/arch/arm/boot/dts/exynos4412-trats2.dts
> index 41ecd6d..82221a0 100644
> --- a/arch/arm/boot/dts/exynos4412-trats2.dts
> +++ b/arch/arm/boot/dts/exynos4412-trats2.dts
> @@ -385,6 +385,8 @@
>  _0 {
>   vddcore-supply = <_reg>;
>   vddio-supply = <_reg>;
> + samsung,burst-clock-frequency = <5>;
> + samsung,esc-clock-frequency = <2000>;
>   samsung,pll-clock-frequency = <2400>;
>   status = "okay";
>  


Lothar Waßmann
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH V2] drm: update kerneldoc for changes introduced by commits "16fadc2568e9" and "9671e228fb78"

2016-08-16 Thread Lothar Waßmann
Describe the new parameter 'bus_flags' to of_get_drm_display_mode() in
the kerneldoc comments and add kerneldoc comments to the new function
drm_bus_flags_from_videomode().

Signed-off-by: Lothar Waßmann 
---
Changes vs. v1:
  - added missing characters

 drivers/gpu/drm/drm_modes.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 1570487..53f07ac 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -657,6 +657,15 @@ void drm_display_mode_to_videomode(const struct 
drm_display_mode *dmode,
 }
 EXPORT_SYMBOL_GPL(drm_display_mode_to_videomode);

+/**
+ * drm_bus_flags_from_videomode - extract information about pixelclk and
+ * DE polarity from videomode and store it in a separate variable
+ * @vm: videomode structure to use
+ * @bus_flags: information about pixelclk and DE polarity will be stored here
+ *
+ * Sets DRM_BUS_FLAG_DE_(LOW|HIGH) and DRM_BUS_FLAG_PIXDATA_(POS|NEG)EDGE
+ * in @bus_flags according to DISPLAY_FLAGS found in @vm
+ */
 void drm_bus_flags_from_videomode(const struct videomode *vm, u32 *bus_flags)
 {
*bus_flags = 0;
@@ -677,6 +686,7 @@ EXPORT_SYMBOL_GPL(drm_bus_flags_from_videomode);
  * of_get_drm_display_mode - get a drm_display_mode from devicetree
  * @np: device_node with the timing specification
  * @dmode: will be set to the return value
+ * @bus_flags: information about pixelclk and DE polarity
  * @index: index into the list of display timings in devicetree
  *
  * This function is expensive and should only be used, if only one mode is to 
be
-- 
2.1.4



[PATCH] drm: update kerneldoc for changes introduced by commits "16fadc2568e9" and "9671e228fb78"

2016-08-16 Thread Lothar Waßmann
Hi,

On Tue, 16 Aug 2016 13:41:20 +0200 Lucas Stach wrote:
> Hi Lothar,
> 
> Am Dienstag, den 16.08.2016, 13:12 +0200 schrieb Lothar Waßmann:
> > Describe the new parameter 'bus_flags' to of_get_drm_display_mode() in
> > the kerneldoc comments and add kerneldoc comments to the new function
> > drm_bus_flags_from_videomode().
> > 
> > Signed-off-by: Lothar Waßmann 
> > ---
> >  drivers/gpu/drm/drm_modes.c | 10 ++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> > index 1570487..e4c65bb 100644
> > --- a/drivers/gpu/drm/drm_modes.c
> > +++ b/drivers/gpu/drm/drm_modes.c
> > @@ -657,6 +657,15 @@ void drm_display_mode_to_videomode(const struct 
> > drm_display_mode *dmode,
> >  }
> >  EXPORT_SYMBOL_GPL(drm_display_mode_to_videomode);
> >  
> > +/**
> > + * drm_bus_flags_from_videomode - extract rmation about pixelclk and
>  ^ missing letters here
> 
OOOPS! Just found them under my keyboard. ;)
Should I resubmit or can whoever picks this up fix it when applying?


Lothar Waßmann


[PATCH] drm: update kerneldoc for changes introduced by commits "16fadc2568e9" and "9671e228fb78"

2016-08-16 Thread Lothar Waßmann
Describe the new parameter 'bus_flags' to of_get_drm_display_mode() in
the kerneldoc comments and add kerneldoc comments to the new function
drm_bus_flags_from_videomode().

Signed-off-by: Lothar Waßmann 
---
 drivers/gpu/drm/drm_modes.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 1570487..e4c65bb 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -657,6 +657,15 @@ void drm_display_mode_to_videomode(const struct 
drm_display_mode *dmode,
 }
 EXPORT_SYMBOL_GPL(drm_display_mode_to_videomode);

+/**
+ * drm_bus_flags_from_videomode - extract rmation about pixelclk and
+ * DE polarity from videomode and store it in a separate variable
+ * @vm: videomode structure to use
+ * @bus_flags: information about pixelclk and DE polarity will be stored here
+ *
+ * Sets DRM_BUS_FLAG_DE_(LOW|HIGH) and DRM_BUS_FLAG_PIXDATA_(POS|NEG)EDGE
+ * in @bus_flags according to DISPLAY_FLAGS found in @vm
+ */
 void drm_bus_flags_from_videomode(const struct videomode *vm, u32 *bus_flags)
 {
*bus_flags = 0;
@@ -677,6 +686,7 @@ EXPORT_SYMBOL_GPL(drm_bus_flags_from_videomode);
  * of_get_drm_display_mode - get a drm_display_mode from devicetree
  * @np: device_node with the timing specification
  * @dmode: will be set to the return value
+ * @bus_flags: information about pixelclk and DE polarity
  * @index: index into the list of display timings in devicetree
  *
  * This function is expensive and should only be used, if only one mode is to 
be
-- 
2.1.4



[PATCH v5] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver

2016-08-02 Thread Lothar Waßmann
Hi,

On Thu, 14 Jul 2016 11:47:52 +0200 Philipp Zabel wrote:
> Hi Lothar,
> 
> Am Dienstag, den 12.07.2016, 18:50 +0200 schrieb Philipp Zabel:
> > From: Lothar Waßmann 
> > 
> > The 'de-active' and 'pixelclk-active' DT properties are evaluated
> > by of_parse_display_timing() called from  of_get_drm_display_mode(),
> > but later lost in the conversion from videomode.flags to
> > drm_display_mode.flags.
> > Enhance of_get_drm_display_mode() to also return the bus flags in a
> > separate variable, so that they can be passed on to the ipu-di
> > driver.
> > 
> > Signed-off-by: Lothar Waßmann 
> > Signed-off-by: Philipp Zabel 
> > ---
> > Changes since v4:
> >  - Rebased onto imx-drm/next after atomic modeset changes
> 
> could you double check
> git://git.pengutronix.de/git/pza/linux.git imx-drm/next
> works for you?
> Let me know if you agree with my changes to your patch.
> 
I'm just back from vacation and will check this soon.


Lothar Waßmann


[PATCHv4 3/3] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver

2016-07-12 Thread Lothar Waßmann
The 'de-active' and 'pixelclk-active' DT properties are evaluated
by of_parse_display_timing() called from  of_get_drm_display_mode(),
but later lost in the conversion from videomode.flags to
drm_display_mode.flags.
Enhance of_get_drm_display_mode() to also return the bus flags in a
separate variable, so that they can be passed on to the ipu-di
driver.

Signed-off-by: Lothar Waßmann 
---
 drivers/gpu/drm/drm_modes.c|  5 -
 drivers/gpu/drm/imx/imx-ldb.c  | 11 ---
 drivers/gpu/drm/imx/parallel-display.c |  8 ++--
 include/drm/drm_modes.h|  2 +-
 4 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 51804e5..1570487 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -687,7 +687,8 @@ EXPORT_SYMBOL_GPL(drm_bus_flags_from_videomode);
  * 0 on success, a negative errno code when no of videomode node was found.
  */
 int of_get_drm_display_mode(struct device_node *np,
-   struct drm_display_mode *dmode, int index)
+   struct drm_display_mode *dmode, u32 *bus_flags,
+   int index)
 {
struct videomode vm;
int ret;
@@ -697,6 +698,8 @@ int of_get_drm_display_mode(struct device_node *np,
return ret;

drm_display_mode_from_videomode(, dmode);
+   if (bus_flags)
+   drm_bus_flags_from_videomode(, bus_flags);

pr_debug("%s: got %dx%d display mode from %s\n",
of_node_full_name(np), vm.hactive, vm.vactive, np->name);
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index beff793..e445182 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -66,7 +66,8 @@ struct imx_ldb_channel {
int edid_len;
struct drm_display_mode mode;
int mode_valid;
-   int bus_format;
+   u32 bus_format;
+   u32 bus_flags;
 };

 struct bus_mux {
@@ -103,8 +104,10 @@ static int imx_ldb_connector_get_modes(struct 
drm_connector *connector)
struct drm_display_info *di = >display_info;

num_modes = 
imx_ldb_ch->panel->funcs->get_modes(imx_ldb_ch->panel);
-   if (!imx_ldb_ch->bus_format && di->num_bus_formats)
+   if (!imx_ldb_ch->bus_format && di->num_bus_formats) {
imx_ldb_ch->bus_format = di->bus_formats[0];
+   imx_ldb_ch->bus_flags = di->bus_flags;
+   }
if (num_modes > 0)
return num_modes;
}
@@ -206,7 +209,8 @@ static void imx_ldb_encoder_prepare(struct drm_encoder 
*encoder)
break;
}

-   imx_drm_set_bus_format(encoder, bus_format);
+   imx_drm_set_bus_config(encoder, bus_format, 2, 3,
+   imx_ldb_ch->bus_flags);
 }

 static void imx_ldb_encoder_commit(struct drm_encoder *encoder)
@@ -626,6 +630,7 @@ static int imx_ldb_bind(struct device *dev, struct device 
*master, void *data)
/* fallback to display-timings node */
ret = of_get_drm_display_mode(child,
  >mode,
+ 
>bus_flags,
  
OF_USE_NATIVE_MODE);
if (!ret)
channel->mode_valid = 1;
diff --git a/drivers/gpu/drm/imx/parallel-display.c 
b/drivers/gpu/drm/imx/parallel-display.c
index 4b2ec5d..f956387 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -35,6 +35,7 @@ struct imx_parallel_display {
void *edid;
int edid_len;
u32 bus_format;
+   u32 bus_flags;
struct drm_display_mode mode;
struct drm_panel *panel;
 };
@@ -56,8 +57,10 @@ static int imx_pd_connector_get_modes(struct drm_connector 
*connector)
struct drm_display_info *di = >display_info;

num_modes = imxpd->panel->funcs->get_modes(imxpd->panel);
-   if (!imxpd->bus_format && di->num_bus_formats)
+   if (!imxpd->bus_format && di->num_bus_formats) {
imxpd->bus_format = di->bus_formats[0];
+   imxpd->bus_flags = di->bus_flags;
+   }
if (num_modes > 0)
return num_modes;
}
@@ -75,6 +78,7 @@ static int imx_pd_connector_get_modes(struct drm_connector 
*connector)
return -EINVAL;

ret = of_get_drm_display_mode(np, >mode,
+ >bus_flags,
  OF_USE_NATIVE_MODE);
if (ret)
return ret;
@@ -110,7 +114,7 @@ static void 

[PATCHv4 2/3] drm: add a helper function to extract 'de-active' and 'pixelclk-active' from DT

2016-07-12 Thread Lothar Waßmann
add a helper function to extract information about pixel clock and DE
polarity from DT for use by of_get_drm_display_mode().
While at it, convert spaces to tabs in indentation in drm_modes.h.

Signed-off-by: Lothar Waßmann 
---
 drivers/gpu/drm/drm_modes.c | 15 +++
 include/drm/drm_modes.h |  3 ++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index fc5040a..51804e5 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -657,6 +657,21 @@ void drm_display_mode_to_videomode(const struct 
drm_display_mode *dmode,
 }
 EXPORT_SYMBOL_GPL(drm_display_mode_to_videomode);

+void drm_bus_flags_from_videomode(const struct videomode *vm, u32 *bus_flags)
+{
+   *bus_flags = 0;
+   if (vm->flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
+   *bus_flags |= DRM_BUS_FLAG_PIXDATA_POSEDGE;
+   if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+   *bus_flags |= DRM_BUS_FLAG_PIXDATA_NEGEDGE;
+
+   if (vm->flags & DISPLAY_FLAGS_DE_LOW)
+   *bus_flags |= DRM_BUS_FLAG_DE_LOW;
+   if (vm->flags & DISPLAY_FLAGS_DE_HIGH)
+   *bus_flags |= DRM_BUS_FLAG_DE_HIGH;
+}
+EXPORT_SYMBOL_GPL(drm_bus_flags_from_videomode);
+
 #ifdef CONFIG_OF
 /**
  * of_get_drm_display_mode - get a drm_display_mode from devicetree
diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
index ff48177..a8164d2 100644
--- a/include/drm/drm_modes.h
+++ b/include/drm/drm_modes.h
@@ -434,7 +434,7 @@ struct drm_cmdline_mode;
 struct drm_display_mode *drm_mode_create(struct drm_device *dev);
 void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
 void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
-   const struct drm_display_mode *in);
+  const struct drm_display_mode *in);
 int drm_mode_convert_umode(struct drm_display_mode *out,
   const struct drm_mode_modeinfo *in);
 void drm_mode_probed_add(struct drm_connector *connector, struct 
drm_display_mode *mode);
@@ -457,6 +457,7 @@ void drm_display_mode_from_videomode(const struct videomode 
*vm,
 struct drm_display_mode *dmode);
 void drm_display_mode_to_videomode(const struct drm_display_mode *dmode,
   struct videomode *vm);
+void drm_bus_flags_from_videomode(const struct videomode *vm, u32 *bus_flags);
 int of_get_drm_display_mode(struct device_node *np,
struct drm_display_mode *dmode,
int index);
-- 
2.1.4



[PATCHv4 1/3] drm/imx: parallel-display: check return code from of_get_drm_display_mode()

2016-07-12 Thread Lothar Waßmann
of_get_drm_display_mode() may fail. Check its return code and bail out
on error.

Signed-off-by: Lothar Waßmann 
---
 drivers/gpu/drm/imx/parallel-display.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/parallel-display.c 
b/drivers/gpu/drm/imx/parallel-display.c
index 2d1fd02..4b2ec5d 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -69,10 +69,16 @@ static int imx_pd_connector_get_modes(struct drm_connector 
*connector)

if (np) {
struct drm_display_mode *mode = drm_mode_create(connector->dev);
+   int ret;

if (!mode)
return -EINVAL;
-   of_get_drm_display_mode(np, >mode, OF_USE_NATIVE_MODE);
+
+   ret = of_get_drm_display_mode(np, >mode,
+ OF_USE_NATIVE_MODE);
+   if (ret)
+   return ret;
+
drm_mode_copy(mode, >mode);
mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
drm_mode_probed_add(connector, mode);
-- 
2.1.4



[PATCHv4 0/3] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver

2016-07-12 Thread Lothar Waßmann
The 'de-active' and 'pixelclk-active' DT properties are evaluated
by of_parse_display_timing() called from  of_get_drm_display_mode(),
but later lost in the conversion from videomode.flags to
drm_display_mode.flags.


Changes vs. v3:
  - split the patch as suggested by Daniel Vetter

Changes vs. v2:
  - removed patches which have already been applied
  - created a drm_bus_flags_from_videomode() helper to prevent code
duplication as suggested by Philipp Zabel

Changes vs. v1:
  - rebased on top of https://patchwork.kernel.org/patch/9113791/ as
per Philipp Zabel's request



[PATCHv3 1/1] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver

2016-07-12 Thread Lothar Waßmann
Hi,

On Wed, 25 May 2016 15:18:16 +0200 Lothar Waßmann wrote:
> The 'de-active' and 'pixelclk-active' DT properties are evaluated
> by of_parse_display_timing() called from  of_get_drm_display_mode(),
> but later lost in the conversion from videomode.flags to
> drm_display_mode.flags.
> Use an open coded version of of_get_drm_display_mode() to get access
> to these flags and make sure they are passed on to the ipu-di driver.
> 
> Changes vs. v2:
>   - removed patches which have already been applied
>   - created a drm_bus_flags_from_videomode() helper to prevent code
> duplication as suggested by Philipp Zabel
> 
> Changes vs. v1:
>   - rebased on top of https://patchwork.kernel.org/patch/9113791/ as
> per Philipp Zabel's request
> 
> GIT: [PATCHv2 1/3] drm/imx: imx-ldb: honor 'native-mode' property when
> GIT: [PATCHv2 2/3] drm/imx: convey the pixelclk-active and de-active flags
> GIT: [PATCHv2 3/3] drm/imx: remove dead code
> Signed-off-by: Lothar Waßmann 
> ---
>  drivers/gpu/drm/drm_modes.c| 20 +++-
>  drivers/gpu/drm/imx/imx-ldb.c  | 15 ++-
>  drivers/gpu/drm/imx/parallel-display.c | 16 +---
>  include/drm/drm_modes.h|  5 +++--
>  4 files changed, 45 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index 7def3d5..7c97d5b 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -655,6 +655,21 @@ void drm_display_mode_to_videomode(const struct 
> drm_display_mode *dmode,
>  }
>  EXPORT_SYMBOL_GPL(drm_display_mode_to_videomode);
>  
> +void drm_bus_flags_from_videomode(const struct videomode *vm, u32 *bus_flags)
> +{
> + *bus_flags = 0;
> + if (vm->flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
> + *bus_flags |= DRM_BUS_FLAG_PIXDATA_POSEDGE;
> + if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
> + *bus_flags |= DRM_BUS_FLAG_PIXDATA_NEGEDGE;
> +
> + if (vm->flags & DISPLAY_FLAGS_DE_LOW)
> + *bus_flags |= DRM_BUS_FLAG_DE_LOW;
> + if (vm->flags & DISPLAY_FLAGS_DE_HIGH)
> + *bus_flags |= DRM_BUS_FLAG_DE_HIGH;
> +}
> +EXPORT_SYMBOL_GPL(drm_bus_flags_from_videomode);
> +
>  #ifdef CONFIG_OF
>  /**
>   * of_get_drm_display_mode - get a drm_display_mode from devicetree
> @@ -670,7 +685,8 @@ EXPORT_SYMBOL_GPL(drm_display_mode_to_videomode);
>   * 0 on success, a negative errno code when no of videomode node was found.
>   */
>  int of_get_drm_display_mode(struct device_node *np,
> - struct drm_display_mode *dmode, int index)
> + struct drm_display_mode *dmode, u32 *bus_flags,
> + int index)
>  {
>   struct videomode vm;
>   int ret;
> @@ -680,6 +696,8 @@ int of_get_drm_display_mode(struct device_node *np,
>   return ret;
>  
>   drm_display_mode_from_videomode(, dmode);
> + if (bus_flags)
> + drm_bus_flags_from_videomode(, bus_flags);
>  
>   pr_debug("%s: got %dx%d display mode from %s\n",
>   of_node_full_name(np), vm.hactive, vm.vactive, np->name);
> diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
> index b2dc4df..bb9d745 100644
> --- a/drivers/gpu/drm/imx/imx-ldb.c
> +++ b/drivers/gpu/drm/imx/imx-ldb.c
> @@ -65,7 +65,8 @@ struct imx_ldb_channel {
>   int edid_len;
>   struct drm_display_mode mode;
>   int mode_valid;
> - int bus_format;
> + u32 bus_format;
> + u32 bus_flags;
>  };
>  
>  struct bus_mux {
> @@ -102,8 +103,10 @@ static int imx_ldb_connector_get_modes(struct 
> drm_connector *connector)
>   struct drm_display_info *di = >display_info;
>  
>   num_modes = 
> imx_ldb_ch->panel->funcs->get_modes(imx_ldb_ch->panel);
> - if (!imx_ldb_ch->bus_format && di->num_bus_formats)
> + if (!imx_ldb_ch->bus_format && di->num_bus_formats) {
>   imx_ldb_ch->bus_format = di->bus_formats[0];
> + imx_ldb_ch->bus_flags = di->bus_flags;
> + }
>   if (num_modes > 0)
>   return num_modes;
>   }
> @@ -202,7 +205,8 @@ static void imx_ldb_encoder_prepare(struct drm_encoder 
> *encoder)
>   break;
>   }
>  
> - imx_drm_set_bus_format(encoder, bus_format);
> + imx_drm_set_bus_config(encoder, bus_format, 2, 3,
> + imx_ldb_ch->bus_flags);
>  }
>  
>  static void imx_ldb_encoder_commit(struct drm_encoder *encoder)
> @@ -558,7 +562,7 @@ static int imx_ldb_bind(struct device *dev, struct device 
> *master, void *data)
>  
>   ret = of_property_read_u32(child, "reg", );
>   if (ret || i < 0 || i > 1)
> - return -EINVAL;
> + return ret ?: -EINVAL;
>  
>   if (dual && i > 0) {
>   dev_warn(dev, "dual-channel mode, ignoring second 
> output\n");
> @@ -602,7 

[PATCHv3 1/1] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver

2016-05-25 Thread Lothar Waßmann
The 'de-active' and 'pixelclk-active' DT properties are evaluated
by of_parse_display_timing() called from  of_get_drm_display_mode(),
but later lost in the conversion from videomode.flags to
drm_display_mode.flags.
Use an open coded version of of_get_drm_display_mode() to get access
to these flags and make sure they are passed on to the ipu-di driver.

Changes vs. v2:
  - removed patches which have already been applied
  - created a drm_bus_flags_from_videomode() helper to prevent code
duplication as suggested by Philipp Zabel

Changes vs. v1:
  - rebased on top of https://patchwork.kernel.org/patch/9113791/ as
per Philipp Zabel's request

GIT: [PATCHv2 1/3] drm/imx: imx-ldb: honor 'native-mode' property when
GIT: [PATCHv2 2/3] drm/imx: convey the pixelclk-active and de-active flags
GIT: [PATCHv2 3/3] drm/imx: remove dead code
Signed-off-by: Lothar Waßmann 
---
 drivers/gpu/drm/drm_modes.c| 20 +++-
 drivers/gpu/drm/imx/imx-ldb.c  | 15 ++-
 drivers/gpu/drm/imx/parallel-display.c | 16 +---
 include/drm/drm_modes.h|  5 +++--
 4 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 7def3d5..7c97d5b 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -655,6 +655,21 @@ void drm_display_mode_to_videomode(const struct 
drm_display_mode *dmode,
 }
 EXPORT_SYMBOL_GPL(drm_display_mode_to_videomode);

+void drm_bus_flags_from_videomode(const struct videomode *vm, u32 *bus_flags)
+{
+   *bus_flags = 0;
+   if (vm->flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
+   *bus_flags |= DRM_BUS_FLAG_PIXDATA_POSEDGE;
+   if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+   *bus_flags |= DRM_BUS_FLAG_PIXDATA_NEGEDGE;
+
+   if (vm->flags & DISPLAY_FLAGS_DE_LOW)
+   *bus_flags |= DRM_BUS_FLAG_DE_LOW;
+   if (vm->flags & DISPLAY_FLAGS_DE_HIGH)
+   *bus_flags |= DRM_BUS_FLAG_DE_HIGH;
+}
+EXPORT_SYMBOL_GPL(drm_bus_flags_from_videomode);
+
 #ifdef CONFIG_OF
 /**
  * of_get_drm_display_mode - get a drm_display_mode from devicetree
@@ -670,7 +685,8 @@ EXPORT_SYMBOL_GPL(drm_display_mode_to_videomode);
  * 0 on success, a negative errno code when no of videomode node was found.
  */
 int of_get_drm_display_mode(struct device_node *np,
-   struct drm_display_mode *dmode, int index)
+   struct drm_display_mode *dmode, u32 *bus_flags,
+   int index)
 {
struct videomode vm;
int ret;
@@ -680,6 +696,8 @@ int of_get_drm_display_mode(struct device_node *np,
return ret;

drm_display_mode_from_videomode(, dmode);
+   if (bus_flags)
+   drm_bus_flags_from_videomode(, bus_flags);

pr_debug("%s: got %dx%d display mode from %s\n",
of_node_full_name(np), vm.hactive, vm.vactive, np->name);
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index b2dc4df..bb9d745 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -65,7 +65,8 @@ struct imx_ldb_channel {
int edid_len;
struct drm_display_mode mode;
int mode_valid;
-   int bus_format;
+   u32 bus_format;
+   u32 bus_flags;
 };

 struct bus_mux {
@@ -102,8 +103,10 @@ static int imx_ldb_connector_get_modes(struct 
drm_connector *connector)
struct drm_display_info *di = >display_info;

num_modes = 
imx_ldb_ch->panel->funcs->get_modes(imx_ldb_ch->panel);
-   if (!imx_ldb_ch->bus_format && di->num_bus_formats)
+   if (!imx_ldb_ch->bus_format && di->num_bus_formats) {
imx_ldb_ch->bus_format = di->bus_formats[0];
+   imx_ldb_ch->bus_flags = di->bus_flags;
+   }
if (num_modes > 0)
return num_modes;
}
@@ -202,7 +205,8 @@ static void imx_ldb_encoder_prepare(struct drm_encoder 
*encoder)
break;
}

-   imx_drm_set_bus_format(encoder, bus_format);
+   imx_drm_set_bus_config(encoder, bus_format, 2, 3,
+   imx_ldb_ch->bus_flags);
 }

 static void imx_ldb_encoder_commit(struct drm_encoder *encoder)
@@ -558,7 +562,7 @@ static int imx_ldb_bind(struct device *dev, struct device 
*master, void *data)

ret = of_property_read_u32(child, "reg", );
if (ret || i < 0 || i > 1)
-   return -EINVAL;
+   return ret ?: -EINVAL;

if (dual && i > 0) {
dev_warn(dev, "dual-channel mode, ignoring second 
output\n");
@@ -602,7 +606,8 @@ static int imx_ldb_bind(struct device *dev, struct device 
*master, void *data)
GFP_KERNEL);
} else if (!channel->panel) {
ret = 

[PATCHv2 2/3] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver

2016-05-25 Thread Lothar Waßmann
Hi,

On Tue, 24 May 2016 16:16:40 +0200 Philipp Zabel wrote:
> Hi Lothar,
> 
> thank you for rebasing. I have applied the other two patches.
> With this one, I'd like to avoid the duplicated code. See below:
> 
> Am Dienstag, den 24.05.2016, 08:31 +0200 schrieb Lothar Waßmann:
> > Currently these flags are lost in the call
> > drm_display_mode_from_videomode()
> > 
> > Signed-off-by: Lothar Waßmann 
> > ---
> >  drivers/gpu/drm/imx/imx-ldb.c  | 37 
> > ++
> >  drivers/gpu/drm/imx/parallel-display.c | 31 
> >  2 files changed, 56 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
> > index b2dc4df..b17a246 100644
> > --- a/drivers/gpu/drm/imx/imx-ldb.c
> > +++ b/drivers/gpu/drm/imx/imx-ldb.c
> [...]
> > @@ -601,10 +606,26 @@ static int imx_ldb_bind(struct device *dev, struct 
> > device *master, void *data)
> > channel->edid = kmemdup(edidp, channel->edid_len,
> > GFP_KERNEL);
> > } else if (!channel->panel) {
> > -   ret = of_get_drm_display_mode(child, >mode,
> > -   OF_USE_NATIVE_MODE);
> > -   if (!ret)
> > -   channel->mode_valid = 1;
> > +   struct videomode vm;
> > +
> > +   ret = of_get_videomode(child, , OF_USE_NATIVE_MODE);
> > +   if (ret)
> > +   return ret;
> > +   drm_display_mode_from_videomode(, >mode);
> > +
> > +   if (vm.flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
> > +   channel->bus_flags |= 
> > DRM_BUS_FLAG_PIXDATA_POSEDGE;
> > +   if (vm.flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
> > +   channel->bus_flags |= 
> > DRM_BUS_FLAG_PIXDATA_NEGEDGE;
> > +
> > +   if (vm.flags & DISPLAY_FLAGS_DE_LOW)
> > +   channel->bus_flags |= DRM_BUS_FLAG_DE_LOW;
> > +   if (vm.flags & DISPLAY_FLAGS_DE_HIGH)
> > +   channel->bus_flags |= DRM_BUS_FLAG_DE_HIGH;
> > +
> > +   drm_mode_debug_printmodeline(>mode);
> > +   channel->mode_valid = 1;
> [...]
> > @@ -81,10 +87,27 @@ static int imx_pd_connector_get_modes(struct 
> > drm_connector *connector)
> >  
> > if (np) {
> > struct drm_display_mode *mode = drm_mode_create(connector->dev);
> > +   struct videomode vm;
> > +   int ret;
> >  
> > if (!mode)
> > return -EINVAL;
> > -   of_get_drm_display_mode(np, >mode, OF_USE_NATIVE_MODE);
> > +
> > +   ret = of_get_videomode(np, , OF_USE_NATIVE_MODE);
> > +   if (ret)
> > +   return ret;
> > +   drm_display_mode_from_videomode(, >mode);
> > +   drm_mode_debug_printmodeline(>mode);
> > +
> > +   if (vm.flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
> > +   imxpd->bus_flags |= DRM_BUS_FLAG_PIXDATA_POSEDGE;
> > +   if (vm.flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
> > +   imxpd->bus_flags |= DRM_BUS_FLAG_PIXDATA_NEGEDGE;
> > +
> > +   if (vm.flags & DISPLAY_FLAGS_DE_LOW)
> > +   imxpd->bus_flags |= DRM_BUS_FLAG_DE_LOW;
> > +   if (vm.flags & DISPLAY_FLAGS_DE_HIGH)
> > +   imxpd->bus_flags |= DRM_BUS_FLAG_DE_HIGH;
> 
> This could be shared between ldb and parallel drivers if you extended
> of_get_drm_display_mode to also return bus_flags, for example. The flags
> translation could be put into a drm_bus_flags_from_videomode helper.
> 
I had that in mind also, but hesitated to change the generic
of_get_drm_display_mode() to implement some i.MX specific functionality.


Lothar Waßmann


[PATCHv2 3/3] drm/imx: remove dead code

2016-05-24 Thread Lothar Waßmann
The 'mode_valid' flag is never set in this driver. Remove it and the
code that depends on it.

Signed-off-by: Lothar Waßmann 
---
 drivers/gpu/drm/imx/parallel-display.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/imx/parallel-display.c 
b/drivers/gpu/drm/imx/parallel-display.c
index 238057b..10afba8 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -39,7 +39,6 @@ struct imx_parallel_display {
int edid_len;
u32 bus_format;
u32 bus_flags;
-   int mode_valid;
struct drm_display_mode mode;
struct drm_panel *panel;
 };
@@ -74,17 +73,6 @@ static int imx_pd_connector_get_modes(struct drm_connector 
*connector)
num_modes = drm_add_edid_modes(connector, imxpd->edid);
}

-   if (imxpd->mode_valid) {
-   struct drm_display_mode *mode = drm_mode_create(connector->dev);
-
-   if (!mode)
-   return -EINVAL;
-   drm_mode_copy(mode, >mode);
-   mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
-   drm_mode_probed_add(connector, mode);
-   num_modes++;
-   }
-
if (np) {
struct drm_display_mode *mode = drm_mode_create(connector->dev);
struct videomode vm;
-- 
2.1.4



[PATCHv2 2/3] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver

2016-05-24 Thread Lothar Waßmann
Currently these flags are lost in the call
drm_display_mode_from_videomode()

Signed-off-by: Lothar Waßmann 
---
 drivers/gpu/drm/imx/imx-ldb.c  | 37 ++
 drivers/gpu/drm/imx/parallel-display.c | 31 
 2 files changed, 56 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index b2dc4df..b17a246 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 

@@ -65,7 +66,8 @@ struct imx_ldb_channel {
int edid_len;
struct drm_display_mode mode;
int mode_valid;
-   int bus_format;
+   u32 bus_format;
+   u32 bus_flags;
 };

 struct bus_mux {
@@ -102,8 +104,10 @@ static int imx_ldb_connector_get_modes(struct 
drm_connector *connector)
struct drm_display_info *di = >display_info;

num_modes = 
imx_ldb_ch->panel->funcs->get_modes(imx_ldb_ch->panel);
-   if (!imx_ldb_ch->bus_format && di->num_bus_formats)
+   if (!imx_ldb_ch->bus_format && di->num_bus_formats) {
imx_ldb_ch->bus_format = di->bus_formats[0];
+   imx_ldb_ch->bus_flags = di->bus_flags;
+   }
if (num_modes > 0)
return num_modes;
}
@@ -202,7 +206,8 @@ static void imx_ldb_encoder_prepare(struct drm_encoder 
*encoder)
break;
}

-   imx_drm_set_bus_format(encoder, bus_format);
+   imx_drm_set_bus_config(encoder, bus_format, 2, 3,
+   imx_ldb_ch->bus_flags);
 }

 static void imx_ldb_encoder_commit(struct drm_encoder *encoder)
@@ -558,7 +563,7 @@ static int imx_ldb_bind(struct device *dev, struct device 
*master, void *data)

ret = of_property_read_u32(child, "reg", );
if (ret || i < 0 || i > 1)
-   return -EINVAL;
+   return ret ?: -EINVAL;

if (dual && i > 0) {
dev_warn(dev, "dual-channel mode, ignoring second 
output\n");
@@ -601,10 +606,26 @@ static int imx_ldb_bind(struct device *dev, struct device 
*master, void *data)
channel->edid = kmemdup(edidp, channel->edid_len,
GFP_KERNEL);
} else if (!channel->panel) {
-   ret = of_get_drm_display_mode(child, >mode,
-   OF_USE_NATIVE_MODE);
-   if (!ret)
-   channel->mode_valid = 1;
+   struct videomode vm;
+
+   ret = of_get_videomode(child, , OF_USE_NATIVE_MODE);
+   if (ret)
+   return ret;
+
+   drm_display_mode_from_videomode(, >mode);
+
+   if (vm.flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
+   channel->bus_flags |= 
DRM_BUS_FLAG_PIXDATA_POSEDGE;
+   if (vm.flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+   channel->bus_flags |= 
DRM_BUS_FLAG_PIXDATA_NEGEDGE;
+
+   if (vm.flags & DISPLAY_FLAGS_DE_LOW)
+   channel->bus_flags |= DRM_BUS_FLAG_DE_LOW;
+   if (vm.flags & DISPLAY_FLAGS_DE_HIGH)
+   channel->bus_flags |= DRM_BUS_FLAG_DE_HIGH;
+
+   drm_mode_debug_printmodeline(>mode);
+   channel->mode_valid = 1;
}

channel->bus_format = of_get_bus_format(dev, child);
diff --git a/drivers/gpu/drm/imx/parallel-display.c 
b/drivers/gpu/drm/imx/parallel-display.c
index 3db634d..238057b 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -19,9 +19,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
-#include 
+#include 
+#include 

 #include "imx-drm.h"

@@ -35,6 +38,7 @@ struct imx_parallel_display {
void *edid;
int edid_len;
u32 bus_format;
+   u32 bus_flags;
int mode_valid;
struct drm_display_mode mode;
struct drm_panel *panel;
@@ -57,8 +61,10 @@ static int imx_pd_connector_get_modes(struct drm_connector 
*connector)
struct drm_display_info *di = >display_info;

num_modes = imxpd->panel->funcs->get_modes(imxpd->panel);
-   if (!imxpd->bus_format && di->num_bus_formats)
+   if (!imxpd->bus_format && di->num_bus_formats) {
imxpd->bus_format = di->bus_formats[0];
+   imxpd->bus_flags = di->bus_flags;
+   }
if (num_modes > 0)
return num_modes;
}
@@ -81,10 +87,27 @@ static int imx_pd_connector_get_modes(struct 

[PATCHv2 1/3] drm/imx: imx-ldb: honor 'native-mode' property when selecting video mode from DT

2016-05-24 Thread Lothar Waßmann
This patch allows to select a specific video mode from a list of modes
defined in DT by setting the 'native-mode' property appropriately.

This change does not affect the behaviour of existing platforms, since
they either:
   - have just one display-timings subnode
   - have the native-mode property pointing to the first entry
   - let the bootloader select the appropriate timing

Signed-off-by: Lothar Waßmann 
---
 drivers/gpu/drm/imx/imx-ldb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index a58eee5..b2dc4df 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -600,7 +601,8 @@ static int imx_ldb_bind(struct device *dev, struct device 
*master, void *data)
channel->edid = kmemdup(edidp, channel->edid_len,
GFP_KERNEL);
} else if (!channel->panel) {
-   ret = of_get_drm_display_mode(child, >mode, 0);
+   ret = of_get_drm_display_mode(child, >mode,
+   OF_USE_NATIVE_MODE);
if (!ret)
channel->mode_valid = 1;
}
-- 
2.1.4



[PATCHv2 0/3] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver

2016-05-24 Thread Lothar Waßmann
The 'de-active' and 'pixelclk-active' DT properties are evaluated
by of_parse_display_timing() called from  of_get_drm_display_mode(),
but later lost in the conversion from videomode.flags to
drm_display_mode.flags.
Use an open coded version of of_get_drm_display_mode() to get access
to these flags and make sure they are passed on to the ipu-di driver.


The first patch in this series makes sure, the imx-ldb driver honors
the 'native-mode' property in DT (like the parallel-display driver
does already).

The third patch removes some dead code in the parallel-display driver,
hat depends on a variable which is never assigned a non-zero value and
thus can never be reached.


Changes vs. v1:
  - rebased on top of https://patchwork.kernel.org/patch/9113791/ as
per Philipp Zabel's request



[PATCH 3/3] drm/imx: remove dead code

2016-05-20 Thread Lothar Waßmann
The 'mode_valid' flag is never set in this driver. Remove it and the
code that depends on it.

Signed-off-by: Lothar Waßmann 
---
 drivers/gpu/drm/imx/parallel-display.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/imx/parallel-display.c 
b/drivers/gpu/drm/imx/parallel-display.c
index 440f34d..e37d0e6 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -39,7 +39,6 @@ struct imx_parallel_display {
int edid_len;
u32 bus_format;
u32 bus_flags;
-   int mode_valid;
struct drm_display_mode mode;
struct drm_panel *panel;
 };
@@ -74,17 +73,6 @@ static int imx_pd_connector_get_modes(struct drm_connector 
*connector)
num_modes = drm_add_edid_modes(connector, imxpd->edid);
}

-   if (imxpd->mode_valid) {
-   struct drm_display_mode *mode = drm_mode_create(connector->dev);
-
-   if (!mode)
-   return -EINVAL;
-   drm_mode_copy(mode, >mode);
-   mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
-   drm_mode_probed_add(connector, mode);
-   num_modes++;
-   }
-
if (np) {
struct drm_display_mode *mode = drm_mode_create(connector->dev);
struct videomode vm;
-- 
2.1.4



[PATCH 2/3] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver

2016-05-20 Thread Lothar Waßmann
Currently these flags are lost in the call
drm_display_mode_from_videomode()

Signed-off-by: Lothar Waßmann 
---
 drivers/gpu/drm/imx/imx-drm-core.c | 12 +++
 drivers/gpu/drm/imx/imx-drm.h  |  7 ---
 drivers/gpu/drm/imx/imx-ldb.c  | 37 ++
 drivers/gpu/drm/imx/ipuv3-crtc.c   |  7 ---
 drivers/gpu/drm/imx/parallel-display.c | 31 
 drivers/gpu/ipu-v3/ipu-di.c| 14 +++--
 include/video/imx-ipu-v3.h |  5 +
 7 files changed, 81 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c 
b/drivers/gpu/drm/imx/imx-drm-core.c
index 2453fb1..51735b1 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -96,7 +96,8 @@ static struct imx_drm_crtc *imx_drm_find_crtc(struct drm_crtc 
*crtc)
return NULL;
 }

-int imx_drm_set_bus_format_pins(struct drm_encoder *encoder, u32 bus_format,
+int imx_drm_set_bus_format_pins(struct drm_encoder *encoder,
+   u32 bus_format, u32 bus_flags,
int hsync_pin, int vsync_pin)
 {
struct imx_drm_crtc_helper_funcs *helper;
@@ -109,14 +110,17 @@ int imx_drm_set_bus_format_pins(struct drm_encoder 
*encoder, u32 bus_format,
helper = _crtc->imx_drm_helper_funcs;
if (helper->set_interface_pix_fmt)
return helper->set_interface_pix_fmt(encoder->crtc,
-   bus_format, hsync_pin, vsync_pin);
+   bus_format, bus_flags,
+   hsync_pin, vsync_pin);
return 0;
 }
 EXPORT_SYMBOL_GPL(imx_drm_set_bus_format_pins);

-int imx_drm_set_bus_format(struct drm_encoder *encoder, u32 bus_format)
+int imx_drm_set_bus_format(struct drm_encoder *encoder, u32 bus_format,
+   u32 bus_flags)
 {
-   return imx_drm_set_bus_format_pins(encoder, bus_format, 2, 3);
+   return imx_drm_set_bus_format_pins(encoder, bus_format, bus_flags,
+   2, 3);
 }
 EXPORT_SYMBOL_GPL(imx_drm_set_bus_format);

diff --git a/drivers/gpu/drm/imx/imx-drm.h b/drivers/gpu/drm/imx/imx-drm.h
index b0241b9..b74baf7 100644
--- a/drivers/gpu/drm/imx/imx-drm.h
+++ b/drivers/gpu/drm/imx/imx-drm.h
@@ -19,7 +19,8 @@ struct imx_drm_crtc_helper_funcs {
int (*enable_vblank)(struct drm_crtc *crtc);
void (*disable_vblank)(struct drm_crtc *crtc);
int (*set_interface_pix_fmt)(struct drm_crtc *crtc,
-   u32 bus_format, int hsync_pin, int vsync_pin);
+   u32 bus_format, u32 bus_flags,
+   int hsync_pin, int vsync_pin);
const struct drm_crtc_helper_funcs *crtc_helper_funcs;
const struct drm_crtc_funcs *crtc_funcs;
 };
@@ -42,9 +43,9 @@ void imx_drm_mode_config_init(struct drm_device *drm);
 struct drm_gem_cma_object *imx_drm_fb_get_obj(struct drm_framebuffer *fb);

 int imx_drm_set_bus_format_pins(struct drm_encoder *encoder,
-   u32 bus_format, int hsync_pin, int vsync_pin);
+   u32 bus_format, u32 bus_flags, int hsync_pin, int vsync_pin);
 int imx_drm_set_bus_format(struct drm_encoder *encoder,
-   u32 bus_format);
+   u32 bus_format, u32 bus_flags);

 int imx_drm_encoder_parse_of(struct drm_device *drm,
struct drm_encoder *encoder, struct device_node *np);
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index b2dc4df..67706eea 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 

@@ -65,7 +66,8 @@ struct imx_ldb_channel {
int edid_len;
struct drm_display_mode mode;
int mode_valid;
-   int bus_format;
+   u32 bus_format;
+   u32 bus_flags;
 };

 struct bus_mux {
@@ -102,8 +104,10 @@ static int imx_ldb_connector_get_modes(struct 
drm_connector *connector)
struct drm_display_info *di = >display_info;

num_modes = 
imx_ldb_ch->panel->funcs->get_modes(imx_ldb_ch->panel);
-   if (!imx_ldb_ch->bus_format && di->num_bus_formats)
+   if (!imx_ldb_ch->bus_format && di->num_bus_formats) {
imx_ldb_ch->bus_format = di->bus_formats[0];
+   imx_ldb_ch->bus_flags = di->bus_flags;
+   }
if (num_modes > 0)
return num_modes;
}
@@ -202,7 +206,8 @@ static void imx_ldb_encoder_prepare(struct drm_encoder 
*encoder)
break;
}

-   imx_drm_set_bus_format(encoder, bus_format);
+   imx_drm_set_bus_format(encoder, bus_format,
+   imx_ldb_ch->bus_flags);
 }

 static void imx_ldb_encoder_commit(struct drm_encoder *encoder)
@@ -558,7 +563,7 @@ static int imx_ldb_bind(struct device *dev, struct device 
*master, void *data)


[PATCH 1/3] drm/imx: imx-ldb: honor 'native-mode' property when selecting video mode from DT

2016-05-20 Thread Lothar Waßmann
This patch allows to select a specific video mode from a list of modes
defined in DT by setting the 'native-mode' property appropriately.

This change does not affect the behaviour of existing platforms, since
they either:
   - have just one display-timings subnode
   - have the native-mode property pointing to the first entry
   - let the bootloader select the appropriate timing

Signed-off-by: Lothar Waßmann 
---
 drivers/gpu/drm/imx/imx-ldb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index a58eee5..b2dc4df 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -600,7 +601,8 @@ static int imx_ldb_bind(struct device *dev, struct device 
*master, void *data)
channel->edid = kmemdup(edidp, channel->edid_len,
GFP_KERNEL);
} else if (!channel->panel) {
-   ret = of_get_drm_display_mode(child, >mode, 0);
+   ret = of_get_drm_display_mode(child, >mode,
+   OF_USE_NATIVE_MODE);
if (!ret)
channel->mode_valid = 1;
}
-- 
2.1.4



[PATCH 0/3] drm/imx: convey the pixelclk-active and de-active flags to the ipu-di driver

2016-05-20 Thread Lothar Waßmann
The 'de-active' and 'pixelclk-active' DT properties are evaluated
by of_parse_display_timing() called from  of_get_drm_display_mode(),
but later lost in the conversion from videomode.flags to
drm_display_mode.flags.
Use an open coded version of of_get_drm_display_mode() to get access
to these flags and make sure they are passed on to the ipu-di driver.
This patch also makes sure, that the 'bus_flags' specified in the
simple-panel driver will be passed on from the ipu-di driver.

The first patch in this series makes sure, the imx-ldb driver honors
the 'native-mode' property in DT (like the parallel-display driver
does already).

The third patch removes some dead code in the parallel-display driver,
hat depends on a variable which is never assigned a non-zero value and
thus can never be reached.


[PATCH v2] drm/imx: Match imx-ipuv3-crtc components using device node in platform data

2016-05-18 Thread Lothar Waßmann
Hi,

On Wed, 18 May 2016 14:56:40 +0200 Philipp Zabel wrote:
> The component master driver imx-drm-core matches component devices using
> their of_node. Since commit 950b410dd1ab ("gpu: ipu-v3: Fix imx-ipuv3-crtc
> module autoloading"), the imx-ipuv3-crtc dev->of_node is not set during
> probing. Before that, of_node was set and caused an of: modalias to be
> used instead of the platform: modalias, which broke module autoloading.
> 
> On the other hand, if dev->of_node is not set yet when the imx-ipuv3-crtc
> probe function calls component_add, component matching in imx-drm-core
> fails. While dev->of_node will be set once the next component tries to
> bring up the component master, imx-drm-core component binding will never
> succeed if one of the crtc devices is probed last.
> 
> Add of_node to the component platform data and match against the
> pdata->of_node instead of dev->of_node in imx-drm-core to work around
> this problem.
> 
> Cc:  # 4.4.x
> Fixes: 950b410dd1ab ("gpu: ipu-v3: Fix imx-ipuv3-crtc module autoloading")
> Signed-off-by: Philipp Zabel 
> ---
> Changes since v1:
>  - Also set the crtc->port to the of_node from platform data
> ---
>  drivers/gpu/drm/imx/imx-drm-core.c | 8 
>  drivers/gpu/drm/imx/ipuv3-crtc.c   | 2 +-
>  drivers/gpu/ipu-v3/ipu-common.c| 5 +++--
>  include/video/imx-ipu-v3.h | 2 ++
>  4 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c 
> b/drivers/gpu/drm/imx/imx-drm-core.c
> index e26dcde..05229b9 100644
> --- a/drivers/gpu/drm/imx/imx-drm-core.c
> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> @@ -25,6 +25,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "imx-drm.h"
>  
> @@ -444,6 +445,13 @@ static int compare_of(struct device *dev, void *data)
>  {
>   struct device_node *np = data;
>  
> + /* Special case for DI, dev->of_node may not be set yet */
> + if (strcmp(dev->driver->name, "imx-ipuv3-crtc") == 0) {
> + struct ipu_client_platformdata *pdata = dev->platform_data;
> +
> + return pdata->of_node == np;
> + }
> +
>   /* Special case for LDB, one device for two channels */
>   if (of_node_cmp(np->name, "lvds-channel") == 0) {
>   np = of_get_parent(np);
> diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c 
> b/drivers/gpu/drm/imx/ipuv3-crtc.c
> index dee8e8b..b2c30b8 100644
> --- a/drivers/gpu/drm/imx/ipuv3-crtc.c
> +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
> @@ -473,7 +473,7 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc,
>  
>   ret = imx_drm_add_crtc(drm, _crtc->base, _crtc->imx_crtc,
>   _crtc->plane[0]->base, _crtc_helper_funcs,
> - ipu_crtc->dev->of_node);
> + pdata->of_node);
>   if (ret) {
>   dev_err(ipu_crtc->dev, "adding crtc failed with %d.\n", ret);
>   goto err_put_resources;
> diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
> index abb98c7..99dcacf 100644
> --- a/drivers/gpu/ipu-v3/ipu-common.c
> +++ b/drivers/gpu/ipu-v3/ipu-common.c
> @@ -997,7 +997,7 @@ struct ipu_platform_reg {
>  };
>  
>  /* These must be in the order of the corresponding device tree port nodes */
> -static const struct ipu_platform_reg client_reg[] = {
> +static struct ipu_platform_reg client_reg[] = {
>   {
>   .pdata = {
>   .csi = 0,
> @@ -1048,7 +1048,7 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, 
> unsigned long ipu_base)
>   mutex_unlock(_client_id_mutex);
>  
>   for (i = 0; i < ARRAY_SIZE(client_reg); i++) {
> - const struct ipu_platform_reg *reg = _reg[i];
> + struct ipu_platform_reg *reg = _reg[i];
>   struct platform_device *pdev;
>   struct device_node *of_node;
>  
> @@ -1070,6 +1070,7 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, 
> unsigned long ipu_base)
>  
>   pdev->dev.parent = dev;
>  
> + reg->pdata.of_node = of_node;
>   ret = platform_device_add_data(pdev, >pdata,
>  sizeof(reg->pdata));
>   if (!ret)
> diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
> index ad66589..3a2a794 100644
> --- a/include/video/imx-ipu-v3.h
> +++ b/include/video/imx-ipu-v3.h
> @@ -16,6 +16,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -345,6 +346,7 @@ struct ipu_client_platformdata {
>   int dc;
>   int dp;
>   int dma[2];
> + struct device_node *of_node;
>  };
>  
>  #endif /* __DRM_IPU_H__ */
>
This seems to be OK. I tested this patch with parallel-display and
imx-ldb modular and built-in.


Lothar Waßmann


imx-drm: regression due to commit 503fe87bd0a8 ("gpu: ipu-v3: Fix imx-ipuv3-crtc module autoloading")

2016-05-18 Thread Lothar Waßmann
Hi,

On Fri, 13 May 2016 13:04:12 +0200 Philipp Zabel wrote:
> Hi Lothar,
> 
> Am Freitag, den 13.05.2016, 12:33 +0200 schrieb Lothar Waßmann:
> > Hi,
> > 
> > the commit 503fe87bd0a8 ("gpu: ipu-v3: Fix imx-ipuv3-crtc module 
> > autoloading")
> > indeed fixes the autoloading issue, but completely breaks the driver in
> > non-modular mode (at least with the parallel-display driver I didn't
> > yet check with the imx-ldb driver.
> > Can anyone confirm that the imx-drm driver in current linux-next
> > (next-20160512) works for them with any i.MX6 or i.MX53 board?
> 
> I have sent a patch: https://patchwork.kernel.org/patch/9081661/
> that I'd appreciate your input on.
> 
This patch works for the parallel-display driver but not for imx-ldb
(I didn't test the TV or HDMI drivers). It works when the DRM driver is
built as modules, but when it is non-modular I get a framebuffer
device which is useable from userspace, but no output on the LVDS
interface.

When reverting 503fe87bd0a8346ba9d8b7f49115dcd0a4185226 instead of
applying the above patch, the builtin driver works normally.


Lothar Waßmann


imx-drm: regression due to commit 503fe87bd0a8 ("gpu: ipu-v3: Fix imx-ipuv3-crtc module autoloading")

2016-05-13 Thread Lothar Waßmann
Hi,

the commit 503fe87bd0a8 ("gpu: ipu-v3: Fix imx-ipuv3-crtc module autoloading")
indeed fixes the autoloading issue, but completely breaks the driver in
non-modular mode (at least with the parallel-display driver I didn't
yet check with the imx-ldb driver.
Can anyone confirm that the imx-drm driver in current linux-next
(next-20160512) works for them with any i.MX6 or i.MX53 board?

I'm always very suspicious when seeing code moving of_node's from
one device to another or assigning of_node's to platform devices that
weren't instantiated via DT.


Lothar Waßmann


[PATCH v12][ 06/12] ARM: dts: imx5*, imx6*: correct display-timings nodes.

2014-04-09 Thread Lothar Waßmann
Hi,

Shawn Guo wrote:
> On Mon, Apr 07, 2014 at 02:44:45PM +0200, Denis Carikli wrote:
> > The imx-drm driver can't use the de-active and
> > pixelclk-active display-timings properties yet.
> > 
> > Instead the data-enable and the pixel data clock
> > polarity are hardcoded in the imx-drm driver.
> > 
> > So theses properties are now set to keep
> > the same behaviour when imx-drm will start
> > using them.
> > 
> > Signed-off-by: Denis Carikli 
> > ---
> > ChangeLog v9->v10:
> > - New patch that was splitted out of:
> >   "staging imx-drm: Use de-active and pixelclk-active
> >   display-timings."
> > ---
> >  arch/arm/boot/dts/imx51-babbage.dts   |2 ++
> >  arch/arm/boot/dts/imx53-m53evk.dts|2 ++
> >  arch/arm/boot/dts/imx53-tx53-x03x.dts |2 +-
> >  arch/arm/boot/dts/imx6qdl-gw53xx.dtsi |2 ++
> >  arch/arm/boot/dts/imx6qdl-gw54xx.dtsi |2 ++
> >  arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi |2 ++
> >  arch/arm/boot/dts/imx6qdl-sabreauto.dtsi  |2 ++
> >  arch/arm/boot/dts/imx6qdl-sabrelite.dtsi  |2 ++
> >  arch/arm/boot/dts/imx6qdl-sabresd.dtsi|2 ++
> >  9 files changed, 17 insertions(+), 1 deletion(-)
> 
> ...
> 
> > diff --git a/arch/arm/boot/dts/imx53-tx53-x03x.dts 
> > b/arch/arm/boot/dts/imx53-tx53-x03x.dts
> > index 0217dde3..4092a81 100644
> > --- a/arch/arm/boot/dts/imx53-tx53-x03x.dts
> > +++ b/arch/arm/boot/dts/imx53-tx53-x03x.dts
> > @@ -93,7 +93,7 @@
> > hsync-active = <0>;
> > vsync-active = <0>;
> > de-active = <1>;
> > -   pixelclk-active = <1>;
> > +   pixelclk-active = <0>;
> 
> @Lothar, is this change correct?
> 
No, the ET0430 display which is affected by this patch actually has an
inverted clock wrt the other displays of the family.

'pixelclk-active = <1>' is the correct setting for this display!

Thanks, Shawn for the reminder.


Lothar Wa?mann
-- 
___

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___


[PATCH 07/12] drm: drm_display_mode: add signal polarity flags

2014-03-18 Thread Lothar Waßmann
Hi,

Laurent Pinchart wrote:
> Hi Lothar,
> 
> On Tuesday 18 March 2014 08:50:30 Lothar Wa?mann wrote:
> > Laurent Pinchart wrote:
> > > On Monday 17 March 2014 16:14:36 Lothar Wa?mann wrote:
> > > > Laurent Pinchart wrote:
> > > > > On Monday 17 March 2014 14:41:09 Andrzej Hajda wrote:
> > > > > > On 03/13/2014 06:17 PM, Denis Carikli wrote:
> > > > > > > We need a way to pass signal polarity informations
> > > > > > > between DRM panels, and the display drivers.
> > > > > > > 
> > > > > > > To do that, a pol_flags field was added to drm_display_mode.
> > > > > > > 
> > > > > > > Signed-off-by: Denis Carikli 
> > > > > > > ---
> > > > > > > ChangeLog v10->v11:
> > > > > > > - Since the imx-drm won't be able to retrive its regulators
> > > > > > > 
> > > > > > >   from the device tree when using display-timings nodes,
> > > > > > >   and that I was told that the drm simple-panel driver
> > > > > > >   already supported that, I then, instead, added what was
> > > > > > >   lacking to make the eukrea displays work with the
> > > > > > >   drm-simple-panel driver.
> > > > > > >   
> > > > > > >   That required a way to get back the display polarity
> > > > > > >   informations from the imx-drm driver without affecting
> > > > > > >   userspace.
> > > > > > > 
> > > > > > > ---
> > > > > > > 
> > > > > > >  include/drm/drm_crtc.h |8 
> > > > > > >  1 file changed, 8 insertions(+)
> > > > > > > 
> > > > > > > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> > > > > > > index f764654..61a4fe1 100644
> > > > > > > --- a/include/drm/drm_crtc.h
> > > > > > > +++ b/include/drm/drm_crtc.h
> > > > > > > @@ -131,6 +131,13 @@ enum drm_mode_status {
> > > > > > > 
> > > > > > >  #define DRM_MODE_FLAG_3D_MAX 
> > > > > > > DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
> > > > > > > 
> > > > > > > +#define DRM_MODE_FLAG_POL_PIXDATA_NEGEDGEBIT(1)
> > > > > > > +#define DRM_MODE_FLAG_POL_PIXDATA_POSEDGEBIT(2)
> > > > > > > +#define DRM_MODE_FLAG_POL_PIXDATA_PRESERVE   BIT(3)
> > > > > > > +#define DRM_MODE_FLAG_POL_DE_NEGEDGE BIT(4)
> > > > > > > +#define DRM_MODE_FLAG_POL_DE_POSEDGE BIT(5)
> > > > > > > +#define DRM_MODE_FLAG_POL_DE_PRESERVEBIT(6)
> > > > > > 
> > > > > > Could you add some description to these flags.
> > > > > > What are *_PRESERVE flags for?
> > > > > > Are those flags 1:1 compatible with respective 'videomode:flags'?
> > > > > > I guess DE flags should be rather DRM_MODE_FLAG_POL_DE_(LOW|HIGH),
> > > > > > am I right?
> > > > > 
> > > > > Possibly nitpicking, I wouldn't call the clock edge on which data
> > > > > signals are generated/sampled "data polarity". This is clock polarity
> > > > > information.
> > > > > 
> > > > > Have you seen cases where pixel data and DE are geenrated or need to
> > > > > be sampled on different edges ?
> > > > 
> > > > DE is not a clock signal, but an 'Enable' signal whose value (high or
> > > > low) defines the window in which the pixel data is valid.
> > > > The flag defines whether data is valid during the HIGH or LOW period of
> > > > DE.
> > > 
> > > The DRM_MODE_FLAG_POL_DE_(LOW|HIGH) do, by my impression of the proposed
> > > new DRM_MODE_FLAG_POL_DE_*EDGE flags is that they define sampling clock
> > > edges, not active levels.
> > 
> > The current naming of the flags gives the impression that they describe
> > the sampling edges of a clock signal. But the DE signal in fact is not
> > a clock signal but a level sensitive gating signal.
> 
> That's not my point. I *know* that DE is a data gating signal with a polarity 
> already defined by the DRM_MODE_FLAG_POL_DE_(LOW|HIGH) flags. Like all other 
> signals it gets generated on a clock edge and is sampled on a clock edge. The 
> DRM_MODE_FLAG_POL_DE_*EDGE flags proposed above describe seem to describe 
> just 
>
The important word here is 'seem'.


Lothar Wa?ann
-- 
___

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___


[PATCH 08/12] imx-drm: Use drm_display_mode timings flags.

2014-03-18 Thread Lothar Waßmann
Hi,

Denis Carikli wrote:
> The previous hardware behaviour was kept if the
> flags are not set.
> 
> Signed-off-by: Denis Carikli 
> ---
> ChangeLog v10->v11:
> - This patch was splitted-out and adapted from:
>   "Prepare imx-drm for extra display-timings retrival."
> - The display-timings dt specific part was removed.
> - The flags names were changed to use the DRM ones from:
>   "drm: drm_display_mode: add signal polarity flags"
> ---
>  drivers/staging/imx-drm/imx-drm-core.c  |   10 ++
>  drivers/staging/imx-drm/imx-drm.h   |6 ++
>  drivers/staging/imx-drm/imx-hdmi.c  |3 +++
>  drivers/staging/imx-drm/imx-ldb.c   |3 +++
>  drivers/staging/imx-drm/imx-tve.c   |3 +++
>  drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h |6 --
>  drivers/staging/imx-drm/ipu-v3/ipu-di.c |7 ++-
>  drivers/staging/imx-drm/ipuv3-crtc.c|   21 +++--
>  3 files changed, 29 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h 
> b/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
> index b95cba1..3abeea3 100644
> --- a/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
> +++ b/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
> @@ -29,9 +29,11 @@ enum ipuv3_type {
>  
>  #define CLK_POL_ACTIVE_LOW   0
>  #define CLK_POL_ACTIVE_HIGH  1
> +#define CLK_POL_PRESERVE 2
>  
>  #define ENABLE_POL_NEGEDGE   0
>  #define ENABLE_POL_POSEDGE   1
> +#define ENABLE_POL_PRESERVE  2
>  
>  /*
>   * Bitfield of Display Interface signal polarities.
> @@ -43,10 +45,10 @@ struct ipu_di_signal_cfg {
>   unsigned clksel_en:1;
>   unsigned clkidle_en:1;
>   unsigned data_pol:1;/* true = inverted */
> - unsigned clk_pol:1;
> - unsigned enable_pol:1;
>   unsigned Hsync_pol:1;   /* true = active high */
>   unsigned Vsync_pol:1;
> + u8 clk_pol;
> + u8 enable_pol;
>  
>   u16 width;
>   u16 height;
> diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-di.c 
> b/drivers/staging/imx-drm/ipu-v3/ipu-di.c
> index 53646aa..791080b 100644
> --- a/drivers/staging/imx-drm/ipu-v3/ipu-di.c
> +++ b/drivers/staging/imx-drm/ipu-v3/ipu-di.c
> @@ -597,6 +597,8 @@ int ipu_di_init_sync_panel(struct ipu_di *di, struct 
> ipu_di_signal_cfg *sig)
>  
>   if (sig->clk_pol == CLK_POL_ACTIVE_HIGH)
>   di_gen |= DI_GEN_POLARITY_DISP_CLK;
> + else if (sig->clk_pol == CLK_POL_ACTIVE_LOW)
> + di_gen &= ~DI_GEN_POLARITY_DISP_CLK;
>  
>   ipu_di_write(di, di_gen, DI_GENERAL);
>  
> @@ -604,10 +606,13 @@ int ipu_di_init_sync_panel(struct ipu_di *di, struct 
> ipu_di_signal_cfg *sig)
>DI_SYNC_AS_GEN);
>  
>   reg = ipu_di_read(di, DI_POL);
> - reg &= ~(DI_POL_DRDY_DATA_POLARITY | DI_POL_DRDY_POLARITY_15);
> + reg &= ~(DI_POL_DRDY_DATA_POLARITY);
>  
>   if (sig->enable_pol == ENABLE_POL_POSEDGE)
>   reg |= DI_POL_DRDY_POLARITY_15;
> + else if (sig->enable_pol == ENABLE_POL_NEGEDGE)
> + reg &= ~DI_POL_DRDY_POLARITY_15;
> +
>   if (sig->data_pol)
>   reg |= DI_POL_DRDY_DATA_POLARITY;
>  
> diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c 
> b/drivers/staging/imx-drm/ipuv3-crtc.c
> index 8cfeb47..c75034e 100644
> --- a/drivers/staging/imx-drm/ipuv3-crtc.c
> +++ b/drivers/staging/imx-drm/ipuv3-crtc.c
> @@ -157,8 +157,25 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc,
>   if (mode->flags & DRM_MODE_FLAG_PVSYNC)
>   sig_cfg.Vsync_pol = 1;
>  
> - sig_cfg.enable_pol = ENABLE_POL_POSEDGE;
> - sig_cfg.clk_pol = CLK_POL_ACTIVE_LOW;
> + if (mode->pol_flags & DRM_MODE_FLAG_POL_PIXDATA_POSEDGE)
> + sig_cfg.enable_pol = ENABLE_POL_POSEDGE;
> + else if (mode->pol_flags & DRM_MODE_FLAG_POL_DE_NEGEDGE)
> + sig_cfg.enable_pol = ENABLE_POL_NEGEDGE;
> + else if (mode->pol_flags & DRM_MODE_FLAG_POL_PIXDATA_PRESERVE)
> + sig_cfg.enable_pol = ENABLE_POL_PRESERVE;
> + else
> + sig_cfg.enable_pol = ENABLE_POL_POSEDGE;
> +
> + if (mode->private_flags & DRM_MODE_FLAG_POL_DE_POSEDGE)
> + sig_cfg.clk_pol = CLK_POL_ACTIVE_HIGH;
> + else if (mode->private_flags & DRM_MODE_FLAG_POL_DE_NEGEDGE)
> + sig_cfg.clk_pol = CLK_POL_ACTIVE_LOW;
> + else if (mode->private_flags & DRM_MODE_FLAG_POL_DE_PRESERVE)
> + sig_cfg.clk_pol = CLK_POL_PRESERVE;
> + else
> + sig_cfg.clk_pol = CLK_POL_ACTIVE_LOW;
>
This is completely messed up. POL_PIXDATA should obviously define the
clock edge at which the pixel data is sampled and thus should determine
the value of sig_cfg.clk_pol and POL_DE should determine the value of
sig_cfg.enable_pol.



Lothar Wa?mann
-- 
___

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, 

[PATCH 07/12] drm: drm_display_mode: add signal polarity flags

2014-03-18 Thread Lothar Waßmann
Hi,

Laurent Pinchart wrote:
> Hi Lothar,
> 
> On Monday 17 March 2014 16:14:36 Lothar Wa?mann wrote:
> > Laurent Pinchart wrote:
> > > On Monday 17 March 2014 14:41:09 Andrzej Hajda wrote:
> > > > On 03/13/2014 06:17 PM, Denis Carikli wrote:
> > > > > We need a way to pass signal polarity informations
> > > > > between DRM panels, and the display drivers.
> > > > > 
> > > > > To do that, a pol_flags field was added to drm_display_mode.
> > > > > 
> > > > > Signed-off-by: Denis Carikli 
> > > > > ---
> > > > > ChangeLog v10->v11:
> > > > > - Since the imx-drm won't be able to retrive its regulators
> > > > > 
> > > > >   from the device tree when using display-timings nodes,
> > > > >   and that I was told that the drm simple-panel driver
> > > > >   already supported that, I then, instead, added what was
> > > > >   lacking to make the eukrea displays work with the
> > > > >   drm-simple-panel driver.
> > > > >   
> > > > >   That required a way to get back the display polarity
> > > > >   informations from the imx-drm driver without affecting
> > > > >   userspace.
> > > > > 
> > > > > ---
> > > > > 
> > > > >  include/drm/drm_crtc.h |8 
> > > > >  1 file changed, 8 insertions(+)
> > > > > 
> > > > > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> > > > > index f764654..61a4fe1 100644
> > > > > --- a/include/drm/drm_crtc.h
> > > > > +++ b/include/drm/drm_crtc.h
> > > > > @@ -131,6 +131,13 @@ enum drm_mode_status {
> > > > > 
> > > > >  #define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
> > > > > 
> > > > > +#define DRM_MODE_FLAG_POL_PIXDATA_NEGEDGEBIT(1)
> > > > > +#define DRM_MODE_FLAG_POL_PIXDATA_POSEDGEBIT(2)
> > > > > +#define DRM_MODE_FLAG_POL_PIXDATA_PRESERVE   BIT(3)
> > > > > +#define DRM_MODE_FLAG_POL_DE_NEGEDGE BIT(4)
> > > > > +#define DRM_MODE_FLAG_POL_DE_POSEDGE BIT(5)
> > > > > +#define DRM_MODE_FLAG_POL_DE_PRESERVEBIT(6)
> > > > 
> > > > Could you add some description to these flags.
> > > > What are *_PRESERVE flags for?
> > > > Are those flags 1:1 compatible with respective 'videomode:flags'?
> > > > I guess DE flags should be rather DRM_MODE_FLAG_POL_DE_(LOW|HIGH), am I
> > > > right?
> > > 
> > > Possibly nitpicking, I wouldn't call the clock edge on which data signals
> > > are generated/sampled "data polarity". This is clock polarity
> > > information.
> > > 
> > > Have you seen cases where pixel data and DE are geenrated or need to be
> > > sampled on different edges ?
> > 
> > DE is not a clock signal, but an 'Enable' signal whose value (high or
> > low) defines the window in which the pixel data is valid.
> > The flag defines whether data is valid during the HIGH or LOW period of
> > DE.
> 
> The DRM_MODE_FLAG_POL_DE_(LOW|HIGH) do, by my impression of the proposed new 
> DRM_MODE_FLAG_POL_DE_*EDGE flags is that they define sampling clock edges, 
> not 
> active levels.
> 
The current naming of the flags gives the impression that they describe
the sampling edges of a clock signal. But the DE signal in fact is not
a clock signal but a level sensitive gating signal.


Lothar Wa?mann
-- 
___

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___


[PATCH 07/12] drm: drm_display_mode: add signal polarity flags

2014-03-17 Thread Lothar Waßmann
Hi,

Laurent Pinchart wrote:
> Hello,
> 
> On Monday 17 March 2014 14:41:09 Andrzej Hajda wrote:
> > On 03/13/2014 06:17 PM, Denis Carikli wrote:
> > > We need a way to pass signal polarity informations
> > > between DRM panels, and the display drivers.
> > > 
> > > To do that, a pol_flags field was added to drm_display_mode.
> > > 
> > > Signed-off-by: Denis Carikli 
> > > ---
> > > ChangeLog v10->v11:
> > > - Since the imx-drm won't be able to retrive its regulators
> > > 
> > >   from the device tree when using display-timings nodes,
> > >   and that I was told that the drm simple-panel driver
> > >   already supported that, I then, instead, added what was
> > >   lacking to make the eukrea displays work with the
> > >   drm-simple-panel driver.
> > >   
> > >   That required a way to get back the display polarity
> > >   informations from the imx-drm driver without affecting
> > >   userspace.
> > > 
> > > ---
> > > 
> > >  include/drm/drm_crtc.h |8 
> > >  1 file changed, 8 insertions(+)
> > > 
> > > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> > > index f764654..61a4fe1 100644
> > > --- a/include/drm/drm_crtc.h
> > > +++ b/include/drm/drm_crtc.h
> > > @@ -131,6 +131,13 @@ enum drm_mode_status {
> > > 
> > >  #define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
> > > 
> > > +#define DRM_MODE_FLAG_POL_PIXDATA_NEGEDGEBIT(1)
> > > +#define DRM_MODE_FLAG_POL_PIXDATA_POSEDGEBIT(2)
> > > +#define DRM_MODE_FLAG_POL_PIXDATA_PRESERVE   BIT(3)
> > > +#define DRM_MODE_FLAG_POL_DE_NEGEDGE BIT(4)
> > > +#define DRM_MODE_FLAG_POL_DE_POSEDGE BIT(5)
> > > +#define DRM_MODE_FLAG_POL_DE_PRESERVEBIT(6)
> > 
> > Could you add some description to these flags.
> > What are *_PRESERVE flags for?
> > Are those flags 1:1 compatible with respective 'videomode:flags'?
> > I guess DE flags should be rather DRM_MODE_FLAG_POL_DE_(LOW|HIGH), am I
> > right?
> 
> Possibly nitpicking, I wouldn't call the clock edge on which data signals are 
> generated/sampled "data polarity". This is clock polarity information.
> 
> Have you seen cases where pixel data and DE are geenrated or need to be 
> sampled on different edges ?
> 
DE is not a clock signal, but an 'Enable' signal whose value (high or
low) defines the window in which the pixel data is valid.
The flag defines whether data is valid during the HIGH or LOW period of
DE.


Lothar Wa?mann
-- 
___

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___