Repository navigation
ASoC: SOF: merge ipc and sdw irq #1412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,4 +123,18 @@ void sdw_intel_exit(struct sdw_intel_ctx *ctx); | |
|
|
||
| void sdw_intel_enable_irq(void __iomem *mmio_base, bool enable); | ||
|
|
||
| irqreturn_t sdw_intel_thread(int irq, void *dev_id); | ||
|
|
||
| static inline | ||
| bool is_sdw_intel_irq(struct sdw_intel_ctx *ctx) | ||
| { | ||
| u32 int_status; | ||
|
|
||
| int_status = readl(ctx->mmio_base + 0x14); | ||
| if (int_status & BIT(5)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. HDA_DSP_REG_ADSPIC2_SNDW |
||
| return true; | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -237,15 +237,18 @@ irqreturn_t hda_dsp_ipc_irq_thread(int irq, void *context) | |
| return IRQ_HANDLED; | ||
| } | ||
|
|
||
| /* is this IRQ for ADSP ? - we only care about IPC here */ | ||
| /* is this IRQ for ADSP or SDW? - we only care about IPC and SDW here */ | ||
| irqreturn_t hda_dsp_ipc_irq_handler(int irq, void *context) | ||
| { | ||
| struct snd_sof_dev *sdev = context; | ||
| struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; | ||
| int ret = IRQ_NONE; | ||
| u32 irq_status; | ||
|
|
||
| spin_lock(&sdev->hw_lock); | ||
|
|
||
| sdev->irq_event = 0; | ||
|
|
||
| /* store status */ | ||
| irq_status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPIS); | ||
| dev_vdbg(sdev->dev, "irq handler: irq_status:0x%x\n", irq_status); | ||
|
|
@@ -260,6 +263,13 @@ irqreturn_t hda_dsp_ipc_irq_handler(int irq, void *context) | |
| snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, | ||
| HDA_DSP_REG_ADSPIC, | ||
| HDA_DSP_ADSPIC_IPC, 0); | ||
| sdev->irq_event |= SOF_IRQ_IPC; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the use of a field that's set in the handler is problematic. We know we can have new interrupts before the thread is scheduled (that's e.g. how SoundWire handled the commands before, with the wait_for_completion in the thread and the complete() bin the handler So it's possible that while you have an SoundWire thread scheduled an IPC interrupt quicks in, and you would reset sdev->irq_event. I don't think this can work... |
||
| ret = IRQ_WAKE_THREAD; | ||
| } | ||
| /* SDW message */ | ||
| if (hdev->sdw && is_sdw_intel_irq(hdev->sdw)) { | ||
| hda_sdw_int_enable(sdev, false); | ||
| sdev->irq_event |= SOF_IRQ_SDW; | ||
| ret = IRQ_WAKE_THREAD; | ||
| } | ||
|
|
||
|
|
@@ -268,6 +278,20 @@ irqreturn_t hda_dsp_ipc_irq_handler(int irq, void *context) | |
| return ret; | ||
| } | ||
|
|
||
| irqreturn_t hda_dsp_irq_thread(int irq, void *context) | ||
| { | ||
| struct snd_sof_dev *sdev = context; | ||
| struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; | ||
|
|
||
| if (sdev->irq_event & SOF_IRQ_IPC) | ||
| sof_ops(sdev)->irq_thread(irq, context); | ||
|
|
||
| if (sdev->irq_event & SOF_IRQ_SDW) | ||
| sdw_intel_thread(irq, hdev->sdw); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bardliao I understand the intention here but the naming is incorrent. hda_dsp_irq_thread() is the IRQ thread, sof_ops(sdev)->irq_thread() and sdw_intel_thread() are not threads but just normal methods. So I think we should remove the "thread" from their names.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@ranj063 I agree with you. I have a concern regarding sof_ops(sdev)->irq_thread(). Is there anywhere use sof_ops(sdev)->irq_thread() except here? And it looks confusing, too if we remove the _thread suffix. i.e. sof_ops(sdev)->irq. irq_handler may be a better name, but we already have it. Do you have any suggestion for irq_thread? |
||
|
|
||
| return IRQ_HANDLED; | ||
| } | ||
|
|
||
| int hda_dsp_ipc_get_mailbox_offset(struct snd_sof_dev *sdev) | ||
| { | ||
| return HDA_DSP_MBOX_UPLINK_OFFSET; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HDA_DSP_REG_ADSPIS2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plbossart HDA_DSP_REG_ADSPIS2 is defined at sound/soc/sof/intel/hda.h, but we don't include hda.h in soundwire driver. I am not sure include hda.h in sdw_intel.h is a good idea or not. If we just add the HDA_DSP_REG_ADSPIS2 define in sdw_intel.h, we will see redefine warning in compiling. Or we can define another name for HDA_DSP_REG_ADSPIS2 in sdw_intel.h?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just redefine them SDW_ADSPIC2 and SDW_ADSIS2. that's fine.