|
|
Log in / Subscribe / Register

add USB Type-B GPIO connector driver

From:  Chunfeng Yun <chunfeng.yun-AT-mediatek.com>
To:  Rob Herring <robh+dt-AT-kernel.org>, Greg Kroah-Hartman <gregkh-AT-linuxfoundation.org>, Heikki Krogerus <heikki.krogerus-AT-linux.intel.com>
Subject:  [v5 PATCH 0/6] add USB Type-B GPIO connector driver
Date:  Tue, 14 May 2019 16:47:17 +0800
Message-ID:  <1557823643-8616-1-git-send-email-chunfeng.yun@mediatek.com>
Cc:  Mark Rutland <mark.rutland-AT-arm.com>, Chunfeng Yun <chunfeng.yun-AT-mediatek.com>, Matthias Brugger <matthias.bgg-AT-gmail.com>, Adam Thomson <Adam.Thomson.Opensource-AT-diasemi.com>, Li Jun <jun.li-AT-nxp.com>, Badhri Jagan Sridharan <badhri-AT-google.com>, Hans de Goede <hdegoede-AT-redhat.com>, Andy Shevchenko <andy.shevchenko-AT-gmail.com>, Min Guo <min.guo-AT-mediatek.com>, <devicetree-AT-vger.kernel.org>, <linux-kernel-AT-vger.kernel.org>, <linux-usb-AT-vger.kernel.org>, <linux-arm-kernel-AT-lists.infradead.org>, <linux-mediatek-AT-lists.infradead.org>, Biju Das <biju.das-AT-bp.renesas.com>, Linus Walleij <linus.walleij-AT-linaro.org>
Archive-link:  Article

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.

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 (6):
  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: add API to get usb_role_switch by node
  usb: roles: add USB Type-B GPIO connector driver
  usb: mtu3: register a USB Role Switch for dual role mode

 .../bindings/connector/usb-connector.txt      |  14 +
 .../devicetree/bindings/usb/mediatek,mtu3.txt |  10 +
 .../bindings/usb/typeb-conn-gpio.txt          |  42 +++
 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                     |  24 ++
 drivers/usb/roles/typeb-conn-gpio.c           | 295 ++++++++++++++++++
 include/linux/usb/role.h                      |   8 +
 14 files changed, 465 insertions(+), 7 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



Copyright © 2019, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds