Skip to contentSkip to conversation

Add SECO Boards CEC device driver

PATCH New ektor5 1 participant 3 messages Oct 21, 2018 Media (V4L/DVB)

lore
Share & tools
lore

ektor5

author
#0 lore raw

v4 cover Add SECO Boards CEC device driver

This series of patches aims to add CEC functionalities to SECO devices, in particular UDOO X86.

The communication is achieved via Braswell SMBus (i2c-i801) to the onboard STM32 microcontroller that handles the CEC signals. The driver use direct access to the PCI addresses, due to the limitations of the specific driver in presence of ACPI calls.

The basic functionalities are tested with success with cec-ctl and cec-compliance.

v4:
- Reduced SMBus timeout
- Removed/updated debug printouts
- Removed useless return values
- Update SECO denomination

v3:
- Refactored rx/tx for loops
- Removed more debug prints
- Sorted headers

v2:
- Removed useless debug prints
- Added DMI && PCI to dependences
- Removed useless ifdefs
- Renamed all irda references to ir
- Fixed SPDX clause
- Several style fixes

Ettore Chimenti (2):
media: add SECO cec driver
seco-cec: add Consumer-IR support

 MAINTAINERS                                |   6 +
 drivers/media/platform/Kconfig             |  22 +
 drivers/media/platform/Makefile            |   2 +
 drivers/media/platform/seco-cec/Makefile   |   1 +
 drivers/media/platform/seco-cec/seco-cec.c | 795 +++++++++++++++++++++
 drivers/media/platform/seco-cec/seco-cec.h | 141 ++++
 6 files changed, 967 insertions(+)
 create mode 100644 drivers/media/platform/seco-cec/Makefile
 create mode 100644 drivers/media/platform/seco-cec/seco-cec.c
 create mode 100644 drivers/media/platform/seco-cec/seco-cec.h
Signature · 1 line
2.18.0
author
#1 lore raw

PATCH v4 1/2 media: add SECO cec driver

From: Ettore Chimenti <[email protected]>

This patch adds support to the CEC device implemented with a STM32 microcontroller in X86 SECO Boards, including UDOO X86.

The communication is achieved via Braswell integrated SMBus (i2c-i801). The driver use direct access to the PCI addresses, due to the limitations of the specific driver in presence of ACPI calls.

The basic functionalities are tested with success with cec-ctl and cec-compliance.

Inspired by cros-ec-cec implementation, attaches to i915 driver cec-notifier.

---
 MAINTAINERS                                |   6 +
 drivers/media/platform/Kconfig             |  12 +
 drivers/media/platform/Makefile            |   2 +
 drivers/media/platform/seco-cec/Makefile   |   1 +
 drivers/media/platform/seco-cec/seco-cec.c | 672 +++++++++++++++++++++
 drivers/media/platform/seco-cec/seco-cec.h | 130 ++++
 6 files changed, 823 insertions(+)
 create mode 100644 drivers/media/platform/seco-cec/Makefile
 create mode 100644 drivers/media/platform/seco-cec/seco-cec.c
 create mode 100644 drivers/media/platform/seco-cec/seco-cec.h
MAINTAINERS +6 -0
index 4ece30f15777..1062912a5ff4 100644
@@ -12972,6 +12972,12 @@ L:	[email protected] (subscribers-only)
 S:	Maintained
 F:	drivers/mmc/host/sdricoh_cs.c
 
+SECO BOARDS CEC DRIVER
+M:	Ettore Chimenti <[email protected]>
+S:	Maintained
+F:	drivers/media/platform/seco-cec/seco-cec.c
+F:	drivers/media/platform/seco-cec/seco-cec.h
+
 SECURE COMPUTING
 M:	Kees Cook <[email protected]>
 R:	Andy Lutomirski <[email protected]>
drivers/media/platform/Kconfig +12 -0
index 94c1fe0e9787..51cd1fd005e3 100644
@@ -613,6 +613,18 @@ config VIDEO_TEGRA_HDMI_CEC
 	 The CEC bus is present in the HDMI connector and enables communication
 	 between compatible devices.
 
+config VIDEO_SECO_CEC
+	tristate "SECO Boards HDMI CEC driver"
+	depends on (X86 || IA64) || COMPILE_TEST
+	depends on PCI && DMI
+	select CEC_CORE
+	select CEC_NOTIFIER
+	help
+	  This is a driver for SECO Boards integrated CEC interface.
+	  Selecting it will enable support for this device.
+	  CEC bus is present in the HDMI connector and enables communication
+	  between compatible devices.
+
 endif #CEC_PLATFORM_DRIVERS
 
 menuconfig SDR_PLATFORM_DRIVERS
drivers/media/platform/Makefile +2 -0
index 41322ab65802..5d2b06c4c68a 100644
@@ -53,6 +53,8 @@ obj-$(CONFIG_VIDEO_TEGRA_HDMI_CEC)	+= tegra-cec/
 
 obj-y					+= stm32/
 
+obj-$(CONFIG_VIDEO_SECO_CEC)		+= seco-cec/
+
 obj-y					+= davinci/
 
 obj-$(CONFIG_VIDEO_SH_VOU)		+= sh_vou.o
drivers/media/platform/seco-cec/Makefile new file +1 -0
new file mode 100644
index 000000000000..09900b087d02
@@ -0,0 +1 @@
+obj-y += seco-cec.o
drivers/media/platform/seco-cec/seco-cec.c new file +672 -0

672 lines not on this page · raw message

drivers/media/platform/seco-cec/seco-cec.h new file +130 -0

130 lines not on this page · raw message

Signature · 1 line
2.18.0
author
#2 lore raw

PATCH v4 2/2 seco-cec: add Consumer-IR support

In reply to ektor5

From: Ettore Chimenti <[email protected]>

Introduce support for Consumer-IR into seco-cec driver, as it shares the same interrupt for receiving messages.
The device decodes RC5 signals only, defaults to hauppauge mapping. It will spawn an input interface using the RC framework (like CEC device).

---
 drivers/media/platform/Kconfig             |  10 ++
 drivers/media/platform/seco-cec/seco-cec.c | 125 ++++++++++++++++++++-
 drivers/media/platform/seco-cec/seco-cec.h |  11 ++
 3 files changed, 145 insertions(+), 1 deletion(-)
drivers/media/platform/Kconfig +10 -0
index 51cd1fd005e3..e6b45da2af6d 100644
@@ -625,6 +625,16 @@ config VIDEO_SECO_CEC
 	  CEC bus is present in the HDMI connector and enables communication
 	  between compatible devices.
 
+config VIDEO_SECO_RC
+	bool "SECO Boards IR RC5 support"
+	depends on VIDEO_SECO_CEC
+	select RC_CORE
+	help
+	  If you say yes here you will get support for the
+	  SECO Boards Consumer-IR in seco-cec driver.
+	  The embedded controller supports RC5 protocol only, default mapping
+	  is set to rc-hauppauge.
+
 endif #CEC_PLATFORM_DRIVERS
 
 menuconfig SDR_PLATFORM_DRIVERS
drivers/media/platform/seco-cec/seco-cec.c +124 -1

156 lines not on this page · raw message

drivers/media/platform/seco-cec/seco-cec.h +11 -0
index be5a657ae462..e632c4a2a044 100644
@@ -99,6 +99,17 @@
 
 #define SECOCEC_IR_READ_DATA		0x3e
 
+/*
+ * IR
+ */
+
+#define SECOCEC_IR_COMMAND_MASK		0x007F
+#define SECOCEC_IR_COMMAND_SHL		0
+#define SECOCEC_IR_ADDRESS_MASK		0x1F00
+#define SECOCEC_IR_ADDRESS_SHL		7
+#define SECOCEC_IR_TOGGLE_MASK		0x8000
+#define SECOCEC_IR_TOGGLE_SHL		15
+
 /*
  * Enabling register
  */
Signature · 1 line
2.18.0