summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2017-08-02 10:54:05 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-10-12 10:49:14 +0300
commita141a29612d7c0ba95a4e36a236d51c2b86e0e2b (patch)
treeaa74c18eaf5583cfecc06f7f001e8cb9b1025bec
parent1d54ecf230029dccc97e26a520ed95b9b95ae0eb (diff)
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>
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi4.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 91c2a1e8b324..fd1b252c6e6d 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -124,9 +124,12 @@ static int hdmi_power_on_core(struct omap_dss_device *dssdev)
{
int r;
+ if (hdmi.core.core_pwr_cnt++)
+ return 0;
+
r = regulator_enable(hdmi.vdda_reg);
if (r)
- return r;
+ goto err_reg_enable;
r = hdmi_runtime_get();
if (r)
@@ -143,12 +146,17 @@ static int hdmi_power_on_core(struct omap_dss_device *dssdev)
err_runtime_get:
regulator_disable(hdmi.vdda_reg);
+err_reg_enable:
+ hdmi.core.core_pwr_cnt--;
return r;
}
static void hdmi_power_off_core(struct omap_dss_device *dssdev)
{
+ if (--hdmi.core.core_pwr_cnt)
+ return;
+
hdmi.core_enabled = false;
hdmi_runtime_put();