devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] cec/cec-gpio: add support for 5V testing
@ 2018-07-17 13:29 Hans Verkuil
  2018-07-17 13:29 ` [PATCH 1/5] cec-gpio.txt: add v5-gpios for testing the 5V line Hans Verkuil
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Hans Verkuil @ 2018-07-17 13:29 UTC (permalink / raw)
  To: linux-media; +Cc: Rob Herring, devicetree

From: Hans Verkuil <hans.verkuil@cisco.com>

Some displays disable CEC if the HDMI 5V is not detected. In order
to test issues related to this you want to be able to optionally
detect when the 5V line changes in the cec-gpio driver.

This patch series adds support for this feature.

Regards,

	Hans

Hans Verkuil (5):
  cec-gpio.txt: add v5-gpios for testing the 5V line
  cec-ioc-dqevent.rst: document the new 5V events
  uapi/linux/cec.h: add 5V events
  cec: add support for 5V signal testing
  cec-gpio: support 5v testing

 .../devicetree/bindings/media/cec-gpio.txt    | 17 +++---
 .../media/uapi/cec/cec-ioc-dqevent.rst        | 18 +++++++
 drivers/media/cec/cec-adap.c                  | 18 ++++++-
 drivers/media/cec/cec-api.c                   |  8 +++
 drivers/media/platform/cec-gpio/cec-gpio.c    | 54 +++++++++++++++++++
 include/media/cec-pin.h                       |  4 ++
 include/media/cec.h                           | 12 ++++-
 include/uapi/linux/cec.h                      |  2 +
 8 files changed, 124 insertions(+), 9 deletions(-)

-- 
2.18.0

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

* [PATCH 1/5] cec-gpio.txt: add v5-gpios for testing the 5V line
  2018-07-17 13:29 [PATCH 0/5] cec/cec-gpio: add support for 5V testing Hans Verkuil
@ 2018-07-17 13:29 ` Hans Verkuil
  2018-07-20 18:05   ` Rob Herring
  2018-07-17 13:29 ` [PATCH 2/5] cec-ioc-dqevent.rst: document the new 5V events Hans Verkuil
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Hans Verkuil @ 2018-07-17 13:29 UTC (permalink / raw)
  To: linux-media; +Cc: Rob Herring, devicetree, Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

In order to debug the HDMI 5V line we need to add a new v5-gpios
property.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 .../devicetree/bindings/media/cec-gpio.txt      | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/cec-gpio.txt b/Documentation/devicetree/bindings/media/cec-gpio.txt
index 12fcd55ed153..1d53ce89da74 100644
--- a/Documentation/devicetree/bindings/media/cec-gpio.txt
+++ b/Documentation/devicetree/bindings/media/cec-gpio.txt
@@ -4,8 +4,8 @@ The HDMI CEC GPIO module supports CEC implementations where the CEC line
 is hooked up to a pull-up GPIO line and - optionally - the HPD line is
 hooked up to another GPIO line.
 
-Please note: the maximum voltage for the CEC line is 3.63V, for the HPD
-line it is 5.3V. So you may need some sort of level conversion circuitry
+Please note: the maximum voltage for the CEC line is 3.63V, for the HPD and
+5V lines it is 5.3V. So you may need some sort of level conversion circuitry
 when connecting them to a GPIO line.
 
 Required properties:
@@ -22,15 +22,18 @@ If the CEC line is not associated with an HDMI receiver/transmitter, then
 the following property is optional:
 
   - hpd-gpios: gpio that the HPD line is connected to.
+  - v5-gpios: gpio that the 5V line is connected to.
 
 Example for the Raspberry Pi 3 where the CEC line is connected to
-pin 26 aka BCM7 aka CE1 on the GPIO pin header and the HPD line is
-connected to pin 11 aka BCM17 (some level shifter is needed for this!):
+pin 26 aka BCM7 aka CE1 on the GPIO pin header, the HPD line is
+connected to pin 11 aka BCM17 and the 5V line is connected to pin
+15 aka BCM22 (some level shifter is needed for the HPD and 5V lines!):
 
 #include <dt-bindings/gpio/gpio.h>
 
 cec-gpio {
-       compatible = "cec-gpio";
-       cec-gpios = <&gpio 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
-       hpd-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
+	compatible = "cec-gpio";
+	cec-gpios = <&gpio 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+	hpd-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
+	v5-gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
 };
-- 
2.18.0

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

* [PATCH 2/5] cec-ioc-dqevent.rst: document the new 5V events
  2018-07-17 13:29 [PATCH 0/5] cec/cec-gpio: add support for 5V testing Hans Verkuil
  2018-07-17 13:29 ` [PATCH 1/5] cec-gpio.txt: add v5-gpios for testing the 5V line Hans Verkuil
@ 2018-07-17 13:29 ` Hans Verkuil
  2018-07-17 13:29 ` [PATCH 3/5] uapi/linux/cec.h: add " Hans Verkuil
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Hans Verkuil @ 2018-07-17 13:29 UTC (permalink / raw)
  To: linux-media; +Cc: Rob Herring, devicetree, Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

Document the two new 5V events.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 .../media/uapi/cec/cec-ioc-dqevent.rst         | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst
index b6fd86424fbb..8d5633e6ae04 100644
--- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst
+++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst
@@ -179,6 +179,24 @@ it is guaranteed that the state did change in between the two events.
 	capability set. When open() is called, the HPD pin can be read and
 	if the HPD is high, then an initial event will be generated for that
 	filehandle.
+    * .. _`CEC-EVENT-PIN-5V-LOW`:
+
+      - ``CEC_EVENT_PIN_5V_LOW``
+      - 6
+      - Generated if the 5V pin goes from a high voltage to a low voltage.
+	Only applies to adapters that have the ``CEC_CAP_MONITOR_PIN``
+	capability set. When open() is called, the 5V pin can be read and
+	if the 5V is low, then an initial event will be generated for that
+	filehandle.
+    * .. _`CEC-EVENT-PIN-5V-HIGH`:
+
+      - ``CEC_EVENT_PIN_5V_HIGH``
+      - 7
+      - Generated if the 5V pin goes from a low voltage to a high voltage.
+	Only applies to adapters that have the ``CEC_CAP_MONITOR_PIN``
+	capability set. When open() is called, the 5V pin can be read and
+	if the 5V is high, then an initial event will be generated for that
+	filehandle.
 
 
 .. tabularcolumns:: |p{6.0cm}|p{0.6cm}|p{10.9cm}|
-- 
2.18.0

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

* [PATCH 3/5] uapi/linux/cec.h: add 5V events
  2018-07-17 13:29 [PATCH 0/5] cec/cec-gpio: add support for 5V testing Hans Verkuil
  2018-07-17 13:29 ` [PATCH 1/5] cec-gpio.txt: add v5-gpios for testing the 5V line Hans Verkuil
  2018-07-17 13:29 ` [PATCH 2/5] cec-ioc-dqevent.rst: document the new 5V events Hans Verkuil
@ 2018-07-17 13:29 ` Hans Verkuil
  2018-07-17 13:29 ` [PATCH 4/5] cec: add support for 5V signal testing Hans Verkuil
  2018-07-17 13:29 ` [PATCH 5/5] cec-gpio: support 5v testing Hans Verkuil
  4 siblings, 0 replies; 8+ messages in thread
From: Hans Verkuil @ 2018-07-17 13:29 UTC (permalink / raw)
  To: linux-media; +Cc: Rob Herring, devicetree, Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

Add two new events to signal when the 5V line goes high or low.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 include/uapi/linux/cec.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/linux/cec.h b/include/uapi/linux/cec.h
index 20fe091b7e96..097fcd812471 100644
--- a/include/uapi/linux/cec.h
+++ b/include/uapi/linux/cec.h
@@ -384,6 +384,8 @@ struct cec_log_addrs {
 #define CEC_EVENT_PIN_CEC_HIGH		4
 #define CEC_EVENT_PIN_HPD_LOW		5
 #define CEC_EVENT_PIN_HPD_HIGH		6
+#define CEC_EVENT_PIN_5V_LOW		7
+#define CEC_EVENT_PIN_5V_HIGH		8
 
 #define CEC_EVENT_FL_INITIAL_STATE	(1 << 0)
 #define CEC_EVENT_FL_DROPPED_EVENTS	(1 << 1)
-- 
2.18.0

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

* [PATCH 4/5] cec: add support for 5V signal testing
  2018-07-17 13:29 [PATCH 0/5] cec/cec-gpio: add support for 5V testing Hans Verkuil
                   ` (2 preceding siblings ...)
  2018-07-17 13:29 ` [PATCH 3/5] uapi/linux/cec.h: add " Hans Verkuil
@ 2018-07-17 13:29 ` Hans Verkuil
  2018-07-17 13:29 ` [PATCH 5/5] cec-gpio: support 5v testing Hans Verkuil
  4 siblings, 0 replies; 8+ messages in thread
From: Hans Verkuil @ 2018-07-17 13:29 UTC (permalink / raw)
  To: linux-media; +Cc: Rob Herring, devicetree, Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

Add support for the new 5V CEC events

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/cec/cec-adap.c | 18 +++++++++++++++++-
 drivers/media/cec/cec-api.c  |  8 ++++++++
 include/media/cec-pin.h      |  4 ++++
 include/media/cec.h          | 12 +++++++++++-
 4 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c
index b7fad0ec5710..030b2602faf0 100644
--- a/drivers/media/cec/cec-adap.c
+++ b/drivers/media/cec/cec-adap.c
@@ -74,7 +74,7 @@ void cec_queue_event_fh(struct cec_fh *fh,
 			const struct cec_event *new_ev, u64 ts)
 {
 	static const u16 max_events[CEC_NUM_EVENTS] = {
-		1, 1, 800, 800, 8, 8,
+		1, 1, 800, 800, 8, 8, 8, 8
 	};
 	struct cec_event_entry *entry;
 	unsigned int ev_idx = new_ev->event - 1;
@@ -176,6 +176,22 @@ void cec_queue_pin_hpd_event(struct cec_adapter *adap, bool is_high, ktime_t ts)
 }
 EXPORT_SYMBOL_GPL(cec_queue_pin_hpd_event);
 
+/* Notify userspace that the 5V pin changed state at the given time. */
+void cec_queue_pin_5v_event(struct cec_adapter *adap, bool is_high, ktime_t ts)
+{
+	struct cec_event ev = {
+		.event = is_high ? CEC_EVENT_PIN_5V_HIGH :
+				   CEC_EVENT_PIN_5V_LOW,
+	};
+	struct cec_fh *fh;
+
+	mutex_lock(&adap->devnode.lock);
+	list_for_each_entry(fh, &adap->devnode.fhs, list)
+		cec_queue_event_fh(fh, &ev, ktime_to_ns(ts));
+	mutex_unlock(&adap->devnode.lock);
+}
+EXPORT_SYMBOL_GPL(cec_queue_pin_5v_event);
+
 /*
  * Queue a new message for this filehandle.
  *
diff --git a/drivers/media/cec/cec-api.c b/drivers/media/cec/cec-api.c
index 10b67fc40318..b6536bbad530 100644
--- a/drivers/media/cec/cec-api.c
+++ b/drivers/media/cec/cec-api.c
@@ -579,6 +579,14 @@ static int cec_open(struct inode *inode, struct file *filp)
 			cec_queue_event_fh(fh, &ev, 0);
 		}
 	}
+	if (adap->pin && adap->pin->ops->read_5v) {
+		err = adap->pin->ops->read_5v(adap);
+		if (err >= 0) {
+			ev.event = err ? CEC_EVENT_PIN_5V_HIGH :
+					 CEC_EVENT_PIN_5V_LOW;
+			cec_queue_event_fh(fh, &ev, 0);
+		}
+	}
 #endif
 
 	list_add(&fh->list, &devnode->fhs);
diff --git a/include/media/cec-pin.h b/include/media/cec-pin.h
index ed16c6dde0ba..604e79cb6cbf 100644
--- a/include/media/cec-pin.h
+++ b/include/media/cec-pin.h
@@ -25,6 +25,9 @@
  * @read_hpd:	read the HPD pin. Return true if high, false if low or
  *		an error if negative. If NULL or -ENOTTY is returned,
  *		then this is not supported.
+ * @read_5v:	read the 5V pin. Return true if high, false if low or
+ *		an error if negative. If NULL or -ENOTTY is returned,
+ *		then this is not supported.
  *
  * These operations are used by the cec pin framework to manipulate
  * the CEC pin.
@@ -38,6 +41,7 @@ struct cec_pin_ops {
 	void (*free)(struct cec_adapter *adap);
 	void (*status)(struct cec_adapter *adap, struct seq_file *file);
 	int  (*read_hpd)(struct cec_adapter *adap);
+	int  (*read_5v)(struct cec_adapter *adap);
 };
 
 /**
diff --git a/include/media/cec.h b/include/media/cec.h
index 580ab1042898..ff9847f7f99d 100644
--- a/include/media/cec.h
+++ b/include/media/cec.h
@@ -79,7 +79,7 @@ struct cec_event_entry {
 };
 
 #define CEC_NUM_CORE_EVENTS 2
-#define CEC_NUM_EVENTS CEC_EVENT_PIN_HPD_HIGH
+#define CEC_NUM_EVENTS CEC_EVENT_PIN_5V_HIGH
 
 struct cec_fh {
 	struct list_head	list;
@@ -308,6 +308,16 @@ void cec_queue_pin_cec_event(struct cec_adapter *adap, bool is_high,
  */
 void cec_queue_pin_hpd_event(struct cec_adapter *adap, bool is_high, ktime_t ts);
 
+/**
+ * cec_queue_pin_5v_event() - queue a pin event with a given timestamp.
+ *
+ * @adap:	pointer to the cec adapter
+ * @is_high:	when true the 5V pin is high, otherwise it is low
+ * @ts:		the timestamp for this event
+ *
+ */
+void cec_queue_pin_5v_event(struct cec_adapter *adap, bool is_high, ktime_t ts);
+
 /**
  * cec_get_edid_phys_addr() - find and return the physical address
  *
-- 
2.18.0

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

* [PATCH 5/5] cec-gpio: support 5v testing
  2018-07-17 13:29 [PATCH 0/5] cec/cec-gpio: add support for 5V testing Hans Verkuil
                   ` (3 preceding siblings ...)
  2018-07-17 13:29 ` [PATCH 4/5] cec: add support for 5V signal testing Hans Verkuil
@ 2018-07-17 13:29 ` Hans Verkuil
  4 siblings, 0 replies; 8+ messages in thread
From: Hans Verkuil @ 2018-07-17 13:29 UTC (permalink / raw)
  To: linux-media; +Cc: Rob Herring, devicetree, Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

Add support for the new (optional) 5V gpio in order to debug 5V
changes. Some displays turn off CEC if the 5V is not detected,
so it is useful to be able to monitor this line.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/platform/cec-gpio/cec-gpio.c | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/drivers/media/platform/cec-gpio/cec-gpio.c b/drivers/media/platform/cec-gpio/cec-gpio.c
index 69f8242209c2..d2861749d640 100644
--- a/drivers/media/platform/cec-gpio/cec-gpio.c
+++ b/drivers/media/platform/cec-gpio/cec-gpio.c
@@ -23,6 +23,11 @@ struct cec_gpio {
 	int			hpd_irq;
 	bool			hpd_is_high;
 	ktime_t			hpd_ts;
+
+	struct gpio_desc	*v5_gpio;
+	int			v5_irq;
+	bool			v5_is_high;
+	ktime_t			v5_ts;
 };
 
 static bool cec_gpio_read(struct cec_adapter *adap)
@@ -65,6 +70,26 @@ static irqreturn_t cec_hpd_gpio_irq_handler_thread(int irq, void *priv)
 	return IRQ_HANDLED;
 }
 
+static irqreturn_t cec_5v_gpio_irq_handler(int irq, void *priv)
+{
+	struct cec_gpio *cec = priv;
+	bool is_high = gpiod_get_value(cec->v5_gpio);
+
+	if (is_high == cec->v5_is_high)
+		return IRQ_HANDLED;
+	cec->v5_ts = ktime_get();
+	cec->v5_is_high = is_high;
+	return IRQ_WAKE_THREAD;
+}
+
+static irqreturn_t cec_5v_gpio_irq_handler_thread(int irq, void *priv)
+{
+	struct cec_gpio *cec = priv;
+
+	cec_queue_pin_5v_event(cec->adap, cec->v5_is_high, cec->v5_ts);
+	return IRQ_HANDLED;
+}
+
 static irqreturn_t cec_hpd_gpio_irq_handler(int irq, void *priv)
 {
 	struct cec_gpio *cec = priv;
@@ -119,6 +144,9 @@ static void cec_gpio_status(struct cec_adapter *adap, struct seq_file *file)
 	if (cec->hpd_gpio)
 		seq_printf(file, "hpd: %s\n",
 			   cec->hpd_is_high ? "high" : "low");
+	if (cec->v5_gpio)
+		seq_printf(file, "5V: %s\n",
+			   cec->v5_is_high ? "high" : "low");
 }
 
 static int cec_gpio_read_hpd(struct cec_adapter *adap)
@@ -130,6 +158,15 @@ static int cec_gpio_read_hpd(struct cec_adapter *adap)
 	return gpiod_get_value(cec->hpd_gpio);
 }
 
+static int cec_gpio_read_5v(struct cec_adapter *adap)
+{
+	struct cec_gpio *cec = cec_get_drvdata(adap);
+
+	if (!cec->v5_gpio)
+		return -ENOTTY;
+	return gpiod_get_value(cec->v5_gpio);
+}
+
 static void cec_gpio_free(struct cec_adapter *adap)
 {
 	cec_gpio_disable_irq(adap);
@@ -144,6 +181,7 @@ static const struct cec_pin_ops cec_gpio_pin_ops = {
 	.status = cec_gpio_status,
 	.free = cec_gpio_free,
 	.read_hpd = cec_gpio_read_hpd,
+	.read_5v = cec_gpio_read_5v,
 };
 
 static int cec_gpio_probe(struct platform_device *pdev)
@@ -167,6 +205,10 @@ static int cec_gpio_probe(struct platform_device *pdev)
 	if (IS_ERR(cec->hpd_gpio))
 		return PTR_ERR(cec->hpd_gpio);
 
+	cec->v5_gpio = devm_gpiod_get_optional(dev, "v5", GPIOD_IN);
+	if (IS_ERR(cec->v5_gpio))
+		return PTR_ERR(cec->v5_gpio);
+
 	cec->adap = cec_pin_allocate_adapter(&cec_gpio_pin_ops,
 		cec, pdev->name, CEC_CAP_DEFAULTS | CEC_CAP_PHYS_ADDR |
 				 CEC_CAP_MONITOR_ALL | CEC_CAP_MONITOR_PIN);
@@ -185,6 +227,18 @@ static int cec_gpio_probe(struct platform_device *pdev)
 			return ret;
 	}
 
+	if (cec->v5_gpio) {
+		cec->v5_irq = gpiod_to_irq(cec->v5_gpio);
+		ret = devm_request_threaded_irq(dev, cec->v5_irq,
+			cec_5v_gpio_irq_handler,
+			cec_5v_gpio_irq_handler_thread,
+			IRQF_ONESHOT |
+			IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
+			"v5-gpio", cec);
+		if (ret)
+			return ret;
+	}
+
 	ret = cec_register_adapter(cec->adap, &pdev->dev);
 	if (ret) {
 		cec_delete_adapter(cec->adap);
-- 
2.18.0

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

* Re: [PATCH 1/5] cec-gpio.txt: add v5-gpios for testing the 5V line
  2018-07-17 13:29 ` [PATCH 1/5] cec-gpio.txt: add v5-gpios for testing the 5V line Hans Verkuil
@ 2018-07-20 18:05   ` Rob Herring
  2018-07-23  8:30     ` [PATCHv2 " Hans Verkuil
  0 siblings, 1 reply; 8+ messages in thread
From: Rob Herring @ 2018-07-20 18:05 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media, devicetree, Hans Verkuil

On Tue, Jul 17, 2018 at 03:29:05PM +0200, Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
> 
> In order to debug the HDMI 5V line we need to add a new v5-gpios
> property.
> 
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
>  .../devicetree/bindings/media/cec-gpio.txt      | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/cec-gpio.txt b/Documentation/devicetree/bindings/media/cec-gpio.txt
> index 12fcd55ed153..1d53ce89da74 100644
> --- a/Documentation/devicetree/bindings/media/cec-gpio.txt
> +++ b/Documentation/devicetree/bindings/media/cec-gpio.txt
> @@ -4,8 +4,8 @@ The HDMI CEC GPIO module supports CEC implementations where the CEC line
>  is hooked up to a pull-up GPIO line and - optionally - the HPD line is
>  hooked up to another GPIO line.
>  
> -Please note: the maximum voltage for the CEC line is 3.63V, for the HPD
> -line it is 5.3V. So you may need some sort of level conversion circuitry
> +Please note: the maximum voltage for the CEC line is 3.63V, for the HPD and
> +5V lines it is 5.3V. So you may need some sort of level conversion circuitry
>  when connecting them to a GPIO line.
>  
>  Required properties:
> @@ -22,15 +22,18 @@ If the CEC line is not associated with an HDMI receiver/transmitter, then
>  the following property is optional:
>  
>    - hpd-gpios: gpio that the HPD line is connected to.
> +  - v5-gpios: gpio that the 5V line is connected to.

This is a bit strange without the context of debugging. So can you 
mention that here.

With that,

Reviewed-by: Rob Herring <robh@kernel.org>

>  
>  Example for the Raspberry Pi 3 where the CEC line is connected to
> -pin 26 aka BCM7 aka CE1 on the GPIO pin header and the HPD line is
> -connected to pin 11 aka BCM17 (some level shifter is needed for this!):
> +pin 26 aka BCM7 aka CE1 on the GPIO pin header, the HPD line is
> +connected to pin 11 aka BCM17 and the 5V line is connected to pin
> +15 aka BCM22 (some level shifter is needed for the HPD and 5V lines!):
>  
>  #include <dt-bindings/gpio/gpio.h>
>  
>  cec-gpio {
> -       compatible = "cec-gpio";
> -       cec-gpios = <&gpio 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
> -       hpd-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
> +	compatible = "cec-gpio";
> +	cec-gpios = <&gpio 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
> +	hpd-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
> +	v5-gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
>  };
> -- 
> 2.18.0
> 

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

* [PATCHv2 1/5] cec-gpio.txt: add v5-gpios for testing the 5V line
  2018-07-20 18:05   ` Rob Herring
@ 2018-07-23  8:30     ` Hans Verkuil
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Verkuil @ 2018-07-23  8:30 UTC (permalink / raw)
  To: Rob Herring; +Cc: linux-media, devicetree, Hans Verkuil

In order to debug the HDMI 5V line we need to add a new v5-gpios
property.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
Changes since v1:
- Document that hpd-gpios and 5v-gpios are meant for debugging those lines.
---
 .../devicetree/bindings/media/cec-gpio.txt    | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/cec-gpio.txt b/Documentation/devicetree/bindings/media/cec-gpio.txt
index 12fcd55ed153..47e8d73d32a3 100644
--- a/Documentation/devicetree/bindings/media/cec-gpio.txt
+++ b/Documentation/devicetree/bindings/media/cec-gpio.txt
@@ -4,8 +4,8 @@ The HDMI CEC GPIO module supports CEC implementations where the CEC line
 is hooked up to a pull-up GPIO line and - optionally - the HPD line is
 hooked up to another GPIO line.

-Please note: the maximum voltage for the CEC line is 3.63V, for the HPD
-line it is 5.3V. So you may need some sort of level conversion circuitry
+Please note: the maximum voltage for the CEC line is 3.63V, for the HPD and
+5V lines it is 5.3V. So you may need some sort of level conversion circuitry
 when connecting them to a GPIO line.

 Required properties:
@@ -19,18 +19,24 @@ following property is also required:
   - hdmi-phandle - phandle to the HDMI controller, see also cec.txt.

 If the CEC line is not associated with an HDMI receiver/transmitter, then
-the following property is optional:
+the following property is optional and can be used for debugging HPD changes:

   - hpd-gpios: gpio that the HPD line is connected to.

+This property is optional and can be used for debugging changes on the 5V line:
+
+  - v5-gpios: gpio that the 5V line is connected to.
+
 Example for the Raspberry Pi 3 where the CEC line is connected to
-pin 26 aka BCM7 aka CE1 on the GPIO pin header and the HPD line is
-connected to pin 11 aka BCM17 (some level shifter is needed for this!):
+pin 26 aka BCM7 aka CE1 on the GPIO pin header, the HPD line is
+connected to pin 11 aka BCM17 and the 5V line is connected to pin
+15 aka BCM22 (some level shifter is needed for the HPD and 5V lines!):

 #include <dt-bindings/gpio/gpio.h>

 cec-gpio {
-       compatible = "cec-gpio";
-       cec-gpios = <&gpio 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
-       hpd-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
+	compatible = "cec-gpio";
+	cec-gpios = <&gpio 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+	hpd-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
+	v5-gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
 };
-- 
2.18.0


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

end of thread, other threads:[~2018-07-23  9:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-17 13:29 [PATCH 0/5] cec/cec-gpio: add support for 5V testing Hans Verkuil
2018-07-17 13:29 ` [PATCH 1/5] cec-gpio.txt: add v5-gpios for testing the 5V line Hans Verkuil
2018-07-20 18:05   ` Rob Herring
2018-07-23  8:30     ` [PATCHv2 " Hans Verkuil
2018-07-17 13:29 ` [PATCH 2/5] cec-ioc-dqevent.rst: document the new 5V events Hans Verkuil
2018-07-17 13:29 ` [PATCH 3/5] uapi/linux/cec.h: add " Hans Verkuil
2018-07-17 13:29 ` [PATCH 4/5] cec: add support for 5V signal testing Hans Verkuil
2018-07-17 13:29 ` [PATCH 5/5] cec-gpio: support 5v testing Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).