Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp123990pxk; Wed, 9 Sep 2020 00:22:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz135guJXRFp9pKSZGo24X3eiVFy+vx9jzEllZanAFWlfM8IpffyaRUDmY5hjF4NbMfTUc/ X-Received: by 2002:a17:907:374:: with SMTP id rs20mr2423080ejb.135.1599636170161; Wed, 09 Sep 2020 00:22:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599636170; cv=none; d=google.com; s=arc-20160816; b=idhMBrC784Mb3kXDzatox0Oza9iQayJrhMjEGlZmb96onM6PNbWyALsE+ewNkOEdEu uLhFRY34sEaeg1hZgOelIIfbqxCy6WjGFZciRK4FIMqgnGrxgke+l3B8pIW6tqrFVhU7 2r4dnrycwIiuTo7aDDBsajD2aEmqqzoJFxQQOkvFJ5KtQd2LrEoPRGlgR8Itoh5+l2lK NAxVtxC304kTe6SOM+p3QO9Yh4OapC8MlJFjX+SFZHXiwlNH2zZL+cQ+mOgzFyQ1T+5/ AoN1/irQ6DWBqYF2dnx9iAF5+VLBZhuBPpZUtxmfdOS9XafZOXGobqeeC8COwYqXd32O JbVQ== 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=bLPtTuLpMmqGcI18AHosC8t8jX+F5LJliVXfFXGdRzo=; b=ZEOuWbnODWE+2y8E+bJwfbe9Pv1JcOzRG5jpm7yt8kCL93drGQAPfjCq9WKh2O0BAt sDyPPCkIGlbQ7/9z+uH8vP65lHgDIHsgyldatj0pImN9TmicCIv8Ah7U0d/LyagZUgl/ 1v02uedxa6Pm6zaBrAL9O8dMRlqpEyNIMdCQIKS1JMSyx9nwlhZbtxDFNLsCrmlLyM30 DWLJO4M75xGlXoLF3CcQp+xZOvMQvZ69Q+Bq4oelZ56Atti3Y/a/W4zcjVaYs+SOW9BG WxlcZg2azIhRB5ZO7ECSWG5SyP6KB7pMspHgn1JCKsK3cDfY600d7B0lEkvR1fU+BhNQ 0Xvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dHllD90s; 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 gq14si955771ejb.354.2020.09.09.00.22.27; Wed, 09 Sep 2020 00:22:50 -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=dHllD90s; 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 S1728363AbgIIHVc (ORCPT + 99 others); Wed, 9 Sep 2020 03:21:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728207AbgIIHVX (ORCPT ); Wed, 9 Sep 2020 03:21:23 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0D9BC061573 for ; Wed, 9 Sep 2020 00:21:22 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id b16so900341pjp.0 for ; Wed, 09 Sep 2020 00:21:22 -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=bLPtTuLpMmqGcI18AHosC8t8jX+F5LJliVXfFXGdRzo=; b=dHllD90sWsIvfpw8cEKg4udYXNwUKGh2aJJesDyELYXYfTm6NHaITmgFkGFmy0HCjF 1IhK/ljvkIzPQ0KnPfH4w/kpgG4MprLjzPzItFCHI9CiTLhFsvTLo8FJn3MNYeRaUhN/ 7tVvgDzaoWCkVlYgeasCYE6KCO3NFOsmShzEg= 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=bLPtTuLpMmqGcI18AHosC8t8jX+F5LJliVXfFXGdRzo=; b=uSnoaDUKOY9bwWE/f+3YW19EJbj+w8bp5E84998k2xOZyb1NQw1KAHvm2X51wI1hMj jWkxgWLXw5NPZFSV72IUGaujVQcb5CJirHFESUXkrLkVaEJGe9sKqB0y+PhjCS6fcHO6 a/GxQv2mAms2pOiJx3eT1JR13PTxEId7/PjoIAf74WG7g4c14aX5wDHpDmGB3P5+VB9d nzIBCXoNigyiIE9cLIRZIM1biOTjrf15SfND9QsrnXaSqMpWLs5ikxP6hT2F8aaElpeI HsXa9POC5PUroSe/A0tZe1MzC7NDs1vfFDxwsNMeuy554t39uZNShQzrJh+s9e7JD+Kt 716w== X-Gm-Message-State: AOAM532WYxjDtXmmtPKfvi1uKH0A2QUsmFvVapfmzXoGymIc62H5DISU V6/0neICefpUEp8tq22ovsfWWEqQ6vUxuA== X-Received: by 2002:a17:90a:104f:: with SMTP id y15mr212144pjd.45.1599636082099; Wed, 09 Sep 2020 00:21:22 -0700 (PDT) Received: from localhost ([2401:fa00:9:15:7220:84ff:fe09:cabc]) by smtp.gmail.com with ESMTPSA id q34sm1304145pgl.28.2020.09.09.00.21.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Sep 2020 00:21:21 -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 v2 2/4] drm_dp_mst_topology: use correct AUX channel Date: Wed, 9 Sep 2020 17:20:50 +1000 Message-Id: <20200909172023.v2.2.Ided0ab0808c4908238bd2eb9ebb6ffb2c9312789@changeid> X-Mailer: git-send-email 2.28.0.526.ge36021eeef-goog In-Reply-To: <20200909172023.v2.1.I8693156f555875e5c8342e86ab37ce968dfdd277@changeid> References: <20200909172023.v2.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 --- (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.526.ge36021eeef-goog