mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
media: cec: core: add rx-no-low-drive setting
If rx-no-low-drive is set, then the CEC pin framework will disable the detection of situations where a Low Drive has to be generated. So if this is set, then we will never generate Low Drives. This helps testing whether other CEC devices generate Low Drive pulses by ensuring it is not us that is generating them. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
36e713438a
commit
a9fc2adc14
@@ -91,6 +91,7 @@ bool cec_pin_error_inj_parse_line(struct cec_adapter *adap, char *line)
|
||||
if (!strcmp(token, "clear")) {
|
||||
memset(pin->error_inj, 0, sizeof(pin->error_inj));
|
||||
pin->rx_toggle = pin->tx_toggle = false;
|
||||
pin->rx_no_low_drive = false;
|
||||
pin->tx_ignore_nack_until_eom = false;
|
||||
pin->tx_custom_pulse = false;
|
||||
pin->tx_custom_low_usecs = CEC_TIM_CUSTOM_DEFAULT;
|
||||
@@ -105,6 +106,7 @@ bool cec_pin_error_inj_parse_line(struct cec_adapter *adap, char *line)
|
||||
for (i = 0; i <= CEC_ERROR_INJ_OP_ANY; i++)
|
||||
pin->error_inj[i] &= ~CEC_ERROR_INJ_RX_MASK;
|
||||
pin->rx_toggle = false;
|
||||
pin->rx_no_low_drive = false;
|
||||
return true;
|
||||
}
|
||||
if (!strcmp(token, "tx-clear")) {
|
||||
@@ -121,6 +123,10 @@ bool cec_pin_error_inj_parse_line(struct cec_adapter *adap, char *line)
|
||||
pin->tx_glitch_rising_edge = false;
|
||||
return true;
|
||||
}
|
||||
if (!strcmp(token, "rx-no-low-drive")) {
|
||||
pin->rx_no_low_drive = true;
|
||||
return true;
|
||||
}
|
||||
if (!strcmp(token, "tx-ignore-nack-until-eom")) {
|
||||
pin->tx_ignore_nack_until_eom = true;
|
||||
return true;
|
||||
@@ -305,6 +311,9 @@ int cec_pin_error_inj_show(struct cec_adapter *adap, struct seq_file *sf)
|
||||
seq_puts(sf, "# <op> rx-clear clear all rx error injections for <op>\n");
|
||||
seq_puts(sf, "# <op> tx-clear clear all tx error injections for <op>\n");
|
||||
seq_puts(sf, "#\n");
|
||||
seq_puts(sf, "# RX error injection settings:\n");
|
||||
seq_puts(sf, "# rx-no-low-drive do not generate low-drive pulses\n");
|
||||
seq_puts(sf, "#\n");
|
||||
seq_puts(sf, "# RX error injection:\n");
|
||||
seq_puts(sf, "# <op>[,<mode>] rx-nack NACK the message instead of sending an ACK\n");
|
||||
seq_puts(sf, "# <op>[,<mode>] rx-low-drive <bit> force a low-drive condition at this bit position\n");
|
||||
@@ -368,6 +377,8 @@ int cec_pin_error_inj_show(struct cec_adapter *adap, struct seq_file *sf)
|
||||
}
|
||||
}
|
||||
|
||||
if (pin->rx_no_low_drive)
|
||||
seq_puts(sf, "rx-no-low-drive\n");
|
||||
if (pin->tx_ignore_nack_until_eom)
|
||||
seq_puts(sf, "tx-ignore-nack-until-eom\n");
|
||||
if (pin->tx_glitch_falling_edge)
|
||||
|
||||
@@ -228,6 +228,7 @@ struct cec_pin {
|
||||
u32 timer_max_overrun;
|
||||
u32 timer_sum_overrun;
|
||||
|
||||
bool rx_no_low_drive;
|
||||
u32 tx_custom_low_usecs;
|
||||
u32 tx_custom_high_usecs;
|
||||
u32 tx_glitch_low_usecs;
|
||||
|
||||
@@ -797,7 +797,7 @@ static void cec_pin_rx_states(struct cec_pin *pin, ktime_t ts)
|
||||
* Go to low drive state when the total bit time is
|
||||
* too short.
|
||||
*/
|
||||
if (delta < CEC_TIM_DATA_BIT_TOTAL_MIN) {
|
||||
if (delta < CEC_TIM_DATA_BIT_TOTAL_MIN && !pin->rx_no_low_drive) {
|
||||
if (!pin->rx_data_bit_too_short_cnt++) {
|
||||
pin->rx_data_bit_too_short_ts = ktime_to_ns(pin->ts);
|
||||
pin->rx_data_bit_too_short_delta = delta;
|
||||
|
||||
Reference in New Issue
Block a user