From patchwork Mon Nov 28 11:23:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13058301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF97CC4332F for ; Tue, 29 Nov 2022 07:48:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3BD5910E052; Tue, 29 Nov 2022 07:48:32 +0000 (UTC) Received: from smtp-out-01.comm2000.it (smtp-out-01.comm2000.it [212.97.32.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5177B10E1F4 for ; Mon, 28 Nov 2022 11:23:30 +0000 (UTC) Received: from francesco-nb.pivistrello.it (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: francesco@dolcini.it) by smtp-out-01.comm2000.it (Postfix) with ESMTPSA id 81A2E8434BE; Mon, 28 Nov 2022 12:23:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailserver.it; s=mailsrv; t=1669634607; bh=o1vqXSM72h+f8G6bBVWfHnJcH7nCL56jr3X5yawBKic=; h=From:To:Cc:Subject:Date; b=OgK1M/8nDln3IvgT8gEcscYiTgyaZyxpj0SYzsR31X1FbJXL+I8r1XTqaKin2j2vj aige0anNUtfyLnp6/0sE7cEh3ErP3cIPHU9nUcj+nMlOzlIaN+RSYyoZ5nwi8N+9ZP cr42dxw0ZrMh91/tBPB//w2vpi/7ohkLfUBhuMtFpMfz8o8ssnBaZ/ub5/pdz/42rK +iYAvYZ3JRrnAp/gcaAa0Ki9wNNXDH5X/pHp2v2nuRoL8IiOV37N/zsW5pbzMEURwA Nn9ZTToGGa13RXluquqEh+HaKp3UcKiHLy9lGyxQmOgjLqp0s0ijjx4AAHvgoEIbED GLCWaBFBLCDhA== From: Francesco Dolcini To: Adrien Grassein , dri-devel@lists.freedesktop.org Subject: [PATCH v1] drm/bridge: lt8912b: Add hot plug detection Date: Mon, 28 Nov 2022 12:23:20 +0100 Message-Id: <20221128112320.25708-1-francesco@dolcini.it> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 29 Nov 2022 07:48:28 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Neil Armstrong , Jonas Karlman , Jernej Skrabec , Stefan Eichenberger , Robert Foss , Andrzej Hajda , Francesco Dolcini , Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Stefan Eichenberger Enable hot plug detection when it is available on the HDMI port. Without this connecting to a different monitor with incompatible timing before the 10 seconds poll period will lead to a broken display output. Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge") Signed-off-by: Stefan Eichenberger Signed-off-by: Francesco Dolcini Reviewed-by: Robert Foss Reviewed-by: Adrien Grassein --- drivers/gpu/drm/bridge/lontium-lt8912b.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c index a98efef0ba0e..5f0c9cd2a970 100644 --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c @@ -517,14 +517,27 @@ static int lt8912_attach_dsi(struct lt8912 *lt) return 0; } +static void lt8912_bridge_hpd_cb(void *data, enum drm_connector_status status) +{ + struct lt8912 *lt = data; + + if (lt->bridge.dev) + drm_helper_hpd_irq_event(lt->bridge.dev); +} + static int lt8912_bridge_connector_init(struct drm_bridge *bridge) { int ret; struct lt8912 *lt = bridge_to_lt8912(bridge); struct drm_connector *connector = <->connector; - connector->polled = DRM_CONNECTOR_POLL_CONNECT | - DRM_CONNECTOR_POLL_DISCONNECT; + if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) { + drm_bridge_hpd_enable(lt->hdmi_port, lt8912_bridge_hpd_cb, lt); + connector->polled = DRM_CONNECTOR_POLL_HPD; + } else { + connector->polled = DRM_CONNECTOR_POLL_CONNECT | + DRM_CONNECTOR_POLL_DISCONNECT; + } ret = drm_connector_init(bridge->dev, connector, <8912_connector_funcs, @@ -578,6 +591,10 @@ static void lt8912_bridge_detach(struct drm_bridge *bridge) if (lt->is_attached) { lt8912_hard_power_off(lt); + + if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) + drm_bridge_hpd_disable(lt->hdmi_port); + drm_connector_unregister(<->connector); drm_connector_cleanup(<->connector); }