summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhani Kumar Uppalapati <phaniu@codeaurora.org>2016-03-22 21:16:44 -0700
committerJeevan Shriram <jshriram@codeaurora.org>2016-05-06 12:06:19 -0700
commit22ba2185dab87dd8da9bdb72f6aac257c707a082 (patch)
tree2d2c5450084a9a56f4c4eccfa83855c07da42dc2
parent849a6fc42c73bffb3c00103eebd837c14d5e1729 (diff)
soundwire: Add API to control slave device data path
Add soundwire API to control slave device data path enable or disable. This gives slave device drivers more flexibility for data path control during device path enablement. CRs-fixed: 996586 Change-Id: Ic0ab015098035418458a5ba7c2ffad9df20f933c Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
-rwxr-xr-xdrivers/soundwire/soundwire.c37
-rwxr-xr-xinclude/linux/soundwire/soundwire.h5
2 files changed, 41 insertions, 1 deletions
diff --git a/drivers/soundwire/soundwire.c b/drivers/soundwire/soundwire.c
index 23642fe38ef3..2ca4faedd4b3 100755
--- a/drivers/soundwire/soundwire.c
+++ b/drivers/soundwire/soundwire.c
@@ -240,6 +240,43 @@ void swr_port_response(struct swr_master *mstr, u8 tid)
EXPORT_SYMBOL(swr_port_response);
/**
+ * swr_slvdev_datapath_control - Enables/Disables soundwire slave device
+ * data path
+ * @dev: pointer to soundwire slave device
+ * @dev_num: device number of the soundwire slave device
+ *
+ * Returns error code for failure and 0 for success
+ */
+int swr_slvdev_datapath_control(struct swr_device *dev, u8 dev_num,
+ bool enable)
+{
+ struct swr_master *master;
+
+ if (!dev)
+ return -ENODEV;
+
+ master = dev->master;
+ if (!master)
+ return -EINVAL;
+
+ if (dev->group_id) {
+ /* Broadcast */
+ if (master->gr_sid != dev_num) {
+ if (!master->gr_sid)
+ master->gr_sid = dev_num;
+ else
+ return 0;
+ }
+ }
+
+ if (master->slvdev_datapath_control)
+ master->slvdev_datapath_control(master, enable);
+
+ return 0;
+}
+EXPORT_SYMBOL(swr_slvdev_datapath_control);
+
+/**
* swr_connect_port - enable soundwire slave port(s)
* @dev: pointer to soundwire slave device
* @port_id: logical port id(s) of soundwire slave device
diff --git a/include/linux/soundwire/soundwire.h b/include/linux/soundwire/soundwire.h
index f19e871d6ac2..4b957245209e 100755
--- a/include/linux/soundwire/soundwire.h
+++ b/include/linux/soundwire/soundwire.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -151,6 +151,7 @@ struct swr_master {
const void *buf, size_t len);
int (*get_logical_dev_num)(struct swr_master *mstr, u64 dev_id,
u8 *dev_num);
+ void (*slvdev_datapath_control)(struct swr_master *mstr, bool enable);
};
static inline struct swr_master *to_swr_master(struct device *dev)
@@ -304,4 +305,6 @@ extern int swr_device_down(struct swr_device *swr_dev);
extern int swr_reset_device(struct swr_device *swr_dev);
+extern int swr_slvdev_datapath_control(struct swr_device *swr_dev, u8 dev_num,
+ bool enable);
#endif /* _LINUX_SOUNDWIRE_H */