Re: [alsa-devel] [PATCH 06/14] soundwire: add support for sdw_slave_type

From: Pierre-Louis Bossart
Date: Mon Nov 04 2019 - 09:44:19 EST




On 11/3/19 12:32 AM, Vinod Koul wrote:
On 23-10-19, 16:28, Pierre-Louis Bossart wrote:
Currently the bus does not have any explicit support for master
devices. Add explicit support for sdw_slave_type, so that in
follow-up patches we can add support for the sdw_md_type (md==Master
Device), following the Grey Bus example.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
---
drivers/soundwire/bus_type.c | 9 ++++++++-
drivers/soundwire/slave.c | 7 ++++++-
include/linux/soundwire/sdw_type.h | 6 ++++++
3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c
index 9a0fd3ee1014..5df095f4e12f 100644
--- a/drivers/soundwire/bus_type.c
+++ b/drivers/soundwire/bus_type.c
@@ -49,9 +49,16 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size)
static int sdw_uevent(struct device *dev, struct kobj_uevent_env *env)
{
- struct sdw_slave *slave = to_sdw_slave_device(dev);
+ struct sdw_slave *slave;
char modalias[32];
+ if (is_sdw_slave(dev)) {
+ slave = to_sdw_slave_device(dev);
+ } else {
+ dev_warn(dev, "uevent for unknown Soundwire type\n");
+ return -EINVAL;

when is the case where this would be triggered?

this is in preparation for the master case, where you will have 2 types of devices, so need to check if the type is correct.