diff options
| author | Phani Kumar Uppalapati <phaniu@codeaurora.org> | 2016-04-22 16:48:48 -0700 |
|---|---|---|
| committer | Jeevan Shriram <jshriram@codeaurora.org> | 2016-05-20 13:33:55 -0700 |
| commit | ae4cedcf33773bd67466e4607dd2f860ffc3a937 (patch) | |
| tree | 4206b2027f5635b4105fe41e8d34fb74f4ed3553 | |
| parent | c04712dc8f47664574d61884a2da3503113d4b4d (diff) | |
soundwire: Add API to ungroup soundwire slave devices
Add soundwire API to remove the soundwire slave devices
from group so that the devices can be controlled
independently as required.
CRs-fixed: 1007465
Change-Id: Ibca3e33c0e85629ae5ce121e75526f4786d6408a
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
| -rwxr-xr-x | drivers/soundwire/soundwire.c | 32 | ||||
| -rwxr-xr-x | include/linux/soundwire/soundwire.h | 2 |
2 files changed, 34 insertions, 0 deletions
diff --git a/drivers/soundwire/soundwire.c b/drivers/soundwire/soundwire.c index 2ca4faedd4b3..6691418b516e 100755 --- a/drivers/soundwire/soundwire.c +++ b/drivers/soundwire/soundwire.c @@ -240,6 +240,38 @@ void swr_port_response(struct swr_master *mstr, u8 tid) EXPORT_SYMBOL(swr_port_response); /** + * swr_remove_from_group - remove soundwire slave devices from group + * @dev: pointer to the soundwire slave device + * dev_num: device number of the soundwire slave device + * + * Returns error code for failure and 0 for success + */ +int swr_remove_from_group(struct swr_device *dev, u8 dev_num) +{ + struct swr_master *master; + + if (!dev) + return -ENODEV; + + master = dev->master; + if (!master) + return -EINVAL; + + if (!dev->group_id) + return 0; + + if (master->gr_sid == dev_num) + return 0; + + if (master->remove_from_group && master->remove_from_group(master)) + dev_dbg(&master->dev, "%s: falling back to GROUP_NONE\n", + __func__); + + return 0; +} +EXPORT_SYMBOL(swr_remove_from_group); + +/** * swr_slvdev_datapath_control - Enables/Disables soundwire slave device * data path * @dev: pointer to soundwire slave device diff --git a/include/linux/soundwire/soundwire.h b/include/linux/soundwire/soundwire.h index 4b957245209e..2083e7b5da25 100755 --- a/include/linux/soundwire/soundwire.h +++ b/include/linux/soundwire/soundwire.h @@ -152,6 +152,7 @@ struct swr_master { 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); + bool (*remove_from_group)(struct swr_master *mstr); }; static inline struct swr_master *to_swr_master(struct device *dev) @@ -307,4 +308,5 @@ 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); +extern int swr_remove_from_group(struct swr_device *dev, u8 dev_num); #endif /* _LINUX_SOUNDWIRE_H */ |
