Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5988991ybi; Wed, 29 May 2019 00:45:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqycNlS0mwIWNKvNY8MAvlWwjm0alC4wXn7S8YVnekPZz7YNS0cbRMUKlSnZ6VAtNnSB2ILt X-Received: by 2002:a65:6145:: with SMTP id o5mr36222855pgv.262.1559115935457; Wed, 29 May 2019 00:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559115935; cv=none; d=google.com; s=arc-20160816; b=smjmbZFtv8IdtT/GrvYuAFBamndp7335KUzLCiEBWmTuLU2pa9izj889P20kuqqA0F b+pxNWm4blqA9PQDjkINtvg5p3eKRjrvGEHG8q36IhaXjRi1qGZ00uB59SXFrmIfFshj 46mVUUhaRSzoZg4tjO1HklVfQAffvw6NQXGlccOXc9o6s5c88b3mXJS3yvyLCfvc737V MFkDVcSO59sYB29eMxStHFvCX2bIPSLZDD/xluKnbQfDgYkYGW3LiFpG56gOEN9gED5H VAqsBYIhIA0B9XeuRqhZ1FEBbPFYY2Xe0B9IG6D0OAo1eZorsaLwrLj1IvAkMhpfYtn9 s/5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=u5P/2ahjcB87H1F0Vf5dHQevldDQ1VpIaOY0cvL1Q9Q=; b=DCdATEpreKvIt7NK8mSibiqGTKx+x/jZ8Yt7xS0plaCGumZMhsoo/EuHnyqLgGzo7v Z0dD+NMMi/Mv0+mp12o7+IC81AETIe/5ISNb67WFoyvRJ1GdisQkcwNvbxjMl7h0aUsa iiqIp4xkHvMPPMrOTn8D9poFTQK7QRGXvYLObABx+1VwXT0pk8Xt5dmY/JgSR3ArEq76 AijcR0dBmkoK3Znl9/1fMvztO9f4RAmg2YrpS6TNaK/fLVQZy8LQK2m6/JlAKAQQ4U11 PiXM9tgg+4UIq5MPoLA/Mmx0nrN9eYOw/5IY8XwWdo+8FaVZyGboxbSAngcTjig7sEgP nOKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si23274344pgv.482.2019.05.29.00.45.20; Wed, 29 May 2019 00:45:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726879AbfE2HoN (ORCPT + 99 others); Wed, 29 May 2019 03:44:13 -0400 Received: from mailgw02.mediatek.com ([1.203.163.81]:60325 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726102AbfE2HoM (ORCPT ); Wed, 29 May 2019 03:44:12 -0400 X-UUID: 9e5f20fd8ee94acbb196ac8a75c68ee1-20190529 X-UUID: 9e5f20fd8ee94acbb196ac8a75c68ee1-20190529 Received: from mtkcas35.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 606122557; Wed, 29 May 2019 15:44:05 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 29 May 2019 15:44:03 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 29 May 2019 15:44:02 +0800 From: Chunfeng Yun To: Rob Herring , Greg Kroah-Hartman , Heikki Krogerus CC: Mark Rutland , Chunfeng Yun , Matthias Brugger , Adam Thomson , Li Jun , Badhri Jagan Sridharan , Hans de Goede , Andy Shevchenko , Min Guo , , , , , , Biju Das , Linus Walleij , Yu Chen Subject: [PATCH v6 00/10] add USB Type-B GPIO connector driver Date: Wed, 29 May 2019 15:43:38 +0800 Message-ID: <1559115828-19146-1-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Because the USB Connector is introduced and the requirement of usb-connector.txt binding, the old way using extcon to support USB Dual-Role switch is now deprecated, meanwhile there is no available common driver when use Type-B connector, typically using an input GPIO to detect USB ID pin. This patch series introduce a Type-B GPIO connector driver and try to replace the function provided by extcon-usb-gpio driver. v6 changes: 1. merge [1] and [2] into this series 2. don't use graph anymore to find usb-role-switch 3. abandon [3] and introduce three patches (6, 7, 8 in this series) to rebuild APIs getting usb-role-switch [1]: [v3] dt-binding: usb: add usb-role-switch property https://patchwork.kernel.org/patch/10934835/ [2]: [v6,08/13] usb: roles: Introduce stubs for the exiting functions in role.h https://patchwork.kernel.org/patch/10909971/ [3]: [PATCH v5 4/6] usb: roles: add API to get usb_role_switch by node v5 changes: 1. remove linux/of.h and put usb_role_switch when error happens, suggested by Biju 2. treat Type-B connector as USB controller's child, but not as a virtual device, suggested by Rob 3. provide and use generic property "usb-role-switch", see [1], suggested by Rob Note: this series still depends on [2] [1]: [v3] dt-binding: usb: add usb-role-switch property https://patchwork.kernel.org/patch/10934835/ [2]: [v6,08/13] usb: roles: Introduce stubs for the exiting functions in role.h https://patchwork.kernel.org/patch/10909971/ v4 changes: 1. use switch_fwnode_match() to find fwnode suggested by Heikki 2. assign fwnode member of usb_role_switch struct suggested by Heikki 3. make [4/6] depend on [2] 3. remove linux/gpio.h suggested by Linus 4. put node when error happens [4/6] usb: roles: add API to get usb_role_switch by node [2] [v6,08/13] usb: roles: Introduce stubs for the exiting functions in role.h https://patchwork.kernel.org/patch/10909971/ v3 changes: 1. add GPIO direction, and use fixed-regulator for GPIO controlled VBUS regulator suggested by Rob; 2. rebuild fwnode_usb_role_switch_get() suggested by Andy and Heikki 3. treat the type-B connector as a virtual device; 4. change file name of driver again 5. select USB_ROLE_SWITCH in mtu3/Kconfig suggested by Heikki 6. rename ssusb_mode_manual_switch() to ssusb_mode_switch() v2 changes: 1. make binding clear, and add a extra compatible suggested by Hans Chunfeng Yun (7): dt-binding: usb: add usb-role-switch property dt-bindings: connector: add optional properties for Type-B dt-bindings: usb: add binding for Type-B GPIO connector driver dt-bindings: usb: mtu3: add properties about USB Role Switch usb: roles: get usb-role-switch from parent usb: roles: add USB Type-B GPIO connector driver usb: mtu3: register a USB Role Switch for dual role mode Heikki Krogerus (2): device connection: Add fwnode_connection_find_match() usb: roles: Add fwnode_usb_role_switch_get() function Yu Chen (1): usb: roles: Introduce stubs for the exiting functions in role.h. .../bindings/connector/usb-connector.txt | 14 + .../devicetree/bindings/usb/generic.txt | 4 + .../devicetree/bindings/usb/mediatek,mtu3.txt | 10 + .../bindings/usb/typeb-conn-gpio.txt | 30 ++ drivers/base/devcon.c | 33 +- drivers/usb/mtu3/Kconfig | 1 + drivers/usb/mtu3/mtu3.h | 5 + drivers/usb/mtu3/mtu3_debugfs.c | 4 +- drivers/usb/mtu3/mtu3_dr.c | 48 ++- drivers/usb/mtu3/mtu3_dr.h | 6 +- drivers/usb/mtu3/mtu3_plat.c | 3 +- drivers/usb/roles/Kconfig | 11 + drivers/usb/roles/Makefile | 1 + drivers/usb/roles/class.c | 41 ++- drivers/usb/roles/typeb-conn-gpio.c | 286 ++++++++++++++++++ include/linux/device.h | 10 +- include/linux/usb/role.h | 37 +++ 17 files changed, 524 insertions(+), 20 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/typeb-conn-gpio.txt create mode 100644 drivers/usb/roles/typeb-conn-gpio.c -- 2.21.0