linux-stable/include/media
Hans Verkuil 4651530385 media: cec: keep track of outstanding transmits
commit 32804fcb61 upstream.

I noticed that repeatedly running 'cec-ctl --playback' would occasionally
select 'Playback Device 2' instead of 'Playback Device 1', even though there
were no other Playback devices in the HDMI topology. This happened both with
'real' hardware and with the vivid CEC emulation, suggesting that this was an
issue in the core code that claims a logical address.

What 'cec-ctl --playback' does is to first clear all existing logical addresses,
and immediately after that configure the new desired device type.

The core code will poll the logical addresses trying to find a free address.
When found it will issue a few standard messages as per the CEC spec and return.
Those messages are queued up and will be transmitted asynchronously.

What happens is that if you run two 'cec-ctl --playback' commands in quick
succession, there is still a message of the first cec-ctl command being transmitted
when you reconfigure the adapter again in the second cec-ctl command.

When the logical addresses are cleared, then all information about outstanding
transmits inside the CEC core is also cleared, and the core is no longer aware
that there is still a transmit in flight.

When the hardware finishes the transmit it calls transmit_done and the CEC core
thinks it is actually in response of a POLL messages that is trying to find a
free logical address. The result of all this is that the core thinks that the
logical address for Playback Device 1 is in use, when it is really an earlier
transmit that ended.

The main transmit thread looks at adap->transmitting to check if a transmit
is in progress, but that is set to NULL when the adapter is unconfigured.
adap->transmitting represents the view of userspace, not that of the hardware.
So when unconfiguring the adapter the message is marked aborted from the point
of view of userspace, but seen from the PoV of the hardware it is still ongoing.

So introduce a new bool transmit_in_progress that represents the hardware state
and use that instead of adap->transmitting. Now the CEC core waits until the
hardware finishes the transmit before starting a new transmit.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: <stable@vger.kernel.org>      # for v4.18 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-09 17:38:46 +01:00
..
davinci media: platform: davinci: drop VPFE_CMD_S_CCDC_RAW_PARAMS 2017-07-26 06:14:33 -04:00
drv-intf media: include: media: Add Renesas CEU driver interface 2018-02-26 08:59:41 -05:00
i2c media: i2c: lm3560: add support for lm3559 chip 2018-06-28 07:10:01 -04:00
tpg media: include/(uapi/)media: add SPDX license info 2018-02-14 13:23:51 -05:00
cec-notifier.h media: cec-notifier: Get notifier by device and connector name 2018-07-13 08:44:16 +01:00
cec-pin.h media: cec: add support for 5V signal testing 2018-07-25 07:11:48 -04:00
cec.h media: cec: keep track of outstanding transmits 2019-01-09 17:38:46 +01:00
demux.h media: dvb: update buffer mmaped flags and frame counter 2018-02-23 11:44:08 -05:00
dmxdev.h media: dmxdev: Fix the logic that enables DMA mmap support 2018-02-23 05:27:10 -05:00
dvb-usb-ids.h media: dvb: add alternative USB PID for Hauppauge WinTV-soloHD 2018-05-04 14:20:55 -04:00
dvb_ca_en50221.h media: move dvb kAPI headers to include/media 2017-12-28 13:16:01 -05:00
dvb_demux.h media: dvb: update buffer mmaped flags and frame counter 2018-02-23 11:44:08 -05:00
dvb_frontend.h media: dvb: represent min/max/step/tolerance freqs in Hz 2018-08-02 18:10:48 -04:00
dvb_math.h media: move dvb kAPI headers to include/media 2017-12-28 13:16:01 -05:00
dvb_net.h media: move dvb kAPI headers to include/media 2017-12-28 13:16:01 -05:00
dvb_ringbuffer.h media: move dvb kAPI headers to include/media 2017-12-28 13:16:01 -05:00
dvb_vb2.h media: dvb: update buffer mmaped flags and frame counter 2018-02-23 11:44:08 -05:00
dvbdev.h media: dvbdev: add a mutex protecting the "mdev" pointer 2018-05-11 12:09:59 -04:00
imx.h [media] media: Add i.MX media core driver 2017-06-20 07:30:38 -03:00
media-device.h media: media-device: remove driver_version 2017-08-08 06:02:22 -04:00
media-devnode.h ->poll() methods should return __poll_t 2017-11-27 16:19:52 -05:00
media-entity.h media: entity: fix spelling for media_entity_get_fwnode_pad() 2018-05-09 15:49:41 -04:00
rc-core.h media: rc: default to idle on at startup or after reset 2018-05-14 07:14:51 -04:00
rc-map.h media: rc: add new imon protocol decoder and encoder 2018-03-21 11:12:29 -04:00
rcar-fcp.h v4l: rcar-fcp: Add an API to retrieve the FCP device 2017-06-09 12:25:36 +01:00
soc_camera.h ->poll() methods should return __poll_t 2017-11-27 16:19:52 -05:00
tuner-types.h media: tuner-types: add kernel-doc markups for struct tunertype 2017-12-18 09:06:40 -05:00
tuner.h [media] v4l2-mc.h: move tuner PAD definitions to this new header 2016-02-01 07:19:44 -02:00
tveeprom.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
v4l2-async.h media: fix usage of whitespaces and on indentation 2018-01-04 13:12:01 -05:00
v4l2-clk.h media: Convert to using %pOF instead of full_name 2017-08-20 08:20:20 -04:00
v4l2-common.h media: v4l-common: Make v4l2_find_nearest_size more sparse-friendly 2018-06-28 09:23:56 -04:00
v4l2-ctrls.h media: v4l2-ctrls.h: fix v4l2_ctrl field description typos 2018-07-25 08:36:05 -04:00
v4l2-dev.h media: v4l2-core: push taking ioctl mutex down to ioctl handler 2018-05-28 16:31:44 -04:00
v4l2-device.h media: v4l2-device.h: always expose mdev 2018-05-11 11:26:56 -04:00
v4l2-dv-timings.h media: v4l2-dv-timings: add v4l2_hdmi_colorimetry() 2018-02-22 12:41:09 -05:00
v4l2-event.h media: fix usage of whitespaces and on indentation 2018-01-04 13:12:01 -05:00
v4l2-fh.h media: v4l: event: Prevent freeing event subscriptions while accessed 2018-10-03 06:32:51 -04:00
v4l2-flash-led-class.h media: v4l2-flash-led-class.h: add kernel-doc to two helper funcs 2017-12-18 10:40:41 -05:00
v4l2-fwnode.h media: v4l: fwnode: Fix comment incorrectly mentioning v4l2_fwnode_parse_endpoint 2018-04-23 17:20:07 -04:00
v4l2-image-sizes.h [media] media: v4l2-image-sizes.h: correct the SVGA height definition 2014-12-04 13:56:56 -02:00
v4l2-ioctl.h media: v4l2-ioctl: create helper to fill in v4l2_standard for ENUMSTD 2018-06-28 07:29:24 -04:00
v4l2-mc.h [media] get rid of a number of problems at the cross references 2016-09-22 10:00:23 -03:00
v4l2-mediabus.h media: v4l2-fwnode: parse 'data-enable-active' prop 2018-07-24 14:57:38 -04:00
v4l2-mem2mem.h media: v4l2-mem2mem: add v4l2_m2m_last_buf() 2018-07-25 08:10:31 -04:00
v4l2-rect.h media: include/(uapi/)media: add SPDX license info 2018-02-14 13:23:51 -05:00
v4l2-subdev.h media: add tuner standby op, use where needed 2018-03-21 12:05:39 -04:00
videobuf-core.h MAINTAINERS & files: Canonize the e-mails I use at files 2018-05-04 06:21:06 -04:00
videobuf-dma-contig.h
videobuf-dma-sg.h MAINTAINERS & files: Canonize the e-mails I use at files 2018-05-04 06:21:06 -04:00
videobuf-vmalloc.h MAINTAINERS & files: Canonize the e-mails I use at files 2018-05-04 06:21:06 -04:00
videobuf2-core.h media: vb2-core: vb2_ops: document non-interrupt-context calling 2018-03-21 12:01:21 -04:00
videobuf2-dma-contig.h dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
videobuf2-dma-sg.h [media] vb2: replace void *alloc_ctxs by struct device *alloc_devs 2016-07-08 14:45:07 -03:00
videobuf2-dvb.h media: move dvb kAPI headers to include/media 2017-12-28 13:16:01 -05:00
videobuf2-memops.h media: vb2: add cross references at memops and v4l2 kernel-doc markups 2017-12-18 12:27:41 -05:00
videobuf2-v4l2.h media updates for v4.16-rc1 2018-02-06 11:27:48 -08:00
videobuf2-vmalloc.h [media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2 2015-10-01 08:48:18 -03:00
vsp1.h media: vsp1: Support Interlaced display pipelines 2018-08-03 16:02:27 -04:00