ASoC: amd: acp: Add acp6.3 pci legacy driver support
Subsystems (3)
PATCH 1/13 ASoC: amd: acp: Add acp6.3 pci legacy driver support
Add pci legacy driver support and create platform driver for acp6.3 based platforms.
--- sound/soc/amd/acp/acp-legacy-common.c | 4 + sound/soc/amd/acp/acp-pci.c | 4 + sound/soc/amd/acp/acp63.c | 314 ++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 4 + 4 files changed, 326 insertions(+) create mode 100644 sound/soc/amd/acp/acp63.c
sound/soc/amd/acp/acp-legacy-common.c +4 -0
@@ -260,6 +260,10 @@ static int acp_power_on(struct acp_chip_info *chip) acp_pgfsm_stat_reg =ACP6X_PGFSM_STATUS ; acp_pgfsm_ctrl_reg =ACP6X_PGFSM_CONTROL ;break ; +case ACP63_DEV : + acp_pgfsm_stat_reg =ACP63_PGFSM_STATUS ; + acp_pgfsm_ctrl_reg =ACP63_PGFSM_CONTROL ; +break ;default :return -EINVAL ; }
sound/soc/amd/acp/acp-pci.c +4 -0
@@ -87,6 +87,10 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id chip->name ="acp_asoc_rembrandt" ; chip->acp_rev =ACP6X_DEV ;break ; +case 0x63 : + chip->name ="acp_asoc_acp63" ; + chip->acp_rev =ACP63_DEV ; +break ;default :dev_err (dev,"Unsupported device revision:0x%x\n" , pci->revision); ret = -EINVAL ;
sound/soc/amd/acp/acp63.c new file +314 -0
314 lines not on this page · raw message
sound/soc/amd/acp/amd.h +4 -0
@@ -20,6 +20,7 @@#define ACP3X_DEV 3#define ACP6X_DEV 6 +#define ACP63_DEV 0x63#define DMIC_INSTANCE 0x00#define I2S_SP_INSTANCE 0x01
@@ -95,6 +96,9 @@#define ACP6X_PGFSM_CONTROL 0x1024#define ACP6X_PGFSM_STATUS 0x1028 +#define ACP63_PGFSM_CONTROL ACP6X_PGFSM_CONTROL +#define ACP63_PGFSM_STATUS ACP6X_PGFSM_STATUS +#define ACP_SOFT_RST_DONE_MASK 0x00010001#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x01
Signature · 1 line
2.25.1
PATCH 2/13 ASoC: amd: acp: refactor acp i2s clock generation code
Refactor acp i2s LRCLK,BCLK generation code and move to commnon file.
--- sound/soc/amd/acp/acp-i2s.c | 32 ++++++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 39 ------------------------------------- 2 files changed, 32 insertions(+), 39 deletions(-)
sound/soc/amd/acp/acp-i2s.c +32 -0
@@ -20,10 +20,42 @@#include <sound/soc.h> #include <sound/soc-dai.h> #include <linux/dma-mapping.h> +#include <linux/bitfield.h> #include "amd.h" #define DRV_NAME "acp_i2s_playcap" +#define I2S_MASTER_MODE_ENABLE 1 +#define I2S_MODE_ENABLE 0 +#define I2S_FORMAT_MODE GENMASK(1, 1) +#define LRCLK_DIV_FIELD GENMASK(10, 2) +#define BCLK_DIV_FIELD GENMASK(23, 11) + +static inline void acp_set_i2s_clk (struct acp_dev_data *adata,int dai_id) +{ +u32 i2s_clk_reg, val; + +switch (dai_id) { +case I2S_SP_INSTANCE : + i2s_clk_reg =ACP_I2STDM0_MSTRCLKGEN ; +break ; +case I2S_BT_INSTANCE : + i2s_clk_reg =ACP_I2STDM1_MSTRCLKGEN ; +break ; +case I2S_HS_INSTANCE : + i2s_clk_reg =ACP_I2STDM2_MSTRCLKGEN ; +break ; +default : + i2s_clk_reg =ACP_I2STDM0_MSTRCLKGEN ; +break ; + } + + val =I2S_MASTER_MODE_ENABLE ; + val |=I2S_MODE_ENABLE &BIT (1 ); + val |=FIELD_PREP (LRCLK_DIV_FIELD , adata->lrclk_div); + val |=FIELD_PREP (BCLK_DIV_FIELD , adata->bclk_div); +writel (val, adata->acp_base + i2s_clk_reg); +}static int acp_i2s_set_fmt (struct snd_soc_dai *cpu_dai,unsigned int fmt)
sound/soc/amd/acp/amd.h +0 -39
@@ -188,17 +188,6 @@ struct acp_dev_data {u32 xfer_rx_resolution[3 ]; }; -union acp_i2stdm_mstrclkgen { -struct { -u32 i2stdm_master_mode :1 ; -u32 i2stdm_format_mode :1 ; -u32 i2stdm_lrclk_div_val :9 ; -u32 i2stdm_bclk_div_val :11 ; - u32:10; - } bitfields, bits; -u32 u32_all; -}; -extern const struct snd_soc_dai_ops asoc_acp_cpu_dai_ops;extern const struct snd_soc_dai_ops acp_dmic_dai_ops;
@@ -276,32 +265,4 @@ static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int POINTER_RETURN_BYTES: return byte_count; } - -static inline void acp_set_i2s_clk (struct acp_dev_data *adata,int dai_id) -{ -union acp_i2stdm_mstrclkgen mclkgen; -u32 master_reg; - -switch (dai_id) { -case I2S_SP_INSTANCE : - master_reg =ACP_I2STDM0_MSTRCLKGEN ; -break ; -case I2S_BT_INSTANCE : - master_reg =ACP_I2STDM1_MSTRCLKGEN ; -break ; -case I2S_HS_INSTANCE : - master_reg =ACP_I2STDM2_MSTRCLKGEN ; -break ; -default : - master_reg =ACP_I2STDM0_MSTRCLKGEN ; -break ; - } - - mclkgen.bits.i2stdm_master_mode =0x1 ; - mclkgen.bits.i2stdm_format_mode =0x00 ; - - mclkgen.bits.i2stdm_bclk_div_val = adata->bclk_div; - mclkgen.bits.i2stdm_lrclk_div_val = adata->lrclk_div; -writel (mclkgen.u32_all, adata->acp_base + master_reg); -}#endif
Signature · 1 line
2.25.1
Re: [PATCH 02/13] ASoC: amd: acp: refactor acp i2s clock generation code
Quoted 38 lines · Syed Saba Kareem
Refactor acp i2s LRCLK,BCLK generation code and move to commnon file.
Signed-off-by Syed Saba Kareem <[email protected]>--- sound/soc/amd/acp/acp-i2s.c | 32 ++++++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 39 ------------------------------------- 2 files changed, 32 insertions(+), 39 deletions(-)sound/soc/amd/acp/acp-i2s.c +18
-0@@ -20,10 +20,42 @@#include <sound/soc.h> #include <sound/soc-dai.h> #include <linux/dma-mapping.h> +#include <linux/bitfield.h> #include "amd.h" #define DRV_NAME "acp_i2s_playcap" +#define I2S_MASTER_MODE_ENABLE 1 +#define I2S_MODE_ENABLE 0 +#define I2S_FORMAT_MODE GENMASK(1, 1) +#define LRCLK_DIV_FIELD GENMASK(10, 2) +#define BCLK_DIV_FIELD GENMASK(23, 11) + +static inline void acp_set_i2s_clk (struct acp_dev_data *adata,int dai_id) +{ +u32 i2s_clk_reg, val; + +switch (dai_id) { +case I2S_SP_INSTANCE : + i2s_clk_reg =ACP_I2STDM0_MSTRCLKGEN ; +break ; +case I2S_BT_INSTANCE : + i2s_clk_reg =ACP_I2STDM1_MSTRCLKGEN ; +break ;
sound/soc/amd/acp/acp-i2s.c line 54
Quoted 10 lines
sound/soc/amd/acp/acp-i2s.c +10
-0+case I2S_HS_INSTANCE : + i2s_clk_reg =ACP_I2STDM2_MSTRCLKGEN ; +break ; +default : + i2s_clk_reg =ACP_I2STDM0_MSTRCLKGEN ; +break ; + } + + val =I2S_MASTER_MODE_ENABLE ; + val |=I2S_MODE_ENABLE &BIT (1 );
There is I2S_FORMAT_MODE define, you probably want to use it instead of BIT(1), so there is no "magic number" mask?
Quoted 62 lines
sound/soc/amd/acp/acp-i2s.c +4
-0+ val |=FIELD_PREP (LRCLK_DIV_FIELD , adata->lrclk_div); + val |=FIELD_PREP (BCLK_DIV_FIELD , adata->bclk_div); +writel (val, adata->acp_base + i2s_clk_reg); +}static int acp_i2s_set_fmt (struct snd_soc_dai *cpu_dai,unsigned int fmt)sound/soc/amd/acp/amd.h +0
-39@@ -188,17 +188,6 @@ struct acp_dev_data {u32 xfer_rx_resolution[3 ]; }; -union acp_i2stdm_mstrclkgen { -struct { -u32 i2stdm_master_mode :1 ; -u32 i2stdm_format_mode :1 ; -u32 i2stdm_lrclk_div_val :9 ; -u32 i2stdm_bclk_div_val :11 ; - u32:10; - } bitfields, bits; -u32 u32_all; -}; -extern const struct snd_soc_dai_ops asoc_acp_cpu_dai_ops;extern const struct snd_soc_dai_ops acp_dmic_dai_ops;@@ -276,32 +265,4 @@ static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int POINTER_RETURN_BYTES: return byte_count; } - -static inline void acp_set_i2s_clk (struct acp_dev_data *adata,int dai_id) -{ -union acp_i2stdm_mstrclkgen mclkgen; -u32 master_reg; - -switch (dai_id) { -case I2S_SP_INSTANCE : - master_reg =ACP_I2STDM0_MSTRCLKGEN ; -break ; -case I2S_BT_INSTANCE : - master_reg =ACP_I2STDM1_MSTRCLKGEN ; -break ; -case I2S_HS_INSTANCE : - master_reg =ACP_I2STDM2_MSTRCLKGEN ; -break ; -default : - master_reg =ACP_I2STDM0_MSTRCLKGEN ; -break ; - } - - mclkgen.bits.i2stdm_master_mode =0x1 ; - mclkgen.bits.i2stdm_format_mode =0x00 ; - - mclkgen.bits.i2stdm_bclk_div_val = adata->bclk_div; - mclkgen.bits.i2stdm_lrclk_div_val = adata->lrclk_div; -writel (mclkgen.u32_all, adata->acp_base + master_reg); -}#endif
Re: [PATCH 02/13] ASoC: amd: acp: refactor acp i2s clock generation code
Quoted 42 lines · Amadeusz Sławiński
Quoted 41 lines · Syed Saba Kareem
Refactor acp i2s LRCLK,BCLK generation code and move to commnon file.
Signed-off-by Syed Saba Kareem <[email protected]>---
sound/soc/amd/acp/acp-i2s.c| 32 ++++++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 39 -------------------------------------2 files changed, 32 insertions(+), 39 deletions(-)sound/soc/amd/acp/acp-i2s.c +22
-0@@ -20,10 +20,42 @@ #include <sound/soc.h> #include <sound/soc-dai.h> #include <linux/dma-mapping.h> +#include <linux/bitfield.h> #include "amd.h" #define DRV_NAME "acp_i2s_playcap" +#define I2S_MASTER_MODE_ENABLE 1 +#define I2S_MODE_ENABLE 0 +#define I2S_FORMAT_MODE GENMASK(1, 1) +#define LRCLK_DIV_FIELD GENMASK(10, 2) +#define BCLK_DIV_FIELD GENMASK(23, 11) + +static inline void acp_set_i2s_clk (struct acp_dev_data *adata,int dai_id) +{ + u32 i2s_clk_reg, val; + + switch (dai_id) { + case I2S_SP_INSTANCE: + i2s_clk_reg = ACP_I2STDM0_MSTRCLKGEN; + break; + case I2S_BT_INSTANCE: + i2s_clk_reg = ACP_I2STDM1_MSTRCLKGEN; + break; + case I2S_HS_INSTANCE: + i2s_clk_reg = ACP_I2STDM2_MSTRCLKGEN; + break; + default:
Quoted 9 lines
sound/soc/amd/acp/acp-i2s.c line 54
Quoted 6 lines
sound/soc/amd/acp/acp-i2s.c +6
-0+ i2s_clk_reg = ACP_I2STDM0_MSTRCLKGEN; + break; + } + + val = I2S_MASTER_MODE_ENABLE; + val |= I2S_MODE_ENABLE & BIT(1);There is
I2S_FORMAT_MODEdefine, you probably want to use it instead of BIT(1), so there is no "magic number" mask?
This has to be corrected.
For TDM mode case , bit position 1 should be set.
if (adata->tdm_mode)
val |= BIT(1);
I2S_MODE_ENABLE , I2S_FORMAT_MODE macros can be dropped. Will push the changes as an incremental patch.
Quoted 61 lines
Quoted 60 lines
sound/soc/amd/acp/acp-i2s.c +4
-0+ val |= FIELD_PREP(LRCLK_DIV_FIELD, adata->lrclk_div); + val |= FIELD_PREP(BCLK_DIV_FIELD, adata->bclk_div); + writel(val, adata->acp_base + i2s_clk_reg); +} static int acp_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)sound/soc/amd/acp/amd.h +0
-10@@ -188,17 +188,6 @@ struct acp_dev_data { u32 xfer_rx_resolution[3]; }; -union acp_i2stdm_mstrclkgen { - struct { - u32 i2stdm_master_mode : 1; - u32 i2stdm_format_mode : 1; - u32 i2stdm_lrclk_div_val : 9; - u32 i2stdm_bclk_div_val : 11; - u32:10; - } bitfields, bits; - u32 u32_all; -}; - extern const struct snd_soc_dai_ops asoc_acp_cpu_dai_ops; extern const struct snd_soc_dai_ops acp_dmic_dai_ops;@@ -276,32 +265,4 @@ static inline u64 acp_get_byte_count(struct
acp_dev_data*adata, intdai_id, intPOINTER_RETURN_BYTES:
returnbyte_count;
}sound/soc/amd/acp/amd.h +0
-2- -static inline void acp_set_i2s_clk(struct acp_dev_data *adata, int
dai_id)sound/soc/amd/acp/amd.h +0
-26-{ - union acp_i2stdm_mstrclkgen mclkgen; - u32 master_reg; - - switch (dai_id) { - case I2S_SP_INSTANCE: - master_reg = ACP_I2STDM0_MSTRCLKGEN; - break; - case I2S_BT_INSTANCE: - master_reg = ACP_I2STDM1_MSTRCLKGEN; - break; - case I2S_HS_INSTANCE: - master_reg = ACP_I2STDM2_MSTRCLKGEN; - break; - default: - master_reg = ACP_I2STDM0_MSTRCLKGEN; - break; - } - - mclkgen.bits.i2stdm_master_mode = 0x1; - mclkgen.bits.i2stdm_format_mode = 0x00; - - mclkgen.bits.i2stdm_bclk_div_val = adata->bclk_div; - mclkgen.bits.i2stdm_lrclk_div_val = adata->lrclk_div; - writel(mclkgen.u32_all, adata->acp_base + master_reg); -}#endif
PATCH 3/13 ASoC: amd: acp: add i2s clock generation support for acp6.3 based platforms
In reply to Syed Saba KareemAdd I2S LRCLK & BCLK generation code for ACP6.3 based platforms.
--- sound/soc/amd/acp/acp-i2s.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
sound/soc/amd/acp/acp-i2s.c +16 -3
@@ -27,14 +27,19 @@#define DRV_NAME "acp_i2s_playcap"#define I2S_MASTER_MODE_ENABLE 1#define I2S_MODE_ENABLE 0 -#define I2S_FORMAT_MODE GENMASK(1, 1)#define LRCLK_DIV_FIELD GENMASK(10, 2)#define BCLK_DIV_FIELD GENMASK(23, 11) +#define ACP63_LRCLK_DIV_FIELD GENMASK(12, 2) +#define ACP63_BCLK_DIV_FIELD GENMASK(23, 13)static inline void acp_set_i2s_clk (struct acp_dev_data *adata,int dai_id) {u32 i2s_clk_reg, val; +struct acp_chip_info *chip; +struct device *dev; + dev = adata->dev; + chip =dev_get_platdata (dev);switch (dai_id) {case I2S_SP_INSTANCE : i2s_clk_reg =ACP_I2STDM0_MSTRCLKGEN ;
@@ -52,8 +57,16 @@ static inline void acp_set_i2s_clk(struct acp_dev_data *adata, int dai_id) val =I2S_MASTER_MODE_ENABLE ; val |=I2S_MODE_ENABLE &BIT (1 ); - val |=FIELD_PREP (LRCLK_DIV_FIELD , adata->lrclk_div); - val |=FIELD_PREP (BCLK_DIV_FIELD , adata->bclk_div); + +switch (chip->acp_rev) { +case ACP63_DEV : + val |=FIELD_PREP (ACP63_LRCLK_DIV_FIELD , adata->lrclk_div); + val |=FIELD_PREP (ACP63_BCLK_DIV_FIELD , adata->bclk_div); +break ; +default : + val |=FIELD_PREP (LRCLK_DIV_FIELD , adata->lrclk_div); + val |=FIELD_PREP (BCLK_DIV_FIELD , adata->bclk_div); + }writel (val, adata->acp_base + i2s_clk_reg); }
Signature · 1 line
2.25.1
PATCH 4/13 ASoC: amd: acp: add machine driver support for acp6.3 platform
In reply to Syed Saba Kareemadd legacy machine driver support for acp6.3 based platform.
--- sound/soc/amd/acp/acp-mach-common.c | 15 +++++++++++++++ sound/soc/amd/acp/acp-mach.h | 1 + 2 files changed, 16 insertions(+)
sound/soc/amd/acp/acp-mach-common.c +15 -0
@@ -1260,6 +1260,12 @@ static struct snd_soc_dai_link_component platform_rmb_component[] = { } }; +static struct snd_soc_dai_link_component platform_acp63_component[] = { + { + .name ="acp_asoc_acp63.0" , + } +}; +static struct snd_soc_dai_link_component sof_component[] = { { .name ="0000:04:00.5" ,
@@ -1570,6 +1576,9 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card)if (drv_data->platform ==REMBRANDT ) { links[i].platforms = platform_rmb_component; links[i].num_platforms =ARRAY_SIZE (platform_rmb_component); + }else if (drv_data->platform ==ACP63 ) { + links[i].platforms = platform_acp63_component; + links[i].num_platforms =ARRAY_SIZE (platform_acp63_component); }else { links[i].platforms = platform_component; links[i].num_platforms =ARRAY_SIZE (platform_component);
@@ -1634,6 +1643,9 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card)if (drv_data->platform ==REMBRANDT ) { links[i].platforms = platform_rmb_component; links[i].num_platforms =ARRAY_SIZE (platform_rmb_component); + }else if (drv_data->platform ==ACP63 ) { + links[i].platforms = platform_acp63_component; + links[i].num_platforms =ARRAY_SIZE (platform_acp63_component); }else { links[i].platforms = platform_component; links[i].num_platforms =ARRAY_SIZE (platform_component);
@@ -1677,6 +1689,9 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card)if (drv_data->platform ==REMBRANDT ) { links[i].platforms = platform_rmb_component; links[i].num_platforms =ARRAY_SIZE (platform_rmb_component); + }else if (drv_data->platform ==ACP63 ) { + links[i].platforms = platform_acp63_component; + links[i].num_platforms =ARRAY_SIZE (platform_acp63_component); }else { links[i].platforms = platform_component; links[i].num_platforms =ARRAY_SIZE (platform_component);
sound/soc/amd/acp/acp-mach.h +1 -0
@@ -53,6 +53,7 @@ enum codec_endpoints {enum platform_end_point {RENOIR =0 ,REMBRANDT , +ACP63 , };struct acp_mach_ops {
Signature · 1 line
2.25.1
PATCH 5/13 ASoC: amd: acp: add Kconfig options for acp6.3 based platform driver
In reply to Syed Saba KareemACP6.3 based platform legacy drivers can be built by selecting necessary kernel config option. This patch enables build support of the same.
--- sound/soc/amd/acp/Kconfig | 11 +++++++++++ sound/soc/amd/acp/Makefile | 2 ++ 2 files changed, 13 insertions(+)
sound/soc/amd/acp/Kconfig +11 -0
@@ -57,6 +57,17 @@ config SND_AMD_ASOC_REMBRANDT Say Y if you want to enable AUDIO on Rembrandt If unsure select "N". +config SND_AMD_ASOC_ACP63 + tristate "AMD ACP ASOC ACP6.3 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 Acp6.3 I2S support on AMD platform. + Say Y if you want to enable AUDIO on ACP6.3 + If unsure select "N". + config SND_SOC_AMD_MACH_COMMON tristate depends on X86 && PCI && I2C
sound/soc/amd/acp/Makefile +2 -0
@@ -14,6 +14,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 +snd-acp63-objs := acp63.o #machine specific driver snd-acp-mach-objs := acp-mach-common.o
@@ -28,6 +29,7 @@ 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_AMD_ASOC_ACP63) += snd-acp63.o obj-$(CONFIG_SND_SOC_AMD_MACH_COMMON) += snd-acp-mach.o obj-$(CONFIG_SND_SOC_AMD_LEGACY_MACH) += snd-acp-legacy-mach.o
Signature · 1 line
2.25.1
PATCH 6/13 ASoC: amd: acp: add code for scanning acp pdm controller
In reply to Syed Saba KareemAdd common code for scanning acp pdm controller and create platform device for the same.
--- sound/soc/amd/acp/acp-legacy-common.c | 52 +++++++++++++++++++++++++++ sound/soc/amd/acp/acp-pci.c | 11 +++++- sound/soc/amd/acp/amd.h | 22 ++++++++++++ sound/soc/amd/acp/chip_offset_byte.h | 1 + sound/soc/amd/mach-config.h | 1 + 5 files changed, 86 insertions(+), 1 deletion(-)
sound/soc/amd/acp/acp-legacy-common.c +52 -0
@@ -16,6 +16,10 @@#include <linux/pci.h> #include <linux/export.h> +#define ACP_RENOIR_PDM_ADDR 0x02 +#define ACP_REMBRANDT_PDM_ADDR 0x03 +#define ACP63_PDM_ADDR 0x02 +void acp_enable_interrupts (struct acp_dev_data *adata) {struct acp_resource *rsrc = adata->rsrc;
@@ -348,4 +352,52 @@ int smn_read(struct pci_dev *dev, u32 smn_addr) }EXPORT_SYMBOL_NS_GPL (smn_read,SND_SOC_ACP_COMMON ); +int check_acp_pdm (struct pci_dev *pci,struct acp_chip_info *chip) +{ +struct acpi_device *pdm_dev; +const union acpi_object *obj; +u32 pdm_addr, val; + + val =readl (chip->base +ACP_PIN_CONFIG ); +switch (val) { +case ACP_CONFIG_4 : +case ACP_CONFIG_5 : +case ACP_CONFIG_6 : +case ACP_CONFIG_7 : +case ACP_CONFIG_8 : +case ACP_CONFIG_10 : +case ACP_CONFIG_11 : +case ACP_CONFIG_12 : +case ACP_CONFIG_13 : +case ACP_CONFIG_14 : +break ; +default : +return -EINVAL ; + } + +switch (chip->acp_rev) { +case ACP3X_DEV : + pdm_addr =ACP_RENOIR_PDM_ADDR ; +break ; +case ACP6X_DEV : + pdm_addr =ACP_REMBRANDT_PDM_ADDR ; +break ; +case ACP63_DEV : + pdm_addr =ACP63_PDM_ADDR ; +break ; +default : +return -EINVAL ; + } + + pdm_dev =acpi_find_child_device (ACPI_COMPANION (&pci->dev), pdm_addr,0 ); +if (pdm_dev) { +if (!acpi_dev_get_property (pdm_dev,"acp-audio-device-type" , +ACPI_TYPE_INTEGER , &obj) && + obj->integer.value == pdm_addr) +return 0 ; + } +return -ENODEV ; +} +EXPORT_SYMBOL_NS_GPL (check_acp_pdm,SND_SOC_ACP_COMMON ); +MODULE_LICENSE ("Dual BSD/GPL" );
sound/soc/amd/acp/acp-pci.c +10 -1
@@ -55,7 +55,7 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_idint ret; flag =snd_amd_acp_find_config (pci); -if (flag !=FLAG_AMD_LEGACY ) +if (flag !=FLAG_AMD_LEGACY && flag !=FLAG_AMD_LEGACY_ONLY_DMIC )return -ENODEV ; chip =devm_kzalloc (&pci->dev,sizeof (*chip),GFP_KERNEL );
@@ -129,6 +129,13 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id } } +if (flag ==FLAG_AMD_LEGACY_ONLY_DMIC ) { + ret =check_acp_pdm (pci, chip); +if (ret <0 ) + goto skip_pdev_creation; + } + + chip->flag = flag;memset (&pdevinfo,0 ,sizeof (pdevinfo)); pdevinfo.name = chip->name;
@@ -145,6 +152,8 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id ret =PTR_ERR (pdev); goto unregister_dmic_dev; } + +skip_pdev_creation: chip->chip_pdev = pdev;dev_set_drvdata (&pci->dev, chip);pm_runtime_set_autosuspend_delay (&pci->dev,2000 );
sound/soc/amd/acp/amd.h +22 -0
@@ -133,6 +133,7 @@ struct acp_chip_info {unsigned int acp_rev;/* ACP Revision id */ void __iomem *base;/* ACP memory PCI base */ struct platform_device *chip_pdev; +unsigned int flag;/* Distinguish b/w Legacy or Only PDM */ };struct acp_stream {
@@ -188,6 +189,25 @@ struct acp_dev_data {u32 xfer_rx_resolution[3 ]; }; +enum acp_config { +ACP_CONFIG_0 =0 , +ACP_CONFIG_1 , +ACP_CONFIG_2 , +ACP_CONFIG_3 , +ACP_CONFIG_4 , +ACP_CONFIG_5 , +ACP_CONFIG_6 , +ACP_CONFIG_7 , +ACP_CONFIG_8 , +ACP_CONFIG_9 , +ACP_CONFIG_10 , +ACP_CONFIG_11 , +ACP_CONFIG_12 , +ACP_CONFIG_13 , +ACP_CONFIG_14 , +ACP_CONFIG_15 , +}; +extern const struct snd_soc_dai_ops asoc_acp_cpu_dai_ops;extern const struct snd_soc_dai_ops acp_dmic_dai_ops;
@@ -214,6 +234,8 @@ void restore_acp_pdm_params(struct snd_pcm_substream *substream,int restore_acp_i2s_params (struct snd_pcm_substream *substream,struct acp_dev_data *adata,struct acp_stream *stream); +int check_acp_pdm (struct pci_dev *pci,struct acp_chip_info *chip); +static inline u64 acp_get_byte_count (struct acp_dev_data *adata,int dai_id,int direction) {u64 byte_count =0 , low =0 , high =0 ;
sound/soc/amd/acp/chip_offset_byte.h +1 -0
@@ -19,6 +19,7 @@#define ACP_PGFSM_STATUS 0x1420#define ACP_SOFT_RESET 0x1000#define ACP_CONTROL 0x1004 +#define ACP_PIN_CONFIG 0x1440#define ACP_EXTERNAL_INTR_REG_ADDR (adata, offset, ctrl) \ (adata->acp_base + adata->rsrc->irq_reg_offset + offset + (ctrl * 0x04))
sound/soc/amd/mach-config.h +1 -0
@@ -15,6 +15,7 @@#define FLAG_AMD_SOF BIT(1)#define FLAG_AMD_SOF_ONLY_DMIC BIT(2)#define FLAG_AMD_LEGACY BIT(3) +#define FLAG_AMD_LEGACY_ONLY_DMIC BIT(4)#define ACP_PCI_DEV_ID 0x15E2
Signature · 1 line
2.25.1
kernel test robot
build botRe: [PATCH 06/13] ASoC: amd: acp: add code for scanning acp pdm controller
kernel test robot noticed the following build errors:
Hi Syed,
kernel test robot noticed the following build errors:
[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v6.6-rc7 next-20231026] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Syed-Saba-Kareem/ASoC-amd-acp-refactor-acp-i2s-clock-generation-code/20231021-225635 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next patch link: https://lore.kernel.org/r/20231021145110.478744-6-Syed.SabaKareem%40amd.com patch subject: [PATCH 06/13] ASoC: amd: acp: add code for scanning acp pdm controller config: i386-buildonly-randconfig-002-20231026 (https://download.01.org/0day-ci/archive/20231026/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231026/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
sound/soc/amd/acp/acp-legacy-common.c: In function 'check_acp_pdm':
>> sound/soc/amd/acp/acp-legacy-common.c:392:12: error: implicit declaration of function 'acpi_find_child_device'; did you mean 'acpi_match_device'? [-Werror=implicit-function-declaration]
pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), pdm_addr, 0);
^~~~~~~~~~~~~~~~~~~~~~
acpi_match_device
>> sound/soc/amd/acp/acp-legacy-common.c:392:10: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), pdm_addr, 0);
^cc1: some warnings being treated as errors
vim +392 sound/soc/amd/acp/acp-legacy-common.c
354
355 int check_acp_pdm(struct pci_dev *pci, struct acp_chip_info *chip)
356 {
357 struct acpi_device *pdm_dev;
358 const union acpi_object *obj;
359 u32 pdm_addr, val;
360
361 val = readl(chip->base + ACP_PIN_CONFIG);
362 switch (val) {
363 case ACP_CONFIG_4:
364 case ACP_CONFIG_5:
365 case ACP_CONFIG_6:
366 case ACP_CONFIG_7:
367 case ACP_CONFIG_8:
368 case ACP_CONFIG_10:
369 case ACP_CONFIG_11:
370 case ACP_CONFIG_12:
371 case ACP_CONFIG_13:
372 case ACP_CONFIG_14:
373 break;
374 default:
375 return -EINVAL;
376 }
377
378 switch (chip->acp_rev) {
379 case ACP3X_DEV:
380 pdm_addr = ACP_RENOIR_PDM_ADDR;
381 break;
382 case ACP6X_DEV:
383 pdm_addr = ACP_REMBRANDT_PDM_ADDR;
384 break;
385 case ACP63_DEV:
386 pdm_addr = ACP63_PDM_ADDR;
387 break;
388 default:
389 return -EINVAL;
390 }
391
> 392 pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), pdm_addr, 0);
393 if (pdm_dev) {
394 if (!acpi_dev_get_property(pdm_dev, "acp-audio-device-type",
395 ACPI_TYPE_INTEGER, &obj) &&
396 obj->integer.value == pdm_addr)
397 return 0;
398 }
399 return -ENODEV;
400 }
401 EXPORT_SYMBOL_NS_GPL(check_acp_pdm, SND_SOC_ACP_COMMON);
402
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 7/13 ASoC: amd: acp: add platform and flag data to acp data structure
In reply to Syed Saba Kareemadd name of the platform and flag data in private data structure. name of the platform will be used to differentiate platforms where as flag will be used to know what kind of endpoint configuration is selected where its legacy(I2S + PDM) or only ACP PDM.
--- sound/soc/amd/acp/acp-rembrandt.c | 5 ++++- sound/soc/amd/acp/acp-renoir.c | 3 +++ sound/soc/amd/acp/acp63.c | 4 ++++ sound/soc/amd/acp/amd.h | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-)
sound/soc/amd/acp/acp-rembrandt.c +4 -1
@@ -23,6 +23,8 @@#include <linux/pm_runtime.h> #include "amd.h" +#include "../mach-config.h" +#include "acp-mach.h" #define DRV_NAME "acp_asoc_rembrandt"
@@ -226,7 +228,8 @@ static int rembrandt_audio_probe(struct platform_device *pdev) adata->dai_driver = acp_rmb_dai; adata->num_dai =ARRAY_SIZE (acp_rmb_dai); adata->rsrc = &rsrc; - + adata->platform =REMBRANDT ; + adata->flag = chip->flag; adata->machines = snd_soc_acpi_amd_rmb_acp_machines;acp_machine_select (adata);
sound/soc/amd/acp/acp-renoir.c +3 -0
@@ -22,6 +22,7 @@#include <linux/dma-mapping.h> #include "amd.h" +#include "acp-mach.h" #define DRV_NAME "acp_asoc_renoir"
@@ -185,6 +186,8 @@ static int renoir_audio_probe(struct platform_device *pdev) adata->dai_driver = acp_renoir_dai; adata->num_dai =ARRAY_SIZE (acp_renoir_dai); adata->rsrc = &rsrc; + adata->platform =RENOIR ; + adata->flag = chip->flag; adata->machines = snd_soc_acpi_amd_acp_machines;acp_machine_select (adata);
sound/soc/amd/acp/acp63.c +4 -0
@@ -21,6 +21,8 @@#include <linux/pm_runtime.h> #include <linux/pci.h> #include "amd.h" +#include "acp-mach.h" +#include "../mach-config.h" #define DRV_NAME "acp_asoc_acp63"
@@ -237,6 +239,8 @@ static int acp63_audio_probe(struct platform_device *pdev) adata->dai_driver = acp63_dai; adata->num_dai =ARRAY_SIZE (acp63_dai); adata->rsrc = &rsrc; + adata->platform =ACP63 ; + adata->flag = chip->flag; adata->machines = snd_soc_acpi_amd_acp63_acp_machines;acp_machine_select (adata);dev_set_drvdata (dev, adata);
sound/soc/amd/acp/amd.h +2 -0
@@ -187,6 +187,8 @@ struct acp_dev_data {u32 tdm_rx_fmt[3 ];u32 xfer_tx_resolution[3 ];u32 xfer_rx_resolution[3 ]; +unsigned int flag; +unsigned int platform; };enum acp_config {
Signature · 1 line
2.25.1
PATCH 8/13 ASoC: amd: acp: add condition check for i2s clock generation
In reply to Syed Saba Kareemfor only PDM endpoint i2s master clock is not required. Add a condition check for the same based on chip flag value.
--- sound/soc/amd/acp/acp-rembrandt.c | 12 ++++++++++-- sound/soc/amd/acp/acp63.c | 12 ++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-)
sound/soc/amd/acp/acp-rembrandt.c +10 -2
@@ -191,6 +191,7 @@ static int rembrandt_audio_probe(struct platform_device *pdev)struct acp_chip_info *chip;struct acp_dev_data *adata;struct resource *res; +u32 ret; chip =dev_get_platdata (&pdev->dev);if (!chip || !chip->base) {
@@ -234,7 +235,12 @@ static int rembrandt_audio_probe(struct platform_device *pdev)acp_machine_select (adata);dev_set_drvdata (dev, adata); -acp6x_master_clock_generate (dev); + +if (chip->flag !=FLAG_AMD_LEGACY_ONLY_DMIC ) { + ret =acp6x_master_clock_generate (dev); +if (ret) +return ret; + }acp_enable_interrupts (adata);acp_platform_register (dev);pm_runtime_set_autosuspend_delay (&pdev->dev,ACP_SUSPEND_DELAY_MS );
@@ -263,7 +269,9 @@ static int __maybe_unused rmb_pcm_resume(struct device *dev)snd_pcm_uframes_t buf_in_frames;u64 buf_size; -acp6x_master_clock_generate (dev); +if (adata->flag !=FLAG_AMD_LEGACY_ONLY_DMIC ) +acp6x_master_clock_generate (dev); +spin_lock (&adata->acp_lock);list_for_each_entry (stream, &adata->stream_list, list) { substream = stream->substream;
sound/soc/amd/acp/acp63.c +8 -4
@@ -244,10 +244,12 @@ static int acp63_audio_probe(struct platform_device *pdev) adata->machines = snd_soc_acpi_amd_acp63_acp_machines;acp_machine_select (adata);dev_set_drvdata (dev, adata); - ret =acp63_i2s_master_clock_generate (adata); -if (ret) -return ret; +if (chip->flag !=FLAG_AMD_LEGACY_ONLY_DMIC ) { + ret =acp63_i2s_master_clock_generate (adata); +if (ret) +return ret; + }acp_enable_interrupts (adata);acp_platform_register (dev);pm_runtime_set_autosuspend_delay (&pdev->dev,ACP_SUSPEND_DELAY_MS );
@@ -276,7 +278,9 @@ static int __maybe_unused acp63_pcm_resume(struct device *dev)snd_pcm_uframes_t buf_in_frames;u64 buf_size; -acp63_i2s_master_clock_generate (adata); +if (adata->flag !=FLAG_AMD_LEGACY_ONLY_DMIC ) +acp63_i2s_master_clock_generate (adata); +spin_lock (&adata->acp_lock);list_for_each_entry (stream, &adata->stream_list, list) {if (stream) {
Signature · 1 line
2.25.1
PATCH 9/13 ASoC: amd: acp: add machine driver support for pdm use case
In reply to Syed Saba Kareemadd pdm use case machine driver support
--- sound/soc/amd/acp/acp-legacy-mach.c | 12 ++++++++++++ sound/soc/amd/acp/acp-platform.c | 29 ++++++++++++++++++----------- 2 files changed, 30 insertions(+), 11 deletions(-)
sound/soc/amd/acp/acp-legacy-mach.c +12 -0
@@ -84,6 +84,11 @@ static struct acp_card_drvdata rt5682s_rt1019_rmb_data = { .tdm_mode = false, }; +static struct acp_card_drvdata acp_dmic_data = { + .dmic_cpu_id =DMIC , + .dmic_codec_id =DMIC , +}; +static bool acp_asoc_init_ops (struct acp_card_drvdata *priv) {bool has_ops = false;
@@ -165,6 +170,8 @@ static int acp_asoc_probe(struct platform_device *pdev) card->name, ret); goto out; } +if (!strcmp (pdev->name,"acp-pdm-mach" )) + acp_card_drvdata->platform = *((int *)dev->platform_data); dmi_id =dmi_first_match (acp_quirk_table);if (dmi_id && dmi_id->driver_data)
@@ -214,6 +221,10 @@ static const struct platform_device_id board_ids[] = { .name = "rmb-rt5682s-rt1019", .driver_data = (kernel_ulong_t)&rt5682s_rt1019_rmb_data, }, + { + .name = "acp-pdm-mach", + .driver_data = (kernel_ulong_t)&acp_dmic_data, + }, { } };static struct platform_driver acp_asoc_audio = {
@@ -235,4 +246,5 @@ MODULE_ALIAS("platform:acp3xalc5682s1019");MODULE_ALIAS ("platform:acp3x-es83xx" );MODULE_ALIAS ("platform:rmb-nau8825-max" );MODULE_ALIAS ("platform:rmb-rt5682s-rt1019" ); +MODULE_ALIAS ("platform:acp-pdm-mach" );MODULE_LICENSE ("GPL v2" );
sound/soc/amd/acp/acp-platform.c +18 -11
@@ -21,6 +21,8 @@#include <linux/dma-mapping.h> #include "amd.h" +#include "../mach-config.h" +#include "acp-mach.h" #define DRV_NAME "acp_i2s_dma"
@@ -69,20 +71,25 @@ static const struct snd_pcm_hardware acp_pcm_hardware_capture = {int acp_machine_select (struct acp_dev_data *adata) {struct snd_soc_acpi_mach *mach; -int size; - - size =sizeof (*adata->machines); - mach =snd_soc_acpi_find_machine (adata->machines); -if (!mach) { -dev_err (adata->dev,"warning: No matching ASoC machine driver found\n" ); -return -EINVAL ; +int size, platform; + +if (adata->flag ==FLAG_AMD_LEGACY_ONLY_DMIC ) { + platform = adata->platform; + adata->mach_dev =platform_device_register_data (adata->dev,"acp-pdm-mach" , +PLATFORM_DEVID_NONE , &platform, +sizeof (platform)); + }else { + size =sizeof (*adata->machines); + mach =snd_soc_acpi_find_machine (adata->machines); +if (!mach) { +dev_err (adata->dev,"warning: No matching ASoC machine driver found\n" ); +return -EINVAL ; + } + adata->mach_dev =platform_device_register_data (adata->dev, mach->drv_name, +PLATFORM_DEVID_NONE , mach, size); } - - adata->mach_dev =platform_device_register_data (adata->dev, mach->drv_name, -PLATFORM_DEVID_NONE , mach, size);if (IS_ERR (adata->mach_dev))dev_warn (adata->dev,"Unable to register Machine device\n" ); -return 0 ; }EXPORT_SYMBOL_NS_GPL (acp_machine_select,SND_SOC_ACP_COMMON );
Signature · 1 line
2.25.1
Re: [PATCH 09/13] ASoC: amd: acp: add machine driver support for pdm use case
Quoted 20 lines · Syed Saba Kareem
add pdm use case machine driver support
Signed-off-by Syed Saba Kareem <[email protected]>---
sound/soc/amd/acp/acp-legacy-mach.c +4
-0dmi_id =dmi_first_match (acp_quirk_table);if (dmi_id && dmi_id->driver_data)@@ -214,6 +221,10 @@ static const struct platform_device_id board_ids[] = { .name = "rmb-rt5682s-rt1019", .driver_data = (kernel_ulong_t)&rt5682s_rt1019_rmb_data, }, + { + .name = "acp-pdm-mach", + .driver_data = (kernel_ulong_t)&acp_dmic_data, + }, { } };static struct platform_driver acp_asoc_audio = {
sound/soc/amd/acp/acp-legacy-mach.c MODULE_ALIAS("platform:acp3xalc5682s1019"); · line 249
Quoted 4 lines
sound/soc/amd/acp/acp-legacy-mach.c +1
-0@@ -235,4 +246,5 @@ MODULE_ALIAS("platform:acp3xalc5682s1019");MODULE_ALIAS ("platform:acp3x-es83xx" );MODULE_ALIAS ("platform:rmb-nau8825-max" );MODULE_ALIAS ("platform:rmb-rt5682s-rt1019" ); +MODULE_ALIAS ("platform:acp-pdm-mach" );
Please stop growing the aliases. Module alias is not a substitute for missing MODULE_DEVICE_TABLE.
Best regards,
Krzysztof
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Mark Brown
maintainerRe: [PATCH 09/13] ASoC: amd: acp: add machine driver support for pdm use case
Quoted 5 lines · Mario Limonciello
What would actually go into
MODULE_DEVICE_TABLE?The platform devices created are contingent upon what was found during the top level ACP driver probe. You don't want all the "child" platform drivers to load unless they're needed.
You want
MODULE_DEVICE_TABLE(platform, board_ids);
which is effectively the same as all the MODULE_ALIAS items you have there (which can be removed).
Re: [PATCH 09/13] ASoC: amd: acp: add machine driver support for pdm use case
Quoted 6 lines · Mark Brown
Quoted 4 lines · Mario Limonciello
What would actually go into
MODULE_DEVICE_TABLE?
The platform devices created are contingent upon what was found during the top level ACP driver probe. You don't want all the "child" platform drivers to load unless they're needed.
Quoted 6 lines
You want
MODULE_DEVICE_TABLE(platform, board_ids);which is effectively the same as all the
MODULE_ALIASitems you have there (which can be removed).
@krzk:as Mark Brown explained we can use platform device id table
instead of MODULE_ALIAS. As effectively there is no difference between
using platform device id table and MODULE_ALIAS.
If you are still expecting us to use platform id table instead of MODULE_ALIAS
we will provide the changes as an incremental patch.
Re: [PATCH 09/13] ASoC: amd: acp: add machine driver support for pdm use case
Quoted 12 lines · syed saba kareem
Quoted 10 lines · Mark Brown
Quoted 4 lines · Mario Limonciello
What would actually go into
MODULE_DEVICE_TABLE?
The platform devices created are contingent upon what was found during the top level ACP driver probe. You don't want all the "child" platform drivers to load unless they're needed.You want
MODULE_DEVICE_TABLE(platform, board_ids);
Quoted 8 lines
Quoted 2 lines
which is effectively the same as all the
MODULE_ALIASitems you have there (which can be removed).@krzk:as Mark Brown explained we can use platform device id table
instead of
MODULE_ALIAS. As effectively there is no difference betweenusing platform device id table and
MODULE_ALIAS.
There is a difference. MODULE_DEVICE_TABLE solves the problem and you do not need to spread aliases all over. This code is not equivalent. What's more, DEVICE_TABLE could be used for other purposes like dependency detection or ordering or whatever. ALIAS not.
Quoted 3 lines
If you are still expecting us to use platform id table instead of
MODULE_ALIAS
Yes, I asked this first time.
Quoted 2 lines
we will provide the changes as an incremental patch.
Fix existing driver before adding new aliases. Then don't add ALIAS, how I asked already two times before.
Best regards,
Krzysztof
PATCH 10/13 ASoC: amd: acp: change acp-deinit function arguments
In reply to Syed Saba Kareemacp-deinit function will not be same for all platforms. To make platform specific changes in acp-deinit function, instead of passing base address pass chip structure which contains acp_rev feild. chip->acp_rev will be used to add platform specific code in acp-deinit().
--- sound/soc/amd/acp/acp-legacy-common.c | 6 +++--- sound/soc/amd/acp/acp-pci.c | 4 ++-- sound/soc/amd/acp/amd.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
sound/soc/amd/acp/acp-legacy-common.c +3 -3
@@ -320,16 +320,16 @@ int acp_init(struct acp_chip_info *chip) }EXPORT_SYMBOL_NS_GPL (acp_init,SND_SOC_ACP_COMMON ); -int acp_deinit (void __iomem *base) +int acp_deinit (struct acp_chip_info *chip) {int ret;/* Reset */ - ret =acp_reset (base); + ret =acp_reset (chip->base);if (ret)return ret; -writel (0 , base +ACP_CONTROL ); +writel (0 , chip->base +ACP_CONTROL );return 0 ; }EXPORT_SYMBOL_NS_GPL (acp_deinit,SND_SOC_ACP_COMMON );
sound/soc/amd/acp/acp-pci.c +2 -2
@@ -178,7 +178,7 @@ static int __maybe_unused snd_acp_suspend(struct device *dev)int ret; chip =dev_get_drvdata (dev); - ret =acp_deinit (chip->base); + ret =acp_deinit (chip);if (ret)dev_err (dev,"ACP de-init failed\n" );return ret;
@@ -219,7 +219,7 @@ static void acp_pci_remove(struct pci_dev *pci)platform_device_unregister (dmic_dev);if (pdev)platform_device_unregister (pdev); - ret =acp_deinit (chip->base); + ret =acp_deinit (chip);if (ret)dev_err (&pci->dev,"ACP de-init failed\n" ); }
sound/soc/amd/acp/amd.h +1 -1
@@ -222,7 +222,7 @@ int smn_read(struct pci_dev *dev, u32 smn_addr);int smn_write (struct pci_dev *dev,u32 smn_addr,u32 data);int acp_init (struct acp_chip_info *chip); -int acp_deinit (void __iomem *base); +int acp_deinit (struct acp_chip_info *chip);void acp_enable_interrupts (struct acp_dev_data *adata);void acp_disable_interrupts (struct acp_dev_data *adata);/* Machine configuration */
Signature · 1 line
2.25.1
PATCH 11/13 ASoC: amd: acp: change acp power on mask macro value
In reply to Syed Saba Kareemchange acp power on mask macro value so that same macro can be used for all amd platforms.
--- sound/soc/amd/acp/amd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/acp/amd.h +1 -1
@@ -101,7 +101,7 @@#define ACP_SOFT_RST_DONE_MASK 0x00010001 -#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x01 +#define ACP_PGFSM_CNTL_POWER_ON_MASK 0xffffffff#define ACP_PGFSM_CNTL_POWER_OFF_MASK 0x00#define ACP_PGFSM_STATUS_MASK 0x03#define ACP_POWERED_ON 0x00
Signature · 1 line
2.25.1
PATCH 12/13 ASoC: amd: acp: Add pci legacy driver support for acp7.0 platform
In reply to Syed Saba KareemAdd pci legacy driver support and create platform driver for acp7.0 platform.
--- sound/soc/amd/acp/acp-legacy-common.c | 11 +- sound/soc/amd/acp/acp-mach.h | 1 + sound/soc/amd/acp/acp-pci.c | 4 + sound/soc/amd/acp/acp70.c | 254 ++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 4 + 5 files changed, 273 insertions(+), 1 deletion(-) create mode 100644 sound/soc/amd/acp/acp70.c
sound/soc/amd/acp/acp-legacy-common.c +10 -1
@@ -19,6 +19,7 @@#define ACP_RENOIR_PDM_ADDR 0x02#define ACP_REMBRANDT_PDM_ADDR 0x03#define ACP63_PDM_ADDR 0x02 +#define ACP70_PDM_ADDR 0x02void acp_enable_interrupts (struct acp_dev_data *adata) {
@@ -268,6 +269,10 @@ static int acp_power_on(struct acp_chip_info *chip) acp_pgfsm_stat_reg =ACP63_PGFSM_STATUS ; acp_pgfsm_ctrl_reg =ACP63_PGFSM_CONTROL ;break ; +case ACP70_DEV : + acp_pgfsm_stat_reg =ACP70_PGFSM_STATUS ; + acp_pgfsm_ctrl_reg =ACP70_PGFSM_CONTROL ; +break ;default :return -EINVAL ; }
@@ -329,7 +334,8 @@ int acp_deinit(struct acp_chip_info *chip)if (ret)return ret; -writel (0 , chip->base +ACP_CONTROL ); +if (chip->acp_rev !=ACP70_DEV ) +writel (0 , chip->base +ACP_CONTROL );return 0 ; }EXPORT_SYMBOL_NS_GPL (acp_deinit,SND_SOC_ACP_COMMON );
@@ -385,6 +391,9 @@ int check_acp_pdm(struct pci_dev *pci, struct acp_chip_info *chip)case ACP63_DEV : pdm_addr =ACP63_PDM_ADDR ;break ; +case ACP70_DEV : + pdm_addr =ACP70_PDM_ADDR ; +break ;default :return -EINVAL ; }
sound/soc/amd/acp/acp-mach.h +1 -0
@@ -54,6 +54,7 @@ enum platform_end_point {RENOIR =0 ,REMBRANDT ,ACP63 , + ACP70, }; struct acp_mach_ops {
sound/soc/amd/acp/acp-pci.c +4 -0
@@ -91,6 +91,10 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id chip->name ="acp_asoc_acp63" ; chip->acp_rev =ACP63_DEV ;break ; +case 0x70 : + chip->name ="acp_asoc_acp70" ; + chip->acp_rev =ACP70_DEV ; +break ;default :dev_err (dev,"Unsupported device revision:0x%x\n" , pci->revision); ret = -EINVAL ;
sound/soc/amd/acp/acp70.c new file +254 -0
254 lines not on this page · raw message
sound/soc/amd/acp/amd.h +4 -0
@@ -21,6 +21,7 @@#define ACP3X_DEV 3#define ACP6X_DEV 6#define ACP63_DEV 0x63 +#define ACP70_DEV 0x70#define DMIC_INSTANCE 0x00#define I2S_SP_INSTANCE 0x01
@@ -99,6 +100,9 @@#define ACP63_PGFSM_CONTROL ACP6X_PGFSM_CONTROL#define ACP63_PGFSM_STATUS ACP6X_PGFSM_STATUS +#define ACP70_PGFSM_CONTROL ACP6X_PGFSM_CONTROL +#define ACP70_PGFSM_STATUS ACP6X_PGFSM_STATUS +#define ACP_SOFT_RST_DONE_MASK 0x00010001#define ACP_PGFSM_CNTL_POWER_ON_MASK 0xffffffff
Signature · 1 line
2.25.1
Re: [PATCH 12/13] ASoC: amd: acp: Add pci legacy driver support for acp7.0 platform
Quoted 5 lines · Syed Saba Kareem
Add pci legacy driver support and create platform driver for acp7.0 platform.
Signed-off-by Syed Saba Kareem <[email protected]>---
...
sound/soc/amd/acp/acp70.c line 56
Quoted 10 lines
sound/soc/amd/acp/acp70.c new file +10
-0+ +static struct snd_soc_dai_driver acp70_dai[] = { +{ + .name ="acp-i2s-sp" , + .id =I2S_SP_INSTANCE , + .playback = { + .stream_name ="I2S SP Playback" , + .rates =SNDRV_PCM_RATE_8000_96000 , + .formats =SNDRV_PCM_FMTBIT_S16_LE |SNDRV_PCM_FMTBIT_S8 | +SNDRV_PCM_FMTBIT_U8 |SNDRV_PCM_FMTBIT_S32_LE ,
Any reason to not go from lowest bit width to higher? Similarly in further definitions.
Quoted 5 lines
sound/soc/amd/acp/acp70.c new file +5
-0+ .channels_min = 2, + .channels_max = 8, + .rate_min = 8000, + .rate_max = 96000, + },
...
Quoted 17 lines
sound/soc/amd/acp/acp70.c new file +17
-0+ +static int __maybe_unused acp70_pcm_resume (struct device *dev) +{ +struct acp_dev_data *adata =dev_get_drvdata (dev); +struct acp_stream *stream; +struct snd_pcm_substream *substream; +snd_pcm_uframes_t buf_in_frames; +u64 buf_size; + +spin_lock (&adata->acp_lock); +list_for_each_entry (stream, &adata->stream_list, list) { +if (stream) { + substream = stream->substream; +if (substream && substream->runtime) { + buf_in_frames = (substream->runtime->buffer_size); + buf_size =frames_to_bytes (substream->runtime, buf_in_frames); +config_pte_for_stream (adata, stream);
sound/soc/amd/acp/acp70.c line 233
Quoted 10 lines
sound/soc/amd/acp/acp70.c new file +10
-0+config_acp_dma (adata, stream, buf_size); +if (stream->dai_id) +restore_acp_i2s_params (substream, adata, stream); +else +restore_acp_pdm_params (substream, adata); + } + } + } +spin_unlock (&adata->acp_lock); +return 0 ;
Indentation is wrong in above two lines.
Quoted 6 lines
sound/soc/amd/acp/acp70.c new file +6
-0+} + +static const struct dev_pm_ops acp70_dma_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (NULL , acp70_pcm_resume) +}; +
Re: [PATCH 12/13] ASoC: amd: acp: Add pci legacy driver support for acp7.0 platform
Quoted 69 lines · Amadeusz Sławiński
Quoted 5 lines · Syed Saba Kareem
Add pci legacy driver support and create platform driver for acp7.0 platform.
Signed-off-by Syed Saba Kareem <[email protected]>---
...
sound/soc/amd/acp/acp70.c line 56
Quoted 10 lines
sound/soc/amd/acp/acp70.c new file +10
-0+ +static struct snd_soc_dai_driver acp70_dai[] = { +{ + .name = "acp-i2s-sp", + .id = I2S_SP_INSTANCE, + .playback = { + .stream_name = "I2S SP Playback", + .rates = SNDRV_PCM_RATE_8000_96000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | + SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE,Any reason to not go from lowest bit width to higher? Similarly in further definitions. This has to be corrected, will push the changes as an incremental patch.
Quoted 5 lines
+ .channels_min = 2,
+ .channels_max = 8,
+ .rate_min = 8000,
+ .rate_max = 96000,
+ },...
Quoted 20 lines
sound/soc/amd/acp/acp70.c new file +16
-0+ +static int __maybe_unused acp70_pcm_resume (struct device *dev) +{ + struct acp_dev_data *adata = dev_get_drvdata(dev); + struct acp_stream *stream; + struct snd_pcm_substream *substream; + snd_pcm_uframes_t buf_in_frames; + u64 buf_size; + + spin_lock(&adata->acp_lock); + list_for_each_entry(stream, &adata->stream_list, list) { + if (stream) { + substream = stream->substream; + if (substream && substream->runtime) { + buf_in_frames = (substream->runtime->buffer_size); + buf_size = frames_to_bytes(substream->runtime,
buf_in_frames);
+config_pte_for_stream(adata, stream); +config_acp_dma(adata, stream, buf_size); + if (stream->dai_id)Quoted 8 lines
+
restore_acp_i2s_params(substream, adata, stream); + else
+restore_acp_pdm_params(substream, adata); + }
+ }
+ }
+spin_unlock(&adata->acp_lock);
+ return 0;Indentation is wrong in above two lines.
This has to be corrected, will push the changes as an incremental patch.Quoted 6 lines
sound/soc/amd/acp/acp70.c new file +6
-0+} + +static const struct dev_pm_ops acp70_dma_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(NULL, acp70_pcm_resume) +}; +
PATCH 13/13 ASoC: amd: acp: add machine driver support for acp7.0
In reply to Syed Saba Kareemadd machine driver support for ACP7.0 on legacy stack.
--- sound/soc/amd/acp/acp-mach-common.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/soc/amd/acp/acp-mach-common.c +9 -0
@@ -1266,6 +1266,12 @@ static struct snd_soc_dai_link_component platform_acp63_component[] = { } }; +static struct snd_soc_dai_link_component platform_acp70_component[] = { + { + .name ="acp_asoc_acp70.0" , + } +}; +static struct snd_soc_dai_link_component sof_component[] = { { .name ="0000:04:00.5" ,
@@ -1692,6 +1698,9 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card) }else if (drv_data->platform ==ACP63 ) { links[i].platforms = platform_acp63_component; links[i].num_platforms =ARRAY_SIZE (platform_acp63_component); + }else if (drv_data->platform ==ACP70 ) { + links[i].platforms = platform_acp70_component; + links[i].num_platforms =ARRAY_SIZE (platform_acp70_component); }else { links[i].platforms = platform_component; links[i].num_platforms =ARRAY_SIZE (platform_component);
Signature · 1 line
2.25.1
Quoted 24 lines · Syed Saba Kareem
Add pci legacy driver support and create platform driver for acp6.3 based platforms.
Signed-off-by Syed Saba Kareem <[email protected]>--- sound/soc/amd/acp/acp-legacy-common.c | 4 + sound/soc/amd/acp/acp-pci.c | 4 + sound/soc/amd/acp/acp63.c | 314 ++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 4 + 4 files changed, 326 insertions(+) create mode 100644 sound/soc/amd/acp/acp63.csound/soc/amd/acp/acp63.c new file +10
-0+ +static const struct dev_pm_ops acp63_dma_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (NULL , acp63_pcm_resume) +}; + +static struct platform_driver acp63_driver = { + .probe = acp63_audio_probe, + .remove_new = acp63_audio_remove, + .driver = { + .name ="acp_asoc_acp63" ,
sound/soc/amd/acp/acp63.c line 314
Quoted 10 lines
sound/soc/amd/acp/acp63.c new file +10
-0+ .pm = &acp63_dma_pm_ops, + }, +}; + +module_platform_driver (acp63_driver); + +MODULE_DESCRIPTION ("AMD ACP acp63 Driver" ); +MODULE_IMPORT_NS (SND_SOC_ACP_COMMON ); +MODULE_LICENSE ("Dual BSD/GPL" ); +MODULE_ALIAS ("platform:" DRV_NAME );
You should not need MODULE_ALIAS() in normal cases. If you need it, usually it means your device ID table is wrong.
Best regards,
Krzysztof
Quoted 28 lines · Krzysztof Kozlowski
Quoted 27 lines · Syed Saba Kareem
Add pci legacy driver support and create platform driver for acp6.3 based platforms.
Signed-off-by Syed Saba Kareem<[email protected]>--- sound/soc/amd/acp/acp-legacy-common.c | 4 + sound/soc/amd/acp/acp-pci.c | 4 + sound/soc/amd/acp/acp63.c | 314 ++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 4 + 4 files changed, 326 insertions(+)create mode 100644
sound/soc/amd/acp/acp63.csound/soc/amd/acp/acp63.c new file +14
-0+ +static const struct dev_pm_ops acp63_dma_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (NULL , acp63_pcm_resume) +}; + +static struct platform_driver acp63_driver = { + .probe = acp63_audio_probe, + .remove_new = acp63_audio_remove, + .driver = { + .name ="acp_asoc_acp63" , + .pm = &acp63_dma_pm_ops, + }, +}; +
Quoted 8 lines
sound/soc/amd/acp/acp63.c line 314
Quoted 6 lines
sound/soc/amd/acp/acp63.c new file +6
-0+module_platform_driver (acp63_driver); + +MODULE_DESCRIPTION ("AMD ACP acp63 Driver" ); +MODULE_IMPORT_NS (SND_SOC_ACP_COMMON ); +MODULE_LICENSE ("Dual BSD/GPL" ); +MODULE_ALIAS ("platform:" DRV_NAME );You should not need
MODULE_ALIAS()in normal cases. If you need it, usually it means your device ID table is wrong.
It is platform driver ,for auto loading MODULE_ALIAS() is required.
Quoted 4 lines
Best regards,
Krzysztof
Quoted 8 lines · syed saba kareem
sound/soc/amd/acp/acp63.c new file +7
-0+ +module_platform_driver (acp63_driver); + +MODULE_DESCRIPTION ("AMD ACP acp63 Driver" ); +MODULE_IMPORT_NS (SND_SOC_ACP_COMMON ); +MODULE_LICENSE ("Dual BSD/GPL" ); +MODULE_ALIAS ("platform:" DRV_NAME );
Quoted 4 lines
You should not need
MODULE_ALIAS()in normal cases. If you need it, usually it means your device ID table is wrong.It is platform driver ,for auto loading
MODULE_ALIAS()is required.
Hm, not really. platform_driver does not need MODULE_ALIAS(). At least 99% of them do not need it. Please help us understand what is broken here that this one platform driver needs alias.
BR,
Krzysztof
Mark Brown
maintainerQuoted 2 lines · Syed Saba Kareem
Add pci legacy driver support and create platform driver for acp6.3 based platforms.
I've queued this series for CI - there were some valid concerns that Amadeusz and Krzysztof raised but they're relatively minor, please send incremental patches fixing these issues (assuming CI is fine).
Will send the fixes as incremental patches.
Quoted 6 lines · Mark Brown
Quoted 2 lines · Syed Saba Kareem
Add pci legacy driver support and create platform driver for acp6.3 based platforms.
I've queued this series for CI - there were some valid concerns that Amadeusz and Krzysztof raised but they're relatively minor, please send incremental patches fixing these issues (assuming CI is fine).
Mark Brown
maintainerQuoted 4 lines · Syed Saba Kareem
Add pci legacy driver support and create platform driver for acp6.3 based platforms.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[01/13] ASoC: amd: acp: Add acp6.3 pci legacy driver support
commit: 33d120a49b970acbe465041d7b71e0cd6a1d1de0
[02/13] ASoC: amd: acp: refactor acp i2s clock generation code
commit: 40f74d5f09d7c068bd7a980dc06a688dc8d2b3e3
[03/13] ASoC: amd: acp: add i2s clock generation support for acp6.3 based platforms
commit: c7bf9156f811bcffb4201a0bf5d1b32d97ec0e5f
[04/13] ASoC: amd: acp: add machine driver support for acp6.3 platform
commit: 9393bfb4c4dea406dd345820a6b39b9c70a7f934
[05/13] ASoC: amd: acp: add Kconfig options for acp6.3 based platform driver
commit: d4c2d5391d7efc29fdd59d54355526c9ace16bec
[06/13] ASoC: amd: acp: add code for scanning acp pdm controller
commit: 3a94c8ad0aae2b14a55059869871ea2d199af489
[07/13] ASoC: amd: acp: add platform and flag data to acp data structure
commit: 57e857770f6021a73af85e6b201203520cb1a529
[08/13] ASoC: amd: acp: add condition check for i2s clock generation
commit: 16fb2a25440a85708778f6442914066c98dc2f1e
[09/13] ASoC: amd: acp: add machine driver support for pdm use case
commit: 39d9ee47167a2210d803f651c8fdcac84f03e766
[10/13] ASoC: amd: acp: change acp-deinit function arguments
commit: 1b6180c095bc9a6c25e38ae1ec6481f8df20a81f
[11/13] ASoC: amd: acp: change acp power on mask macro value
commit: caa126f2b0c821811eedf2e2fd435b11844bf0f1
[12/13] ASoC: amd: acp: Add pci legacy driver support for acp7.0 platform
commit: e84db124cb2158b538820f31f641c28b86fb3ca3
[13/13] ASoC: amd: acp: add machine driver support for acp7.0
commit: b97f4dac40eecfc2fc9b818b427a8eda44cb7763All 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