Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1498787pxk; Mon, 31 Aug 2020 23:23:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZtjEy4L73v0E0UllX9TMa9aVvojCz5Y4cxlYcJHU9etF60UaZgwIAC0OJ1kmUbY0xVmcg X-Received: by 2002:a17:906:b156:: with SMTP id bt22mr126060ejb.481.1598941433471; Mon, 31 Aug 2020 23:23:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598941433; cv=none; d=google.com; s=arc-20160816; b=jset9DIGozvIuU20kOaFxNQ7Li9N/z7wzOzw/Au6aLAYTRZHcvw8l/IOwInBx1KIKi f3CDZ8NoHWQOewcE0/2N9DCD3HOhBkJ5jZpYmTh8CddL08dXLBVsV4p6THbEV6pyBsKY 7+7hu/2tafwQiFPNBaHu1RdTpOUgMx0tMbyRdUY8izHjbCLPWEW0zxFXoMNJkibfsrv6 11aAOi1LYFvkxsheOtesVuyheGSjwCZfsM8ERWX+V2oE2OaBYbqPwhtkJnI9Fl+eXTIN TeQ0HyB8nUHORHxIfRE1ZeLJE+jsgfxSAG4kYeKFLovbyvdsU5llEVYjw73kquuBBs7S NC8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lRIHcVNxVGPyHgfpqDwa33OIPQovgsuZYgCyV3RsN4U=; b=zlr2cNeNsm19MHSJTnHdUxVqmjCnqNTWTWszRhimL4eUaX6QJng0olh7MekUOG2zjy zOIi3tOuLgu0cadDxfjioV0BjnxSH5agiy8IwYvbfwr1R8ZRP3rMqUZxdnxG8EsftPUw E/Y/0KHHraBIdcvZYcOMxS6V2aB1X4GzoZAdoP9GqaozXQyjIi8bFfvrn6ONi78N5iSu C7ksHAib2FOsHBUruEQp8AjygUvJcoN3niOOYk+2Rt5XojstbuO5N7dP8SPjf/tg0iOh 6ZkV2478fztTnirH5i9OOFT/jWQUMtz4BU/z0txC+62i795WBhJldxctt7skHohibv3T iSyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bbjai8uA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i24si142237ejd.88.2020.08.31.23.23.30; Mon, 31 Aug 2020 23:23:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bbjai8uA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726144AbgIAGWl (ORCPT + 99 others); Tue, 1 Sep 2020 02:22:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726006AbgIAGWi (ORCPT ); Tue, 1 Sep 2020 02:22:38 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91786C0612AC for ; Mon, 31 Aug 2020 23:22:37 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id g6so116160pjl.0 for ; Mon, 31 Aug 2020 23:22:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lRIHcVNxVGPyHgfpqDwa33OIPQovgsuZYgCyV3RsN4U=; b=bbjai8uAfQTONaD7KIS+VvI0y9gAklINsoRx4g7eLrbLP5Af077ZQYThvPgH1KaxaN lSiUGHPyy1Ixzsi835Q19YIiFeVyTpA3jXFhHIKdctbYgjH8x7OLJGCTPjg7aYrhaRhu /yEHG7bSgsx5cpODbWFnyTcusm++jPyWGxmKY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lRIHcVNxVGPyHgfpqDwa33OIPQovgsuZYgCyV3RsN4U=; b=loQjCOGgeVRYYdRaF8uerTZQ7D5sXsGIbBMGbbH1WElcvqZbdLLK1SkPCoY9A33sKN /n8PFCeziAcvikYhP/vF0SAfhFii7PfIylAe3CGqSBti4Aj0RHFH9ztMkgLa8RN5UKTH TOWL++5NoYqQKT9N1s6UkzVhnW5mzUHyVIhlDO7+Z2U18dmZXJMJX3Pv5k+5XbBw4eb8 uR91Cx1z0fnI7VaDkgb+uT8pmr/HkFMjJMv4QuYbHM1UCaS//SBh3lCmPkuSUJ/Jykgr egjwr/AOwOzzqDsTX59fehjBuuqj2MUwdVll+BEklA6kj1/USrCyquvrJdzwXyJ61CO2 iGuQ== X-Gm-Message-State: AOAM530mh6CubBqVxYJOK0Hn4QQFixwAgxncsEXKYAxKe4UZU+DlL/4e YzmDFCG2KKOFtSWT8uNu+90j50dMliq0JA== X-Received: by 2002:a17:90b:282:: with SMTP id az2mr144138pjb.66.1598941356873; Mon, 31 Aug 2020 23:22:36 -0700 (PDT) Received: from localhost ([2401:fa00:9:15:7220:84ff:fe09:cabc]) by smtp.gmail.com with ESMTPSA id n1sm372069pfu.2.2020.08.31.23.22.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Aug 2020 23:22:36 -0700 (PDT) From: Sam McNally To: LKML Cc: Hans Verkuil , Sam McNally , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org Subject: [PATCH 2/5] drm_dp_mst_topology: use correct AUX channel Date: Tue, 1 Sep 2020 16:22:16 +1000 Message-Id: <20200901162133.2.Ided0ab0808c4908238bd2eb9ebb6ffb2c9312789@changeid> X-Mailer: git-send-email 2.28.0.402.g5ffc5be6b7-goog In-Reply-To: <20200901162133.1.I8693156f555875e5c8342e86ab37ce968dfdd277@changeid> References: <20200901162133.1.I8693156f555875e5c8342e86ab37ce968dfdd277@changeid> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans Verkuil For adapters behind an MST hub use the correct AUX channel. Signed-off-by: Hans Verkuil [sammc@chromium.org: rebased, removing redundant changes] Signed-off-by: Sam McNally --- drivers/gpu/drm/drm_dp_mst_topology.c | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 15b6cc39a754..0d753201adbd 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -2255,6 +2255,9 @@ drm_dp_mst_topology_unlink_port(struct drm_dp_mst_topology_mgr *mgr, drm_dp_mst_topology_put_port(port); } +static ssize_t +drm_dp_mst_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg); + static struct drm_dp_mst_port * drm_dp_mst_add_port(struct drm_device *dev, struct drm_dp_mst_topology_mgr *mgr, @@ -2271,9 +2274,13 @@ drm_dp_mst_add_port(struct drm_device *dev, port->port_num = port_number; port->mgr = mgr; port->aux.name = "DPMST"; + mutex_init(&port->aux.hw_mutex); + mutex_init(&port->aux.cec.lock); port->aux.dev = dev->dev; port->aux.is_remote = true; + port->aux.transfer = drm_dp_mst_aux_transfer; + /* initialize the MST downstream port's AUX crc work queue */ drm_dp_remote_aux_init(&port->aux); @@ -3503,6 +3510,35 @@ static int drm_dp_send_up_ack_reply(struct drm_dp_mst_topology_mgr *mgr, return 0; } +static ssize_t +drm_dp_mst_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) +{ + struct drm_dp_mst_port *port = + container_of(aux, struct drm_dp_mst_port, aux); + int ret; + + switch (msg->request & ~DP_AUX_I2C_MOT) { + case DP_AUX_NATIVE_WRITE: + case DP_AUX_I2C_WRITE: + case DP_AUX_I2C_WRITE_STATUS_UPDATE: + ret = drm_dp_send_dpcd_write(port->mgr, port, msg->address, + msg->size, msg->buffer); + break; + + case DP_AUX_NATIVE_READ: + case DP_AUX_I2C_READ: + ret = drm_dp_send_dpcd_read(port->mgr, port, msg->address, + msg->size, msg->buffer); + break; + + default: + ret = -EINVAL; + break; + } + + return ret; +} + static int drm_dp_get_vc_payload_bw(u8 dp_link_bw, u8 dp_link_count) { if (dp_link_bw == 0 || dp_link_count == 0) -- 2.28.0.402.g5ffc5be6b7-goog