From patchwork Mon Aug 27 08:07:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 10576601 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 3315C1390 for ; Mon, 27 Aug 2018 08:07:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F08A298C4 for ; Mon, 27 Aug 2018 08:07:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12D8A298D5; Mon, 27 Aug 2018 08:07:48 +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 CC969298C4 for ; Mon, 27 Aug 2018 08:07:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F5816E1ED; Mon, 27 Aug 2018 08:07:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb1-smtp-cloud8.xs4all.net (lb1-smtp-cloud8.xs4all.net [194.109.24.21]) by gabe.freedesktop.org (Postfix) with ESMTPS id 183606E077; Mon, 27 Aug 2018 08:07:44 +0000 (UTC) Received: from [IPv6:2001:983:e9a7:1:8960:b49d:3b62:6d25] ([IPv6:2001:983:e9a7:1:8960:b49d:3b62:6d25]) by smtp-cloud8.xs4all.net with ESMTPA id uCYofy11eoj71uCYpfrUUe; Mon, 27 Aug 2018 10:07:43 +0200 Subject: [PATCHv2 3/5] drm_dp_mst_topology: fix broken drm_dp_sideband_parse_remote_dpcd_read() From: Hans Verkuil To: linux-media@vger.kernel.org References: <20180827075820.41109-1-hverkuil@xs4all.nl> <20180827075820.41109-3-hverkuil@xs4all.nl> Message-ID: Date: Mon, 27 Aug 2018 10:07:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180827075820.41109-3-hverkuil@xs4all.nl> Content-Language: en-US X-CMAE-Envelope: MS4wfDGAVCl/LPUxVgU3OzgHSH6GmI+fR6I3WcaFLRtuhMkuPv5/+xZjwQuqahux4PwftUqLuEZ5ieSVImXqSk/aAo/hVl8jNIrdl3J4tFCGYEENdoHCH3lS mg8JBbVUe1Y/f55fuQSqNAf4RGCuvEYjwBjN9pz4oO6CztWfqTJOwKOYwKt5TDs+UVM/N3FpuJLzUcTBYZYYv5oKdiIUdtf7Xxe10UN1PcAZ7QBOEL8186lx ygVGZbKhrFjUhnN2Yobp6huf2laL8MN+LSiJ7WKI44fFdhmqXhPJGzpw/Cn+4TN/NeE1auGfkrIGONXunhvKrHMlM28PCYGKObpr/cObvBZXN76QEB0NSgt4 MlE5w+HaZo3Lisu0nE8RySdm46Zb3w2+DmNY+wz+lZUTpLtJJh+of8YZbRagGBhbfAjgaDCVvh7+XovgmUCaAX1zYrLEEg== 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: nouveau@lists.freedesktop.org, Hans Verkuil , Maling list - DRI developers , amd-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP When parsing the reply of a DP_REMOTE_DPCD_READ DPCD command the result is wrong due to a missing idx increment. This was never noticed since DP_REMOTE_DPCD_READ is currently not used, but if you enable it, then it is all wrong. Signed-off-by: Hans Verkuil Reviewed-by: Lyude Paul Acked-by: Alex Deucher --- drivers/gpu/drm/drm_dp_mst_topology.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 7780567aa669..5ff1d79b86c4 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -439,6 +439,7 @@ static bool drm_dp_sideband_parse_remote_dpcd_read(struct drm_dp_sideband_msg_rx if (idx > raw->curlen) goto fail_len; repmsg->u.remote_dpcd_read_ack.num_bytes = raw->msg[idx]; + idx++; if (idx > raw->curlen) goto fail_len; From patchwork Mon Aug 27 08:08:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 10576605 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 601621390 for ; Mon, 27 Aug 2018 08:08:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BC1B298AF for ; Mon, 27 Aug 2018 08:08:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E871298D5; Mon, 27 Aug 2018 08:08:25 +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,TVD_SPACE_RATIO 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 33751298AF for ; Mon, 27 Aug 2018 08:08:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 109C26E200; Mon, 27 Aug 2018 08:08:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb2-smtp-cloud8.xs4all.net (lb2-smtp-cloud8.xs4all.net [194.109.24.25]) by gabe.freedesktop.org (Postfix) with ESMTPS id 638AC6E1FC; Mon, 27 Aug 2018 08:08:21 +0000 (UTC) Received: from [IPv6:2001:983:e9a7:1:8960:b49d:3b62:6d25] ([IPv6:2001:983:e9a7:1:8960:b49d:3b62:6d25]) by smtp-cloud8.xs4all.net with ESMTPA id uCZOfy1Stoj71uCZPfrUma; Mon, 27 Aug 2018 10:08:19 +0200 Subject: [PATCHv2 5/5] drm/amdgpu: add DisplayPort CEC-Tunneling-over-AUX support From: Hans Verkuil To: linux-media@vger.kernel.org References: <20180827075820.41109-1-hverkuil@xs4all.nl> <20180827075820.41109-3-hverkuil@xs4all.nl> <5c0b907d-0bf2-7b80-b4b6-cbde78b03f0d@xs4all.nl> Message-ID: Date: Mon, 27 Aug 2018 10:08:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <5c0b907d-0bf2-7b80-b4b6-cbde78b03f0d@xs4all.nl> Content-Language: en-US X-CMAE-Envelope: MS4wfNnG3Myp8Zq99xva1zL/dnbqoZ3cYIMZXCwDmdD+wSjubVJht1cgfnpUDc0UdFkGbqt/Je/jckKiNBQwpU2nblGJCOGhnxnDBLRTNB+yVRGKS35aIgRx uzlwr0UMJSZXht2rmrmKvFN5dbufD7MhFExqTbCPuUi3UzvO7p20wC3kzzM9FSb+LMt6Yw0/C9cg4YR8Zhpr0EAhh6AysL2j95iVw0Ec5br/N8lP95H1wtLM +5wuENmTsugFJxDkNZqlCRIjXOhMlh2oQVarJCj+YNQYKxpaUTe8ckT1ZhD+Sxqe4vKaN8i3Gx0jtH7GqdbD7M7rHTtt8Roec0Rd43ny49O4kFgnOP9qedmW Kr2M6yjSlehGKMFmh4sjI703rardmkxrpmdrzXs6oEkQ4FqKNAecskfDKrSAfUfdtjhsgIczlnm/BWMcDpErwsnlQmJnIQ== 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: nouveau@lists.freedesktop.org, Hans Verkuil , Maling list - DRI developers , amd-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add DisplayPort CEC-Tunneling-over-AUX support to amdgpu. Signed-off-by: Hans Verkuil Acked-by: Alex Deucher Reviewed-by: Harry Wentland --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 ++++++++- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 800f481a6995..85f6c1546bff 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -896,6 +896,7 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector) aconnector->dc_sink = sink; if (sink->dc_edid.length == 0) { aconnector->edid = NULL; + drm_dp_cec_unset_edid(&aconnector->dm_dp_aux.aux); } else { aconnector->edid = (struct edid *) sink->dc_edid.raw_edid; @@ -903,10 +904,13 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector) drm_connector_update_edid_property(connector, aconnector->edid); + drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux, + aconnector->edid); } amdgpu_dm_add_sink_to_freesync_module(connector, aconnector->edid); } else { + drm_dp_cec_unset_edid(&aconnector->dm_dp_aux.aux); amdgpu_dm_remove_sink_from_freesync_module(connector); drm_connector_update_edid_property(connector, NULL); aconnector->num_modes = 0; @@ -1061,8 +1065,10 @@ static void handle_hpd_rx_irq(void *param) (dc_link->type == dc_connection_mst_branch)) dm_handle_hpd_rx_irq(aconnector); - if (dc_link->type != dc_connection_mst_branch) + if (dc_link->type != dc_connection_mst_branch) { + drm_dp_cec_irq(&aconnector->dm_dp_aux.aux); mutex_unlock(&aconnector->hpd_lock); + } } static void register_hpd_handlers(struct amdgpu_device *adev) @@ -2730,6 +2736,7 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector) dm->backlight_dev = NULL; } #endif + drm_dp_cec_unregister_connector(&aconnector->dm_dp_aux.aux); drm_connector_unregister(connector); drm_connector_cleanup(connector); kfree(connector); diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c index 9a300732ba37..18a3a6e5ffa0 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c @@ -496,6 +496,8 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, aconnector->dm_dp_aux.ddc_service = aconnector->dc_link->ddc; drm_dp_aux_register(&aconnector->dm_dp_aux.aux); + drm_dp_cec_register_connector(&aconnector->dm_dp_aux.aux, + aconnector->base.name, dm->adev->dev); aconnector->mst_mgr.cbs = &dm_mst_cbs; drm_dp_mst_topology_mgr_init( &aconnector->mst_mgr,