aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/serdev.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/serdev.h')
-rw-r--r--include/linux/serdev.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/linux/serdev.h b/include/linux/serdev.h
index d609e6dc5bad..f153b2c7f0cd 100644
--- a/include/linux/serdev.h
+++ b/include/linux/serdev.h
@@ -27,8 +27,10 @@ struct serdev_device;
27 27
28/** 28/**
29 * struct serdev_device_ops - Callback operations for a serdev device 29 * struct serdev_device_ops - Callback operations for a serdev device
30 * @receive_buf: Function called with data received from device. 30 * @receive_buf: Function called with data received from device;
31 * @write_wakeup: Function called when ready to transmit more data. 31 * returns number of bytes accepted; may sleep.
32 * @write_wakeup: Function called when ready to transmit more data; must
33 * not sleep.
32 */ 34 */
33struct serdev_device_ops { 35struct serdev_device_ops {
34 int (*receive_buf)(struct serdev_device *, const unsigned char *, size_t); 36 int (*receive_buf)(struct serdev_device *, const unsigned char *, size_t);
@@ -76,6 +78,12 @@ static inline struct serdev_device_driver *to_serdev_device_driver(struct device
76 return container_of(d, struct serdev_device_driver, driver); 78 return container_of(d, struct serdev_device_driver, driver);
77} 79}
78 80
81enum serdev_parity {
82 SERDEV_PARITY_NONE,
83 SERDEV_PARITY_EVEN,
84 SERDEV_PARITY_ODD,
85};
86
79/* 87/*
80 * serdev controller structures 88 * serdev controller structures
81 */ 89 */
@@ -86,6 +94,7 @@ struct serdev_controller_ops {
86 int (*open)(struct serdev_controller *); 94 int (*open)(struct serdev_controller *);
87 void (*close)(struct serdev_controller *); 95 void (*close)(struct serdev_controller *);
88 void (*set_flow_control)(struct serdev_controller *, bool); 96 void (*set_flow_control)(struct serdev_controller *, bool);
97 int (*set_parity)(struct serdev_controller *, enum serdev_parity);
89 unsigned int (*set_baudrate)(struct serdev_controller *, unsigned int); 98 unsigned int (*set_baudrate)(struct serdev_controller *, unsigned int);
90 void (*wait_until_sent)(struct serdev_controller *, long); 99 void (*wait_until_sent)(struct serdev_controller *, long);
91 int (*get_tiocm)(struct serdev_controller *); 100 int (*get_tiocm)(struct serdev_controller *);
@@ -193,6 +202,7 @@ static inline int serdev_controller_receive_buf(struct serdev_controller *ctrl,
193 202
194int serdev_device_open(struct serdev_device *); 203int serdev_device_open(struct serdev_device *);
195void serdev_device_close(struct serdev_device *); 204void serdev_device_close(struct serdev_device *);
205int devm_serdev_device_open(struct device *, struct serdev_device *);
196unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int); 206unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int);
197void serdev_device_set_flow_control(struct serdev_device *, bool); 207void serdev_device_set_flow_control(struct serdev_device *, bool);
198int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t); 208int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t);
@@ -298,6 +308,9 @@ static inline int serdev_device_set_rts(struct serdev_device *serdev, bool enabl
298 return serdev_device_set_tiocm(serdev, 0, TIOCM_RTS); 308 return serdev_device_set_tiocm(serdev, 0, TIOCM_RTS);
299} 309}
300 310
311int serdev_device_set_parity(struct serdev_device *serdev,
312 enum serdev_parity parity);
313
301/* 314/*
302 * serdev hooks into TTY core 315 * serdev hooks into TTY core
303 */ 316 */