media: s5p-cec: add NACK detection support
Subsystems (3)
This is an automatic generated email to let you know that the following patch were queued:
Subject: media: s5p-cec: add NACK detection support Author: Hans Verkuil <[email protected]> Date: Thu Aug 31 12:56:10 2017 -0400
The s5p-cec driver returned CEC_TX_STATUS_ERROR for the NACK condition.
Some digging into the datasheet uncovered the S5P_CEC_TX_STAT1 register where bit 0 indicates if the transmit was nacked or not.
Use this to return the correct CEC_TX_STATUS_NACK status to userspace.
This was the only driver that couldn't tell a NACK from another error, and that was very unusual. And a potential problem for applications as well.
Tested with my Odroid-U3.
Signed-off-by Hans Verkuil <[email protected]>
Cc <[email protected]> # for v4.12 and up
Signed-off-by Mauro Carvalho Chehab <[email protected]>
drivers/media/platform/s5p-cec/exynos_hdmi_cecctrl.c | 3 ++- drivers/media/platform/s5p-cec/s5p_cec.c | 11 ++++++++++- drivers/media/platform/s5p-cec/s5p_cec.h | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-)
---
drivers/media/platform/s5p-cec/exynos_hdmi_cecctrl.c +2 -1
@@ -172,7 +172,8 @@ u32 s5p_cec_get_status(struct s5p_cec_dev *cec) {u32 status =0 ; - status =readb (cec->reg +S5P_CEC_STATUS_0 ); + status =readb (cec->reg +S5P_CEC_STATUS_0 ) &0xf ; + status |= (readb (cec->reg +S5P_CEC_TX_STAT1 ) &0xf ) <<4 ; status |=readb (cec->reg +S5P_CEC_STATUS_1 ) <<8 ; status |=readb (cec->reg +S5P_CEC_STATUS_2 ) <<16 ; status |=readb (cec->reg +S5P_CEC_STATUS_3 ) <<24 ;
drivers/media/platform/s5p-cec/s5p_cec.c +10 -1
@@ -92,7 +92,10 @@ static irqreturn_t s5p_cec_irq_handler(int irq, void *priv)dev_dbg (cec->dev,"irq received\n" );if (status &CEC_STATUS_TX_DONE ) { -if (status &CEC_STATUS_TX_ERROR ) { +if (status &CEC_STATUS_TX_NACK ) { +dev_dbg (cec->dev,"CEC_STATUS_TX_NACK set\n" ); + cec->tx =STATE_NACK ; + }else if (status &CEC_STATUS_TX_ERROR ) {dev_dbg (cec->dev,"CEC_STATUS_TX_ERROR set\n" ); cec->tx =STATE_ERROR ; }else {
@@ -135,6 +138,12 @@ static irqreturn_t s5p_cec_irq_handler_thread(int irq, void *priv)cec_transmit_done (cec->adap,CEC_TX_STATUS_OK ,0 ,0 ,0 ,0 ); cec->tx =STATE_IDLE ;break ; +case STATE_NACK : +cec_transmit_done (cec->adap, +CEC_TX_STATUS_MAX_RETRIES |CEC_TX_STATUS_NACK , +0 ,1 ,0 ,0 ); + cec->tx =STATE_IDLE ; +break ;case STATE_ERROR : cec_transmit_done(cec->adap, CEC_TX_STATUS_MAX_RETRIES | CEC_TX_STATUS_ERROR,
drivers/media/platform/s5p-cec/s5p_cec.h +2 -0
@@ -35,6 +35,7 @@#define CEC_STATUS_TX_TRANSFERRING (1 << 1)#define CEC_STATUS_TX_DONE (1 << 2)#define CEC_STATUS_TX_ERROR (1 << 3) +#define CEC_STATUS_TX_NACK (1 << 4)#define CEC_STATUS_TX_BYTES (0xFF << 8)#define CEC_STATUS_RX_RUNNING (1 << 16)#define CEC_STATUS_RX_RECEIVING (1 << 17)
@@ -55,6 +56,7 @@ enum cec_state {STATE_IDLE ,STATE_BUSY ,STATE_DONE , +STATE_NACK , STATE_ERROR };