History

ALSA: hda: Add helper macros for DSP capable devices

HDAudio drivers make heavy use of I/O operations. Declare a range of update, read and write helpers similar to those available for HDAudio legacy driver. These macros are used by AVS driver to improve code readability.

Cezary Rojewski committed 4 years ago

Commit c19bd021 parent 6b6bb5e2 files · +53 −0Browse files

Showing the changes to include (2 of 2 files). Show all

Unified · Split

2 files
  1. include/sound/hdaudio.h +3 −0
  2. include/sound/hdaudio_ext.h +50 −0
include/sound/hdaudio.h+3−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include <linux/device.h>
1010 #include <linux/interrupt.h>
1111 #include <linux/io.h>
12+#include <linux/io-64-nonatomic-lo-hi.h>
1213 #include <linux/pm_runtime.h>
1314 #include <linux/timecounter.h>
1415 #include <sound/core.h>
@@ -448,6 +449,8 @@ static inline u16 snd_hdac_reg_readw(struct hdac_bus *bus, void __iomem *addr) · 433 unmodified lines
448449
449450 #define snd_hdac_reg_writel(bus, addr, val) writel(val, addr)
450451 #define snd_hdac_reg_readl(bus, addr) readl(addr)
452+#define snd_hdac_reg_writeq(bus, addr, val) writeq(val, addr)
453+#define snd_hdac_reg_readq(bus, addr) readq(addr)
451454
452455 /*
453456 * macros for easy use
include/sound/hdaudio_ext.h+50−0
@@ -2,6 +2,8 @@ · 1 unmodified line
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>
57 #include <sound/hdaudio.h>
68
79 int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
@@ -143,6 +145,54 @@ void snd_hdac_ext_bus_link_power(struct hdac_device *codec, bool enable); · 135 unmodified lines
143145 writew(((readw(addr + reg) & ~(mask)) | (val)), \
144146 addr + reg)
145147
148+#define snd_hdac_adsp_writeb(chip, reg, value) \
149+ snd_hdac_reg_writeb(chip, (chip)->dsp_ba + (reg), value)
150+#define snd_hdac_adsp_readb(chip, reg) \
151+ snd_hdac_reg_readb(chip, (chip)->dsp_ba + (reg))
152+#define snd_hdac_adsp_writew(chip, reg, value) \
153+ snd_hdac_reg_writew(chip, (chip)->dsp_ba + (reg), value)
154+#define snd_hdac_adsp_readw(chip, reg) \
155+ snd_hdac_reg_readw(chip, (chip)->dsp_ba + (reg))
156+#define snd_hdac_adsp_writel(chip, reg, value) \
157+ snd_hdac_reg_writel(chip, (chip)->dsp_ba + (reg), value)
158+#define snd_hdac_adsp_readl(chip, reg) \
159+ snd_hdac_reg_readl(chip, (chip)->dsp_ba + (reg))
160+#define snd_hdac_adsp_writeq(chip, reg, value) \
161+ snd_hdac_reg_writeq(chip, (chip)->dsp_ba + (reg), value)
162+#define snd_hdac_adsp_readq(chip, reg) \
163+ snd_hdac_reg_readq(chip, (chip)->dsp_ba + (reg))
164+
165+#define snd_hdac_adsp_updateb(chip, reg, mask, val) \
166+ snd_hdac_adsp_writeb(chip, reg, \
167+ (snd_hdac_adsp_readb(chip, reg) & ~(mask)) | (val))
168+#define snd_hdac_adsp_updatew(chip, reg, mask, val) \
169+ snd_hdac_adsp_writew(chip, reg, \
170+ (snd_hdac_adsp_readw(chip, reg) & ~(mask)) | (val))
171+#define snd_hdac_adsp_updatel(chip, reg, mask, val) \
172+ snd_hdac_adsp_writel(chip, reg, \
173+ (snd_hdac_adsp_readl(chip, reg) & ~(mask)) | (val))
174+#define snd_hdac_adsp_updateq(chip, reg, mask, val) \
175+ snd_hdac_adsp_writeq(chip, reg, \
176+ (snd_hdac_adsp_readq(chip, reg) & ~(mask)) | (val))
177+
178+#define snd_hdac_adsp_readb_poll(chip, reg, val, cond, delay_us, timeout_us) \
179+ readb_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
180+ delay_us, timeout_us)
181+#define snd_hdac_adsp_readw_poll(chip, reg, val, cond, delay_us, timeout_us) \
182+ readw_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
183+ delay_us, timeout_us)
184+#define snd_hdac_adsp_readl_poll(chip, reg, val, cond, delay_us, timeout_us) \
185+ readl_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
186+ delay_us, timeout_us)
187+#define snd_hdac_adsp_readq_poll(chip, reg, val, cond, delay_us, timeout_us) \
188+ readq_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
189+ delay_us, timeout_us)
190+#define snd_hdac_stream_readb_poll(strm, reg, val, cond, delay_us, timeout_us) \
191+ readb_poll_timeout((strm)->sd_addr + AZX_REG_ ## reg, val, cond, \
192+ delay_us, timeout_us)
193+#define snd_hdac_stream_readl_poll(strm, reg, val, cond, delay_us, timeout_us) \
194+ readl_poll_timeout((strm)->sd_addr + AZX_REG_ ## reg, val, cond, \
195+ delay_us, timeout_us)
146196
147197 struct hdac_ext_device;
148198

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t