Commit fcb9d730 authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Vinod Koul

soundwire: bus: add enumerated Slave device to device list

Currently Slave devices are only added on startup, either from Device
Tree or ACPI entries. However Slave devices that are physically
present on the bus, but not described in platform firmware, will never
be added to the device list. The user/integrator can only know the
list of devices by looking a dynamic debug logs.

This patch suggests adding a Slave device even if there is no matching
DT or ACPI entry, so that we can see this in sysfs entry.

Initial code from Srinivas. Comments, fixes for ACPI probe and edits
of commit message by Pierre.
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Co-developed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200924194430.121058-2-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 5ec3215e
...@@ -747,6 +747,15 @@ static int sdw_program_device_num(struct sdw_bus *bus) ...@@ -747,6 +747,15 @@ static int sdw_program_device_num(struct sdw_bus *bus)
if (!found) { if (!found) {
/* TODO: Park this device in Group 13 */ /* TODO: Park this device in Group 13 */
/*
* add Slave device even if there is no platform
* firmware description. There will be no driver probe
* but the user/integration will be able to see the
* device, enumeration status and device number in sysfs
*/
sdw_slave_add(bus, &id, NULL);
dev_err(bus->dev, "Slave Entry not found\n"); dev_err(bus->dev, "Slave Entry not found\n");
} }
......
...@@ -19,6 +19,8 @@ static inline int sdw_acpi_find_slaves(struct sdw_bus *bus) ...@@ -19,6 +19,8 @@ static inline int sdw_acpi_find_slaves(struct sdw_bus *bus)
int sdw_of_find_slaves(struct sdw_bus *bus); int sdw_of_find_slaves(struct sdw_bus *bus);
void sdw_extract_slave_id(struct sdw_bus *bus, void sdw_extract_slave_id(struct sdw_bus *bus,
u64 addr, struct sdw_slave_id *id); u64 addr, struct sdw_slave_id *id);
int sdw_slave_add(struct sdw_bus *bus, struct sdw_slave_id *id,
struct fwnode_handle *fwnode);
int sdw_master_device_add(struct sdw_bus *bus, struct device *parent, int sdw_master_device_add(struct sdw_bus *bus, struct device *parent,
struct fwnode_handle *fwnode); struct fwnode_handle *fwnode);
int sdw_master_device_del(struct sdw_bus *bus); int sdw_master_device_del(struct sdw_bus *bus);
......
...@@ -84,6 +84,15 @@ static int sdw_drv_probe(struct device *dev) ...@@ -84,6 +84,15 @@ static int sdw_drv_probe(struct device *dev)
const struct sdw_device_id *id; const struct sdw_device_id *id;
int ret; int ret;
/*
* fw description is mandatory to bind
*/
if (!dev->fwnode)
return -ENODEV;
if (!IS_ENABLED(CONFIG_ACPI) && !dev->of_node)
return -ENODEV;
id = sdw_get_device_id(slave, drv); id = sdw_get_device_id(slave, drv);
if (!id) if (!id)
return -ENODEV; return -ENODEV;
......
...@@ -20,8 +20,8 @@ struct device_type sdw_slave_type = { ...@@ -20,8 +20,8 @@ struct device_type sdw_slave_type = {
.uevent = sdw_slave_uevent, .uevent = sdw_slave_uevent,
}; };
static int sdw_slave_add(struct sdw_bus *bus, int sdw_slave_add(struct sdw_bus *bus,
struct sdw_slave_id *id, struct fwnode_handle *fwnode) struct sdw_slave_id *id, struct fwnode_handle *fwnode)
{ {
struct sdw_slave *slave; struct sdw_slave *slave;
int ret; int ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment