Skip to content

Commit

Permalink
omapdrm: hdmi4: refcount hdmi_power_on/off_core
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hans Verkuil authored and Tomi Valkeinen committed Oct 12, 2017
1 parent 1d54ecf commit a141a29
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/gpu/drm/omapdrm/dss/hdmi4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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();
Expand Down

0 comments on commit a141a29

Please sign in to comment.