CH7322 CEC controller driver
v6 cover CH7322 CEC controller driver
Add device driver and device tree bindings for a Chrontel CEC conroller. This is an I2C device that can send and receive CEC messages.
Changes from v5:
- Kconfig option should depend on I2C, not select
- add flag to cec adapter in order to use notifier without addr updates (notifier is needed to enable CEC_CAP_CONNECTOR_INFO)
- add optional dmi matching to associate adapter with hdmi port
- read phys addr if hpd is up instead of relying on pending interrupt in device probe
Changes from v4:
- rebase onto master (vendor-prefixes.yaml already updated)
Changes from v3:
- address devicetree comments
- revert interrupt mask/unmask in cec adapter enable (the driver relies on the interrupt to get the physical address)
Changes from v2:
- fix formatting errors
- mask and unmask interrupt in cec adapter enable
Changes from v1:
- fix formatpatch.pl --strict errors
- additional comments
- enable and program logical address register
- add flags to aid interpreting transmit done status
- move ch7322 out of devicetree trivial devices
Jeff Chase (3):
dt-bindings: Add ch7322 media i2c device
media: cec: add adap_controls_phys_addr option
media: cec: i2c: ch7322: Add ch7322 CEC controller driver
.../bindings/media/i2c/chrontel,ch7322.yaml | 67 ++ MAINTAINERS | 8 + drivers/media/cec/Kconfig | 1 + drivers/media/cec/Makefile | 2 +- drivers/media/cec/core/cec-notifier.c | 11 +- drivers/media/cec/i2c/Kconfig | 14 + drivers/media/cec/i2c/Makefile | 5 + drivers/media/cec/i2c/ch7322.c | 604 ++++++++++++++++++ include/media/cec.h | 1 + 9 files changed, 708 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/i2c/chrontel,ch7322.yaml create mode 100644 drivers/media/cec/i2c/Kconfig create mode 100644 drivers/media/cec/i2c/Makefile create mode 100644 drivers/media/cec/i2c/ch7322.c
Signature · 1 line
2.27.0.111.gc72c7da667-goog
PATCH v6 1/3 dt-bindings: Add ch7322 media i2c device
The ch7322 is a Chrontel CEC controller.
--- .../bindings/media/i2c/chrontel,ch7322.yaml | 67 +++++++++++++++++++ MAINTAINERS | 7 ++ 2 files changed, 74 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/chrontel,ch7322.yaml
Documentation/devicetree/bindings/media/i2c/chrontel,ch7322.yaml new file +67 -0
@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/media/i2c/chrontel,ch7322.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Chrontel HDMI-CEC Controller + +maintainers: + - Jeff Chase <[email protected]> + +description: + The Chrontel CH7322 is a discrete HDMI-CEC controller. It is + programmable through I2C and drives a single CEC line. + +properties: + compatible: + const: chrontel,ch7322 + + reg: + description: I2C device address + maxItems: 1 + + clocks: + maxItems: 1 + + interrupts: + maxItems: 1 + + reset-gpios: + description: + Reference to the GPIO connected to the RESET pin, if any. This + pin is active-low. + maxItems: 1 + + standby-gpios: + description: + Reference to the GPIO connected to the OE pin, if any. When low + the device will respond to power status requests with "standby" + if in auto mode. + maxItems: 1 + + # see ../cec.txt + hdmi-phandle: + description: phandle to the HDMI controller + +required: + - compatible + - reg + - interrupts + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + #include <dt-bindings/interrupt-controller/irq.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + ch7322@75 { + compatible = "chrontel,ch7322"; + reg = <0x75>; + interrupts = <47 IRQ_TYPE_EDGE_RISING>; + standby-gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + reset-gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + hdmi-phandle = <&hdmi>; + }; + };
MAINTAINERS +7 -0
@@ -4101,6 +4101,13 @@ F: drivers/power/supply/cros_usbpd-charger.c N: cros_ec N: cros-ec +CHRONTEL CH7322 CEC DRIVER +M: Jeff Chase <[email protected]> +L: [email protected] +S: Maintained +T: git git://linuxtv.org/media_tree.git +F: Documentation/devicetree/bindings/media/i2c/chontel,ch7322.yaml + CIRRUS LOGIC AUDIO CODEC DRIVERS M: James Schulman <[email protected]> M: David Rhodes <[email protected]>
Signature · 1 line
2.27.0.111.gc72c7da667-goog
PATCH v6 2/3 media: cec: add adap_controls_phys_addr option
In reply to Jeff ChaseUse of the cec notifier framework is required to support CEC_CAP_CONNECTOR_INFO but some devices do not want physical address updates from the notifier. This adds an option to allow registering with a cec notifier without getting address updates.
--- drivers/media/cec/core/cec-notifier.c | 11 +++++++---- include/media/cec.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/media/cec/core/cec-notifier.c +7 -4
@@ -116,7 +116,8 @@ cec_notifier_conn_register(struct device *hdmi_dev, const char *port_name,else memset (&n->conn_info,0 ,sizeof (n->conn_info));if (n->cec_adap) { -cec_phys_addr_invalidate (n->cec_adap); +if (!n->cec_adap->adap_controls_phys_addr) +cec_phys_addr_invalidate (n->cec_adap);cec_s_conn_info (n->cec_adap, conn_info); }mutex_unlock (&n->lock);
@@ -133,7 +134,8 @@ void cec_notifier_conn_unregister(struct cec_notifier *n)memset (&n->conn_info,0 ,sizeof (n->conn_info)); n->phys_addr =CEC_PHYS_ADDR_INVALID ;if (n->cec_adap) { -cec_phys_addr_invalidate (n->cec_adap); +if (!n->cec_adap->adap_controls_phys_addr) +cec_phys_addr_invalidate (n->cec_adap);cec_s_conn_info (n->cec_adap,NULL ); }mutex_unlock (&n->lock);
@@ -158,7 +160,8 @@ cec_notifier_cec_adap_register(struct device *hdmi_dev, const char *port_name, n->cec_adap = adap; adap->conn_info = n->conn_info; adap->notifier = n; -cec_s_phys_addr (adap, n->phys_addr, false); +if (!adap->adap_controls_phys_addr) +cec_s_phys_addr (adap, n->phys_addr, false);mutex_unlock (&n->lock);return n; }
@@ -185,7 +188,7 @@ void cec_notifier_set_phys_addr(struct cec_notifier *n, u16 pa)mutex_lock (&n->lock); n->phys_addr = pa; -if (n->cec_adap) +if (n->cec_adap && !n->cec_adap->adap_controls_phys_addr)cec_s_phys_addr (n->cec_adap, n->phys_addr, false);mutex_unlock (&n->lock); }
include/media/cec.h +1 -0
@@ -174,6 +174,7 @@ struct cec_adapter {bool is_configuring;bool is_configured;bool cec_pin_is_high; +bool adap_controls_phys_addr;u8 last_initiator;u32 monitor_all_cnt;u32 monitor_pin_cnt;
Signature · 1 line
2.27.0.111.gc72c7da667-goog
PATCH v6 3/3 media: cec: i2c: ch7322: Add ch7322 CEC controller driver
In reply to Jeff ChaseAdd a CEC device driver for the Chrontel ch7322 CEC conroller. This is an I2C device capable of sending and receiving CEC messages.
--- MAINTAINERS | 1 + drivers/media/cec/Kconfig | 1 + drivers/media/cec/Makefile | 2 +- drivers/media/cec/i2c/Kconfig | 14 + drivers/media/cec/i2c/Makefile | 5 + drivers/media/cec/i2c/ch7322.c | 604 +++++++++++++++++++++++++++++++++ 6 files changed, 626 insertions(+), 1 deletion(-) create mode 100644 drivers/media/cec/i2c/Kconfig create mode 100644 drivers/media/cec/i2c/Makefile create mode 100644 drivers/media/cec/i2c/ch7322.c
MAINTAINERS +1 -0
@@ -4107,6 +4107,7 @@ L: [email protected] S: Maintained T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/chontel,ch7322.yaml +F: drivers/media/cec/i2c/ch7322.c CIRRUS LOGIC AUDIO CODEC DRIVERS M: James Schulman <[email protected]>
drivers/media/cec/Kconfig +1 -0
@@ -33,6 +33,7 @@ menuconfig MEDIA_CEC_SUPPORT adapter that supports HDMI CEC. if MEDIA_CEC_SUPPORT +source "drivers/media/cec/i2c/Kconfig" source "drivers/media/cec/platform/Kconfig" source "drivers/media/cec/usb/Kconfig" endif
drivers/media/cec/Makefile +1 -1
@@ -1,2 +1,2 @@ # SPDX-License-Identifier: GPL-2.0 -obj-y += core/ platform/ usb/ +obj-y += core/ i2c/ platform/ usb/
drivers/media/cec/i2c/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# I2C drivers + +config CEC_CH7322 + tristate "Chrontel CH7322 CEC controller" + depends on I2C + select REGMAP_I2C + select CEC_CORE + help + This is a driver for the Chrontel CH7322 CEC controller. It uses the + generic CEC framework interface. + CEC bus is present in the HDMI connector and enables communication + between compatible devices.
drivers/media/cec/i2c/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for the CEC I2C device drivers. +# +obj-$(CONFIG_CEC_CH7322) += ch7322.o
drivers/media/cec/i2c/ch7322.c new file +604 -0
604 lines not on this page · raw message
Signature · 1 line
2.27.0.111.gc72c7da667-goog