media: tegra-cec: reset rx_buf_cnt when start bit detected
If a start bit is detected, then reset the receive buffer counter to 0. This ensures that no stale data is in the buffer if a message is broken off midstream due to e.g. a Low Drive condition and then retransmitted. The only Rx interrupts we need to listen to are RX_REGISTER_FULL (i.e. a valid byte was received) and RX_START_BIT_DETECTED (i.e. a new message starts and we need to reset the counter). Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: <stable@vger.kernel.org> # for v4.15 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
2fe4c22c53
commit
e113d65ae4
|
@ -172,16 +172,13 @@ static irqreturn_t tegra_cec_irq_handler(int irq, void *data)
|
|||
}
|
||||
}
|
||||
|
||||
if (status & (TEGRA_CEC_INT_STAT_RX_REGISTER_OVERRUN |
|
||||
TEGRA_CEC_INT_STAT_RX_BUS_ANOMALY_DETECTED |
|
||||
TEGRA_CEC_INT_STAT_RX_START_BIT_DETECTED |
|
||||
TEGRA_CEC_INT_STAT_RX_BUS_ERROR_DETECTED)) {
|
||||
if (status & TEGRA_CEC_INT_STAT_RX_START_BIT_DETECTED) {
|
||||
cec_write(cec, TEGRA_CEC_INT_STAT,
|
||||
(TEGRA_CEC_INT_STAT_RX_REGISTER_OVERRUN |
|
||||
TEGRA_CEC_INT_STAT_RX_BUS_ANOMALY_DETECTED |
|
||||
TEGRA_CEC_INT_STAT_RX_START_BIT_DETECTED |
|
||||
TEGRA_CEC_INT_STAT_RX_BUS_ERROR_DETECTED));
|
||||
} else if (status & TEGRA_CEC_INT_STAT_RX_REGISTER_FULL) {
|
||||
TEGRA_CEC_INT_STAT_RX_START_BIT_DETECTED);
|
||||
cec->rx_done = false;
|
||||
cec->rx_buf_cnt = 0;
|
||||
}
|
||||
if (status & TEGRA_CEC_INT_STAT_RX_REGISTER_FULL) {
|
||||
u32 v;
|
||||
|
||||
cec_write(cec, TEGRA_CEC_INT_STAT,
|
||||
|
@ -255,7 +252,7 @@ static int tegra_cec_adap_enable(struct cec_adapter *adap, bool enable)
|
|||
TEGRA_CEC_INT_MASK_TX_BUS_ANOMALY_DETECTED |
|
||||
TEGRA_CEC_INT_MASK_TX_FRAME_TRANSMITTED |
|
||||
TEGRA_CEC_INT_MASK_RX_REGISTER_FULL |
|
||||
TEGRA_CEC_INT_MASK_RX_REGISTER_OVERRUN);
|
||||
TEGRA_CEC_INT_MASK_RX_START_BIT_DETECTED);
|
||||
|
||||
cec_write(cec, TEGRA_CEC_HW_CONTROL, TEGRA_CEC_HWCTRL_TX_RX_MODE);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue