ADD legacy audio driver support for rembrandt
Subsystems (3)
cover ADD legacy audio driver support for rembrandt
Add Generic driver to support multiple platform,
ADD HS control instance for Rembrandt platform.
Add nau8825,max98560 and rt5682s,rt1019 combination support for legacy platform.
v0--->v1
-- Kconfig syntax changes done
-- robot errors donesound/soc/amd/acp/acp-rembrandt.c:264:5: warning: no previous prototype for 'rmb_acp_init' [-Wmissing-prototypes] sound/soc/amd/acp/acp-rembrandt.c:264:5: warning: no previous prototype for 'rmb_acp_init' [-Wmissing-prototypes]
V sujith kumar Reddy (3):
ASoC: amd: acp: Remove rt1019_1 codec conf from machine driver
ASoC: amd: acp: ACP code generic to support newer platforms
ASoC: amd: acp: Add legacy audio driver support for Rembrandt platform
sound/soc/amd/acp/Kconfig | 11 + sound/soc/amd/acp/Makefile | 2 + sound/soc/amd/acp/acp-i2s.c | 169 +++++++++++- sound/soc/amd/acp/acp-legacy-mach.c | 32 +++ sound/soc/amd/acp/acp-mach-common.c | 104 +++++-- sound/soc/amd/acp/acp-mach.h | 6 + sound/soc/amd/acp/acp-pci.c | 6 + sound/soc/amd/acp/acp-pdm.c | 8 +- sound/soc/amd/acp/acp-platform.c | 32 ++- sound/soc/amd/acp/acp-rembrandt.c | 397 +++++++++++++++++++++++++++ sound/soc/amd/acp/acp-renoir.c | 38 ++- sound/soc/amd/acp/amd.h | 86 +++++- sound/soc/amd/acp/chip_offset_byte.h | 40 ++- 13 files changed, 862 insertions(+), 69 deletions(-) create mode 100644 sound/soc/amd/acp/acp-rembrandt.c
Signature · 1 line
2.25.1
PATCH 1/3 ASoC: amd: acp: Remove rt1019_1 codec conf from machine driver
Remove rt1019_1 codec configuration which has i2c-10EC1019:01 and i2c-10EC1019:02 codec components, Now Using default i2c-10EC1019:00 and i2c-10EC1019:01 codec components.
--- sound/soc/amd/acp/acp-mach-common.c | 18 ------------------ 1 file changed, 18 deletions(-)
sound/soc/amd/acp/acp-mach-common.c +0 -18
@@ -313,9 +313,6 @@ static const struct snd_soc_ops acp_card_dmic_ops = {SND_SOC_DAILINK_DEF (rt1019,DAILINK_COMP_ARRAY (COMP_CODEC ("i2c-10EC1019:00" ,"rt1019-aif" ),COMP_CODEC ("i2c-10EC1019:01" ,"rt1019-aif" ))); -SND_SOC_DAILINK_DEF (rt1019_1, -DAILINK_COMP_ARRAY (COMP_CODEC ("i2c-10EC1019:02" ,"rt1019-aif" ), -COMP_CODEC ("i2c-10EC1019:01" ,"rt1019-aif" )));static const struct snd_soc_dapm_route rt1019_map_lr[] = { {"Left Spk" ,NULL ,"Left SPO" },
@@ -333,17 +330,6 @@ static struct snd_soc_codec_conf rt1019_conf[] = { }, }; -static struct snd_soc_codec_conf rt1019_1_conf[] = { - { - .dlc =COMP_CODEC_CONF ("i2c-10EC1019:02" ), - .name_prefix ="Left" , - }, - { - .dlc =COMP_CODEC_CONF ("i2c-10EC1019:01" ), - .name_prefix ="Right" , - }, -}; -static int acp_card_rt1019_init (struct snd_soc_pcm_runtime *rtd) {struct snd_soc_card *card = rtd->card;
@@ -716,10 +702,6 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card) links[i].init = acp_card_rt1019_init; card->codec_conf = rt1019_conf; card->num_configs =ARRAY_SIZE (rt1019_conf); - links[i].codecs = rt1019_1; - links[i].num_codecs =ARRAY_SIZE (rt1019_1); - card->codec_conf = rt1019_1_conf; - card->num_configs =ARRAY_SIZE (rt1019_1_conf); } i++; }
Signature · 1 line
2.25.1
PATCH 2/3 ASoC: amd: acp: ACP code generic to support newer platforms
In reply to V sujith kumar ReddyADD Generic code to support to newer platforms, add control threshold, irq control macros ,added structure for register offset differences.
--- sound/soc/amd/acp/acp-i2s.c | 34 +++++++++++++++---------- sound/soc/amd/acp/acp-pdm.c | 8 +++--- sound/soc/amd/acp/acp-platform.c | 16 +++++++----- sound/soc/amd/acp/acp-renoir.c | 38 ++++++++++++++++++++-------- sound/soc/amd/acp/amd.h | 24 +++++++++++++----- sound/soc/amd/acp/chip_offset_byte.h | 12 +++++---- 6 files changed, 86 insertions(+), 46 deletions(-)
sound/soc/amd/acp/acp-i2s.c +20 -14
@@ -199,6 +199,7 @@ static int acp_i2s_prepare(struct snd_pcm_substream *substream, struct snd_soc_d {struct device *dev = dai->component->dev;struct acp_dev_data *adata =dev_get_drvdata (dev); +struct acp_resource *rsrc = adata->rsrc;struct acp_stream *stream = substream->runtime->private_data;u32 reg_dma_size =0 , reg_fifo_size =0 , reg_fifo_addr =0 ;u32 phy_addr =0 , acp_fifo_addr =0 , ext_int_ctrl;
@@ -208,7 +209,7 @@ static int acp_i2s_prepare(struct snd_pcm_substream *substream, struct snd_soc_dcase I2S_SP_INSTANCE :if (dir ==SNDRV_PCM_STREAM_PLAYBACK ) { reg_dma_size =ACP_I2S_TX_DMA_SIZE ; - acp_fifo_addr =ACP_SRAM_PTE_OFFSET + + acp_fifo_addr = rsrc->sram_pte_offset +SP_PB_FIFO_ADDR_OFFSET ; reg_fifo_addr =ACP_I2S_TX_FIFOADDR ; reg_fifo_size =ACP_I2S_TX_FIFOSIZE ;
@@ -217,7 +218,7 @@ static int acp_i2s_prepare(struct snd_pcm_substream *substream, struct snd_soc_dwritel (phy_addr, adata->acp_base +ACP_I2S_TX_RINGBUFADDR ); }else { reg_dma_size =ACP_I2S_RX_DMA_SIZE ; - acp_fifo_addr =ACP_SRAM_PTE_OFFSET + + acp_fifo_addr = rsrc->sram_pte_offset +SP_CAPT_FIFO_ADDR_OFFSET ; reg_fifo_addr =ACP_I2S_RX_FIFOADDR ; reg_fifo_size =ACP_I2S_RX_FIFOSIZE ;
@@ -228,7 +229,7 @@ static int acp_i2s_prepare(struct snd_pcm_substream *substream, struct snd_soc_dcase I2S_BT_INSTANCE :if (dir ==SNDRV_PCM_STREAM_PLAYBACK ) { reg_dma_size =ACP_BT_TX_DMA_SIZE ; - acp_fifo_addr =ACP_SRAM_PTE_OFFSET + + acp_fifo_addr = rsrc->sram_pte_offset +BT_PB_FIFO_ADDR_OFFSET ; reg_fifo_addr =ACP_BT_TX_FIFOADDR ; reg_fifo_size =ACP_BT_TX_FIFOSIZE ;
@@ -237,7 +238,7 @@ static int acp_i2s_prepare(struct snd_pcm_substream *substream, struct snd_soc_dwritel (phy_addr, adata->acp_base +ACP_BT_TX_RINGBUFADDR ); }else { reg_dma_size =ACP_BT_RX_DMA_SIZE ; - acp_fifo_addr =ACP_SRAM_PTE_OFFSET + + acp_fifo_addr = rsrc->sram_pte_offset +BT_CAPT_FIFO_ADDR_OFFSET ; reg_fifo_addr =ACP_BT_RX_FIFOADDR ; reg_fifo_size =ACP_BT_RX_FIFOSIZE ;
@@ -255,11 +256,13 @@ static int acp_i2s_prepare(struct snd_pcm_substream *substream, struct snd_soc_dwritel (acp_fifo_addr, adata->acp_base + reg_fifo_addr);writel (FIFO_SIZE , adata->acp_base + reg_fifo_size); - ext_int_ctrl =readl (adata->acp_base +ACP_EXTERNAL_INTR_CNTL ); - ext_int_ctrl |=BIT (I2S_RX_THRESHOLD ) |BIT (BT_RX_THRESHOLD ) - |BIT (I2S_TX_THRESHOLD ) |BIT (BT_TX_THRESHOLD ); + ext_int_ctrl =readl (ACP_EXTERNAL_INTR_CNTL (adata, rsrc->irqp_used)); + ext_int_ctrl |=BIT (I2S_RX_THRESHOLD (rsrc->offset)) | +BIT (BT_RX_THRESHOLD (rsrc->offset)) | +BIT (I2S_TX_THRESHOLD (rsrc->offset)) | +BIT (BT_TX_THRESHOLD (rsrc->offset)); -writel (ext_int_ctrl, adata->acp_base +ACP_EXTERNAL_INTR_CNTL ); +writel (ext_int_ctrl,ACP_EXTERNAL_INTR_CNTL (adata, rsrc->irqp_used));return 0 ; }
@@ -268,28 +271,30 @@ static int acp_i2s_startup(struct snd_pcm_substream *substream, struct snd_soc_d {struct acp_stream *stream = substream->runtime->private_data;struct device *dev = dai->component->dev; +struct acp_dev_data *adata =dev_get_drvdata (dev); +struct acp_resource *rsrc = adata->rsrc;unsigned int dir = substream->stream;unsigned int irq_bit =0 ;switch (dai->driver->id) {case I2S_SP_INSTANCE :if (dir ==SNDRV_PCM_STREAM_PLAYBACK ) { - irq_bit =BIT (I2S_TX_THRESHOLD ); + irq_bit =BIT (I2S_TX_THRESHOLD (rsrc->offset)); stream->pte_offset =ACP_SRAM_SP_PB_PTE_OFFSET ; stream->fifo_offset =SP_PB_FIFO_ADDR_OFFSET ; }else { - irq_bit =BIT (I2S_RX_THRESHOLD ); + irq_bit =BIT (I2S_RX_THRESHOLD (rsrc->offset)); stream->pte_offset =ACP_SRAM_SP_CP_PTE_OFFSET ; stream->fifo_offset =SP_CAPT_FIFO_ADDR_OFFSET ; }break ;case I2S_BT_INSTANCE :if (dir ==SNDRV_PCM_STREAM_PLAYBACK ) { - irq_bit =BIT (BT_TX_THRESHOLD ); + irq_bit =BIT (BT_TX_THRESHOLD (rsrc->offset)); stream->pte_offset =ACP_SRAM_BT_PB_PTE_OFFSET ; stream->fifo_offset =BT_PB_FIFO_ADDR_OFFSET ; }else { - irq_bit =BIT (BT_RX_THRESHOLD ); + irq_bit =BIT (BT_RX_THRESHOLD (rsrc->offset)); stream->pte_offset =ACP_SRAM_BT_CP_PTE_OFFSET ; stream->fifo_offset =BT_CAPT_FIFO_ADDR_OFFSET ; }
@@ -319,6 +324,7 @@ int asoc_acp_i2s_probe(struct snd_soc_dai *dai) {struct device *dev = dai->component->dev;struct acp_dev_data *adata =dev_get_drvdata (dev); +struct acp_resource *rsrc = adata->rsrc;unsigned int val;if (!adata->acp_base) {
@@ -326,8 +332,8 @@ int asoc_acp_i2s_probe(struct snd_soc_dai *dai)return -EINVAL ; } - val =readl (adata->acp_base +ACP_I2S_PIN_CONFIG ); -if (val !=I2S_MODE ) { + val =readl (adata->acp_base + rsrc->i2s_pin_cfg_offset); +if (val != rsrc->i2s_mode) {dev_err (dev,"I2S Mode not supported val %x\n" , val);return -EINVAL ; }
sound/soc/amd/acp/acp-pdm.c +4 -4
@@ -160,9 +160,9 @@ static int acp_dmic_dai_startup(struct snd_pcm_substream *substream, stream->reg_offset =ACP_REGION2_OFFSET ;/* Enable DMIC Interrupts */ - ext_int_ctrl =readl (adata->acp_base +ACP_EXTERNAL_INTR_CNTL ); + ext_int_ctrl =readl (ACP_EXTERNAL_INTR_CNTL (adata,0 )); ext_int_ctrl |=PDM_DMA_INTR_MASK ; -writel (ext_int_ctrl, adata->acp_base +ACP_EXTERNAL_INTR_CNTL ); +writel (ext_int_ctrl,ACP_EXTERNAL_INTR_CNTL (adata,0 ));return 0 ; }
@@ -175,9 +175,9 @@ static void acp_dmic_dai_shutdown(struct snd_pcm_substream *substream,u32 ext_int_ctrl;/* Disable DMIC interrupts */ - ext_int_ctrl =readl (adata->acp_base +ACP_EXTERNAL_INTR_CNTL ); + ext_int_ctrl =readl (ACP_EXTERNAL_INTR_CNTL (adata,0 )); ext_int_ctrl |= ~PDM_DMA_INTR_MASK ; -writel (ext_int_ctrl, adata->acp_base +ACP_EXTERNAL_INTR_CNTL ); +writel (ext_int_ctrl,ACP_EXTERNAL_INTR_CNTL (adata,0 )); }const struct snd_soc_dai_ops acp_dmic_dai_ops = {
sound/soc/amd/acp/acp-platform.c +10 -6
@@ -91,6 +91,7 @@ EXPORT_SYMBOL_NS_GPL(acp_machine_select, SND_SOC_ACP_COMMON);static irqreturn_t i2s_irq_handler (int irq,void *data) {struct acp_dev_data *adata = data; +struct acp_resource *rsrc = adata->rsrc;struct acp_stream *stream;u16 i2s_flag =0 ;u32 val, i;
@@ -98,12 +99,13 @@ static irqreturn_t i2s_irq_handler(int irq, void *data)if (!adata)return IRQ_NONE ; - val =readl (adata->acp_base +ACP_EXTERNAL_INTR_STAT ); + val =readl (ACP_EXTERNAL_INTR_STAT (adata, rsrc->irqp_used));for (i =0 ; i <ACP_MAX_STREAM ; i++) { stream = adata->stream[i];if (stream && (val & stream->irq_bit)) { -writel (stream->irq_bit, adata->acp_base +ACP_EXTERNAL_INTR_STAT ); +writel (stream->irq_bit, +ACP_EXTERNAL_INTR_STAT (adata, rsrc->irqp_used));snd_pcm_period_elapsed (stream->substream); i2s_flag =1 ;break ;
@@ -118,6 +120,7 @@ static irqreturn_t i2s_irq_handler(int irq, void *data)static void config_pte_for_stream (struct acp_dev_data *adata,struct acp_stream *stream) { +struct acp_resource *rsrc = adata->rsrc;u32 pte_reg, pte_size, reg_val;/* Use ATU base Group5 */
@@ -126,7 +129,7 @@ static void config_pte_for_stream(struct acp_dev_data *adata, struct acp_stream stream->reg_offset =0x02000000 ;/* Group Enable */ - reg_val =ACP_SRAM_PTE_OFFSET ; + reg_val = rsrc->sram_pte_offset;writel (reg_val |BIT (31 ), adata->acp_base + pte_reg);writel (PAGE_SIZE_4K_ENABLE , adata->acp_base + pte_size); }
@@ -135,6 +138,7 @@ static void config_acp_dma(struct acp_dev_data *adata, int cpu_id, int size) {struct acp_stream *stream = adata->stream[cpu_id];struct snd_pcm_substream *substream = stream->substream; +struct acp_resource *rsrc = adata->rsrc;dma_addr_t addr = substream->dma_buffer.addr;int num_pages = (PAGE_ALIGN (size) >>PAGE_SHIFT );u32 low, high, val;
@@ -146,9 +150,9 @@ static void config_acp_dma(struct acp_dev_data *adata, int cpu_id, int size)/* Load the low address of page int ACP SRAM through SRBM */ low =lower_32_bits (addr); high =upper_32_bits (addr); -writel (low, adata->acp_base +ACP_SCRATCH_REG_0 + val); +writel (low, adata->acp_base + rsrc->scratch_reg_offset + val); high |=BIT (31 ); -writel (high, adata->acp_base +ACP_SCRATCH_REG_0 + val +4 ); +writel (high, adata->acp_base + rsrc->scratch_reg_offset + val +4 );/* Move to next physically contiguous page */ val +=8 ;
@@ -187,7 +191,7 @@ static int acp_dma_open(struct snd_soc_component *component, struct snd_pcm_subs } runtime->private_data = stream; -writel (1 , adata->acp_base +ACP_EXTERNAL_INTR_ENB ); +writel (1 ,ACP_EXTERNAL_INTR_ENB (adata));return ret; }
sound/soc/amd/acp/acp-renoir.c +27 -11
@@ -39,6 +39,17 @@#define ACP_ERROR_MASK 0x20000000#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF +static struct acp_resource rsrc = { + .offset =20 , + .no_of_ctrls =1 , + .irqp_used =0 , + .irq_reg_offset =0x1800 , + .i2s_pin_cfg_offset =0x1400 , + .i2s_mode =0x04 , + .scratch_reg_offset =0x12800 , + .sram_pte_offset =0x02052800 , +}; +static struct snd_soc_acpi_codecs amp_rt1019 = { .num_codecs =1 , .codecs = {"10EC1019" }
@@ -186,20 +197,24 @@ static int acp3x_reset(void __iomem *base)return readl_poll_timeout (base +ACP_SOFT_RESET , val, !val,DELAY_US ,ACP_TIMEOUT ); } -static void acp3x_enable_interrupts (void __iomem *base) +static void acp3x_enable_interrupts (struct acp_dev_data *adata) { +struct acp_resource *rsrc = adata->rsrc;u32 ext_intr_ctrl; -writel (0x01 , base +ACP_EXTERNAL_INTR_ENB ); - ext_intr_ctrl =readl (base +ACP_EXTERNAL_INTR_CNTL ); +writel (0x01 ,ACP_EXTERNAL_INTR_ENB (adata)); + ext_intr_ctrl =readl (ACP_EXTERNAL_INTR_CNTL (adata, rsrc->irqp_used)); ext_intr_ctrl |=ACP_ERROR_MASK ; -writel (ext_intr_ctrl, base +ACP_EXTERNAL_INTR_CNTL ); +writel (ext_intr_ctrl,ACP_EXTERNAL_INTR_CNTL (adata, rsrc->irqp_used)); } -static void acp3x_disable_interrupts (void __iomem *base) +static void acp3x_disable_interrupts (struct acp_dev_data *adata) { -writel (ACP_EXT_INTR_STAT_CLEAR_MASK , base +ACP_EXTERNAL_INTR_STAT ); -writel (0x00 , base +ACP_EXTERNAL_INTR_ENB ); +struct acp_resource *rsrc = adata->rsrc; + +writel (ACP_EXT_INTR_STAT_CLEAR_MASK , +ACP_EXTERNAL_INTR_STAT (adata, rsrc->irqp_used)); +writel (0x00 ,ACP_EXTERNAL_INTR_ENB (adata)); }static int rn_acp_init (void __iomem *base)
@@ -218,8 +233,6 @@ static int rn_acp_init(void __iomem *base)if (ret)return ret; -acp3x_enable_interrupts (base); -return 0 ; }
@@ -227,8 +240,6 @@ static int rn_acp_deinit(void __iomem *base) {int ret =0 ; -acp3x_disable_interrupts (base); -/* Reset */ ret =acp3x_reset (base);if (ret)
@@ -290,11 +301,13 @@ static int renoir_audio_probe(struct platform_device *pdev) adata->dev = dev; adata->dai_driver = acp_renoir_dai; adata->num_dai =ARRAY_SIZE (acp_renoir_dai); + adata->rsrc = &rsrc; adata->machines = snd_soc_acpi_amd_acp_machines;acp_machine_select (adata);dev_set_drvdata (dev, adata); +acp3x_enable_interrupts (adata);acp_platform_register (dev);return 0 ;
@@ -303,11 +316,14 @@ static int renoir_audio_probe(struct platform_device *pdev)static int renoir_audio_remove (struct platform_device *pdev) {struct device *dev = &pdev->dev; +struct acp_dev_data *adata =dev_get_drvdata (dev);struct acp_chip_info *chip;int ret; chip =dev_get_platdata (&pdev->dev); +acp3x_disable_interrupts (adata); + ret =rn_acp_deinit (chip->base);if (ret)dev_err (&pdev->dev,"ACP de-init Failed (%pe)\n" ,ERR_PTR (ret));
sound/soc/amd/acp/amd.h +18 -6
@@ -32,13 +32,12 @@#define ACP3x_I2STDM_REG_END 0x1242410#define ACP3x_BT_TDM_REG_START 0x1242800#define ACP3x_BT_TDM_REG_END 0x1242810 -#define I2S_MODE 0x04 -#define I2S_RX_THRESHOLD 27 -#define I2S_TX_THRESHOLD 28 -#define BT_TX_THRESHOLD 26 -#define BT_RX_THRESHOLD 25 -#define ACP_SRAM_PTE_OFFSET 0x02052800 +#define THRESHOLD (bit, base) ((bit) + (base)) +#define I2S_RX_THRESHOLD (base) THRESHOLD(7, base) +#define I2S_TX_THRESHOLD (base) THRESHOLD(8, base) +#define BT_TX_THRESHOLD (base) THRESHOLD(6, base) +#define BT_RX_THRESHOLD (base) THRESHOLD(5, base)#define ACP_SRAM_SP_PB_PTE_OFFSET 0x0#define ACP_SRAM_SP_CP_PTE_OFFSET 0x100
@@ -92,6 +91,17 @@ struct acp_stream {u32 fifo_offset; }; +struct acp_resource { +int offset; +int no_of_ctrls; +int irqp_used; +u32 irq_reg_offset; +u32 i2s_pin_cfg_offset; +int i2s_mode; +u64 scratch_reg_offset; +u64 sram_pte_offset; +}; +struct acp_dev_data {char *name;struct device *dev;
@@ -106,6 +116,8 @@ struct acp_dev_data {struct snd_soc_acpi_mach *machines;struct platform_device *mach_dev; + +struct acp_resource *rsrc; };extern const struct snd_soc_dai_ops asoc_acp_cpu_dai_ops;
sound/soc/amd/acp/chip_offset_byte.h +7 -5
@@ -20,11 +20,13 @@#define ACP_SOFT_RESET 0x1000#define ACP_CONTROL 0x1004 -#define ACP_EXTERNAL_INTR_ENB 0x1800 -#define ACP_EXTERNAL_INTR_CNTL 0x1804 -#define ACP_EXTERNAL_INTR_STAT 0x1808 -#define ACP_I2S_PIN_CONFIG 0x1400 -#define ACP_SCRATCH_REG_0 0x12800 +#define ACP_EXTERNAL_INTR_REG_ADDR (adata, offset, ctrl) \ + (adata->acp_base + adata->rsrc->irq_reg_offset + offset + (ctrl * 0x04)) + +#define ACP_EXTERNAL_INTR_ENB (adata) ACP_EXTERNAL_INTR_REG_ADDR(adata, 0x0, 0x0) +#define ACP_EXTERNAL_INTR_CNTL (adata, ctrl) ACP_EXTERNAL_INTR_REG_ADDR(adata, 0x4, ctrl) +#define ACP_EXTERNAL_INTR_STAT (adata, ctrl) ACP_EXTERNAL_INTR_REG_ADDR(adata, \ + (0x4 + (adata->rsrc->no_of_ctrls * 0x04)), ctrl)/* Registers from ACP_AUDIO_BUFFERS block */
Signature · 1 line
2.25.1
PATCH 3/3 ASoC: amd: acp: Add legacy audio driver support for Rembrandt platform
In reply to V sujith kumar ReddyAdd i2s and dmic support for Rembrandt platform,
Add machine support for nau8825, max98360 and rt5682s,rt1019 codec in legacy driver for rembrandt platform.
Here codec is in a slave mode.
--- sound/soc/amd/acp/Kconfig | 11 + sound/soc/amd/acp/Makefile | 2 + sound/soc/amd/acp/acp-i2s.c | 137 ++++++++- sound/soc/amd/acp/acp-legacy-mach.c | 32 +++ sound/soc/amd/acp/acp-mach-common.c | 86 +++++- sound/soc/amd/acp/acp-mach.h | 6 + sound/soc/amd/acp/acp-pci.c | 6 + sound/soc/amd/acp/acp-platform.c | 16 +- sound/soc/amd/acp/acp-rembrandt.c | 401 +++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 62 ++++- sound/soc/amd/acp/chip_offset_byte.h | 28 ++ 11 files changed, 781 insertions(+), 6 deletions(-) create mode 100644 sound/soc/amd/acp/acp-rembrandt.c
sound/soc/amd/acp/Kconfig +11 -0
@@ -40,6 +40,17 @@ config SND_AMD_ASOC_RENOIR help This option enables Renoir I2S support on AMD platform. +config SND_AMD_ASOC_REMBRANDT + tristate "AMD ACP ASOC Rembrandt Support" + select SND_SOC_AMD_ACP_PCM + select SND_SOC_AMD_ACP_I2S + select SND_SOC_AMD_ACP_PDM + depends on X86 && PCI + help + This option enables Rembrandt I2S support on AMD platform. + Say Y if you want to enable AUDIO on Rembrandt + If unsure select "N". + config SND_SOC_AMD_MACH_COMMON tristate depends on X86 && PCI && I2C
sound/soc/amd/acp/Makefile +2 -0
@@ -12,6 +12,7 @@ snd-acp-pci-objs := acp-pci.o #platform specific driver snd-acp-renoir-objs := acp-renoir.o +snd-acp-rembrandt-objs := acp-rembrandt.o #machine specific driver snd-acp-mach-objs := acp-mach-common.o
@@ -24,6 +25,7 @@ obj-$(CONFIG_SND_SOC_AMD_ACP_PDM) += snd-acp-pdm.o obj-$(CONFIG_SND_SOC_AMD_ACP_PCI) += snd-acp-pci.o obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o +obj-$(CONFIG_SND_AMD_ASOC_REMBRANDT) += snd-acp-rembrandt.o obj-$(CONFIG_SND_SOC_AMD_MACH_COMMON) += snd-acp-mach.o obj-$(CONFIG_SND_SOC_AMD_LEGACY_MACH) += snd-acp-legacy-mach.o
sound/soc/amd/acp/acp-i2s.c +136 -1
226 lines not on this page · raw message
sound/soc/amd/acp/acp-legacy-mach.c +32 -0
@@ -47,6 +47,28 @@ static struct acp_card_drvdata rt5682s_rt1019_data = { .dmic_codec_id = DMIC, }; +static struct acp_card_drvdata max_nau8825_data = { + .hs_cpu_id =I2S_HS , + .amp_cpu_id =I2S_HS , + .dmic_cpu_id =DMIC , + .hs_codec_id =NAU8825 , + .amp_codec_id =MAX98360A , + .dmic_codec_id =DMIC , + .soc_mclk = true, + .platform =REMBRANDT , +}; + +static struct acp_card_drvdata rt5682s_rt1019_rmb_data = { + .hs_cpu_id =I2S_HS , + .amp_cpu_id =I2S_HS , + .dmic_cpu_id =DMIC , + .hs_codec_id =RT5682S , + .amp_codec_id =RT1019 , + .dmic_codec_id =DMIC , + .soc_mclk = true, + .platform =REMBRANDT , +}; +static const struct snd_kcontrol_new acp_controls[] = {SOC_DAPM_PIN_SWITCH ("Headphone Jack" ),SOC_DAPM_PIN_SWITCH ("Headset Mic" ),
@@ -112,6 +134,14 @@ static const struct platform_device_id board_ids[] = { .name = "acp3xalc5682s1019", .driver_data = (kernel_ulong_t)&rt5682s_rt1019_data, }, + { + .name = "rmb-nau8825-max", + .driver_data = (kernel_ulong_t)&max_nau8825_data, + }, + { + .name = "rmb-rt5682s-rt1019", + .driver_data = (kernel_ulong_t)&rt5682s_rt1019_rmb_data, + }, { } }; static struct platform_driver acp_asoc_audio = {
@@ -130,4 +160,6 @@ MODULE_DESCRIPTION("ACP chrome audio support");MODULE_ALIAS ("platform:acp3xalc56821019" );MODULE_ALIAS ("platform:acp3xalc5682sm98360" );MODULE_ALIAS ("platform:acp3xalc5682s1019" ); +MODULE_ALIAS ("platform:rmb-nau8825-max" ); +MODULE_ALIAS ("platform:rmb-rt5682s-rt1019" );MODULE_LICENSE ("GPL v2" );
sound/soc/amd/acp/acp-mach-common.c +84 -2
116 lines not on this page · raw message
sound/soc/amd/acp/acp-mach.h +6 -0
@@ -41,6 +41,11 @@ enum codec_endpoints { NAU8825, }; +enum platform_end_point { +RENOIR =0 , +REMBRANDT , +}; +struct acp_card_drvdata {unsigned int hs_cpu_id;unsigned int amp_cpu_id;
@@ -49,6 +54,7 @@ struct acp_card_drvdata {unsigned int amp_codec_id;unsigned int dmic_codec_id;unsigned int dai_fmt; +unsigned int platform;struct clk *wclk;struct clk *bclk;bool soc_mclk;
sound/soc/amd/acp/acp-pci.c +6 -0
@@ -82,6 +82,12 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id chip->name ="acp_asoc_renoir" ; chip->acp_rev =ACP3X_DEV ;break ; +case 0x6f : + res_acp = acp3x_res; + num_res =ARRAY_SIZE (acp3x_res); + chip->name ="acp_asoc_rembrandt" ; + chip->acp_rev =ACP6X_DEV ; +break ;default :dev_err (dev,"Unsupported device revision:0x%x\n" , pci->revision);return -EINVAL ;
sound/soc/amd/acp/acp-platform.c +14 -2
@@ -94,11 +94,14 @@ static irqreturn_t i2s_irq_handler(int irq, void *data)struct acp_resource *rsrc = adata->rsrc;struct acp_stream *stream;u16 i2s_flag =0 ; -u32 val, i; +u32 val, val1, i;if (!adata)return IRQ_NONE ; +if (adata->rsrc->no_of_ctrls ==2 ) + val1 =readl (ACP_EXTERNAL_INTR_STAT (adata, (rsrc->irqp_used -1 ))); + val =readl (ACP_EXTERNAL_INTR_STAT (adata, rsrc->irqp_used));for (i =0 ; i <ACP_MAX_STREAM ; i++) {
@@ -110,8 +113,16 @@ static irqreturn_t i2s_irq_handler(int irq, void *data) i2s_flag =1 ;break ; } +if (adata->rsrc->no_of_ctrls ==2 ) { +if (stream && (val1 & stream->irq_bit)) { +writel (stream->irq_bit,ACP_EXTERNAL_INTR_STAT (adata, + (rsrc->irqp_used -1 ))); +snd_pcm_period_elapsed (stream->substream); + i2s_flag =1 ; +break ; + } + } } -if (i2s_flag)return IRQ_HANDLED ;
@@ -132,6 +143,7 @@ static void config_pte_for_stream(struct acp_dev_data *adata, struct acp_stream reg_val = rsrc->sram_pte_offset;writel (reg_val |BIT (31 ), adata->acp_base + pte_reg);writel (PAGE_SIZE_4K_ENABLE , adata->acp_base + pte_size); +writel (0x01 , adata->acp_base +ACPAXI2AXI_ATU_CTRL ); }static void config_acp_dma (struct acp_dev_data *adata,int cpu_id,int size)
sound/soc/amd/acp/acp-rembrandt.c new file +401 -0
401 lines not on this page · raw message
sound/soc/amd/acp/amd.h +61 -1
132 lines not on this page · raw message
sound/soc/amd/acp/chip_offset_byte.h +28 -0
@@ -66,6 +66,24 @@#define ACP_BT_TX_LINEARPOSITIONCNTR_HIGH 0x2084#define ACP_BT_TX_LINEARPOSITIONCNTR_LOW 0x2088#define ACP_BT_TX_INTR_WATERMARK_SIZE 0x208C +#define ACP_HS_RX_RINGBUFADDR 0x3A90 +#define ACP_HS_RX_RINGBUFSIZE 0x3A94 +#define ACP_HS_RX_LINKPOSITIONCNTR 0x3A98 +#define ACP_HS_RX_FIFOADDR 0x3A9C +#define ACP_HS_RX_FIFOSIZE 0x3AA0 +#define ACP_HS_RX_DMA_SIZE 0x3AA4 +#define ACP_HS_RX_LINEARPOSITIONCNTR_HIGH 0x3AA8 +#define ACP_HS_RX_LINEARPOSITIONCNTR_LOW 0x3AAC +#define ACP_HS_RX_INTR_WATERMARK_SIZE 0x3AB0 +#define ACP_HS_TX_RINGBUFADDR 0x3AB4 +#define ACP_HS_TX_RINGBUFSIZE 0x3AB8 +#define ACP_HS_TX_LINKPOSITIONCNTR 0x3ABC +#define ACP_HS_TX_FIFOADDR 0x3AC0 +#define ACP_HS_TX_FIFOSIZE 0x3AC4 +#define ACP_HS_TX_DMA_SIZE 0x3AC8 +#define ACP_HS_TX_LINEARPOSITIONCNTR_HIGH 0x3ACC +#define ACP_HS_TX_LINEARPOSITIONCNTR_LOW 0x3AD0 +#define ACP_HS_TX_INTR_WATERMARK_SIZE 0x3AD4#define ACP_I2STDM_IER 0x2400#define ACP_I2STDM_IRER 0x2404
@@ -81,6 +99,13 @@#define ACP_BTTDM_ITER 0x280C#define ACP_BTTDM_TXFRMT 0x2810 +/* Registers from ACP_HS_TDM block */ +#define ACP_HSTDM_IER 0x2814 +#define ACP_HSTDM_IRER 0x2818 +#define ACP_HSTDM_RXFRMT 0x281C +#define ACP_HSTDM_ITER 0x2820 +#define ACP_HSTDM_TXFRMT 0x2824 +/* Registers from ACP_WOV_PDM block */ #define ACP_WOV_PDM_ENABLE 0x2C04
@@ -101,4 +126,7 @@#define ACP_PDM_VAD_DYNAMIC_CLK_GATING_EN 0x2C64#define ACP_WOV_ERROR_STATUS_REGISTER 0x2C68 +#define ACP_I2STDM0_MSTRCLKGEN 0x2414 +#define ACP_I2STDM1_MSTRCLKGEN 0x2418 +#define ACP_I2STDM2_MSTRCLKGEN 0x241C#endif
Signature · 1 line
2.25.1
Re: [PATCH v1 3/3] ASoC: amd: acp: Add legacy audio driver support for Rembrandt platform
Hi,
this patch has already reached -next, but a few nit below.
Le 07/07/2022 à 18:11, V sujith kumar Reddy a écrit :
Quoted 21 lines
Add i2s and dmic support for Rembrandt platform,
Add machine support for nau8825, max98360 and rt5682s,rt1019 codec in legacy driver for rembrandt platform.
Here codec is in a slave mode.Signed-off-by V sujith kumar Reddy <[email protected]>--- sound/soc/amd/acp/Kconfig | 11 + sound/soc/amd/acp/Makefile | 2 + sound/soc/amd/acp/acp-i2s.c | 137 ++++++++- sound/soc/amd/acp/acp-legacy-mach.c | 32 +++ sound/soc/amd/acp/acp-mach-common.c | 86 +++++- sound/soc/amd/acp/acp-mach.h | 6 + sound/soc/amd/acp/acp-pci.c | 6 + sound/soc/amd/acp/acp-platform.c | 16 +- sound/soc/amd/acp/acp-rembrandt.c | 401 +++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 62 ++++- sound/soc/amd/acp/chip_offset_byte.h | 28 ++ 11 files changed, 781 insertions(+), 6 deletions(-)create mode 100644
sound/soc/amd/acp/acp-rembrandt.c
[...]
sound/soc/amd/acp/acp-rembrandt.c line 4
Quoted 10 lines
sound/soc/amd/acp/acp-rembrandt.c new file +4
-0@@ -0,0 +1,401 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// This file is provided under a dual BSD/GPLv2 license. When using or +// redistributing this file, you may do so under either license.
These lines are useless. There is already a SPDX-License-Identifier just above.
Quoted 9 lines
sound/soc/amd/acp/acp-rembrandt.c new file +9
-0+// +// Copyright(c) 2022 Advanced Micro Devices, Inc. +// +// Authors: Ajit Kumar Pandey <[email protected]> +// V sujith kumar Reddy <[email protected]> +/* +* Hardware interface for Renoir ACP block +*/ +
[...]
Quoted 9 lines
sound/soc/amd/acp/acp-rembrandt.c new file +9
-0+static int rembrandt_audio_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct acp_chip_info *chip; +struct acp_dev_data *adata; +struct resource *res; + + chip =dev_get_platdata (&pdev->dev); +if (!chip || !chip->base) {
sound/soc/amd/acp/acp-rembrandt.c line 331
Quoted 10 lines
sound/soc/amd/acp/acp-rembrandt.c new file +10
-0+dev_err (&pdev->dev,"ACP chip data is NULL\n" ); +return -ENODEV ; + } + +if (chip->acp_rev !=ACP6X_DEV ) { +dev_err (&pdev->dev,"Un-supported ACP Revision %d\n" , chip->acp_rev); +return -ENODEV ; + } + +rmb_acp_init (chip->base);
Should rmb_acp_deinit() be called if an error occurs below? Or a devm_add_action_or_reset() + .remove() simplification?
(this is called in the .remove() function)
Quoted 38 lines
sound/soc/amd/acp/acp-rembrandt.c new file +38
-0+ + adata =devm_kzalloc (dev,sizeof (struct acp_dev_data ),GFP_KERNEL ); +if (!adata) +return -ENOMEM ; + + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"acp_mem" ); +if (!res) { +dev_err (&pdev->dev,"IORESOURCE_MEM FAILED\n" ); +return -ENODEV ; + } + + adata->acp_base =devm_ioremap (&pdev->dev, res->start,resource_size (res)); +if (!adata->acp_base) +return -ENOMEM ; + + res =platform_get_resource_byname (pdev,IORESOURCE_IRQ ,"acp_dai_irq" ); +if (!res) { +dev_err (&pdev->dev,"IORESOURCE_IRQ FAILED\n" ); +return -ENODEV ; + } + + adata->i2s_irq = res->start; + adata->dev = dev; + adata->dai_driver = acp_rmb_dai; + adata->num_dai =ARRAY_SIZE (acp_rmb_dai); + adata->rsrc = &rsrc; + + adata->machines = snd_soc_acpi_amd_rmb_acp_machines; +acp_machine_select (adata); + +dev_set_drvdata (dev, adata); +acp6x_enable_interrupts (adata); +acp_platform_register (dev); + +return 0 ; +} + +static int rembrandt_audio_remove (struct platform_device *pdev)
sound/soc/amd/acp/acp-rembrandt.c line 379
Quoted 10 lines
sound/soc/amd/acp/acp-rembrandt.c new file +10
-0+{ +struct device *dev = &pdev->dev; +struct acp_dev_data *adata =dev_get_drvdata (dev); +struct acp_chip_info *chip; + + chip =dev_get_platdata (&pdev->dev); +if (!chip || !chip->base) { +dev_err (&pdev->dev,"ACP chip data is NULL\n" ); +return -ENODEV ; + }
These tests and dev_err and return look useless.
The same is already tested at the biginning of the probe and if it fails, the probe will fail, right?
Quoted 7 lines
sound/soc/amd/acp/acp-rembrandt.c new file +7
-0+ +rmb_acp_deinit (chip->base); + +acp6x_disable_interrupts (adata); +acp_platform_unregister (dev); +return 0 ; +}
[...]
Re: [PATCH v1 3/3] ASoC: amd: acp: Add legacy audio driver support for Rembrandt platform
Quoted 81 lines · Christophe JAILLET
[CAUTION: External Email]
Hi,
this patch has already reached -next, but a few nit below.
Quoted 21 lines · V sujith kumar Reddy
Add i2s and dmic support for Rembrandt platform,
Add machine support for nau8825, max98360 and rt5682s,rt1019 codec in legacy driver for rembrandt platform.
Here codec is in a slave mode.Signed-off-by V sujith kumar Reddy <[email protected]>---
sound/soc/amd/acp/Kconfig | 11 + sound/soc/amd/acp/Makefile | 2 + sound/soc/amd/acp/acp-i2s.c | 137 ++++++++- sound/soc/amd/acp/acp-legacy-mach.c | 32 +++ sound/soc/amd/acp/acp-mach-common.c | 86 +++++- sound/soc/amd/acp/acp-mach.h | 6 + sound/soc/amd/acp/acp-pci.c | 6 + sound/soc/amd/acp/acp-platform.c | 16 +- sound/soc/amd/acp/acp-rembrandt.c | 401 +++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 62 ++++-sound/soc/amd/acp/chip_offset_byte.h| 28 ++11 files changed, 781 insertions(+), 6 deletions(-)create mode 100644
sound/soc/amd/acp/acp-rembrandt.c[...]
sound/soc/amd/acp/acp-rembrandt.c line 4
Quoted 10 lines
sound/soc/amd/acp/acp-rembrandt.c new file +4
-0@@ -0,0 +1,401 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// This file is provided under a dual BSD/GPLv2 license. When using or +// redistributing this file, you may do so under either license. These lines are useless. There is already a SPDX-License-Identifier just above.
Quoted 9 lines
sound/soc/amd/acp/acp-rembrandt.c new file +9
-0+// +// Copyright(c) 2022 Advanced Micro Devices, Inc. +// +// Authors: Ajit Kumar Pandey <[email protected]> +// V sujith kumar Reddy <[email protected]> +/* +* Hardware interface for Renoir ACP block +*/ +[...]
Quoted 15 lines
sound/soc/amd/acp/acp-rembrandt.c new file +15
-0+static int rembrandt_audio_probe (struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct acp_chip_info *chip; + struct acp_dev_data *adata; + struct resource *res; + + chip = dev_get_platdata(&pdev->dev); + if (!chip || !chip->base) { + dev_err(&pdev->dev, "ACP chip data is NULL\n"); + return -ENODEV; + } + + if (chip->acp_rev != ACP6X_DEV) { + dev_err(&pdev->dev, "Un-supported ACP Revision %d\n",Quoted 5 lines
chip->acp_rev);
+ return-ENODEV;
+ }
+
+rmb_acp_init(chip->base);Should
rmb_acp_deinit()be called if an error occurs below? Or adevm_add_action_or_reset()+ .remove() simplification?
Quoted 1 line
(this is called in the .remove() function)
Yes,we can check the error status ,we will do it up in a cleanup patch.
Quoted 49 lines
Quoted 49 lines
+
+ adata =devm_kzalloc(dev, sizeof(struct acp_dev_data), GFP_KERNEL);
+ if (!adata)
+ return-ENOMEM;
+
+ res =platform_get_resource_byname(pdev, IORESOURCE_MEM, "acp_mem");
+ if (!res) {
+dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n"); + return-ENODEV;
+ }
+
+adata->acp_base=devm_ioremap(&pdev->dev, res->start, resource_size(res));
+ if (!adata->acp_base)
+ return-ENOMEM;
+
+ res =platform_get_resource_byname(pdev, IORESOURCE_IRQ, "acp_dai_irq");
+ if (!res) {
+dev_err(&pdev->dev, "IORESOURCE_IRQ FAILED\n"); + return-ENODEV;
+ }sound/soc/amd/acp/acp-rembrandt.c new file +24
-0+ + adata->i2s_irq = res->start; + adata->dev = dev; + adata->dai_driver = acp_rmb_dai; + adata->num_dai = ARRAY_SIZE(acp_rmb_dai); + adata->rsrc = &rsrc; + + adata->machines = snd_soc_acpi_amd_rmb_acp_machines; + acp_machine_select(adata); + + dev_set_drvdata(dev, adata); + acp6x_enable_interrupts(adata); + acp_platform_register(dev); + + return 0; +} + +static int rembrandt_audio_remove (struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + struct acp_chip_info *chip; + + chip = dev_get_platdata(&pdev->dev);
Quoted 8 lines
Quoted 4 lines
+ if (!chip || !chip->base) {
+dev_err(&pdev->dev, "ACP chip data is NULL\n"); + return-ENODEV;
+ }These tests and
dev_errand return look useless.
The same is already tested at the biginning of the probe and if it fails, the probe will fail, right?
yes ,agreed we will do it in a cleanup patch as it is merged.
Quoted 11 lines
Quoted 8 lines
sound/soc/amd/acp/acp-rembrandt.c new file +7
-0+ + rmb_acp_deinit(chip->base); + + acp6x_disable_interrupts(adata); + acp_platform_unregister(dev); + return 0; +}[...]
Mark Brown
maintainerQuoted 5 lines · V sujith kumar Reddy
Add Generic driver to support multiple platform,
ADD HS control instance for Rembrandt platform.
Add nau8825,max98560 and rt5682s,rt1019 combination support for legacy platform.
Quoted 7 lines
v0--->v1
--Kconfigsyntax changes done
-- robot errors donesound/soc/amd/acp/acp-rembrandt.c:264:5: warning: no previous prototype for 'rmb_acp_init' [-Wmissing-prototypes]sound/soc/amd/acp/acp-rembrandt.c:264:5: warning: no previous prototype for 'rmb_acp_init' [-Wmissing-prototypes][...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: amd: acp: Remove rt1019_1 codec conf from machine driver
commit: ac2606df8a3fb4450240cf0893ff3934b5882c69
[2/3] ASoC: amd: acp: ACP code generic to support newer platforms
commit: b24484c18b1089f9dd1ef7901b05a85e315e9f41
[3/3] ASoC: amd: acp: Add legacy audio driver support for Rembrandt platform
commit: e8a33a94078560df73761f6d6147a25bda07605cAll being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark