Dne 08. 04. 21 v 22:01 Jaroslav Kysela napsal(a): > Dne 08. 04. 21 v 21:41 Pierre-Louis Bossart napsal(a): >> >> >> >>>>> Yes, I'm talking about rules which depends on the sound driver specific sysfs >>>>> attributes (you can match the modified /sys/module/*/parameters here). >>>> >>>> you lost me with 'match the modified parameters' wording. who matches >>>> and who modifies those parameters? >>> >>> You can probably add something like this to the sound-card.rules: >>> >>> SUBSYSTEMS=="pci",ATTR{device/driver/module}=="snd_soc_sof_sdw", >>> ATTR{device/driver/module/../snd_sof_pci/parameters/tplg_path}=="intel/sof-tplg/pdm1", >>> DO_SOMETHING_HERE >>> >>> DO_SOMETHING_HERE may be ATTR{longname}="My Long Name" for example when my change is accepted. >> >> Humm, not sure this can work due to dependencies. >> >> The machine device is neither an ACPI nor PCI one. It's a platform device. >> >> When the PCI device is detected, the PCI core will call the SOF driver >> probe, which will first try and boot the firmware, and then create the >> platform device. That results in the probe of the machine driver which >> creates the card, but that happens *after* booting the firmware. >> >> the DSP firmware is setup starting here: >> >> https://elixir.bootlin.com/linux/latest/source/sound/soc/sof/core.c#L138 >> >> and the machine device is created almost last, after registering the >> ASoC components. >> >> https://elixir.bootlin.com/linux/latest/source/sound/soc/sof/core.c#L234 >> >> when the card is created, it's too late to change the firmware path or >> any firmware-related parameters. > > I just tried to describe the possible 2nd stage - modify the sysfs attributes > when the card with the modified firmware is created (all modules are loaded > and initialized). The 1st stage like from Curtis must be retained. It ensures > to load the right fw. > > SYSTEMS=="pci" checks also parents and card0 links to pci device: card0 -> > ../../devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card0 . You can modify > this matching anyway - the goal is to run commands for the specific driver and > module parameters when the card is loaded (avoid to change the card attributes > for other hw). > > I'm not an udev expert, so there may be a bug in my suggestion. I also think > that the filter may be specified more elegantly (probably using the DRIVER > match or so). Another way to use two rules - use internal udev device environment variable (it seems more straight): PCI detection level: SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0xa0c8", ATTR{class}=="0x040100",ATTRS{[dmi/id]board_name}=="Eldrid", ENV{SOUND_SOF_PROFILE}="MyProfile",...module stuff... Card instance level (sound-card.rules): SUBSYSTEMS=="pci",ENV{SOUND_SOF_PROFILE}=="MyProfile",...attr setup... Jaroslav -- Jaroslav Kysela <perex@xxxxxxxx> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.