CHROMIUM: drm/tegra: Add protection for encoder enable/disable

Bug 56043 describes an issue which is, panel power is disabled
when system resumes, which makes the mode setting fails in the
end.

The reason that panel losts power is this:

[   40.504749] [<c04eb748>] (tegra_output_panel_unprepare+0x4c/0x8c)
from [<c04eb7dc>] (tegra_encoder_disable+0x54/0x58)
[   40.515913] [<c04eb7dc>] (tegra_encoder_disable+0x54/0x58) from
[<c04c6f98>] (drm_encoder_disable+0x28/0x3c)
[   40.526261] [<c04c6f98>] (drm_encoder_disable+0x28/0x3c) from
[<c04c7034>] (drm_helper_disable_unused_functions+0x88/0x100)
[   40.537969] [<c04c7034>]
(drm_helper_disable_unused_functions+0x88/0x100) from [<c04c7778>]
(drm_helper_resume_force_mode+0x10c/0x120)
[   40.550682] [<c04c7778>] (drm_helper_resume_force_mode+0x10c/0x120)
from [<c04e433c>] (tegra_drm_platform_resume+0x2c/0x44)
[   40.562391] [<c04e433c>] (tegra_drm_platform_resume+0x2c/0x44) from
[<c04faff0>] (platform_pm_resume+0x50/0x5c)

Actually when suspend, powerd_dbus_suspend already triggered a mode
setting which disabled crtc/encoder/panel, so the backtrace above
disables encoder again which finally really powergated panel.

So this patch adds a "enabled" member for tegra_output, and we use
this member to avoid enable/disable the tegra output multiple times.

BUG=chrome-os-partner:56043
TEST=Display comes back when system resumes

Change-Id: I96991e5602ec2a2aeb7dec3e4ea656a14a4a8867
Signed-off-by: Mark Zhang <markz@gpartner-nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/366945
Commit-Ready: Vince Hsu <vince.h@nvidia.com>
Tested-by: Vince Hsu <vince.h@nvidia.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2 files changed