All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] drm/panel: Support panel detection
@ 2018-04-30 14:43 Boris Brezillon
  2018-04-30 14:43 ` [RFC PATCH 1/3] " Boris Brezillon
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Boris Brezillon @ 2018-04-30 14:43 UTC (permalink / raw)
  To: Thierry Reding, dri-devel; +Cc: David Airlie, Boris Brezillon

Some panels are connected through extension boards an provide an easy
way for the main board to detect when they are present (like checking
for a working I2C communication with a device and making sure a
specific reg in this device has a consistent value).

When this is the case, we might want to support dynamic panel detection
and only expose the display (and its display modes) when the panel is
detected, similar to the monitor detection we use for regular
connectors (HDMI, DVI, ...).

This solves a problem we have on the Rpi when the panel is not
connected to the board but described in the DT. This prevents the whole
display pipeline from being exposed because one of the element (the
panel) is missing.

This was posted as an RFC because I'm not sure dynamically detecting
panels or supporting panel hotplug is actually something we want to do.

Thierry, and DRM folks in general, feel free to give your opinion on
this approach, and/or propose others solution to solve the "DSI panel
not connected" problem we have on RPi. Oh, and before someone suggests
it, IIRC, Eric wanted to avoid relying on DT overlays to do that, I
don't remember why though.

Regards,

Boris

Boris Brezillon (3):
  drm/panel: Support panel detection
  drm/bridge: panel: Make use of the panel detection infrastructure
  drm/panel: rpi-touchscreen: Implement ->detect()

 drivers/gpu/drm/bridge/panel.c                     | 13 +++++
 .../gpu/drm/panel/panel-raspberrypi-touchscreen.c  | 62 ++++++++++++++++++----
 include/drm/drm_panel.h                            | 12 +++++
 3 files changed, 78 insertions(+), 9 deletions(-)

-- 
2.14.1

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

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

* [RFC PATCH 1/3] drm/panel: Support panel detection
  2018-04-30 14:43 [RFC PATCH 0/3] drm/panel: Support panel detection Boris Brezillon
@ 2018-04-30 14:43 ` Boris Brezillon
  2018-04-30 16:08   ` Daniel Vetter
  2018-04-30 14:43 ` [RFC PATCH 2/3] drm/bridge: panel: Make use of the panel detection infrastructure Boris Brezillon
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Boris Brezillon @ 2018-04-30 14:43 UTC (permalink / raw)
  To: Thierry Reding, dri-devel; +Cc: David Airlie, Boris Brezillon

Some panels might be connected through extension boards and might not
be available when the system boots. Extend the panel interface to
support panel detection.

An optional ->detect() hook is added and, if implemented, will be called
every time the panel user wants to know if the panel is connected or
disconnected.

We also add a ->polled field which should encode the type of polling the
DRM core should do (DRM_CONNECTOR_POLL_HPD, DRM_CONNECTOR_POLL_CONNECT
and DRM_CONNECTOR_POLL_DISCONNECT flags).

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
 include/drm/drm_panel.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 14ac240a1f64..718cc1f746ab 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -24,6 +24,7 @@
 #ifndef __DRM_PANEL_H__
 #define __DRM_PANEL_H__
 
+#include <drm/drm_connector.h>
 #include <linux/errno.h>
 #include <linux/list.h>
 
@@ -68,6 +69,7 @@ struct display_timing;
  * the panel. This is the job of the .unprepare() function.
  */
 struct drm_panel_funcs {
+	int (*detect)(struct drm_panel *panel);
 	int (*disable)(struct drm_panel *panel);
 	int (*unprepare)(struct drm_panel *panel);
 	int (*prepare)(struct drm_panel *panel);
@@ -90,6 +92,7 @@ struct drm_panel {
 	struct drm_connector *connector;
 	struct device *dev;
 
+	u8 polled;
 	const struct drm_panel_funcs *funcs;
 
 	struct list_head list;
@@ -186,6 +189,15 @@ static inline int drm_panel_get_modes(struct drm_panel *panel)
 	return panel ? -ENOSYS : -EINVAL;
 }
 
+static inline int drm_panel_detect(struct drm_panel *panel)
+{
+	if (panel && panel->funcs && panel->funcs->detect)
+		return panel->funcs->detect(panel);
+
+	/* Consider the panel as connected by default. */
+	return panel ? connector_status_connected : -EINVAL;
+}
+
 void drm_panel_init(struct drm_panel *panel);
 
 int drm_panel_add(struct drm_panel *panel);
-- 
2.14.1

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

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

* [RFC PATCH 2/3] drm/bridge: panel: Make use of the panel detection infrastructure
  2018-04-30 14:43 [RFC PATCH 0/3] drm/panel: Support panel detection Boris Brezillon
  2018-04-30 14:43 ` [RFC PATCH 1/3] " Boris Brezillon
@ 2018-04-30 14:43 ` Boris Brezillon
  2018-04-30 14:43 ` [RFC PATCH 3/3] drm/panel: rpi-touchscreen: Implement ->detect() Boris Brezillon
  2018-04-30 17:22 ` [RFC PATCH 0/3] drm/panel: Support panel detection Eric Anholt
  3 siblings, 0 replies; 9+ messages in thread
From: Boris Brezillon @ 2018-04-30 14:43 UTC (permalink / raw)
  To: Thierry Reding, dri-devel; +Cc: David Airlie, Boris Brezillon

The DRM panel framework now exposes a way to know whether a panel is
connected or disconnected.

Use this panel detection logic to implement the connector->detect_ctx()
method and allow one to report when a panel is connected or disconnected
which is particularly useful to support panels connected through
extension boards.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
 drivers/gpu/drm/bridge/panel.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
index 6d99d4a3beb3..195deb651243 100644
--- a/drivers/gpu/drm/bridge/panel.c
+++ b/drivers/gpu/drm/bridge/panel.c
@@ -44,9 +44,21 @@ static int panel_bridge_connector_get_modes(struct drm_connector *connector)
 	return drm_panel_get_modes(panel_bridge->panel);
 }
 
+static int
+panel_bridge_connector_detect_ctx(struct drm_connector *connector,
+				  struct drm_modeset_acquire_ctx *ctx,
+				  bool force)
+{
+	struct panel_bridge *panel_bridge =
+		drm_connector_to_panel_bridge(connector);
+
+	return drm_panel_detect(panel_bridge->panel);
+}
+
 static const struct drm_connector_helper_funcs
 panel_bridge_connector_helper_funcs = {
 	.get_modes = panel_bridge_connector_get_modes,
+	.detect_ctx = panel_bridge_connector_detect_ctx,
 };
 
 static const struct drm_connector_funcs panel_bridge_connector_funcs = {
@@ -68,6 +80,7 @@ static int panel_bridge_attach(struct drm_bridge *bridge)
 		return -ENODEV;
 	}
 
+	connector->polled = panel_bridge->panel->polled;
 	drm_connector_helper_add(connector,
 				 &panel_bridge_connector_helper_funcs);
 
-- 
2.14.1

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

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

* [RFC PATCH 3/3] drm/panel: rpi-touchscreen: Implement ->detect()
  2018-04-30 14:43 [RFC PATCH 0/3] drm/panel: Support panel detection Boris Brezillon
  2018-04-30 14:43 ` [RFC PATCH 1/3] " Boris Brezillon
  2018-04-30 14:43 ` [RFC PATCH 2/3] drm/bridge: panel: Make use of the panel detection infrastructure Boris Brezillon
@ 2018-04-30 14:43 ` Boris Brezillon
  2018-04-30 17:22 ` [RFC PATCH 0/3] drm/panel: Support panel detection Eric Anholt
  3 siblings, 0 replies; 9+ messages in thread
From: Boris Brezillon @ 2018-04-30 14:43 UTC (permalink / raw)
  To: Thierry Reding, dri-devel; +Cc: David Airlie, Boris Brezillon

Implement a way to determine when the panel is connected. This is done
by reading REG_ID through I2C. We consider the panel as disconnect
until we retrieve a valid ID.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
 .../gpu/drm/panel/panel-raspberrypi-touchscreen.c  | 62 ++++++++++++++++++----
 1 file changed, 53 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
index d964d454e4ae..e65caec590d4 100644
--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
@@ -196,6 +196,7 @@ struct rpi_touchscreen {
 	struct drm_panel base;
 	struct mipi_dsi_device *dsi;
 	struct i2c_client *i2c;
+	bool connected;
 };
 
 static const struct drm_display_mode rpi_touchscreen_modes[] = {
@@ -255,6 +256,9 @@ static int rpi_touchscreen_write(struct rpi_touchscreen *ts, u16 reg, u32 val)
 
 	mipi_dsi_dcs_write_buffer(ts->dsi, msg, sizeof(msg));
 #else
+	if (!ts->connected)
+		return 0;
+
 	rpi_touchscreen_i2c_write(ts, REG_WR_ADDRH, reg >> 8);
 	rpi_touchscreen_i2c_write(ts, REG_WR_ADDRL, reg);
 	rpi_touchscreen_i2c_write(ts, REG_WRITEH, val >> 8);
@@ -268,6 +272,9 @@ static int rpi_touchscreen_disable(struct drm_panel *panel)
 {
 	struct rpi_touchscreen *ts = panel_to_ts(panel);
 
+	if (!ts->connected)
+		return 0;
+
 	rpi_touchscreen_i2c_write(ts, REG_PWM, 0);
 
 	rpi_touchscreen_i2c_write(ts, REG_POWERON, 0);
@@ -286,6 +293,9 @@ static int rpi_touchscreen_enable(struct drm_panel *panel)
 	struct rpi_touchscreen *ts = panel_to_ts(panel);
 	int i;
 
+	if (!ts->connected)
+		return 0;
+
 	rpi_touchscreen_i2c_write(ts, REG_POWERON, 1);
 	/* Wait for nPWRDWN to go low to indicate poweron is done. */
 	for (i = 0; i < 100; i++) {
@@ -330,6 +340,10 @@ static int rpi_touchscreen_get_modes(struct drm_panel *panel)
 	struct drm_device *drm = panel->drm;
 	unsigned int i, num = 0;
 	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
+	struct rpi_touchscreen *ts = panel_to_ts(panel);
+
+	if (!ts->connected)
+		return 0;
 
 	for (i = 0; i < ARRAY_SIZE(rpi_touchscreen_modes); i++) {
 		const struct drm_display_mode *m = &rpi_touchscreen_modes[i];
@@ -362,7 +376,34 @@ static int rpi_touchscreen_get_modes(struct drm_panel *panel)
 	return num;
 }
 
+static int rpi_touchscreen_detect(struct drm_panel *panel)
+{
+	struct rpi_touchscreen *ts = panel_to_ts(panel);
+	int ver;
+
+	if (ts->connected)
+		return connector_status_connected;
+
+	ver = rpi_touchscreen_i2c_read(ts, REG_ID);
+	switch (ver) {
+	case 0xde: /* ver 1 */
+	case 0xc3: /* ver 2 */
+		ts->connected = true;
+
+		/* Turn off at boot, so we can cleanly sequence powering on. */
+		rpi_touchscreen_i2c_write(ts, REG_POWERON, 0);
+
+		return connector_status_connected;
+
+	default:
+		break;
+	}
+
+	return connector_status_disconnected;
+}
+
 static const struct drm_panel_funcs rpi_touchscreen_funcs = {
+	.detect = rpi_touchscreen_detect,
 	.disable = rpi_touchscreen_disable,
 	.unprepare = rpi_touchscreen_noop,
 	.prepare = rpi_touchscreen_noop,
@@ -393,22 +434,24 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c,
 	ts->i2c = i2c;
 
 	ver = rpi_touchscreen_i2c_read(ts, REG_ID);
-	if (ver < 0) {
-		dev_err(dev, "Atmel I2C read failed: %d\n", ver);
-		return -ENODEV;
-	}
-
 	switch (ver) {
 	case 0xde: /* ver 1 */
 	case 0xc3: /* ver 2 */
+		ts->connected = true;
+
+		/* Turn off at boot, so we can cleanly sequence powering on. */
+		rpi_touchscreen_i2c_write(ts, REG_POWERON, 0);
 		break;
 	default:
-		dev_err(dev, "Unknown Atmel firmware revision: 0x%02x\n", ver);
-		return -ENODEV;
+		if (ver < 0)
+			dev_err(dev, "Atmel I2C read failed: %d\n", ver);
+		else
+			dev_err(dev,
+				"Unknown Atmel firmware revision: 0x%02x\n",
+				ver);
+		break;
 	}
 
-	/* Turn off at boot, so we can cleanly sequence powering on. */
-	rpi_touchscreen_i2c_write(ts, REG_POWERON, 0);
 
 	/* Look up the DSI host.  It needs to probe before we do. */
 	endpoint = of_graph_get_next_endpoint(dev->of_node, NULL);
@@ -432,6 +475,7 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c,
 
 	ts->base.dev = dev;
 	ts->base.funcs = &rpi_touchscreen_funcs;
+	ts->base.polled = DRM_CONNECTOR_POLL_CONNECT;
 
 	/* This appears last, as it's what will unblock the DSI host
 	 * driver's component bind function.
-- 
2.14.1

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

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

* Re: [RFC PATCH 1/3] drm/panel: Support panel detection
  2018-04-30 14:43 ` [RFC PATCH 1/3] " Boris Brezillon
@ 2018-04-30 16:08   ` Daniel Vetter
  2018-04-30 16:34     ` Boris Brezillon
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Vetter @ 2018-04-30 16:08 UTC (permalink / raw)
  To: Boris Brezillon; +Cc: David Airlie, Thierry Reding, dri-devel

On Mon, Apr 30, 2018 at 04:43:21PM +0200, Boris Brezillon wrote:
> Some panels might be connected through extension boards and might not
> be available when the system boots. Extend the panel interface to
> support panel detection.
> 
> An optional ->detect() hook is added and, if implemented, will be called
> every time the panel user wants to know if the panel is connected or
> disconnected.
> 
> We also add a ->polled field which should encode the type of polling the
> DRM core should do (DRM_CONNECTOR_POLL_HPD, DRM_CONNECTOR_POLL_CONNECT
> and DRM_CONNECTOR_POLL_DISCONNECT flags).
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>

Hm, not sure panel detection makes much sense, the entire idea behind
drm_panel is to hard-code a fixed/built-in panel. The only thing panels
may report through the connection status is whether the lid is closed or
not. Yes we should probably document that somewhere.

If you have a panel-that-can-be-hotplugged a drm_bridge that implemens the
drm_connector is probably the way to go.

> ---
>  include/drm/drm_panel.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index 14ac240a1f64..718cc1f746ab 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -24,6 +24,7 @@
>  #ifndef __DRM_PANEL_H__
>  #define __DRM_PANEL_H__
>  
> +#include <drm/drm_connector.h>
>  #include <linux/errno.h>
>  #include <linux/list.h>
>  
> @@ -68,6 +69,7 @@ struct display_timing;
>   * the panel. This is the job of the .unprepare() function.
>   */
>  struct drm_panel_funcs {
> +	int (*detect)(struct drm_panel *panel);

Kerneldoc for this please. Would also be really good to switch this struct
of function pointers over to the in-line style, and put the paragraphs
relevant for a given callback into it's dedicated comment.
-Daniel

>  	int (*disable)(struct drm_panel *panel);
>  	int (*unprepare)(struct drm_panel *panel);
>  	int (*prepare)(struct drm_panel *panel);
> @@ -90,6 +92,7 @@ struct drm_panel {
>  	struct drm_connector *connector;
>  	struct device *dev;
>  
> +	u8 polled;
>  	const struct drm_panel_funcs *funcs;
>  
>  	struct list_head list;
> @@ -186,6 +189,15 @@ static inline int drm_panel_get_modes(struct drm_panel *panel)
>  	return panel ? -ENOSYS : -EINVAL;
>  }
>  
> +static inline int drm_panel_detect(struct drm_panel *panel)
> +{
> +	if (panel && panel->funcs && panel->funcs->detect)
> +		return panel->funcs->detect(panel);
> +
> +	/* Consider the panel as connected by default. */
> +	return panel ? connector_status_connected : -EINVAL;
> +}
> +
>  void drm_panel_init(struct drm_panel *panel);
>  
>  int drm_panel_add(struct drm_panel *panel);
> -- 
> 2.14.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [RFC PATCH 1/3] drm/panel: Support panel detection
  2018-04-30 16:08   ` Daniel Vetter
@ 2018-04-30 16:34     ` Boris Brezillon
  0 siblings, 0 replies; 9+ messages in thread
From: Boris Brezillon @ 2018-04-30 16:34 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: David Airlie, Thierry Reding, dri-devel

Hi Daniel,

On Mon, 30 Apr 2018 18:08:47 +0200
Daniel Vetter <daniel@ffwll.ch> wrote:

> On Mon, Apr 30, 2018 at 04:43:21PM +0200, Boris Brezillon wrote:
> > Some panels might be connected through extension boards and might not
> > be available when the system boots. Extend the panel interface to
> > support panel detection.
> > 
> > An optional ->detect() hook is added and, if implemented, will be called
> > every time the panel user wants to know if the panel is connected or
> > disconnected.
> > 
> > We also add a ->polled field which should encode the type of polling the
> > DRM core should do (DRM_CONNECTOR_POLL_HPD, DRM_CONNECTOR_POLL_CONNECT
> > and DRM_CONNECTOR_POLL_DISCONNECT flags).
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>  
> 
> Hm, not sure panel detection makes much sense, the entire idea behind
> drm_panel is to hard-code a fixed/built-in panel. The only thing panels
> may report through the connection status is whether the lid is closed or
> not. Yes we should probably document that somewhere.
> 
> If you have a panel-that-can-be-hotplugged a drm_bridge that implemens the
> drm_connector is probably the way to go.

That does not really work for the rpi panel case because we use an I2C
message to detect the presence of the panel. So, unless we decide to
attach the I2C client to the bridge device instead of attaching it to
the panel that's not really possible, and I'm not sure doing that is a
good thing either.

I guess the only alternative to solve the issue I'm trying to solve is
drm_bridge hotplug, so that we allow the DRM device to be registered
even if not all of its leaf nodes (i.e. bridges and connectors) are
ready to be used.

> 
> > ---
> >  include/drm/drm_panel.h | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> > 
> > diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> > index 14ac240a1f64..718cc1f746ab 100644
> > --- a/include/drm/drm_panel.h
> > +++ b/include/drm/drm_panel.h
> > @@ -24,6 +24,7 @@
> >  #ifndef __DRM_PANEL_H__
> >  #define __DRM_PANEL_H__
> >  
> > +#include <drm/drm_connector.h>
> >  #include <linux/errno.h>
> >  #include <linux/list.h>
> >  
> > @@ -68,6 +69,7 @@ struct display_timing;
> >   * the panel. This is the job of the .unprepare() function.
> >   */
> >  struct drm_panel_funcs {
> > +	int (*detect)(struct drm_panel *panel);  
> 
> Kerneldoc for this please. Would also be really good to switch this struct
> of function pointers over to the in-line style, and put the paragraphs
> relevant for a given callback into it's dedicated comment.

Not useful anymore since the idea appeared to be bad ;-).

Thanks for the quick feedback.

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

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

* Re: [RFC PATCH 0/3] drm/panel: Support panel detection
  2018-04-30 14:43 [RFC PATCH 0/3] drm/panel: Support panel detection Boris Brezillon
                   ` (2 preceding siblings ...)
  2018-04-30 14:43 ` [RFC PATCH 3/3] drm/panel: rpi-touchscreen: Implement ->detect() Boris Brezillon
@ 2018-04-30 17:22 ` Eric Anholt
  2018-04-30 17:43   ` Boris Brezillon
  3 siblings, 1 reply; 9+ messages in thread
From: Eric Anholt @ 2018-04-30 17:22 UTC (permalink / raw)
  To: Thierry Reding, dri-devel; +Cc: David Airlie, Boris Brezillon


[-- Attachment #1.1: Type: text/plain, Size: 1496 bytes --]

Boris Brezillon <boris.brezillon@bootlin.com> writes:

> Some panels are connected through extension boards an provide an easy
> way for the main board to detect when they are present (like checking
> for a working I2C communication with a device and making sure a
> specific reg in this device has a consistent value).
>
> When this is the case, we might want to support dynamic panel detection
> and only expose the display (and its display modes) when the panel is
> detected, similar to the monitor detection we use for regular
> connectors (HDMI, DVI, ...).
>
> This solves a problem we have on the Rpi when the panel is not
> connected to the board but described in the DT. This prevents the whole
> display pipeline from being exposed because one of the element (the
> panel) is missing.
>
> This was posted as an RFC because I'm not sure dynamically detecting
> panels or supporting panel hotplug is actually something we want to do.

I want to clarify here: we're not trying to do panel hotplug.  We're
trying to boot-time-only detection of whether or not the standard panel
is plugged in.

Since this is something like the 6th variation of trying to get this
driver to work whether or not the panel is plugged in at boot, I'm
leaning toward just asking the closed source firmware to hack the DT to
add/remove the panel's node depending on whether it can probe it on I2C.
Relying on more closed source software in order to work around something
so trivial is really frustrating, though.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

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

* Re: [RFC PATCH 0/3] drm/panel: Support panel detection
  2018-04-30 17:22 ` [RFC PATCH 0/3] drm/panel: Support panel detection Eric Anholt
@ 2018-04-30 17:43   ` Boris Brezillon
  2018-04-30 19:48     ` Daniel Vetter
  0 siblings, 1 reply; 9+ messages in thread
From: Boris Brezillon @ 2018-04-30 17:43 UTC (permalink / raw)
  To: Eric Anholt; +Cc: David Airlie, Thierry Reding, dri-devel

On Mon, 30 Apr 2018 10:22:19 -0700
Eric Anholt <eric@anholt.net> wrote:

> Boris Brezillon <boris.brezillon@bootlin.com> writes:
> 
> > Some panels are connected through extension boards an provide an easy
> > way for the main board to detect when they are present (like checking
> > for a working I2C communication with a device and making sure a
> > specific reg in this device has a consistent value).
> >
> > When this is the case, we might want to support dynamic panel detection
> > and only expose the display (and its display modes) when the panel is
> > detected, similar to the monitor detection we use for regular
> > connectors (HDMI, DVI, ...).
> >
> > This solves a problem we have on the Rpi when the panel is not
> > connected to the board but described in the DT. This prevents the whole
> > display pipeline from being exposed because one of the element (the
> > panel) is missing.
> >
> > This was posted as an RFC because I'm not sure dynamically detecting
> > panels or supporting panel hotplug is actually something we want to do.  
> 
> I want to clarify here: we're not trying to do panel hotplug.  We're
> trying to boot-time-only detection of whether or not the standard panel
> is plugged in.
> 
> Since this is something like the 6th variation of trying to get this
> driver to work whether or not the panel is plugged in at boot, I'm
> leaning toward just asking the closed source firmware to hack the DT to
> add/remove the panel's node depending on whether it can probe it on I2C.
> Relying on more closed source software in order to work around something
> so trivial is really frustrating, though.

Well, we could still have this hack in the rpi-touchscreen-panel driver
and expose the panel without any display modes when the device is
actually not responding on the I2C bus. This way we could have the DRM
device registered and the panel display would just be unusable.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [RFC PATCH 0/3] drm/panel: Support panel detection
  2018-04-30 17:43   ` Boris Brezillon
@ 2018-04-30 19:48     ` Daniel Vetter
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Vetter @ 2018-04-30 19:48 UTC (permalink / raw)
  To: Boris Brezillon; +Cc: David Airlie, Thierry Reding, dri-devel

On Mon, Apr 30, 2018 at 7:43 PM, Boris Brezillon
<boris.brezillon@bootlin.com> wrote:
> On Mon, 30 Apr 2018 10:22:19 -0700
> Eric Anholt <eric@anholt.net> wrote:
>
>> Boris Brezillon <boris.brezillon@bootlin.com> writes:
>>
>> > Some panels are connected through extension boards an provide an easy
>> > way for the main board to detect when they are present (like checking
>> > for a working I2C communication with a device and making sure a
>> > specific reg in this device has a consistent value).
>> >
>> > When this is the case, we might want to support dynamic panel detection
>> > and only expose the display (and its display modes) when the panel is
>> > detected, similar to the monitor detection we use for regular
>> > connectors (HDMI, DVI, ...).
>> >
>> > This solves a problem we have on the Rpi when the panel is not
>> > connected to the board but described in the DT. This prevents the whole
>> > display pipeline from being exposed because one of the element (the
>> > panel) is missing.
>> >
>> > This was posted as an RFC because I'm not sure dynamically detecting
>> > panels or supporting panel hotplug is actually something we want to do.
>>
>> I want to clarify here: we're not trying to do panel hotplug.  We're
>> trying to boot-time-only detection of whether or not the standard panel
>> is plugged in.
>>
>> Since this is something like the 6th variation of trying to get this
>> driver to work whether or not the panel is plugged in at boot, I'm
>> leaning toward just asking the closed source firmware to hack the DT to
>> add/remove the panel's node depending on whether it can probe it on I2C.
>> Relying on more closed source software in order to work around something
>> so trivial is really frustrating, though.

Ugh, sorry, I didn't remember the entire story here when I replied.

> Well, we could still have this hack in the rpi-touchscreen-panel driver
> and expose the panel without any display modes when the device is
> actually not responding on the I2C bus. This way we could have the DRM
> device registered and the panel display would just be unusable.

Yeah that sounds like a reasonable hack to me, but I have no idea
whether this was one of the earlier pile of ideas or not. Another
thing that I just thought of (so might be bogus) would be a dummy
bridge which only exists to transport an errno, which would then be
returned from drm_of_find_panel_or_bridge instead of 0. Probably only
reasonable case would be to return -ENODEV. No good idea though how to
somewhat cleanly wire this through the entire stack, simplest might be
to add an in errno to drm_panel. Since we use an embedded list for
of_drm_find_panel we can't do the usual trick of storing the errno in
the pointer.

Hm, maybe we could encode panel->funcs == NULL as "sorry this panel
isn't really there" and use that. Assuming we only ever want to encode
ENODEV and not a pile of other errno values.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-04-30 19:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-30 14:43 [RFC PATCH 0/3] drm/panel: Support panel detection Boris Brezillon
2018-04-30 14:43 ` [RFC PATCH 1/3] " Boris Brezillon
2018-04-30 16:08   ` Daniel Vetter
2018-04-30 16:34     ` Boris Brezillon
2018-04-30 14:43 ` [RFC PATCH 2/3] drm/bridge: panel: Make use of the panel detection infrastructure Boris Brezillon
2018-04-30 14:43 ` [RFC PATCH 3/3] drm/panel: rpi-touchscreen: Implement ->detect() Boris Brezillon
2018-04-30 17:22 ` [RFC PATCH 0/3] drm/panel: Support panel detection Eric Anholt
2018-04-30 17:43   ` Boris Brezillon
2018-04-30 19:48     ` Daniel Vetter

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.