Unverified Commit c1156cce authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: Intel: AVS - Audio DSP for cAVS

Merge series from Cezary Rojewski <cezary.rojewski@intel.com>:

A continuation of cleanup work of Intel SST solutions found in
sound/soc/intel/. With two major chapters released last year catpt [1]
and removal of haswell solution [2], time has come for Skylake-driver.

Througout 2019, 2020 and 2021 Skylake-driver has had many fixes applied
and even attempts of refactors as seen in fundamental overhaul [3], IPC
flow adjustments [4] and LARGE_CONFIG overhaul [5] series.
Unfortunately, story repeats itself - problems are found within the core
of a driver. Painting it with different colors does not change the fact
that is it still a house of cards. As changes needed to address those
issues would make Skylake solution incompatible with its previous
revisions, a decision has been made to provide a new solution instead.
In time it would deprecate and replace Skylake-driver.

That solution has been called AVS - from AudioDSP architecture name:
Audio-Voice-Speech. It is meant to provide support for the exact same
range of platforms as its predecessor: SKL, KBL, AML and APL.

Note: this series is dependent upon HDA-series [6] which exposes several
codec-organization functions allowing for reduced code size on
avs-driver side.

Note: this series does not add fully functional driver as its size would
get out of control. Here, focus is put on adding IPC protocol and code
loading code.
parents 375a347d 092cf7b2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/pm_runtime.h>
#include <linux/timecounter.h>
#include <sound/core.h>
@@ -448,6 +449,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
+50 −0
Original line number Diff line number Diff line
@@ -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,
@@ -143,6 +145,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;

+1 −0
Original line number Diff line number Diff line
@@ -429,6 +429,7 @@ struct snd_soc_dapm_widget *snd_soc_dapm_new_control_unlocked(
		const struct snd_soc_dapm_widget *widget);
int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
				 struct snd_soc_dai *dai);
void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w);
int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card);
void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);

+12 −0
Original line number Diff line number Diff line
@@ -209,5 +209,17 @@ config SND_SOC_INTEL_KEEMBAY
	  If you have a Intel Keembay platform then enable this option
	  by saying Y or m.

config SND_SOC_INTEL_AVS
	tristate "Intel AVS driver"
	depends on PCI && ACPI
	depends on COMMON_CLK
	select SND_SOC_ACPI
	select SND_HDA_EXT_CORE
	select SND_HDA_DSP_LOADER
	help
	  Enable support for Intel(R) cAVS 1.5 platforms with DSP
	  capabilities. This includes Skylake, Kabylake, Amberlake and
	  Apollolake.

# ASoC codec drivers
source "sound/soc/intel/boards/Kconfig"
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM) += atom/
obj-$(CONFIG_SND_SOC_INTEL_CATPT) += catpt/
obj-$(CONFIG_SND_SOC_INTEL_SKYLAKE_COMMON) += skylake/
obj-$(CONFIG_SND_SOC_INTEL_KEEMBAY) += keembay/
obj-$(CONFIG_SND_SOC_INTEL_AVS) += avs/

# Machine support
obj-$(CONFIG_SND_SOC) += boards/
Loading