Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3437254pxf; Mon, 29 Mar 2021 02:06:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxILpyb8BmW/VZB8pMisQ5+tdBXbVv1Nicxukv1s0F7vcWadZmLPIT80uZEuxkScjDxXh1q X-Received: by 2002:a17:907:d09:: with SMTP id gn9mr26631184ejc.538.1617008803087; Mon, 29 Mar 2021 02:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617008803; cv=none; d=google.com; s=arc-20160816; b=HCINZEB/onSXvwzryywFg1voxIWTXNZ/PmLtpMmw9mlfeGu963yzyOe8ZOkLn9pkSm yZttaK8qK3hans9zODmmAQuCs5NKyrC49oVgg2VyVoFB2Bn5QzFm2md57DZvFFFlgq/c GW3zhEuopgaziM96xJCMyvKJKT7hNQeLD9t4hyxBERGTVIETZC9pzlz80KTNpz1qSJSl 7H9VRuvn/ejeAfuKaOVXrlgjwjYLacuraFmjA0DLfgVtx0uJtQ3L+H7hifeNxB7sAlJ/ qgiXUgiD+orTTdO8cMnIEwaycKsNmM8YoE068v0/cMGMOPueERhHhbxo5WsR9NV0I/yz ubxA== 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 :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=1LV9n9Gn44usVSfb7PTVoYdX3Gjtc8VVE4cqNg+h6y4=; b=lrcWyJP5/Hn9iJJb6OlhR9eVhdTLKCkD3JtenpLMKOBIXSGEbhmE8nD9dTO1ihNpyX 3V6NLT4vPfFEUaVUiLAnOEH8gggymlzhZ+SNs0Lrt5ZPAAVY5PsiZK6Gk2NNv2jouMwq qSV5gjjA8+k/rEJ/nCHrXW0jgwZkKuEpOIhCmFFCeapQkglpYwGHwxqLYTrqrvNuC+6l l3ZWmV/3w75uSBcJtGDBFDa2cwbBHeQjtNNvZb0oph/M8fODjEAr2Y/Ozzm+D6qdOxCl y5sbi1L00GXEvk2z41alGJhV/MJeqT4HoV/NeMaBoceKQvUFt/1AAh28tW449rL4KrJG D0aA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v17si12128403eds.386.2021.03.29.02.06.20; Mon, 29 Mar 2021 02:06:43 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231689AbhC2JEp (ORCPT + 99 others); Mon, 29 Mar 2021 05:04:45 -0400 Received: from mga06.intel.com ([134.134.136.31]:14117 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235223AbhC2IoT (ORCPT ); Mon, 29 Mar 2021 04:44:19 -0400 IronPort-SDR: A01djvKZGoG5mTpB1rHUh3IQVFfSB1JZ4ciXBbacrcSDsAeAyjpwkObdbjGqM3bTF+4Z//VbFN JZSJcNOkqmPg== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="252854816" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="252854816" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 01:44:15 -0700 IronPort-SDR: 9EtB6AHAXNFroLhREiM3x+bOlL+UhscSTSUkSM6yvDAtVkKuwf//ytCKOEWdq2kYPHI/1tYgER +r0dMA99DcJA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="515918659" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2021 01:44:12 -0700 From: Heikki Krogerus To: Greg Kroah-Hartman Cc: Alan Stern , Benson Leung , Prashant Malani , Guenter Roeck , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/6] usb: Linking ports to their Type-C connectors Date: Mon, 29 Mar 2021 11:44:20 +0300 Message-Id: <20210329084426.78138-1-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, This is the second version of this series. The "Iterator for ports" patch is now moved to the end of the series (5/6). I'm now using usb_for_each_dev() in usb_for_each_port like Alan suggested, and I'm now using usb_port_peer_mutex to lock the ports while we're dealing with them in __each_hub(). The original cover letter: Adding a simple function typec_link_port() that can be used to create a symlink "connector" that points to the USB Type-C connector of a port. It is used with USB ports initially, but hopefully later also with other things like DisplayPorts. Being able to see which connector is connected to a port is important in general, but it is really important when for example the data or power role of a device needs to swapped. The user probable wants to know which USB device is disconnected if role swap on a USB Type-C connector is executed. Hope these are OK. thanks, Heikki Krogerus (6): usb: typec: Organize the private headers properly usb: typec: Declare the typec_class static usb: typec: Port mapping utility usb: Link the ports to the connectors they are attached to usb: Iterator for ports usb: typec: Link all ports during connector registration Documentation/ABI/testing/sysfs-bus-usb | 9 + drivers/usb/core/port.c | 3 + drivers/usb/core/usb.c | 46 ++++ drivers/usb/typec/Makefile | 2 +- drivers/usb/typec/bus.c | 2 + drivers/usb/typec/bus.h | 19 +- drivers/usb/typec/class.c | 101 +++------ drivers/usb/typec/class.h | 85 +++++++ drivers/usb/typec/mux.c | 4 +- drivers/usb/typec/mux.h | 21 ++ drivers/usb/typec/port-mapper.c | 280 ++++++++++++++++++++++++ include/linux/usb.h | 1 + include/linux/usb/typec.h | 13 ++ 13 files changed, 490 insertions(+), 96 deletions(-) create mode 100644 drivers/usb/typec/class.h create mode 100644 drivers/usb/typec/mux.h create mode 100644 drivers/usb/typec/port-mapper.c -- 2.30.2