Skip to content

Commit 55b10b8

Browse files
mripardgregkh
authored andcommitted
drm/vc4: hdmi: Make sure the device is powered with CEC
commit 20b0dfa upstream. Similarly to what we encountered with the detect hook with DRM, nothing actually prevents any of the CEC callback from being run while the HDMI output is disabled. However, this is an issue since any register access to the controller when it's powered down will result in a silent hang. Let's make sure we run the runtime_pm hooks when the CEC adapter is opened and closed by the userspace to avoid that issue. Fixes: 15b4511 ("drm/vc4: add HDMI CEC support") 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-6-maxime@cerno.tech Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 81ac08a commit 55b10b8

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎drivers/gpu/drm/vc4/vc4_hdmi.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,8 +1399,14 @@ static int vc4_hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)
13991399
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
14001400
/* clock period in microseconds */
14011401
const u32 usecs = 1000000 / CEC_CLOCK_FREQ;
1402-
u32 val = HDMI_READ(HDMI_CEC_CNTRL_5);
1402+
u32 val;
1403+
int ret;
1404+
1405+
ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev);
1406+
if (ret)
1407+
return ret;
14031408

1409+
val = HDMI_READ(HDMI_CEC_CNTRL_5);
14041410
val &= ~(VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET |
14051411
VC4_HDMI_CEC_CNT_TO_4700_US_MASK |
14061412
VC4_HDMI_CEC_CNT_TO_4500_US_MASK);
@@ -1525,6 +1531,8 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi)
15251531
if (ret < 0)
15261532
goto err_delete_cec_adap;
15271533

1534+
pm_runtime_put(&vc4_hdmi->pdev->dev);
1535+
15281536
return 0;
15291537

15301538
err_delete_cec_adap:

0 commit comments

Comments
 (0)