Skip to content

ASoC: SOF: merge ipc and sdw irq - #1451

Closed
bardliao wants to merge 1 commit into
thesofproject:integration/soundwire-debug-fixesfrom
bardliao:sdw-one-irq
Closed

bardliao wants to merge 1 commit into
thesofproject:integration/soundwire-debug-fixesfrom
bardliao:sdw-one-irq

Conversation

@bardliao

@bardliao bardliao commented Nov 8, 2019

Copy link
Copy Markdown
Collaborator

So we can use single irq to handle both ipc and sdw interrupts.

Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com

@bardliao
bardliao requested review from plbossart and ranj063 November 8, 2019 05:32
@plbossart
plbossart force-pushed the integration/soundwire-debug-fixes branch 3 times, most recently from b475d02 to 70067f0 Compare November 11, 2019 22:41
@plbossart

Copy link
Copy Markdown
Member

@bardliao did you see my comments on #1412 ?

@bardliao

Copy link
Copy Markdown
Collaborator Author

@bardliao did you see my comments on #1412 ?

@plbossart Yes, and I update my PR according to your suggestion. However, I have a question regardingHDA_DSP_REG_ADSPIS2. Please see #1412 (comment). Currently, I call sof_ops(sdev)->irq_thread(irq, context) and sdw_intel_thread(irq, hdev->sdw) in hda_dsp_irq_thread unconditionally. But I think we can improve it there. I will do it today.

@bardliao

Copy link
Copy Markdown
Collaborator Author

@plbossart I updated my PR. The main difference is that I check interrupt and set irq_event flag at hda_dsp_ipc_irq_handler(). So we will need to check interrupt only if the irq_event flag is not set. And we will only call sof_ops(sdev)->irq_thread(irq, context) and/or sdw_intel_thread(irq, hdev->sdw) when it is required.

@RanderWang

Copy link
Copy Markdown

I checked windows driver which does the same job.

@plbossart plbossart left a comment

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.

@bardliao good work, but before we start changing the SoundWire handing of interrupts, we should first merge the IPC and stream interrupts on top of topic/sof-dev. If the end-goal is to merge all interrupt handlers as a single one, the first order of business is to merge the two non-SoundWire ones and have a full-cycle of validation on that topic alone.

See also additional comments below


return false;
}

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.

because SoundWire and ASoC are handled as separate subsystems, we need a patch that will modify the soundwire interfaces, and a separate on that will modify the ASoC parts.

u32 irq_status;

spin_lock(&sdev->hw_lock);
spin_lock_irq(&sdev->hw_lock);

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.

why do we need a change here? is this is because we use this routine both from handler and interrupt threads, than you need to add a comment.

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.

Yes, is_ipc_irq() will be called on interrupt thread and handler, and we don't want another interrupt to lock it while it is locked.

struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata;
int ret = IRQ_NONE;

sdev->irq_event = 0;

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.

we can't do this, the irq_event may be reset before it's used in a thread. I think we have no choice but to re-read the hardware registers in the thread.

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.

Thanks. @plbossart I didn't notice that. Maybe we can clear each bit in the irq thread the interrupt is handled.


/* IPC message ? */
if (is_ipc_irq(sdev)) {
/* disable IPC interrupt at is_ipc_irq() */

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.

it's quite ugly, we will use is_ipc_irq() multiple times (in the handler and in the thread), so we should only disable the interrupt once.

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.

That's why we have irq_event :) Ideally, we won't call is_ipc_irq() if SOF_IRQ_IPC is set. Also, I think we need to disable irq, too if we get an interrupt on irq thread.

sdw_intel_thread(irq, hdev->sdw);
else if (hdev->sdw && is_sdw_intel_irq(hdev->sdw)) {
hda_sdw_int_enable(sdev, false);
sdw_intel_thread(irq, hdev->sdw);

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.

sorry. I don't understand the last two cases here. Aren't they exactly the same thing?

Also what's the point of using the irq_events since we will also test for is_ipc_irq and is_sdw_intel_irq() in the thread?

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.

sorry. I don't understand the last two cases here. Aren't they exactly the same thing?

if (sdev->irq_event & SOF_IRQ_SDW) means is_sdw_intel_irq() return true in the handler, and we already disable interrupt there. So we don't need to disable interrupt there. else means is_sdw_intel_irq() return false. So we test is_sdw_intel_irq() here again to make sure we will handle sdw interrupt if there is any. And we need to disable sdw interrupt here since we didn't disable it in the handler.

Also what's the point of using the irq_events since we will also test for is_ipc_irq and is_sdw_intel_irq() in the thread?

We don't have to test is irq again in the thread If irq_event is set. i.e. We will only test is irq when the test result is false on irq handler.

@bardliao

Copy link
Copy Markdown
Collaborator Author

@bardliao good work, but before we start changing the SoundWire handing of interrupts, we should first merge the IPC and stream interrupts on top of topic/sof-dev. If the end-goal is to merge all interrupt handlers as a single one, the first order of business is to merge the two non-SoundWire ones and have a full-cycle of validation on that topic alone.

@plbossart Agree, let's focus on merging IPC and stream interrupts first.

@plbossart
plbossart force-pushed the integration/soundwire-debug-fixes branch 5 times, most recently from 989e38e to ac926ce Compare November 18, 2019 20:40
@mengdonglin

mengdonglin commented Nov 19, 2019 •

Copy link
Copy Markdown

So this will depend on merging IPC and stream interrupts, RFC in #1483

So we can use single irq to handle both ipc and sdw interrupts.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
@plbossart

Copy link
Copy Markdown
Member

sorry @bardliao I am confused by all the previous comments and versions.
Can you restart with a new PR and I guess add PR #1483 then your soundwire changes on top (as a separate patch?)

@bardliao

Copy link
Copy Markdown
Collaborator Author

sorry @bardliao I am confused by all the previous comments and versions.
Can you restart with a new PR and I guess add PR #1483 then your soundwire changes on top (as a separate patch?)

@plbossart Yes, let's close this one.

@bardliao bardliao closed this Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants