From patchwork Sat Sep 16 14:17:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 9954339 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 6149B603B4 for ; Sat, 16 Sep 2017 14:17:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57FFF28A38 for ; Sat, 16 Sep 2017 14:17:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CEBB28B1F; Sat, 16 Sep 2017 14:17:47 +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=-4.2 required=2.0 tests=BAYES_00, 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 6CE64291EC for ; Sat, 16 Sep 2017 14:17:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4631A6E1F3; Sat, 16 Sep 2017 14:17:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb3-smtp-cloud9.xs4all.net (lb3-smtp-cloud9.xs4all.net [194.109.24.30]) by gabe.freedesktop.org (Postfix) with ESMTPS id C6DDC6E0DE for ; Sat, 16 Sep 2017 14:17:38 +0000 (UTC) Received: from tschai.fritz.box ([212.251.195.8]) by smtp-cloud9.xs4all.net with ESMTPA id tDuQdMMIHmRxPtDubdiJUv; Sat, 16 Sep 2017 16:17:37 +0200 From: Hans Verkuil To: linux-media@vger.kernel.org Subject: [PATCHv4 3/3] drm/i915: add DisplayPort CEC-Tunneling-over-AUX support Date: Sat, 16 Sep 2017 16:17:26 +0200 Message-Id: <20170916141726.4921-4-hverkuil@xs4all.nl> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170916141726.4921-1-hverkuil@xs4all.nl> References: <20170916141726.4921-1-hverkuil@xs4all.nl> X-CMAE-Envelope: MS4wfKwui+SGemrlqbX2sRXd80DW+Td4MYQPkVzRKfyvdbyCVBSKtZEP3HK76fmu+d/xlVoieQWv4lDtuuri+GLvEl+UkQhnnGRwLpQqnHx4gKijYeLvJUjv G5GPlyDciOJXnBK///0Yxss+pcQABcAcJHxhTb9zKvU/p+9ZhkGkHH9N5xWppg54yMyjybB1PAa2kxXV1fD0K02r1MHQTm08SMLTB2nHemFsLqmBL+gsWBAK eR3fcQRynYnLI44DYiCSpw5Fq4me2hnTHAaEprLcEMj2hJDoenRgahhitHB8P4ERu0T43dwN2X8mhQDkZDa4Vi8+mW58R1Ll2d0dnOqhuAI14rN2tL0lnrEA h6RKN8ly Cc: Daniel Vetter , Hans Verkuil , dri-devel@lists.freedesktop.org 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-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil Implement support for this DisplayPort feature. The cec device is created whenever it detects an adapter that has this feature. It is only removed when a new adapter is connected that does not support this. If a new adapter is connected that has different properties than the previous one, then the old cec device is unregistered and a new one is registered to replace the old one. Signed-off-by: Hans Verkuil Tested-by: Carlos Santa --- drivers/gpu/drm/i915/intel_dp.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 64fa774c855b..fdb853d2c458 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -1449,6 +1450,7 @@ static void intel_aux_reg_init(struct intel_dp *intel_dp) static void intel_dp_aux_fini(struct intel_dp *intel_dp) { + cec_unregister_adapter(intel_dp->aux.cec_adap); kfree(intel_dp->aux.name); } @@ -4587,6 +4589,7 @@ intel_dp_set_edid(struct intel_dp *intel_dp) intel_connector->detect_edid = edid; intel_dp->has_audio = drm_detect_monitor_audio(edid); + cec_s_phys_addr_from_edid(intel_dp->aux.cec_adap, edid); } static void @@ -4596,6 +4599,7 @@ intel_dp_unset_edid(struct intel_dp *intel_dp) kfree(intel_connector->detect_edid); intel_connector->detect_edid = NULL; + cec_phys_addr_invalidate(intel_dp->aux.cec_adap); intel_dp->has_audio = false; } @@ -4616,13 +4620,17 @@ intel_dp_long_pulse(struct intel_connector *intel_connector) intel_display_power_get(to_i915(dev), intel_dp->aux_power_domain); /* Can't disconnect eDP, but you can close the lid... */ - if (is_edp(intel_dp)) + if (is_edp(intel_dp)) { status = edp_detect(intel_dp); - else if (intel_digital_port_connected(to_i915(dev), - dp_to_dig_port(intel_dp))) + } else if (intel_digital_port_connected(to_i915(dev), + dp_to_dig_port(intel_dp))) { status = intel_dp_detect_dpcd(intel_dp); - else + if (status == connector_status_connected) + drm_dp_cec_configure_adapter(&intel_dp->aux, + intel_dp->aux.name, dev->dev); + } else { status = connector_status_disconnected; + } if (status == connector_status_disconnected) { memset(&intel_dp->compliance, 0, sizeof(intel_dp->compliance)); @@ -5011,6 +5019,8 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) intel_display_power_get(dev_priv, intel_dp->aux_power_domain); + drm_dp_cec_irq(&intel_dp->aux); + if (intel_dp->is_mst) { if (intel_dp_check_mst_status(intel_dp) == -EINVAL) { /*