summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Alencar <rodrigo.alencar@analog.com>2026-07-16 13:14:20 +0100
committerJonathan Cameron <jonathan.cameron@oss.qualcomm.com>2026-07-19 23:16:21 +0100
commit92b7963fb544d42b0d974bfd86921566b404fabc (patch)
treeaaa0f346d9fcf6102549f3a10a7a39e89ef7de56
parent797d37e46c947dda659e0d523fbb936679025950 (diff)
downloadlinux-92b7963fb544d42b0d974bfd86921566b404fabc.tar.gz
linux-92b7963fb544d42b0d974bfd86921566b404fabc.zip
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 <dlechner@baylibre.com> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
-rw-r--r--drivers/iio/dac/ad5686.h10
1 files changed, 9 insertions, 1 deletions
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)