Skip to content

Commit

Permalink
drm/tegra: Track HDMI enable state
Browse files Browse the repository at this point in the history
The DRM core doesn't track enable and disable state of encoders and/or
connectors, so calls to the output's .enable() and .disable() are not
guaranteed to be balanced. Track the enable state internally so that
calls to regulator and clock frameworks remain balanced.

Signed-off-by: Thierry Reding <treding@nvidia.com>
  • Loading branch information
Thierry Reding committed Dec 19, 2013
1 parent 17a8b6b commit 365765f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/gpu/drm/tegra/hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct tegra_hdmi {
struct host1x_client client;
struct tegra_output output;
struct device *dev;
bool enabled;

struct regulator *vdd;
struct regulator *pll;
Expand Down Expand Up @@ -699,6 +700,9 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)
int retries = 1000;
int err;

if (hdmi->enabled)
return 0;

hdmi->dvi = !tegra_output_is_hdmi(output);

pclk = mode->clock * 1000;
Expand Down Expand Up @@ -906,17 +910,24 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)

/* TODO: add HDCP support */

hdmi->enabled = true;

return 0;
}

static int tegra_output_hdmi_disable(struct tegra_output *output)
{
struct tegra_hdmi *hdmi = to_hdmi(output);

if (!hdmi->enabled)
return 0;

reset_control_assert(hdmi->rst);
clk_disable(hdmi->clk);
regulator_disable(hdmi->pll);

hdmi->enabled = false;

return 0;
}

Expand Down

0 comments on commit 365765f

Please sign in to comment.