-
Notifications
You must be signed in to change notification settings - Fork 140
Fix HDaudio probe/remove #274
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
8c4b558
36bc509
06f2402
90277c3
304a296
52e0435
bdfd569
aeb1db3
dc91aea
d8f615a
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 |
|---|---|---|
|
|
@@ -459,8 +459,11 @@ static int hda_init_caps(struct snd_sof_dev *sdev) | |
| ret = hda_dsp_ctrl_init_chip(sdev, true); | ||
| if (ret < 0) { | ||
| dev_err(bus->dev, "Init chip failed with ret: %d\n", ret); | ||
| if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) | ||
| snd_hdac_display_power(bus, false); | ||
| if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) { | ||
| ret = hda_codec_i915_put(sdev); | ||
| if (ret < 0) | ||
| return ret; | ||
| } | ||
| return ret; | ||
| } | ||
|
|
||
|
|
@@ -477,11 +480,9 @@ static int hda_init_caps(struct snd_sof_dev *sdev) | |
| hda_codec_probe_bus(sdev); | ||
|
|
||
| if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) { | ||
| ret = snd_hdac_display_power(bus, false); | ||
| if (ret < 0) { | ||
| dev_err(bus->dev, "Cannot turn off display power on i915\n"); | ||
| ret = hda_codec_i915_put(sdev); | ||
| if (ret < 0) | ||
| return ret; | ||
| } | ||
| } | ||
|
|
||
| /* | ||
|
|
@@ -563,15 +564,17 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) | |
| #endif | ||
|
|
||
| /* set up HDA base */ | ||
| bus = sof_to_bus(sdev); | ||
| ret = hda_init(sdev); | ||
| if (ret < 0) | ||
| return ret; | ||
| goto hdac_bus_unmap; | ||
|
|
||
| /* DSP base */ | ||
| sdev->bar[HDA_DSP_BAR] = pci_ioremap_bar(pci, HDA_DSP_BAR); | ||
| if (!sdev->bar[HDA_DSP_BAR]) { | ||
| dev_err(&pci->dev, "error: ioremap error\n"); | ||
| return -ENXIO; | ||
| ret = -ENXIO; | ||
| goto hdac_bus_unmap; | ||
| } | ||
|
|
||
| sdev->mmio_bar = HDA_DSP_BAR; | ||
|
|
@@ -595,7 +598,7 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) | |
| * not all errors are due to memory issues, but trying | ||
| * to free everything does not harm | ||
| */ | ||
| goto err; | ||
| goto free_streams; | ||
| } | ||
|
||
|
|
||
| /* | ||
|
|
@@ -619,7 +622,6 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) | |
| sdev->ipc_irq = sdev->hda->irq; | ||
| } | ||
|
|
||
| bus = sof_to_bus(sdev); | ||
| dev_dbg(sdev->dev, "using HDA IRQ %d\n", sdev->hda->irq); | ||
| ret = request_threaded_irq(sdev->hda->irq, hda_dsp_stream_interrupt, | ||
| hda_dsp_stream_threaded_handler, | ||
|
|
@@ -720,10 +722,11 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) | |
| pci_free_irq_vectors(pci); | ||
| free_streams: | ||
| hda_dsp_stream_free(sdev); | ||
| /* dsp_unmap: not currently used */ | ||
| iounmap(sdev->bar[HDA_DSP_BAR]); | ||
|
||
| hdac_bus_unmap: | ||
| iounmap(bus->remap_addr); | ||
| err: | ||
|
||
| /* disable DSP */ | ||
| snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL, | ||
| SOF_HDA_PPCTL_GPROCEN, 0); | ||
| return ret; | ||
|
||
| } | ||
|
|
||
|
|
@@ -756,10 +759,17 @@ int hda_dsp_remove(struct snd_sof_dev *sdev) | |
| SOF_HDA_PPCTL_GPROCEN, 0); | ||
|
|
||
| free_irq(sdev->ipc_irq, sdev); | ||
| free_irq(sdev->pci->irq, bus); | ||
| free_irq(sdev->hda->irq, bus); | ||
| pci_free_irq_vectors(pci); | ||
|
||
|
|
||
| hda_dsp_stream_free(sdev); | ||
|
|
||
| iounmap(sdev->bar[HDA_DSP_BAR]); | ||
| iounmap(bus->remap_addr); | ||
|
|
||
| if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) | ||
| hda_codec_i915_exit(sdev); | ||
|
|
||
|
||
| return 0; | ||
|
||
| } | ||
|
|
||
|
|
||
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.
This 'goto hdac_bus_unmap' is fine, but we may need add some error point e.g. 'dsp_bar_unmap' where we will do iounmap for sdev->bar[HDA_DSP_BAR].