Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1091923rdb; Tue, 19 Sep 2023 22:03:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2C17sG6yNaQ8NJBY3iJAVj7ytFwdv4A4601AD26hucn0KXHII8SMuHUh1Sqb74HHjPnpq X-Received: by 2002:a05:6a20:144c:b0:15b:2125:890f with SMTP id a12-20020a056a20144c00b0015b2125890fmr1479072pzi.37.1695186186997; Tue, 19 Sep 2023 22:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695186186; cv=none; d=google.com; s=arc-20160816; b=K/7wtICc1e9YfYJg6CyxgFR1WgV/pR/acHd5ffGrX8jS+IvwmOjed6CaqlfeXpuHyI qo7Q0DIrQ1zaQ5qryDSGVjPmsRcugn+f/ZjMszF8/drt9dkK3/VJNxCTzpgO7AqsUXG4 wBjfFd7r5nxZvl9S1pM+Is9puuCB5TZMmLoAQgdL6zS/UiZ+SQuVyxm1Gr7qfiV8qVgX OPlIn1KTz070/Ulzh442vaZMG7BKb9pJoJH9KUFGbnEvhZW7rc6yJEXxWQmLeT3Gr2Vz NrFs/g7dOqJEwNqocTRdwhfDc6z+yxjjmFGedKhqKqBmp89gFWRL7MG9f2VbIYTO+Vh4 pQKw== 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=0VvvFCX7JLi6m4E9od5+Fel7ExyNJ+izUom/V70Os5o=; fh=ZLeuJsS1exUNW0TyRuzfeWJzIQEQbRWBArrxuN3AENA=; b=h9FUgiTqKAYNyzz+bPmxcvtYeEF4A3KJF89c/WSQCF6g//YOurIE2QlSmJHbaNb7vA al6at4NKVsvVIPLnthCnMvpQR6CdkZbEMucV9VmidMoV9Xa2enSr7JUMIcJvFEYq6gxl AK3jF/Fwxg+f2cni0HMcblsvcYLDFZER/JpyXip75B1/3wX5vfsL96yfhFI/DRsAmWIB AyekWCGtgNacSwyW8ICrB0ng30ID/ZDL9o57e7ZpmNHWiOsW61GTNOLfLnPCJm77HwaT i5qq/s9+gMYYp9JNKVUdhfsObt53FIGzbPLAEUmoGhhnR1grw5va5zyyLWTWxvNNa3rv xATw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EIolThKm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id r20-20020a6560d4000000b00578b6e32b5dsi2299162pgv.405.2023.09.19.22.03.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 22:03:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EIolThKm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 50533802390A; Tue, 19 Sep 2023 19:33:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232330AbjITCde (ORCPT + 99 others); Tue, 19 Sep 2023 22:33:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232200AbjITCdY (ORCPT ); Tue, 19 Sep 2023 22:33:24 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2BBBCE; Tue, 19 Sep 2023 19:33:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695177197; x=1726713197; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dFOE4HirFKRZgsK0uCPrJhP57Aa31MNoDRzWf7ltFDM=; b=EIolThKmoZVRYGF9PaaPtLdxcwA4A30XQyF3LFtv/Hn+gS48jaRb7r1x P54awHFfiA0y3wZKNgA1ltFxeJu0t7fbLpDg/usf/4Rb7DCFIB/6QqR0P gHKhsnMu2Jqj60FJDA5n7f4+n7v9UIg9xCU2bxLqHH8HdpYSqAi0XUI18 /CNFCB7FH+9E57kVvbLrv22iR9nlRZrHn5+VHRofltN8lgEysQP9cC0Bt lY6fRI7jgeKUB5Dk+GU0UAQoRRAh0UmzMGHT05sMlA153AzM5sSetpmfy MnCy6W8RW2jJ6N70Uouk8NBHX05v9gz1qBV1Wwp5lpONMruNXC++34VRk g==; X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="466422454" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="466422454" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 19:33:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="816690732" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="816690732" Received: from uhpatel-desk4.jf.intel.com ([10.23.15.215]) by fmsmga004.fm.intel.com with ESMTP; 19 Sep 2023 19:33:14 -0700 From: Utkarsh Patel To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: heikki.krogerus@linux.intel.com, pmalani@chromium.org, chrome-platform@lists.linux.dev, andriy.shevchenko@linux.intel.com, bleung@chromium.org, Utkarsh Patel Subject: [PATCH v4 5/5] usb: typec: intel_pmc_mux: Configure Displayport Alternate mode 2.1 Date: Tue, 19 Sep 2023 19:32:43 -0700 Message-Id: <20230920023243.2494410-6-utkarsh.h.patel@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230920023243.2494410-1-utkarsh.h.patel@intel.com> References: <20230920023243.2494410-1-utkarsh.h.patel@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 19 Sep 2023 19:33:45 -0700 (PDT) Mux agent driver can configure cable details such as cable type and cable speed received as a part of displayport configuration to support Displayport Alternate mode 2.1. Reviewed-by: Andy Shevchenko Reviewed-by: Heikki Krogerus Signed-off-by: Utkarsh Patel --- Changes in v4: - No change. Changes in v3: - No change. Changes in v2: - No change. drivers/usb/typec/mux/intel_pmc_mux.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c index 60ed1f809130..233958084b43 100644 --- a/drivers/usb/typec/mux/intel_pmc_mux.c +++ b/drivers/usb/typec/mux/intel_pmc_mux.c @@ -191,6 +191,12 @@ static int hsl_orientation(struct pmc_usb_port *port) return port->orientation - 1; } +static bool is_pmc_mux_tbt(struct acpi_device *adev) +{ + return acpi_dev_hid_uid_match(adev, "INTC1072", NULL) || + acpi_dev_hid_uid_match(adev, "INTC1079", NULL); +} + static int pmc_usb_send_command(struct intel_scu_ipc_dev *ipc, u8 *msg, u32 len) { u8 response[4]; @@ -293,6 +299,24 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) req.mode_data |= (state->mode - TYPEC_STATE_MODAL) << PMC_USB_ALTMODE_DP_MODE_SHIFT; + if (!is_pmc_mux_tbt(port->pmc->iom_adev)) { + u8 cable_speed = (data->conf & DP_CONF_SIGNALLING_MASK) >> + DP_CONF_SIGNALLING_SHIFT; + + u8 cable_type = (data->conf & DP_CONF_CABLE_TYPE_MASK) >> + DP_CONF_CABLE_TYPE_SHIFT; + + req.mode_data |= PMC_USB_ALTMODE_CABLE_SPD(cable_speed); + + if (cable_type == DP_CONF_CABLE_TYPE_OPTICAL) + req.mode_data |= PMC_USB_ALTMODE_CABLE_TYPE; + else if (cable_type == DP_CONF_CABLE_TYPE_RE_TIMER) + req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE | + PMC_USB_ALTMODE_RETIMER_CABLE; + else if (cable_type == DP_CONF_CABLE_TYPE_RE_DRIVER) + req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE; + } + ret = pmc_usb_command(port, (void *)&req, sizeof(req)); if (ret) return ret; -- 2.25.1