From: Greg Kroah-Hartman Date: Thu, 3 Feb 2022 18:08:30 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v5.4.177~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ab468d90cf387e976ed3f03e7109de1349a4ff8e;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: drm-vc4-hdmi-make-sure-the-device-is-powered-with-cec.patch --- diff --git a/queue-5.15/drm-vc4-hdmi-make-sure-the-device-is-powered-with-cec.patch b/queue-5.15/drm-vc4-hdmi-make-sure-the-device-is-powered-with-cec.patch new file mode 100644 index 00000000000..c2c6fdb6eae --- /dev/null +++ b/queue-5.15/drm-vc4-hdmi-make-sure-the-device-is-powered-with-cec.patch @@ -0,0 +1,95 @@ +From 20b0dfa86bef0e80b41b0e5ac38b92f23b6f27f9 Mon Sep 17 00:00:00 2001 +From: Maxime Ripard +Date: Thu, 19 Aug 2021 15:59:30 +0200 +Subject: drm/vc4: hdmi: Make sure the device is powered with CEC + +From: Maxime Ripard + +Commit 20b0dfa86bef0e80b41b0e5ac38b92f23b6f27f9 upstream. + +The original commit depended on a rework commit (724fc856c09e ("drm/vc4: +hdmi: Split the CEC disable / enable functions in two")) that +(rightfully) didn't reach stable. + +However, probably because the context changed, when the patch was +applied to stable the pm_runtime_put called got moved to the end of the +vc4_hdmi_cec_adap_enable function (that would have become +vc4_hdmi_cec_disable with the rework) to vc4_hdmi_cec_init. + +This means that at probe time, we now drop our reference to the clocks +and power domains and thus end up with a CPU hang when the CPU tries to +access registers. + +The call to pm_runtime_resume_and_get() is also problematic since the +.adap_enable CEC hook is called both to enable and to disable the +controller. That means that we'll now call pm_runtime_resume_and_get() +at disable time as well, messing with the reference counting. + +The behaviour we should have though would be to have +pm_runtime_resume_and_get() called when the CEC controller is enabled, +and pm_runtime_put when it's disabled. + +We need to move things around a bit to behave that way, but it aligns +stable with upstream. + +Cc: # 5.10.x +Cc: # 5.15.x +Cc: # 5.16.x +Reported-by: Michael Stapelberg +Signed-off-by: Maxime Ripard +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/vc4/vc4_hdmi.c | 25 +++++++++++++------------ + 1 file changed, 13 insertions(+), 12 deletions(-) + +--- a/drivers/gpu/drm/vc4/vc4_hdmi.c ++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c +@@ -1738,18 +1738,18 @@ static int vc4_hdmi_cec_adap_enable(stru + u32 val; + int ret; + +- ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); +- if (ret) +- return ret; ++ if (enable) { ++ ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); ++ if (ret) ++ return ret; + +- val = HDMI_READ(HDMI_CEC_CNTRL_5); +- val &= ~(VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET | +- VC4_HDMI_CEC_CNT_TO_4700_US_MASK | +- VC4_HDMI_CEC_CNT_TO_4500_US_MASK); +- val |= ((4700 / usecs) << VC4_HDMI_CEC_CNT_TO_4700_US_SHIFT) | +- ((4500 / usecs) << VC4_HDMI_CEC_CNT_TO_4500_US_SHIFT); ++ val = HDMI_READ(HDMI_CEC_CNTRL_5); ++ val &= ~(VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET | ++ VC4_HDMI_CEC_CNT_TO_4700_US_MASK | ++ VC4_HDMI_CEC_CNT_TO_4500_US_MASK); ++ 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); +@@ -1777,7 +1777,10 @@ static int vc4_hdmi_cec_adap_enable(stru + HDMI_WRITE(HDMI_CEC_CPU_MASK_SET, VC4_HDMI_CPU_CEC); + HDMI_WRITE(HDMI_CEC_CNTRL_5, val | + VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET); ++ ++ pm_runtime_put(&vc4_hdmi->pdev->dev); + } ++ + return 0; + } + +@@ -1888,8 +1891,6 @@ static int vc4_hdmi_cec_init(struct vc4_ + if (ret < 0) + goto err_remove_handlers; + +- pm_runtime_put(&vc4_hdmi->pdev->dev); +- + return 0; + + err_remove_handlers: diff --git a/queue-5.15/series b/queue-5.15/series index 7aadba04d17..385f4bf3fe6 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -2,3 +2,4 @@ pci-pciehp-fix-infinite-loop-in-irq-handler-upon-power-fault.patch selftests-mptcp-fix-ipv6-routing-setup.patch net-ipa-use-a-bitmap-for-endpoint-replenish_enabled.patch net-ipa-prevent-concurrent-replenish.patch +drm-vc4-hdmi-make-sure-the-device-is-powered-with-cec.patch