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>
This commit is contained in:
parent
f28b6e365b
commit
8896b43482
|
@ -239,6 +239,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
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue