summaryrefslogtreecommitdiffstats
path: root/drivers/soundwire/bus.h
diff options
context:
space:
mode:
authorSanyog Kale <sanyog.r.kale@intel.com>2017-12-14 11:19:39 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-19 11:27:33 +0100
commitd52d7a1be02cc6da287bfaea7eebb0de1a77fbe2 (patch)
treea0a540a601e261253f8b90b1a5518c4623fc6abd /drivers/soundwire/bus.h
parent9d715fa005ebccc510a430df278665793528e31f (diff)
downloadlinux-stable-d52d7a1be02cc6da287bfaea7eebb0de1a77fbe2.tar.gz
linux-stable-d52d7a1be02cc6da287bfaea7eebb0de1a77fbe2.tar.bz2
linux-stable-d52d7a1be02cc6da287bfaea7eebb0de1a77fbe2.zip
soundwire: Add Slave status handling helpers
SoundWire Slaves report status to bus. Add helpers to handle the status changes. Signed-off-by: Hardik T Shah <hardik.t.shah@intel.com> Signed-off-by: Sanyog Kale <sanyog.r.kale@intel.com> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Acked-By: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/soundwire/bus.h')
-rw-r--r--drivers/soundwire/bus.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/soundwire/bus.h b/drivers/soundwire/bus.h
index 48eb7de8db7b..e8df55d761c7 100644
--- a/drivers/soundwire/bus.h
+++ b/drivers/soundwire/bus.h
@@ -52,4 +52,18 @@ int sdw_transfer_defer(struct sdw_bus *bus, struct sdw_msg *msg,
int sdw_fill_msg(struct sdw_msg *msg, struct sdw_slave *slave,
u32 addr, size_t count, u16 dev_num, u8 flags, u8 *buf);
+/* Read-Modify-Write Slave register */
+static inline int
+sdw_update(struct sdw_slave *slave, u32 addr, u8 mask, u8 val)
+{
+ int tmp;
+
+ tmp = sdw_read(slave, addr);
+ if (tmp < 0)
+ return tmp;
+
+ tmp = (tmp & ~mask) | val;
+ return sdw_write(slave, addr, tmp);
+}
+
#endif /* __SDW_BUS_H */