Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1228698rdg; Fri, 11 Aug 2023 14:17:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFurJVGIdcdkvhQ9QT7OBhL4bTJ/0YgXGv9fwmUMaGRW9mrnoy8U5T95CMHUPbAUfRMTeXx X-Received: by 2002:a05:6870:424c:b0:1be:c688:1cc with SMTP id v12-20020a056870424c00b001bec68801ccmr2902773oac.5.1691788679489; Fri, 11 Aug 2023 14:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691788679; cv=none; d=google.com; s=arc-20160816; b=bl90F/8eEBI2iDFydGEgDDiiQweuX4AcZCWzSWm9s6FZjZJK4I8CN5zzHLveWXoKUD Mk7d6FNrg2HFnle4uLukkxyQnSBU1VfM5KTQQfVr5d82ppYbVDkKHHrliXIb2apINZ/O emuWCUK5yJLe8Ar/COAEnxmKksx2eTX3xBh4xaOGrdizM4dILk4a7vJplZSxKfUkJyoR +kW9JaMP1F3SXppDI4K39LYAXVexmjTJ4yIQb/N5gxnM4bVQR8Btz76mlv4/UOqWVLZc S/ycjI8LSXfk0x6hOwlLH/w4olqWCyqSb6m2I9e4Koc2VDJRHwqHxY4qJ/ldFFmgv3pQ kIXA== 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=vl8mFnVKIvSLv0UVMH0kqc/cvYylzZ+WdklyuuXkGDc=; fh=4wm9g7W1jUHuvAopkJTeEcXcEUqkwSimCyoawvarBaI=; b=1AnA20TiJFE/n7oLvPdCcEP1WODoLckkOf6MXnR0y2uXuQQUrW80/mJ3DCEtgIgxNK TiDb6czkdzYly1gc6kS+P+G01UldhKMy+Sr6kUI35Alk1aMBGlBYHML1iALX5051fi2i FvfDadRud1HfWtZHqKDdjmKjjUVpwGSc13bovzKy37oliWUR7r6JfYFIjk59jSUsnh5J e5QsCCq28+UcNZ7lFuCZpqotMWyJh0A9PH3VLcpflLuNu6VjPltQUUMVlHQxt0VZKkUa aAr/6lsb+NqqEQ0PGVucWzHlRMcDEsDyTDmI8oP4xyCes8t7CoCOzVucQhsAVlBZwW21 hsNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=m6KQr1nH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm7-20020a17090b3ec700b00262e77d645asi6395560pjb.174.2023.08.11.14.17.39; Fri, 11 Aug 2023 14:17:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=m6KQr1nH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236945AbjHKUwp (ORCPT + 99 others); Fri, 11 Aug 2023 16:52:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236806AbjHKUwh (ORCPT ); Fri, 11 Aug 2023 16:52:37 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BA1A30F8; Fri, 11 Aug 2023 13:52:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691787151; x=1723323151; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9+EKRCDHeYAFpWJW50VR+0rBDbKfPEO7TcEgh/r17hc=; b=m6KQr1nHBrdHOLbQHkwzpfyRdr0EqNyIZzOelYfFLuH5PVB95CIH2pHM Kw4Sj7cpkCz8a7vL8d7oIZjzbWDBpu3+/fjSeSTTDL8jC7IiJ1Md8odV/ llpAp70gnxmTM3eceCZWxXqD7p0+ofROi87Py77eUHW370hV3UcTbELvO rvd60w/6dVeFTxlJ6SCpvo+YlNN/XyzswQjLb5m3pg9UoRjbQ7osJBTqd He2X2qrpnCyUynGRqcP0ebYR3Pxpu7CyoL39gxqmqHu11NZWDrvJG2kJA aTj0MERMwRUNllY9JLOZUIRkEaYRPaNGbOcV0KWFb8arArNjY38VzWNDp w==; X-IronPort-AV: E=McAfee;i="6600,9927,10799"; a="375473047" X-IronPort-AV: E=Sophos;i="6.01,166,1684825200"; d="scan'208";a="375473047" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2023 13:52:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10799"; a="762322064" X-IronPort-AV: E=Sophos;i="6.01,166,1684825200"; d="scan'208";a="762322064" Received: from uhpatel-desk4.jf.intel.com ([10.23.15.223]) by orsmga008.jf.intel.com with ESMTP; 11 Aug 2023 13:52:11 -0700 From: Utkarsh Patel To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: heikki.krogerus@linux.intel.com, andriy.shevchenko@linux.intel.com, pmalani@chromium.org, bleung@chromium.org, Utkarsh Patel Subject: [PATCH 4/4] usb: typec: intel_pmc_mux: Configure Displayport Alternate mode 2.1 Date: Fri, 11 Aug 2023 14:07:35 -0700 Message-Id: <20230811210735.159529-5-utkarsh.h.patel@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230811210735.159529-1-utkarsh.h.patel@intel.com> References: <20230811210735.159529-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,URIBL_BLOCKED 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 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 --- 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 888632847a74..218f6e25518d 100644 --- a/drivers/usb/typec/mux/intel_pmc_mux.c +++ b/drivers/usb/typec/mux/intel_pmc_mux.c @@ -180,6 +180,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]; @@ -282,6 +288,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