diff options
| author | Philip Cuadra <philipcuadra@google.com> | 2017-06-12 15:04:50 -0700 |
|---|---|---|
| committer | Michael Bestas <mkbestas@lineageos.org> | 2019-12-23 23:43:34 +0200 |
| commit | 8c5bbe67b5ebb84836cd198fb65fc52e825ea9d3 (patch) | |
| tree | 6d4017e8cab522186718d589f82991476cb70304 | |
| parent | 642b725c9cc052c2c1f2eaf44c34d7ffa8b4290f (diff) | |
tty: add tty_port_set_policy function
This function allows the port's scheduling policy to be changed. Some
tty ports (like Bluetooth ones), need a higher priority to reduce
jitter.
Bug: 36106419
Test: Bluetooth audio
Change-Id: If11e21c55924314910d602573c735c6afae09709
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/tty/tty_port.c | 10 | ||||
| -rw-r--r-- | include/linux/tty.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 482f33f20043..9f06fc11bc5f 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -16,6 +16,7 @@ #include <linux/bitops.h> #include <linux/delay.h> #include <linux/module.h> +#include <uapi/linux/sched.h> void tty_port_init(struct tty_port *port) { @@ -598,3 +599,12 @@ int tty_port_open(struct tty_port *port, struct tty_struct *tty, } EXPORT_SYMBOL(tty_port_open); + +int tty_port_set_policy(struct tty_port *port, int policy, int sched_priority) +{ + struct sched_param param = { .sched_priority = sched_priority }; + + return sched_setscheduler(port->worker_thread, policy, ¶m); +} +EXPORT_SYMBOL_GPL(tty_port_set_policy); + diff --git a/include/linux/tty.h b/include/linux/tty.h index 67e46308ca99..1c1bb90f6819 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -582,6 +582,8 @@ static inline int tty_port_users(struct tty_port *port) { return port->count + port->blocked_open; } +extern int tty_port_set_policy(struct tty_port *port, int policy, + int sched_priority); extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); extern int tty_unregister_ldisc(int disc); |
