Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

omapdrm: hdmi4: refcount hdmi_power_on/off_core

The hdmi_power_on/off_core functions can be called multiple times:
when the HPD changes and when the HDMI CEC support needs to power
the HDMI core.

So use a counter to know when to really power on or off the HDMI core.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

authored by

Hans Verkuil and committed by
Tomi Valkeinen
a141a296 1d54ecf2

+9 -1
+9 -1
drivers/gpu/drm/omapdrm/dss/hdmi4.c
··· 124 124 { 125 125 int r; 126 126 127 + if (hdmi.core.core_pwr_cnt++) 128 + return 0; 129 + 127 130 r = regulator_enable(hdmi.vdda_reg); 128 131 if (r) 129 - return r; 132 + goto err_reg_enable; 130 133 131 134 r = hdmi_runtime_get(); 132 135 if (r) ··· 146 143 147 144 err_runtime_get: 148 145 regulator_disable(hdmi.vdda_reg); 146 + err_reg_enable: 147 + hdmi.core.core_pwr_cnt--; 149 148 150 149 return r; 151 150 } 152 151 153 152 static void hdmi_power_off_core(struct omap_dss_device *dssdev) 154 153 { 154 + if (--hdmi.core.core_pwr_cnt) 155 + return; 156 + 155 157 hdmi.core_enabled = false; 156 158 157 159 hdmi_runtime_put();