Skip to content

Commit

Permalink
[media] cec: Kconfig cleanup
Browse files Browse the repository at this point in the history
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>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Apr 19, 2017
1 parent ee0fe83 commit 56a263a
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 79 deletions.
2 changes: 0 additions & 2 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 7 additions & 19 deletions drivers/media/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 2 additions & 12 deletions drivers/media/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions drivers/media/cec/Kconfig
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 5 additions & 3 deletions drivers/media/cec/Makefile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 0 additions & 4 deletions drivers/media/cec-edid.c → drivers/media/cec/cec-edid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
File renamed without changes.
9 changes: 3 additions & 6 deletions drivers/media/i2c/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.
Expand All @@ -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.

Expand All @@ -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.
Expand Down Expand Up @@ -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.

Expand All @@ -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.
Expand Down
56 changes: 28 additions & 28 deletions drivers/media/platform/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
3 changes: 1 addition & 2 deletions drivers/media/platform/vivid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/usb/pulse8-cec/Kconfig
Original file line number Diff line number Diff line change
@@ -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---
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/usb/rainshadow-cec/Kconfig
Original file line number Diff line number Diff line change
@@ -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---
Expand Down
29 changes: 29 additions & 0 deletions include/media/cec-edid.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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 */
2 changes: 1 addition & 1 deletion include/media/cec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 56a263a

Please sign in to comment.