Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp91639pxk; Tue, 22 Sep 2020 19:59:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/1XfYXmUsvXgksJaXC6AQZ8ZJUb6WtblwgVm7IwuPL3g0A6LRM/GLovoErtCA0YNQTK7m X-Received: by 2002:a17:906:c8d2:: with SMTP id gc18mr8503296ejb.467.1600829973871; Tue, 22 Sep 2020 19:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600829973; cv=none; d=google.com; s=arc-20160816; b=nuGB67wQ6/ktauPsXkZWsmAf3g/wDSfADA9vQdCFYKKf0TfFjiuu/kbzrA3x+1+Nhk Jz0tGQERM45y+fHzwerCLEWBDILa1oTs7vnylVnZgVRDfTsLBCEgCQ/7GjopZR0lwPLy s7FrFv5iqfgnlESWZmrvbBnnjl/+Sw8CdGEnxaUPp0EU1hoREMdLJROxi1JLhb0Q14V4 FDhR0M7oipL5J6HDSoMdUnhxBhX4mi2GdlriCT/YeasUahkglphFkMqVbnOe3NY+O3KF r927TjrDlQI8e27evW7aEAGT9BEUmY3cGp56JvIr90DeJlWlYSRHNDATtCavmiTsGEQb wiKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ayUkH7l5CPlRC3YVFDHaRBHhROsz6N6CbKDEAWespPw=; b=LtUh2zyTRbtCXKPY9+DEpXW8Q6iahTXgCB6t72EHhs63Jd/iZnEVGzCCIBb3X4M47T FxsoQLKhjeA8xCMBGIwEmhumaPhPsmAuXnN77SdNx/hdoOzJEGqC17LC/E4c8Q8PELmM 7xzTAmHDrVxF02sLMOac5FdMpbc5LoTvRHUj4cWlYH6Fo7DNSS0TwLV2qfKGZmgATVDE RUfsXKTTs4Ivsif+Q3BgtZQIX1HjEBig6M0vSlG/k9r+xw4DZDRXK0G+7gp6GRDCMKcY udWsXDiccT9HQblPcejQzYyOf0p+oerhUBho97S/zgJ4qZ16acfNDK9A72pdpcc7E/9k w9pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="PwE/D0s0"; 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 n17si11705402edq.422.2020.09.22.19.59.11; Tue, 22 Sep 2020 19:59:33 -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="PwE/D0s0"; 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 S1727089AbgIWCOU (ORCPT + 99 others); Tue, 22 Sep 2020 22:14:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726548AbgIWCOT (ORCPT ); Tue, 22 Sep 2020 22:14:19 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C240C061755 for ; Tue, 22 Sep 2020 19:14:19 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id 34so13398082pgo.13 for ; Tue, 22 Sep 2020 19:14:19 -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=ayUkH7l5CPlRC3YVFDHaRBHhROsz6N6CbKDEAWespPw=; b=PwE/D0s06SrN9M9kYTLMAsu9vmMvgM8NCW2Fo/jiWi08DaG2LQMfT6dgJtx5z6t3rb OhUycuW/b/UwreEhWSP7AgO3aAfEUlqeyYgFYLcc922EPJcTNsgiNyO+90yiHTDT+lJz 2EU33h//Yer0GP1qSJ1O1SXp8Nfdiw3019Ba0= 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=ayUkH7l5CPlRC3YVFDHaRBHhROsz6N6CbKDEAWespPw=; b=b/p/RmjMiqERKRvtt+Ea5eyGahZ55DtLMNcfZ5OjLJ9uyD+UxwToFo8CChXXn1aQ6l GTO9A63xj5SJnD8ChP6U1M/6DINY5f9AibqhultWyY1mNH/63w0R2s0ozLEim3xuyf/j 7mT/5um2dN1UYLnqw2VuCusHEXw8dCys+Do9eawEnE3tvz5al2rMTjp7E+CokMvNEY8d QaO67uyq7BoeNsFwTu0CDMsV1J8PKu0JMHoVuvg5DgJtnFYiti9/YCy6t084zC7v02Ac ofA5UypeyF90yY8I7MVHTRnkvU88jclxxqgbE5vYl6Si3yZXRqsiV8edG+O3AXsoHFv7 8eKA== X-Gm-Message-State: AOAM530tpp/G40g6Nh9Y01BlO42Sa9nU+4kOKdLulKazHjW6SOYa0n1/ k0Df+ipoxXsxHNE3MMTch/WN7e5IQ5buCA== X-Received: by 2002:a62:dd01:0:b029:13c:f607:5fff with SMTP id w1-20020a62dd010000b029013cf6075fffmr6492251pff.3.1600827258660; Tue, 22 Sep 2020 19:14:18 -0700 (PDT) Received: from localhost ([2401:fa00:9:15:7220:84ff:fe09:cabc]) by smtp.gmail.com with ESMTPSA id x3sm15853111pgg.54.2020.09.22.19.14.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Sep 2020 19:14:18 -0700 (PDT) From: Sam McNally To: LKML Cc: Hans Verkuil , Hans Verkuil , Sam McNally , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org Subject: [PATCH v3 2/4] drm_dp_mst_topology: use correct AUX channel Date: Wed, 23 Sep 2020 12:13:53 +1000 Message-Id: <20200923121320.v3.2.Ided0ab0808c4908238bd2eb9ebb6ffb2c9312789@changeid> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog In-Reply-To: <20200923121320.v3.1.I8693156f555875e5c8342e86ab37ce968dfdd277@changeid> References: <20200923121320.v3.1.I8693156f555875e5c8342e86ab37ce968dfdd277@changeid> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- (no changes since v1) 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.681.g6f77f65b4e-goog