All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for v4.12 0/3] cec: clean up Kconfig, headers
@ 2017-04-18  8:45 Hans Verkuil
  2017-04-18  8:45 ` [PATCH for v4.12 1/3] cec: Kconfig cleanup Hans Verkuil
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hans Verkuil @ 2017-04-18  8:45 UTC (permalink / raw)
  To: linux-media; +Cc: Benjamin Gaignard, Marek Szyprowski

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

This patch series cleans up the various CEC config options.

In particular it adds a CEC_CORE config option which is what CEC drivers
should depend on, and it removes the MEDIA_CEC_EDID config option which
was rather pointless.

Finally it adds a new option to explicitly enable the RC passthrough
support in CEC.

It also moves cec-edid.c and cec-notifier.c to the media/cec directory
and merges them into the cec module instead of having separate modules
for these. And the cec-edid.h header is merged into cec.h.

CEC drivers now just depend on CEC_CORE. And if the CEC drivers needs
the CEC notifier framework, then it has to select CEC_NOTIFIER.

I would like to see this merged for 4.12 before more CEC drivers get
merged.

Regards,

	Hans

Hans Verkuil (3):
  cec: Kconfig cleanup
  cec.h: merge cec-edid.h into cec.h
  cec: add MEDIA_CEC_RC config option

 MAINTAINERS                              |   3 -
 drivers/media/Kconfig                    |  26 +++-----
 drivers/media/Makefile                   |  14 +----
 drivers/media/cec/Kconfig                |  19 ++++++
 drivers/media/cec/Makefile               |   8 ++-
 drivers/media/cec/cec-adap.c             |   4 +-
 drivers/media/cec/cec-core.c             |  12 ++--
 drivers/media/{ => cec}/cec-edid.c       |   6 +-
 drivers/media/{ => cec}/cec-notifier.c   |   1 +
 drivers/media/i2c/Kconfig                |   9 +--
 drivers/media/platform/Kconfig           |  56 ++++++++---------
 drivers/media/platform/s5p-cec/s5p_cec.c |   1 -
 drivers/media/platform/vivid/Kconfig     |   3 +-
 drivers/media/usb/pulse8-cec/Kconfig     |   2 +-
 drivers/media/usb/rainshadow-cec/Kconfig |   2 +-
 include/media/cec-edid.h                 | 104 -------------------------------
 include/media/cec-notifier.h             |   2 +-
 include/media/cec.h                      | 104 ++++++++++++++++++++++++++++++-
 18 files changed, 180 insertions(+), 196 deletions(-)
 create mode 100644 drivers/media/cec/Kconfig
 rename drivers/media/{ => cec}/cec-edid.c (96%)
 rename drivers/media/{ => cec}/cec-notifier.c (99%)
 delete mode 100644 include/media/cec-edid.h

-- 
2.11.0

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

* [PATCH for v4.12 1/3] cec: Kconfig cleanup
  2017-04-18  8:45 [PATCH for v4.12 0/3] cec: clean up Kconfig, headers Hans Verkuil
@ 2017-04-18  8:45 ` Hans Verkuil
  2017-04-18 10:13   ` Benjamin Gaignard
  2017-04-18  8:46 ` [PATCH for v4.12 2/3] cec.h: merge cec-edid.h into cec.h Hans Verkuil
  2017-04-18  8:46 ` [PATCH for v4.12 3/3] cec: add MEDIA_CEC_RC config option Hans Verkuil
  2 siblings, 1 reply; 5+ messages in thread
From: Hans Verkuil @ 2017-04-18  8:45 UTC (permalink / raw)
  To: linux-media; +Cc: Benjamin Gaignard, Marek Szyprowski, Hans Verkuil

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

The Kconfig options for the CEC subsystem were a bit messy. In
addition there were two cec sources (cec-edid.c and cec-notifier.c)
that were outside of the media/cec directory, which was weird.

Move those sources to media/cec as well.

The cec-edid and cec-notifier functionality is now part of the cec
module and these are no longer separate modules.

Also remove the MEDIA_CEC_EDID config option and include it with the
main CEC config option (which defined CEC_EDID anyway).

Added static inlines to cec-edid.h for dummy functions when CEC_CORE
isn't defined.

CEC drivers should now depend on CEC_CORE.

CEC drivers that need the cec-notifier functionality must explicitly
select CEC_NOTIFIER.

The s5p-cec and stih-cec drivers depended on VIDEO_DEV instead of
CEC_CORE, fix that as well.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 MAINTAINERS                              |  2 --
 drivers/media/Kconfig                    | 26 ++++-----------
 drivers/media/Makefile                   | 14 ++------
 drivers/media/cec/Kconfig                | 13 ++++++++
 drivers/media/cec/Makefile               |  8 +++--
 drivers/media/{ => cec}/cec-edid.c       |  4 ---
 drivers/media/{ => cec}/cec-notifier.c   |  0
 drivers/media/i2c/Kconfig                |  9 ++---
 drivers/media/platform/Kconfig           | 56 ++++++++++++++++----------------
 drivers/media/platform/vivid/Kconfig     |  3 +-
 drivers/media/usb/pulse8-cec/Kconfig     |  2 +-
 drivers/media/usb/rainshadow-cec/Kconfig |  2 +-
 include/media/cec-edid.h                 | 29 +++++++++++++++++
 include/media/cec.h                      |  2 +-
 14 files changed, 91 insertions(+), 79 deletions(-)
 create mode 100644 drivers/media/cec/Kconfig
 rename drivers/media/{ => cec}/cec-edid.c (97%)
 rename drivers/media/{ => cec}/cec-notifier.c (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7d3b9993e4ba..1b0049934cf9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3075,8 +3075,6 @@ S:	Supported
 F:	Documentation/media/kapi/cec-core.rst
 F:	Documentation/media/uapi/cec
 F:	drivers/media/cec/
-F:	drivers/media/cec-edid.c
-F:	drivers/media/cec-notifier.c
 F:	drivers/media/rc/keymaps/rc-cec.c
 F:	include/media/cec.h
 F:	include/media/cec-edid.h
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index 9e9ded44e8a8..b72edd27f880 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -81,27 +81,15 @@ config MEDIA_RC_SUPPORT
 	  Say Y when you have a TV or an IR device.
 
 config MEDIA_CEC_SUPPORT
-	bool "HDMI CEC support"
-	select MEDIA_CEC_EDID
-	---help---
-	  Enable support for HDMI CEC (Consumer Electronics Control),
-	  which is an optional HDMI feature.
-
-	  Say Y when you have an HDMI receiver, transmitter or a USB CEC
-	  adapter that supports HDMI CEC.
-
-config MEDIA_CEC_DEBUG
-	bool "HDMI CEC debugfs interface"
-	depends on MEDIA_CEC_SUPPORT && DEBUG_FS
-	---help---
-	  Turns on the DebugFS interface for CEC devices.
+       bool "HDMI CEC support"
+       ---help---
+         Enable support for HDMI CEC (Consumer Electronics Control),
+         which is an optional HDMI feature.
 
-config MEDIA_CEC_EDID
-	bool
+         Say Y when you have an HDMI receiver, transmitter or a USB CEC
+         adapter that supports HDMI CEC.
 
-config MEDIA_CEC_NOTIFIER
-	bool
-	select MEDIA_CEC_EDID
+source "drivers/media/cec/Kconfig"
 
 #
 # Media controller
diff --git a/drivers/media/Makefile b/drivers/media/Makefile
index 8b36a571d443..523fea3648ad 100644
--- a/drivers/media/Makefile
+++ b/drivers/media/Makefile
@@ -2,20 +2,10 @@
 # Makefile for the kernel multimedia device drivers.
 #
 
-ifeq ($(CONFIG_MEDIA_CEC_EDID),y)
-  obj-$(CONFIG_MEDIA_SUPPORT) += cec-edid.o
-endif
-
-ifeq ($(CONFIG_MEDIA_CEC_NOTIFIER),y)
-  obj-$(CONFIG_MEDIA_SUPPORT) += cec-notifier.o
-endif
-
-ifeq ($(CONFIG_MEDIA_CEC_SUPPORT),y)
-  obj-$(CONFIG_MEDIA_SUPPORT) += cec/
-endif
-
 media-objs	:= media-device.o media-devnode.o media-entity.o
 
+obj-$(CONFIG_CEC_CORE) += cec/
+
 #
 # I2C drivers should come before other drivers, otherwise they'll fail
 # when compiled as builtin drivers
diff --git a/drivers/media/cec/Kconfig b/drivers/media/cec/Kconfig
new file mode 100644
index 000000000000..24b53187ee52
--- /dev/null
+++ b/drivers/media/cec/Kconfig
@@ -0,0 +1,13 @@
+config CEC_CORE
+	tristate
+	depends on MEDIA_CEC_SUPPORT
+	default y
+
+config MEDIA_CEC_NOTIFIER
+	bool
+
+config MEDIA_CEC_DEBUG
+	bool "HDMI CEC debugfs interface"
+	depends on MEDIA_CEC_SUPPORT && DEBUG_FS
+	---help---
+	  Turns on the DebugFS interface for CEC devices.
diff --git a/drivers/media/cec/Makefile b/drivers/media/cec/Makefile
index d6686337275f..402a6c62a3e8 100644
--- a/drivers/media/cec/Makefile
+++ b/drivers/media/cec/Makefile
@@ -1,5 +1,7 @@
-cec-objs := cec-core.o cec-adap.o cec-api.o
+cec-objs := cec-core.o cec-adap.o cec-api.o cec-edid.o
 
-ifeq ($(CONFIG_MEDIA_CEC_SUPPORT),y)
-  obj-$(CONFIG_MEDIA_SUPPORT) += cec.o
+ifeq ($(CONFIG_MEDIA_CEC_NOTIFIER),y)
+  cec-objs += cec-notifier.o
 endif
+
+obj-$(CONFIG_CEC_CORE) += cec.o
diff --git a/drivers/media/cec-edid.c b/drivers/media/cec/cec-edid.c
similarity index 97%
rename from drivers/media/cec-edid.c
rename to drivers/media/cec/cec-edid.c
index 5719b991e340..c63dc81d2a29 100644
--- a/drivers/media/cec-edid.c
+++ b/drivers/media/cec/cec-edid.c
@@ -165,7 +165,3 @@ int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(cec_phys_addr_validate);
-
-MODULE_AUTHOR("Hans Verkuil <hans.verkuil@cisco.com>");
-MODULE_DESCRIPTION("CEC EDID helper functions");
-MODULE_LICENSE("GPL");
diff --git a/drivers/media/cec-notifier.c b/drivers/media/cec/cec-notifier.c
similarity index 100%
rename from drivers/media/cec-notifier.c
rename to drivers/media/cec/cec-notifier.c
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index b358d1a40688..40bb4bdc51da 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -209,7 +209,6 @@ config VIDEO_ADV7604
 	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
 	depends on GPIOLIB || COMPILE_TEST
 	select HDMI
-	select MEDIA_CEC_EDID
 	---help---
 	  Support for the Analog Devices ADV7604 video decoder.
 
@@ -221,7 +220,7 @@ config VIDEO_ADV7604
 
 config VIDEO_ADV7604_CEC
 	bool "Enable Analog Devices ADV7604 CEC support"
-	depends on VIDEO_ADV7604 && MEDIA_CEC_SUPPORT
+	depends on VIDEO_ADV7604 && CEC_CORE
 	---help---
 	  When selected the adv7604 will support the optional
 	  HDMI CEC feature.
@@ -230,7 +229,6 @@ config VIDEO_ADV7842
 	tristate "Analog Devices ADV7842 decoder"
 	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
 	select HDMI
-	select MEDIA_CEC_EDID
 	---help---
 	  Support for the Analog Devices ADV7842 video decoder.
 
@@ -242,7 +240,7 @@ config VIDEO_ADV7842
 
 config VIDEO_ADV7842_CEC
 	bool "Enable Analog Devices ADV7842 CEC support"
-	depends on VIDEO_ADV7842 && MEDIA_CEC_SUPPORT
+	depends on VIDEO_ADV7842 && CEC_CORE
 	---help---
 	  When selected the adv7842 will support the optional
 	  HDMI CEC feature.
@@ -470,7 +468,6 @@ config VIDEO_ADV7511
 	tristate "Analog Devices ADV7511 encoder"
 	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
 	select HDMI
-	select MEDIA_CEC_EDID
 	---help---
 	  Support for the Analog Devices ADV7511 video encoder.
 
@@ -481,7 +478,7 @@ config VIDEO_ADV7511
 
 config VIDEO_ADV7511_CEC
 	bool "Enable Analog Devices ADV7511 CEC support"
-	depends on VIDEO_ADV7511 && MEDIA_CEC_SUPPORT
+	depends on VIDEO_ADV7511 && CEC_CORE
 	---help---
 	  When selected the adv7511 will support the optional
 	  HDMI CEC feature.
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 73c3bc5deadf..ac026ee1ca07 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -461,34 +461,6 @@ config VIDEO_TI_SC
 config VIDEO_TI_CSC
 	tristate
 
-menuconfig V4L_CEC_DRIVERS
-	bool "Platform HDMI CEC drivers"
-	depends on MEDIA_CEC_SUPPORT
-
-if V4L_CEC_DRIVERS
-
-config VIDEO_SAMSUNG_S5P_CEC
-       tristate "Samsung S5P CEC driver"
-       depends on VIDEO_DEV && MEDIA_CEC_SUPPORT && (PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST)
-       select MEDIA_CEC_NOTIFIER
-       ---help---
-         This is a driver for Samsung S5P HDMI CEC interface. It uses the
-         generic CEC framework interface.
-         CEC bus is present in the HDMI connector and enables communication
-         between compatible devices.
-
-config VIDEO_STI_HDMI_CEC
-       tristate "STMicroelectronics STiH4xx HDMI CEC driver"
-       depends on VIDEO_DEV && MEDIA_CEC_SUPPORT && (ARCH_STI || COMPILE_TEST)
-       select MEDIA_CEC_NOTIFIER
-       ---help---
-         This is a driver for STIH4xx HDMI CEC interface. It uses the
-         generic CEC framework interface.
-         CEC bus is present in the HDMI connector and enables communication
-         between compatible devices.
-
-endif #V4L_CEC_DRIVERS
-
 menuconfig V4L_TEST_DRIVERS
 	bool "Media test drivers"
 	depends on MEDIA_CAMERA_SUPPORT
@@ -520,3 +492,31 @@ menuconfig DVB_PLATFORM_DRIVERS
 if DVB_PLATFORM_DRIVERS
 source "drivers/media/platform/sti/c8sectpfe/Kconfig"
 endif #DVB_PLATFORM_DRIVERS
+
+menuconfig CEC_PLATFORM_DRIVERS
+	bool "CEC platform devices"
+	depends on MEDIA_CEC_SUPPORT
+
+if CEC_PLATFORM_DRIVERS
+
+config VIDEO_SAMSUNG_S5P_CEC
+       tristate "Samsung S5P CEC driver"
+       depends on CEC_CORE && (PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST)
+       select MEDIA_CEC_NOTIFIER
+       ---help---
+         This is a driver for Samsung S5P HDMI CEC interface. It uses the
+         generic CEC framework interface.
+         CEC bus is present in the HDMI connector and enables communication
+         between compatible devices.
+
+config VIDEO_STI_HDMI_CEC
+       tristate "STMicroelectronics STiH4xx HDMI CEC driver"
+       depends on CEC_CORE && (ARCH_STI || COMPILE_TEST)
+       select MEDIA_CEC_NOTIFIER
+       ---help---
+         This is a driver for STIH4xx HDMI CEC interface. It uses the
+         generic CEC framework interface.
+         CEC bus is present in the HDMI connector and enables communication
+         between compatible devices.
+
+endif #CEC_PLATFORM_DRIVERS
diff --git a/drivers/media/platform/vivid/Kconfig b/drivers/media/platform/vivid/Kconfig
index 94ab1364a792..b36ac19dc6e4 100644
--- a/drivers/media/platform/vivid/Kconfig
+++ b/drivers/media/platform/vivid/Kconfig
@@ -7,7 +7,6 @@ config VIDEO_VIVID
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
-	select MEDIA_CEC_EDID
 	select VIDEOBUF2_VMALLOC
 	select VIDEOBUF2_DMA_CONTIG
 	select VIDEO_V4L2_TPG
@@ -27,7 +26,7 @@ config VIDEO_VIVID
 
 config VIDEO_VIVID_CEC
 	bool "Enable CEC emulation support"
-	depends on VIDEO_VIVID && MEDIA_CEC_SUPPORT
+	depends on VIDEO_VIVID && CEC_CORE
 	---help---
 	  When selected the vivid module will emulate the optional
 	  HDMI CEC feature.
diff --git a/drivers/media/usb/pulse8-cec/Kconfig b/drivers/media/usb/pulse8-cec/Kconfig
index 6ffc407de62f..8937f3986a01 100644
--- a/drivers/media/usb/pulse8-cec/Kconfig
+++ b/drivers/media/usb/pulse8-cec/Kconfig
@@ -1,6 +1,6 @@
 config USB_PULSE8_CEC
 	tristate "Pulse Eight HDMI CEC"
-	depends on USB_ACM && MEDIA_CEC_SUPPORT
+	depends on USB_ACM && CEC_CORE
 	select SERIO
 	select SERIO_SERPORT
 	---help---
diff --git a/drivers/media/usb/rainshadow-cec/Kconfig b/drivers/media/usb/rainshadow-cec/Kconfig
index 447291b3cca3..3eb86607efb8 100644
--- a/drivers/media/usb/rainshadow-cec/Kconfig
+++ b/drivers/media/usb/rainshadow-cec/Kconfig
@@ -1,6 +1,6 @@
 config USB_RAINSHADOW_CEC
 	tristate "RainShadow Tech HDMI CEC"
-	depends on USB_ACM && MEDIA_CEC_SUPPORT
+	depends on USB_ACM && CEC_CORE
 	select SERIO
 	select SERIO_SERPORT
 	---help---
diff --git a/include/media/cec-edid.h b/include/media/cec-edid.h
index bdf731ecba1a..242781fd377f 100644
--- a/include/media/cec-edid.h
+++ b/include/media/cec-edid.h
@@ -26,6 +26,8 @@
 #define cec_phys_addr_exp(pa) \
 	((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf
 
+#if IS_ENABLED(CONFIG_CEC_CORE)
+
 /**
  * cec_get_edid_phys_addr() - find and return the physical address
  *
@@ -101,4 +103,31 @@ u16 cec_phys_addr_for_input(u16 phys_addr, u8 input);
  */
 int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port);
 
+#else
+
+static inline u16 cec_get_edid_phys_addr(const u8 *edid, unsigned int size,
+					 unsigned int *offset)
+{
+	if (offset)
+		*offset = 0;
+	return CEC_PHYS_ADDR_INVALID;
+}
+
+static inline void cec_set_edid_phys_addr(u8 *edid, unsigned int size,
+					  u16 phys_addr)
+{
+}
+
+static inline u16 cec_phys_addr_for_input(u16 phys_addr, u8 input)
+{
+	return CEC_PHYS_ADDR_INVALID;
+}
+
+static inline int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port)
+{
+	return 0;
+}
+
+#endif
+
 #endif /* _MEDIA_CEC_EDID_H */
diff --git a/include/media/cec.h b/include/media/cec.h
index b313e3ecab70..bae8d0153de7 100644
--- a/include/media/cec.h
+++ b/include/media/cec.h
@@ -204,7 +204,7 @@ static inline bool cec_is_sink(const struct cec_adapter *adap)
 	return adap->phys_addr == 0;
 }
 
-#if IS_ENABLED(CONFIG_MEDIA_CEC_SUPPORT)
+#if IS_ENABLED(CONFIG_CEC_CORE)
 struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
 		void *priv, const char *name, u32 caps, u8 available_las);
 int cec_register_adapter(struct cec_adapter *adap, struct device *parent);
-- 
2.11.0

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

* [PATCH for v4.12 2/3] cec.h: merge cec-edid.h into cec.h
  2017-04-18  8:45 [PATCH for v4.12 0/3] cec: clean up Kconfig, headers Hans Verkuil
  2017-04-18  8:45 ` [PATCH for v4.12 1/3] cec: Kconfig cleanup Hans Verkuil
@ 2017-04-18  8:46 ` Hans Verkuil
  2017-04-18  8:46 ` [PATCH for v4.12 3/3] cec: add MEDIA_CEC_RC config option Hans Verkuil
  2 siblings, 0 replies; 5+ messages in thread
From: Hans Verkuil @ 2017-04-18  8:46 UTC (permalink / raw)
  To: linux-media; +Cc: Benjamin Gaignard, Marek Szyprowski, Hans Verkuil

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

Drop the separate cec-edid.h header and merge it into cec.h.

There was really no need to have a separate header for this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 MAINTAINERS                              |   1 -
 drivers/media/cec/cec-edid.c             |   2 +-
 drivers/media/cec/cec-notifier.c         |   1 +
 drivers/media/platform/s5p-cec/s5p_cec.c |   1 -
 include/media/cec-edid.h                 | 133 -------------------------------
 include/media/cec-notifier.h             |   2 +-
 include/media/cec.h                      | 102 +++++++++++++++++++++++-
 7 files changed, 104 insertions(+), 138 deletions(-)
 delete mode 100644 include/media/cec-edid.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 1b0049934cf9..8cc0104f14aa 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3077,7 +3077,6 @@ F:	Documentation/media/uapi/cec
 F:	drivers/media/cec/
 F:	drivers/media/rc/keymaps/rc-cec.c
 F:	include/media/cec.h
-F:	include/media/cec-edid.h
 F:	include/media/cec-notifier.h
 F:	include/uapi/linux/cec.h
 F:	include/uapi/linux/cec-funcs.h
diff --git a/drivers/media/cec/cec-edid.c b/drivers/media/cec/cec-edid.c
index c63dc81d2a29..38e3fec6152b 100644
--- a/drivers/media/cec/cec-edid.c
+++ b/drivers/media/cec/cec-edid.c
@@ -20,7 +20,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
-#include <media/cec-edid.h>
+#include <media/cec.h>
 
 /*
  * This EDID is expected to be a CEA-861 compliant, which means that there are
diff --git a/drivers/media/cec/cec-notifier.c b/drivers/media/cec/cec-notifier.c
index 5f5209a73665..74dc1c32080e 100644
--- a/drivers/media/cec/cec-notifier.c
+++ b/drivers/media/cec/cec-notifier.c
@@ -24,6 +24,7 @@
 #include <linux/list.h>
 #include <linux/kref.h>
 
+#include <media/cec.h>
 #include <media/cec-notifier.h>
 #include <drm/drm_edid.h>
 
diff --git a/drivers/media/platform/s5p-cec/s5p_cec.c b/drivers/media/platform/s5p-cec/s5p_cec.c
index 4688f0879f55..664937b61fa4 100644
--- a/drivers/media/platform/s5p-cec/s5p_cec.c
+++ b/drivers/media/platform/s5p-cec/s5p_cec.c
@@ -25,7 +25,6 @@
 #include <linux/timer.h>
 #include <linux/workqueue.h>
 #include <media/cec.h>
-#include <media/cec-edid.h>
 #include <media/cec-notifier.h>
 
 #include "exynos_hdmi_cec.h"
diff --git a/include/media/cec-edid.h b/include/media/cec-edid.h
deleted file mode 100644
index 242781fd377f..000000000000
--- a/include/media/cec-edid.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * cec-edid - HDMI Consumer Electronics Control & EDID helpers
- *
- * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
- *
- * This program is free software; you may redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef _MEDIA_CEC_EDID_H
-#define _MEDIA_CEC_EDID_H
-
-#include <linux/types.h>
-
-#define CEC_PHYS_ADDR_INVALID		0xffff
-#define cec_phys_addr_exp(pa) \
-	((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf
-
-#if IS_ENABLED(CONFIG_CEC_CORE)
-
-/**
- * cec_get_edid_phys_addr() - find and return the physical address
- *
- * @edid:	pointer to the EDID data
- * @size:	size in bytes of the EDID data
- * @offset:	If not %NULL then the location of the physical address
- *		bytes in the EDID will be returned here. This is set to 0
- *		if there is no physical address found.
- *
- * Return: the physical address or CEC_PHYS_ADDR_INVALID if there is none.
- */
-u16 cec_get_edid_phys_addr(const u8 *edid, unsigned int size,
-			   unsigned int *offset);
-
-/**
- * cec_set_edid_phys_addr() - find and set the physical address
- *
- * @edid:	pointer to the EDID data
- * @size:	size in bytes of the EDID data
- * @phys_addr:	the new physical address
- *
- * This function finds the location of the physical address in the EDID
- * and fills in the given physical address and updates the checksum
- * at the end of the EDID block. It does nothing if the EDID doesn't
- * contain a physical address.
- */
-void cec_set_edid_phys_addr(u8 *edid, unsigned int size, u16 phys_addr);
-
-/**
- * cec_phys_addr_for_input() - calculate the PA for an input
- *
- * @phys_addr:	the physical address of the parent
- * @input:	the number of the input port, must be between 1 and 15
- *
- * This function calculates a new physical address based on the input
- * port number. For example:
- *
- * PA = 0.0.0.0 and input = 2 becomes 2.0.0.0
- *
- * PA = 3.0.0.0 and input = 1 becomes 3.1.0.0
- *
- * PA = 3.2.1.0 and input = 5 becomes 3.2.1.5
- *
- * PA = 3.2.1.3 and input = 5 becomes f.f.f.f since it maxed out the depth.
- *
- * Return: the new physical address or CEC_PHYS_ADDR_INVALID.
- */
-u16 cec_phys_addr_for_input(u16 phys_addr, u8 input);
-
-/**
- * cec_phys_addr_validate() - validate a physical address from an EDID
- *
- * @phys_addr:	the physical address to validate
- * @parent:	if not %NULL, then this is filled with the parents PA.
- * @port:	if not %NULL, then this is filled with the input port.
- *
- * This validates a physical address as read from an EDID. If the
- * PA is invalid (such as 1.0.1.0 since '0' is only allowed at the end),
- * then it will return -EINVAL.
- *
- * The parent PA is passed into %parent and the input port is passed into
- * %port. For example:
- *
- * PA = 0.0.0.0: has parent 0.0.0.0 and input port 0.
- *
- * PA = 1.0.0.0: has parent 0.0.0.0 and input port 1.
- *
- * PA = 3.2.0.0: has parent 3.0.0.0 and input port 2.
- *
- * PA = f.f.f.f: has parent f.f.f.f and input port 0.
- *
- * Return: 0 if the PA is valid, -EINVAL if not.
- */
-int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port);
-
-#else
-
-static inline u16 cec_get_edid_phys_addr(const u8 *edid, unsigned int size,
-					 unsigned int *offset)
-{
-	if (offset)
-		*offset = 0;
-	return CEC_PHYS_ADDR_INVALID;
-}
-
-static inline void cec_set_edid_phys_addr(u8 *edid, unsigned int size,
-					  u16 phys_addr)
-{
-}
-
-static inline u16 cec_phys_addr_for_input(u16 phys_addr, u8 input)
-{
-	return CEC_PHYS_ADDR_INVALID;
-}
-
-static inline int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port)
-{
-	return 0;
-}
-
-#endif
-
-#endif /* _MEDIA_CEC_EDID_H */
diff --git a/include/media/cec-notifier.h b/include/media/cec-notifier.h
index 035712e0993d..eb50ce54b759 100644
--- a/include/media/cec-notifier.h
+++ b/include/media/cec-notifier.h
@@ -22,7 +22,7 @@
 #define LINUX_CEC_NOTIFIER_H
 
 #include <linux/types.h>
-#include <media/cec-edid.h>
+#include <media/cec.h>
 
 struct device;
 struct edid;
diff --git a/include/media/cec.h b/include/media/cec.h
index bae8d0153de7..b8eb895731d5 100644
--- a/include/media/cec.h
+++ b/include/media/cec.h
@@ -29,7 +29,6 @@
 #include <linux/timer.h>
 #include <linux/cec-funcs.h>
 #include <media/rc-core.h>
-#include <media/cec-edid.h>
 #include <media/cec-notifier.h>
 
 /**
@@ -204,6 +203,9 @@ static inline bool cec_is_sink(const struct cec_adapter *adap)
 	return adap->phys_addr == 0;
 }
 
+#define cec_phys_addr_exp(pa) \
+	((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf
+
 #if IS_ENABLED(CONFIG_CEC_CORE)
 struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
 		void *priv, const char *name, u32 caps, u8 available_las);
@@ -223,6 +225,81 @@ void cec_transmit_done(struct cec_adapter *adap, u8 status, u8 arb_lost_cnt,
 		       u8 nack_cnt, u8 low_drive_cnt, u8 error_cnt);
 void cec_received_msg(struct cec_adapter *adap, struct cec_msg *msg);
 
+/**
+ * cec_get_edid_phys_addr() - find and return the physical address
+ *
+ * @edid:	pointer to the EDID data
+ * @size:	size in bytes of the EDID data
+ * @offset:	If not %NULL then the location of the physical address
+ *		bytes in the EDID will be returned here. This is set to 0
+ *		if there is no physical address found.
+ *
+ * Return: the physical address or CEC_PHYS_ADDR_INVALID if there is none.
+ */
+u16 cec_get_edid_phys_addr(const u8 *edid, unsigned int size,
+			   unsigned int *offset);
+
+/**
+ * cec_set_edid_phys_addr() - find and set the physical address
+ *
+ * @edid:	pointer to the EDID data
+ * @size:	size in bytes of the EDID data
+ * @phys_addr:	the new physical address
+ *
+ * This function finds the location of the physical address in the EDID
+ * and fills in the given physical address and updates the checksum
+ * at the end of the EDID block. It does nothing if the EDID doesn't
+ * contain a physical address.
+ */
+void cec_set_edid_phys_addr(u8 *edid, unsigned int size, u16 phys_addr);
+
+/**
+ * cec_phys_addr_for_input() - calculate the PA for an input
+ *
+ * @phys_addr:	the physical address of the parent
+ * @input:	the number of the input port, must be between 1 and 15
+ *
+ * This function calculates a new physical address based on the input
+ * port number. For example:
+ *
+ * PA = 0.0.0.0 and input = 2 becomes 2.0.0.0
+ *
+ * PA = 3.0.0.0 and input = 1 becomes 3.1.0.0
+ *
+ * PA = 3.2.1.0 and input = 5 becomes 3.2.1.5
+ *
+ * PA = 3.2.1.3 and input = 5 becomes f.f.f.f since it maxed out the depth.
+ *
+ * Return: the new physical address or CEC_PHYS_ADDR_INVALID.
+ */
+u16 cec_phys_addr_for_input(u16 phys_addr, u8 input);
+
+/**
+ * cec_phys_addr_validate() - validate a physical address from an EDID
+ *
+ * @phys_addr:	the physical address to validate
+ * @parent:	if not %NULL, then this is filled with the parents PA.
+ * @port:	if not %NULL, then this is filled with the input port.
+ *
+ * This validates a physical address as read from an EDID. If the
+ * PA is invalid (such as 1.0.1.0 since '0' is only allowed at the end),
+ * then it will return -EINVAL.
+ *
+ * The parent PA is passed into %parent and the input port is passed into
+ * %port. For example:
+ *
+ * PA = 0.0.0.0: has parent 0.0.0.0 and input port 0.
+ *
+ * PA = 1.0.0.0: has parent 0.0.0.0 and input port 1.
+ *
+ * PA = 3.2.0.0: has parent 3.0.0.0 and input port 2.
+ *
+ * PA = f.f.f.f: has parent f.f.f.f and input port 0.
+ *
+ * Return: 0 if the PA is valid, -EINVAL if not.
+ */
+int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port);
+
 #ifdef CONFIG_MEDIA_CEC_NOTIFIER
 void cec_register_cec_notifier(struct cec_adapter *adap,
 			       struct cec_notifier *notifier);
@@ -249,6 +326,29 @@ static inline void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr,
 {
 }
 
+static inline u16 cec_get_edid_phys_addr(const u8 *edid, unsigned int size,
+					 unsigned int *offset)
+{
+	if (offset)
+		*offset = 0;
+	return CEC_PHYS_ADDR_INVALID;
+}
+
+static inline void cec_set_edid_phys_addr(u8 *edid, unsigned int size,
+					  u16 phys_addr)
+{
+}
+
+static inline u16 cec_phys_addr_for_input(u16 phys_addr, u8 input)
+{
+	return CEC_PHYS_ADDR_INVALID;
+}
+
+static inline int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port)
+{
+	return 0;
+}
+
 #endif
 
 #endif /* _MEDIA_CEC_H */
-- 
2.11.0

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

* [PATCH for v4.12 3/3] cec: add MEDIA_CEC_RC config option
  2017-04-18  8:45 [PATCH for v4.12 0/3] cec: clean up Kconfig, headers Hans Verkuil
  2017-04-18  8:45 ` [PATCH for v4.12 1/3] cec: Kconfig cleanup Hans Verkuil
  2017-04-18  8:46 ` [PATCH for v4.12 2/3] cec.h: merge cec-edid.h into cec.h Hans Verkuil
@ 2017-04-18  8:46 ` Hans Verkuil
  2 siblings, 0 replies; 5+ messages in thread
From: Hans Verkuil @ 2017-04-18  8:46 UTC (permalink / raw)
  To: linux-media; +Cc: Benjamin Gaignard, Marek Szyprowski, Hans Verkuil

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

Add an explicit config option to select whether the CEC remote control
messages are to be passed on to the RC subsystem or not.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/cec/Kconfig    |  8 +++++++-
 drivers/media/cec/cec-adap.c |  4 ++--
 drivers/media/cec/cec-core.c | 12 ++++++------
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/media/cec/Kconfig b/drivers/media/cec/Kconfig
index 24b53187ee52..f944d93e3167 100644
--- a/drivers/media/cec/Kconfig
+++ b/drivers/media/cec/Kconfig
@@ -6,8 +6,14 @@ config CEC_CORE
 config MEDIA_CEC_NOTIFIER
 	bool
 
+config MEDIA_CEC_RC
+	bool "HDMI CEC RC integration"
+	depends on CEC_CORE && RC_CORE
+	---help---
+	  Pass on CEC remote control messages to the RC framework.
+
 config MEDIA_CEC_DEBUG
 	bool "HDMI CEC debugfs interface"
-	depends on MEDIA_CEC_SUPPORT && DEBUG_FS
+	depends on CEC_CORE && DEBUG_FS
 	---help---
 	  Turns on the DebugFS interface for CEC devices.
diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c
index 25d0a835921f..f5fe01c9da8a 100644
--- a/drivers/media/cec/cec-adap.c
+++ b/drivers/media/cec/cec-adap.c
@@ -1732,7 +1732,7 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
 		    !(adap->log_addrs.flags & CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU))
 			break;
 
-#if IS_REACHABLE(CONFIG_RC_CORE)
+#ifdef CONFIG_MEDIA_CEC_RC
 		switch (msg->msg[2]) {
 		/*
 		 * Play function, this message can have variable length
@@ -1769,7 +1769,7 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
 		if (!(adap->capabilities & CEC_CAP_RC) ||
 		    !(adap->log_addrs.flags & CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU))
 			break;
-#if IS_REACHABLE(CONFIG_RC_CORE)
+#ifdef CONFIG_MEDIA_CEC_RC
 		rc_keyup(adap->rc);
 #endif
 		break;
diff --git a/drivers/media/cec/cec-core.c b/drivers/media/cec/cec-core.c
index 430f5e052ab3..a21fca7f7883 100644
--- a/drivers/media/cec/cec-core.c
+++ b/drivers/media/cec/cec-core.c
@@ -220,7 +220,7 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
 	struct cec_adapter *adap;
 	int res;
 
-#if !IS_REACHABLE(CONFIG_RC_CORE)
+#ifndef CONFIG_MEDIA_CEC_RC
 	caps &= ~CEC_CAP_RC;
 #endif
 
@@ -256,7 +256,7 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
 		return ERR_PTR(res);
 	}
 
-#if IS_REACHABLE(CONFIG_RC_CORE)
+#ifdef CONFIG_MEDIA_CEC_RC
 	if (!(caps & CEC_CAP_RC))
 		return adap;
 
@@ -305,7 +305,7 @@ int cec_register_adapter(struct cec_adapter *adap,
 	adap->owner = parent->driver->owner;
 	adap->devnode.dev.parent = parent;
 
-#if IS_REACHABLE(CONFIG_RC_CORE)
+#ifdef CONFIG_MEDIA_CEC_RC
 	if (adap->capabilities & CEC_CAP_RC) {
 		adap->rc->dev.parent = parent;
 		res = rc_register_device(adap->rc);
@@ -322,7 +322,7 @@ int cec_register_adapter(struct cec_adapter *adap,
 
 	res = cec_devnode_register(&adap->devnode, adap->owner);
 	if (res) {
-#if IS_REACHABLE(CONFIG_RC_CORE)
+#ifdef CONFIG_MEDIA_CEC_RC
 		/* Note: rc_unregister also calls rc_free */
 		rc_unregister_device(adap->rc);
 		adap->rc = NULL;
@@ -357,7 +357,7 @@ void cec_unregister_adapter(struct cec_adapter *adap)
 	if (IS_ERR_OR_NULL(adap))
 		return;
 
-#if IS_REACHABLE(CONFIG_RC_CORE)
+#ifdef CONFIG_MEDIA_CEC_RC
 	/* Note: rc_unregister also calls rc_free */
 	rc_unregister_device(adap->rc);
 	adap->rc = NULL;
@@ -381,7 +381,7 @@ void cec_delete_adapter(struct cec_adapter *adap)
 	kthread_stop(adap->kthread);
 	if (adap->kthread_config)
 		kthread_stop(adap->kthread_config);
-#if IS_REACHABLE(CONFIG_RC_CORE)
+#ifdef CONFIG_MEDIA_CEC_RC
 	rc_free_device(adap->rc);
 #endif
 	kfree(adap);
-- 
2.11.0

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

* Re: [PATCH for v4.12 1/3] cec: Kconfig cleanup
  2017-04-18  8:45 ` [PATCH for v4.12 1/3] cec: Kconfig cleanup Hans Verkuil
@ 2017-04-18 10:13   ` Benjamin Gaignard
  0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Gaignard @ 2017-04-18 10:13 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media, Marek Szyprowski, Hans Verkuil

2017-04-18 10:45 GMT+02:00 Hans Verkuil <hverkuil@xs4all.nl>:
> From: Hans Verkuil <hans.verkuil@cisco.com>
>
> The Kconfig options for the CEC subsystem were a bit messy. In
> addition there were two cec sources (cec-edid.c and cec-notifier.c)
> that were outside of the media/cec directory, which was weird.
>
> Move those sources to media/cec as well.
>
> The cec-edid and cec-notifier functionality is now part of the cec
> module and these are no longer separate modules.
>
> Also remove the MEDIA_CEC_EDID config option and include it with the
> main CEC config option (which defined CEC_EDID anyway).
>
> Added static inlines to cec-edid.h for dummy functions when CEC_CORE
> isn't defined.
>
> CEC drivers should now depend on CEC_CORE.
>
> CEC drivers that need the cec-notifier functionality must explicitly
> select CEC_NOTIFIER.
>
> The s5p-cec and stih-cec drivers depended on VIDEO_DEV instead of
> CEC_CORE, fix that as well.
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

Thanks for this clean up.

Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

> ---
>  MAINTAINERS                              |  2 --
>  drivers/media/Kconfig                    | 26 ++++-----------
>  drivers/media/Makefile                   | 14 ++------
>  drivers/media/cec/Kconfig                | 13 ++++++++
>  drivers/media/cec/Makefile               |  8 +++--
>  drivers/media/{ => cec}/cec-edid.c       |  4 ---
>  drivers/media/{ => cec}/cec-notifier.c   |  0
>  drivers/media/i2c/Kconfig                |  9 ++---
>  drivers/media/platform/Kconfig           | 56 ++++++++++++++++----------------
>  drivers/media/platform/vivid/Kconfig     |  3 +-
>  drivers/media/usb/pulse8-cec/Kconfig     |  2 +-
>  drivers/media/usb/rainshadow-cec/Kconfig |  2 +-
>  include/media/cec-edid.h                 | 29 +++++++++++++++++
>  include/media/cec.h                      |  2 +-
>  14 files changed, 91 insertions(+), 79 deletions(-)
>  create mode 100644 drivers/media/cec/Kconfig
>  rename drivers/media/{ => cec}/cec-edid.c (97%)
>  rename drivers/media/{ => cec}/cec-notifier.c (100%)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7d3b9993e4ba..1b0049934cf9 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3075,8 +3075,6 @@ S:        Supported
>  F:     Documentation/media/kapi/cec-core.rst
>  F:     Documentation/media/uapi/cec
>  F:     drivers/media/cec/
> -F:     drivers/media/cec-edid.c
> -F:     drivers/media/cec-notifier.c
>  F:     drivers/media/rc/keymaps/rc-cec.c
>  F:     include/media/cec.h
>  F:     include/media/cec-edid.h
> diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
> index 9e9ded44e8a8..b72edd27f880 100644
> --- a/drivers/media/Kconfig
> +++ b/drivers/media/Kconfig
> @@ -81,27 +81,15 @@ config MEDIA_RC_SUPPORT
>           Say Y when you have a TV or an IR device.
>
>  config MEDIA_CEC_SUPPORT
> -       bool "HDMI CEC support"
> -       select MEDIA_CEC_EDID
> -       ---help---
> -         Enable support for HDMI CEC (Consumer Electronics Control),
> -         which is an optional HDMI feature.
> -
> -         Say Y when you have an HDMI receiver, transmitter or a USB CEC
> -         adapter that supports HDMI CEC.
> -
> -config MEDIA_CEC_DEBUG
> -       bool "HDMI CEC debugfs interface"
> -       depends on MEDIA_CEC_SUPPORT && DEBUG_FS
> -       ---help---
> -         Turns on the DebugFS interface for CEC devices.
> +       bool "HDMI CEC support"
> +       ---help---
> +         Enable support for HDMI CEC (Consumer Electronics Control),
> +         which is an optional HDMI feature.
>
> -config MEDIA_CEC_EDID
> -       bool
> +         Say Y when you have an HDMI receiver, transmitter or a USB CEC
> +         adapter that supports HDMI CEC.
>
> -config MEDIA_CEC_NOTIFIER
> -       bool
> -       select MEDIA_CEC_EDID
> +source "drivers/media/cec/Kconfig"
>
>  #
>  # Media controller
> diff --git a/drivers/media/Makefile b/drivers/media/Makefile
> index 8b36a571d443..523fea3648ad 100644
> --- a/drivers/media/Makefile
> +++ b/drivers/media/Makefile
> @@ -2,20 +2,10 @@
>  # Makefile for the kernel multimedia device drivers.
>  #
>
> -ifeq ($(CONFIG_MEDIA_CEC_EDID),y)
> -  obj-$(CONFIG_MEDIA_SUPPORT) += cec-edid.o
> -endif
> -
> -ifeq ($(CONFIG_MEDIA_CEC_NOTIFIER),y)
> -  obj-$(CONFIG_MEDIA_SUPPORT) += cec-notifier.o
> -endif
> -
> -ifeq ($(CONFIG_MEDIA_CEC_SUPPORT),y)
> -  obj-$(CONFIG_MEDIA_SUPPORT) += cec/
> -endif
> -
>  media-objs     := media-device.o media-devnode.o media-entity.o
>
> +obj-$(CONFIG_CEC_CORE) += cec/
> +
>  #
>  # I2C drivers should come before other drivers, otherwise they'll fail
>  # when compiled as builtin drivers
> diff --git a/drivers/media/cec/Kconfig b/drivers/media/cec/Kconfig
> new file mode 100644
> index 000000000000..24b53187ee52
> --- /dev/null
> +++ b/drivers/media/cec/Kconfig
> @@ -0,0 +1,13 @@
> +config CEC_CORE
> +       tristate
> +       depends on MEDIA_CEC_SUPPORT
> +       default y
> +
> +config MEDIA_CEC_NOTIFIER
> +       bool
> +
> +config MEDIA_CEC_DEBUG
> +       bool "HDMI CEC debugfs interface"
> +       depends on MEDIA_CEC_SUPPORT && DEBUG_FS
> +       ---help---
> +         Turns on the DebugFS interface for CEC devices.
> diff --git a/drivers/media/cec/Makefile b/drivers/media/cec/Makefile
> index d6686337275f..402a6c62a3e8 100644
> --- a/drivers/media/cec/Makefile
> +++ b/drivers/media/cec/Makefile
> @@ -1,5 +1,7 @@
> -cec-objs := cec-core.o cec-adap.o cec-api.o
> +cec-objs := cec-core.o cec-adap.o cec-api.o cec-edid.o
>
> -ifeq ($(CONFIG_MEDIA_CEC_SUPPORT),y)
> -  obj-$(CONFIG_MEDIA_SUPPORT) += cec.o
> +ifeq ($(CONFIG_MEDIA_CEC_NOTIFIER),y)
> +  cec-objs += cec-notifier.o
>  endif
> +
> +obj-$(CONFIG_CEC_CORE) += cec.o
> diff --git a/drivers/media/cec-edid.c b/drivers/media/cec/cec-edid.c
> similarity index 97%
> rename from drivers/media/cec-edid.c
> rename to drivers/media/cec/cec-edid.c
> index 5719b991e340..c63dc81d2a29 100644
> --- a/drivers/media/cec-edid.c
> +++ b/drivers/media/cec/cec-edid.c
> @@ -165,7 +165,3 @@ int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port)
>         return 0;
>  }
>  EXPORT_SYMBOL_GPL(cec_phys_addr_validate);
> -
> -MODULE_AUTHOR("Hans Verkuil <hans.verkuil@cisco.com>");
> -MODULE_DESCRIPTION("CEC EDID helper functions");
> -MODULE_LICENSE("GPL");
> diff --git a/drivers/media/cec-notifier.c b/drivers/media/cec/cec-notifier.c
> similarity index 100%
> rename from drivers/media/cec-notifier.c
> rename to drivers/media/cec/cec-notifier.c
> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
> index b358d1a40688..40bb4bdc51da 100644
> --- a/drivers/media/i2c/Kconfig
> +++ b/drivers/media/i2c/Kconfig
> @@ -209,7 +209,6 @@ config VIDEO_ADV7604
>         depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
>         depends on GPIOLIB || COMPILE_TEST
>         select HDMI
> -       select MEDIA_CEC_EDID
>         ---help---
>           Support for the Analog Devices ADV7604 video decoder.
>
> @@ -221,7 +220,7 @@ config VIDEO_ADV7604
>
>  config VIDEO_ADV7604_CEC
>         bool "Enable Analog Devices ADV7604 CEC support"
> -       depends on VIDEO_ADV7604 && MEDIA_CEC_SUPPORT
> +       depends on VIDEO_ADV7604 && CEC_CORE
>         ---help---
>           When selected the adv7604 will support the optional
>           HDMI CEC feature.
> @@ -230,7 +229,6 @@ config VIDEO_ADV7842
>         tristate "Analog Devices ADV7842 decoder"
>         depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
>         select HDMI
> -       select MEDIA_CEC_EDID
>         ---help---
>           Support for the Analog Devices ADV7842 video decoder.
>
> @@ -242,7 +240,7 @@ config VIDEO_ADV7842
>
>  config VIDEO_ADV7842_CEC
>         bool "Enable Analog Devices ADV7842 CEC support"
> -       depends on VIDEO_ADV7842 && MEDIA_CEC_SUPPORT
> +       depends on VIDEO_ADV7842 && CEC_CORE
>         ---help---
>           When selected the adv7842 will support the optional
>           HDMI CEC feature.
> @@ -470,7 +468,6 @@ config VIDEO_ADV7511
>         tristate "Analog Devices ADV7511 encoder"
>         depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
>         select HDMI
> -       select MEDIA_CEC_EDID
>         ---help---
>           Support for the Analog Devices ADV7511 video encoder.
>
> @@ -481,7 +478,7 @@ config VIDEO_ADV7511
>
>  config VIDEO_ADV7511_CEC
>         bool "Enable Analog Devices ADV7511 CEC support"
> -       depends on VIDEO_ADV7511 && MEDIA_CEC_SUPPORT
> +       depends on VIDEO_ADV7511 && CEC_CORE
>         ---help---
>           When selected the adv7511 will support the optional
>           HDMI CEC feature.
> diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
> index 73c3bc5deadf..ac026ee1ca07 100644
> --- a/drivers/media/platform/Kconfig
> +++ b/drivers/media/platform/Kconfig
> @@ -461,34 +461,6 @@ config VIDEO_TI_SC
>  config VIDEO_TI_CSC
>         tristate
>
> -menuconfig V4L_CEC_DRIVERS
> -       bool "Platform HDMI CEC drivers"
> -       depends on MEDIA_CEC_SUPPORT
> -
> -if V4L_CEC_DRIVERS
> -
> -config VIDEO_SAMSUNG_S5P_CEC
> -       tristate "Samsung S5P CEC driver"
> -       depends on VIDEO_DEV && MEDIA_CEC_SUPPORT && (PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST)
> -       select MEDIA_CEC_NOTIFIER
> -       ---help---
> -         This is a driver for Samsung S5P HDMI CEC interface. It uses the
> -         generic CEC framework interface.
> -         CEC bus is present in the HDMI connector and enables communication
> -         between compatible devices.
> -
> -config VIDEO_STI_HDMI_CEC
> -       tristate "STMicroelectronics STiH4xx HDMI CEC driver"
> -       depends on VIDEO_DEV && MEDIA_CEC_SUPPORT && (ARCH_STI || COMPILE_TEST)
> -       select MEDIA_CEC_NOTIFIER
> -       ---help---
> -         This is a driver for STIH4xx HDMI CEC interface. It uses the
> -         generic CEC framework interface.
> -         CEC bus is present in the HDMI connector and enables communication
> -         between compatible devices.
> -
> -endif #V4L_CEC_DRIVERS
> -
>  menuconfig V4L_TEST_DRIVERS
>         bool "Media test drivers"
>         depends on MEDIA_CAMERA_SUPPORT
> @@ -520,3 +492,31 @@ menuconfig DVB_PLATFORM_DRIVERS
>  if DVB_PLATFORM_DRIVERS
>  source "drivers/media/platform/sti/c8sectpfe/Kconfig"
>  endif #DVB_PLATFORM_DRIVERS
> +
> +menuconfig CEC_PLATFORM_DRIVERS
> +       bool "CEC platform devices"
> +       depends on MEDIA_CEC_SUPPORT
> +
> +if CEC_PLATFORM_DRIVERS
> +
> +config VIDEO_SAMSUNG_S5P_CEC
> +       tristate "Samsung S5P CEC driver"
> +       depends on CEC_CORE && (PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST)
> +       select MEDIA_CEC_NOTIFIER
> +       ---help---
> +         This is a driver for Samsung S5P HDMI CEC interface. It uses the
> +         generic CEC framework interface.
> +         CEC bus is present in the HDMI connector and enables communication
> +         between compatible devices.
> +
> +config VIDEO_STI_HDMI_CEC
> +       tristate "STMicroelectronics STiH4xx HDMI CEC driver"
> +       depends on CEC_CORE && (ARCH_STI || COMPILE_TEST)
> +       select MEDIA_CEC_NOTIFIER
> +       ---help---
> +         This is a driver for STIH4xx HDMI CEC interface. It uses the
> +         generic CEC framework interface.
> +         CEC bus is present in the HDMI connector and enables communication
> +         between compatible devices.
> +
> +endif #CEC_PLATFORM_DRIVERS
> diff --git a/drivers/media/platform/vivid/Kconfig b/drivers/media/platform/vivid/Kconfig
> index 94ab1364a792..b36ac19dc6e4 100644
> --- a/drivers/media/platform/vivid/Kconfig
> +++ b/drivers/media/platform/vivid/Kconfig
> @@ -7,7 +7,6 @@ config VIDEO_VIVID
>         select FB_CFB_FILLRECT
>         select FB_CFB_COPYAREA
>         select FB_CFB_IMAGEBLIT
> -       select MEDIA_CEC_EDID
>         select VIDEOBUF2_VMALLOC
>         select VIDEOBUF2_DMA_CONTIG
>         select VIDEO_V4L2_TPG
> @@ -27,7 +26,7 @@ config VIDEO_VIVID
>
>  config VIDEO_VIVID_CEC
>         bool "Enable CEC emulation support"
> -       depends on VIDEO_VIVID && MEDIA_CEC_SUPPORT
> +       depends on VIDEO_VIVID && CEC_CORE
>         ---help---
>           When selected the vivid module will emulate the optional
>           HDMI CEC feature.
> diff --git a/drivers/media/usb/pulse8-cec/Kconfig b/drivers/media/usb/pulse8-cec/Kconfig
> index 6ffc407de62f..8937f3986a01 100644
> --- a/drivers/media/usb/pulse8-cec/Kconfig
> +++ b/drivers/media/usb/pulse8-cec/Kconfig
> @@ -1,6 +1,6 @@
>  config USB_PULSE8_CEC
>         tristate "Pulse Eight HDMI CEC"
> -       depends on USB_ACM && MEDIA_CEC_SUPPORT
> +       depends on USB_ACM && CEC_CORE
>         select SERIO
>         select SERIO_SERPORT
>         ---help---
> diff --git a/drivers/media/usb/rainshadow-cec/Kconfig b/drivers/media/usb/rainshadow-cec/Kconfig
> index 447291b3cca3..3eb86607efb8 100644
> --- a/drivers/media/usb/rainshadow-cec/Kconfig
> +++ b/drivers/media/usb/rainshadow-cec/Kconfig
> @@ -1,6 +1,6 @@
>  config USB_RAINSHADOW_CEC
>         tristate "RainShadow Tech HDMI CEC"
> -       depends on USB_ACM && MEDIA_CEC_SUPPORT
> +       depends on USB_ACM && CEC_CORE
>         select SERIO
>         select SERIO_SERPORT
>         ---help---
> diff --git a/include/media/cec-edid.h b/include/media/cec-edid.h
> index bdf731ecba1a..242781fd377f 100644
> --- a/include/media/cec-edid.h
> +++ b/include/media/cec-edid.h
> @@ -26,6 +26,8 @@
>  #define cec_phys_addr_exp(pa) \
>         ((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf
>
> +#if IS_ENABLED(CONFIG_CEC_CORE)
> +
>  /**
>   * cec_get_edid_phys_addr() - find and return the physical address
>   *
> @@ -101,4 +103,31 @@ u16 cec_phys_addr_for_input(u16 phys_addr, u8 input);
>   */
>  int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port);
>
> +#else
> +
> +static inline u16 cec_get_edid_phys_addr(const u8 *edid, unsigned int size,
> +                                        unsigned int *offset)
> +{
> +       if (offset)
> +               *offset = 0;
> +       return CEC_PHYS_ADDR_INVALID;
> +}
> +
> +static inline void cec_set_edid_phys_addr(u8 *edid, unsigned int size,
> +                                         u16 phys_addr)
> +{
> +}
> +
> +static inline u16 cec_phys_addr_for_input(u16 phys_addr, u8 input)
> +{
> +       return CEC_PHYS_ADDR_INVALID;
> +}
> +
> +static inline int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port)
> +{
> +       return 0;
> +}
> +
> +#endif
> +
>  #endif /* _MEDIA_CEC_EDID_H */
> diff --git a/include/media/cec.h b/include/media/cec.h
> index b313e3ecab70..bae8d0153de7 100644
> --- a/include/media/cec.h
> +++ b/include/media/cec.h
> @@ -204,7 +204,7 @@ static inline bool cec_is_sink(const struct cec_adapter *adap)
>         return adap->phys_addr == 0;
>  }
>
> -#if IS_ENABLED(CONFIG_MEDIA_CEC_SUPPORT)
> +#if IS_ENABLED(CONFIG_CEC_CORE)
>  struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
>                 void *priv, const char *name, u32 caps, u8 available_las);
>  int cec_register_adapter(struct cec_adapter *adap, struct device *parent);
> --
> 2.11.0
>



-- 
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2017-04-18 10:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-18  8:45 [PATCH for v4.12 0/3] cec: clean up Kconfig, headers Hans Verkuil
2017-04-18  8:45 ` [PATCH for v4.12 1/3] cec: Kconfig cleanup Hans Verkuil
2017-04-18 10:13   ` Benjamin Gaignard
2017-04-18  8:46 ` [PATCH for v4.12 2/3] cec.h: merge cec-edid.h into cec.h Hans Verkuil
2017-04-18  8:46 ` [PATCH for v4.12 3/3] cec: add MEDIA_CEC_RC config option Hans Verkuil

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.