-
Notifications
You must be signed in to change notification settings - Fork 140
[SQUASHME] ASoC: SOF : hda: better split between HDA and non-HDA support #257
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 |
|---|---|---|
|
|
@@ -87,22 +87,21 @@ int sof_hda_bus_init(struct hdac_bus *bus, struct device *dev, | |
|
|
||
| bus->io_ops = &io_ops; | ||
| INIT_LIST_HEAD(&bus->stream_list); | ||
| INIT_LIST_HEAD(&bus->codec_list); | ||
|
|
||
| #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) | ||
| bus->ops = &bus_ops; | ||
| INIT_WORK(&bus->unsol_work, snd_hdac_bus_process_unsol_events); | ||
| #endif | ||
| spin_lock_init(&bus->reg_lock); | ||
| mutex_init(&bus->cmd_mutex); | ||
| bus->irq = -1; | ||
|
|
||
| bus->ext_ops = ext_ops; | ||
| INIT_LIST_HEAD(&bus->hlink_list); | ||
| bus->idx = idx++; | ||
|
|
||
| #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) | ||
| INIT_LIST_HEAD(&bus->codec_list); | ||
| INIT_LIST_HEAD(&bus->hlink_list); | ||
| spin_lock_init(&bus->reg_lock); | ||
| mutex_init(&bus->cmd_mutex); | ||
| mutex_init(&bus->lock); | ||
| bus->ops = &bus_ops; | ||
| INIT_WORK(&bus->unsol_work, snd_hdac_bus_process_unsol_events); | ||
| bus->cmd_dma_state = true; | ||
| #endif | ||
|
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. some members such as hlink_list is a general member and will be used in other places.
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. @libinyang sorry, don't get your point. are you saying that hda-dai.c doesn't compile when CONFIG_SND_SOC_SOF_HDA is unselected? 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. You are right. In this case, it is still in the CONFIG_SND_SOC_SOF_HDA.
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. Not able to follow these comments, too many double-negatives. I also find suspicious that hlink_list can be parked under the SOF_HDA config, @keyonjie can you double check? Also for the bus_idx it'd be nice to find a solution that doesn't rely on a static variable, maybe by doing the ref-counting at a higher level and passing the argument.
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. I went through hlink_list with Libin and confirmed that all hlink_list related codes are embraced in #ifdef CONFIG_SND_SOC_SOF_HDA. For bus_idx, I can imagine the potential issue here when doing module unload/reload, sorry the time is used up today, let me figure out a solution for it next Monday.
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. so the list is wrong per the discussion on #279, reg_lock is required in all cases?
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. yes, let's move reg_lock out. |
||
|
|
||
| return 0; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -601,7 +601,6 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev) | |
| } | ||
|
|
||
| /* mem alloc for the position buffer */ | ||
| /* TODO: check position buffer update */ | ||
| ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev, | ||
| SOF_HDA_DPIB_ENTRY_SIZE * num_total, | ||
| &bus->posbuf); | ||
|
|
@@ -610,13 +609,15 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev) | |
| return -ENOMEM; | ||
| } | ||
|
|
||
| #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) | ||
| /* mem alloc for the CORB/RIRB ringbuffers */ | ||
| ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev, | ||
| PAGE_SIZE, &bus->rb); | ||
| if (ret < 0) { | ||
| dev_err(sdev->dev, "error: RB alloc failed\n"); | ||
| return -ENOMEM; | ||
| } | ||
| #endif | ||
|
|
||
| /* create capture streams */ | ||
| for (i = 0; i < num_capture; i++) { | ||
|
|
@@ -643,14 +644,6 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev) | |
| SOF_HDA_SPIB_MAXFIFO; | ||
| } | ||
|
|
||
| #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_DRSM) | ||
| /* FIXME: Remove? HDAC doesn't use DRSM so has no drsm_addr */ | ||
| /* do we support DRSM */ | ||
| if (sdev->bar[HDA_DSP_DRSM_BAR]) | ||
| stream->drsm_addr = sdev->bar[HDA_DSP_DRSM_BAR] + | ||
| SOF_HDA_DRSM_BASE + SOF_HDA_DRSM_INTERVAL * i; | ||
| #endif | ||
|
|
||
| hstream = &stream->hstream; | ||
|
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. What was this about? I don't even know what DRSM is, maybe worth sharing and educating the rest of us?
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. That is for HDA DMA resume capabilities, which support resume from DPIB/LPIB, we haven't enabled it yet.
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. Humm, how would it work since we take the DSP off on suspend. You'd be missing a lot of context and resuming the DMA might not be that useful. What is the expectation here and was it supported in the SKL and legacy drivers?
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. It is supported in SKL driver. In SOF driver, it is a missing feature at the moment, we are relying on ALSA resume which means the resume point may be not so accurate in my opinion.
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. For my education, where do you see this supported in SKL? |
||
| hstream->bus = bus; | ||
| hstream->sd_int_sta_mask = 1 << i; | ||
|
|
@@ -701,14 +694,6 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev) | |
| SOF_HDA_SPIB_MAXFIFO; | ||
| } | ||
|
|
||
| #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_DRSM) | ||
| /* FIXME: Remove? HDAC doesn't use DRSM so has no drsm_addr */ | ||
| /* do we support DRSM */ | ||
| if (sdev->bar[HDA_DSP_DRSM_BAR]) | ||
| stream->drsm_addr = sdev->bar[HDA_DSP_DRSM_BAR] + | ||
| SOF_HDA_DRSM_BASE + SOF_HDA_DRSM_INTERVAL * i; | ||
| #endif | ||
|
|
||
| hstream = &stream->hstream; | ||
| hstream->bus = bus; | ||
| hstream->sd_int_sta_mask = 1 << i; | ||
|
|
@@ -747,6 +732,12 @@ void hda_dsp_stream_free(struct snd_sof_dev *sdev) | |
| if (bus->posbuf.area) | ||
| snd_dma_free_pages(&bus->posbuf); | ||
|
|
||
| #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) | ||
| /* free position buffer */ | ||
| if (bus->rb.area) | ||
| snd_dma_free_pages(&bus->rb); | ||
| #endif | ||
|
|
||
|
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. Can you split this RB part to a fix in a separate patch, this is not controversial and can be merged without issues.
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. Sure, Rander is doing this(#280 ) so let me remove this part. |
||
| list_for_each_entry_safe(s, _s, &bus->stream_list, list) { | ||
| /* TODO: decouple */ | ||
|
|
||
|
|
||
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.
Maybe add a comment that ext_ops is NULL except for the HDA_CODEC case