Message ID | 20200917160007.153106-2-pierre-louis.bossart@linux.intel.com |
---|---|
State | Superseded |
Headers | show |
Series | soundwire: sysfs: expose device number and status | expand |
On 18-09-20, 08:54, Pierre-Louis Bossart wrote: > > > On 9/18/20 7:05 AM, Vinod Koul wrote: > > On 17-09-20, 11:00, Pierre-Louis Bossart wrote: > > > From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > > > > > > 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 eveb 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. > > > > You should add yours as Co-developed. That is the standard tag for these > > things > > ok, I've never used this tag before but it seems appropriate indeed, thanks > for the suggestion. > > Should I add your Co-developed tag to the second patch as well then? Sure
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index 02574b4bb179..81807b332a12 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -741,6 +741,15 @@ static int sdw_program_device_num(struct sdw_bus *bus) if (!found) { /* 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"); } diff --git a/drivers/soundwire/bus.h b/drivers/soundwire/bus.h index c53345fbc4c7..fd251c1eb925 100644 --- a/drivers/soundwire/bus.h +++ b/drivers/soundwire/bus.h @@ -19,6 +19,8 @@ static inline int sdw_acpi_find_slaves(struct sdw_bus *bus) int sdw_of_find_slaves(struct sdw_bus *bus); void sdw_extract_slave_id(struct sdw_bus *bus, 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, struct fwnode_handle *fwnode); int sdw_master_device_del(struct sdw_bus *bus); diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c index 6fba55898cf0..575b9bad99d5 100644 --- a/drivers/soundwire/bus_type.c +++ b/drivers/soundwire/bus_type.c @@ -84,6 +84,15 @@ static int sdw_drv_probe(struct device *dev) const struct sdw_device_id *id; 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); if (!id) return -ENODEV; diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c index 4a250d33de5d..19b012310c29 100644 --- a/drivers/soundwire/slave.c +++ b/drivers/soundwire/slave.c @@ -20,8 +20,8 @@ struct device_type sdw_slave_type = { .uevent = sdw_slave_uevent, }; -static int sdw_slave_add(struct sdw_bus *bus, - struct sdw_slave_id *id, struct fwnode_handle *fwnode) +int sdw_slave_add(struct sdw_bus *bus, + struct sdw_slave_id *id, struct fwnode_handle *fwnode) { struct sdw_slave *slave; int ret;