From patchwork Mon Apr 30 14:43:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 10371905 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 6E0286053E for ; Mon, 30 Apr 2018 14:43:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E9D428824 for ; Mon, 30 Apr 2018 14:43:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 536FA288EB; Mon, 30 Apr 2018 14:43:55 +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 E848528824 for ; Mon, 30 Apr 2018 14:43:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A5D3A6E356; Mon, 30 Apr 2018 14:43:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.bootlin.com (mail.bootlin.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id 5DE446E350 for ; Mon, 30 Apr 2018 14:43:37 +0000 (UTC) Received: by mail.bootlin.com (Postfix, from userid 110) id EAC86208A7; Mon, 30 Apr 2018 16:43:35 +0200 (CEST) Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id AC4EC207FF; Mon, 30 Apr 2018 16:43:25 +0200 (CEST) From: Boris Brezillon To: Thierry Reding , dri-devel@lists.freedesktop.org Subject: [RFC PATCH 1/3] drm/panel: Support panel detection Date: Mon, 30 Apr 2018 16:43:21 +0200 Message-Id: <20180430144323.9233-2-boris.brezillon@bootlin.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180430144323.9233-1-boris.brezillon@bootlin.com> References: <20180430144323.9233-1-boris.brezillon@bootlin.com> 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: David Airlie , Boris Brezillon MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Some panels might be connected through extension boards and might not be available when the system boots. Extend the panel interface to support panel detection. An optional ->detect() hook is added and, if implemented, will be called every time the panel user wants to know if the panel is connected or disconnected. We also add a ->polled field which should encode the type of polling the DRM core should do (DRM_CONNECTOR_POLL_HPD, DRM_CONNECTOR_POLL_CONNECT and DRM_CONNECTOR_POLL_DISCONNECT flags). Signed-off-by: Boris Brezillon --- include/drm/drm_panel.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 14ac240a1f64..718cc1f746ab 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -24,6 +24,7 @@ #ifndef __DRM_PANEL_H__ #define __DRM_PANEL_H__ +#include #include #include @@ -68,6 +69,7 @@ struct display_timing; * the panel. This is the job of the .unprepare() function. */ struct drm_panel_funcs { + int (*detect)(struct drm_panel *panel); int (*disable)(struct drm_panel *panel); int (*unprepare)(struct drm_panel *panel); int (*prepare)(struct drm_panel *panel); @@ -90,6 +92,7 @@ struct drm_panel { struct drm_connector *connector; struct device *dev; + u8 polled; const struct drm_panel_funcs *funcs; struct list_head list; @@ -186,6 +189,15 @@ static inline int drm_panel_get_modes(struct drm_panel *panel) return panel ? -ENOSYS : -EINVAL; } +static inline int drm_panel_detect(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->detect) + return panel->funcs->detect(panel); + + /* Consider the panel as connected by default. */ + return panel ? connector_status_connected : -EINVAL; +} + void drm_panel_init(struct drm_panel *panel); int drm_panel_add(struct drm_panel *panel);