diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2017-07-11 03:30:41 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-07-18 12:55:38 -0300 |
commit | b8d62f50b1df2571afcf47107bbbe9cd60f8aafd (patch) | |
tree | b4b95eddddecdcdc902b3bb64470b65e9b6044f4 /drivers/media/cec/cec-adap.c | |
parent | fdb8c88e9213f9d87bbfe56724e20cfd9ff8ef9d (diff) | |
download | lwn-b8d62f50b1df2571afcf47107bbbe9cd60f8aafd.tar.gz lwn-b8d62f50b1df2571afcf47107bbbe9cd60f8aafd.zip |
media: cec: add core support for low-level CEC pin monitoring
Add support for the new MONITOR_PIN mode.
Add the cec_pin_event function that the CEC pin code will call to queue pin
change events.
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>
Diffstat (limited to 'drivers/media/cec/cec-adap.c')
-rw-r--r-- | drivers/media/cec/cec-adap.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c index 5080d7aa6105..b0bd466f75e2 100644 --- a/drivers/media/cec/cec-adap.c +++ b/drivers/media/cec/cec-adap.c @@ -153,6 +153,22 @@ static void cec_queue_event(struct cec_adapter *adap, mutex_unlock(&adap->devnode.lock); } +/* Notify userspace that the CEC pin changed state at the given time. */ +void cec_queue_pin_event(struct cec_adapter *adap, bool is_high, ktime_t ts) +{ + struct cec_event ev = { + .event = is_high ? CEC_EVENT_PIN_HIGH : CEC_EVENT_PIN_LOW, + }; + struct cec_fh *fh; + + mutex_lock(&adap->devnode.lock); + list_for_each_entry(fh, &adap->devnode.fhs, list) + if (fh->mode_follower == CEC_MODE_MONITOR_PIN) + cec_queue_event_fh(fh, &ev, ktime_to_ns(ts)); + mutex_unlock(&adap->devnode.lock); +} +EXPORT_SYMBOL_GPL(cec_queue_pin_event); + /* * Queue a new message for this filehandle. * |