linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/19] Dynamically load/remove serdev devices via sysfs*
@ 2018-05-29 13:09 Ricardo Ribalda Delgado
  2018-05-29 13:09 ` [PATCH 01/19] serdev: Add id_table to serdev_device_driver Ricardo Ribalda Delgado
                   ` (18 more replies)
  0 siblings, 19 replies; 38+ messages in thread
From: Ricardo Ribalda Delgado @ 2018-05-29 13:09 UTC (permalink / raw)
  To: linux-kernel, linux-serial
  Cc: Ricardo Ribalda Delgado, Rob Herring, Johan Hovold

There are some situations where it is interesting to load/remove serdev
devices dynamically, like during board bring-up or when we are
developing a new driver or for devices that are neither described via
ACPI or device tree.

This implementation allows the creation of serdev devices via sysfs,
in a similar way as the i2c bus allows sysfs instantiation [1].

It also opens the door to create platform drivers for specific
platforms, such us notebooks or industrial computers, when their serial
devices are not described via DT or ACPI.

This patchset also supports automatic module load via udev/modprobe,
simplifying its use by the final user.

Currently, serdev does not manage ports that do not have a serdev device
defined at boot time. This implementation adds a new serdev module,
ttydev, that provides the same functionality of tty (it calls the
original one), but can be unloaded.

TL/DR:

When we want to create a new device, we just run:
root@qt5022:~# echo ttydev > /sys/bus/serial/devices/serial0/new_device

This will create a new device:
root@qt5022:~# ls /sys/bus/serial/devices/serial0-0/
driver	modalias  power  subsystem  tty  uevent

And load the required driver to use it:
root@qt5022:~# lsmod | grep serdev_ttydev
serdev_ttydev          16384  0

The device can be removed:
root@qt5022:~#
	echo serial0-0 > /sys/bus/serial/devices/serial0/delete_device

And now we can connect a new device:
root@qt5022:~# echo hci-ti > /sys/bus/serial/devices/serial0/new_device


[1] https://www.kernel.org/doc/Documentation/i2c/instantiating-devices

Ricardo Ribalda Delgado (19):
  serdev: Add id_table to serdev_device_driver
  Bluetooth: hci_bcm: Add serdev_id_table
  Bluetooth: hci_ll: Add serdev_id_table
  Bluetooth: hci_nokia: Add serdev_id_table
  serdev: Introduce modalias field
  serdev: Support bus matching with modalias field
  serdev: Allows dynamic creation of devices via sysfs
  serdev: Provide modalias attribute for modalias devices
  serdev: Provide modalias uevent for modalias devices
  file2alias: Support for serdev devices
  Bluetooth: hci_bcm: MODULE_DEVICE_TABLE(serdev)
  Bluetooth: hci_ll: MODULE_DEVICE_TABLE(serdev)
  Bluetooth: hci_nokia: MODULE_DEVICE_TABLE(serdev)
  mfd: rave-sp: MODULE_DEVICE_TABLE(serdev)
  net: qualcomm: MODULE_DEVICE_TABLE(serdev)
  serdev: ttyport: Move serport structure to its own header
  serdev: Mark controllers compatible with ttyport
  serdev: ttydev: Serdev driver that creates an standard TTY port
  serdev: Instantiate a ttydev serdev if acpi and of fails

 drivers/bluetooth/hci_bcm.c              |   8 ++
 drivers/bluetooth/hci_ll.c               |  19 ++++
 drivers/bluetooth/hci_nokia.c            |   8 ++
 drivers/mfd/rave-sp.c                    |   7 ++
 drivers/net/ethernet/qualcomm/qca_uart.c |   7 ++
 drivers/tty/serdev/Kconfig               |  11 ++
 drivers/tty/serdev/Makefile              |   2 +
 drivers/tty/serdev/core.c                | 133 +++++++++++++++++++++--
 drivers/tty/serdev/serdev-ttydev.c       |  70 ++++++++++++
 drivers/tty/serdev/serdev-ttyport.c      |  10 +-
 drivers/tty/serdev/serport.h             |  16 +++
 include/linux/mod_devicetable.h          |  10 ++
 include/linux/serdev.h                   |   4 +
 scripts/mod/devicetable-offsets.c        |   3 +
 scripts/mod/file2alias.c                 |  11 ++
 15 files changed, 304 insertions(+), 15 deletions(-)
 create mode 100644 drivers/tty/serdev/serdev-ttydev.c
 create mode 100644 drivers/tty/serdev/serport.h

-- 
2.17.0

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2018-06-07 12:51 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-29 13:09 [PATCH 00/19] Dynamically load/remove serdev devices via sysfs* Ricardo Ribalda Delgado
2018-05-29 13:09 ` [PATCH 01/19] serdev: Add id_table to serdev_device_driver Ricardo Ribalda Delgado
2018-05-29 13:09 ` [PATCH 02/19] Bluetooth: hci_bcm: Add serdev_id_table Ricardo Ribalda Delgado
2018-05-29 13:09 ` [PATCH 03/19] Bluetooth: hci_ll: " Ricardo Ribalda Delgado
2018-05-29 13:09 ` [PATCH 04/19] Bluetooth: hci_nokia: " Ricardo Ribalda Delgado
2018-06-05 13:36   ` Andy Shevchenko
2018-06-05 13:53   ` Marcel Holtmann
2018-06-07 10:27     ` Pavel Machek
2018-06-07 12:32       ` Marcel Holtmann
2018-06-07 12:51         ` Pavel Machek
2018-05-29 13:10 ` [PATCH 05/19] serdev: Introduce modalias field Ricardo Ribalda Delgado
2018-05-29 13:10 ` [PATCH 06/19] serdev: Support bus matching with " Ricardo Ribalda Delgado
2018-05-29 13:10 ` [PATCH 07/19] serdev: Allows dynamic creation of devices via sysfs Ricardo Ribalda Delgado
2018-05-29 15:38   ` Rob Herring
2018-05-29 16:30     ` Ricardo Ribalda Delgado
2018-05-29 16:32       ` Ricardo Ribalda Delgado
2018-05-29 20:35   ` Andy Shevchenko
2018-05-29 21:23     ` Ricardo Ribalda Delgado
2018-05-29 13:10 ` [PATCH 08/19] serdev: Provide modalias attribute for modalias devices Ricardo Ribalda Delgado
2018-05-29 13:10 ` [PATCH 09/19] serdev: Provide modalias uevent " Ricardo Ribalda Delgado
2018-05-29 13:10 ` [PATCH 10/19] file2alias: Support for serdev devices Ricardo Ribalda Delgado
2018-05-29 13:10 ` [PATCH 11/19] Bluetooth: hci_bcm: MODULE_DEVICE_TABLE(serdev) Ricardo Ribalda Delgado
2018-05-29 13:10 ` [PATCH 12/19] Bluetooth: hci_ll: MODULE_DEVICE_TABLE(serdev) Ricardo Ribalda Delgado
2018-05-29 13:10 ` [PATCH 13/19] Bluetooth: hci_nokia: MODULE_DEVICE_TABLE(serdev) Ricardo Ribalda Delgado
2018-05-29 13:10 ` [PATCH 14/19] mfd: rave-sp: MODULE_DEVICE_TABLE(serdev) Ricardo Ribalda Delgado
2018-05-29 13:10 ` [PATCH 15/19] net: qualcomm: MODULE_DEVICE_TABLE(serdev) Ricardo Ribalda Delgado
2018-06-01  8:59   ` Stefan Wahren
2018-05-29 13:10 ` [PATCH 16/19] serdev: ttyport: Move serport structure to its own header Ricardo Ribalda Delgado
2018-05-29 13:10 ` [PATCH 17/19] serdev: Mark controllers compatible with ttyport Ricardo Ribalda Delgado
2018-05-29 13:10 ` [PATCH 18/19] serdev: ttydev: Serdev driver that creates an standard TTY port Ricardo Ribalda Delgado
2018-06-05 13:42   ` Andy Shevchenko
2018-06-06  6:58     ` Ricardo Ribalda Delgado
2018-06-06  7:47       ` Ricardo Ribalda Delgado
2018-06-06  9:55         ` Andy Shevchenko
2018-06-06  9:58           ` Ricardo Ribalda Delgado
2018-05-29 13:10 ` [PATCH 19/19] serdev: Instantiate a ttydev serdev if acpi and of fails Ricardo Ribalda Delgado
2018-06-05 13:44   ` Andy Shevchenko
2018-06-06  7:28     ` Ricardo Ribalda Delgado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).