diff options
author | Thierry Reding <treding@nvidia.com> | 2013-10-29 11:00:42 -0400 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2013-12-19 03:29:55 -0500 |
commit | 365765fc293e68a1d2ce63811b80c5b3c33eebd1 (patch) | |
tree | 566e75fc4d528d51e189d147807902149c9a6db2 | |
parent | 17a8b6b03717fda28be73bc0d24a608a8339d646 (diff) |
drm/tegra: Track HDMI enable state
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>
-rw-r--r-- | drivers/gpu/drm/tegra/hdmi.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index d8cc81f5de38..19ce750e4856 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c | |||
@@ -40,6 +40,7 @@ struct tegra_hdmi { | |||
40 | struct host1x_client client; | 40 | struct host1x_client client; |
41 | struct tegra_output output; | 41 | struct tegra_output output; |
42 | struct device *dev; | 42 | struct device *dev; |
43 | bool enabled; | ||
43 | 44 | ||
44 | struct regulator *vdd; | 45 | struct regulator *vdd; |
45 | struct regulator *pll; | 46 | struct regulator *pll; |
@@ -699,6 +700,9 @@ static int tegra_output_hdmi_enable(struct tegra_output *output) | |||
699 | int retries = 1000; | 700 | int retries = 1000; |
700 | int err; | 701 | int err; |
701 | 702 | ||
703 | if (hdmi->enabled) | ||
704 | return 0; | ||
705 | |||
702 | hdmi->dvi = !tegra_output_is_hdmi(output); | 706 | hdmi->dvi = !tegra_output_is_hdmi(output); |
703 | 707 | ||
704 | pclk = mode->clock * 1000; | 708 | pclk = mode->clock * 1000; |
@@ -906,6 +910,8 @@ static int tegra_output_hdmi_enable(struct tegra_output *output) | |||
906 | 910 | ||
907 | /* TODO: add HDCP support */ | 911 | /* TODO: add HDCP support */ |
908 | 912 | ||
913 | hdmi->enabled = true; | ||
914 | |||
909 | return 0; | 915 | return 0; |
910 | } | 916 | } |
911 | 917 | ||
@@ -913,10 +919,15 @@ static int tegra_output_hdmi_disable(struct tegra_output *output) | |||
913 | { | 919 | { |
914 | struct tegra_hdmi *hdmi = to_hdmi(output); | 920 | struct tegra_hdmi *hdmi = to_hdmi(output); |
915 | 921 | ||
922 | if (!hdmi->enabled) | ||
923 | return 0; | ||
924 | |||
916 | reset_control_assert(hdmi->rst); | 925 | reset_control_assert(hdmi->rst); |
917 | clk_disable(hdmi->clk); | 926 | clk_disable(hdmi->clk); |
918 | regulator_disable(hdmi->pll); | 927 | regulator_disable(hdmi->pll); |
919 | 928 | ||
929 | hdmi->enabled = false; | ||
930 | |||
920 | return 0; | 931 | return 0; |
921 | } | 932 | } |
922 | 933 | ||