From 92b7963fb544d42b0d974bfd86921566b404fabc Mon Sep 17 00:00:00 2001 From: Rodrigo Alencar Date: Thu, 16 Jul 2026 13:14:20 +0100 Subject: [PATCH] iio: dac: ad5686: introduce sync operation Add sync() to operation to ad5686_bus_ops, which can be used to flush multiple pending data transfers at once. This is going to be used when implementing triggered buffer support. Reviewed-by: David Lechner Signed-off-by: Rodrigo Alencar Signed-off-by: Jonathan Cameron --- drivers/iio/dac/ad5686.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h index 32cb3931413c..ae9aeda2d201 100644 --- a/drivers/iio/dac/ad5686.h +++ b/drivers/iio/dac/ad5686.h @@ -70,10 +70,12 @@ struct ad5686_state; * struct ad5686_bus_ops - bus specific read/write operations * @read: read a register value at the given address * @write: write a command, address and value to the device + * @sync: ensure the completion of the write operation (optional) */ struct ad5686_bus_ops { int (*read)(struct ad5686_state *st, u8 addr); int (*write)(struct ad5686_state *st, u8 cmd, u8 addr, u16 val); + int (*sync)(struct ad5686_state *st); }; /** @@ -162,7 +164,13 @@ int ad5686_probe(struct device *dev, static inline int ad5686_write(struct ad5686_state *st, u8 cmd, u8 addr, u16 val) { - return st->ops->write(st, cmd, addr, val); + int ret; + + ret = st->ops->write(st, cmd, addr, val); + if (ret) + return ret; + + return st->ops->sync ? st->ops->sync(st) : 0; } static inline int ad5686_read(struct ad5686_state *st, u8 addr)