Skip to contentSkip to conversation

media: platform: Add support for the Amlogic Meson G12A AO CEC Controller

PATCH New Neil Armstrong 1 participant 4 messages Apr 12, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v5 cover media: platform: Add support for the Amlogic Meson G12A AO CEC Controller

The Amlogic G12A SoC embeds a second CEC controller with a totally different design.

The two controller can work in the same time since the CEC line can be set to two different pins on the two controllers.

This second CEC controller is documented as "AO-CEC-B", thus the registers will be named "CECB_" to differentiate with the other AO-CEC driver.

Unlike the other AO-CEC controller, this one takes the Oscillator clock as input and embeds a dual-divider to provide a precise 32768Hz clock for communication. This is handled by registering a clock in the driver.

Unlike the other AO-CEC controller, this controller supports setting up to 15 logical addresses and supports the signal_free_time settings in the transmit function.

Unfortunately, this controller does not support "monitor" mode.

This patchset :
- Update the bindings for this controller
- Add the controller driver
- Update the MAINTAINERS entry

Changes since v4:
- Rebased on top of [2] to use cec_notifier_parse_hdmi_phandle()
- Added Kconfig dependency on COMMON_CLK and OF, and selects REGMAP & REGMAP_MMIO

Changes since v3:
- Use the cec_notifier_find_hdmi_dev() introduced in [1]

Changes since v2:
- Really fixed compatible used in driver
- Collected bindings review tag

Changes since v1:
- Fixed typos in bindings
- Fixed compatible used in driver, using the bindings defined one
- Fix regmap return value handling
- Fix irq error handling
- Fixed wrong clk unprepare on oscin

[1] https://patchwork.linuxtv.org/patch/55513/
[2] https://patchwork.linuxtv.org/patch/55588/

Neil Armstrong (3):
media: dt-bindings: media: meson-ao-cec: Add G12A AO-CEC-B Compatible
media: platform: meson: Add Amlogic Meson G12A AO CEC Controller
driver
MAINTAINERS: Update AO CEC with ao-cec-g12a driver

 .../bindings/media/meson-ao-cec.txt           |  13 +-
 MAINTAINERS                                   |   1 +
 drivers/media/platform/Kconfig                |  16 +
 drivers/media/platform/meson/Makefile         |   1 +
 drivers/media/platform/meson/ao-cec-g12a.c    | 779 ++++++++++++++++++
 5 files changed, 807 insertions(+), 3 deletions(-)
 create mode 100644 drivers/media/platform/meson/ao-cec-g12a.c
Signature · 1 line
2.21.0
#1 lore raw

PATCH v5 1/3 media: dt-bindings: media: meson-ao-cec: Add G12A AO-CEC-B Compatible

The Amlogic G12A embeds a second CEC controller named AO-CEC-B, and the other one is AO-CEC-A described by the current bindings.

The register interface is very close but the internal architecture is totally different.

The other difference is the clock source, the AO-CEC-B takes the "oscin", the Always-On Oscillator clock, as input and embeds a dual-divider clock divider to provide the precise 32768Hz base clock for CEC communication.

---
 .../devicetree/bindings/media/meson-ao-cec.txt      | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/media/meson-ao-cec.txt +10 -3
index 8671bdb08080..c67fc41d4aa2 100644
@@ -4,16 +4,23 @@ The Amlogic Meson AO-CEC module is present is Amlogic SoCs and its purpose is
 to handle communication between HDMI connected devices over the CEC bus.
 
 Required properties:
-  - compatible : value should be following
+  - compatible : value should be following depending on the SoC :
+	For GXBB, GXL, GXM and G12A (AO_CEC_A module) :
 	"amlogic,meson-gx-ao-cec"
+	For G12A (AO_CEC_B module) :
+	"amlogic,meson-g12a-ao-cec"
 
   - reg : Physical base address of the IP registers and length of memory
 	  mapped region.
 
   - interrupts : AO-CEC interrupt number to the CPU.
   - clocks : from common clock binding: handle to AO-CEC clock.
-  - clock-names : from common clock binding: must contain "core",
-		  corresponding to entry in the clocks property.
+  - clock-names : from common clock binding, must contain :
+		For GXBB, GXL, GXM and G12A (AO_CEC_A module) :
+		- "core"
+		For G12A (AO_CEC_B module) :
+		- "oscin"
+		corresponding to entry in the clocks property.
   - hdmi-phandle: phandle to the HDMI controller
 
 Example:
Signature · 1 line
2.21.0
#2 lore raw

PATCH v5 2/3 media: platform: meson: Add Amlogic Meson G12A AO CEC Controller driver

In reply to Neil Armstrong

The Amlogic G12A SoC embeds a second CEC controller with a totally different design.

The two controller can work in the same time since the CEC line can be set to two different pins on the two controllers.

This second CEC controller is documented as "AO-CEC-B", thus the registers will be named "CECB_" to differentiate with the other AO-CEC driver.

Unlike the other AO-CEC controller, this one takes the Oscillator clock as input and embeds a dual-divider to provide a precise 32768Hz clock for communication. This is handled by registering a clock in the driver.

Unlike the other AO-CEC controller, this controller supports setting up to 15 logical addresses and supports the signal_free_time settings in the transmit function.

Unfortunately, this controller does not support "monitor" mode.

---
 drivers/media/platform/Kconfig             |  16 +
 drivers/media/platform/meson/Makefile      |   1 +
 drivers/media/platform/meson/ao-cec-g12a.c | 779 +++++++++++++++++++++
 3 files changed, 796 insertions(+)
 create mode 100644 drivers/media/platform/meson/ao-cec-g12a.c
drivers/media/platform/Kconfig +16 -0
index 4acbed189644..ea3a65e1ddbc 100644
@@ -578,6 +578,22 @@ config VIDEO_MESON_AO_CEC
 	  generic CEC framework interface.
 	  CEC bus is present in the HDMI connector and enables communication
 
+config VIDEO_MESON_G12A_AO_CEC
+	tristate "Amlogic Meson G12A AO CEC driver"
+	depends on ARCH_MESON || COMPILE_TEST
+	depends on COMMON_CLK && OF
+	select REGMAP
+	select REGMAP_MMIO
+	select CEC_CORE
+	select CEC_NOTIFIER
+	---help---
+	  This is a driver for Amlogic Meson G12A SoCs AO CEC interface.
+	  This driver if for the new AO-CEC module found in G12A SoCs,
+	  usually named AO_CEC_B in documentation.
+	  It uses the generic CEC framework interface.
+	  CEC bus is present in the HDMI connector and enables communication
+	  between compatible devices.
+
 config CEC_GPIO
 	tristate "Generic GPIO-based CEC driver"
 	depends on PREEMPT || COMPILE_TEST
drivers/media/platform/meson/Makefile +1 -0
index 597beb8f34d1..f611c23c3718 100644
@@ -1 +1,2 @@
 obj-$(CONFIG_VIDEO_MESON_AO_CEC)	+= ao-cec.o
+obj-$(CONFIG_VIDEO_MESON_G12A_AO_CEC)	+= ao-cec-g12a.o
drivers/media/platform/meson/ao-cec-g12a.c new file +779 -0

779 lines not on this page · raw message

Signature · 1 line
2.21.0
#3 lore raw

PATCH v5 3/3 MAINTAINERS: Update AO CEC with ao-cec-g12a driver

In reply to Neil Armstrong

Update the MAINTAINERS entry with the new AO-CEC driver for G12A.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index e17ebf70b548..bbad8f3ee3e8 100644
@@ -10046,6 +10046,7 @@ L:	[email protected]
 W:	http://linux-meson.com/
 S:	Supported
 F:	drivers/media/platform/meson/ao-cec.c
+F:	drivers/media/platform/meson/ao-cec-g12a.c
 F:	Documentation/devicetree/bindings/media/meson-ao-cec.txt
 T:	git git://linuxtv.org/media_tree.git
 
Signature · 1 line
2.21.0