ASoC: snd-sof-pci - add model parameter and pass it to HDA codec driver
Subsystems (3)
Jaroslav Kysela
maintainerPATCH 1/1 ASoC: snd-sof-pci - add model parameter and pass it to HDA codec driver
It may be useful to pass the specific model to the generic HDA codec routines like the legacy HDA driver (snd-hda-intel) allows. The model name "sofbus" is tricky anyway.
--- include/sound/sof.h | 1 + sound/soc/sof/intel/hda.c | 2 +- sound/soc/sof/sof-pci-dev.c | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-)
include/sound/sof.h +1 -0
@@ -25,6 +25,7 @@ struct snd_sof_pdata {const char *drv_name;const char *name;const char *platform; +const char *modelname;struct device *dev;
sound/soc/sof/intel/hda.c +1 -1
@@ -271,7 +271,7 @@ static int hda_init(struct snd_sof_dev *sdev)mutex_init (&hbus->prepare_mutex); hbus->pci = pci; hbus->mixer_assigned =-1 ; - hbus->modelname ="sofbus" ; + hbus->modelname = sdev->pdata->modelname;/* initialise hdac bus */ bus->addr =pci_resource_start (pci,0 );
sound/soc/sof/sof-pci-dev.c +5 -0
@@ -34,6 +34,10 @@ static int sof_pci_debug;module_param_named (sof_pci_debug, sof_pci_debug, int,0444 );MODULE_PARM_DESC (sof_pci_debug,"SOF PCI debug options (0x0 all off)" ); +static char *model; +module_param (model, charp,0444 ); +MODULE_PARM_DESC (model,"Use the given HDA board model." ); +#define SOF_PCI_DISABLE_PM_RUNTIME BIT(0)#if IS_ENABLED (CONFIG_SND_SOC_SOF_APOLLOLAKE )
@@ -326,6 +330,7 @@ static int sof_pci_probe(struct pci_dev *pci, sof_pdata->desc = (struct sof_dev_desc *)pci_id->driver_data; sof_pdata->dev = dev; sof_pdata->platform =dev_name (dev); + sof_pdata->modelname = model;/* alternate fw and tplg filenames ? */ if (fw_path)
Signature · 5 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 3 lines · Jaroslav Kysela
It may be useful to pass the specific model to the generic HDA codec routines like the legacy HDA driver (snd-hda-intel) allows. The model name "sofbus" is tricky anyway.
Humm, I must admit I have never looked at this for the legacy driver, and I am a bit confused on what this would be used for? The legacy driver uses codec->modelname but I can't figure out this part in hda_codec.c
if (codec->bus->modelname) {
codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL);In theory there can be multiple codecs per bus (with different SDIs) so using the bus->modelname for the codec->modelname looks odd. Is there an example of this being used for my education?
Also it'd make more sense to me to have this parameter in an intel-specific module, not the top level PCI one?
Quoted 52 lines
Signed-off-by Jaroslav Kysela <[email protected]>Cc Pierre-Louis Bossart <[email protected]>Cc Mark Brown <[email protected]>--- include/sound/sof.h | 1 + sound/soc/sof/intel/hda.c | 2 +- sound/soc/sof/sof-pci-dev.c | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-)include/sound/sof.h +1
-0@@ -25,6 +25,7 @@ struct snd_sof_pdata {const char *drv_name;const char *name;const char *platform; +const char *modelname;struct device *dev;sound/soc/sof/intel/hda.c +1
-1@@ -271,7 +271,7 @@ static int hda_init(struct snd_sof_dev *sdev)mutex_init (&hbus->prepare_mutex); hbus->pci = pci; hbus->mixer_assigned =-1 ; - hbus->modelname ="sofbus" ; + hbus->modelname = sdev->pdata->modelname;/* initialise hdac bus */ bus->addr =pci_resource_start (pci,0 );sound/soc/sof/sof-pci-dev.c +4
-0@@ -34,6 +34,10 @@ static int sof_pci_debug;module_param_named (sof_pci_debug, sof_pci_debug, int,0444 );MODULE_PARM_DESC (sof_pci_debug,"SOF PCI debug options (0x0 all off)" ); +static char *model; +module_param (model, charp,0444 ); +MODULE_PARM_DESC (model,"Use the given HDA board model." ); +#define SOF_PCI_DISABLE_PM_RUNTIME BIT(0)#if IS_ENABLED (CONFIG_SND_SOC_SOF_APOLLOLAKE )
sound/soc/sof/sof-pci-dev.c static int sof_pci_probe(struct pci_dev *pci, · line 336
Quoted 7 lines
sound/soc/sof/sof-pci-dev.c +1
-0@@ -326,6 +330,7 @@ static int sof_pci_probe(struct pci_dev *pci, sof_pdata->desc = (struct sof_dev_desc *)pci_id->driver_data; sof_pdata->dev = dev; sof_pdata->platform =dev_name (dev); + sof_pdata->modelname = model;/* alternate fw and tplg filenames ? */ if (fw_path)
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 13 lines · Pierre-Louis Bossart
Quoted 3 lines · Jaroslav Kysela
It may be useful to pass the specific model to the generic HDA codec routines like the legacy HDA driver (snd-hda-intel) allows. The model name "sofbus" is tricky anyway.
Humm, I must admit I have never looked at this for the legacy driver, and I am a bit confused on what this would be used for? The legacy driver uses
codec->modelnamebut I can't figure out this part inhda_codec.c
Quoted 5 lines
if (codec->bus->modelname) { codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL);In theory there can be multiple codecs per bus (with different SDIs) so using the
bus->modelnamefor thecodec->modelnamelooks odd.
That's true. However, basically the model name is specific to the whole device, hence it's usually OK to pass to all codecs. The mismatched model name is just ignored (that's why the current code with model="sofbus" works). So you can think it a kind of quirk lookup with a system name given explicitly by user.
Quoted 1 line
Is there an example of this being used for my education?
You can find the list in Documentation/sound/hd-audio/models.rst and the usage in Documentation/sound/hd-audio/notes.rst. The documents are a bit outdated, though.
Takashi
Quoted 48 lines
Also it'd make more sense to me to have this parameter in an intel-specific module, not the top level PCI one?
Quoted 45 lines
Signed-off-by Jaroslav Kysela <[email protected]>Cc Pierre-Louis Bossart <[email protected]>Cc Mark Brown <[email protected]>--- include/sound/sof.h | 1 + sound/soc/sof/intel/hda.c | 2 +- sound/soc/sof/sof-pci-dev.c | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-)include/sound/sof.h +1
-0@@ -25,6 +25,7 @@ struct snd_sof_pdata {const char *drv_name;const char *name;const char *platform; +const char *modelname;struct device *dev; diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.cindex
91bd88fddac7..ccb640bacc99100644sound/soc/sof/intel/hda.c +1
-1@@ -271,7 +271,7 @@ static int hda_init(struct snd_sof_dev *sdev)mutex_init (&hbus->prepare_mutex); hbus->pci = pci; hbus->mixer_assigned =-1 ; - hbus->modelname ="sofbus" ; + hbus->modelname = sdev->pdata->modelname;/* initialise hdac bus */ bus->addr =pci_resource_start (pci,0 );sound/soc/sof/sof-pci-dev.c +3
-0@@ -34,6 +34,10 @@ static int sof_pci_debug;module_param_named (sof_pci_debug, sof_pci_debug, int,0444 );MODULE_PARM_DESC (sof_pci_debug,"SOF PCI debug options (0x0 all off)" ); +static char *model; +module_param (model, charp,0444 ); +MODULE_PARM_DESC (model,"Use the given HDA board model." ); +#define SOF_PCI_DISABLE_PM_RUNTIME BIT(0)#if IS_ENABLED (CONFIG_SND_SOC_SOF_APOLLOLAKE )
Quoted 9 lines
sound/soc/sof/sof-pci-dev.c static int sof_pci_probe(struct pci_dev *pci, · line 336
Quoted 8 lines
sound/soc/sof/sof-pci-dev.c +1
-0@@ -326,6 +330,7 @@ static int sof_pci_probe(struct pci_dev *pci, sof_pdata->desc = (struct sof_dev_desc *)pci_id->driver_data; sof_pdata->dev = dev; sof_pdata->platform =dev_name (dev); + sof_pdata->modelname = model;/* alternate fw and tplg filenames ? */ if (fw_path)
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 22 lines
Quoted 10 lines
Quoted 4 lines
It may be useful to pass the specific model to the generic HDA codec routines like the legacy HDA driver (snd-hda-intel) allows. The model name "sofbus" is tricky anyway.
Humm, I must admit I have never looked at this for the legacy driver, and I am a bit confused on what this would be used for? The legacy driver uses
codec->modelnamebut I can't figure out this part inhda_codec.cQuoted 5 lines
if (codec->bus->modelname) { codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL);In theory there can be multiple codecs per bus (with different SDIs) so using the
bus->modelnamefor thecodec->modelnamelooks odd.That's true. However, basically the model name is specific to the whole device, hence it's usually OK to pass to all codecs. The mismatched model name is just ignored (that's why the current code with model="sofbus" works). So you can think it a kind of quirk lookup with a system name given explicitly by user.
Quoted 5 lines
Quoted 1 line
Is there an example of this being used for my education?
You can find the list in
Documentation/sound/hd-audio/models.rstand the usage inDocumentation/sound/hd-audio/notes.rst. The documents are a bit outdated, though.
ah, ok, thanks for the pointers.
So if you have a new machine that's not explicitly handled by quirks you can initially force existing tricks to be used, and in a second step the quirk is extended to handle that machine, yes?
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 29 lines · Pierre-Louis Bossart
Quoted 23 lines
Quoted 11 lines
Quoted 5 lines
It may be useful to pass the specific model to the generic HDA codec routines like the legacy HDA driver (snd-hda-intel) allows. The model name "sofbus" is tricky anyway.
Humm, I must admit I have never looked at this for the legacy driver, and I am a bit confused on what this would be used for? The legacy driver uses
codec->modelnamebut I can't figure out this part inhda_codec.cQuoted 5 lines
if (codec->bus->modelname) { codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL);In theory there can be multiple codecs per bus (with different SDIs) so using the
bus->modelnamefor thecodec->modelnamelooks odd.That's true. However, basically the model name is specific to the whole device, hence it's usually OK to pass to all codecs. The mismatched model name is just ignored (that's why the current code with model="sofbus" works). So you can think it a kind of quirk lookup with a system name given explicitly by user.
Quoted 5 lines
Quoted 1 line
Is there an example of this being used for my education?
You can find the list in
Documentation/sound/hd-audio/models.rstand the usage inDocumentation/sound/hd-audio/notes.rst. The documents are a bit outdated, though.
Quoted 5 lines
ah, ok, thanks for the pointers.
So if you have a new machine that's not explicitly handled by quirks you can initially force existing tricks to be used, and in a second step the quirk is extended to handle that machine, yes?
Yes, that's the usual step.
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel