diff options
author | Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> | 2019-07-22 10:13:57 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-07-23 07:21:45 -0400 |
commit | 672ff5e3596ee27b64edcc73251f4ae1c8ab12ac (patch) | |
tree | 71a7fe39cf8e857319790f4b0425fa783bd94a72 | |
parent | dc7a36f178a94604d29c5dd15c77187905d8e882 (diff) |
ASoC: SOF: Intel: hda: add a parameter to disable MSI
Enabling MSI on HDA can fail, in which case the legacy PCI IRQ mode
will be used. To make testing this mode easier add an "enable_msi"
module parameter, which is only enabled if debugging is enabled too.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190722141402.7194-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/sof/intel/hda.c | 28 | ||||
-rw-r--r-- | sound/soc/sof/sof-priv.h | 2 |
2 files changed, 18 insertions, 12 deletions
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 7f665392618f..79cce20666b6 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c | |||
@@ -46,6 +46,12 @@ struct hda_dsp_msg_code { | |||
46 | const char *msg; | 46 | const char *msg; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | static bool hda_use_msi = IS_ENABLED(CONFIG_PCI); | ||
50 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG) | ||
51 | module_param_named(use_msi, hda_use_msi, bool, 0444); | ||
52 | MODULE_PARM_DESC(use_msi, "SOF HDA use PCI MSI mode"); | ||
53 | #endif | ||
54 | |||
49 | static const struct hda_dsp_msg_code hda_dsp_rom_msg[] = { | 55 | static const struct hda_dsp_msg_code hda_dsp_rom_msg[] = { |
50 | {HDA_DSP_ROM_FW_MANIFEST_LOADED, "status: manifest loaded"}, | 56 | {HDA_DSP_ROM_FW_MANIFEST_LOADED, "status: manifest loaded"}, |
51 | {HDA_DSP_ROM_FW_FW_LOADED, "status: fw loaded"}, | 57 | {HDA_DSP_ROM_FW_FW_LOADED, "status: fw loaded"}, |
@@ -529,11 +535,18 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) | |||
529 | * register our IRQ | 535 | * register our IRQ |
530 | * let's try to enable msi firstly | 536 | * let's try to enable msi firstly |
531 | * if it fails, use legacy interrupt mode | 537 | * if it fails, use legacy interrupt mode |
532 | * TODO: support interrupt mode selection with kernel parameter | 538 | * TODO: support msi multiple vectors |
533 | * support msi multiple vectors | ||
534 | */ | 539 | */ |
535 | ret = pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_MSI); | 540 | if (hda_use_msi && !pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_MSI)) { |
536 | if (ret < 0) { | 541 | dev_info(sdev->dev, "use msi interrupt mode\n"); |
542 | hdev->irq = pci_irq_vector(pci, 0); | ||
543 | /* ipc irq number is the same of hda irq */ | ||
544 | sdev->ipc_irq = hdev->irq; | ||
545 | /* initialised to "false" by kzalloc() */ | ||
546 | sdev->msi_enabled = true; | ||
547 | } | ||
548 | |||
549 | if (!sdev->msi_enabled) { | ||
537 | dev_info(sdev->dev, "use legacy interrupt mode\n"); | 550 | dev_info(sdev->dev, "use legacy interrupt mode\n"); |
538 | /* | 551 | /* |
539 | * in IO-APIC mode, hda->irq and ipc_irq are using the same | 552 | * in IO-APIC mode, hda->irq and ipc_irq are using the same |
@@ -541,13 +554,6 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) | |||
541 | */ | 554 | */ |
542 | hdev->irq = pci->irq; | 555 | hdev->irq = pci->irq; |
543 | sdev->ipc_irq = pci->irq; | 556 | sdev->ipc_irq = pci->irq; |
544 | sdev->msi_enabled = 0; | ||
545 | } else { | ||
546 | dev_info(sdev->dev, "use msi interrupt mode\n"); | ||
547 | hdev->irq = pci_irq_vector(pci, 0); | ||
548 | /* ipc irq number is the same of hda irq */ | ||
549 | sdev->ipc_irq = hdev->irq; | ||
550 | sdev->msi_enabled = 1; | ||
551 | } | 557 | } |
552 | 558 | ||
553 | dev_dbg(sdev->dev, "using HDA IRQ %d\n", hdev->irq); | 559 | dev_dbg(sdev->dev, "using HDA IRQ %d\n", hdev->irq); |
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index b8c9274ccf42..983eadef4b30 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h | |||
@@ -435,7 +435,7 @@ struct snd_sof_dev { | |||
435 | u32 dtrace_error; | 435 | u32 dtrace_error; |
436 | u32 dtrace_draining; | 436 | u32 dtrace_draining; |
437 | 437 | ||
438 | u32 msi_enabled; | 438 | bool msi_enabled; |
439 | 439 | ||
440 | void *private; /* core does not touch this */ | 440 | void *private; /* core does not touch this */ |
441 | }; | 441 | }; |