From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
To: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>,
Rob Herring <robh@kernel.org>, Johan Hovold <johan@kernel.org>,
Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: [PATCH v2 00/19] Dynamically load/remove serdev devices via sysfs*
Date: Mon, 11 Jun 2018 13:52:16 +0200 [thread overview]
Message-ID: <20180611115240.32606-1-ricardo.ribalda@gmail.com> (raw)
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
Changelog v2:
New functionality:
- New functions: get/put controller add_probed_device
- Rave_sp: Match all the variants
Changes proposed by Andy Shevchenko <andy.shevchenko@gmail.com>
- Avoid strchr
- Terminators with no comma
[1] https://www.kernel.org/doc/Documentation/i2c/instantiating-devices
Ricardo Ribalda Delgado (24):
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
serdev: Make match_id accessible by drivers
rave-sp: Support for variants on modalias drivers
serdev: Replace IDA functions with IDR
serdev: get/put controller
serdev: serdev_controller_add_probed_device
drivers/bluetooth/hci_bcm.c | 8 +
drivers/bluetooth/hci_ll.c | 19 +++
drivers/bluetooth/hci_nokia.c | 8 +
drivers/mfd/rave-sp.c | 25 ++-
drivers/net/ethernet/qualcomm/qca_uart.c | 7 +
drivers/tty/serdev/Kconfig | 10 ++
drivers/tty/serdev/Makefile | 2 +
drivers/tty/serdev/core.c | 186 ++++++++++++++++++++---
drivers/tty/serdev/serdev-ttydev.c | 60 ++++++++
drivers/tty/serdev/serdev-ttyport.c | 10 +-
drivers/tty/serdev/serport.h | 16 ++
include/linux/mod_devicetable.h | 10 ++
include/linux/serdev.h | 11 ++
scripts/mod/devicetable-offsets.c | 3 +
scripts/mod/file2alias.c | 11 ++
15 files changed, 360 insertions(+), 26 deletions(-)
create mode 100644 drivers/tty/serdev/serdev-ttydev.c
create mode 100644 drivers/tty/serdev/serport.h
--
2.17.1
next reply other threads:[~2018-06-11 11:52 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-11 11:52 Ricardo Ribalda Delgado [this message]
2018-06-11 11:52 ` [PATCH v2 01/24] serdev: Add id_table to serdev_device_driver Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 02/24] Bluetooth: hci_bcm: Add serdev_id_table Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 03/24] Bluetooth: hci_ll: " Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 04/24] Bluetooth: hci_nokia: " Ricardo Ribalda Delgado
2018-06-11 12:56 ` Marcel Holtmann
2018-06-11 13:04 ` Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 05/24] serdev: Introduce modalias field Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 06/24] serdev: Support bus matching with " Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 07/24] serdev: Allows dynamic creation of devices via sysfs Ricardo Ribalda Delgado
2018-06-11 12:39 ` Andy Shevchenko
2018-06-11 13:03 ` Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 08/24] serdev: Provide modalias attribute for modalias devices Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 09/24] serdev: Provide modalias uevent " Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 10/24] file2alias: Support for serdev devices Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 11/24] Bluetooth: hci_bcm: MODULE_DEVICE_TABLE(serdev) Ricardo Ribalda Delgado
2018-06-11 12:59 ` Marcel Holtmann
2018-06-11 13:31 ` Andy Shevchenko
2018-06-11 11:52 ` [PATCH v2 12/24] Bluetooth: hci_ll: MODULE_DEVICE_TABLE(serdev) Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 13/24] Bluetooth: hci_nokia: MODULE_DEVICE_TABLE(serdev) Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 14/24] mfd: rave-sp: MODULE_DEVICE_TABLE(serdev) Ricardo Ribalda Delgado
2018-06-11 13:14 ` Marcel Holtmann
2018-06-11 15:18 ` Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 15/24] net: qualcomm: MODULE_DEVICE_TABLE(serdev) Ricardo Ribalda Delgado
2018-06-11 13:01 ` Marcel Holtmann
2018-06-11 15:09 ` Ricardo Ribalda Delgado
2018-06-11 15:28 ` Marcel Holtmann
2018-06-11 15:33 ` Ricardo Ribalda Delgado
2018-06-11 15:52 ` Marcel Holtmann
2018-06-11 16:21 ` Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 16/24] serdev: ttyport: Move serport structure to its own header Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 17/24] serdev: Mark controllers compatible with ttyport Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 18/24] serdev: ttydev: Serdev driver that creates an standard TTY port Ricardo Ribalda Delgado
2018-06-13 1:20 ` Rob Herring
2018-06-13 6:35 ` Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 19/24] serdev: Instantiate a ttydev serdev if acpi and of fails Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 20/24] serdev: Make match_id accessible by drivers Ricardo Ribalda Delgado
2018-06-11 12:47 ` Andy Shevchenko
2018-06-11 13:10 ` Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 21/24] rave-sp: Support for variants on modalias drivers Ricardo Ribalda Delgado
2018-06-11 12:54 ` Andy Shevchenko
2018-06-11 13:38 ` Marcel Holtmann
2018-06-11 15:21 ` Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 22/24] serdev: Replace IDA functions with IDR Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 23/24] serdev: get/put controller Ricardo Ribalda Delgado
2018-06-11 11:52 ` [PATCH v2 24/24] serdev: serdev_controller_add_probed_device Ricardo Ribalda Delgado
2018-06-14 10:48 ` [PATCH v2 00/19] Dynamically load/remove serdev devices via sysfs* Johan Hovold
2018-06-14 11:06 ` Ricardo Ribalda Delgado
2018-06-14 13:33 ` Johan Hovold
2018-06-14 14:06 ` Ricardo Ribalda Delgado
2018-06-14 14:55 ` Johan Hovold
2018-06-14 15:20 ` Ricardo Ribalda Delgado
2018-06-14 15:47 ` Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180611115240.32606-1-ricardo.ribalda@gmail.com \
--to=ricardo.ribalda@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).