Skip to content

RFC Regmap over USB for Multifunction USB Device (gpio, display, ...)

Noralf Trønnes dri-devel linux-usb 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest9 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9regmap: Add USB supportdrivers/base/regmap/Kconfig drivers/base/regmap/Makefile drivers/base/regmap/regmap-usb.c +2 more+1154 -15 replies
2/9mfd: Add driver for Multifunction USB Devicedrivers/mfd/Kconfig drivers/mfd/Makefile drivers/mfd/mud.c +1 more+605 -03 replies
3/9usb: gadget: function: Add Multifunction USB Device supportdrivers/usb/gadget/Kconfig drivers/usb/gadget/function/Makefile drivers/usb/gadget/function/f_mud.c +2 more+2071 -00 replies
4/9pinctrl: Add Multifunction USB Device pinctrl driverdrivers/pinctrl/Kconfig drivers/pinctrl/Makefile drivers/pinctrl/pinctrl-mud.c +1 more+756 -00 replies
5/9usb: gadget: function: mud: Add gpio supportdrivers/usb/gadget/Kconfig drivers/usb/gadget/function/Makefile drivers/usb/gadget/function/f_mud_pins.c+978 -00 replies
6/9regmap: Speed up _regmap_raw_write_impl() for large buffersdrivers/base/regmap/regmap.c+6 -41 reply
7/9drm: Add Multifunction USB Device display driverdrivers/gpu/drm/Kconfig drivers/gpu/drm/Makefile drivers/gpu/drm/mud/Kconfig +3 more+1356 -00 replies
8/9drm/client: Add drm_client_init_from_id() and drm_client_modeset_set()drivers/gpu/drm/drm_client.c drivers/gpu/drm/drm_client_modeset.c include/drm/drm_client.h+93 -03 replies
9/9usb: gadget: function: mud: Add display supportdrivers/gpu/drm/mud/Kconfig drivers/gpu/drm/mud/Makefile drivers/gpu/drm/mud/mud_drm_gadget.c +3 more+1088 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/9] Regmap over USB for Multifunction USB Device (gpio, display, ...)

Hi,

A while back I had the idea to turn a Raspberry Pi Zero into a $5 USB to HDMI/SDTV/DSI/DPI display adapter.

Thinking about how to represent the display to the driver I realised that hardware use registers as API. And Linux does have a generic register abstraction: regmap. Furthermore this means that if I can do a regmap over USB implementation, it will be easy to do other functions like gpio, adc and others. After a few iterations trying to understand the USB subsystem and satisfying driver requirements, I now have something that looks promising.

I'm sending out an early version hoping to get feedback especially on the core parts that handles regmap and interrupts.

Overview:

          USB Host          :         USB Device
                            :
            --------------  :  ------------------
----------  | mfd: mud   |  :  | f_mud          |  ----------
| Driver |  --------------  :  |                |  | Driver |
----------  | regmap-usb |  :  | (mud_regmap)   |  ----------
            --------------  :  ------------------

I've attached 2 drivers:
- gpio/pinctrl: is more or less finished
- display: needs a lot more work

USB3 device
I've only tested this with usb2 devices (Pi, BBB) so I should get myself a usb3 gadget capable board. My searching didn't turn up much, so this seems to be quite rare. ROCK960 has USB 3.0 type C OTG but the price is $139 which is a bit expensive for this hobby project. Does anyone know of a cheap board?

Noralf.

Noralf Trønnes (9):
regmap: Add USB support
mfd: Add driver for Multifunction USB Device
usb: gadget: function: Add Multifunction USB Device support
pinctrl: Add Multifunction USB Device pinctrl driver
usb: gadget: function: mud: Add gpio support
regmap: Speed up _regmap_raw_write_impl() for large buffers
drm: Add Multifunction USB Device display driver drm/client: Add drm_client_init_from_id() and drm_client_modeset_set()
usb: gadget: function: mud: Add display support

 drivers/base/regmap/Kconfig              |    8 +-
 drivers/base/regmap/Makefile             |    1 +
 drivers/base/regmap/regmap-usb.c         | 1026 ++++++++++++++++++
 drivers/base/regmap/regmap.c             |   10 +-
 drivers/gpu/drm/Kconfig                  |    2 +
 drivers/gpu/drm/Makefile                 |    1 +
 drivers/gpu/drm/drm_client.c             |   37 +
 drivers/gpu/drm/drm_client_modeset.c     |   52 +
 drivers/gpu/drm/mud/Kconfig              |   18 +
 drivers/gpu/drm/mud/Makefile             |    4 +
 drivers/gpu/drm/mud/mud_drm.c            | 1198 ++++++++++++++++++++++
 drivers/gpu/drm/mud/mud_drm.h            |  137 +++
 drivers/gpu/drm/mud/mud_drm_gadget.c     |  889 ++++++++++++++++
 drivers/mfd/Kconfig                      |    8 +
 drivers/mfd/Makefile                     |    1 +
 drivers/mfd/mud.c                        |  580 +++++++++++
 drivers/pinctrl/Kconfig                  |    9 +
 drivers/pinctrl/Makefile                 |    1 +
 drivers/pinctrl/pinctrl-mud.c            |  657 ++++++++++++
 drivers/pinctrl/pinctrl-mud.h            |   89 ++
 drivers/usb/gadget/Kconfig               |   36 +
 drivers/usb/gadget/function/Makefile     |    6 +
 drivers/usb/gadget/function/f_mud.c      |  913 +++++++++++++++++
 drivers/usb/gadget/function/f_mud.h      |  210 ++++
 drivers/usb/gadget/function/f_mud_drm.c  |  181 ++++
 drivers/usb/gadget/function/f_mud_pins.c |  962 +++++++++++++++++
 drivers/usb/gadget/function/mud_regmap.c |  936 +++++++++++++++++
 include/drm/drm_client.h                 |    4 +
 include/linux/mfd/mud.h                  |   16 +
 include/linux/regmap.h                   |   23 +
 include/linux/regmap_usb.h               |   97 ++
 31 files changed, 8107 insertions(+), 5 deletions(-)
 create mode 100644 drivers/base/regmap/regmap-usb.c
 create mode 100644 drivers/gpu/drm/mud/Kconfig
 create mode 100644 drivers/gpu/drm/mud/Makefile
 create mode 100644 drivers/gpu/drm/mud/mud_drm.c
 create mode 100644 drivers/gpu/drm/mud/mud_drm.h
 create mode 100644 drivers/gpu/drm/mud/mud_drm_gadget.c
 create mode 100644 drivers/mfd/mud.c
 create mode 100644 drivers/pinctrl/pinctrl-mud.c
 create mode 100644 drivers/pinctrl/pinctrl-mud.h
 create mode 100644 drivers/usb/gadget/function/f_mud.c
 create mode 100644 drivers/usb/gadget/function/f_mud.h
 create mode 100644 drivers/usb/gadget/function/f_mud_drm.c
 create mode 100644 drivers/usb/gadget/function/f_mud_pins.c
 create mode 100644 drivers/usb/gadget/function/mud_regmap.c
 create mode 100644 include/linux/mfd/mud.h
 create mode 100644 include/linux/regmap_usb.h
Signature · 1 line
2.23.0