File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -2869,6 +2869,7 @@ static int vc4_hdmi_runtime_resume(struct device *dev)
2869
2869
struct vc4_hdmi * vc4_hdmi = dev_get_drvdata (dev );
2870
2870
unsigned long __maybe_unused flags ;
2871
2871
u32 __maybe_unused value ;
2872
+ unsigned long rate ;
2872
2873
int ret ;
2873
2874
2874
2875
/*
@@ -2884,6 +2885,21 @@ static int vc4_hdmi_runtime_resume(struct device *dev)
2884
2885
if (ret )
2885
2886
return ret ;
2886
2887
2888
+ /*
2889
+ * Whenever the RaspberryPi boots without an HDMI monitor
2890
+ * plugged in, the firmware won't have initialized the HSM clock
2891
+ * rate and it will be reported as 0.
2892
+ *
2893
+ * If we try to access a register of the controller in such a
2894
+ * case, it will lead to a silent CPU stall. Let's make sure we
2895
+ * prevent such a case.
2896
+ */
2897
+ rate = clk_get_rate (vc4_hdmi -> hsm_clock );
2898
+ if (!rate ) {
2899
+ ret = - EINVAL ;
2900
+ goto err_disable_clk ;
2901
+ }
2902
+
2887
2903
if (vc4_hdmi -> variant -> reset )
2888
2904
vc4_hdmi -> variant -> reset (vc4_hdmi );
2889
2905
@@ -2905,6 +2921,10 @@ static int vc4_hdmi_runtime_resume(struct device *dev)
2905
2921
#endif
2906
2922
2907
2923
return 0 ;
2924
+
2925
+ err_disable_clk :
2926
+ clk_disable_unprepare (vc4_hdmi -> hsm_clock );
2927
+ return ret ;
2908
2928
}
2909
2929
2910
2930
static int vc4_hdmi_bind (struct device * dev , struct device * master , void * data )
You can’t perform that action at this time.
0 commit comments