Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions sound/soc/sof/intel/hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ struct hda_dsp_msg_code {
const char *msg;
};

static bool hda_use_msi = IS_ENABLED(CONFIG_PCI);
#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG)
module_param_named(use_msi, hda_use_msi, bool, 0444);
MODULE_PARM_DESC(use_msi, "SOF HDA use PCI MSI mode");
#endif

static const struct hda_dsp_msg_code hda_dsp_rom_msg[] = {
{HDA_DSP_ROM_FW_MANIFEST_LOADED, "status: manifest loaded"},
{HDA_DSP_ROM_FW_FW_LOADED, "status: fw loaded"},
Expand Down Expand Up @@ -529,25 +535,25 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)
* register our IRQ
* let's try to enable msi firstly
* if it fails, use legacy interrupt mode
* TODO: support interrupt mode selection with kernel parameter
* support msi multiple vectors
* TODO: support msi multiple vectors
*/
ret = pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_MSI);
if (ret < 0) {
if (hda_use_msi && !pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_MSI)) {
dev_info(sdev->dev, "use msi interrupt mode\n");
hdev->irq = pci_irq_vector(pci, 0);
/* ipc irq number is the same of hda irq */
sdev->ipc_irq = hdev->irq;
/* initialised to "false" by kzalloc() */
sdev->msi_enabled = true;
}

if (!sdev->msi_enabled) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't really need a new field that isn't used anywhere else, a local variable would do.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart it isn't new at all, I just changed its type. And yes, it is used in multiple functions, so, no, it cannot be a local variable

dev_info(sdev->dev, "use legacy interrupt mode\n");
/*
* in IO-APIC mode, hda->irq and ipc_irq are using the same
* irq number of pci->irq
*/
hdev->irq = pci->irq;
sdev->ipc_irq = pci->irq;
sdev->msi_enabled = 0;
} else {
dev_info(sdev->dev, "use msi interrupt mode\n");
hdev->irq = pci_irq_vector(pci, 0);
/* ipc irq number is the same of hda irq */
sdev->ipc_irq = hdev->irq;
sdev->msi_enabled = 1;
}

dev_dbg(sdev->dev, "using HDA IRQ %d\n", hdev->irq);
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/sof/sof-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ struct snd_sof_dev {
u32 dtrace_error;
u32 dtrace_draining;

u32 msi_enabled;
bool msi_enabled;

void *private; /* core does not touch this */
};
Expand Down