History log of /linux-master/include/media/cec-pin.h
Revision Date Author Comments
# e5ad7db4 21-Apr-2020 Hans Verkuil <hverkuil-cisco@xs4all.nl>

media: cec-gpio: handle gpiod_get_value errors correctly

gpiod_get_value() can return negative values if an error occurs.
In several places this error code was ignored.

Ensure that errors codes are handled correctly throughout the CEC
pin framework and CEC pin drivers.

The return code of the cec_pin_ops read() callback had to be changed
from 'bool' to 'int', which mean the prototype of that callback in the
sun4i drm driver also had to be changed.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 69e3235d 09-Oct-2019 Hans Verkuil <hverkuil-cisco@xs4all.nl>

media: cec-pin: add 'received' callback

Drivers that use the CEC pin framework have no way of processing messages
themselves by providing the 'received' callback. This is present in
cec_ops, but not in cec_pin_ops.

Add support for this callback.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 4786b0d6 28-Jun-2018 Hans Verkuil <hans.verkuil@cisco.com>

media: cec: add support for 5V signal testing

Add support for the new 5V CEC events

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# ab15d248 07-Feb-2018 Hans Verkuil <hansverk@cisco.com>

media: include/(uapi/)media: add SPDX license info

Replace the old license information with the corresponding SPDX
license for those headers that I authored.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 5bf24e08 13-Oct-2017 Hans Verkuil <hansverk@cisco.com>

media: cec-pin.h: move non-kAPI parts into cec-pin-priv.h

The kAPI cec-pin.h header also defined data structures that did
not belong here but were private to the CEC core code.

Split that part off into a cec-pin-priv.h header.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 333ef6bd 15-Aug-2017 Hans Verkuil <hans.verkuil@cisco.com>

media: cec: add CEC_EVENT_PIN_HPD_LOW/HIGH events

Add support for two new low-level events: PIN_HPD_LOW and PIN_HPD_HIGH.

This is specifically meant for use with the upcoming cec-gpio driver
and makes it possible to trace when the HPD pin changes. Some HDMI
sinks do strange things with the HPD and this makes it easy to debug
this.

Note that this also moves the initialization of a devnode mutex and
list to the allocate_adapter function: if the HPD is high, then as
soon as the HPD interrupt is created an interrupt occurs and
cec_queue_pin_hpd_event() is called which requires that the devnode
mutex and list are initialized.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 28e11b15 20-Aug-2017 Hans Verkuil <hans.verkuil@cisco.com>

media: cec: replace pin->cur_value by adap->cec_pin_is_high

The current CEC pin value (0 or 1) was part of the cec_pin struct,
but that assumes that CEC pin monitoring can only be used with
a driver that uses the low-level CEC pin framework.

But hardware that has both a high-level API and can monitor the
CEC pin at low-level at the same time does not need to depend on
the cec pin framework.

To support such devices remove the cur_value field from struct cec_pin
and add a cec_pin_is_high field to cec_adapter. This also makes it
possible to drop the '#ifdef CONFIG_CEC_PIN' in cec-api.c.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# cb747494 16-Aug-2017 Hans Verkuil <hverkuil@xs4all.nl>

media: cec-pin: fix irq handling

The free_irq() function could be called from interrupt context,
which is invalid. Move this to the thread.

In the interrupt handler we just request that the thread disables
the irq. This is done through an atomic so we don't need to add
any spinlocks.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# ea5c8ef2 11-Jul-2017 Hans Verkuil <hans.verkuil@cisco.com>

media: cec-pin: add low-level pin hardware support

Add support for CEC hardware that relies on low-level pin polling or
GPIO interrupts.

One example is the Allwinner SoC. But any GPIO-based CEC implementation can
use this as well.

A GPIO implementation is very suitable as well for debugging: it can use
interrupts to detect state changes and report it. Userspace can then verify
if the bus traffic is correct. This also makes error injection possible.

The disadvantage is that it is hard to get the timings right since linux
isn't a hard realtime system.

In general on an idle system it works quite well, but under load the timer
will miss its mark every so often.

The debugfs file /sys/kernel/debug/cec/cecX/status gives some statistics
with respect to the timer overruns.

When the adapter is unconfigured and the low-level driver supports
interrupts, then the interrupt will be used to detect changes. This should
be quite accurate. But when the adapter is configured a hrtimer has to be
used.

The hrtimer implements a state machine where for each state the code will
read the bus or drive the bus and go on to the next state. It will re-arm
the timer with a delay based on the next state.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>