Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: cec-pin: fix off-by-one SFT check

The CEC pin framework has to wait for the CEC bus to be idle for the
requested Signal Free Time before it can start a transmit.

However, the check for that was off by one, so transmits would start one
bit period (2.4ms) too late.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
7e360fa0 8515965e

+2 -2
+2 -2
drivers/media/cec/core/cec-pin.c
··· 957 957 * so we can kick off the pending transmit. 958 958 */ 959 959 delta = ktime_us_delta(ts, pin->ts); 960 - if (delta / CEC_TIM_DATA_BIT_TOTAL > 960 + if (delta / CEC_TIM_DATA_BIT_TOTAL >= 961 961 pin->tx_signal_free_time) { 962 962 pin->tx_nacked = false; 963 963 if (tx_custom_start(pin)) ··· 968 968 cec_pin_low(pin); 969 969 break; 970 970 } 971 - if (delta / CEC_TIM_DATA_BIT_TOTAL > 971 + if (delta / CEC_TIM_DATA_BIT_TOTAL >= 972 972 pin->tx_signal_free_time - 1) 973 973 pin->state = CEC_ST_TX_WAIT; 974 974 break;