drm/vc4: hdmi: Split the CEC disable / enable functions in two
In order to ease further additions to the CEC enable and disable, let's split the function into two functions, one to enable and the other to disable. Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-5-maxime@cerno.tech
This commit is contained in:
parent
caa51a4c11
commit
724fc856c0
|
@ -1736,7 +1736,7 @@ static irqreturn_t vc4_cec_irq_handler(int irq, void *priv)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int vc4_hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)
|
||||
static int vc4_hdmi_cec_enable(struct cec_adapter *adap)
|
||||
{
|
||||
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
|
||||
/* clock period in microseconds */
|
||||
|
@ -1749,7 +1749,6 @@ static int vc4_hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)
|
|||
val |= ((4700 / usecs) << VC4_HDMI_CEC_CNT_TO_4700_US_SHIFT) |
|
||||
((4500 / usecs) << VC4_HDMI_CEC_CNT_TO_4500_US_SHIFT);
|
||||
|
||||
if (enable) {
|
||||
HDMI_WRITE(HDMI_CEC_CNTRL_5, val |
|
||||
VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET);
|
||||
HDMI_WRITE(HDMI_CEC_CNTRL_5, val);
|
||||
|
@ -1772,15 +1771,31 @@ static int vc4_hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)
|
|||
|
||||
if (!vc4_hdmi->variant->external_irq_controller)
|
||||
HDMI_WRITE(HDMI_CEC_CPU_MASK_CLEAR, VC4_HDMI_CPU_CEC);
|
||||
} else {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vc4_hdmi_cec_disable(struct cec_adapter *adap)
|
||||
{
|
||||
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
|
||||
|
||||
if (!vc4_hdmi->variant->external_irq_controller)
|
||||
HDMI_WRITE(HDMI_CEC_CPU_MASK_SET, VC4_HDMI_CPU_CEC);
|
||||
HDMI_WRITE(HDMI_CEC_CNTRL_5, val |
|
||||
|
||||
HDMI_WRITE(HDMI_CEC_CNTRL_5, HDMI_READ(HDMI_CEC_CNTRL_5) |
|
||||
VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vc4_hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)
|
||||
{
|
||||
if (enable)
|
||||
return vc4_hdmi_cec_enable(adap);
|
||||
else
|
||||
return vc4_hdmi_cec_disable(adap);
|
||||
}
|
||||
|
||||
static int vc4_hdmi_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr)
|
||||
{
|
||||
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
|
||||
|
|
Loading…
Reference in New Issue