[PATCH 1/1] drm/tegra: Add guard to avoid double disable/enable of RGB outputs (original) (raw)

Erik Faye-Lund kusmabite at gmail.com
Tue Feb 11 11:13:14 PST 2014


On Tue, Feb 11, 2014 at 6:12 PM, Dmitry Osipenko <digetx at gmail.com> wrote:

Add guard to check whether RGB output is already enabled in the way it's done for HDMI output. Fixes possible hang on trying to disable output twice (first time during driver probe and second on fb registering).

Signed-off-by: Dmitry Osipenko <digetx at gmail.com> --- drivers/gpu/drm/tegra/rgb.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c index 338f7f6..0266fb4 100644 --- a/drivers/gpu/drm/tegra/rgb.c +++ b/drivers/gpu/drm/tegra/rgb.c @@ -15,6 +15,7 @@ struct tegrargb { struct tegraoutput output; struct tegradc *dc; + bool enabled; struct clk *clkparent; struct clk *clk; @@ -89,6 +90,9 @@ static int tegraoutputrgbenable(struct tegraoutput *output) struct tegrargb *rgb = torgb(output); unsigned long value; + if (rgb->enabled) + return 0; + tegradcwriteregs(rgb->dc, rgbenable, ARRAYSIZE(rgbenable)); value = DESELECTACTIVE | DECONTROLNORMAL; @@ -122,6 +126,8 @@ static int tegraoutputrgbenable(struct tegraoutput *output) tegradcwritel(rgb->dc, GENERALACTREQ << 8, DCCMDSTATECONTROL);_ _tegradcwritel(rgb->dc, GENERALACTREQ, DCCMDSTATECONTROL); + rgb->enabled = true; + return 0; } @@ -130,6 +136,9 @@ static int tegraoutputrgbdisable(struct tegraoutput *output) struct tegrargb *rgb = torgb(output); unsigned long value; + if (!rgb->enabled) + return 0; + value = tegradcreadl(rgb->dc, DCCMDDISPLAYPOWERCONTROL); value &= ~(PW0ENABLE | PW1ENABLE | PW2ENABLE | PW3ENABLE | PW4ENABLE | PM0ENABLE | PM1ENABLE); @@ -144,6 +153,8 @@ static int tegraoutputrgbdisable(struct tegraoutput *output) tegradcwriteregs(rgb->dc, rgbdisable, ARRAYSIZE(rgbdisable)); + rgb->enabled = false; + return 0; }

Wouldn't it make more sense to make "enabled" and int that counts how many times tegra_output_rgb_enable has been called? That way you can have tegra_output_rgb_disable only really disable the display once the same amount of disables have been performed...



More information about the dri-devel mailing list