ASoC: SOF: amd: remove unused code
Subsystems (3)
Vijendar Mukunda
reviewerPATCH 1/6 ASoC: SOF: amd: remove unused code
During initial SOF driver bring up on AMD platforms, only DMIC support was added. As of today, we have a complete SOF solution for I2S endpoints along with DMIC endpoint.
This code is no longer required.
Remove unused code from RMB and RN platform ACP PCI driver.
--- sound/soc/sof/amd/pci-rmb.c | 70 +------------------------------------ sound/soc/sof/amd/pci-rn.c | 70 +------------------------------------ 2 files changed, 2 insertions(+), 138 deletions(-)
sound/soc/sof/amd/pci-rmb.c +1 -69
@@ -27,22 +27,6 @@#define ACP6x_REG_END 0x125C000static struct platform_device *dmic_dev; -static struct platform_device *pdev; - -static const struct resource rembrandt_res[] = { - { - .start =0 , - .end = ACP6x_REG_END - ACP6x_REG_START, - .name ="acp_mem" , - .flags =IORESOURCE_MEM , - }, - { - .start =0 , - .end =0 , - .name ="acp_dai_irq" , - .flags =IORESOURCE_IRQ , - }, -};static const struct sof_amd_acp_desc rembrandt_chip_info = { .rev =6 ,
@@ -83,11 +67,8 @@ static const struct sof_dev_desc rembrandt_desc = {static int acp_pci_rmb_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) { -struct platform_device_info pdevinfo;struct device *dev = &pci->dev; -const struct resource *res_i2s; -struct resource *res; -unsigned int flag, i, addr; +unsigned int flag;int ret; flag =snd_amd_acp_find_config (pci);
@@ -104,53 +85,6 @@ static int acp_pci_rmb_probe(struct pci_dev *pci, const struct pci_device_id *pcsof_pci_remove (pci);return PTR_ERR (dmic_dev); } - -/* Register platform device only if flag set to FLAG_AMD_SOF_ONLY_DMIC */ -if (flag !=FLAG_AMD_SOF_ONLY_DMIC ) -return 0 ; - - addr =pci_resource_start (pci,0 ); - res =devm_kzalloc (&pci->dev,sizeof (struct resource ) *ARRAY_SIZE (rembrandt_res), -GFP_KERNEL ); -if (!res) { -platform_device_unregister (dmic_dev); -sof_pci_remove (pci); -return -ENOMEM ; - } - - res_i2s = rembrandt_res; -for (i =0 ; i <ARRAY_SIZE (rembrandt_res); i++, res_i2s++) { - res[i].name = res_i2s->name; - res[i].flags = res_i2s->flags; - res[i].start = addr + res_i2s->start; - res[i].end = addr + res_i2s->end; -if (res_i2s->flags ==IORESOURCE_IRQ ) { - res[i].start = pci->irq; - res[i].end = res[i].start; - } - } - -memset (&pdevinfo,0 ,sizeof (pdevinfo)); - -/* -* We have common PCI driver probe for ACP device but we have to support I2S without SOF -* for some distributions. Register platform device that will be used to support non dsp -* ACP's audio ends points on some machines. -*/ - pdevinfo.name ="acp_asoc_rembrandt" ; - pdevinfo.id =0 ; - pdevinfo.parent = &pci->dev; - pdevinfo.num_res =ARRAY_SIZE (rembrandt_res); - pdevinfo.res = &res[0 ]; - - pdev =platform_device_register_full (&pdevinfo); -if (IS_ERR (pdev)) { -dev_err (&pci->dev,"cannot register %s device\n" , pdevinfo.name); -platform_device_unregister (dmic_dev); -sof_pci_remove (pci); - ret =PTR_ERR (pdev); - } -return ret; };
@@ -158,8 +92,6 @@ static void acp_pci_rmb_remove(struct pci_dev *pci) {if (dmic_dev)platform_device_unregister (dmic_dev); -if (pdev) -platform_device_unregister (pdev);sof_pci_remove (pci); }
sound/soc/sof/amd/pci-rn.c +1 -69
95 lines not on this page · raw message
Signature · 1 line
2.34.1
Vijendar Mukunda
reviewerPATCH 2/6 ASoC: SOF: amd: remove acp_dai_probe() function
ACP SOF driver supports different audio configurations. Explicit condition check for I2S configuration will break other audio endpoint configurations.
acp_dai_probe() function is not required as we have machine select logic to select the exact machine.
Remove acp_dai_probe() from existing AMD PCI driver code base.
--- sound/soc/sof/amd/acp-common.c | 16 ---------------- sound/soc/sof/amd/acp.h | 1 - sound/soc/sof/amd/rembrandt.c | 4 ---- sound/soc/sof/amd/renoir.c | 3 --- 4 files changed, 24 deletions(-)
sound/soc/sof/amd/acp-common.c +0 -16
@@ -18,22 +18,6 @@#include "acp-dsp-offset.h" #include <sound/sof/xtensa.h> -int acp_dai_probe (struct snd_soc_dai *dai) -{ -struct snd_sof_dev *sdev =snd_soc_component_get_drvdata (dai->component); -const struct sof_amd_acp_desc *desc =get_chip_info (sdev->pdata); -unsigned int val; - - val =snd_sof_dsp_read (sdev,ACP_DSP_BAR , desc->i2s_pin_config_offset); -if (val != desc->i2s_mode) { -dev_err (sdev->dev,"I2S Mode is not supported (I2S_PIN_CONFIG: %#x)\n" , val); -return -EINVAL ; - } - -return 0 ; -} -EXPORT_SYMBOL_NS (acp_dai_probe,SND_SOC_SOF_AMD_COMMON ); -/** * amd_sof_ipc_dump() - This function is called when IPC tx times out. * @sdev: SOF device.
sound/soc/sof/amd/acp.h +0 -1
@@ -248,7 +248,6 @@ int sof_renoir_ops_init(struct snd_sof_dev *sdev);extern struct snd_sof_dsp_ops sof_rembrandt_ops;int sof_rembrandt_ops_init (struct snd_sof_dev *sdev); -int acp_dai_probe (struct snd_soc_dai *dai);struct snd_soc_acpi_mach *amd_sof_machine_select (struct snd_sof_dev *sdev);/* Machine configuration */ int snd_amd_acp_find_config (struct pci_dev *pci);
sound/soc/sof/amd/rembrandt.c +0 -4
@@ -48,7 +48,6 @@ static struct snd_soc_dai_driver rembrandt_sof_dai[] = { .rate_min = 8000, .rate_max = 48000, }, - .probe = &acp_dai_probe, }, [I2S_BT_INSTANCE ] = {
@@ -73,7 +72,6 @@ static struct snd_soc_dai_driver rembrandt_sof_dai[] = { .rate_min = 8000, .rate_max = 48000, }, - .probe = &acp_dai_probe, }, [I2S_SP_INSTANCE ] = {
@@ -98,7 +96,6 @@ static struct snd_soc_dai_driver rembrandt_sof_dai[] = { .rate_min = 8000, .rate_max = 48000, }, - .probe = &acp_dai_probe, }, [PDM_DMIC_INSTANCE ] = {
@@ -126,7 +123,6 @@ static struct snd_soc_dai_driver rembrandt_sof_dai[] = { .rate_min = 8000, .rate_max = 96000, }, - .probe = &acp_dai_probe, }, };
sound/soc/sof/amd/renoir.c +0 -3
@@ -47,7 +47,6 @@ static struct snd_soc_dai_driver renoir_sof_dai[] = { .rate_min = 8000, .rate_max = 48000, }, - .probe = &acp_dai_probe, }, [I2S_SP_INSTANCE ] = {
@@ -72,7 +71,6 @@ static struct snd_soc_dai_driver renoir_sof_dai[] = { .rate_min = 8000, .rate_max = 48000, }, - .probe = &acp_dai_probe, }, [PDM_DMIC_INSTANCE ] = {
@@ -100,7 +98,6 @@ static struct snd_soc_dai_driver renoir_sof_dai[] = { .rate_min = 8000, .rate_max = 96000, }, - .probe = &acp_dai_probe, }, };
Signature · 1 line
2.34.1
Vijendar Mukunda
reviewerPATCH 3/6 ASoC: SOF: amd: remove unused variables
In reply to Vijendar MukundaRemove unused variables - i2s_mode, i2s_pin_config_offset from code.
--- sound/soc/sof/amd/acp.h | 2 -- sound/soc/sof/amd/pci-rmb.c | 2 -- sound/soc/sof/amd/pci-rn.c | 2 -- 3 files changed, 6 deletions(-)
sound/soc/sof/amd/acp.h +0 -2
@@ -158,12 +158,10 @@ struct acp_dsp_stream {struct sof_amd_acp_desc {unsigned int rev;unsigned int host_bridge_id; -unsigned int i2s_mode;u32 pgfsm_base;u32 ext_intr_stat;u32 dsp_intr_base;u32 sram_pte_offset; -u32 i2s_pin_config_offset;u32 hw_semaphore_offset;u32 acp_clkmux_sel;u32 fusion_dsp_offset;
sound/soc/sof/amd/pci-rmb.c +0 -2
@@ -31,12 +31,10 @@ static struct platform_device *dmic_dev;static const struct sof_amd_acp_desc rembrandt_chip_info = { .rev =6 , .host_bridge_id =HOST_BRIDGE_RMB , - .i2s_mode =0x0a , .pgfsm_base =ACP6X_PGFSM_BASE , .ext_intr_stat =ACP6X_EXT_INTR_STAT , .dsp_intr_base =ACP6X_DSP_SW_INTR_BASE , .sram_pte_offset =ACP6X_SRAM_PTE_OFFSET , - .i2s_pin_config_offset =ACP6X_I2S_PIN_CONFIG , .hw_semaphore_offset =ACP6X_AXI2DAGB_SEM_0 , .acp_clkmux_sel =ACP6X_CLKMUX_SEL , .fusion_dsp_offset =ACP6X_DSP_FUSION_RUNSTALL ,
sound/soc/sof/amd/pci-rn.c +0 -2
@@ -31,12 +31,10 @@ static struct platform_device *dmic_dev;static const struct sof_amd_acp_desc renoir_chip_info = { .rev =3 , .host_bridge_id =HOST_BRIDGE_CZN , - .i2s_mode =0x04 , .pgfsm_base =ACP3X_PGFSM_BASE , .ext_intr_stat =ACP3X_EXT_INTR_STAT , .dsp_intr_base =ACP3X_DSP_SW_INTR_BASE , .sram_pte_offset =ACP3X_SRAM_PTE_OFFSET , - .i2s_pin_config_offset =ACP3X_I2S_PIN_CONFIG , .hw_semaphore_offset =ACP3X_AXI2DAGB_SEM_0 , .acp_clkmux_sel =ACP3X_CLKMUX_SEL , };
Signature · 1 line
2.34.1
Vijendar Mukunda
reviewerPATCH 4/6 ASoC: SOF: amd: refactor get_chip_info callback
In reply to Vijendar MukundaMove get_chip_info callback to the start of API.
This should be first check in probe() call.
--- sound/soc/sof/amd/acp.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
sound/soc/sof/amd/acp.c +5 -7
@@ -470,6 +470,11 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)unsigned int addr;int ret; + chip =get_chip_info (sdev->pdata); +if (!chip) { +dev_err (sdev->dev,"no such device supported, chip id:%x\n" , pci->device); +return -EIO ; + } adata =devm_kzalloc (sdev->dev,sizeof (struct acp_dev_data ),GFP_KERNEL );if (!adata)
@@ -486,13 +491,6 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)pci_set_master (pci); sdev->pdata->hw_pdata = adata; - - chip =get_chip_info (sdev->pdata); -if (!chip) { -dev_err (sdev->dev,"no such device supported, chip id:%x\n" , pci->device); -return -EIO ; - } - adata->smn_dev =pci_get_device (PCI_VENDOR_ID_AMD , chip->host_bridge_id,NULL );if (!adata->smn_dev) {dev_err (sdev->dev,"Failed to get host bridge device\n" );
Signature · 1 line
2.34.1
Vijendar Mukunda
reviewerPATCH 5/6 ASoC: SOF: amd: refactor error checks in probe call
In reply to Vijendar MukundaRefactor error checks code in probe() callback.
--- sound/soc/sof/amd/acp.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
sound/soc/sof/amd/acp.c +9 -7
@@ -503,16 +503,12 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)if (ret <0 ) {dev_err (sdev->dev,"failed to register IRQ %d\n" , sdev->ipc_irq); -pci_dev_put (adata->smn_dev); -return ret; + goto free_smn_dev; } ret =acp_init (sdev); -if (ret <0 ) { -free_irq (sdev->ipc_irq, sdev); -pci_dev_put (adata->smn_dev); -return ret; - } +if (ret <0 ) + goto free_ipc_irq; sdev->dsp_box.offset =0 ; sdev->dsp_box.size =BOX_SIZE_512 ;
@@ -528,6 +524,12 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)acp_dsp_stream_init (sdev);return 0 ; + +free_ipc_irq: +free_irq (sdev->ipc_irq, sdev); +free_smn_dev: +pci_dev_put (adata->smn_dev); +return ret; }EXPORT_SYMBOL_NS (amd_sof_acp_probe,SND_SOC_SOF_AMD_COMMON );
Signature · 1 line
2.34.1
Vijendar Mukunda
reviewerPATCH 6/6 ASoC: SOF: amd: refactor dmic codec platform device creation
In reply to Vijendar MukundaUnder snd_sof_dev device scope, create platform device for dmic codec.
--- sound/soc/sof/amd/acp.c | 17 +++++++++++++++-- sound/soc/sof/amd/acp.h | 2 ++ sound/soc/sof/amd/pci-rmb.c | 19 +------------------ sound/soc/sof/amd/pci-rn.c | 19 +------------------ 4 files changed, 19 insertions(+), 38 deletions(-)
sound/soc/sof/amd/acp.c +15 -2
@@ -481,11 +481,18 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)return -ENOMEM ; adata->dev = sdev; + adata->dmic_dev =platform_device_register_data (sdev->dev,"dmic-codec" , +PLATFORM_DEVID_NONE ,NULL ,0 ); +if (IS_ERR (adata->dmic_dev)) { +dev_err (sdev->dev,"failed to register platform for dmic codec\n" ); +return PTR_ERR (adata->dmic_dev); + } addr =pci_resource_start (pci,ACP_DSP_BAR ); sdev->bar[ACP_DSP_BAR ] =devm_ioremap (sdev->dev, addr,pci_resource_len (pci,ACP_DSP_BAR ));if (!sdev->bar[ACP_DSP_BAR ]) {dev_err (sdev->dev,"ioremap error\n" ); -return -ENXIO ; + ret = -ENXIO ; + goto unregister_dev; }pci_set_master (pci);
@@ -494,7 +501,8 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev) adata->smn_dev =pci_get_device (PCI_VENDOR_ID_AMD , chip->host_bridge_id,NULL );if (!adata->smn_dev) {dev_err (sdev->dev,"Failed to get host bridge device\n" ); -return -ENODEV ; + ret = -ENODEV ; + goto unregister_dev; } sdev->ipc_irq = pci->irq;
@@ -529,6 +537,8 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)free_irq (sdev->ipc_irq, sdev); free_smn_dev:pci_dev_put (adata->smn_dev); +unregister_dev: +platform_device_unregister (adata->dmic_dev);return ret; }EXPORT_SYMBOL_NS (amd_sof_acp_probe,SND_SOC_SOF_AMD_COMMON );
@@ -543,6 +553,9 @@ int amd_sof_acp_remove(struct snd_sof_dev *sdev)if (sdev->ipc_irq)free_irq (sdev->ipc_irq, sdev); +if (adata->dmic_dev) +platform_device_unregister (adata->dmic_dev); +return acp_reset (sdev); }EXPORT_SYMBOL_NS (amd_sof_acp_remove,SND_SOC_SOF_AMD_COMMON );
sound/soc/sof/amd/acp.h +2 -0
@@ -170,6 +170,8 @@ struct sof_amd_acp_desc {/* Common device data struct for ACP devices */ struct acp_dev_data {struct snd_sof_dev *dev; +/* DMIC device */ +struct platform_device *dmic_dev;unsigned int fw_bin_size;unsigned int fw_data_bin_size;u32 fw_bin_page_count;
sound/soc/sof/amd/pci-rmb.c +1 -18
@@ -26,8 +26,6 @@#define ACP6x_REG_START 0x1240000#define ACP6x_REG_END 0x125C000 -static struct platform_device *dmic_dev; -static const struct sof_amd_acp_desc rembrandt_chip_info = { .rev =6 , .host_bridge_id =HOST_BRIDGE_RMB ,
@@ -65,32 +63,17 @@ static const struct sof_dev_desc rembrandt_desc = {static int acp_pci_rmb_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) { -struct device *dev = &pci->dev;unsigned int flag; -int ret; flag =snd_amd_acp_find_config (pci);if (flag !=FLAG_AMD_SOF && flag !=FLAG_AMD_SOF_ONLY_DMIC )return -ENODEV ; - ret =sof_pci_probe (pci, pci_id); -if (ret !=0 ) -return ret; - - dmic_dev =platform_device_register_data (dev,"dmic-codec" ,PLATFORM_DEVID_NONE ,NULL ,0 ); -if (IS_ERR (dmic_dev)) { -dev_err (dev,"failed to create DMIC device\n" ); -sof_pci_remove (pci); -return PTR_ERR (dmic_dev); - } -return ret; +return sof_pci_probe (pci, pci_id); };static void acp_pci_rmb_remove (struct pci_dev *pci) { -if (dmic_dev) -platform_device_unregister (dmic_dev); -sof_pci_remove (pci); }
sound/soc/sof/amd/pci-rn.c +1 -18
@@ -26,8 +26,6 @@#define ACP3x_REG_START 0x1240000#define ACP3x_REG_END 0x125C000 -static struct platform_device *dmic_dev; -static const struct sof_amd_acp_desc renoir_chip_info = { .rev =3 , .host_bridge_id =HOST_BRIDGE_CZN ,
@@ -65,32 +63,17 @@ static const struct sof_dev_desc renoir_desc = {static int acp_pci_rn_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) { -struct device *dev = &pci->dev;unsigned int flag; -int ret; flag =snd_amd_acp_find_config (pci);if (flag !=FLAG_AMD_SOF && flag !=FLAG_AMD_SOF_ONLY_DMIC )return -ENODEV ; - ret =sof_pci_probe (pci, pci_id); -if (ret !=0 ) -return ret; - - dmic_dev =platform_device_register_data (dev,"dmic-codec" ,PLATFORM_DEVID_NONE ,NULL ,0 ); -if (IS_ERR (dmic_dev)) { -dev_err (dev,"failed to create DMIC device\n" ); -sof_pci_remove (pci); -return PTR_ERR (dmic_dev); - } -return ret; +return sof_pci_probe (pci, pci_id); };static void acp_pci_rn_remove (struct pci_dev *pci) { -if (dmic_dev) -platform_device_unregister (dmic_dev); -return sof_pci_remove (pci); }
Signature · 1 line
2.34.1
PATCH 2/6 ASoC: SOF: amd: remove acp_dai_probe() function
In reply to Vijendar MukundaACP SOF driver supports different audio configurations. Explicit condition check for I2S configuration will break other audio endpoint configurations.
acp_dai_probe() function is not required as we have machine select logic to select the exact machine.
Remove acp_dai_probe() from existing AMD PCI driver code base.
--- sound/soc/sof/amd/acp-common.c | 16 ---------------- sound/soc/sof/amd/acp.h | 1 - sound/soc/sof/amd/rembrandt.c | 4 ---- sound/soc/sof/amd/renoir.c | 3 --- 4 files changed, 24 deletions(-)
sound/soc/sof/amd/acp-common.c +0 -16
@@ -18,22 +18,6 @@#include "acp-dsp-offset.h" #include <sound/sof/xtensa.h> -int acp_dai_probe (struct snd_soc_dai *dai) -{ -struct snd_sof_dev *sdev =snd_soc_component_get_drvdata (dai->component); -const struct sof_amd_acp_desc *desc =get_chip_info (sdev->pdata); -unsigned int val; - - val =snd_sof_dsp_read (sdev,ACP_DSP_BAR , desc->i2s_pin_config_offset); -if (val != desc->i2s_mode) { -dev_err (sdev->dev,"I2S Mode is not supported (I2S_PIN_CONFIG: %#x)\n" , val); -return -EINVAL ; - } - -return 0 ; -} -EXPORT_SYMBOL_NS (acp_dai_probe,SND_SOC_SOF_AMD_COMMON ); -/** * amd_sof_ipc_dump() - This function is called when IPC tx times out. * @sdev: SOF device.
sound/soc/sof/amd/acp.h +0 -1
@@ -248,7 +248,6 @@ int sof_renoir_ops_init(struct snd_sof_dev *sdev);extern struct snd_sof_dsp_ops sof_rembrandt_ops;int sof_rembrandt_ops_init (struct snd_sof_dev *sdev); -int acp_dai_probe (struct snd_soc_dai *dai);struct snd_soc_acpi_mach *amd_sof_machine_select (struct snd_sof_dev *sdev);/* Machine configuration */ int snd_amd_acp_find_config (struct pci_dev *pci);
sound/soc/sof/amd/rembrandt.c +0 -4
@@ -48,7 +48,6 @@ static struct snd_soc_dai_driver rembrandt_sof_dai[] = { .rate_min = 8000, .rate_max = 48000, }, - .probe = &acp_dai_probe, }, [I2S_BT_INSTANCE ] = {
@@ -73,7 +72,6 @@ static struct snd_soc_dai_driver rembrandt_sof_dai[] = { .rate_min = 8000, .rate_max = 48000, }, - .probe = &acp_dai_probe, }, [I2S_SP_INSTANCE ] = {
@@ -98,7 +96,6 @@ static struct snd_soc_dai_driver rembrandt_sof_dai[] = { .rate_min = 8000, .rate_max = 48000, }, - .probe = &acp_dai_probe, }, [PDM_DMIC_INSTANCE ] = {
@@ -126,7 +123,6 @@ static struct snd_soc_dai_driver rembrandt_sof_dai[] = { .rate_min = 8000, .rate_max = 96000, }, - .probe = &acp_dai_probe, }, };
sound/soc/sof/amd/renoir.c +0 -3
@@ -47,7 +47,6 @@ static struct snd_soc_dai_driver renoir_sof_dai[] = { .rate_min = 8000, .rate_max = 48000, }, - .probe = &acp_dai_probe, }, [I2S_SP_INSTANCE ] = {
@@ -72,7 +71,6 @@ static struct snd_soc_dai_driver renoir_sof_dai[] = { .rate_min = 8000, .rate_max = 48000, }, - .probe = &acp_dai_probe, }, [PDM_DMIC_INSTANCE ] = {
@@ -100,7 +98,6 @@ static struct snd_soc_dai_driver renoir_sof_dai[] = { .rate_min = 8000, .rate_max = 96000, }, - .probe = &acp_dai_probe, }, };
Signature · 1 line
2.34.1
PATCH 3/6 ASoC: SOF: amd: remove unused variables
In reply to Vijendar MukundaRemove unused variables - i2s_mode, i2s_pin_config_offset from code.
--- sound/soc/sof/amd/acp.h | 2 -- sound/soc/sof/amd/pci-rmb.c | 2 -- sound/soc/sof/amd/pci-rn.c | 2 -- 3 files changed, 6 deletions(-)
sound/soc/sof/amd/acp.h +0 -2
@@ -158,12 +158,10 @@ struct acp_dsp_stream {struct sof_amd_acp_desc {unsigned int rev;unsigned int host_bridge_id; -unsigned int i2s_mode;u32 pgfsm_base;u32 ext_intr_stat;u32 dsp_intr_base;u32 sram_pte_offset; -u32 i2s_pin_config_offset;u32 hw_semaphore_offset;u32 acp_clkmux_sel;u32 fusion_dsp_offset;
sound/soc/sof/amd/pci-rmb.c +0 -2
@@ -31,12 +31,10 @@ static struct platform_device *dmic_dev;static const struct sof_amd_acp_desc rembrandt_chip_info = { .rev =6 , .host_bridge_id =HOST_BRIDGE_RMB , - .i2s_mode =0x0a , .pgfsm_base =ACP6X_PGFSM_BASE , .ext_intr_stat =ACP6X_EXT_INTR_STAT , .dsp_intr_base =ACP6X_DSP_SW_INTR_BASE , .sram_pte_offset =ACP6X_SRAM_PTE_OFFSET , - .i2s_pin_config_offset =ACP6X_I2S_PIN_CONFIG , .hw_semaphore_offset =ACP6X_AXI2DAGB_SEM_0 , .acp_clkmux_sel =ACP6X_CLKMUX_SEL , .fusion_dsp_offset =ACP6X_DSP_FUSION_RUNSTALL ,
sound/soc/sof/amd/pci-rn.c +0 -2
@@ -31,12 +31,10 @@ static struct platform_device *dmic_dev;static const struct sof_amd_acp_desc renoir_chip_info = { .rev =3 , .host_bridge_id =HOST_BRIDGE_CZN , - .i2s_mode =0x04 , .pgfsm_base =ACP3X_PGFSM_BASE , .ext_intr_stat =ACP3X_EXT_INTR_STAT , .dsp_intr_base =ACP3X_DSP_SW_INTR_BASE , .sram_pte_offset =ACP3X_SRAM_PTE_OFFSET , - .i2s_pin_config_offset =ACP3X_I2S_PIN_CONFIG , .hw_semaphore_offset =ACP3X_AXI2DAGB_SEM_0 , .acp_clkmux_sel =ACP3X_CLKMUX_SEL , };
Signature · 1 line
2.34.1
PATCH 4/6 ASoC: SOF: amd: refactor get_chip_info callback
In reply to Vijendar MukundaMove get_chip_info callback to the start of API.
This should be first check in probe() call.
--- sound/soc/sof/amd/acp.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
sound/soc/sof/amd/acp.c +5 -7
@@ -470,6 +470,11 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)unsigned int addr;int ret; + chip =get_chip_info (sdev->pdata); +if (!chip) { +dev_err (sdev->dev,"no such device supported, chip id:%x\n" , pci->device); +return -EIO ; + } adata =devm_kzalloc (sdev->dev,sizeof (struct acp_dev_data ),GFP_KERNEL );if (!adata)
@@ -486,13 +491,6 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)pci_set_master (pci); sdev->pdata->hw_pdata = adata; - - chip =get_chip_info (sdev->pdata); -if (!chip) { -dev_err (sdev->dev,"no such device supported, chip id:%x\n" , pci->device); -return -EIO ; - } - adata->smn_dev =pci_get_device (PCI_VENDOR_ID_AMD , chip->host_bridge_id,NULL );if (!adata->smn_dev) {dev_err (sdev->dev,"Failed to get host bridge device\n" );
Signature · 1 line
2.34.1
PATCH 5/6 ASoC: SOF: amd: refactor error checks in probe call
In reply to Vijendar MukundaRefactor error checks code in probe() callback.
--- sound/soc/sof/amd/acp.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
sound/soc/sof/amd/acp.c +9 -7
@@ -503,16 +503,12 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)if (ret <0 ) {dev_err (sdev->dev,"failed to register IRQ %d\n" , sdev->ipc_irq); -pci_dev_put (adata->smn_dev); -return ret; + goto free_smn_dev; } ret =acp_init (sdev); -if (ret <0 ) { -free_irq (sdev->ipc_irq, sdev); -pci_dev_put (adata->smn_dev); -return ret; - } +if (ret <0 ) + goto free_ipc_irq; sdev->dsp_box.offset =0 ; sdev->dsp_box.size =BOX_SIZE_512 ;
@@ -528,6 +524,12 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)acp_dsp_stream_init (sdev);return 0 ; + +free_ipc_irq: +free_irq (sdev->ipc_irq, sdev); +free_smn_dev: +pci_dev_put (adata->smn_dev); +return ret; }EXPORT_SYMBOL_NS (amd_sof_acp_probe,SND_SOC_SOF_AMD_COMMON );
Signature · 1 line
2.34.1
PATCH 6/6 ASoC: SOF: amd: refactor dmic codec platform device creation
In reply to Vijendar MukundaUnder snd_sof_dev device scope, create platform device for dmic codec.
--- sound/soc/sof/amd/acp.c | 17 +++++++++++++++-- sound/soc/sof/amd/acp.h | 2 ++ sound/soc/sof/amd/pci-rmb.c | 19 +------------------ sound/soc/sof/amd/pci-rn.c | 19 +------------------ 4 files changed, 19 insertions(+), 38 deletions(-)
sound/soc/sof/amd/acp.c +15 -2
@@ -481,11 +481,18 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)return -ENOMEM ; adata->dev = sdev; + adata->dmic_dev =platform_device_register_data (sdev->dev,"dmic-codec" , +PLATFORM_DEVID_NONE ,NULL ,0 ); +if (IS_ERR (adata->dmic_dev)) { +dev_err (sdev->dev,"failed to register platform for dmic codec\n" ); +return PTR_ERR (adata->dmic_dev); + } addr =pci_resource_start (pci,ACP_DSP_BAR ); sdev->bar[ACP_DSP_BAR ] =devm_ioremap (sdev->dev, addr,pci_resource_len (pci,ACP_DSP_BAR ));if (!sdev->bar[ACP_DSP_BAR ]) {dev_err (sdev->dev,"ioremap error\n" ); -return -ENXIO ; + ret = -ENXIO ; + goto unregister_dev; }pci_set_master (pci);
@@ -494,7 +501,8 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev) adata->smn_dev =pci_get_device (PCI_VENDOR_ID_AMD , chip->host_bridge_id,NULL );if (!adata->smn_dev) {dev_err (sdev->dev,"Failed to get host bridge device\n" ); -return -ENODEV ; + ret = -ENODEV ; + goto unregister_dev; } sdev->ipc_irq = pci->irq;
@@ -529,6 +537,8 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)free_irq (sdev->ipc_irq, sdev); free_smn_dev:pci_dev_put (adata->smn_dev); +unregister_dev: +platform_device_unregister (adata->dmic_dev);return ret; }EXPORT_SYMBOL_NS (amd_sof_acp_probe,SND_SOC_SOF_AMD_COMMON );
@@ -543,6 +553,9 @@ int amd_sof_acp_remove(struct snd_sof_dev *sdev)if (sdev->ipc_irq)free_irq (sdev->ipc_irq, sdev); +if (adata->dmic_dev) +platform_device_unregister (adata->dmic_dev); +return acp_reset (sdev); }EXPORT_SYMBOL_NS (amd_sof_acp_remove,SND_SOC_SOF_AMD_COMMON );
sound/soc/sof/amd/acp.h +2 -0
@@ -170,6 +170,8 @@ struct sof_amd_acp_desc {/* Common device data struct for ACP devices */ struct acp_dev_data {struct snd_sof_dev *dev; +/* DMIC device */ +struct platform_device *dmic_dev;unsigned int fw_bin_size;unsigned int fw_data_bin_size;u32 fw_bin_page_count;
sound/soc/sof/amd/pci-rmb.c +1 -18
@@ -26,8 +26,6 @@#define ACP6x_REG_START 0x1240000#define ACP6x_REG_END 0x125C000 -static struct platform_device *dmic_dev; -static const struct sof_amd_acp_desc rembrandt_chip_info = { .rev =6 , .host_bridge_id =HOST_BRIDGE_RMB ,
@@ -65,32 +63,17 @@ static const struct sof_dev_desc rembrandt_desc = {static int acp_pci_rmb_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) { -struct device *dev = &pci->dev;unsigned int flag; -int ret; flag =snd_amd_acp_find_config (pci);if (flag !=FLAG_AMD_SOF && flag !=FLAG_AMD_SOF_ONLY_DMIC )return -ENODEV ; - ret =sof_pci_probe (pci, pci_id); -if (ret !=0 ) -return ret; - - dmic_dev =platform_device_register_data (dev,"dmic-codec" ,PLATFORM_DEVID_NONE ,NULL ,0 ); -if (IS_ERR (dmic_dev)) { -dev_err (dev,"failed to create DMIC device\n" ); -sof_pci_remove (pci); -return PTR_ERR (dmic_dev); - } -return ret; +return sof_pci_probe (pci, pci_id); };static void acp_pci_rmb_remove (struct pci_dev *pci) { -if (dmic_dev) -platform_device_unregister (dmic_dev); -sof_pci_remove (pci); }
sound/soc/sof/amd/pci-rn.c +1 -18
@@ -26,8 +26,6 @@#define ACP3x_REG_START 0x1240000#define ACP3x_REG_END 0x125C000 -static struct platform_device *dmic_dev; -static const struct sof_amd_acp_desc renoir_chip_info = { .rev =3 , .host_bridge_id =HOST_BRIDGE_CZN ,
@@ -65,32 +63,17 @@ static const struct sof_dev_desc renoir_desc = {static int acp_pci_rn_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) { -struct device *dev = &pci->dev;unsigned int flag; -int ret; flag =snd_amd_acp_find_config (pci);if (flag !=FLAG_AMD_SOF && flag !=FLAG_AMD_SOF_ONLY_DMIC )return -ENODEV ; - ret =sof_pci_probe (pci, pci_id); -if (ret !=0 ) -return ret; - - dmic_dev =platform_device_register_data (dev,"dmic-codec" ,PLATFORM_DEVID_NONE ,NULL ,0 ); -if (IS_ERR (dmic_dev)) { -dev_err (dev,"failed to create DMIC device\n" ); -sof_pci_remove (pci); -return PTR_ERR (dmic_dev); - } -return ret; +return sof_pci_probe (pci, pci_id); };static void acp_pci_rn_remove (struct pci_dev *pci) { -if (dmic_dev) -platform_device_unregister (dmic_dev); -return sof_pci_remove (pci); }
Signature · 1 line
2.34.1
Mark Brown
maintainerQuoted 8 lines · Vijendar Mukunda
During initial SOF driver bring up on AMD platforms, only DMIC support was added. As of today, we have a complete SOF solution for I2S endpoints along with DMIC endpoint.
This code is no longer required.
Remove unused code from RMB and RN platform ACP PCI driver.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/6] ASoC: SOF: amd: remove unused code
commit: 56e008146e5b46059c5469a8b47478ab78f5b895
[2/6] ASoC: SOF: amd: remove acp_dai_probe() function
commit: 9eb48aeddd8dcf2defd94a837a65e052576cf42b
[3/6] ASoC: SOF: amd: remove unused variables
commit: 2675de62de702dbda936eb0f9a20ce3d8fed5ab5
[4/6] ASoC: SOF: amd: refactor get_chip_info callback
commit: 292b544ef4555ec5c69522e9c6eace6a90c4cd00
[5/6] ASoC: SOF: amd: refactor error checks in probe call
commit: c7a3662f14d7e0add7b50dc2f971e77bebb333cc
[6/6] ASoC: SOF: amd: refactor dmic codec platform device creation
commit: dd6bdd8b4d41b8f9db4b88dff2d10c0c62dbeb1dAll 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