[PATCH] soundwire: bus: add enumerated slave to device list

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Wed Sep 9 16:39:25 CEST 2020


>>> Currently slave devices are only added either from device tree or acpi
>>> entries. However lets say, there is wrong or no entry of a slave device
>>> in DT that is enumerated, then there is no way for user to know all
>>> the enumerated devices on the bus.
>>
>> Sorry Srinivas, I don't understand your point.
>>
>> The sysfs entries will include all devices that are described in 
>> platform firmware (be it DT or ACPI).
> 
> yes that is true, but it will not include all the enumerated devices on 
> the bus!
> 
> In my case on a new board I was trying to figure out what devices are on 
> the bus even before even adding any device tree entries!

We've seen this before but dynamic debug provides all the information 
you need. see e.g. the logs from 
https://sof-ci.01.org/linuxpr/PR2425/build4447/devicetest/

jf-cml-rvp-sdw-1 kernel: [  289.751974] soundwire sdw-master-0: Slave 
attached, programming device number
jf-cml-rvp-sdw-1 kernel: [  289.752121] soundwire sdw-master-0: SDW 
Slave Addr: 10025d070000 <<< HERE
jf-cml-rvp-sdw-1 kernel: [  289.752122] soundwire sdw-master-0: SDW 
Slave class_id 0, part_id 700, mfg_id 25d, unique_id 0, version 1

  > In second case I had a typo in the device tree entry and sysfs 
displayed
> devices with that typo rather than actual enumerated device id.

That's a feature, not a bug? We use what address the platform firmware 
provides. If it's inaccurate then nothing can work.

>> If you add to sysfs entries unknown devices which happen to be present 
>> on the bus, then what? How would you identify them from the devices 
>> that are described in firmware?
> 
> Both of them should be displayed in sysfs, core should be able to 
> differentiate this based on the presence of fw_node or of_node and not 
> bind!

Core yes but user not so much. If the intent is to list the devices 
present on the bus, your patch still requires manual work.

>> Also the sysfs entries describe properties, but if you haven't bound a 
>> driver then how would this work?
> 
> This is would be informative, atleast in cases like me!
> 
> All I want to know is the list of enumerated devices on the bus, If 
> doing this way is not the right thing, then am happy to try any suggestion!
> 
> For now I have managed to figure out enumerated device ids on the bus 
> with this patch, I was hoping that other people would also hit such 
> issue, so I sent this patch!

Now I get your point but
a) you already have a dynamic debug trace to list all devices
b) adding 'undeclared' devices would make things quite murky and is only 
half of the solution. We already struggle because we already have 
'ghost' devices in sysfs that are not physically present, and no way to 
differentiate between the two. If we did add those entries, then we'd 
need two new sysfs attributes such as
'declared' and 'enumerated'.


More information about the Alsa-devel mailing list