Skip to content

Commit 94d67c8

Browse files
plbossartbardliao
authored andcommitted
soundwire: slave: lookup SDCA version and functions
Use SDCA helpers to get the basic information and store it in the slave context. The information will be optionally be used in codec drivers to register sub-devices for each Function. When platforms are not based on ACPI the helpers do absolutely nothing. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
1 parent de2c2c4 commit 94d67c8

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

drivers/soundwire/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
menuconfig SOUNDWIRE
77
tristate "SoundWire support"
88
depends on ACPI || OF
9+
depends on SND_SOC_SDCA_OPTIONAL
910
help
1011
SoundWire is a 2-Pin interface with data and clock line ratified
1112
by the MIPI Alliance. SoundWire is used for transporting data

drivers/soundwire/slave.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <linux/of.h>
66
#include <linux/soundwire/sdw.h>
77
#include <linux/soundwire/sdw_type.h>
8+
#include <sound/sdca.h>
89
#include "bus.h"
910
#include "sysfs_local.h"
1011

@@ -70,6 +71,17 @@ int sdw_slave_add(struct sdw_bus *bus,
7071
list_add_tail(&slave->node, &bus->slaves);
7172
mutex_unlock(&bus->bus_lock);
7273

74+
/*
75+
* The Soundwire driver probe may optionally register SDCA
76+
* sub-devices, one per Function. This means the information
77+
* on the SDCA revision and the number/type of Functions need
78+
* to be extracted from platform firmware before the SoundWire
79+
* driver probe, and as a consequence before the SoundWire
80+
* device_register() below.
81+
*/
82+
sdca_lookup_interface_revision(slave);
83+
sdca_lookup_functions(slave);
84+
7385
ret = device_register(&slave->dev);
7486
if (ret) {
7587
dev_err(bus->dev, "Failed to add slave: ret %d\n", ret);
@@ -259,3 +271,5 @@ int sdw_of_find_slaves(struct sdw_bus *bus)
259271

260272
return 0;
261273
}
274+
275+
MODULE_IMPORT_NS(SND_SOC_SDCA);

0 commit comments

Comments
 (0)