Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp295276ybx; Wed, 6 Nov 2019 00:20:39 -0800 (PST) X-Google-Smtp-Source: APXvYqx/I7NsKS9QpagcvomBmMCSxXDj0x4Dr9Ct6HkR6aY+OkCDFlRx2Sol9oydxvrLksHx60bs X-Received: by 2002:a50:f05c:: with SMTP id u28mr1208676edl.265.1573028439377; Wed, 06 Nov 2019 00:20:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573028439; cv=none; d=google.com; s=arc-20160816; b=XiIuRLdFNwaUSbGLiJwofgfc0gW5Z9w/jI2QuwiSj142VztgxKm97VIlStTlLuxkdZ nRjTJRUbQegduHC3kbpMFESx8sB5BlPDSz+qkZNcaTaJKPbMGR3lesN0HJ5BbUL+imOl JTaSBP/69tJ4hN666MTXE8Kx/tGkeJXcuWGNBsMo+QBjSfDAcFY1sa7smKp+hVav3bk+ rPVDI58Stqw+ujO3v85NIzqsKXTK6Q6fwQk8+Dr85qi9d6pEkhl+Eqes0UhYHK86IdaN 4DMMfCGnrqLrUvXsnJOYqvntELLXaI1vphf5c3Fu4rhFxPqAbatq0nDBQ8UZUm7Hkgae Cmfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Iv9APmk9yeHIdj2ibPaJ4tcXGxRhG5S114t+Zvu3wyI=; b=hH37BFeBlM9GcgruJrpOSIb4qA89ElFpvZ4ZIM8L7+3Jzj1kIFN8DJGnMY8CoYK+My jB8KlXuAJvh24xarMRRHj4j3Vd6nXwYYjDwmqBXkGAbbihsCXhvhMH1ZQvppNIuNTuRs ZMsAEUEVQajufjaMZzqyRTPBUXeP9j46mm9dzGbLENGmuVimsijAdx6A2bO8k9XJHTS3 8xL8GVeS6ozEBTWEdt91ri/TCIUdSFaUBoTnGkHRM1li3TWTXXPv//fnrJ13w1wviJHv oXCrL0Qxn3zUdozUbaFj57fm4HiGWreHqOJktNBYpqZsIMcY+6UMVICNP3WUQPzP51Zi mNQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si11120123eda.30.2019.11.06.00.20.15; Wed, 06 Nov 2019 00:20:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731264AbfKFIS0 (ORCPT + 99 others); Wed, 6 Nov 2019 03:18:26 -0500 Received: from mailgw02.mediatek.com ([1.203.163.81]:21554 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730205AbfKFIS0 (ORCPT ); Wed, 6 Nov 2019 03:18:26 -0500 X-UUID: 25253dab0afd47488c94f4ba8422e5a9-20191106 X-UUID: 25253dab0afd47488c94f4ba8422e5a9-20191106 Received: from mtkcas35.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1504382312; Wed, 06 Nov 2019 16:18:00 +0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by MTKMBS33N2.mediatek.inc (172.27.4.76) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 6 Nov 2019 16:17:58 +0800 Received: from mszsdclx1018.gcn.mediatek.inc (172.27.4.253) by MTKCAS32.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 6 Nov 2019 16:17:57 +0800 From: Jitao Shi To: Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Maarten Lankhorst , , CC: , , , , , , , , Jitao Shi Subject: [PATCH 1/1] drm/panel: boe-tv101wum-n16 seperate the panel power control Date: Wed, 6 Nov 2019 16:17:52 +0800 Message-ID: <20191106081752.12944-2-jitao.shi@mediatek.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191106081752.12944-1-jitao.shi@mediatek.com> References: <20191106081752.12944-1-jitao.shi@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-TM-SNTS-SMTP: 7250D2CDEDEBC5411FF78CEBCF2F72549F4795A771E1D586B2B3B5E503F1CC012000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Seperate the panel power control from prepare/unprepare. Signed-off-by: Jitao Shi --- .../gpu/drm/panel/panel-boe-tv101wum-nl6.c | 69 +++++++++++++------ 1 file changed, 49 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c index e2496a334ab6..5b1b285a2194 100644 --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c @@ -50,6 +50,7 @@ struct boe_panel { struct regulator *avdd; struct gpio_desc *enable_gpio; + bool prepared_power; bool prepared; bool enabled; @@ -501,12 +502,11 @@ static int boe_panel_disable(struct drm_panel *panel) return 0; } -static int boe_panel_unprepare(struct drm_panel *panel) +static int boe_panel_unprepare_power(struct drm_panel *panel) { struct boe_panel *boe = to_boe_panel(panel); - int ret; - if (!boe->prepared) + if (!boe->prepared_power) return 0; if (boe->desc->discharge_on_disable) { @@ -518,12 +518,6 @@ static int boe_panel_unprepare(struct drm_panel *panel) usleep_range(5000, 7000); regulator_disable(boe->pp1800); } else { - ret = boe_panel_off(boe); - if (ret < 0) { - dev_err(panel->dev, "failed to set panel off: %d\n", - ret); - return ret; - } msleep(150); gpiod_set_value(boe->enable_gpio, 0); usleep_range(500, 1000); @@ -533,17 +527,39 @@ static int boe_panel_unprepare(struct drm_panel *panel) regulator_disable(boe->pp1800); } + boe->prepared_power = false; + + return 0; +} + +static int boe_panel_unprepare(struct drm_panel *panel) +{ + struct boe_panel *boe = to_boe_panel(panel); + int ret; + + if (!boe->prepared) + return 0; + + if (!boe->desc->discharge_on_disable) { + ret = boe_panel_off(boe); + if (ret < 0) { + dev_err(panel->dev, "failed to set panel off: %d\n", + ret); + return ret; + } + } + boe->prepared = false; return 0; } -static int boe_panel_prepare(struct drm_panel *panel) +static int boe_panel_prepare_power(struct drm_panel *panel) { struct boe_panel *boe = to_boe_panel(panel); int ret; - if (boe->prepared) + if (boe->prepared_power) return 0; gpiod_set_value(boe->enable_gpio, 0); @@ -571,18 +587,10 @@ static int boe_panel_prepare(struct drm_panel *panel) gpiod_set_value(boe->enable_gpio, 1); usleep_range(6000, 10000); - ret = boe_panel_init(boe); - if (ret < 0) { - dev_err(panel->dev, "failed to init panel: %d\n", ret); - goto poweroff; - } - - boe->prepared = true; + boe->prepared_power = true; return 0; -poweroff: - regulator_disable(boe->avee); poweroffavdd: regulator_disable(boe->avdd); poweroff1v8: @@ -593,6 +601,25 @@ static int boe_panel_prepare(struct drm_panel *panel) return ret; } +static int boe_panel_prepare(struct drm_panel *panel) +{ + struct boe_panel *boe = to_boe_panel(panel); + int ret; + + if (boe->prepared) + return 0; + + ret = boe_panel_init(boe); + if (ret < 0) { + dev_err(panel->dev, "failed to init panel: %d\n", ret); + return ret; + } + + boe->prepared = true; + + return 0; +} + static int boe_panel_enable(struct drm_panel *panel) { struct boe_panel *boe = to_boe_panel(panel); @@ -754,7 +781,9 @@ static int boe_panel_get_modes(struct drm_panel *panel) static const struct drm_panel_funcs boe_panel_funcs = { .disable = boe_panel_disable, .unprepare = boe_panel_unprepare, + .unprepare_power = boe_panel_unprepare_power, .prepare = boe_panel_prepare, + .prepare_power = boe_panel_prepare_power, .enable = boe_panel_enable, .get_modes = boe_panel_get_modes, }; -- 2.21.0