Skip to content

Commit 865463f

Browse files
Hans Verkuilmchehab
authored andcommitted
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: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
1 parent 22712b3 commit 865463f

2 files changed

Lines changed: 527 additions & 59 deletions

File tree

‎drivers/media/cec/cec-pin-priv.h‎

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,51 @@ enum cec_pin_state {
2828
CEC_ST_TX_START_BIT_LOW,
2929
/* Drive CEC high for the start bit */
3030
CEC_ST_TX_START_BIT_HIGH,
31+
/* Generate a start bit period that is too short */
32+
CEC_ST_TX_START_BIT_HIGH_SHORT,
33+
/* Generate a start bit period that is too long */
34+
CEC_ST_TX_START_BIT_HIGH_LONG,
35+
/* Drive CEC low for the start bit using the custom timing */
36+
CEC_ST_TX_START_BIT_LOW_CUSTOM,
37+
/* Drive CEC high for the start bit using the custom timing */
38+
CEC_ST_TX_START_BIT_HIGH_CUSTOM,
3139
/* Drive CEC low for the 0 bit */
3240
CEC_ST_TX_DATA_BIT_0_LOW,
3341
/* Drive CEC high for the 0 bit */
3442
CEC_ST_TX_DATA_BIT_0_HIGH,
43+
/* Generate a bit period that is too short */
44+
CEC_ST_TX_DATA_BIT_0_HIGH_SHORT,
45+
/* Generate a bit period that is too long */
46+
CEC_ST_TX_DATA_BIT_0_HIGH_LONG,
3547
/* Drive CEC low for the 1 bit */
3648
CEC_ST_TX_DATA_BIT_1_LOW,
3749
/* Drive CEC high for the 1 bit */
3850
CEC_ST_TX_DATA_BIT_1_HIGH,
51+
/* Generate a bit period that is too short */
52+
CEC_ST_TX_DATA_BIT_1_HIGH_SHORT,
53+
/* Generate a bit period that is too long */
54+
CEC_ST_TX_DATA_BIT_1_HIGH_LONG,
3955
/*
4056
* Wait for start of sample time to check for Ack bit or first
4157
* four initiator bits to check for Arbitration Lost.
4258
*/
4359
CEC_ST_TX_DATA_BIT_1_HIGH_PRE_SAMPLE,
4460
/* Wait for end of bit period after sampling */
4561
CEC_ST_TX_DATA_BIT_1_HIGH_POST_SAMPLE,
62+
/* Generate a bit period that is too short */
63+
CEC_ST_TX_DATA_BIT_1_HIGH_POST_SAMPLE_SHORT,
64+
/* Generate a bit period that is too long */
65+
CEC_ST_TX_DATA_BIT_1_HIGH_POST_SAMPLE_LONG,
66+
/* Drive CEC low for a data bit using the custom timing */
67+
CEC_ST_TX_DATA_BIT_LOW_CUSTOM,
68+
/* Drive CEC high for a data bit using the custom timing */
69+
CEC_ST_TX_DATA_BIT_HIGH_CUSTOM,
70+
/* Drive CEC low for a standalone pulse using the custom timing */
71+
CEC_ST_TX_PULSE_LOW_CUSTOM,
72+
/* Drive CEC high for a standalone pulse using the custom timing */
73+
CEC_ST_TX_PULSE_HIGH_CUSTOM,
74+
/* Start low drive */
75+
CEC_ST_TX_LOW_DRIVE,
4676

4777
/* Rx states */
4878

@@ -54,8 +84,8 @@ enum cec_pin_state {
5484
CEC_ST_RX_DATA_SAMPLE,
5585
/* Wait for earliest end of bit period after sampling */
5686
CEC_ST_RX_DATA_POST_SAMPLE,
57-
/* Wait for CEC to go high (i.e. end of bit period */
58-
CEC_ST_RX_DATA_HIGH,
87+
/* Wait for CEC to go low (i.e. end of bit period) */
88+
CEC_ST_RX_DATA_WAIT_FOR_LOW,
5989
/* Drive CEC low to send 0 Ack bit */
6090
CEC_ST_RX_ACK_LOW,
6191
/* End of 0 Ack time, wait for earliest end of bit period */
@@ -64,9 +94,9 @@ enum cec_pin_state {
6494
CEC_ST_RX_ACK_HIGH_POST,
6595
/* Wait for earliest end of bit period and end of message */
6696
CEC_ST_RX_ACK_FINISH,
67-
6897
/* Start low drive */
69-
CEC_ST_LOW_DRIVE,
98+
CEC_ST_RX_LOW_DRIVE,
99+
70100
/* Monitor pin using interrupts */
71101
CEC_ST_RX_IRQ,
72102

0 commit comments

Comments
 (0)