Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bae40758 authored by Phani Kumar Uppalapati's avatar Phani Kumar Uppalapati
Browse files

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: default avatarPhani Kumar Uppalapati <phaniu@codeaurora.org>
parent fd64e02a
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -239,6 +239,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
+4 −1
Original line number Diff line number Diff line
/* 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 */