diff --git a/sound/soc/sof/intel/hda-bus.c b/sound/soc/sof/intel/hda-bus.c index 759f1e61a0309c..17637241d76483 100644 --- a/sound/soc/sof/intel/hda-bus.c +++ b/sound/soc/sof/intel/hda-bus.c @@ -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 return 0; } diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c index aeaa1af787dbae..aa99d4f7817ede 100644 --- a/sound/soc/sof/intel/hda-dsp.c +++ b/sound/soc/sof/intel/hda-dsp.c @@ -272,7 +272,9 @@ int hda_dsp_core_reset_power_down(struct snd_sof_dev *sdev, static int hda_suspend(struct snd_sof_dev *sdev, int state) { const struct sof_intel_dsp_desc *chip = sdev->hda->desc; +#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) struct hdac_bus *bus = sof_to_bus(sdev); +#endif int ret = 0; #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) @@ -307,8 +309,10 @@ static int hda_suspend(struct snd_sof_dev *sdev, int state) static int hda_resume(struct snd_sof_dev *sdev) { const struct sof_intel_dsp_desc *chip = sdev->hda->desc; +#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) struct hdac_bus *bus = sof_to_bus(sdev); struct hdac_ext_link *hlink = NULL; +#endif int ret; /* diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c index 42a986ce35a08f..95c20ced83f312 100644 --- a/sound/soc/sof/intel/hda-stream.c +++ b/sound/soc/sof/intel/hda-stream.c @@ -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,6 +609,7 @@ 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); @@ -617,6 +617,7 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev) 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; 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 + list_for_each_entry_safe(s, _s, &bus->stream_list, list) { /* TODO: decouple */