summaryrefslogtreecommitdiff
path: root/include/media/cec.h
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2022-03-03 16:55:08 +0300
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-04-24 09:37:58 +0300
commit3813c932ed970dd4f413498ccecb03c73c4f1784 (patch)
tree509956bf8e6c674130f45056b9ad256de0fe1085 /include/media/cec.h
parent82b4737fd001247527405b19045c25bf1622ab6d (diff)
downloadlinux-3813c932ed970dd4f413498ccecb03c73c4f1784.tar.xz
media: cec: call enable_adap on s_log_addrs
Don't enable/disable the adapter if the first fh is opened or the last fh is closed, instead do this when the adapter is configured or unconfigured, and also when we enter Monitor All or Monitor Pin mode for the first time or we exit the Monitor All/Pin mode for the last time. However, if needs_hpd is true, then do this when the physical address is set or cleared: in that case the adapter typically is powered by the HPD, so it really is disabled when the HPD is low. This case (needs_hpd is true) was already handled in this way, so this wasn't changed. The problem with the old behavior was that if the HPD goes low when no fh is open, and a transmit was in progress, then the adapter would be disabled, typically stopping the transmit immediately which leaves a partial message on the bus, which isn't nice and can confuse some adapters. It makes much more sense to disable it only when the adapter is unconfigured and we're not monitoring the bus, since then you really won't be using it anymore. To keep track of this store a CEC activation count and call adap_enable only when it goes from 0 to 1 or back to 0. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'include/media/cec.h')
-rw-r--r--include/media/cec.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/media/cec.h b/include/media/cec.h
index 77346f757036..97c5f5bfcbd0 100644
--- a/include/media/cec.h
+++ b/include/media/cec.h
@@ -185,6 +185,7 @@ struct cec_adap_ops {
* Drivers that need this can set this field to true after the
* cec_allocate_adapter() call.
* @last_initiator: the initiator of the last transmitted message.
+ * @activate_cnt: number of times that CEC is activated
* @monitor_all_cnt: number of filehandles monitoring all msgs
* @monitor_pin_cnt: number of filehandles monitoring pin changes
* @follower_cnt: number of filehandles in follower mode
@@ -236,6 +237,7 @@ struct cec_adapter {
bool cec_pin_is_high;
bool adap_controls_phys_addr;
u8 last_initiator;
+ u32 activate_cnt;
u32 monitor_all_cnt;
u32 monitor_pin_cnt;
u32 follower_cnt;