From patchwork Fri Jul 22 01:50:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yakir Yang X-Patchwork-Id: 9242799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0B0EE602F0 for ; Fri, 22 Jul 2016 01:50:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF54127BF7 for ; Fri, 22 Jul 2016 01:50:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3B3427F54; Fri, 22 Jul 2016 01:50:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8159827BF7 for ; Fri, 22 Jul 2016 01:50:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752318AbcGVBu4 (ORCPT ); Thu, 21 Jul 2016 21:50:56 -0400 Received: from lucky1.263xmail.com ([211.157.147.135]:46457 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752139AbcGVBuz (ORCPT ); Thu, 21 Jul 2016 21:50:55 -0400 Received: from ykk?rock-chips.com (unknown [192.168.167.190]) by lucky1.263xmail.com (Postfix) with SMTP id 3B04674D; Fri, 22 Jul 2016 09:50:51 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 57C25395; Fri, 22 Jul 2016 09:50:42 +0800 (CST) X-RL-SENDER: ykk@rock-chips.com X-FST-TO: yzq@rock-chips.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: ykk@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: ykk@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 2193218CQ2G; Fri, 22 Jul 2016 09:50:47 +0800 (CST) From: Yakir Yang To: Mark Yao , Inki Dae , Thierry Reding , Heiko Stuebner Cc: Jingoo Han , Javier Martinez Canillas , =?UTF-8?q?St=C3=A9phane=20Marchesin?= , Sean Paul , Tomasz Figa , dianders@chromium.org, David Airlie , daniel.vetter@ffwll.ch, Krzysztof Kozlowski , emil.l.velikov@gmail.com, Yakir Yang , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-rockchip@lists.infradead.org Subject: [PATCH v2 2/3] drm/bridge: analogix_dp: turn off the panel when eDP need to disable Date: Fri, 22 Jul 2016 09:50:40 +0800 Message-Id: <1469152240-7316-1-git-send-email-ykk@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469151750-7130-1-git-send-email-ykk@rock-chips.com> References: <1469151750-7130-1-git-send-email-ykk@rock-chips.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some panels (like Sharp LQ123P1JX31) need to be turn off when eDP controller stop to send valid video signal, otherwhise panel would go burn in, and keep flicker and flicker. So it's better to turn off the panel when eDP need to disable, and we need to turn on the panel in connector->detect() callback, so that driver would detect panel status rightly. Signed-off-by: Yakir Yang --- Changes in v2: - s/Panle/Panel/ (Sean) - Move the drm_panel_xxxx out of a conditional, and throw the return code away (Sean) - Add comments about why we need unprepare the panel in bridge_disable (Sean) - Unprepare the panel at the end of bridge->disable() function. drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 37 ++++++++++++++++------ 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 32715da..0ddaf93 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -960,6 +960,17 @@ enum drm_connector_status analogix_dp_detect(struct drm_connector *connector, bool force) { struct analogix_dp_device *dp = to_dp(connector); + int ret; + + /* + * Panel would prepare for several times here, but don't worry, it + * would only enable the hardware at the first prepare time. + */ + if (dp->plat_data->panel) { + ret = drm_panel_prepare(dp->plat_data->panel); + if (ret) + DRM_ERROR("failed to setup the panel ret = %d\n", ret); + } if (analogix_dp_detect_hpd(dp)) return connector_status_disconnected; @@ -1058,13 +1069,15 @@ static void analogix_dp_bridge_enable(struct drm_bridge *bridge) static void analogix_dp_bridge_disable(struct drm_bridge *bridge) { struct analogix_dp_device *dp = bridge->driver_private; + int ret; if (dp->dpms_mode != DRM_MODE_DPMS_ON) return; if (dp->plat_data->panel) { - if (drm_panel_disable(dp->plat_data->panel)) { - DRM_ERROR("failed to disable the panel\n"); + ret = drm_panel_disable(dp->plat_data->panel); + if (ret) { + DRM_ERROR("failed to disable the panel [%d]\n", ret); return; } } @@ -1077,6 +1090,19 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge) pm_runtime_put_sync(dp->dev); + /* + * Some panels need to be turn off when eDP controller stop to send + * valid video signal, otherwhise panel would go burn in, and keep + * flicker and flicker. + */ + if (dp->plat_data->panel) { + ret = drm_panel_unprepare(dp->plat_data->panel); + if (ret) { + DRM_ERROR("failed to turnoff the panel [%d]\n", ret); + return; + } + } + dp->dpms_mode = DRM_MODE_DPMS_OFF; } @@ -1333,13 +1359,6 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, phy_power_on(dp->phy); - if (dp->plat_data->panel) { - if (drm_panel_prepare(dp->plat_data->panel)) { - DRM_ERROR("failed to setup the panel\n"); - return -EBUSY; - } - } - analogix_dp_init_dp(dp); ret = devm_request_threaded_irq(&pdev->dev, dp->irq,