diff options
author | Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> | 2020-05-18 20:43:21 +0300 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2020-05-19 10:14:35 +0300 |
commit | 7ceaa40b930e462ba0477ca6af34ec04d08181dc (patch) | |
tree | e566106b5a14929c7b42a0e180a3f046fe74b392 /drivers/soundwire/bus.c | |
parent | dbb50c7a9949506f750d59d9ba4d58f0ce8ccd42 (diff) | |
download | linux-7ceaa40b930e462ba0477ca6af34ec04d08181dc.tar.xz |
soundwire: bus_type: add sdw_master_device support
In the existing SoundWire code, Master Devices are not explicitly
represented - only SoundWire Slave Devices are exposed (the use of
capital letters follows the SoundWire specification conventions).
With the existing code, the bus is handled without using a proper device,
and bus->dev typically points to a platform device. The right thing to
do as discussed in multiple reviews is use a device for each bus.
The sdw_master_device addition is done with minimal internal plumbing
and not exposed externally. The existing API based on
sdw_bus_master_add() and sdw_bus_master_delete() will deal with the
sdw_master_device life cycle, which minimizes changes to existing
drivers.
Note that the Intel code will be modified in follow-up patches (no
impact on any platform since the connection with ASoC is not supported
upstream so far).
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20200518174322.31561-5-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/soundwire/bus.c')
-rw-r--r-- | drivers/soundwire/bus.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index 03d72fa3c190..11cfe435e4a8 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -37,14 +37,21 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent, struct sdw_master_prop *prop = NULL; int ret; - if (!bus->dev) { - pr_err("SoundWire bus has no device\n"); + if (!parent) { + pr_err("SoundWire parent device is not set\n"); return -ENODEV; } ret = sdw_get_id(bus); if (ret) { - dev_err(bus->dev, "Failed to get bus id\n"); + dev_err(parent, "Failed to get bus id\n"); + return ret; + } + + ret = sdw_master_device_add(bus, parent, fwnode); + if (ret) { + dev_err(parent, "Failed to add master device at link %d\n", + bus->link_id); return ret; } @@ -161,6 +168,7 @@ static int sdw_delete_slave(struct device *dev, void *data) void sdw_bus_master_delete(struct sdw_bus *bus) { device_for_each_child(bus->dev, NULL, sdw_delete_slave); + sdw_master_device_del(bus); sdw_bus_debugfs_exit(bus); ida_free(&sdw_ida, bus->id); |