From patchwork Mon Apr 1 12:33:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 10879829 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 13F0717EE for ; Mon, 1 Apr 2019 12:32:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F415B28846 for ; Mon, 1 Apr 2019 12:32:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F21202887B; Mon, 1 Apr 2019 12:32:53 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 834AF28856 for ; Mon, 1 Apr 2019 12:32:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 92B206E0E0; Mon, 1 Apr 2019 12:32:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by gabe.freedesktop.org (Postfix) with ESMTPS id B00C96E0E0 for ; Mon, 1 Apr 2019 12:32:50 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x31CWlLX047794; Mon, 1 Apr 2019 07:32:47 -0500 Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x31CWlt9033014 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 1 Apr 2019 07:32:47 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 1 Apr 2019 07:32:46 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Mon, 1 Apr 2019 07:32:46 -0500 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x31CWhLq043961; Mon, 1 Apr 2019 07:32:44 -0500 From: Peter Ujfalusi To: , , , Subject: [PATCH] drm/bridge: ti-tfp410: Fall back to HPD polling if HPD irq is not available Date: Mon, 1 Apr 2019 15:33:42 +0300 Message-ID: <20190401123342.15767-1-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1554121967; bh=EJVKnYK00TT1CVmRfDEExyTP8/YIKb3r9bd0yx7SYTM=; h=From:To:CC:Subject:Date; b=BSjon2Zow67lLcucvERnyojWJL5m+a6G4fR97uiMY+5jsvKQnfkz5JmrmT916OYx4 jfHvAyBCfpVfTpIE4dVbH3+IM2ffQBM8RA0f/2DxNIgbkYp6RfV0chxL6UE21KHtlP MdkrD/DsHyEL4y9mSrOr+aG/dxsX+mWRG4v7M6BM= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In case either the HPD gpio is not specified or when the HPD gpio can not be used as interrupt we should tell the core that the HPD needs to be polled for detecting hotplug. Signed-off-by: Peter Ujfalusi Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/ti-tfp410.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c index 285be4a0f4bd..6fc831eb3804 100644 --- a/drivers/gpu/drm/bridge/ti-tfp410.c +++ b/drivers/gpu/drm/bridge/ti-tfp410.c @@ -31,6 +31,7 @@ struct tfp410 { struct i2c_adapter *ddc; struct gpio_desc *hpd; + int hpd_irq; struct delayed_work hpd_work; struct gpio_desc *powerdown; @@ -124,8 +125,10 @@ static int tfp410_attach(struct drm_bridge *bridge) return -ENODEV; } - if (dvi->hpd) + if (dvi->hpd_irq >= 0) dvi->connector.polled = DRM_CONNECTOR_POLL_HPD; + else + dvi->connector.polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT; drm_connector_helper_add(&dvi->connector, &tfp410_con_helper_funcs); @@ -324,10 +327,15 @@ static int tfp410_init(struct device *dev, bool i2c) return PTR_ERR(dvi->powerdown); } - if (dvi->hpd) { + if (dvi->hpd) + dvi->hpd_irq = gpiod_to_irq(dvi->hpd); + else + dvi->hpd_irq = -ENXIO; + + if (dvi->hpd_irq >= 0) { INIT_DELAYED_WORK(&dvi->hpd_work, tfp410_hpd_work_func); - ret = devm_request_threaded_irq(dev, gpiod_to_irq(dvi->hpd), + ret = devm_request_threaded_irq(dev, dvi->hpd_irq, NULL, tfp410_hpd_irq_thread, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "hdmi-hpd", dvi);