On Wed, 09 Mar 2022 21:40:13 +0100, Cezary Rojewski wrote: > > 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. > > Signed-off-by: Cezary Rojewski <cezary.rojewski@xxxxxxxxx> Acked-by: Takashi Iwai <tiwai@xxxxxxx> thanks, Takashi > --- > include/sound/hdaudio.h | 2 ++ > include/sound/hdaudio_ext.h | 50 +++++++++++++++++++++++++++++++++++++ > 2 files changed, 52 insertions(+) > > diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h > index 6a90ce405e60..69907260b9ce 100644 > --- a/include/sound/hdaudio.h > +++ b/include/sound/hdaudio.h > @@ -448,6 +448,8 @@ static inline u16 snd_hdac_reg_readw(struct hdac_bus *bus, void __iomem *addr) > > #define snd_hdac_reg_writel(bus, addr, val) writel(val, addr) > #define snd_hdac_reg_readl(bus, addr) readl(addr) > +#define snd_hdac_reg_writeq(bus, addr, val) writeq(val, addr) > +#define snd_hdac_reg_readq(bus, addr) readq(addr) > > /* > * macros for easy use > diff --git a/include/sound/hdaudio_ext.h b/include/sound/hdaudio_ext.h > index b0c8e4936168..d26234f9ee46 100644 > --- a/include/sound/hdaudio_ext.h > +++ b/include/sound/hdaudio_ext.h > @@ -2,6 +2,8 @@ > #ifndef __SOUND_HDAUDIO_EXT_H > #define __SOUND_HDAUDIO_EXT_H > > +#include <linux/io-64-nonatomic-lo-hi.h> > +#include <linux/iopoll.h> > #include <sound/hdaudio.h> > > int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev, > @@ -144,6 +146,54 @@ void snd_hdac_ext_bus_link_power(struct hdac_device *codec, bool enable); > writew(((readw(addr + reg) & ~(mask)) | (val)), \ > addr + reg) > > +#define snd_hdac_adsp_writeb(chip, reg, value) \ > + snd_hdac_reg_writeb(chip, (chip)->dsp_ba + (reg), value) > +#define snd_hdac_adsp_readb(chip, reg) \ > + snd_hdac_reg_readb(chip, (chip)->dsp_ba + (reg)) > +#define snd_hdac_adsp_writew(chip, reg, value) \ > + snd_hdac_reg_writew(chip, (chip)->dsp_ba + (reg), value) > +#define snd_hdac_adsp_readw(chip, reg) \ > + snd_hdac_reg_readw(chip, (chip)->dsp_ba + (reg)) > +#define snd_hdac_adsp_writel(chip, reg, value) \ > + snd_hdac_reg_writel(chip, (chip)->dsp_ba + (reg), value) > +#define snd_hdac_adsp_readl(chip, reg) \ > + snd_hdac_reg_readl(chip, (chip)->dsp_ba + (reg)) > +#define snd_hdac_adsp_writeq(chip, reg, value) \ > + snd_hdac_reg_writeq(chip, (chip)->dsp_ba + (reg), value) > +#define snd_hdac_adsp_readq(chip, reg) \ > + snd_hdac_reg_readq(chip, (chip)->dsp_ba + (reg)) > + > +#define snd_hdac_adsp_updateb(chip, reg, mask, val) \ > + snd_hdac_adsp_writeb(chip, reg, \ > + (snd_hdac_adsp_readb(chip, reg) & ~(mask)) | (val)) > +#define snd_hdac_adsp_updatew(chip, reg, mask, val) \ > + snd_hdac_adsp_writew(chip, reg, \ > + (snd_hdac_adsp_readw(chip, reg) & ~(mask)) | (val)) > +#define snd_hdac_adsp_updatel(chip, reg, mask, val) \ > + snd_hdac_adsp_writel(chip, reg, \ > + (snd_hdac_adsp_readl(chip, reg) & ~(mask)) | (val)) > +#define snd_hdac_adsp_updateq(chip, reg, mask, val) \ > + snd_hdac_adsp_writeq(chip, reg, \ > + (snd_hdac_adsp_readq(chip, reg) & ~(mask)) | (val)) > + > +#define snd_hdac_adsp_readb_poll(chip, reg, val, cond, delay_us, timeout_us) \ > + readb_poll_timeout((chip)->dsp_ba + (reg), val, cond, \ > + delay_us, timeout_us) > +#define snd_hdac_adsp_readw_poll(chip, reg, val, cond, delay_us, timeout_us) \ > + readw_poll_timeout((chip)->dsp_ba + (reg), val, cond, \ > + delay_us, timeout_us) > +#define snd_hdac_adsp_readl_poll(chip, reg, val, cond, delay_us, timeout_us) \ > + readl_poll_timeout((chip)->dsp_ba + (reg), val, cond, \ > + delay_us, timeout_us) > +#define snd_hdac_adsp_readq_poll(chip, reg, val, cond, delay_us, timeout_us) \ > + readq_poll_timeout((chip)->dsp_ba + (reg), val, cond, \ > + delay_us, timeout_us) > +#define snd_hdac_stream_readb_poll(strm, reg, val, cond, delay_us, timeout_us) \ > + readb_poll_timeout((strm)->sd_addr + AZX_REG_ ## reg, val, cond, \ > + delay_us, timeout_us) > +#define snd_hdac_stream_readl_poll(strm, reg, val, cond, delay_us, timeout_us) \ > + readl_poll_timeout((strm)->sd_addr + AZX_REG_ ## reg, val, cond, \ > + delay_us, timeout_us) > > struct hdac_ext_device; > > -- > 2.25.1 >