summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-08-08 16:35:44 -0400
committerTakashi Iwai <tiwai@suse.de>2019-08-08 16:35:44 -0400
commit3a76a41ffbf94c49245f5050be97d389b7d28102 (patch)
tree4c713e97619a5ae91674fd6e744c7f776385aee1
parent118b2806a07605d6e3c880e35a5c472bfda7582f (diff)
parentd4ff1b3917a529bdc75592af6b1504ad6c4029f7 (diff)
Merge branch 'topic/hda-bus-ops-cleanup' into for-next
Pull HD-audio bus ops cleanups. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/sound/hdaudio.h69
-rw-r--r--include/sound/hdaudio_ext.h1
-rw-r--r--sound/hda/Kconfig3
-rw-r--r--sound/hda/ext/hdac_ext_bus.c60
-rw-r--r--sound/hda/hdac_bus.c36
-rw-r--r--sound/hda/hdac_controller.c18
-rw-r--r--sound/hda/hdac_stream.c8
-rw-r--r--sound/pci/hda/Kconfig1
-rw-r--r--sound/pci/hda/hda_controller.c6
-rw-r--r--sound/pci/hda/hda_controller.h3
-rw-r--r--sound/pci/hda/hda_intel.c71
-rw-r--r--sound/pci/hda/hda_tegra.c84
-rw-r--r--sound/soc/intel/skylake/skl-messages.c15
-rw-r--r--sound/soc/intel/skylake/skl.c7
-rw-r--r--sound/soc/sof/intel/hda-bus.c85
-rw-r--r--sound/soc/sof/intel/hda-dsp.c2
-rw-r--r--sound/soc/sof/intel/hda.c6
-rw-r--r--sound/soc/sof/intel/hda.h3
18 files changed, 107 insertions, 371 deletions
diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
index 612a17e375d0..4af4af55e854 100644
--- a/include/sound/hdaudio.h
+++ b/include/sound/hdaudio.h
@@ -253,24 +253,6 @@ struct hdac_ext_bus_ops {
253 int (*hdev_detach)(struct hdac_device *hdev); 253 int (*hdev_detach)(struct hdac_device *hdev);
254}; 254};
255 255
256/*
257 * Lowlevel I/O operators
258 */
259struct hdac_io_ops {
260 /* mapped register accesses */
261 void (*reg_writel)(u32 value, u32 __iomem *addr);
262 u32 (*reg_readl)(u32 __iomem *addr);
263 void (*reg_writew)(u16 value, u16 __iomem *addr);
264 u16 (*reg_readw)(u16 __iomem *addr);
265 void (*reg_writeb)(u8 value, u8 __iomem *addr);
266 u8 (*reg_readb)(u8 __iomem *addr);
267 /* Allocation ops */
268 int (*dma_alloc_pages)(struct hdac_bus *bus, int type, size_t size,
269 struct snd_dma_buffer *buf);
270 void (*dma_free_pages)(struct hdac_bus *bus,
271 struct snd_dma_buffer *buf);
272};
273
274#define HDA_UNSOL_QUEUE_SIZE 64 256#define HDA_UNSOL_QUEUE_SIZE 64
275#define HDA_MAX_CODECS 8 /* limit by controller side */ 257#define HDA_MAX_CODECS 8 /* limit by controller side */
276 258
@@ -304,7 +286,6 @@ struct hdac_rb {
304struct hdac_bus { 286struct hdac_bus {
305 struct device *dev; 287 struct device *dev;
306 const struct hdac_bus_ops *ops; 288 const struct hdac_bus_ops *ops;
307 const struct hdac_io_ops *io_ops;
308 const struct hdac_ext_bus_ops *ext_ops; 289 const struct hdac_ext_bus_ops *ext_ops;
309 290
310 /* h/w resources */ 291 /* h/w resources */
@@ -344,6 +325,7 @@ struct hdac_bus {
344 /* CORB/RIRB and position buffers */ 325 /* CORB/RIRB and position buffers */
345 struct snd_dma_buffer rb; 326 struct snd_dma_buffer rb;
346 struct snd_dma_buffer posbuf; 327 struct snd_dma_buffer posbuf;
328 int dma_type; /* SNDRV_DMA_TYPE_XXX for CORB/RIRB */
347 329
348 /* hdac_stream linked list */ 330 /* hdac_stream linked list */
349 struct list_head stream_list; 331 struct list_head stream_list;
@@ -384,8 +366,7 @@ struct hdac_bus {
384}; 366};
385 367
386int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, 368int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
387 const struct hdac_bus_ops *ops, 369 const struct hdac_bus_ops *ops);
388 const struct hdac_io_ops *io_ops);
389void snd_hdac_bus_exit(struct hdac_bus *bus); 370void snd_hdac_bus_exit(struct hdac_bus *bus);
390int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr, 371int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr,
391 unsigned int cmd, unsigned int *res); 372 unsigned int cmd, unsigned int *res);
@@ -429,21 +410,38 @@ int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
429int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus); 410int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus);
430void snd_hdac_bus_free_stream_pages(struct hdac_bus *bus); 411void snd_hdac_bus_free_stream_pages(struct hdac_bus *bus);
431 412
413#ifdef CONFIG_SND_HDA_ALIGNED_MMIO
414unsigned int snd_hdac_aligned_read(void __iomem *addr, unsigned int mask);
415void snd_hdac_aligned_write(unsigned int val, void __iomem *addr,
416 unsigned int mask);
417#define snd_hdac_reg_writeb(v, addr) snd_hdac_aligned_write(v, addr, 0xff)
418#define snd_hdac_reg_writew(v, addr) snd_hdac_aligned_write(v, addr, 0xffff)
419#define snd_hdac_reg_readb(addr) snd_hdac_aligned_read(addr, 0xff)
420#define snd_hdac_reg_readw(addr) snd_hdac_aligned_read(addr, 0xffff)
421#else /* CONFIG_SND_HDA_ALIGNED_MMIO */
422#define snd_hdac_reg_writeb(val, addr) writeb(val, addr)
423#define snd_hdac_reg_writew(val, addr) writew(val, addr)
424#define snd_hdac_reg_readb(addr) readb(addr)
425#define snd_hdac_reg_readw(addr) readw(addr)
426#endif /* CONFIG_SND_HDA_ALIGNED_MMIO */
427#define snd_hdac_reg_writel(val, addr) writel(val, addr)
428#define snd_hdac_reg_readl(addr) readl(addr)
429
432/* 430/*
433 * macros for easy use 431 * macros for easy use
434 */ 432 */
435#define _snd_hdac_chip_writeb(chip, reg, value) \ 433#define _snd_hdac_chip_writeb(chip, reg, value) \
436 ((chip)->io_ops->reg_writeb(value, (chip)->remap_addr + (reg))) 434 snd_hdac_reg_writeb(value, (chip)->remap_addr + (reg))
437#define _snd_hdac_chip_readb(chip, reg) \ 435#define _snd_hdac_chip_readb(chip, reg) \
438 ((chip)->io_ops->reg_readb((chip)->remap_addr + (reg))) 436 snd_hdac_reg_readb((chip)->remap_addr + (reg))
439#define _snd_hdac_chip_writew(chip, reg, value) \ 437#define _snd_hdac_chip_writew(chip, reg, value) \
440 ((chip)->io_ops->reg_writew(value, (chip)->remap_addr + (reg))) 438 snd_hdac_reg_writew(value, (chip)->remap_addr + (reg))
441#define _snd_hdac_chip_readw(chip, reg) \ 439#define _snd_hdac_chip_readw(chip, reg) \
442 ((chip)->io_ops->reg_readw((chip)->remap_addr + (reg))) 440 snd_hdac_reg_readw((chip)->remap_addr + (reg))
443#define _snd_hdac_chip_writel(chip, reg, value) \ 441#define _snd_hdac_chip_writel(chip, reg, value) \
444 ((chip)->io_ops->reg_writel(value, (chip)->remap_addr + (reg))) 442 snd_hdac_reg_writel(value, (chip)->remap_addr + (reg))
445#define _snd_hdac_chip_readl(chip, reg) \ 443#define _snd_hdac_chip_readl(chip, reg) \
446 ((chip)->io_ops->reg_readl((chip)->remap_addr + (reg))) 444 snd_hdac_reg_readl((chip)->remap_addr + (reg))
447 445
448/* read/write a register, pass without AZX_REG_ prefix */ 446/* read/write a register, pass without AZX_REG_ prefix */
449#define snd_hdac_chip_writel(chip, reg, value) \ 447#define snd_hdac_chip_writel(chip, reg, value) \
@@ -548,24 +546,19 @@ int snd_hdac_get_stream_stripe_ctl(struct hdac_bus *bus,
548/* 546/*
549 * macros for easy use 547 * macros for easy use
550 */ 548 */
551#define _snd_hdac_stream_write(type, dev, reg, value) \
552 ((dev)->bus->io_ops->reg_write ## type(value, (dev)->sd_addr + (reg)))
553#define _snd_hdac_stream_read(type, dev, reg) \
554 ((dev)->bus->io_ops->reg_read ## type((dev)->sd_addr + (reg)))
555
556/* read/write a register, pass without AZX_REG_ prefix */ 549/* read/write a register, pass without AZX_REG_ prefix */
557#define snd_hdac_stream_writel(dev, reg, value) \ 550#define snd_hdac_stream_writel(dev, reg, value) \
558 _snd_hdac_stream_write(l, dev, AZX_REG_ ## reg, value) 551 snd_hdac_reg_writel(value, (dev)->sd_addr + AZX_REG_ ## reg)
559#define snd_hdac_stream_writew(dev, reg, value) \ 552#define snd_hdac_stream_writew(dev, reg, value) \
560 _snd_hdac_stream_write(w, dev, AZX_REG_ ## reg, value) 553 snd_hdac_reg_writew(value, (dev)->sd_addr + AZX_REG_ ## reg)
561#define snd_hdac_stream_writeb(dev, reg, value) \ 554#define snd_hdac_stream_writeb(dev, reg, value) \
562 _snd_hdac_stream_write(b, dev, AZX_REG_ ## reg, value) 555 snd_hdac_reg_writeb(value, (dev)->sd_addr + AZX_REG_ ## reg)
563#define snd_hdac_stream_readl(dev, reg) \ 556#define snd_hdac_stream_readl(dev, reg) \
564 _snd_hdac_stream_read(l, dev, AZX_REG_ ## reg) 557 snd_hdac_reg_readl((dev)->sd_addr + AZX_REG_ ## reg)
565#define snd_hdac_stream_readw(dev, reg) \ 558#define snd_hdac_stream_readw(dev, reg) \
566 _snd_hdac_stream_read(w, dev, AZX_REG_ ## reg) 559 snd_hdac_reg_readw((dev)->sd_addr + AZX_REG_ ## reg)
567#define snd_hdac_stream_readb(dev, reg) \ 560#define snd_hdac_stream_readb(dev, reg) \
568 _snd_hdac_stream_read(b, dev, AZX_REG_ ## reg) 561 snd_hdac_reg_readb((dev)->sd_addr + AZX_REG_ ## reg)
569 562
570/* update a register, pass without AZX_REG_ prefix */ 563/* update a register, pass without AZX_REG_ prefix */
571#define snd_hdac_stream_updatel(dev, reg, mask, val) \ 564#define snd_hdac_stream_updatel(dev, reg, mask, val) \
diff --git a/include/sound/hdaudio_ext.h b/include/sound/hdaudio_ext.h
index f34aced69ca8..ef88b20c7b0a 100644
--- a/include/sound/hdaudio_ext.h
+++ b/include/sound/hdaudio_ext.h
@@ -6,7 +6,6 @@
6 6
7int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev, 7int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
8 const struct hdac_bus_ops *ops, 8 const struct hdac_bus_ops *ops,
9 const struct hdac_io_ops *io_ops,
10 const struct hdac_ext_bus_ops *ext_ops); 9 const struct hdac_ext_bus_ops *ext_ops);
11 10
12void snd_hdac_ext_bus_exit(struct hdac_bus *bus); 11void snd_hdac_ext_bus_exit(struct hdac_bus *bus);
diff --git a/sound/hda/Kconfig b/sound/hda/Kconfig
index 9ccbcb5a06bd..3d33fc1757ba 100644
--- a/sound/hda/Kconfig
+++ b/sound/hda/Kconfig
@@ -6,6 +6,9 @@ config SND_HDA_CORE
6config SND_HDA_DSP_LOADER 6config SND_HDA_DSP_LOADER
7 bool 7 bool
8 8
9config SND_HDA_ALIGNED_MMIO
10 bool
11
9config SND_HDA_COMPONENT 12config SND_HDA_COMPONENT
10 bool 13 bool
11 14
diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c
index 4f9f1d2a2ec5..242306d820ec 100644
--- a/sound/hda/ext/hdac_ext_bus.c
+++ b/sound/hda/ext/hdac_ext_bus.c
@@ -17,80 +17,22 @@
17MODULE_DESCRIPTION("HDA extended core"); 17MODULE_DESCRIPTION("HDA extended core");
18MODULE_LICENSE("GPL v2"); 18MODULE_LICENSE("GPL v2");
19 19
20static void hdac_ext_writel(u32 value, u32 __iomem *addr)
21{
22 writel(value, addr);
23}
24
25static u32 hdac_ext_readl(u32 __iomem *addr)
26{
27 return readl(addr);
28}
29
30static void hdac_ext_writew(u16 value, u16 __iomem *addr)
31{
32 writew(value, addr);
33}
34
35static u16 hdac_ext_readw(u16 __iomem *addr)
36{
37 return readw(addr);
38}
39
40static void hdac_ext_writeb(u8 value, u8 __iomem *addr)
41{
42 writeb(value, addr);
43}
44
45static u8 hdac_ext_readb(u8 __iomem *addr)
46{
47 return readb(addr);
48}
49
50static int hdac_ext_dma_alloc_pages(struct hdac_bus *bus, int type,
51 size_t size, struct snd_dma_buffer *buf)
52{
53 return snd_dma_alloc_pages(type, bus->dev, size, buf);
54}
55
56static void hdac_ext_dma_free_pages(struct hdac_bus *bus, struct snd_dma_buffer *buf)
57{
58 snd_dma_free_pages(buf);
59}
60
61static const struct hdac_io_ops hdac_ext_default_io = {
62 .reg_writel = hdac_ext_writel,
63 .reg_readl = hdac_ext_readl,
64 .reg_writew = hdac_ext_writew,
65 .reg_readw = hdac_ext_readw,
66 .reg_writeb = hdac_ext_writeb,
67 .reg_readb = hdac_ext_readb,
68 .dma_alloc_pages = hdac_ext_dma_alloc_pages,
69 .dma_free_pages = hdac_ext_dma_free_pages,
70};
71
72/** 20/**
73 * snd_hdac_ext_bus_init - initialize a HD-audio extended bus 21 * snd_hdac_ext_bus_init - initialize a HD-audio extended bus
74 * @ebus: the pointer to extended bus object 22 * @ebus: the pointer to extended bus object
75 * @dev: device pointer 23 * @dev: device pointer
76 * @ops: bus verb operators 24 * @ops: bus verb operators
77 * @io_ops: lowlevel I/O operators, can be NULL. If NULL core will use
78 * default ops 25 * default ops
79 * 26 *
80 * Returns 0 if successful, or a negative error code. 27 * Returns 0 if successful, or a negative error code.
81 */ 28 */
82int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev, 29int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
83 const struct hdac_bus_ops *ops, 30 const struct hdac_bus_ops *ops,
84 const struct hdac_io_ops *io_ops,
85 const struct hdac_ext_bus_ops *ext_ops) 31 const struct hdac_ext_bus_ops *ext_ops)
86{ 32{
87 int ret; 33 int ret;
88 34
89 /* check if io ops are provided, if not load the defaults */ 35 ret = snd_hdac_bus_init(bus, dev, ops);
90 if (io_ops == NULL)
91 io_ops = &hdac_ext_default_io;
92
93 ret = snd_hdac_bus_init(bus, dev, ops, io_ops);
94 if (ret < 0) 36 if (ret < 0)
95 return ret; 37 return ret;
96 38
diff --git a/sound/hda/hdac_bus.c b/sound/hda/hdac_bus.c
index 14e57ffd5bc1..dc2523ef7d98 100644
--- a/sound/hda/hdac_bus.c
+++ b/sound/hda/hdac_bus.c
@@ -19,13 +19,11 @@ static const struct hdac_bus_ops default_ops = {
19 * snd_hdac_bus_init - initialize a HD-audio bas bus 19 * snd_hdac_bus_init - initialize a HD-audio bas bus
20 * @bus: the pointer to bus object 20 * @bus: the pointer to bus object
21 * @ops: bus verb operators 21 * @ops: bus verb operators
22 * @io_ops: lowlevel I/O operators
23 * 22 *
24 * Returns 0 if successful, or a negative error code. 23 * Returns 0 if successful, or a negative error code.
25 */ 24 */
26int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, 25int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
27 const struct hdac_bus_ops *ops, 26 const struct hdac_bus_ops *ops)
28 const struct hdac_io_ops *io_ops)
29{ 27{
30 memset(bus, 0, sizeof(*bus)); 28 memset(bus, 0, sizeof(*bus));
31 bus->dev = dev; 29 bus->dev = dev;
@@ -33,7 +31,7 @@ int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
33 bus->ops = ops; 31 bus->ops = ops;
34 else 32 else
35 bus->ops = &default_ops; 33 bus->ops = &default_ops;
36 bus->io_ops = io_ops; 34 bus->dma_type = SNDRV_DMA_TYPE_DEV;
37 INIT_LIST_HEAD(&bus->stream_list); 35 INIT_LIST_HEAD(&bus->stream_list);
38 INIT_LIST_HEAD(&bus->codec_list); 36 INIT_LIST_HEAD(&bus->codec_list);
39 INIT_WORK(&bus->unsol_work, snd_hdac_bus_process_unsol_events); 37 INIT_WORK(&bus->unsol_work, snd_hdac_bus_process_unsol_events);
@@ -217,3 +215,33 @@ void snd_hdac_bus_remove_device(struct hdac_bus *bus,
217 flush_work(&bus->unsol_work); 215 flush_work(&bus->unsol_work);
218} 216}
219EXPORT_SYMBOL_GPL(snd_hdac_bus_remove_device); 217EXPORT_SYMBOL_GPL(snd_hdac_bus_remove_device);
218
219#ifdef CONFIG_SND_HDA_ALIGNED_MMIO
220/* Helpers for aligned read/write of mmio space, for Tegra */
221unsigned int snd_hdac_aligned_read(void __iomem *addr, unsigned int mask)
222{
223 void __iomem *aligned_addr =
224 (void __iomem *)((unsigned long)(addr) & ~0x3);
225 unsigned int shift = ((unsigned long)(addr) & 0x3) << 3;
226 unsigned int v;
227
228 v = readl(aligned_addr);
229 return (v >> shift) & mask;
230}
231EXPORT_SYMBOL_GPL(snd_hdac_aligned_read);
232
233void snd_hdac_aligned_write(unsigned int val, void __iomem *addr,
234 unsigned int mask)
235{
236 void __iomem *aligned_addr =
237 (void __iomem *)((unsigned long)(addr) & ~0x3);
238 unsigned int shift = ((unsigned long)(addr) & 0x3) << 3;
239 unsigned int v;
240
241 v = readl(aligned_addr);
242 v &= ~(mask << shift);
243 v |= val << shift;
244 writel(v, aligned_addr);
245}
246EXPORT_SYMBOL_GPL(snd_hdac_aligned_write);
247#endif /* CONFIG_SND_HDA_ALIGNED_MMIO */
diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c
index 196bbc85699e..d3999e7b0705 100644
--- a/sound/hda/hdac_controller.c
+++ b/sound/hda/hdac_controller.c
@@ -577,12 +577,13 @@ int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus)
577{ 577{
578 struct hdac_stream *s; 578 struct hdac_stream *s;
579 int num_streams = 0; 579 int num_streams = 0;
580 int dma_type = bus->dma_type ? bus->dma_type : SNDRV_DMA_TYPE_DEV;
580 int err; 581 int err;
581 582
582 list_for_each_entry(s, &bus->stream_list, list) { 583 list_for_each_entry(s, &bus->stream_list, list) {
583 /* allocate memory for the BDL for each stream */ 584 /* allocate memory for the BDL for each stream */
584 err = bus->io_ops->dma_alloc_pages(bus, SNDRV_DMA_TYPE_DEV, 585 err = snd_dma_alloc_pages(dma_type, bus->dev,
585 BDL_SIZE, &s->bdl); 586 BDL_SIZE, &s->bdl);
586 num_streams++; 587 num_streams++;
587 if (err < 0) 588 if (err < 0)
588 return -ENOMEM; 589 return -ENOMEM;
@@ -591,16 +592,15 @@ int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus)
591 if (WARN_ON(!num_streams)) 592 if (WARN_ON(!num_streams))
592 return -EINVAL; 593 return -EINVAL;
593 /* allocate memory for the position buffer */ 594 /* allocate memory for the position buffer */
594 err = bus->io_ops->dma_alloc_pages(bus, SNDRV_DMA_TYPE_DEV, 595 err = snd_dma_alloc_pages(dma_type, bus->dev,
595 num_streams * 8, &bus->posbuf); 596 num_streams * 8, &bus->posbuf);
596 if (err < 0) 597 if (err < 0)
597 return -ENOMEM; 598 return -ENOMEM;
598 list_for_each_entry(s, &bus->stream_list, list) 599 list_for_each_entry(s, &bus->stream_list, list)
599 s->posbuf = (__le32 *)(bus->posbuf.area + s->index * 8); 600 s->posbuf = (__le32 *)(bus->posbuf.area + s->index * 8);
600 601
601 /* single page (at least 4096 bytes) must suffice for both ringbuffes */ 602 /* single page (at least 4096 bytes) must suffice for both ringbuffes */
602 return bus->io_ops->dma_alloc_pages(bus, SNDRV_DMA_TYPE_DEV, 603 return snd_dma_alloc_pages(dma_type, bus->dev, PAGE_SIZE, &bus->rb);
603 PAGE_SIZE, &bus->rb);
604} 604}
605EXPORT_SYMBOL_GPL(snd_hdac_bus_alloc_stream_pages); 605EXPORT_SYMBOL_GPL(snd_hdac_bus_alloc_stream_pages);
606 606
@@ -614,12 +614,12 @@ void snd_hdac_bus_free_stream_pages(struct hdac_bus *bus)
614 614
615 list_for_each_entry(s, &bus->stream_list, list) { 615 list_for_each_entry(s, &bus->stream_list, list) {
616 if (s->bdl.area) 616 if (s->bdl.area)
617 bus->io_ops->dma_free_pages(bus, &s->bdl); 617 snd_dma_free_pages(&s->bdl);
618 } 618 }
619 619
620 if (bus->rb.area) 620 if (bus->rb.area)
621 bus->io_ops->dma_free_pages(bus, &bus->rb); 621 snd_dma_free_pages(&bus->rb);
622 if (bus->posbuf.area) 622 if (bus->posbuf.area)
623 bus->io_ops->dma_free_pages(bus, &bus->posbuf); 623 snd_dma_free_pages(&bus->posbuf);
624} 624}
625EXPORT_SYMBOL_GPL(snd_hdac_bus_free_stream_pages); 625EXPORT_SYMBOL_GPL(snd_hdac_bus_free_stream_pages);
diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
index 55d53b89ac21..fc68d4ce0a37 100644
--- a/sound/hda/hdac_stream.c
+++ b/sound/hda/hdac_stream.c
@@ -680,8 +680,8 @@ int snd_hdac_dsp_prepare(struct hdac_stream *azx_dev, unsigned int format,
680 azx_dev->locked = true; 680 azx_dev->locked = true;
681 spin_unlock_irq(&bus->reg_lock); 681 spin_unlock_irq(&bus->reg_lock);
682 682
683 err = bus->io_ops->dma_alloc_pages(bus, SNDRV_DMA_TYPE_DEV_SG, 683 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, bus->dev,
684 byte_size, bufp); 684 byte_size, bufp);
685 if (err < 0) 685 if (err < 0)
686 goto err_alloc; 686 goto err_alloc;
687 687
@@ -707,7 +707,7 @@ int snd_hdac_dsp_prepare(struct hdac_stream *azx_dev, unsigned int format,
707 return azx_dev->stream_tag; 707 return azx_dev->stream_tag;
708 708
709 error: 709 error:
710 bus->io_ops->dma_free_pages(bus, bufp); 710 snd_dma_free_pages(bufp);
711 err_alloc: 711 err_alloc:
712 spin_lock_irq(&bus->reg_lock); 712 spin_lock_irq(&bus->reg_lock);
713 azx_dev->locked = false; 713 azx_dev->locked = false;
@@ -754,7 +754,7 @@ void snd_hdac_dsp_cleanup(struct hdac_stream *azx_dev,
754 azx_dev->period_bytes = 0; 754 azx_dev->period_bytes = 0;
755 azx_dev->format_val = 0; 755 azx_dev->format_val = 0;
756 756
757 bus->io_ops->dma_free_pages(bus, dmab); 757 snd_dma_free_pages(dmab);
758 dmab->area = NULL; 758 dmab->area = NULL;
759 759
760 spin_lock_irq(&bus->reg_lock); 760 spin_lock_irq(&bus->reg_lock);
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index b5966014b5f7..dae47a45b2b8 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -36,6 +36,7 @@ config SND_HDA_TEGRA
36 tristate "NVIDIA Tegra HD Audio" 36 tristate "NVIDIA Tegra HD Audio"
37 depends on ARCH_TEGRA 37 depends on ARCH_TEGRA
38 select SND_HDA 38 select SND_HDA
39 select SND_HDA_ALIGNED_MMIO
39 help 40 help
40 Say Y here to support the HDA controller present in NVIDIA 41 Say Y here to support the HDA controller present in NVIDIA
41 Tegra SoCs 42 Tegra SoCs
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 4b4cb0fd5102..156930d0c9d3 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -1205,14 +1205,12 @@ void snd_hda_bus_reset(struct hda_bus *bus)
1205} 1205}
1206 1206
1207/* HD-audio bus initialization */ 1207/* HD-audio bus initialization */
1208int azx_bus_init(struct azx *chip, const char *model, 1208int azx_bus_init(struct azx *chip, const char *model)
1209 const struct hdac_io_ops *io_ops)
1210{ 1209{
1211 struct hda_bus *bus = &chip->bus; 1210 struct hda_bus *bus = &chip->bus;
1212 int err; 1211 int err;
1213 1212
1214 err = snd_hdac_bus_init(&bus->core, chip->card->dev, &bus_core_ops, 1213 err = snd_hdac_bus_init(&bus->core, chip->card->dev, &bus_core_ops);
1215 io_ops);
1216 if (err < 0) 1214 if (err < 0)
1217 return err; 1215 return err;
1218 1216
diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h
index baa15374fbcb..146a71e0d594 100644
--- a/sound/pci/hda/hda_controller.h
+++ b/sound/pci/hda/hda_controller.h
@@ -206,8 +206,7 @@ void azx_stop_chip(struct azx *chip);
206irqreturn_t azx_interrupt(int irq, void *dev_id); 206irqreturn_t azx_interrupt(int irq, void *dev_id);
207 207
208/* Codec interface */ 208/* Codec interface */
209int azx_bus_init(struct azx *chip, const char *model, 209int azx_bus_init(struct azx *chip, const char *model);
210 const struct hdac_io_ops *io_ops);
211int azx_probe_codecs(struct azx *chip, unsigned int max_slots); 210int azx_probe_codecs(struct azx *chip, unsigned int max_slots);
212int azx_codec_configure(struct azx *chip); 211int azx_codec_configure(struct azx *chip);
213int azx_init_streams(struct azx *chip); 212int azx_init_streams(struct azx *chip);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 2af1e0868e55..3a209e07d5d8 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1632,7 +1632,6 @@ static int default_bdl_pos_adj(struct azx *chip)
1632/* 1632/*
1633 * constructor 1633 * constructor
1634 */ 1634 */
1635static const struct hdac_io_ops pci_hda_io_ops;
1636static const struct hda_controller_ops pci_hda_ops; 1635static const struct hda_controller_ops pci_hda_ops;
1637 1636
1638static int azx_create(struct snd_card *card, struct pci_dev *pci, 1637static int azx_create(struct snd_card *card, struct pci_dev *pci,
@@ -1692,13 +1691,17 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
1692 else 1691 else
1693 chip->bdl_pos_adj = bdl_pos_adj[dev]; 1692 chip->bdl_pos_adj = bdl_pos_adj[dev];
1694 1693
1695 err = azx_bus_init(chip, model[dev], &pci_hda_io_ops); 1694 err = azx_bus_init(chip, model[dev]);
1696 if (err < 0) { 1695 if (err < 0) {
1697 kfree(hda); 1696 kfree(hda);
1698 pci_disable_device(pci); 1697 pci_disable_device(pci);
1699 return err; 1698 return err;
1700 } 1699 }
1701 1700
1701 /* use the non-cached pages in non-snoop mode */
1702 if (!azx_snoop(chip))
1703 azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_UC;
1704
1702 /* Workaround for a communication error on CFL (bko#199007) and CNL */ 1705 /* Workaround for a communication error on CFL (bko#199007) and CNL */
1703 if (IS_CFL(pci) || IS_CNL(pci)) 1706 if (IS_CFL(pci) || IS_CNL(pci))
1704 azx_bus(chip)->polling_mode = 1; 1707 azx_bus(chip)->polling_mode = 1;
@@ -1933,41 +1936,6 @@ static void azx_firmware_cb(const struct firmware *fw, void *context)
1933} 1936}
1934#endif 1937#endif
1935 1938
1936/*
1937 * HDA controller ops.
1938 */
1939
1940/* PCI register access. */
1941static void pci_azx_writel(u32 value, u32 __iomem *addr)
1942{
1943 writel(value, addr);
1944}
1945
1946static u32 pci_azx_readl(u32 __iomem *addr)
1947{
1948 return readl(addr);
1949}
1950
1951static void pci_azx_writew(u16 value, u16 __iomem *addr)
1952{
1953 writew(value, addr);
1954}
1955
1956static u16 pci_azx_readw(u16 __iomem *addr)
1957{
1958 return readw(addr);
1959}
1960
1961static void pci_azx_writeb(u8 value, u8 __iomem *addr)
1962{
1963 writeb(value, addr);
1964}
1965
1966static u8 pci_azx_readb(u8 __iomem *addr)
1967{
1968 return readb(addr);
1969}
1970
1971static int disable_msi_reset_irq(struct azx *chip) 1939static int disable_msi_reset_irq(struct azx *chip)
1972{ 1940{
1973 struct hdac_bus *bus = azx_bus(chip); 1941 struct hdac_bus *bus = azx_bus(chip);
@@ -1984,24 +1952,6 @@ static int disable_msi_reset_irq(struct azx *chip)
1984 return 0; 1952 return 0;
1985} 1953}
1986 1954
1987/* DMA page allocation helpers. */
1988static int dma_alloc_pages(struct hdac_bus *bus,
1989 int type,
1990 size_t size,
1991 struct snd_dma_buffer *buf)
1992{
1993 struct azx *chip = bus_to_azx(bus);
1994
1995 if (!azx_snoop(chip) && type == SNDRV_DMA_TYPE_DEV)
1996 type = SNDRV_DMA_TYPE_DEV_UC;
1997 return snd_dma_alloc_pages(type, bus->dev, size, buf);
1998}
1999
2000static void dma_free_pages(struct hdac_bus *bus, struct snd_dma_buffer *buf)
2001{
2002 snd_dma_free_pages(buf);
2003}
2004
2005static void pcm_mmap_prepare(struct snd_pcm_substream *substream, 1955static void pcm_mmap_prepare(struct snd_pcm_substream *substream,
2006 struct vm_area_struct *area) 1956 struct vm_area_struct *area)
2007{ 1957{
@@ -2013,17 +1963,6 @@ static void pcm_mmap_prepare(struct snd_pcm_substream *substream,
2013#endif 1963#endif
2014} 1964}
2015 1965
2016static const struct hdac_io_ops pci_hda_io_ops = {
2017 .reg_writel = pci_azx_writel,
2018 .reg_readl = pci_azx_readl,
2019 .reg_writew = pci_azx_writew,
2020 .reg_readw = pci_azx_readw,
2021 .reg_writeb = pci_azx_writeb,
2022 .reg_readb = pci_azx_readb,
2023 .dma_alloc_pages = dma_alloc_pages,
2024 .dma_free_pages = dma_free_pages,
2025};
2026
2027static const struct hda_controller_ops pci_hda_ops = { 1966static const struct hda_controller_ops pci_hda_ops = {
2028 .disable_msi_reset_irq = disable_msi_reset_irq, 1967 .disable_msi_reset_irq = disable_msi_reset_irq,
2029 .pcm_mmap_prepare = pcm_mmap_prepare, 1968 .pcm_mmap_prepare = pcm_mmap_prepare,
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c
index 7dbe9f39fc79..8350954b7986 100644
--- a/sound/pci/hda/hda_tegra.c
+++ b/sound/pci/hda/hda_tegra.c
@@ -75,88 +75,6 @@ MODULE_PARM_DESC(power_save,
75#define power_save 0 75#define power_save 0
76#endif 76#endif
77 77
78/*
79 * DMA page allocation ops.
80 */
81static int dma_alloc_pages(struct hdac_bus *bus, int type, size_t size,
82 struct snd_dma_buffer *buf)
83{
84 return snd_dma_alloc_pages(type, bus->dev, size, buf);
85}
86
87static void dma_free_pages(struct hdac_bus *bus, struct snd_dma_buffer *buf)
88{
89 snd_dma_free_pages(buf);
90}
91
92/*
93 * Register access ops. Tegra HDA register access is DWORD only.
94 */
95static void hda_tegra_writel(u32 value, u32 __iomem *addr)
96{
97 writel(value, addr);
98}
99
100static u32 hda_tegra_readl(u32 __iomem *addr)
101{
102 return readl(addr);
103}
104
105static void hda_tegra_writew(u16 value, u16 __iomem *addr)
106{
107 unsigned int shift = ((unsigned long)(addr) & 0x3) << 3;
108 void __iomem *dword_addr = (void __iomem *)((unsigned long)(addr) & ~0x3);
109 u32 v;
110
111 v = readl(dword_addr);
112 v &= ~(0xffff << shift);
113 v |= value << shift;
114 writel(v, dword_addr);
115}
116
117static u16 hda_tegra_readw(u16 __iomem *addr)
118{
119 unsigned int shift = ((unsigned long)(addr) & 0x3) << 3;
120 void __iomem *dword_addr = (void __iomem *)((unsigned long)(addr) & ~0x3);
121 u32 v;
122
123 v = readl(dword_addr);
124 return (v >> shift) & 0xffff;
125}
126
127static void hda_tegra_writeb(u8 value, u8 __iomem *addr)
128{
129 unsigned int shift = ((unsigned long)(addr) & 0x3) << 3;
130 void __iomem *dword_addr = (void __iomem *)((unsigned long)(addr) & ~0x3);
131 u32 v;
132
133 v = readl(dword_addr);
134 v &= ~(0xff << shift);
135 v |= value << shift;
136 writel(v, dword_addr);
137}
138
139static u8 hda_tegra_readb(u8 __iomem *addr)
140{
141 unsigned int shift = ((unsigned long)(addr) & 0x3) << 3;
142 void __iomem *dword_addr = (void __iomem *)((unsigned long)(addr) & ~0x3);
143 u32 v;
144
145 v = readl(dword_addr);
146 return (v >> shift) & 0xff;
147}
148
149static const struct hdac_io_ops hda_tegra_io_ops = {
150 .reg_writel = hda_tegra_writel,
151 .reg_readl = hda_tegra_readl,
152 .reg_writew = hda_tegra_writew,
153 .reg_readw = hda_tegra_readw,
154 .reg_writeb = hda_tegra_writeb,
155 .reg_readb = hda_tegra_readb,
156 .dma_alloc_pages = dma_alloc_pages,
157 .dma_free_pages = dma_free_pages,
158};
159
160static const struct hda_controller_ops hda_tegra_ops; /* nothing special */ 78static const struct hda_controller_ops hda_tegra_ops; /* nothing special */
161 79
162static void hda_tegra_init(struct hda_tegra *hda) 80static void hda_tegra_init(struct hda_tegra *hda)
@@ -475,7 +393,7 @@ static int hda_tegra_create(struct snd_card *card,
475 393
476 INIT_WORK(&hda->probe_work, hda_tegra_probe_work); 394 INIT_WORK(&hda->probe_work, hda_tegra_probe_work);
477 395
478 err = azx_bus_init(chip, NULL, &hda_tegra_io_ops); 396 err = azx_bus_init(chip, NULL);
479 if (err < 0) 397 if (err < 0)
480 return err; 398 return err;
481 399
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index febc070839e0..c6f9e05c929e 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -25,23 +25,12 @@
25static int skl_alloc_dma_buf(struct device *dev, 25static int skl_alloc_dma_buf(struct device *dev,
26 struct snd_dma_buffer *dmab, size_t size) 26 struct snd_dma_buffer *dmab, size_t size)
27{ 27{
28 struct hdac_bus *bus = dev_get_drvdata(dev); 28 return snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, dev, size, dmab);
29
30 if (!bus)
31 return -ENODEV;
32
33 return bus->io_ops->dma_alloc_pages(bus, SNDRV_DMA_TYPE_DEV, size, dmab);
34} 29}
35 30
36static int skl_free_dma_buf(struct device *dev, struct snd_dma_buffer *dmab) 31static int skl_free_dma_buf(struct device *dev, struct snd_dma_buffer *dmab)
37{ 32{
38 struct hdac_bus *bus = dev_get_drvdata(dev); 33 snd_dma_free_pages(dmab);
39
40 if (!bus)
41 return -ENODEV;
42
43 bus->io_ops->dma_free_pages(bus, dmab);
44
45 return 0; 34 return 0;
46} 35}
47 36
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 2b5159890a57..239348b0596b 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -134,7 +134,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset)
134 134
135 /* Reset stream-to-link mapping */ 135 /* Reset stream-to-link mapping */
136 list_for_each_entry(hlink, &bus->hlink_list, list) 136 list_for_each_entry(hlink, &bus->hlink_list, list)
137 bus->io_ops->reg_writel(0, hlink->ml_addr + AZX_REG_ML_LOSIDV); 137 writel(0, hlink->ml_addr + AZX_REG_ML_LOSIDV);
138 138
139 skl_enable_miscbdcge(bus->dev, true); 139 skl_enable_miscbdcge(bus->dev, true);
140 140
@@ -858,7 +858,6 @@ out_err:
858 * constructor 858 * constructor
859 */ 859 */
860static int skl_create(struct pci_dev *pci, 860static int skl_create(struct pci_dev *pci,
861 const struct hdac_io_ops *io_ops,
862 struct skl **rskl) 861 struct skl **rskl)
863{ 862{
864 struct hdac_ext_bus_ops *ext_ops = NULL; 863 struct hdac_ext_bus_ops *ext_ops = NULL;
@@ -888,7 +887,7 @@ static int skl_create(struct pci_dev *pci,
888#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC) 887#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC)
889 ext_ops = snd_soc_hdac_hda_get_ops(); 888 ext_ops = snd_soc_hdac_hda_get_ops();
890#endif 889#endif
891 snd_hdac_ext_bus_init(bus, &pci->dev, &bus_core_ops, io_ops, ext_ops); 890 snd_hdac_ext_bus_init(bus, &pci->dev, &bus_core_ops, ext_ops);
892 bus->use_posbuf = 1; 891 bus->use_posbuf = 1;
893 skl->pci = pci; 892 skl->pci = pci;
894 INIT_WORK(&skl->probe_work, skl_probe_work); 893 INIT_WORK(&skl->probe_work, skl_probe_work);
@@ -1017,7 +1016,7 @@ static int skl_probe(struct pci_dev *pci,
1017 } 1016 }
1018 1017
1019 /* we use ext core ops, so provide NULL for ops here */ 1018 /* we use ext core ops, so provide NULL for ops here */
1020 err = skl_create(pci, NULL, &skl); 1019 err = skl_create(pci, &skl);
1021 if (err < 0) 1020 if (err < 0)
1022 return err; 1021 return err;
1023 1022
diff --git a/sound/soc/sof/intel/hda-bus.c b/sound/soc/sof/intel/hda-bus.c
index a7e6d8227df6..0caec3a070d3 100644
--- a/sound/soc/sof/intel/hda-bus.c
+++ b/sound/soc/sof/intel/hda-bus.c
@@ -12,82 +12,26 @@
12#include "../sof-priv.h" 12#include "../sof-priv.h"
13#include "hda.h" 13#include "hda.h"
14 14
15#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) 15#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC)
16 16#define sof_hda_ext_ops snd_soc_hdac_hda_get_ops()
17static const struct hdac_bus_ops bus_ops = { 17#else
18 .command = snd_hdac_bus_send_cmd, 18#define sof_hda_ext_ops NULL
19 .get_response = snd_hdac_bus_get_response,
20};
21
22#endif 19#endif
23 20
24static void sof_hda_writel(u32 value, u32 __iomem *addr)
25{
26 writel(value, addr);
27}
28
29static u32 sof_hda_readl(u32 __iomem *addr)
30{
31 return readl(addr);
32}
33
34static void sof_hda_writew(u16 value, u16 __iomem *addr)
35{
36 writew(value, addr);
37}
38
39static u16 sof_hda_readw(u16 __iomem *addr)
40{
41 return readw(addr);
42}
43
44static void sof_hda_writeb(u8 value, u8 __iomem *addr)
45{
46 writeb(value, addr);
47}
48
49static u8 sof_hda_readb(u8 __iomem *addr)
50{
51 return readb(addr);
52}
53
54static int sof_hda_dma_alloc_pages(struct hdac_bus *bus, int type,
55 size_t size, struct snd_dma_buffer *buf)
56{
57 return snd_dma_alloc_pages(type, bus->dev, size, buf);
58}
59
60static void sof_hda_dma_free_pages(struct hdac_bus *bus,
61 struct snd_dma_buffer *buf)
62{
63 snd_dma_free_pages(buf);
64}
65
66static const struct hdac_io_ops io_ops = {
67 .reg_writel = sof_hda_writel,
68 .reg_readl = sof_hda_readl,
69 .reg_writew = sof_hda_writew,
70 .reg_readw = sof_hda_readw,
71 .reg_writeb = sof_hda_writeb,
72 .reg_readb = sof_hda_readb,
73 .dma_alloc_pages = sof_hda_dma_alloc_pages,
74 .dma_free_pages = sof_hda_dma_free_pages,
75};
76
77/* 21/*
78 * This can be used for both with/without hda link support. 22 * This can be used for both with/without hda link support.
79 */ 23 */
80void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev, 24void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev)
81 const struct hdac_ext_bus_ops *ext_ops)
82{ 25{
26#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
27 snd_hdac_ext_bus_init(bus, dev, NULL, sof_hda_ext_ops);
28#else /* CONFIG_SND_SOC_SOF_HDA */
83 memset(bus, 0, sizeof(*bus)); 29 memset(bus, 0, sizeof(*bus));
84 bus->dev = dev; 30 bus->dev = dev;
85 31
86 bus->io_ops = &io_ops;
87 INIT_LIST_HEAD(&bus->stream_list); 32 INIT_LIST_HEAD(&bus->stream_list);
88 33
89 bus->irq = -1; 34 bus->irq = -1;
90 bus->ext_ops = ext_ops;
91 35
92 /* 36 /*
93 * There is only one HDA bus atm. keep the index as 0. 37 * There is only one HDA bus atm. keep the index as 0.
@@ -96,16 +40,5 @@ void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev,
96 bus->idx = 0; 40 bus->idx = 0;
97 41
98 spin_lock_init(&bus->reg_lock); 42 spin_lock_init(&bus->reg_lock);
99 43#endif /* CONFIG_SND_SOC_SOF_HDA */
100#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
101 INIT_LIST_HEAD(&bus->codec_list);
102 INIT_LIST_HEAD(&bus->hlink_list);
103
104 mutex_init(&bus->cmd_mutex);
105 mutex_init(&bus->lock);
106 bus->ops = &bus_ops;
107 INIT_WORK(&bus->unsol_work, snd_hdac_bus_process_unsol_events);
108 bus->cmd_dma_state = true;
109#endif
110
111} 44}
diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index 91de4785b6a3..8d4ce5b4febd 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -356,7 +356,7 @@ static int hda_resume(struct snd_sof_dev *sdev)
356 356
357 /* Reset stream-to-link mapping */ 357 /* Reset stream-to-link mapping */
358 list_for_each_entry(hlink, &bus->hlink_list, list) 358 list_for_each_entry(hlink, &bus->hlink_list, list)
359 bus->io_ops->reg_writel(0, hlink->ml_addr + AZX_REG_ML_LOSIDV); 359 writel(0, hlink->ml_addr + AZX_REG_ML_LOSIDV);
360 360
361 hda_dsp_ctrl_misc_clock_gating(sdev, true); 361 hda_dsp_ctrl_misc_clock_gating(sdev, true);
362#else 362#else
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index 7f665392618f..7ca27000c34d 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -236,7 +236,6 @@ static int hda_init(struct snd_sof_dev *sdev)
236{ 236{
237 struct hda_bus *hbus; 237 struct hda_bus *hbus;
238 struct hdac_bus *bus; 238 struct hdac_bus *bus;
239 struct hdac_ext_bus_ops *ext_ops = NULL;
240 struct pci_dev *pci = to_pci_dev(sdev->dev); 239 struct pci_dev *pci = to_pci_dev(sdev->dev);
241 int ret; 240 int ret;
242 241
@@ -244,10 +243,7 @@ static int hda_init(struct snd_sof_dev *sdev)
244 bus = sof_to_bus(sdev); 243 bus = sof_to_bus(sdev);
245 244
246 /* HDA bus init */ 245 /* HDA bus init */
247#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) 246 sof_hda_bus_init(bus, &pci->dev);
248 ext_ops = snd_soc_hdac_hda_get_ops();
249#endif
250 sof_hda_bus_init(bus, &pci->dev, ext_ops);
251 247
252 /* Workaround for a communication error on CFL (bko#199007) and CNL */ 248 /* Workaround for a communication error on CFL (bko#199007) and CNL */
253 if (IS_CFL(pci) || IS_CNL(pci)) 249 if (IS_CFL(pci) || IS_CNL(pci))
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index d9c17146200b..75b096050fa2 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -549,8 +549,7 @@ void hda_dsp_ctrl_stop_chip(struct snd_sof_dev *sdev);
549/* 549/*
550 * HDA bus operations. 550 * HDA bus operations.
551 */ 551 */
552void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev, 552void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev);
553 const struct hdac_ext_bus_ops *ext_ops);
554 553
555#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) 554#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
556/* 555/*