drm/panel: simple: fix regulator reference count be set to 2

when power invert and power on:
	->loader_protect[on]->disable regulator(ref count is 0)
	  -> panel_simple_prepare[on]->disable regulator(ref count is 0)
	    ->loader_protect[off]->enable regulator(ref count is 1)
	      ->suspend->enable regulator(ref count is 2)
	        ->resume->disable regulator faild(ref count is 1)

Fixes: 7a91ba36d80 ("drm/panel: panel: add power-invert for some special hardwre")
Change-Id: I43f1cef2410316faec24238cd3f8d2bc1fe38335
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
This commit is contained in:
Sandy Huang
2017-10-20 15:04:30 +08:00
parent 7af58fc74e
commit 0fc389f0d1

View File

@@ -362,11 +362,13 @@ static int panel_simple_regulator_disable(struct drm_panel *panel)
int err = 0;
if (p->power_invert) {
err = regulator_enable(p->supply);
if (err < 0) {
dev_err(panel->dev, "failed to enable supply: %d\n",
err);
return err;
if (!regulator_is_enabled(p->supply)) {
err = regulator_enable(p->supply);
if (err < 0) {
dev_err(panel->dev, "failed to enable supply: %d\n",
err);
return err;
}
}
} else {
regulator_disable(p->supply);