• Hans Verkuil's avatar
    media: cec: call enable_adap on s_log_addrs · 3813c932
    Hans Verkuil authored
    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: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
    3813c932
cec.h 15.4 KB