}
 EXPORT_SYMBOL_GPL(serdev_device_close);
 
-int serdev_device_write_buf(struct serdev_device *serdev,
-                           const unsigned char *buf, size_t count)
+void serdev_device_write_wakeup(struct serdev_device *serdev)
+{
+       complete(&serdev->write_comp);
+}
+EXPORT_SYMBOL_GPL(serdev_device_write_wakeup);
+
+int serdev_device_write(struct serdev_device *serdev,
+                       const unsigned char *buf, size_t count,
+                       unsigned long timeout)
 {
        struct serdev_controller *ctrl = serdev->ctrl;
+       int ret;
 
-       if (!ctrl || !ctrl->ops->write_buf)
+       if (!ctrl || !ctrl->ops->write_buf ||
+           (timeout && !serdev->ops->write_wakeup))
                return -EINVAL;
 
-       return ctrl->ops->write_buf(ctrl, buf, count);
+       mutex_lock(&serdev->write_lock);
+       do {
+               reinit_completion(&serdev->write_comp);
+
+               ret = ctrl->ops->write_buf(ctrl, buf, count);
+               if (ret < 0)
+                       break;
+
+               buf += ret;
+               count -= ret;
+
+       } while (count &&
+                (timeout = wait_for_completion_timeout(&serdev->write_comp,
+                                                       timeout)));
+       mutex_unlock(&serdev->write_lock);
+       return ret < 0 ? ret : (count ? -ETIMEDOUT : 0);
 }
-EXPORT_SYMBOL_GPL(serdev_device_write_buf);
+EXPORT_SYMBOL_GPL(serdev_device_write);
 
 void serdev_device_write_flush(struct serdev_device *serdev)
 {
        serdev->dev.parent = &ctrl->dev;
        serdev->dev.bus = &serdev_bus_type;
        serdev->dev.type = &serdev_device_type;
+       init_completion(&serdev->write_comp);
+       mutex_init(&serdev->write_lock);
        return serdev;
 }
 EXPORT_SYMBOL_GPL(serdev_device_alloc);
 
  * @nr:                Device number on serdev bus.
  * @ctrl:      serdev controller managing this device.
  * @ops:       Device operations.
+ * @write_comp Completion used by serdev_device_write() internally
+ * @write_lock Lock to serialize access when writing data
  */
 struct serdev_device {
        struct device dev;
        int nr;
        struct serdev_controller *ctrl;
        const struct serdev_device_ops *ops;
+       struct completion write_comp;
+       struct mutex write_lock;
 };
 
 static inline struct serdev_device *to_serdev_device(struct device *d)
 void serdev_device_close(struct serdev_device *);
 unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int);
 void serdev_device_set_flow_control(struct serdev_device *, bool);
-int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t);
+void serdev_device_write_wakeup(struct serdev_device *);
+int serdev_device_write(struct serdev_device *, const unsigned char *, size_t, unsigned long);
 void serdev_device_write_flush(struct serdev_device *);
 int serdev_device_write_room(struct serdev_device *);
 
        return 0;
 }
 static inline void serdev_device_set_flow_control(struct serdev_device *sdev, bool enable) {}
-static inline int serdev_device_write_buf(struct serdev_device *sdev, const unsigned char *buf, size_t count)
+static inline int serdev_device_write(struct serdev_device *sdev, const unsigned char *buf,
+                                     size_t count, unsigned long timeout)
 {
        return -ENODEV;
 }
 static inline void serdev_tty_port_unregister(struct tty_port *port) {}
 #endif /* CONFIG_SERIAL_DEV_CTRL_TTYPORT */
 
+static inline int serdev_device_write_buf(struct serdev_device *serdev,
+                                         const unsigned char *data,
+                                         size_t count)
+{
+       return serdev_device_write(serdev, data, count, 0);
+}
+
 #endif /*_LINUX_SERDEV_H */