media: cec: improve CEC pin event handling
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 6 Mar 2018 21:20:00 +0000 (16:20 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 22 Mar 2018 12:16:52 +0000 (08:16 -0400)
commit6ec1cbf6b12531a794bbc007fbf6e74edf7fc93c
tree50394a5dd5d61aa5377bc05ffbc02da3d1a19308
parent2b76e5392d0647c35226b464269b87026578ea83
media: cec: improve CEC pin event handling

It turns out that the struct cec_fh event buffer size of 64 events
(64 for CEC_EVENT_PIN_CEC_LOW and 64 for _HIGH) is too small. It's
about 160 ms worth of events and if the Raspberry Pi is busy, then it
might take too long for the application to be scheduled so that it can
drain the pending events. Increase these buffers to 800 events which
is at least 2 seconds worth of events.

There is also a FIFO in between the interrupt and the cec-pin thread.
The thread passes the events on to the CEC core. It is important that
should this FIFO fill up the cec core will be informed that events
have been lost so this can be communicated to the user by setting
CEC_EVENT_FL_DROPPED_EVENTS.

It is very hard to debug CEC problems if events were lost without
informing the user of that fact.

If events were dropped due to the FIFO filling up, then the debugfs
status file will let you know how many events were dropped.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/cec/cec-adap.c
drivers/media/cec/cec-pin-priv.h
drivers/media/cec/cec-pin.c
drivers/media/platform/vivid/vivid-cec.c
include/media/cec.h