Skip to content

Commit 7579790

Browse files
crojewsk-inteltiwai
authored andcommitted
ALSA: hda: Fix compilation of snd_hdac_adsp_xxx() helpers
The snd_hdac_adsp_xxx() wrap snd_hdac_reg_xxx() helpers to simplify register access for AudioDSP drivers e.g.: the avs-driver. Byte- and word-variants of said helps do not expand to bare readx/writex() operations but functions instead and, due to pointer type incompatibility, cause compilation to fail. As the macros are utilized by the avs-driver alone, relocate the code introduced with commit c19bd02 ("ALSA: hda: Add helper macros for DSP capable devices") into the avs/ directory and update it to operate on 'adev' i.e.: the avs-driver-context directly to fix the issue. Fixes: c19bd02 ("ALSA: hda: Add helper macros for DSP capable devices") Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Acked-by: Mark Brown <broonie@kernel.org> Link: https://patch.msgid.link/20250110113326.3809897-2-cezary.rojewski@intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent a111aee commit 7579790

5 files changed

Lines changed: 48 additions & 45 deletions

File tree

include/sound/hdaudio_ext.h

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#ifndef __SOUND_HDAUDIO_EXT_H
33
#define __SOUND_HDAUDIO_EXT_H
44

5-
#include <linux/io-64-nonatomic-lo-hi.h>
6-
#include <linux/iopoll.h>
75
#include <sound/hdaudio.h>
86

97
int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
@@ -119,49 +117,6 @@ int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, struct hdac_ext_link *hlink)
119117

120118
void snd_hdac_ext_bus_link_power(struct hdac_device *codec, bool enable);
121119

122-
#define snd_hdac_adsp_writeb(chip, reg, value) \
123-
snd_hdac_reg_writeb(chip, (chip)->dsp_ba + (reg), value)
124-
#define snd_hdac_adsp_readb(chip, reg) \
125-
snd_hdac_reg_readb(chip, (chip)->dsp_ba + (reg))
126-
#define snd_hdac_adsp_writew(chip, reg, value) \
127-
snd_hdac_reg_writew(chip, (chip)->dsp_ba + (reg), value)
128-
#define snd_hdac_adsp_readw(chip, reg) \
129-
snd_hdac_reg_readw(chip, (chip)->dsp_ba + (reg))
130-
#define snd_hdac_adsp_writel(chip, reg, value) \
131-
snd_hdac_reg_writel(chip, (chip)->dsp_ba + (reg), value)
132-
#define snd_hdac_adsp_readl(chip, reg) \
133-
snd_hdac_reg_readl(chip, (chip)->dsp_ba + (reg))
134-
#define snd_hdac_adsp_writeq(chip, reg, value) \
135-
snd_hdac_reg_writeq(chip, (chip)->dsp_ba + (reg), value)
136-
#define snd_hdac_adsp_readq(chip, reg) \
137-
snd_hdac_reg_readq(chip, (chip)->dsp_ba + (reg))
138-
139-
#define snd_hdac_adsp_updateb(chip, reg, mask, val) \
140-
snd_hdac_adsp_writeb(chip, reg, \
141-
(snd_hdac_adsp_readb(chip, reg) & ~(mask)) | (val))
142-
#define snd_hdac_adsp_updatew(chip, reg, mask, val) \
143-
snd_hdac_adsp_writew(chip, reg, \
144-
(snd_hdac_adsp_readw(chip, reg) & ~(mask)) | (val))
145-
#define snd_hdac_adsp_updatel(chip, reg, mask, val) \
146-
snd_hdac_adsp_writel(chip, reg, \
147-
(snd_hdac_adsp_readl(chip, reg) & ~(mask)) | (val))
148-
#define snd_hdac_adsp_updateq(chip, reg, mask, val) \
149-
snd_hdac_adsp_writeq(chip, reg, \
150-
(snd_hdac_adsp_readq(chip, reg) & ~(mask)) | (val))
151-
152-
#define snd_hdac_adsp_readb_poll(chip, reg, val, cond, delay_us, timeout_us) \
153-
readb_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
154-
delay_us, timeout_us)
155-
#define snd_hdac_adsp_readw_poll(chip, reg, val, cond, delay_us, timeout_us) \
156-
readw_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
157-
delay_us, timeout_us)
158-
#define snd_hdac_adsp_readl_poll(chip, reg, val, cond, delay_us, timeout_us) \
159-
readl_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
160-
delay_us, timeout_us)
161-
#define snd_hdac_adsp_readq_poll(chip, reg, val, cond, delay_us, timeout_us) \
162-
readq_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
163-
delay_us, timeout_us)
164-
165120
struct hdac_ext_device;
166121

167122
/* ops common to all codec drivers */

sound/soc/intel/avs/apl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "avs.h"
1313
#include "messages.h"
1414
#include "path.h"
15+
#include "registers.h"
1516
#include "topology.h"
1617

1718
static irqreturn_t avs_apl_dsp_interrupt(struct avs_dev *adev)

sound/soc/intel/avs/cnl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <sound/hdaudio_ext.h>
1010
#include "avs.h"
1111
#include "messages.h"
12+
#include "registers.h"
1213

1314
static void avs_cnl_ipc_interrupt(struct avs_dev *adev)
1415
{

sound/soc/intel/avs/registers.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef __SOUND_SOC_INTEL_AVS_REGS_H
1010
#define __SOUND_SOC_INTEL_AVS_REGS_H
1111

12+
#include <linux/io-64-nonatomic-lo-hi.h>
13+
#include <linux/iopoll.h>
1214
#include <linux/sizes.h>
1315

1416
#define AZX_PCIREG_PGCTL 0x44
@@ -98,4 +100,47 @@
98100
#define avs_downlink_addr(adev) \
99101
avs_sram_addr(adev, AVS_DOWNLINK_WINDOW)
100102

103+
#define snd_hdac_adsp_writeb(adev, reg, value) \
104+
snd_hdac_reg_writeb(&(adev)->base.core, (adev)->dsp_ba + (reg), value)
105+
#define snd_hdac_adsp_readb(adev, reg) \
106+
snd_hdac_reg_readb(&(adev)->base.core, (adev)->dsp_ba + (reg))
107+
#define snd_hdac_adsp_writew(adev, reg, value) \
108+
snd_hdac_reg_writew(&(adev)->base.core, (adev)->dsp_ba + (reg), value)
109+
#define snd_hdac_adsp_readw(adev, reg) \
110+
snd_hdac_reg_readw(&(adev)->base.core, (adev)->dsp_ba + (reg))
111+
#define snd_hdac_adsp_writel(adev, reg, value) \
112+
snd_hdac_reg_writel(&(adev)->base.core, (adev)->dsp_ba + (reg), value)
113+
#define snd_hdac_adsp_readl(adev, reg) \
114+
snd_hdac_reg_readl(&(adev)->base.core, (adev)->dsp_ba + (reg))
115+
#define snd_hdac_adsp_writeq(adev, reg, value) \
116+
snd_hdac_reg_writeq(&(adev)->base.core, (adev)->dsp_ba + (reg), value)
117+
#define snd_hdac_adsp_readq(adev, reg) \
118+
snd_hdac_reg_readq(&(adev)->base.core, (adev)->dsp_ba + (reg))
119+
120+
#define snd_hdac_adsp_updateb(adev, reg, mask, val) \
121+
snd_hdac_adsp_writeb(adev, reg, \
122+
(snd_hdac_adsp_readb(adev, reg) & ~(mask)) | (val))
123+
#define snd_hdac_adsp_updatew(adev, reg, mask, val) \
124+
snd_hdac_adsp_writew(adev, reg, \
125+
(snd_hdac_adsp_readw(adev, reg) & ~(mask)) | (val))
126+
#define snd_hdac_adsp_updatel(adev, reg, mask, val) \
127+
snd_hdac_adsp_writel(adev, reg, \
128+
(snd_hdac_adsp_readl(adev, reg) & ~(mask)) | (val))
129+
#define snd_hdac_adsp_updateq(adev, reg, mask, val) \
130+
snd_hdac_adsp_writeq(adev, reg, \
131+
(snd_hdac_adsp_readq(adev, reg) & ~(mask)) | (val))
132+
133+
#define snd_hdac_adsp_readb_poll(adev, reg, val, cond, delay_us, timeout_us) \
134+
readb_poll_timeout((adev)->dsp_ba + (reg), val, cond, \
135+
delay_us, timeout_us)
136+
#define snd_hdac_adsp_readw_poll(adev, reg, val, cond, delay_us, timeout_us) \
137+
readw_poll_timeout((adev)->dsp_ba + (reg), val, cond, \
138+
delay_us, timeout_us)
139+
#define snd_hdac_adsp_readl_poll(adev, reg, val, cond, delay_us, timeout_us) \
140+
readl_poll_timeout((adev)->dsp_ba + (reg), val, cond, \
141+
delay_us, timeout_us)
142+
#define snd_hdac_adsp_readq_poll(adev, reg, val, cond, delay_us, timeout_us) \
143+
readq_poll_timeout((adev)->dsp_ba + (reg), val, cond, \
144+
delay_us, timeout_us)
145+
101146
#endif /* __SOUND_SOC_INTEL_AVS_REGS_H */

sound/soc/intel/avs/skl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "avs.h"
1313
#include "cldma.h"
1414
#include "messages.h"
15+
#include "registers.h"
1516

1617
void avs_skl_ipc_interrupt(struct avs_dev *adev)
1718
{

0 commit comments

Comments
 (0)