[PATCH RFC 4/5] drm/bridge: add dw-hdmi cec driver using Hans Verkil's CEC code

Hans Verkuil hverkuil at xs4all.nl
Tue Aug 23 00:21:17 PDT 2016


Hi Russell,

On 08/12/2016 04:15 PM, Russell King wrote:
> Add a CEC driver for the dw-hdmi hardware using Hans Verkil's CEC
> implementation.
> 
> Signed-off-by: Russell King <rmk+kernel at armlinux.org.uk>
> ---
>  drivers/gpu/drm/bridge/Kconfig            |   7 +
>  drivers/gpu/drm/bridge/Makefile           |   1 +
>  drivers/gpu/drm/bridge/dw-hdmi-cec.c      | 344 ++++++++++++++++++++++++++++++
>  drivers/gpu/drm/bridge/dw-hdmi.c          |  64 +++++-
>  include/linux/platform_data/dw_hdmi-cec.h |  16 ++
>  5 files changed, 421 insertions(+), 11 deletions(-)
>  create mode 100644 drivers/gpu/drm/bridge/dw-hdmi-cec.c
>  create mode 100644 include/linux/platform_data/dw_hdmi-cec.h
> 

<snip>

> +static unsigned int parse_hdmi_addr(const struct edid *edid)
> +{
> +	if (!edid || edid->extensions == 0)
> +		return (u16)~0;
> +
> +	return cec_get_edid_phys_addr((u8 *)edid,
> +				EDID_LENGTH * (edid->extensions + 1), NULL);
> +}
> +
> +static int dw_hdmi_cec_notify(struct notifier_block *nb, unsigned long event,
> +			      void *data)
> +{
> +	struct dw_hdmi_cec *cec = container_of(nb, struct dw_hdmi_cec, nb);
> +	union hdmi_event *event_block = data;
> +	unsigned int phys;
> +
> +	dev_info(event_block->base.source, "event %lu\n", event);
> +
> +	if (event_block->base.source != cec->adap->devnode.parent)
> +		return NOTIFY_OK;
> +
> +	switch (event) {
> +	case HDMI_CONNECTED:
> +		break;
> +
> +	case HDMI_DISCONNECTED:
> +		cec_s_phys_addr(cec->adap, CEC_PHYS_ADDR_INVALID, false);
> +		break;
> +
> +	case HDMI_NEW_EDID:
> +		phys = parse_hdmi_addr(event_block->edid.edid);
> +		cec_s_phys_addr(cec->adap, phys, false);
> +		break;
> +	}
> +
> +	return NOTIFY_OK;
> +}

Wouldn't it make a lot of sense to integrate this into the cec framework?

All you need is to pass an hdmi_notifier_dev as argument to cec_allocate_adapter()
and you can integrate this.

If you are OK with that, then I can make patches for that.

Regards,

	Hans



More information about the linux-arm-kernel mailing list