Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

serdev: Add method to assert break signal over tty UART port

Adds serdev_device_break_ctl() and an implementation for ttyport.
This function simply calls the break_ctl in tty layer, which can
assert a break signal over UART-TX line, if the tty and the
underlying platform and UART peripheral supports this operation.

Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

authored by

Neeraj Sanjay Kale and committed by
Luiz Augusto von Dentz
8eaf839e 29f93a68

+29
+11
drivers/tty/serdev/core.c
··· 405 405 } 406 406 EXPORT_SYMBOL_GPL(serdev_device_set_tiocm); 407 407 408 + int serdev_device_break_ctl(struct serdev_device *serdev, int break_state) 409 + { 410 + struct serdev_controller *ctrl = serdev->ctrl; 411 + 412 + if (!ctrl || !ctrl->ops->break_ctl) 413 + return -EOPNOTSUPP; 414 + 415 + return ctrl->ops->break_ctl(ctrl, break_state); 416 + } 417 + EXPORT_SYMBOL_GPL(serdev_device_break_ctl); 418 + 408 419 static int serdev_drv_probe(struct device *dev) 409 420 { 410 421 const struct serdev_device_driver *sdrv = to_serdev_device_driver(dev->driver);
+12
drivers/tty/serdev/serdev-ttyport.c
··· 247 247 return tty->ops->tiocmset(tty, set, clear); 248 248 } 249 249 250 + static int ttyport_break_ctl(struct serdev_controller *ctrl, unsigned int break_state) 251 + { 252 + struct serport *serport = serdev_controller_get_drvdata(ctrl); 253 + struct tty_struct *tty = serport->tty; 254 + 255 + if (!tty->ops->break_ctl) 256 + return -EOPNOTSUPP; 257 + 258 + return tty->ops->break_ctl(tty, break_state); 259 + } 260 + 250 261 static const struct serdev_controller_ops ctrl_ops = { 251 262 .write_buf = ttyport_write_buf, 252 263 .write_flush = ttyport_write_flush, ··· 270 259 .wait_until_sent = ttyport_wait_until_sent, 271 260 .get_tiocm = ttyport_get_tiocm, 272 261 .set_tiocm = ttyport_set_tiocm, 262 + .break_ctl = ttyport_break_ctl, 273 263 }; 274 264 275 265 struct device *serdev_tty_port_register(struct tty_port *port,
+6
include/linux/serdev.h
··· 93 93 void (*wait_until_sent)(struct serdev_controller *, long); 94 94 int (*get_tiocm)(struct serdev_controller *); 95 95 int (*set_tiocm)(struct serdev_controller *, unsigned int, unsigned int); 96 + int (*break_ctl)(struct serdev_controller *ctrl, unsigned int break_state); 96 97 }; 97 98 98 99 /** ··· 204 203 void serdev_device_wait_until_sent(struct serdev_device *, long); 205 204 int serdev_device_get_tiocm(struct serdev_device *); 206 205 int serdev_device_set_tiocm(struct serdev_device *, int, int); 206 + int serdev_device_break_ctl(struct serdev_device *serdev, int break_state); 207 207 void serdev_device_write_wakeup(struct serdev_device *); 208 208 int serdev_device_write(struct serdev_device *, const unsigned char *, size_t, long); 209 209 void serdev_device_write_flush(struct serdev_device *); ··· 255 253 return -EOPNOTSUPP; 256 254 } 257 255 static inline int serdev_device_set_tiocm(struct serdev_device *serdev, int set, int clear) 256 + { 257 + return -EOPNOTSUPP; 258 + } 259 + static inline int serdev_device_break_ctl(struct serdev_device *serdev, int break_state) 258 260 { 259 261 return -EOPNOTSUPP; 260 262 }