summaryrefslogtreecommitdiffstats
path: root/sound/soc/sof
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-08-07 14:32:08 -0400
committerTakashi Iwai <tiwai@suse.de>2019-08-08 10:36:18 -0400
commit19abfefd4c7604993d1c31e098a3f48bdafe334d (patch)
treea0c62c7b642d4d1b02058548f44e94e485c44894 /sound/soc/sof
parent619a1f195f93276dc8c6e33fe057e007adc9c288 (diff)
ALSA: hda: Direct MMIO accesses
HD-audio drivers access to the mmio registers indirectly via the corresponding bus->io_ops callbacks. This is because some platform (notably Tegra SoC) requires the word-aligned access. But it's rather a rare case, and other platforms suffer from the penalties by indirect calls unnecessarily. This patch is an attempt to optimize and cleanup for this situation. Now the special aligned access is used only when a new kconfig CONFIG_SND_HDA_ALIGNED_MMIO is set. And the HD-audio core itself provides the aligned MMIO access helpers instead of the driver side. If Kconfig isn't set (as default), the standard helpers like readl() or writel() are used directly. A couple of places in ASoC Intel drivers have the access via io_ops reg_writel(), and they are replaced with the direct writel() calls. And now with this patch, the whole bus->io_ops becomes empty, so it's dropped completely. The bus initialization functions are changed accordingly as well to drop the whole bus->io_ops. Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/soc/sof')
-rw-r--r--sound/soc/sof/intel/hda-bus.c40
-rw-r--r--sound/soc/sof/intel/hda-dsp.c2
2 files changed, 1 insertions, 41 deletions
diff --git a/sound/soc/sof/intel/hda-bus.c b/sound/soc/sof/intel/hda-bus.c
index 0bc93fa06b5b..438121c70f99 100644
--- a/sound/soc/sof/intel/hda-bus.c
+++ b/sound/soc/sof/intel/hda-bus.c
@@ -21,45 +21,6 @@ static const struct hdac_bus_ops bus_ops = {
21 21
22#endif 22#endif
23 23
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 const struct hdac_io_ops io_ops = {
55 .reg_writel = sof_hda_writel,
56 .reg_readl = sof_hda_readl,
57 .reg_writew = sof_hda_writew,
58 .reg_readw = sof_hda_readw,
59 .reg_writeb = sof_hda_writeb,
60 .reg_readb = sof_hda_readb,
61};
62
63/* 24/*
64 * This can be used for both with/without hda link support. 25 * This can be used for both with/without hda link support.
65 */ 26 */
@@ -69,7 +30,6 @@ void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev,
69 memset(bus, 0, sizeof(*bus)); 30 memset(bus, 0, sizeof(*bus));
70 bus->dev = dev; 31 bus->dev = dev;
71 32
72 bus->io_ops = &io_ops;
73 INIT_LIST_HEAD(&bus->stream_list); 33 INIT_LIST_HEAD(&bus->stream_list);
74 34
75 bus->irq = -1; 35 bus->irq = -1;
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