From patchwork Fri Oct 31 22:54:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 5207881 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2DC709F387 for ; Fri, 31 Oct 2014 23:57:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6EC7020173 for ; Fri, 31 Oct 2014 23:57:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 78F8C201B9 for ; Fri, 31 Oct 2014 23:57:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E16E6E888; Fri, 31 Oct 2014 16:57:00 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com [209.85.192.171]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D46E6E852 for ; Fri, 31 Oct 2014 15:57:45 -0700 (PDT) Received: by mail-pd0-f171.google.com with SMTP id r10so8099110pdi.2 for ; Fri, 31 Oct 2014 15:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qGR1ey2/bRIuyhdHOA9Iy5kspXnVeFAm49sEKDt0qEQ=; b=Mnwo7AXVg5C8FUfkWrCk3MnvEwRmW4HTvwmo7T57feXfpMGumhBPhgFf2apHItd8/K 3AD7EiYmpJP2bg/7P2jjTB/iN69Yd6cesTOA5uwGvfYayYEt0WD8NERqr4VcRKEDdbkH pwk5+NhHaASRtmhy7a4uKQKFN1IBmrR9NytNh1QjTjZ4wuWA5koSVGWsztaWEXzTb7g7 Rcs9d52K4xfvKGmEPxQ/UHK7bNBKz0AvhJn/y6HdhsKLbNmZ3uqIAVzehv/1xhyz+Gti sBTgsuV8n87gF57cnVOnlKI2AqBDhXBOj5p//oYseqpNwIXYkAu2Ss6b0M2YHSs6ruBT 4m9Q== X-Received: by 10.68.200.100 with SMTP id jr4mr27844843pbc.69.1414796264937; Fri, 31 Oct 2014 15:57:44 -0700 (PDT) Received: from mothership.mgc.mentorg.com (c-50-152-159-227.hsd1.ca.comcast.net. [50.152.159.227]) by mx.google.com with ESMTPSA id ev8sm10870656pdb.28.2014.10.31.15.57.44 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 15:57:44 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: dri-devel@lists.freedesktop.org Subject: [PATCH 68/72] imx-drm: imx-ldb: Use DDC probe as connection detect Date: Fri, 31 Oct 2014 15:54:51 -0700 Message-Id: <1414796095-10107-69-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1414796095-10107-1-git-send-email-steve_longerbeam@mentor.com> References: <1414796095-10107-1-git-send-email-steve_longerbeam@mentor.com> X-Mailman-Approved-At: Fri, 31 Oct 2014 16:56:32 -0700 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If a ddc node was specified in the device tree, use it in imx_ldb_connector_detect() to probe the ddc with drm_probe_ddc(), if the result is success, we know there is a display connected so return connected status. Otherwise (no ddc specified in DT) we just have to assume connected status. Signed-off-by: Steve Longerbeam --- drivers/staging/imx-drm/imx-ldb.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c index 615e090..319eedb 100644 --- a/drivers/staging/imx-drm/imx-ldb.c +++ b/drivers/staging/imx-drm/imx-ldb.c @@ -92,10 +92,32 @@ struct imx_ldb { #define imx_ldb_entry_dbg(ch) \ imx_ldb_dbg((ch), "%s\n", __func__) +/* + * Use the result of ddc probe to detect LVDS display presence + * if a ddc DT node was specified. + */ static enum drm_connector_status imx_ldb_connector_detect( struct drm_connector *connector, bool force) { - return connector_status_connected; + struct imx_ldb_channel *imx_ldb_ch = con_to_imx_ldb_ch(connector); + enum drm_connector_status status; + + if (imx_ldb_ch->ddc) { + if (drm_probe_ddc(imx_ldb_ch->ddc)) { + status = connector_status_connected; + imx_ldb_dbg(imx_ldb_ch, + "ddc probe success, connected\n"); + } else { + status = connector_status_disconnected; + imx_ldb_dbg(imx_ldb_ch, + "ddc probe failed, disconnected\n"); + } + } else { + status = connector_status_connected; + imx_ldb_dbg(imx_ldb_ch, "no ddc, assuming connected\n"); + } + + return status; } static int imx_ldb_connector_get_modes(struct drm_connector *connector)