Commit 865463fc authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: cec-pin: add error injection support

Implement all the error injection commands.

The state machine gets new states for the various error situations,
helper functions are added to detect whether an error injection is
active and the actual error injections are implemented.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 22712b38
...@@ -28,14 +28,30 @@ enum cec_pin_state { ...@@ -28,14 +28,30 @@ enum cec_pin_state {
CEC_ST_TX_START_BIT_LOW, CEC_ST_TX_START_BIT_LOW,
/* Drive CEC high for the start bit */ /* Drive CEC high for the start bit */
CEC_ST_TX_START_BIT_HIGH, CEC_ST_TX_START_BIT_HIGH,
/* Generate a start bit period that is too short */
CEC_ST_TX_START_BIT_HIGH_SHORT,
/* Generate a start bit period that is too long */
CEC_ST_TX_START_BIT_HIGH_LONG,
/* Drive CEC low for the start bit using the custom timing */
CEC_ST_TX_START_BIT_LOW_CUSTOM,
/* Drive CEC high for the start bit using the custom timing */
CEC_ST_TX_START_BIT_HIGH_CUSTOM,
/* Drive CEC low for the 0 bit */ /* Drive CEC low for the 0 bit */
CEC_ST_TX_DATA_BIT_0_LOW, CEC_ST_TX_DATA_BIT_0_LOW,
/* Drive CEC high for the 0 bit */ /* Drive CEC high for the 0 bit */
CEC_ST_TX_DATA_BIT_0_HIGH, CEC_ST_TX_DATA_BIT_0_HIGH,
/* Generate a bit period that is too short */
CEC_ST_TX_DATA_BIT_0_HIGH_SHORT,
/* Generate a bit period that is too long */
CEC_ST_TX_DATA_BIT_0_HIGH_LONG,
/* Drive CEC low for the 1 bit */ /* Drive CEC low for the 1 bit */
CEC_ST_TX_DATA_BIT_1_LOW, CEC_ST_TX_DATA_BIT_1_LOW,
/* Drive CEC high for the 1 bit */ /* Drive CEC high for the 1 bit */
CEC_ST_TX_DATA_BIT_1_HIGH, CEC_ST_TX_DATA_BIT_1_HIGH,
/* Generate a bit period that is too short */
CEC_ST_TX_DATA_BIT_1_HIGH_SHORT,
/* Generate a bit period that is too long */
CEC_ST_TX_DATA_BIT_1_HIGH_LONG,
/* /*
* Wait for start of sample time to check for Ack bit or first * Wait for start of sample time to check for Ack bit or first
* four initiator bits to check for Arbitration Lost. * four initiator bits to check for Arbitration Lost.
...@@ -43,6 +59,20 @@ enum cec_pin_state { ...@@ -43,6 +59,20 @@ enum cec_pin_state {
CEC_ST_TX_DATA_BIT_1_HIGH_PRE_SAMPLE, CEC_ST_TX_DATA_BIT_1_HIGH_PRE_SAMPLE,
/* Wait for end of bit period after sampling */ /* Wait for end of bit period after sampling */
CEC_ST_TX_DATA_BIT_1_HIGH_POST_SAMPLE, CEC_ST_TX_DATA_BIT_1_HIGH_POST_SAMPLE,
/* Generate a bit period that is too short */
CEC_ST_TX_DATA_BIT_1_HIGH_POST_SAMPLE_SHORT,
/* Generate a bit period that is too long */
CEC_ST_TX_DATA_BIT_1_HIGH_POST_SAMPLE_LONG,
/* Drive CEC low for a data bit using the custom timing */
CEC_ST_TX_DATA_BIT_LOW_CUSTOM,
/* Drive CEC high for a data bit using the custom timing */
CEC_ST_TX_DATA_BIT_HIGH_CUSTOM,
/* Drive CEC low for a standalone pulse using the custom timing */
CEC_ST_TX_PULSE_LOW_CUSTOM,
/* Drive CEC high for a standalone pulse using the custom timing */
CEC_ST_TX_PULSE_HIGH_CUSTOM,
/* Start low drive */
CEC_ST_TX_LOW_DRIVE,
/* Rx states */ /* Rx states */
...@@ -54,8 +84,8 @@ enum cec_pin_state { ...@@ -54,8 +84,8 @@ enum cec_pin_state {
CEC_ST_RX_DATA_SAMPLE, CEC_ST_RX_DATA_SAMPLE,
/* Wait for earliest end of bit period after sampling */ /* Wait for earliest end of bit period after sampling */
CEC_ST_RX_DATA_POST_SAMPLE, CEC_ST_RX_DATA_POST_SAMPLE,
/* Wait for CEC to go high (i.e. end of bit period */ /* Wait for CEC to go low (i.e. end of bit period) */
CEC_ST_RX_DATA_HIGH, CEC_ST_RX_DATA_WAIT_FOR_LOW,
/* Drive CEC low to send 0 Ack bit */ /* Drive CEC low to send 0 Ack bit */
CEC_ST_RX_ACK_LOW, CEC_ST_RX_ACK_LOW,
/* End of 0 Ack time, wait for earliest end of bit period */ /* End of 0 Ack time, wait for earliest end of bit period */
...@@ -64,9 +94,9 @@ enum cec_pin_state { ...@@ -64,9 +94,9 @@ enum cec_pin_state {
CEC_ST_RX_ACK_HIGH_POST, CEC_ST_RX_ACK_HIGH_POST,
/* Wait for earliest end of bit period and end of message */ /* Wait for earliest end of bit period and end of message */
CEC_ST_RX_ACK_FINISH, CEC_ST_RX_ACK_FINISH,
/* Start low drive */ /* Start low drive */
CEC_ST_LOW_DRIVE, CEC_ST_RX_LOW_DRIVE,
/* Monitor pin using interrupts */ /* Monitor pin using interrupts */
CEC_ST_RX_IRQ, CEC_ST_RX_IRQ,
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment