All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/imx: imx-ldb: disable LDB on driver bind
@ 2018-04-11 15:31 Lucas Stach
  2018-04-11 15:31 ` [PATCH 2/2] drm/imx: imx-ldb: check if channel is enabled before printing warning Lucas Stach
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lucas Stach @ 2018-04-11 15:31 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: kernel, dri-devel, patchwork-lst

The LVDS signal integrity is only guaranteed when the correct enable
sequence (first IPU DI, then LDB) is used. If the LDB display output was
active before the imx-drm driver is loaded (like when a bootsplash was
active) the DI will be disabled by the full IPU reset we do when loading
the driver. The LDB control registers are not part of the IPU range and
thus will remain unchanged.

This leads to the LDB still being active when the DI is getting enabled,
effectively reversing the required enable sequence. Fix this by also
disabling the LDB on driver bind.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/imx/imx-ldb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 56dd7a9a8e25..17974c0b4be8 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -612,6 +612,9 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
 		return PTR_ERR(imx_ldb->regmap);
 	}
 
+	/* disable LDB by resetting the control register to POR default */
+	regmap_write(imx_ldb->regmap, IOMUXC_GPR2, 0);
+
 	imx_ldb->dev = dev;
 
 	if (of_id)
-- 
2.16.1

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

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

* [PATCH 2/2] drm/imx: imx-ldb: check if channel is enabled before printing warning
  2018-04-11 15:31 [PATCH 1/2] drm/imx: imx-ldb: disable LDB on driver bind Lucas Stach
@ 2018-04-11 15:31 ` Lucas Stach
  2018-04-12  8:58 ` [PATCH 1/2] drm/imx: imx-ldb: disable LDB on driver bind Philipp Zabel
  2018-04-16 11:14 ` Philipp Zabel
  2 siblings, 0 replies; 4+ messages in thread
From: Lucas Stach @ 2018-04-11 15:31 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: kernel, dri-devel, patchwork-lst

If the second LVDS channel has been disabled in the DT when using dual-channel
mode we should not print a warning.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/imx/imx-ldb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 17974c0b4be8..dd5312b02a8d 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -655,14 +655,14 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
 		if (ret || i < 0 || i > 1)
 			return -EINVAL;
 
+		if (!of_device_is_available(child))
+			continue;
+
 		if (dual && i > 0) {
 			dev_warn(dev, "dual-channel mode, ignoring second output\n");
 			continue;
 		}
 
-		if (!of_device_is_available(child))
-			continue;
-
 		channel = &imx_ldb->channel[i];
 		channel->ldb = imx_ldb;
 		channel->chno = i;
-- 
2.16.1

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

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

* Re: [PATCH 1/2] drm/imx: imx-ldb: disable LDB on driver bind
  2018-04-11 15:31 [PATCH 1/2] drm/imx: imx-ldb: disable LDB on driver bind Lucas Stach
  2018-04-11 15:31 ` [PATCH 2/2] drm/imx: imx-ldb: check if channel is enabled before printing warning Lucas Stach
@ 2018-04-12  8:58 ` Philipp Zabel
  2018-04-16 11:14 ` Philipp Zabel
  2 siblings, 0 replies; 4+ messages in thread
From: Philipp Zabel @ 2018-04-12  8:58 UTC (permalink / raw)
  To: Lucas Stach; +Cc: kernel, dri-devel, patchwork-lst

Hi Lucas,

On Wed, 2018-04-11 at 17:31 +0200, Lucas Stach wrote:
> The LVDS signal integrity is only guaranteed when the correct enable
> sequence (first IPU DI, then LDB) is used. If the LDB display output was
> active before the imx-drm driver is loaded (like when a bootsplash was
> active) the DI will be disabled by the full IPU reset we do when loading
> the driver. The LDB control registers are not part of the IPU range and
> thus will remain unchanged.
> 
> This leads to the LDB still being active when the DI is getting enabled,
> effectively reversing the required enable sequence. Fix this by also
> disabling the LDB on driver bind.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/gpu/drm/imx/imx-ldb.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
> index 56dd7a9a8e25..17974c0b4be8 100644
> --- a/drivers/gpu/drm/imx/imx-ldb.c
> +++ b/drivers/gpu/drm/imx/imx-ldb.c
> @@ -612,6 +612,9 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
>  		return PTR_ERR(imx_ldb->regmap);
>  	}
>  
> +	/* disable LDB by resetting the control register to POR default */
> +	regmap_write(imx_ldb->regmap, IOMUXC_GPR2, 0);
> +

Both patches look good to me in principle, but wouldn't the correct
place to do this be imx_ldb_encoder_funcs.reset:

    struct drm_encoder_funcs {
        /**
         * @reset:
         *
         * Reset encoder hardware and software state to off. This function isn't
         * called by the core directly, only through drm_mode_config_reset().
         * It's not a helper hook only for historical reasons.
         */
        void (*reset)(struct drm_encoder *encoder);
    [...]
    };

regards
Philipp
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/2] drm/imx: imx-ldb: disable LDB on driver bind
  2018-04-11 15:31 [PATCH 1/2] drm/imx: imx-ldb: disable LDB on driver bind Lucas Stach
  2018-04-11 15:31 ` [PATCH 2/2] drm/imx: imx-ldb: check if channel is enabled before printing warning Lucas Stach
  2018-04-12  8:58 ` [PATCH 1/2] drm/imx: imx-ldb: disable LDB on driver bind Philipp Zabel
@ 2018-04-16 11:14 ` Philipp Zabel
  2 siblings, 0 replies; 4+ messages in thread
From: Philipp Zabel @ 2018-04-16 11:14 UTC (permalink / raw)
  To: Lucas Stach; +Cc: kernel, dri-devel, patchwork-lst

On Wed, 2018-04-11 at 17:31 +0200, Lucas Stach wrote:
> The LVDS signal integrity is only guaranteed when the correct enable
> sequence (first IPU DI, then LDB) is used. If the LDB display output was
> active before the imx-drm driver is loaded (like when a bootsplash was
> active) the DI will be disabled by the full IPU reset we do when loading
> the driver. The LDB control registers are not part of the IPU range and
> thus will remain unchanged.
> 
> This leads to the LDB still being active when the DI is getting enabled,
> effectively reversing the required enable sequence. Fix this by also
> disabling the LDB on driver bind.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/gpu/drm/imx/imx-ldb.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
> index 56dd7a9a8e25..17974c0b4be8 100644
> --- a/drivers/gpu/drm/imx/imx-ldb.c
> +++ b/drivers/gpu/drm/imx/imx-ldb.c
> @@ -612,6 +612,9 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
>  		return PTR_ERR(imx_ldb->regmap);
>  	}
>  
> +	/* disable LDB by resetting the control register to POR default */
> +	regmap_write(imx_ldb->regmap, IOMUXC_GPR2, 0);
> +

On second thought, this is nice and clear. Moving it into encoder .reset
would unnecessarily complicate things, as both channels share this
register and .reset is called twice, once per channel.

I've applied both patches to imx-drm/next.

regards
Philipp
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-04-16 11:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-11 15:31 [PATCH 1/2] drm/imx: imx-ldb: disable LDB on driver bind Lucas Stach
2018-04-11 15:31 ` [PATCH 2/2] drm/imx: imx-ldb: check if channel is enabled before printing warning Lucas Stach
2018-04-12  8:58 ` [PATCH 1/2] drm/imx: imx-ldb: disable LDB on driver bind Philipp Zabel
2018-04-16 11:14 ` Philipp Zabel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.