Add ASoC support for AMD APUs [v4]
Subsystems (7)
cover Add ASoC support for AMD APUs [v4]
This patch set implements support for i2s audio and new AMD GPUs. The i2s codec is fed by a DMA engine on the GPU. To handle this we create mfd cells which we hang the i2s codec and DMA engine on. Because of this, this patch set covers two subsystems: drm and alsa. The drm patches add support for the ACP hw block which provides the DMA engine for the i2s codec. The alsa patches add the ASoC driver for the i2s codec. Since the alsa changes depend on the drm changes in this patch set as well as some other drm changes queued for 4.3, I'd like to take the alsa patches in via the drm tree.
V2 changes:
- Use the MFD subsystem rather than adding our own bus
- Squash all sub-feature patches together
- fix comments mentioned in previous review
V3 changes:
- Update the designware driver to handle slave mode, amd specific features
- Use the designware driver directly for i2s
- Move the DMA handling from the GPU driver into the AMD ASoC driver
- Change the license on the ASoC driver to GPL
v4 changes:
- patch "ASoC : dwc : support dw i2s in slave mode" accepted
- Add a _dai_fmt() operation that checks to make sure that the mode we're setting corresponds to what we read back from the hardware.
- Split specific quirks into separate patches
- Set the specific quirks that apply to AMD chips in the acp driver
Patch 7 adds the register headers for the ACP block which is a pretty big patch so I've excluded it from email. The entire patch set can be viewed here:
http://cgit.freedesktop.org/~agd5f/linux/log/?h=acp-upstream5
Thanks,
Alex
Maruthi Bayyavarapu (1):
drm/amd: add ACP driver support
Maruthi Srinivas Bayyavarapu (7):
ASoC : dwc : add check for master/slave format ASoC : dwc : add different playback/capture base ASoC : dwc : add quirk for dwc controller instances ASoC : dwc : add quirk for different register offset ASoC : dwc : reconfigure dwc in 'resume' from 'suspend' ASoC : AMD : add ACP 2.2 register headers
ASoC: AMD: add AMD ASoC ACP-I2S driver
drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/amd/acp/Kconfig | 10 + drivers/gpu/drm/amd/acp/Makefile | 9 + drivers/gpu/drm/amd/acp/acp_hw.c | 127 ++ drivers/gpu/drm/amd/acp/include/acp_gfx_if.h | 49 + drivers/gpu/drm/amd/amdgpu/Makefile | 13 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 12 + drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 275 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h | 41 + drivers/gpu/drm/amd/amdgpu/vi.c | 12 + drivers/gpu/drm/amd/include/amd_shared.h | 1 + include/linux/mfd/amd_acp.h | 43 + include/sound/designware_i2s.h | 6 + sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/amd/Kconfig | 4 + sound/soc/amd/Makefile | 3 + sound/soc/amd/acp-pcm-dma.c | 518 ++++++ sound/soc/amd/acp.c | 736 +++++++++ sound/soc/amd/acp.h | 147 ++ sound/soc/amd/include/acp_2_2_d.h | 609 +++++++ sound/soc/amd/include/acp_2_2_enum.h | 1068 ++++++++++++ sound/soc/amd/include/acp_2_2_sh_mask.h | 2292 ++++++++++++++++++++++++++ sound/soc/dwc/designware_i2s.c | 206 ++- 24 files changed, 6121 insertions(+), 64 deletions(-) create mode 100644 drivers/gpu/drm/amd/acp/Kconfig create mode 100644 drivers/gpu/drm/amd/acp/Makefile create mode 100644 drivers/gpu/drm/amd/acp/acp_hw.c create mode 100644 drivers/gpu/drm/amd/acp/include/acp_gfx_if.h create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h create mode 100644 include/linux/mfd/amd_acp.h create mode 100644 sound/soc/amd/Kconfig create mode 100644 sound/soc/amd/Makefile create mode 100644 sound/soc/amd/acp-pcm-dma.c create mode 100644 sound/soc/amd/acp.c create mode 100644 sound/soc/amd/acp.h create mode 100644 sound/soc/amd/include/acp_2_2_d.h create mode 100644 sound/soc/amd/include/acp_2_2_enum.h create mode 100644 sound/soc/amd/include/acp_2_2_sh_mask.h
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/8 ASoC : dwc : add check for master/slave format
From: Maruthi Srinivas Bayyavarapu <[email protected]>
DW i2s controller's master/slave config can be read from a read-only register. Machine driver can try to set a master/slave format on cpu-dai using 'set_fmt' of dai ops. A check is added to verify codec is master when dwc is slave and vice-versa.
--- sound/soc/dwc/designware_i2s.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
sound/soc/dwc/designware_i2s.c +31 -0
@@ -341,12 +341,43 @@ static int dw_i2s_trigger(struct snd_pcm_substream *substream,return ret; } +static int dw_i2s_set_fmt (struct snd_soc_dai *cpu_dai,unsigned int fmt) +{ +struct dw_i2s_dev *dev =snd_soc_dai_get_drvdata (cpu_dai); +int ret =0 ; + +switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) { +case SND_SOC_DAIFMT_CBM_CFM : +if (dev->capability &DW_I2S_SLAVE ) + ret =0 ; +else + ret = -EINVAL ; +break ; +case SND_SOC_DAIFMT_CBS_CFS : +if (dev->capability &DW_I2S_MASTER ) + ret =0 ; +else + ret = -EINVAL ; +break ; +case SND_SOC_DAIFMT_CBM_CFS : +case SND_SOC_DAIFMT_CBS_CFM : + ret = -EINVAL ; +break ; +default : +dev_dbg (dev->dev,"dwc : Invalid master/slave format\n" ); + ret = -EINVAL ; +break ; + } +return ret; +} +static struct snd_soc_dai_ops dw_i2s_dai_ops = { .startup = dw_i2s_startup, .shutdown = dw_i2s_shutdown, .hw_params = dw_i2s_hw_params, .prepare = dw_i2s_prepare, .trigger = dw_i2s_trigger, + .set_fmt = dw_i2s_set_fmt, };static const struct snd_soc_component_driver dw_i2s_component = {
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerRe: [PATCH 1/8] ASoC : dwc : add check for master/slave format
Quoted 9 lines · Alex Deucher
From: Maruthi Srinivas Bayyavarapu <[email protected]>
DW i2s controller's master/slave config can be read from a read-only register. Machine driver can try to set a master/slave format on cpu-dai using '
set_fmt' of dai ops. A check is added to verify codec is master when dwc is slave and vice-versa.Signed-off-by Maruthi Bayyavarapu <[email protected]>---
I can't apply this, you've not added a Signed-off-by for code sent by someone else as covered in SubmittingPatches.
Please also try to use subject lines matching the style for the subsystem.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/8] ASoC : dwc : add check for master/slave format
Quoted 8 lines · Mark Brown
Quoted 7 lines · Alex Deucher
From: Maruthi Srinivas Bayyavarapu <[email protected]>
DW i2s controller's master/slave config can be read from a read-only register. Machine driver can try to set a master/slave format on cpu-dai using '
set_fmt' of dai ops. A check is added to verify codec is master when dwc is slave and vice-versa.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Maruthi Bayyavarapu <[email protected]>---
I can't apply this, you've not added a Signed-off-by for code sent by someone else as covered in SubmittingPatches.
Please also try to use subject lines matching the style for the subsystem.
I'll resend with these fixed up.
Thanks.
Alex
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerApplied "ASoC: dwc: add check for master/slave format" to the asoc tree
In reply to Alex DeucherThe patch
ASoC: dwc: add check for master/slave format
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All 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
Quoted 1 line
From
ab57b8e90c658a72944c48a81a1352e61e84db02Mon Sep 17 00:00:00 2001
From: Maruthi Srinivas Bayyavarapu <[email protected]>
Date: Fri, 23 Oct 2015 17:15:41 -0400
Subject: [PATCH] ASoC: dwc: add check for master/slave format
DW i2s controller's master/slave config can be read from a read-only register. Machine driver can try to set a master/slave format on cpu-dai using 'set_fmt' of dai ops. A check is added to verify codec is master when dwc is slave and vice-versa.
--- sound/soc/dwc/designware_i2s.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
sound/soc/dwc/designware_i2s.c +31 -0
@@ -341,12 +341,43 @@ static int dw_i2s_trigger(struct snd_pcm_substream *substream,return ret; } +static int dw_i2s_set_fmt (struct snd_soc_dai *cpu_dai,unsigned int fmt) +{ +struct dw_i2s_dev *dev =snd_soc_dai_get_drvdata (cpu_dai); +int ret =0 ; + +switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) { +case SND_SOC_DAIFMT_CBM_CFM : +if (dev->capability &DW_I2S_SLAVE ) + ret =0 ; +else + ret = -EINVAL ; +break ; +case SND_SOC_DAIFMT_CBS_CFS : +if (dev->capability &DW_I2S_MASTER ) + ret =0 ; +else + ret = -EINVAL ; +break ; +case SND_SOC_DAIFMT_CBM_CFS : +case SND_SOC_DAIFMT_CBS_CFM : + ret = -EINVAL ; +break ; +default : +dev_dbg (dev->dev,"dwc : Invalid master/slave format\n" ); + ret = -EINVAL ; +break ; + } +return ret; +} +static struct snd_soc_dai_ops dw_i2s_dai_ops = { .startup = dw_i2s_startup, .shutdown = dw_i2s_shutdown, .hw_params = dw_i2s_hw_params, .prepare = dw_i2s_prepare, .trigger = dw_i2s_trigger, + .set_fmt = dw_i2s_set_fmt, };static const struct snd_soc_component_driver dw_i2s_component = {
Signature · 1 line
2.6.1
PATCH 2/8 ASoC : dwc : add different playback/capture base
In reply to Alex DeucherFrom: Maruthi Srinivas Bayyavarapu <[email protected]>
Some platforms (Ex: AMD CZ) can have separate dwc controllers with different base address for playback and capture. This patch adds necessary changes to support it. Platforms which make use of it can supply a quirk in platform data to make use of this. By default, playback and capture base addesses are assumed to be same.
--- sound/soc/dwc/designware_i2s.c | 93 ++++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 45 deletions(-)
sound/soc/dwc/designware_i2s.c +48 -45
@@ -89,7 +89,8 @@ union dw_i2s_snd_dma_data { };struct dw_i2s_dev { -void __iomem *i2s_base; +void __iomem *i2s_pbase; +void __iomem *i2s_cbase;struct clk *clk;int active;unsigned int capability;
@@ -118,10 +119,10 @@ static inline void i2s_disable_channels(struct dw_i2s_dev *dev, u32 stream)if (stream ==SNDRV_PCM_STREAM_PLAYBACK ) {for (i =0 ; i <4 ; i++) -i2s_write_reg (dev->i2s_base,TER (i),0 ); +i2s_write_reg (dev->i2s_pbase,TER (i),0 ); }else {for (i =0 ; i <4 ; i++) -i2s_write_reg (dev->i2s_base,RER (i),0 ); +i2s_write_reg (dev->i2s_cbase,RER (i),0 ); } }
@@ -131,25 +132,25 @@ static inline void i2s_clear_irqs(struct dw_i2s_dev *dev, u32 stream)if (stream ==SNDRV_PCM_STREAM_PLAYBACK ) {for (i =0 ; i <4 ; i++) -i2s_write_reg (dev->i2s_base,TOR (i),0 ); +i2s_write_reg (dev->i2s_pbase,TOR (i),0 ); }else {for (i =0 ; i <4 ; i++) -i2s_write_reg (dev->i2s_base,ROR (i),0 ); +i2s_write_reg (dev->i2s_cbase,ROR (i),0 ); } }static void i2s_start (struct dw_i2s_dev *dev,struct snd_pcm_substream *substream) { - -i2s_write_reg (dev->i2s_base,IER ,1 ); - -if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) -i2s_write_reg (dev->i2s_base,ITER ,1 ); -else -i2s_write_reg (dev->i2s_base,IRER ,1 ); - -i2s_write_reg (dev->i2s_base,CER ,1 ); +if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { +i2s_write_reg (dev->i2s_pbase,IER ,1 ); +i2s_write_reg (dev->i2s_pbase,ITER ,1 ); +i2s_write_reg (dev->i2s_pbase,CER ,1 ); + }else { +i2s_write_reg (dev->i2s_cbase,IER ,1 ); +i2s_write_reg (dev->i2s_cbase,IRER ,1 ); +i2s_write_reg (dev->i2s_cbase,CER ,1 ); + } } static void i2s_stop(struct dw_i2s_dev *dev,
@@ -159,24 +160,25 @@ static void i2s_stop(struct dw_i2s_dev *dev,i2s_clear_irqs (dev, substream->stream);if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { -i2s_write_reg (dev->i2s_base,ITER ,0 ); - +i2s_write_reg (dev->i2s_pbase,ITER ,0 );for (i =0 ; i <4 ; i++) { - irq =i2s_read_reg (dev->i2s_base,IMR (i)); -i2s_write_reg (dev->i2s_base,IMR (i), irq |0x30 ); + irq =i2s_read_reg (dev->i2s_pbase,IMR (i)); +i2s_write_reg (dev->i2s_pbase,IMR (i), + irq |0x30 ); } }else { -i2s_write_reg (dev->i2s_base,IRER ,0 ); +i2s_write_reg (dev->i2s_cbase,IRER ,0 );for (i =0 ; i <4 ; i++) { - irq =i2s_read_reg (dev->i2s_base,IMR (i)); -i2s_write_reg (dev->i2s_base,IMR (i), irq |0x03 ); + irq =i2s_read_reg (dev->i2s_cbase,IMR (i)); +i2s_write_reg (dev->i2s_cbase,IMR (i), + irq |0x03 ); } }if (!dev->active) { -i2s_write_reg (dev->i2s_base,CER ,0 ); -i2s_write_reg (dev->i2s_base,IER ,0 ); +i2s_write_reg (dev->i2s_pbase,CER ,0 ); +i2s_write_reg (dev->i2s_pbase,IER ,0 ); } }
@@ -253,23 +255,23 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,for (ch_reg =0 ; ch_reg < (config->chan_nr /2 ); ch_reg++) {if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { -i2s_write_reg (dev->i2s_base,TCR (ch_reg), +i2s_write_reg (dev->i2s_pbase,TCR (ch_reg), xfer_resolution); -i2s_write_reg (dev->i2s_base,TFCR (ch_reg),0x02 ); - irq =i2s_read_reg (dev->i2s_base,IMR (ch_reg)); -i2s_write_reg (dev->i2s_base,IMR (ch_reg), irq & ~0x30 ); -i2s_write_reg (dev->i2s_base,TER (ch_reg),1 ); +i2s_write_reg (dev->i2s_pbase,TFCR (ch_reg),0x02 ); + irq =i2s_read_reg (dev->i2s_pbase,IMR (ch_reg)); +i2s_write_reg (dev->i2s_pbase,IMR (ch_reg), irq & ~0x30 ); +i2s_write_reg (dev->i2s_pbase,TER (ch_reg),1 ); }else { -i2s_write_reg (dev->i2s_base,RCR (ch_reg), +i2s_write_reg (dev->i2s_cbase,RCR (ch_reg), xfer_resolution); -i2s_write_reg (dev->i2s_base,RFCR (ch_reg),0x07 ); - irq =i2s_read_reg (dev->i2s_base,IMR (ch_reg)); -i2s_write_reg (dev->i2s_base,IMR (ch_reg), irq & ~0x03 ); -i2s_write_reg (dev->i2s_base,RER (ch_reg),1 ); +i2s_write_reg (dev->i2s_cbase,RFCR (ch_reg),0x07 ); + irq =i2s_read_reg (dev->i2s_cbase,IMR (ch_reg)); +i2s_write_reg (dev->i2s_cbase,IMR (ch_reg), irq & ~0x03 ); +i2s_write_reg (dev->i2s_cbase,RER (ch_reg),1 ); } } -i2s_write_reg (dev->i2s_base,CCR , ccr); +i2s_write_reg (dev->i2s_pbase,CCR , ccr); config->sample_rate =params_rate (params);
@@ -307,9 +309,9 @@ static int dw_i2s_prepare(struct snd_pcm_substream *substream,struct dw_i2s_dev *dev =snd_soc_dai_get_drvdata (dai);if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) -i2s_write_reg (dev->i2s_base,TXFFR ,1 ); +i2s_write_reg (dev->i2s_pbase,TXFFR ,1 );else -i2s_write_reg (dev->i2s_base,RXFFR ,1 ); +i2s_write_reg (dev->i2s_cbase,RXFFR ,1 );return 0 ; }
@@ -450,8 +452,8 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,* Read component parameter registers to extract * the I2S block's configuration. */ -u32 comp1 =i2s_read_reg (dev->i2s_base,I2S_COMP_PARAM_1 ); -u32 comp2 =i2s_read_reg (dev->i2s_base,I2S_COMP_PARAM_2 ); +u32 comp1 =i2s_read_reg (dev->i2s_pbase,I2S_COMP_PARAM_1 ); +u32 comp2 =i2s_read_reg (dev->i2s_pbase,I2S_COMP_PARAM_2 );u32 idx;if (COMP1_TX_ENABLED (comp1)) {
@@ -494,7 +496,7 @@ static int dw_configure_dai_by_pd(struct dw_i2s_dev *dev,struct resource *res, const struct i2s_platform_data *pdata) { - u32 comp1 = i2s_read_reg(dev->i2s_base, I2S_COMP_PARAM_1); + u32 comp1 = i2s_read_reg(dev->i2s_pbase, I2S_COMP_PARAM_1);u32 idx =COMP1_APB_DATA_WIDTH (comp1);int ret;
@@ -524,8 +526,8 @@ static int dw_configure_dai_by_dt(struct dw_i2s_dev *dev,struct snd_soc_dai_driver *dw_i2s_dai, struct resource *res) { - u32 comp1 = i2s_read_reg(dev->i2s_base, I2S_COMP_PARAM_1); -u32 comp2 =i2s_read_reg (dev->i2s_base,I2S_COMP_PARAM_2 ); + u32 comp1 = i2s_read_reg(dev->i2s_pbase, I2S_COMP_PARAM_1); +u32 comp2 =i2s_read_reg (dev->i2s_pbase,I2S_COMP_PARAM_2 );u32 fifo_depth =1 << (1 +COMP1_FIFO_DEPTH_GLOBAL (comp1));u32 idx =COMP1_APB_DATA_WIDTH (comp1);u32 idx2;
@@ -589,11 +591,11 @@ static int dw_i2s_probe(struct platform_device *pdev) dw_i2s_dai->resume = dw_i2s_resume; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - dev->i2s_base =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (dev->i2s_base)) -return PTR_ERR (dev->i2s_base); + dev->i2s_pbase =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (dev->i2s_pbase)) +return PTR_ERR (dev->i2s_pbase); - dev->dev = &pdev->dev; + dev->i2s_cbase = dev->i2s_pbase;if (pdata) { dev->capability = pdata->cap;
@@ -624,6 +626,7 @@ static int dw_i2s_probe(struct platform_device *pdev)return ret; } + dev->dev = &pdev->dev;dev_set_drvdata (&pdev->dev, dev); ret =devm_snd_soc_register_component (&pdev->dev, &dw_i2s_component, dw_i2s_dai,1 );
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerRe: [PATCH 2/8] ASoC : dwc : add different playback/capture base
Quoted 7 lines · Alex Deucher
From: Maruthi Srinivas Bayyavarapu <[email protected]>
Some platforms (Ex: AMD CZ) can have separate dwc controllers with different base address for playback and capture. This patch adds necessary changes to support it. Platforms which make use of it can supply a quirk in platform data to make use of this. By default, playback and capture base addesses are assumed to be same.
If these are two physically separate controllers that don't share anything then why are they being represented as a single device as opposed to just having two devices, one for playback and one for capture? You'd still need to register the DAI differently but it should be a much less invasive change and map much more naturally onto the device model (what if some system has put playback and capture into separate power domains for example?).
If we do go with this then we will also need an update to the DT binding to document how the additional resources associated with the second controller are described.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/8 ASoC : dwc : add quirk for dwc controller instances
In reply to Alex DeucherFrom: Maruthi Srinivas Bayyavarapu <[email protected]>
Added a qurik to assign different base addresses for different dwc controllers present on platform for playback and capture.
--- include/sound/designware_i2s.h | 3 +++ sound/soc/dwc/designware_i2s.c | 26 +++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-)
include/sound/designware_i2s.h +3 -0
@@ -45,6 +45,9 @@ struct i2s_platform_data {u32 snd_fmts;u32 snd_rates; +#define DW_I2S_QUIRK_MULTI_DWC (1 << 0) +unsigned int quirks; +void *play_dma_data;void *capture_dma_data;bool (*filter)(struct dma_chan *chan,void *slave);
sound/soc/dwc/designware_i2s.c +23 -3
@@ -94,6 +94,7 @@ struct dw_i2s_dev {struct clk *clk;int active;unsigned int capability; +unsigned int quirks;struct device *dev;/* data related to DMA transfers b/w i2s and DMAC */
@@ -176,9 +177,20 @@ static void i2s_stop(struct dw_i2s_dev *dev, } } -if (!dev->active) { -i2s_write_reg (dev->i2s_pbase,CER ,0 ); -i2s_write_reg (dev->i2s_pbase,IER ,0 ); +if (dev->quirks &DW_I2S_QUIRK_MULTI_DWC ) { +if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { +i2s_write_reg (dev->i2s_pbase,CER ,0 ); +i2s_write_reg (dev->i2s_pbase,IER ,0 ); + }else { +i2s_write_reg (dev->i2s_cbase,CER ,0 ); +i2s_write_reg (dev->i2s_cbase,IER ,0 ); + } + + }else { +if (!dev->active) { +i2s_write_reg (dev->i2s_pbase,CER ,0 ); +i2s_write_reg (dev->i2s_pbase,IER ,0 ); + } } }
@@ -599,6 +611,7 @@ static int dw_i2s_probe(struct platform_device *pdev)if (pdata) { dev->capability = pdata->cap; + dev->quirks = pdata->quirks; clk_id =NULL ; ret =dw_configure_dai_by_pd (dev, dw_i2s_dai, res, pdata); }else {
@@ -608,6 +621,13 @@ static int dw_i2s_probe(struct platform_device *pdev)if (ret <0 )return ret; +if (dev->quirks &DW_I2S_QUIRK_MULTI_DWC ) { + res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); + dev->i2s_cbase =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (dev->i2s_cbase)) +return PTR_ERR (dev->i2s_cbase); + } +if (dev->capability &DW_I2S_MASTER ) {if (pdata) { dev->i2s_clk_cfg = pdata->i2s_clk_cfg;
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerRe: [PATCH 3/8] ASoC : dwc : add quirk for dwc controller instances
Quoted 4 lines · Alex Deucher
From: Maruthi Srinivas Bayyavarapu <[email protected]>
Added a qurik to assign different base addresses for different dwc controllers present on platform for playback and capture.
I don't understand what the above means, sorry. Normally the address ranges for devices are supplied via resources when the device is registered.
sound/soc/dwc/designware_i2s.c static void i2s_stop(struct dw_i2s_dev *dev, · line 187
Quoted 8 lines
sound/soc/dwc/designware_i2s.c +8
-0+if (dev->quirks &DW_I2S_QUIRK_MULTI_DWC ) { +if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { +i2s_write_reg (dev->i2s_pbase,CER ,0 ); +i2s_write_reg (dev->i2s_pbase,IER ,0 ); + }else { +i2s_write_reg (dev->i2s_cbase,CER ,0 ); +i2s_write_reg (dev->i2s_cbase,IER ,0 ); + }
This looks like it might be part of the previous change to merge separate playback and capture instances of the controller into one device rather than a separate change? But perhaps what this is saying is also that the controller instances aren't actually totally separate after all and the prior change maps well onto the hardware...
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/8 ASoC : dwc : add quirk for different register offset
In reply to Alex DeucherFrom: Maruthi Srinivas Bayyavarapu <[email protected]>
AMD CZ platform has different offsets for I2S_COMP_PARAM_* registers. Added a quirk to support the same.
--- include/sound/designware_i2s.h | 5 ++++- sound/soc/dwc/designware_i2s.c | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-)
include/sound/designware_i2s.h +4 -1
@@ -45,8 +45,11 @@ struct i2s_platform_data {u32 snd_fmts;u32 snd_rates; -#define DW_I2S_QUIRK_MULTI_DWC (1 << 0) +#define DW_I2S_QUIRK_MULTI_DWC (1 << 0) +#define DW_I2S_QUIRK_COMP_REG_OFFSET (1 << 1)unsigned int quirks; +unsigned int i2s_reg_comp1; +unsigned int i2s_reg_comp2;void *play_dma_data;void *capture_dma_data;
sound/soc/dwc/designware_i2s.c +13 -4
@@ -95,6 +95,8 @@ struct dw_i2s_dev {int active;unsigned int capability;unsigned int quirks; +unsigned int i2s_reg_comp1; +unsigned int i2s_reg_comp2;struct device *dev;/* data related to DMA transfers b/w i2s and DMAC */
@@ -464,8 +466,8 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,* Read component parameter registers to extract * the I2S block's configuration. */ -u32 comp1 =i2s_read_reg (dev->i2s_pbase,I2S_COMP_PARAM_1 ); -u32 comp2 =i2s_read_reg (dev->i2s_pbase,I2S_COMP_PARAM_2 ); +u32 comp1 =i2s_read_reg (dev->i2s_pbase, dev->i2s_reg_comp1); +u32 comp2 =i2s_read_reg (dev->i2s_pbase, dev->i2s_reg_comp2);u32 idx;if (COMP1_TX_ENABLED (comp1)) {
@@ -508,7 +510,7 @@ static int dw_configure_dai_by_pd(struct dw_i2s_dev *dev,struct resource *res, const struct i2s_platform_data *pdata) { - u32 comp1 = i2s_read_reg(dev->i2s_pbase, I2S_COMP_PARAM_1); + u32 comp1 = i2s_read_reg(dev->i2s_pbase, dev->i2s_reg_comp1);u32 idx =COMP1_APB_DATA_WIDTH (comp1);int ret;
@@ -610,9 +612,16 @@ static int dw_i2s_probe(struct platform_device *pdev) dev->i2s_cbase = dev->i2s_pbase;if (pdata) { + clk_id =NULL ; dev->capability = pdata->cap; dev->quirks = pdata->quirks; - clk_id =NULL ; +if (dev->quirks &DW_I2S_QUIRK_COMP_REG_OFFSET ) { + dev->i2s_reg_comp1 = pdata->i2s_reg_comp1; + dev->i2s_reg_comp2 = pdata->i2s_reg_comp2; + }else { + dev->i2s_reg_comp1 =I2S_COMP_PARAM_1 ; + dev->i2s_reg_comp2 =I2S_COMP_PARAM_2 ; + } ret =dw_configure_dai_by_pd (dev, dw_i2s_dai, res, pdata); }else { clk_id ="i2sclk" ;
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/8 ASoC : dwc : reconfigure dwc in 'resume' from 'suspend'
In reply to Alex DeucherFrom: Maruthi Srinivas Bayyavarapu <[email protected]>
dwc IP can be powered off during system suspend in some platforms (Ex: AMD CZ) as per design. After system is resumed, dwc needs to be programmed again to continue audio use case.
--- sound/soc/dwc/designware_i2s.c | 71 ++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 27 deletions(-)
sound/soc/dwc/designware_i2s.c +44 -27
@@ -98,6 +98,8 @@ struct dw_i2s_dev {unsigned int i2s_reg_comp1;unsigned int i2s_reg_comp2;struct device *dev; +u32 ccr; +u32 xfer_resolution;/* data related to DMA transfers b/w i2s and DMAC */ union dw_i2s_snd_dma_data play_dma_data;
@@ -220,31 +222,58 @@ static int dw_i2s_startup(struct snd_pcm_substream *substream,return 0 ; } +static void dw_i2s_config (struct dw_i2s_dev *dev,int stream) +{ +u32 ch_reg, irq; +struct i2s_clk_config_data *config = &dev->config; + + +i2s_disable_channels (dev, stream); + +for (ch_reg =0 ; ch_reg < (config->chan_nr /2 ); ch_reg++) { +if (stream ==SNDRV_PCM_STREAM_PLAYBACK ) { +i2s_write_reg (dev->i2s_pbase,TCR (ch_reg), + dev->xfer_resolution); +i2s_write_reg (dev->i2s_pbase,TFCR (ch_reg),0x02 ); + irq =i2s_read_reg (dev->i2s_pbase,IMR (ch_reg)); +i2s_write_reg (dev->i2s_pbase,IMR (ch_reg), irq & ~0x30 ); +i2s_write_reg (dev->i2s_pbase,TER (ch_reg),1 ); + }else { +i2s_write_reg (dev->i2s_cbase,RCR (ch_reg), + dev->xfer_resolution); +i2s_write_reg (dev->i2s_cbase,RFCR (ch_reg),0x07 ); + irq =i2s_read_reg (dev->i2s_cbase,IMR (ch_reg)); +i2s_write_reg (dev->i2s_cbase,IMR (ch_reg), irq & ~0x03 ); +i2s_write_reg (dev->i2s_cbase,RER (ch_reg),1 ); + } + + } +} +static int dw_i2s_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params,struct snd_soc_dai *dai) {struct dw_i2s_dev *dev =snd_soc_dai_get_drvdata (dai);struct i2s_clk_config_data *config = &dev->config; -u32 ccr, xfer_resolution, ch_reg, irq;int ret;switch (params_format (params)) {case SNDRV_PCM_FORMAT_S16_LE : config->data_width =16 ; - ccr =0x00 ; - xfer_resolution =0x02 ; + dev->ccr =0x00 ; + dev->xfer_resolution =0x02 ;break ;case SNDRV_PCM_FORMAT_S24_LE : config->data_width =24 ; - ccr =0x08 ; - xfer_resolution =0x04 ; + dev->ccr =0x08 ; + dev->xfer_resolution =0x04 ;break ;case SNDRV_PCM_FORMAT_S32_LE : config->data_width =32 ; - ccr =0x10 ; - xfer_resolution =0x05 ; + dev->ccr =0x10 ; + dev->xfer_resolution =0x05 ;break ;default :
@@ -265,27 +294,9 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,return -EINVAL ; } -i2s_disable_channels (dev, substream->stream); - -for (ch_reg =0 ; ch_reg < (config->chan_nr /2 ); ch_reg++) { -if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { -i2s_write_reg (dev->i2s_pbase,TCR (ch_reg), - xfer_resolution); -i2s_write_reg (dev->i2s_pbase,TFCR (ch_reg),0x02 ); - irq =i2s_read_reg (dev->i2s_pbase,IMR (ch_reg)); -i2s_write_reg (dev->i2s_pbase,IMR (ch_reg), irq & ~0x30 ); -i2s_write_reg (dev->i2s_pbase,TER (ch_reg),1 ); - }else { -i2s_write_reg (dev->i2s_cbase,RCR (ch_reg), - xfer_resolution); -i2s_write_reg (dev->i2s_cbase,RFCR (ch_reg),0x07 ); - irq =i2s_read_reg (dev->i2s_cbase,IMR (ch_reg)); -i2s_write_reg (dev->i2s_cbase,IMR (ch_reg), irq & ~0x03 ); -i2s_write_reg (dev->i2s_cbase,RER (ch_reg),1 ); - } - } +i2s_write_reg (dev->i2s_pbase,CCR , dev->ccr); -i2s_write_reg (dev->i2s_pbase,CCR , ccr); +dw_i2s_config (dev, substream->stream); config->sample_rate =params_rate (params);
@@ -417,6 +428,12 @@ static int dw_i2s_resume(struct snd_soc_dai *dai)if (dev->capability &DW_I2S_MASTER )clk_enable (dev->clk); + +if (dai->playback_active) +dw_i2s_config (dev,SNDRV_PCM_STREAM_PLAYBACK ); +if (dai->capture_active) +dw_i2s_config (dev,SNDRV_PCM_STREAM_CAPTURE ); +return 0 ; }
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/8 drm/amd: add ACP driver support
In reply to Alex DeucherFrom: Maruthi Bayyavarapu <[email protected]>
This adds the ACP (Audio CoProcessor) IP driver and wires it up to the amdgpu driver. The ACP block provides the DMA engine for i2s based ALSA driver. This is required for audio on APUs that utilize an i2s codec.
---
v2: integrate i2s/az check patch
v3: s/amd_acp/amdgpu_acp/
v4: update copyright notice
v5: squash multiple patches, convert to mfd
v6: major changes as below :
1. Pass ACP register base to DMA and dw i2s drivers as IORESOURCE_MEM resources.
2. add dw i2s as a new mfd cell.
v7: specify broken out dw quirks that apply to AMD hardware
drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/amd/acp/Kconfig | 10 + drivers/gpu/drm/amd/acp/Makefile | 9 + drivers/gpu/drm/amd/acp/acp_hw.c | 127 +++++++++++++ drivers/gpu/drm/amd/acp/include/acp_gfx_if.h | 49 +++++ drivers/gpu/drm/amd/amdgpu/Makefile | 13 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 12 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 275 +++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h | 41 ++++ drivers/gpu/drm/amd/amdgpu/vi.c | 12 ++ drivers/gpu/drm/amd/include/amd_shared.h | 1 + include/linux/mfd/amd_acp.h | 43 +++++ 12 files changed, 593 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/acp/Kconfig create mode 100644 drivers/gpu/drm/amd/acp/Makefile create mode 100644 drivers/gpu/drm/amd/acp/acp_hw.c create mode 100644 drivers/gpu/drm/amd/acp/include/acp_gfx_if.h create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h create mode 100644 include/linux/mfd/amd_acp.h
drivers/gpu/drm/Kconfig +2 -0
@@ -161,6 +161,8 @@ config DRM_AMDGPU source "drivers/gpu/drm/amd/amdgpu/Kconfig" +source "drivers/gpu/drm/amd/acp/Kconfig" + source "drivers/gpu/drm/nouveau/Kconfig" config DRM_I810
drivers/gpu/drm/amd/acp/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +menu "ACP Configuration" + +config DRM_AMD_ACP + bool "Enable ACP IP support" + default y + depends on MFD_CORE + help + Choose this option to enable ACP IP support for AMD SOCs. + +endmenu
drivers/gpu/drm/amd/acp/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# +# Makefile for the ACP, which is a sub-component +# of AMDSOC/AMDGPU drm driver. +# It provides the HW control for ACP related functionalities. + +ccflags-y += -Idrivers/gpu/drm/amd/include/asic_reg/acp +subdir-ccflags-y += -I$(AMDACPPATH)/ -I$(AMDACPPATH)/include + +AMD_ACP_FILES := $(AMDACPPATH)/acp_hw.o
drivers/gpu/drm/amd/acp/acp_hw.c new file +127 -0
127 lines not on this page · raw message
drivers/gpu/drm/amd/acp/include/acp_gfx_if.h new file +49 -0
49 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/Makefile +12 -1
@@ -5,7 +5,8 @@ ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/asic_reg \ -Idrivers/gpu/drm/amd/include \ -Idrivers/gpu/drm/amd/amdgpu \ - -Idrivers/gpu/drm/amd/scheduler + -Idrivers/gpu/drm/amd/scheduler \ + -Idrivers/gpu/drm/amd/acp/include amdgpu-y := amdgpu_drv.o
@@ -89,6 +90,16 @@ amdgpu-y += \ ../scheduler/sched_fence.o \ amdgpu_sched.o +# ACP componet +ifneq ($(CONFIG_DRM_AMD_ACP),) +amdgpu-y += amdgpu_acp.o + +AMDACPPATH := ../acp +include drivers/gpu/drm/amd/acp/Makefile + +amdgpu-y += $(AMD_ACP_FILES) +endif + amdgpu-$(CONFIG_COMPAT) += amdgpu_ioc32.o amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o
drivers/gpu/drm/amd/amdgpu/amdgpu.h +12 -0
@@ -52,6 +52,7 @@#include "amdgpu_irq.h" #include "amdgpu_ucode.h" #include "amdgpu_gds.h" +#include "amdgpu_acp.h" #include "gpu_scheduler.h"
@@ -1928,6 +1929,13 @@ void amdgpu_cgs_destroy_device(void *cgs_device);/* +* CGS +*/ +void *amdgpu_cgs_create_device (struct amdgpu_device *adev); +void amdgpu_cgs_destroy_device (void *cgs_device); + + +/* * Core structure, functions and helpers. */ typedef uint32_t (*amdgpu_rreg_t )(struct amdgpu_device *,uint32_t );
@@ -1948,6 +1956,10 @@ struct amdgpu_device {struct pci_dev *pdev;struct rw_semaphore exclusive_lock; +#ifdef CONFIG_DRM_AMD_ACP +struct amdgpu_acp acp; +#endif +/* ASIC */ enum amd_asic_type asic_type;uint32_t family;
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c new file +275 -0
275 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h new file +41 -0
41 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/vi.c +12 -0
@@ -71,6 +71,9 @@#include "uvd_v5_0.h" #include "uvd_v6_0.h" #include "vce_v3_0.h" +#if defined(CONFIG_DRM_AMD_ACP ) +#include "amdgpu_acp.h" +#endif /* * Indirect registers accessor
@@ -1298,6 +1301,15 @@ static const struct amdgpu_ip_block_version cz_ip_blocks[] = .rev = 0, .funcs = &vce_v3_0_ip_funcs, }, +#if defined(CONFIG_DRM_AMD_ACP ) + { + .type = AMD_IP_BLOCK_TYPE_ACP, + .major = 2, + .minor = 2, + .rev = 0, + .funcs = &acp_ip_funcs, + }, +#endif };int vi_set_ip_blocks (struct amdgpu_device *adev)
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
@@ -72,6 +72,7 @@ enum amd_ip_block_type {AMD_IP_BLOCK_TYPE_SDMA ,AMD_IP_BLOCK_TYPE_UVD ,AMD_IP_BLOCK_TYPE_VCE , + AMD_IP_BLOCK_TYPE_ACP, }; enum amd_clockgating_state {
include/linux/mfd/amd_acp.h new file +43 -0
43 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerRe: [PATCH 6/8] drm/amd: add ACP driver support
drivers/gpu/drm/amd/acp/Kconfig line 8
Quoted 6 lines · Alex Deucher
drivers/gpu/drm/amd/acp/Kconfig new file +6
-0+config DRM_AMD_ACP + bool "Enable ACP IP support" + default y + depends on MFD_CORE + help + Choose this option to enable ACP IP support for AMD SOCs.
Why does this depend on rather than select MFD_CORE (as all other users do)? Since MFD_CORE has no help text and hence is not directly user selectable the above means the user won't be able to enable this driver unless they happen to enable something else which uses MFD which doesn't seem ideal.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/8 ASoC: AMD: add AMD ASoC ACP-I2S driver
In reply to Alex DeucherFrom: Maruthi Srinivas Bayyavarapu <[email protected]>
ACP IP block consists of dedicated DMA and I2S blocks. The PCM driver provides the platform DMA component to ALSA core.
---
v2: squash in Kconfig fix
v3: squash additional commits, convert to mfd, drop rt286 changes
v4: add major changes as below:
1. remove i2s specific changes and add them to dwc i2s driver.
2. add ACP DMA logic to PCM driver.
sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/amd/Kconfig | 4 + sound/soc/amd/Makefile | 3 + sound/soc/amd/acp-pcm-dma.c | 518 +++++++++++++++++++++++++++++++ sound/soc/amd/acp.c | 736 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/amd/acp.h | 147 +++++++++ 7 files changed, 1410 insertions(+) create mode 100644 sound/soc/amd/Kconfig create mode 100644 sound/soc/amd/Makefile create mode 100644 sound/soc/amd/acp-pcm-dma.c create mode 100644 sound/soc/amd/acp.c create mode 100644 sound/soc/amd/acp.h
sound/soc/Kconfig +1 -0
@@ -35,6 +35,7 @@ config SND_SOC_TOPOLOGY # All the supported SoCs source "sound/soc/adi/Kconfig" +source "sound/soc/amd/Kconfig" source "sound/soc/atmel/Kconfig" source "sound/soc/au1x/Kconfig" source "sound/soc/bcm/Kconfig"
sound/soc/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_SND_SOC) += snd-soc-core.o obj-$(CONFIG_SND_SOC) += codecs/ obj-$(CONFIG_SND_SOC) += generic/ obj-$(CONFIG_SND_SOC) += adi/ +obj-$(CONFIG_SND_SOC) += amd/ obj-$(CONFIG_SND_SOC) += atmel/ obj-$(CONFIG_SND_SOC) += au1x/ obj-$(CONFIG_SND_SOC) += bcm/
sound/soc/amd/Kconfig new file +4 -0
@@ -0,0 +1,4 @@ +config SND_SOC_AMD_ACP + tristate "AMD Audio Coprocessor support" + help + This option enables ACP DMA support on AMD platform.
sound/soc/amd/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +snd-soc-acp-pcm-objs := acp-pcm-dma.o acp.o + +obj-$(CONFIG_SND_SOC_AMD_ACP) += snd-soc-acp-pcm.o
sound/soc/amd/acp-pcm-dma.c new file +518 -0
518 lines not on this page · raw message
sound/soc/amd/acp.c new file +736 -0
736 lines not on this page · raw message
sound/soc/amd/acp.h new file +147 -0
147 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerRe: [PATCH 8/8] ASoC: AMD: add AMD ASoC ACP-I2S driver
Quoted 2 lines · Alex Deucher
ACP IP block consists of dedicated DMA and I2S blocks. The PCM driver provides the platform DMA component to ALSA core.
Overall my main comment on a lot of this code is that it feels like we have created a lot of infrastructure that parallels standard Linux subsystems and interfaces without something that clearly shows why we're doing that. There may be good reasons but they've not been articulated and it's making the code a lot more complex to follow and review. We end up with multiple layers of abstraction and indirection that aren't explained.
This patch is also rather large and appears to contain multiple components which could be split, there's at least the DMA driver and this abstraction layer than the DMA driver builds on.
sound/soc/amd/acp-pcm-dma.c line 97
Quoted 5 lines
sound/soc/amd/acp-pcm-dma.c new file +5
-0+/* ACP DMA irq handler routine for playback, capture usecases */ +int dma_irq_handler (struct device *dev) +{ +u16 dscr_idx; +u32 intr_flag;
This says it's an interrupt handler but it's using some custom, non-genirq interface?
sound/soc/amd/acp-pcm-dma.c line 205
Quoted 8 lines
sound/soc/amd/acp-pcm-dma.c new file +8
-0+/* Let ACP know the Allocated memory */ + num_of_pages =PAGE_ALIGN (size) >>PAGE_SHIFT ; + +/* Fill the page table entries in ACP SRAM */ + rtd->pg = pg; + rtd->size = size; + rtd->num_of_pages = num_of_pages; + rtd->direction = substream->stream;
We never reference num_of_pages other than to assign it into the page table entry?
sound/soc/amd/acp-pcm-dma.c line 343
Quoted 9 lines
sound/soc/amd/acp-pcm-dma.c new file +9
-0+static int acp_dma_close (struct snd_pcm_substream *substream) +{ +struct snd_pcm_runtime *runtime = substream->runtime; +struct audio_substream_data *rtd = runtime->private_data; +struct snd_soc_pcm_runtime *prtd = substream->private_data; + +kfree (rtd); + +pm_runtime_mark_last_busy (prtd->platform->dev);
Why the _mark_last_busy() here?
sound/soc/amd/acp-pcm-dma.c line 396
Quoted 12 lines
sound/soc/amd/acp-pcm-dma.c new file +12
-0+/* The following members gets populated in device 'open' +* function. Till then interrupts are disabled in 'acp_hw_init' +* and device doesn't generate any interrupts. +*/ + + audio_drv_data->play_stream =NULL ; + audio_drv_data->capture_stream =NULL ; + + audio_drv_data->iprv->dev = &pdev->dev; + audio_drv_data->iprv->acp_mmio = audio_drv_data->acp_mmio; + audio_drv_data->iprv->enable_intr = acp_enable_external_interrupts; + audio_drv_data->iprv->irq_handler = dma_irq_handler;
I do not that we never seem to reset any of these in teardown paths and I am slightly worried about races with interrupt handling in teardown,
sound/soc/amd/acp-pcm-dma.c line 439
Quoted 11 lines
sound/soc/amd/acp-pcm-dma.c new file +11
-0+static int acp_pcm_suspend (struct device *dev) +{ +bool pm_rts; +struct audio_drv_data *adata =dev_get_drvdata (dev); + + pm_rts =pm_runtime_status_suspended (dev); +if (pm_rts == false) +acp_suspend (adata->acp_mmio); + +return 0 ; +}
This appears to merely call into the parent/core device (at least it looks like this is the intention, there's a bunch of infrastructure fo the core device which appeaars to replicate standard infrastructure). Isn't whatever this eventually ends up doing handled by the parent device in the normal PM callbacks.
This parallel infrastructure seems like it needs some motivation, especially given that when I look at the implementation of functions like amd_acp_suspend() and amd_acp_resume() in the preceeding patch they are empty and therefore do nothing (they're also not exported so I expect we get build errors if this is a module and the core isn't). The easiest thing is probably to remove the code until there is an immplementation and then review at that time.
Quoted 5 lines
sound/soc/amd/acp-pcm-dma.c new file +5
-0+static int acp_pcm_resume (struct device *dev) +{ +bool pm_rts; +struct snd_pcm_substream *stream; +struct snd_pcm_runtime *rtd;
sound/soc/amd/acp-pcm-dma.c line 455
Quoted 10 lines
sound/soc/amd/acp-pcm-dma.c new file +10
-0+struct audio_substream_data *sdata; +struct audio_drv_data *adata =dev_get_drvdata (dev); + + pm_rts =pm_runtime_status_suspended (dev); +if (pm_rts == true) { +/* Resumed from system wide suspend and there is +* no pending audio activity to resume. */ +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev);
The above looks very strange - why are we bouncing runtime PM like this?
sound/soc/amd/acp.c line 73
Quoted 7 lines
sound/soc/amd/acp.c new file +7
-0+/* Initialize the dma descriptors location in SRAM and page size */ +static void acp_dma_descr_init (void __iomem *acp_mmio) +{ +u32 sram_pte_offset =0 ; + +/* SRAM starts at 0x04000000. From that offset one page (4KB) left for +* filling DMA descriptors.sram_pte_offset = 0x04001000 , used for
This is a device relative address rather than an absolute address? A lot of these numbers seem kind of large...
sound/soc/amd/acp.c line 262
Quoted 9 lines
sound/soc/amd/acp.c new file +9
-0+u16 get_dscr_idx (void __iomem *acp_mmio,int direction) +{ +u16 dscr_idx; + +if (direction ==SNDRV_PCM_STREAM_PLAYBACK ) { + dscr_idx =acp_reg_read (acp_mmio, mmACP_DMA_CUR_DSCR_13); + dscr_idx = (dscr_idx ==PLAYBACK_START_DMA_DESCR_CH13 ) ? +PLAYBACK_START_DMA_DESCR_CH12 : +PLAYBACK_END_DMA_DESCR_CH12 ;
Please write normal if statements rather than using the ternery operator.
sound/soc/amd/acp.c line 352
Quoted 13 lines
sound/soc/amd/acp.c new file +13
-0+/* Check whether ACP DMA interrupt (IOC) is generated or not */ +u32 acp_get_intr_flag (void __iomem *acp_mmio) +{ +u32 ext_intr_status; +u32 intr_gen; + + ext_intr_status =acp_reg_read (acp_mmio, mmACP_EXTERNAL_INTR_STAT); + intr_gen = (((ext_intr_status & + ACP_EXTERNAL_INTR_STAT__DMAIOCStat_MASK) >> + ACP_EXTERNAL_INTR_STAT__DMAIOCStat__SHIFT)); + +return intr_gen; +}
Looking at a lot of the interrupt code I can't help but think there's a genirq interrupt controller lurking in here somewhere.
sound/soc/amd/acp.c line 386
Quoted 2 lines
sound/soc/amd/acp.c new file +2
-0+/*Invalidating the DAGB cache */ +acp_reg_write (ENABLE , acp_mmio, mmACP_DAGB_ATU_CTRL);
/* spaces around comments please */
sound/soc/amd/acp.c line 399
Quoted 6 lines
sound/soc/amd/acp.c new file +6
-0+if ((ch_num ==ACP_TO_I2S_DMA_CH_NUM ) || + (ch_num ==ACP_TO_SYSRAM_CH_NUM ) || + (ch_num ==I2S_TO_ACP_DMA_CH_NUM )) + dma_ctrl |= ACP_DMA_CNTL_0__DMAChIOCEn_MASK; +else + dma_ctrl &= ~ACP_DMA_CNTL_0__DMAChIOCEn_MASK;
switch statement please.
Quoted 7 lines
sound/soc/amd/acp.c new file +6
-0+u32 delay_time =ACP_DMA_RESET_TIME ; +/* check the channel status bit for some time and return the status */ +while (0 < delay_time) { + dma_ch_sts =acp_reg_read (acp_mmio, mmACP_DMA_CH_STS); +if (!(dma_ch_sts &BIT (ch_num))) { +/* clear the reset flag after successfully stopping
sound/soc/amd/acp.c line 449
Quoted 10 lines
sound/soc/amd/acp.c new file +10
-0+the dma transfer and break from the loop */ + dma_ctrl &= ~ACP_DMA_CNTL_0__DMAChRst_MASK; + +acp_reg_write (dma_ctrl, acp_mmio, mmACP_DMA_CNTL_0 + + ch_num); +break ; + } + delay_time--; + } +}
This isn't really a time, it's a number of spins (the amount of time involved presumably depending on clock speed). If this were a time I'd expect to see a delay or sleep in here.
We're also falling off the end of the loop silently if the hardware fails to respond, if it's worth waiting for the hardware to do it's thing I'd expect it's also worth displaying an error if that happens. This is a common pattern in much of the rest of the driver.
sound/soc/amd/acp.c line 461
Quoted 11 lines
sound/soc/amd/acp.c new file +11
-0+/* power off a tile/block within ACP */ +static void acp_suspend_tile (void __iomem *acp_mmio,int tile) +{ +u32 val =0 ; +u32 timeout =0 ; + +if ((tile <ACP_TILE_P1 ) || (tile >ACP_TILE_DSP2 )) +return ; + + val =acp_reg_read (acp_mmio, mmACP_PGFSM_READ_REG_0 + tile); + val &=ACP_TILE_ON_MASK ;
This is definitely looking like a SoC that could benefit from the standard kernel power management infrastructure and/or DAPM. There's a lot of code here that looks like it's following very common SoC design patterns and could benefit from using infrastructure more.
sound/soc/amd/acp.c line 492
Quoted 7 lines
sound/soc/amd/acp.c new file +7
-0+static void acp_resume_tile (void __iomem *acp_mmio,int tile) +{ +u32 val =0 ; +u32 timeout =0 ; + +if ((tile <ACP_TILE_P1 ) || (tile >ACP_TILE_DSP2 )) +return ;
Not worth printing an error if the user passed in something invalid?
sound/soc/amd/acp.c line 528
Quoted 12 lines
sound/soc/amd/acp.c new file +12
-0+/* Shutdown unused SRAM memory banks in ACP IP */ +static void acp_turnoff_sram_banks (void __iomem *acp_mmio) +{ +/* Bank 0 : used for DMA descriptors +* Bank 1 to 4 : used for playback +* Bank 5 to 8 : used for capture +* Each bank is 8kB and max size allocated for playback/ capture is +* 16kB(max period size) * 2(max periods) reserved for playback/capture +* in ALSA driver +* Turn off all SRAM banks except above banks during playback/capture +*/ +u32 val, bank;
I didn't see any runtime management of the other SRAM bank power, seems like that'd be a good idea?
sound/soc/amd/acp.c line 605
Quoted 6 lines
sound/soc/amd/acp.c new file +6
-0+/* initiailizing Garlic Control DAGB register */ +acp_reg_write (ONION_CNTL_DEFAULT , acp_mmio, mmACP_AXI2DAGB_ONION_CNTL); + +/* initiailizing Onion Control DAGB registers */ +acp_reg_write (GARLIC_CNTL_DEFAULT , acp_mmio, + mmACP_AXI2DAGB_GARLIC_CNTL);
The comments don't match the code...
Quoted 8 lines
sound/soc/amd/acp.c new file +8
-0+/* Update DMA postion in audio ring buffer at period level granularity. +* This will be used by ALSA PCM driver +*/ +u32 acp_update_dma_pointer (void __iomem *acp_mmio,int direction, +u32 period_size) +{ +u32 pos; +u16 dscr;
sound/soc/amd/acp.c line 682
Quoted 10 lines
sound/soc/amd/acp.c new file +10
-0+u32 mul; +u32 dma_config; + + pos =0 ; + +if (direction ==SNDRV_PCM_STREAM_PLAYBACK ) { + dscr =acp_reg_read (acp_mmio, mmACP_DMA_CUR_DSCR_13); + + mul = (dscr ==PLAYBACK_START_DMA_DESCR_CH13 ) ?0 :1 ; + pos = (mul * period_size);
Don't limit the accuracy to period level if the harwdare can do better, report the current position as accurately as possible please. This is also feeling like we've got an unneeded abstraction here - why was this not just directly the pointer operation?
Quoted 8 lines
sound/soc/amd/acp.c new file +8
-0+/* Wait for initial buffering to complete in HOST to SRAM DMA channel +* for plaback usecase +*/ +void prebuffer_audio (void __iomem *acp_mmio) +{ +u32 dma_ch_sts; +u32 channel_mask =BIT (SYSRAM_TO_ACP_CH_NUM ); +
sound/soc/amd/acp.c line 716
Quoted 10 lines
sound/soc/amd/acp.c new file +10
-0+do { +/* Read the channel status to poll dma transfer completion +* (System RAM to SRAM) +* In this case, it will be runtime->start_threshold +* (2 ALSA periods) of transfer. Rendering starts after this +* threshold is met. +*/ + dma_ch_sts =acp_reg_read (acp_mmio, mmACP_DMA_CH_STS); +udelay (20 ); + }while (dma_ch_sts & channel_mask);
This will hang hard if the hardware fails to respond for some reason, please have a timeout. A cpu_relax() would also be friendly.
sound/soc/amd/acp.h line 8
Quoted 2 lines
sound/soc/amd/acp.h new file +2
-0+#define DISABLE 0 +#define ENABLE 1
Please don't do this :(
sound/soc/amd/acp.h line 76
Quoted 2 lines
sound/soc/amd/acp.h new file +2
-0+#define STATUS_SUCCESS 0 +#define STATUS_UNSUCCESSFUL -1
Please use normal Linux error codes.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [alsa-devel] [PATCH 8/8] ASoC: AMD: add AMD ASoC ACP-I2S driver
Quoted 17 lines · Mark Brown
Quoted 2 lines · Alex Deucher
ACP IP block consists of dedicated DMA and I2S blocks. The PCM driver provides the platform DMA component to ALSA core.
Overall my main comment on a lot of this code is that it feels like we have created a lot of infrastructure that parallels standard Linux subsystems and interfaces without something that clearly shows why we're doing that. There may be good reasons but they've not been articulated and it's making the code a lot more complex to follow and review. We end up with multiple layers of abstraction and indirection that aren't explained.
This patch is also rather large and appears to contain multiple components which could be split, there's at least the DMA driver and this abstraction layer than the DMA driver builds on.
Quoted 9 lines
sound/soc/amd/acp-pcm-dma.c line 97
Quoted 5 lines
sound/soc/amd/acp-pcm-dma.c new file +5
-0+/* ACP DMA irq handler routine for playback, capture usecases */ +int dma_irq_handler (struct device *dev) +{ +u16 dscr_idx; +u32 intr_flag;This says it's an interrupt handler but it's using some custom, non-genirq interface?
Irq handling is based on parent device's (part of other subsystem) provided interfaces. I will coordinate with others for this.
Do you mean, using virtual irq assignment for MFD devices (ACP is a MFD device) and registering irq handler for it ?
Quoted 9 lines
sound/soc/amd/acp-pcm-dma.c line 205
Quoted 8 lines
sound/soc/amd/acp-pcm-dma.c new file +8
-0+/* Let ACP know the Allocated memory */ + num_of_pages =PAGE_ALIGN (size) >>PAGE_SHIFT ; + +/* Fill the page table entries in ACP SRAM */ + rtd->pg = pg; + rtd->size = size; + rtd->num_of_pages = num_of_pages; + rtd->direction = substream->stream;
Quoted 3 lines
We never reference
num_of_pagesother than to assign it into the page table entry?
Sorry, I didn't understand your comment.
I used 'num_of_pages' to configure ACP audio device for accessing system memory. The implementation is in 'acp_pte_config' function in the patch.
Quoted 11 lines
sound/soc/amd/acp-pcm-dma.c line 343
Quoted 9 lines
sound/soc/amd/acp-pcm-dma.c new file +9
-0+static int acp_dma_close (struct snd_pcm_substream *substream) +{ +struct snd_pcm_runtime *runtime = substream->runtime; +struct audio_substream_data *rtd = runtime->private_data; +struct snd_soc_pcm_runtime *prtd = substream->private_data; + +kfree (rtd); + +pm_runtime_mark_last_busy (prtd->platform->dev);Why the
_mark_last_busy()here?
I want to power off ACP audio IP, when the audio usecase is not active for sometime (run time PM). I felt, 'close' is the correct place to mark this.
Quoted 17 lines
sound/soc/amd/acp-pcm-dma.c line 396
Quoted 13 lines
sound/soc/amd/acp-pcm-dma.c new file +12
-0+/* The following members gets populated in device 'open' +* function. Till then interrupts are disabled in 'acp_hw_init' +* and device doesn't generate any interrupts. +*/ + + audio_drv_data->play_stream =NULL ; + audio_drv_data->capture_stream =NULL ; + + audio_drv_data->iprv->dev = &pdev->dev; + audio_drv_data->iprv->acp_mmio = audio_drv_data->acp_mmio; + audio_drv_data->iprv->enable_intr = acp_enable_external_interrupts; + audio_drv_data->iprv->irq_handler = dma_irq_handler;I do not that we never seem to reset any of these in teardown paths and I am slightly worried about races with interrupt handling in teardown,
I will recheck this.
Quoted 9 lines
Quoted 9 lines
sound/soc/amd/acp-pcm-dma.c new file +9
-0+static int acp_pcm_suspend (struct device *dev) +{ +bool pm_rts; +struct audio_drv_data *adata =dev_get_drvdata (dev); + + pm_rts =pm_runtime_status_suspended (dev); +if (pm_rts == false) +acp_suspend (adata->acp_mmio); +
Quoted 9 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ return 0; +}This appears to merely call into the parent/core device (at least it looks like this is the intention, there's a bunch of infrastructure fo the core device which appeaars to replicate standard infrastructure). Isn't whatever this eventually ends up doing handled by the parent device in the normal PM callbacks.
ACP device (child) can power off itself, when it receives suspend request. So, the intention is to call 'acp_suspend' (defined in same patch) from the 'suspend' callback of ACP device.
Quoted 8 lines
This parallel infrastructure seems like it needs some motivation, especially given that when I look at the implementation of functions like
amd_acp_suspend()andamd_acp_resume()in the preceeding patch they are empty and therefore do nothing (they're also not exported so I expect we get build errors if this is a module and the core isn't). The easiest thing is probably to remove the code until there is an immplementation and then review at that time.
There were two different functions with same name in two drivers interacting here.That might have introduced some confusion. Sorry, I will modify that.
Also, amd_acp_*() can be removed later, as they are not expected to add any functonality in future. ACP device can be suspended/resumed using acp_*_tile().
Quoted 9 lines
Quoted 9 lines
sound/soc/amd/acp-pcm-dma.c new file +9
-0+static int acp_pcm_resume (struct device *dev) +{ +bool pm_rts; +struct snd_pcm_substream *stream; +struct snd_pcm_runtime *rtd; +struct audio_substream_data *sdata; +struct audio_drv_data *adata =dev_get_drvdata (dev); + + pm_rts =pm_runtime_status_suspended (dev);
Quoted 8 lines
sound/soc/amd/acp-pcm-dma.c line 455
Quoted 6 lines
sound/soc/amd/acp-pcm-dma.c new file +6
-0+if (pm_rts == true) { +/* Resumed from system wide suspend and there is +* no pending audio activity to resume. */ +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev);The above looks very strange - why are we bouncing runtime PM like this?
Sorry, I didn't understand your comment. I felt, steps mentioned in kernel documentation :
http://lxr.free-electrons.com/source/Documentation/power/runtime_pm.txt#L634
is applicable in this scenario. I maybe wrong, but felt that is applicable.
Quoted 11 lines
sound/soc/amd/acp.c line 73
Quoted 8 lines
sound/soc/amd/acp.c new file +7
-0+/* Initialize the dma descriptors location in SRAM and page size */ +static void acp_dma_descr_init (void __iomem *acp_mmio) +{ +u32 sram_pte_offset =0 ; + +/* SRAM starts at 0x04000000. From that offset one page (4KB) left for +* filling DMA descriptors.sram_pte_offset = 0x04001000 , used for This is a device relative address rather than an absolute address? A lot of these numbers seem kind of large...
That is SRAM block's offset address. Sorry. I didn't understand the expected change, here.
Quoted 14 lines
sound/soc/amd/acp.c line 262
Quoted 10 lines
sound/soc/amd/acp.c new file +9
-0+u16 get_dscr_idx (void __iomem *acp_mmio,int direction) +{ +u16 dscr_idx; + +if (direction ==SNDRV_PCM_STREAM_PLAYBACK ) { + dscr_idx =acp_reg_read (acp_mmio, mmACP_DMA_CUR_DSCR_13); + dscr_idx = (dscr_idx ==PLAYBACK_START_DMA_DESCR_CH13 ) ? +PLAYBACK_START_DMA_DESCR_CH12 : +PLAYBACK_END_DMA_DESCR_CH12 ;Please write normal if statements rather than using the ternery operator.
Ok.
Quoted 8 lines
Quoted 8 lines
sound/soc/amd/acp.c new file +8
-0+/* Check whether ACP DMA interrupt (IOC) is generated or not */ +u32 acp_get_intr_flag (void __iomem *acp_mmio) +{ +u32 ext_intr_status; +u32 intr_gen; + + ext_intr_status =acp_reg_read (acp_mmio, mmACP_EXTERNAL_INTR_STAT); + intr_gen = (((ext_intr_status &
Quoted 9 lines
sound/soc/amd/acp.c line 352
Quoted 5 lines
sound/soc/amd/acp.c new file +5
-0+ ACP_EXTERNAL_INTR_STAT__DMAIOCStat_MASK) >> + ACP_EXTERNAL_INTR_STAT__DMAIOCStat__SHIFT)); + +return intr_gen; +}Looking at a lot of the interrupt code I can't help but think there's a genirq interrupt controller lurking in here somewhere.
I will coordinate with other subsystem driver author, that this driver is dependent on.
Quoted 5 lines
sound/soc/amd/acp.c line 386
Quoted 2 lines
sound/soc/amd/acp.c new file +2
-0+/*Invalidating the DAGB cache */ +acp_reg_write (ENABLE , acp_mmio, mmACP_DAGB_ATU_CTRL);/* spaces around comments please */
Quoted 8 lines
sound/soc/amd/acp.c line 399
Quoted 6 lines
sound/soc/amd/acp.c new file +6
-0+if ((ch_num ==ACP_TO_I2S_DMA_CH_NUM ) || + (ch_num ==ACP_TO_SYSRAM_CH_NUM ) || + (ch_num ==I2S_TO_ACP_DMA_CH_NUM )) + dma_ctrl |= ACP_DMA_CNTL_0__DMAChIOCEn_MASK; +else + dma_ctrl &= ~ACP_DMA_CNTL_0__DMAChIOCEn_MASK;switch statement please.
Ok.
Quoted 23 lines
Quoted 8 lines
sound/soc/amd/acp.c new file +6
-0+u32 delay_time =ACP_DMA_RESET_TIME ; +/* check the channel status bit for some time and return the status */ +while (0 < delay_time) { + dma_ch_sts =acp_reg_read (acp_mmio, mmACP_DMA_CH_STS); +if (!(dma_ch_sts &BIT (ch_num))) { +/* clear the reset flag after successfully stopping sound/soc/amd/acp.c line 449
Quoted 10 lines
sound/soc/amd/acp.c new file +10
-0+the dma transfer and break from the loop */ + dma_ctrl &= ~ACP_DMA_CNTL_0__DMAChRst_MASK; + +acp_reg_write (dma_ctrl, acp_mmio, mmACP_DMA_CNTL_0 + + ch_num); +break ; + } + delay_time--; + } +}This isn't really a time, it's a number of spins (the amount of time involved presumably depending on clock speed). If this were a time I'd expect to see a delay or sleep in here.
Quoted 5 lines
We're also falling off the end of the loop silently if the hardware fails to respond, if it's worth waiting for the hardware to do it's thing I'd expect it's also worth displaying an error if that happens. This is a common pattern in much of the rest of the driver.
Ok, will modify.
Quoted 8 lines
Quoted 8 lines
sound/soc/amd/acp.c new file +8
-0+/* power off a tile/block within ACP */ +static void acp_suspend_tile (void __iomem *acp_mmio,int tile) +{ +u32 val =0 ; +u32 timeout =0 ; + +if ((tile <ACP_TILE_P1 ) || (tile >ACP_TILE_DSP2 )) +return ;
Quoted 9 lines
sound/soc/amd/acp.c line 461
Quoted 3 lines
sound/soc/amd/acp.c new file +3
-0+ + val =acp_reg_read (acp_mmio, mmACP_PGFSM_READ_REG_0 + tile); + val &=ACP_TILE_ON_MASK ;This is definitely looking like a SoC that could benefit from the standard kernel power management infrastructure and/or DAPM. There's a lot of code here that looks like it's following very common SoC design patterns and could benefit from using infrastructure more.
Sorry, I didn't understand. Could you help in adding more pointers on this. The device can get powered-off, with this helper function, which can be called from device 'suspend' callback.
Quoted 9 lines
sound/soc/amd/acp.c line 492
Quoted 7 lines
sound/soc/amd/acp.c new file +7
-0+static void acp_resume_tile (void __iomem *acp_mmio,int tile) +{ +u32 val =0 ; +u32 timeout =0 ; + +if ((tile <ACP_TILE_P1 ) || (tile >ACP_TILE_DSP2 )) +return ;Not worth printing an error if the user passed in something invalid?
Ok.
Quoted 16 lines
sound/soc/amd/acp.c line 528
Quoted 13 lines
sound/soc/amd/acp.c new file +12
-0+/* Shutdown unused SRAM memory banks in ACP IP */ +static void acp_turnoff_sram_banks (void __iomem *acp_mmio) +{ +/* Bank 0 : used for DMA descriptors +* Bank 1 to 4 : used for playback +* Bank 5 to 8 : used for capture +* Each bank is 8kB and max size allocated for playback/ capture is +* 16kB(max period size) * 2(max periods) reserved for playback/capture +* in ALSA driver +* Turn off all SRAM banks except above banks during playback/capture +*/ +u32 val, bank;I didn't see any runtime management of the other SRAM bank power, seems like that'd be a good idea?
SRAM banks are part of ACP IP. With ACP's runtime PM handling, all blocks within ACP IP can be powered-off and on.
Quoted 9 lines
sound/soc/amd/acp.c line 605
Quoted 7 lines
sound/soc/amd/acp.c new file +6
-0+/* initiailizing Garlic Control DAGB register */ +acp_reg_write (ONION_CNTL_DEFAULT , acp_mmio, mmACP_AXI2DAGB_ONION_CNTL); + +/* initiailizing Onion Control DAGB registers */ +acp_reg_write (GARLIC_CNTL_DEFAULT , acp_mmio, + mmACP_AXI2DAGB_GARLIC_CNTL);The comments don't match the code...
Oops, I will correct it.
Quoted 16 lines
Quoted 16 lines
sound/soc/amd/acp.c new file +15
-0+/* Update DMA postion in audio ring buffer at period level granularity. +* This will be used by ALSA PCM driver +*/ +u32 acp_update_dma_pointer (void __iomem *acp_mmio,int direction, +u32 period_size) +{ +u32 pos; +u16 dscr; +u32 mul; +u32 dma_config; + + pos =0 ; + +if (direction ==SNDRV_PCM_STREAM_PLAYBACK ) { + dscr =acp_reg_read (acp_mmio, mmACP_DMA_CUR_DSCR_13);
Quoted 9 lines
sound/soc/amd/acp.c line 682
Quoted 3 lines
sound/soc/amd/acp.c new file +3
-0+ + mul = (dscr ==PLAYBACK_START_DMA_DESCR_CH13 ) ?0 :1 ; + pos = (mul * period_size);Don't limit the accuracy to period level if the harwdare can do better, report the current position as accurately as possible please. This is also feeling like we've got an unneeded abstraction here - why was this not just directly the pointer operation?
The current version of hardware has the limitation of accuracy reporting. I will remove abstraction, if suggested.
Quoted 13 lines
Quoted 13 lines
sound/soc/amd/acp.c new file +13
-0+/* Wait for initial buffering to complete in HOST to SRAM DMA channel +* for plaback usecase +*/ +void prebuffer_audio (void __iomem *acp_mmio) +{ +u32 dma_ch_sts; +u32 channel_mask =BIT (SYSRAM_TO_ACP_CH_NUM ); + + do { + /* Read the channel status to poll dma transfer completion + * (System RAM to SRAM) + * In this case, it will be runtime->start_threshold + * (2 ALSA periods) of transfer. Rendering starts after this
Quoted 9 lines
sound/soc/amd/acp.c line 716
Quoted 5 lines
sound/soc/amd/acp.c new file +5
-0+* threshold is met. +*/ + dma_ch_sts =acp_reg_read (acp_mmio, mmACP_DMA_CH_STS); +udelay (20 ); + }while (dma_ch_sts & channel_mask);This will hang hard if the hardware fails to respond for some reason, please have a timeout. A
cpu_relax()would also be friendly.
I will modify this.
Quoted 4 lines
sound/soc/amd/acp.h line 8
Quoted 2 lines
sound/soc/amd/acp.h new file +2
-0+#define DISABLE 0 +#define ENABLE 1Please don't do this :(
Ok.
Quoted 6 lines
sound/soc/amd/acp.h line 76
Quoted 3 lines
sound/soc/amd/acp.h new file +2
-0+#define STATUS_SUCCESS 0 +#define STATUS_UNSUCCESSFUL -1Please use normal Linux error codes.
Ok.
Quoted 5 lines
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerRe: [alsa-devel] [PATCH 8/8] ASoC: AMD: add AMD ASoC ACP-I2S driver
Quoted 12 lines · maruthi srinivas
Quoted 10 lines · Mark Brown
sound/soc/amd/acp-pcm-dma.c line 97
Quoted 5 lines · Alex Deucher
sound/soc/amd/acp-pcm-dma.c new file +5
-0+/* ACP DMA irq handler routine for playback, capture usecases */ +int dma_irq_handler (struct device *dev) +{ +u16 dscr_idx; +u32 intr_flag;This says it's an interrupt handler but it's using some custom, non-genirq interface?
Quoted 5 lines
Irq handling is based on parent device's (part of other subsystem) provided interfaces. I will coordinate with others for this.
Do you mean, using virtual irq assignment for MFD devices (ACP is a MFD device) and registering irq handler for it ?
Well, I'd expect that if we're exporting interrupts around the system we'd be doing so using genirq rather than open coding something.
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
sound/soc/amd/acp-pcm-dma.c new file +8
-0+/* Let ACP know the Allocated memory */ + num_of_pages =PAGE_ALIGN (size) >>PAGE_SHIFT ; + +/* Fill the page table entries in ACP SRAM */ + rtd->pg = pg; + rtd->size = size; + rtd->num_of_pages = num_of_pages; + rtd->direction = substream->stream;
Quoted 6 lines
Quoted 2 lines
We never reference
num_of_pagesother than to assign it into the page table entry?Sorry, I didn't understand your comment.
I used 'num_of_pages' to configure ACP audio device for accessing system memory. The implementation is in 'acp_pte_config' function in the patch.
In the above code we have two blocks of code, one doing an assignment to a local variable and the other initialising the struct but the local variable in the first block is only ever referenced in the second block.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
sound/soc/amd/acp-pcm-dma.c new file +5
-0+static int acp_dma_close (struct snd_pcm_substream *substream) +{ +struct snd_pcm_runtime *runtime = substream->runtime; +struct audio_substream_data *rtd = runtime->private_data; +struct snd_soc_pcm_runtime *prtd = substream->private_data;
Quoted 8 lines
Quoted 5 lines
sound/soc/amd/acp-pcm-dma.c line 343
Quoted 3 lines
sound/soc/amd/acp-pcm-dma.c new file +2
-0+kfree (rtd); +pm_runtime_mark_last_busy (prtd->platform->dev);Why the
_mark_last_busy()here?I want to power off ACP audio IP, when the audio usecase is not active for sometime (run time PM). I felt, 'close' is the correct place to mark this.
That's not what _mark_last_busy() does... the core already takes runtime PM references for you.
Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
sound/soc/amd/acp-pcm-dma.c new file +9
-0+static int acp_pcm_suspend (struct device *dev) +{ +bool pm_rts; +struct audio_drv_data *adata =dev_get_drvdata (dev); + + pm_rts =pm_runtime_status_suspended (dev); +if (pm_rts == false) +acp_suspend (adata->acp_mmio); +Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ return 0; +}This appears to merely call into the parent/core device (at least it looks like this is the intention, there's a bunch of infrastructure fo the core device which appeaars to replicate standard infrastructure). Isn't whatever this eventually ends up doing handled by the parent device in the normal PM callbacks.
Quoted 3 lines
ACP device (child) can power off itself, when it receives suspend request. So, the intention is to call '
acp_suspend' (defined in same patch) from the 'suspend' callback of ACP device.
This doesn't address why you're open coding this rather than using standard infrastructure.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
sound/soc/amd/acp-pcm-dma.c new file +7
-0+ pm_rts =pm_runtime_status_suspended (dev); +if (pm_rts == true) { +/* Resumed from system wide suspend and there is +* no pending audio activity to resume. */ +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev);
Quoted 6 lines
Quoted 1 line
The above looks very strange - why are we bouncing runtime PM like this?
Sorry, I didn't understand your comment. I felt, steps mentioned in kernel documentation :
http://lxr.free-electrons.com/source/Documentation/power/runtime_pm.txt#L634
is applicable in this scenario. I maybe wrong, but felt that is applicable.
Please document this clearly - your comment doesn't appear to relate to the case where system resume powers things on at all.
Quoted 11 lines
Quoted 10 lines
sound/soc/amd/acp.c line 73
Quoted 7 lines
sound/soc/amd/acp.c new file +7
-0+/* Initialize the dma descriptors location in SRAM and page size */ +static void acp_dma_descr_init (void __iomem *acp_mmio) +{ +u32 sram_pte_offset =0 ; + +/* SRAM starts at 0x04000000. From that offset one page (4KB) left for +* filling DMA descriptors.sram_pte_offset = 0x04001000 , used for This is a device relative address rather than an absolute address? A lot of these numbers seem kind of large...
Quoted 2 lines
That is SRAM block's offset address. Sorry. I didn't understand the expected change, here.
Offset with regard to what? I'm asking if these addresses are within the IP or global.
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
sound/soc/amd/acp.c new file +8
-0+/* power off a tile/block within ACP */ +static void acp_suspend_tile (void __iomem *acp_mmio,int tile) +{ +u32 val =0 ; +u32 timeout =0 ; + +if ((tile <ACP_TILE_P1 ) || (tile >ACP_TILE_DSP2 )) +return ;Quoted 8 lines
sound/soc/amd/acp.c line 461
Quoted 3 lines
sound/soc/amd/acp.c new file +3
-0+ + val =acp_reg_read (acp_mmio, mmACP_PGFSM_READ_REG_0 + tile); + val &=ACP_TILE_ON_MASK ;This is definitely looking like a SoC that could benefit from the standard kernel power management infrastructure and/or DAPM. There's a lot of code here that looks like it's following very common SoC design patterns and could benefit from using infrastructure more.
Quoted 3 lines
Sorry, I didn't understand. Could you help in adding more pointers on this. The device can get powered-off, with this helper function, which can be called from device 'suspend' callback.
Power domains are implemented using the interface in include/linux/pm_domain.h and DAPM is sound/soc/soc-dapm.c. The point here is that it looks very much like you are open coding implementations of concepts that we already have generic support for which adds greatly to both the size and complexity of this code.
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
sound/soc/amd/acp.c new file +6
-0+static void acp_turnoff_sram_banks (void __iomem *acp_mmio) +{ +/* Bank 0 : used for DMA descriptors +* Bank 1 to 4 : used for playback +* Bank 5 to 8 : used for capture +* Each bank is 8kB and max size allocated for playback/ capture is Quoted 8 lines
sound/soc/amd/acp.c line 528
Quoted 5 lines
sound/soc/amd/acp.c new file +5
-0+* 16kB(max period size) * 2(max periods) reserved for playback/capture +* in ALSA driver +* Turn off all SRAM banks except above banks during playback/capture +*/ +u32 val, bank;I didn't see any runtime management of the other SRAM bank power, seems like that'd be a good idea?
Quoted 2 lines
SRAM banks are part of ACP IP. With ACP's runtime PM handling, all blocks within ACP IP can be powered-off and on.
So why can't that cope with these banks then?
Quoted 12 lines
Quoted 11 lines
sound/soc/amd/acp.c line 670
Quoted 6 lines
sound/soc/amd/acp.c new file +6
-0+/* Update DMA postion in audio ring buffer at period level granularity. +* This will be used by ALSA PCM driver +*/ +u32 acp_update_dma_pointer (void __iomem *acp_mmio,int direction, +u32 period_size) +{Don't limit the accuracy to period level if the harwdare can do better, report the current position as accurately as possible please. This is also feeling like we've got an unneeded abstraction here - why was this not just directly the pointer operation?
Quoted 1 line
The current version of hardware has the limitation of accuracy reporting.
If the hardware is limited why does the comment suggest that we are limiting based on periods?
Quoted 1 line
I will remove abstraction, if suggested.
Yes, it's just adding to the complexity of the code.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 8/8] ASoC: AMD: add AMD ASoC ACP-I2S driver
Quoted 13 lines · Mark Brown
Quoted 11 lines · maruthi srinivas
Quoted 10 lines · Mark Brown
sound/soc/amd/acp-pcm-dma.c line 97
Quoted 5 lines · Alex Deucher
sound/soc/amd/acp-pcm-dma.c new file +5
-0+/* ACP DMA irq handler routine for playback, capture usecases */ +int dma_irq_handler (struct device *dev) +{ +u16 dscr_idx; +u32 intr_flag;This says it's an interrupt handler but it's using some custom, non-genirq interface?
Quoted 8 lines
Quoted 5 lines
Irq handling is based on parent device's (part of other subsystem) provided interfaces. I will coordinate with others for this.
Do you mean, using virtual irq assignment for MFD devices (ACP is a MFD device) and registering irq handler for it ?
Well, I'd expect that if we're exporting interrupts around the system we'd be doing so using genirq rather than open coding something.
I think the problem is, that in a lot of cases, it's not always readily clear that there is an existing infrastructure to do something. In this particular case, most of the common infrastructure that should be utilized for this particular patch set comes from non-traditional x86 platforms so most of us that come from a more traditional x86 background as not as familiar with them. Searching for information on how to solve these does not always produce particularly useful results (e.g., genirq). So we end up open coding a solution, not out of malice, but ignorance. If there is infrastructure we should be using, please continue to point it out during code review and we'll do our best to take advantage of it.
In the case of this hardware, audio interrupts are triggered on the GPU. The GPU driver's interrupt handler checks the interrupt source and calls the handler registered to handle that source. Until now the ACP audio block was added, all the GPU interrupt sources were stuff handled directly by the GPU driver (vblanks, display hotplug, command submission fences, etc.).
Thanks,
Alex
Quoted 166 lines
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
sound/soc/amd/acp-pcm-dma.c new file +8
-0+/* Let ACP know the Allocated memory */ + num_of_pages =PAGE_ALIGN (size) >>PAGE_SHIFT ; + +/* Fill the page table entries in ACP SRAM */ + rtd->pg = pg; + rtd->size = size; + rtd->num_of_pages = num_of_pages; + rtd->direction = substream->stream;Quoted 6 lines
Quoted 2 lines
We never reference
num_of_pagesother than to assign it into the page table entry?Sorry, I didn't understand your comment.
I used 'num_of_pages' to configure ACP audio device for accessing system memory. The implementation is in 'acp_pte_config' function in the patch.In the above code we have two blocks of code, one doing an assignment to a local variable and the other initialising the struct but the local variable in the first block is only ever referenced in the second block.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
sound/soc/amd/acp-pcm-dma.c new file +5
-0+static int acp_dma_close (struct snd_pcm_substream *substream) +{ +struct snd_pcm_runtime *runtime = substream->runtime; +struct audio_substream_data *rtd = runtime->private_data; +struct snd_soc_pcm_runtime *prtd = substream->private_data;Quoted 8 lines
Quoted 5 lines
sound/soc/amd/acp-pcm-dma.c line 343
Quoted 3 lines
sound/soc/amd/acp-pcm-dma.c new file +2
-0+kfree (rtd); +pm_runtime_mark_last_busy (prtd->platform->dev);Why the
_mark_last_busy()here?I want to power off ACP audio IP, when the audio usecase is not active for sometime (run time PM). I felt, 'close' is the correct place to mark this.
That's not what
_mark_last_busy()does... the core already takes runtime PM references for you.Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
sound/soc/amd/acp-pcm-dma.c new file +9
-0+static int acp_pcm_suspend (struct device *dev) +{ +bool pm_rts; +struct audio_drv_data *adata =dev_get_drvdata (dev); + + pm_rts =pm_runtime_status_suspended (dev); +if (pm_rts == false) +acp_suspend (adata->acp_mmio); +Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ return 0; +}This appears to merely call into the parent/core device (at least it looks like this is the intention, there's a bunch of infrastructure fo the core device which appeaars to replicate standard infrastructure). Isn't whatever this eventually ends up doing handled by the parent device in the normal PM callbacks.
Quoted 3 lines
ACP device (child) can power off itself, when it receives suspend request. So, the intention is to call '
acp_suspend' (defined in same patch) from the 'suspend' callback of ACP device.This doesn't address why you're open coding this rather than using standard infrastructure.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
sound/soc/amd/acp-pcm-dma.c new file +7
-0+ pm_rts =pm_runtime_status_suspended (dev); +if (pm_rts == true) { +/* Resumed from system wide suspend and there is +* no pending audio activity to resume. */ +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev);Quoted 6 lines
Quoted 1 line
The above looks very strange - why are we bouncing runtime PM like this?
Sorry, I didn't understand your comment. I felt, steps mentioned in kernel documentation :
http://lxr.free-electrons.com/source/Documentation/power/runtime_pm.txt#L634
is applicable in this scenario. I maybe wrong, but felt that is applicable.Please document this clearly - your comment doesn't appear to relate to the case where system resume powers things on at all.
Quoted 11 lines
Quoted 10 lines
sound/soc/amd/acp.c line 73
Quoted 7 lines
sound/soc/amd/acp.c new file +7
-0+/* Initialize the dma descriptors location in SRAM and page size */ +static void acp_dma_descr_init (void __iomem *acp_mmio) +{ +u32 sram_pte_offset =0 ; + +/* SRAM starts at 0x04000000. From that offset one page (4KB) left for +* filling DMA descriptors.sram_pte_offset = 0x04001000 , used for This is a device relative address rather than an absolute address? A lot of these numbers seem kind of large...
Quoted 2 lines
That is SRAM block's offset address. Sorry. I didn't understand the expected change, here.
Offset with regard to what? I'm asking if these addresses are within the IP or global.
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
sound/soc/amd/acp.c new file +8
-0+/* power off a tile/block within ACP */ +static void acp_suspend_tile (void __iomem *acp_mmio,int tile) +{ +u32 val =0 ; +u32 timeout =0 ; + +if ((tile <ACP_TILE_P1 ) || (tile >ACP_TILE_DSP2 )) +return ;Quoted 8 lines
sound/soc/amd/acp.c line 461
Quoted 3 lines
sound/soc/amd/acp.c new file +3
-0+ + val =acp_reg_read (acp_mmio, mmACP_PGFSM_READ_REG_0 + tile); + val &=ACP_TILE_ON_MASK ;This is definitely looking like a SoC that could benefit from the standard kernel power management infrastructure and/or DAPM. There's a lot of code here that looks like it's following very common SoC design patterns and could benefit from using infrastructure more.
Quoted 3 lines
Sorry, I didn't understand. Could you help in adding more pointers on this. The device can get powered-off, with this helper function, which can be called from device 'suspend' callback.
Power domains are implemented using the interface in
include/linux/pm_domain.hand DAPM issound/soc/soc-dapm.c. The point here is that it looks very much like you are open coding implementations of concepts that we already have generic support for which adds greatly to both the size and complexity of this code.Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
sound/soc/amd/acp.c new file +6
-0+static void acp_turnoff_sram_banks (void __iomem *acp_mmio) +{ +/* Bank 0 : used for DMA descriptors +* Bank 1 to 4 : used for playback +* Bank 5 to 8 : used for capture +* Each bank is 8kB and max size allocated for playback/ capture is Quoted 8 lines
sound/soc/amd/acp.c line 528
Quoted 5 lines
sound/soc/amd/acp.c new file +5
-0+* 16kB(max period size) * 2(max periods) reserved for playback/capture +* in ALSA driver +* Turn off all SRAM banks except above banks during playback/capture +*/ +u32 val, bank;I didn't see any runtime management of the other SRAM bank power, seems like that'd be a good idea?
Quoted 2 lines
SRAM banks are part of ACP IP. With ACP's runtime PM handling, all blocks within ACP IP can be powered-off and on.
So why can't that cope with these banks then?
Quoted 12 lines
Quoted 11 lines
sound/soc/amd/acp.c line 670
Quoted 6 lines
sound/soc/amd/acp.c new file +6
-0+/* Update DMA postion in audio ring buffer at period level granularity. +* This will be used by ALSA PCM driver +*/ +u32 acp_update_dma_pointer (void __iomem *acp_mmio,int direction, +u32 period_size) +{Don't limit the accuracy to period level if the harwdare can do better, report the current position as accurately as possible please. This is also feeling like we've got an unneeded abstraction here - why was this not just directly the pointer operation?
Quoted 1 line
The current version of hardware has the limitation of accuracy reporting.
If the hardware is limited why does the comment suggest that we are limiting based on periods?
Quoted 1 line
I will remove abstraction, if suggested.
Yes, it's just adding to the complexity of the code.
Mark Brown
maintainerRe: [alsa-devel] [PATCH 8/8] ASoC: AMD: add AMD ASoC ACP-I2S driver
Quoted 4 lines · Alex Deucher
something. In this particular case, most of the common infrastructure that should be utilized for this particular patch set comes from non-traditional x86 platforms so most of us that come from a more traditional x86 background as not as familiar with them. Searching
A lot of this infrastructure (like genirq) comes as much from the x86 side as anywhere else :(
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [alsa-devel] [PATCH 8/8] ASoC: AMD: add AMD ASoC ACP-I2S driver
In reply to Mark BrownQuoted 7 lines · Mark Brown
Quoted 2 lines · maruthi srinivas
Quoted 1 line · Mark Brown
On Thu, Oct 08, 2015 at 12:12:40PM -0400, Alex Deucher wrote:
Please document this clearly - your comment doesn't appear to relate to the case where system resume powers things on at all.
ok.
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines
sound/soc/amd/acp.c line 73
Quoted 7 lines
sound/soc/amd/acp.c new file +7
-0+/* Initialize the dma descriptors location in SRAM and page size */ +static void acp_dma_descr_init (void __iomem *acp_mmio) +{ +u32 sram_pte_offset =0 ; + +/* SRAM starts at 0x04000000. From that offset one page (4KB) left for +* filling DMA descriptors.sram_pte_offset = 0x04001000 , used for This is a device relative address rather than an absolute address? A lot of these numbers seem kind of large...
Quoted 5 lines
Quoted 2 lines
That is SRAM block's offset address. Sorry. I didn't understand the expected change, here.
Offset with regard to what? I'm asking if these addresses are within the IP or global.
mentioned addresses are offsets within the ACP IP.
Quoted 17 lines
Quoted 16 lines
Quoted 16 lines
sound/soc/amd/acp.c line 528
Quoted 13 lines
sound/soc/amd/acp.c new file +11
-0+static void acp_turnoff_sram_banks (void __iomem *acp_mmio) +{ +/* Bank 0 : used for DMA descriptors +* Bank 1 to 4 : used for playback +* Bank 5 to 8 : used for capture +* Each bank is 8kB and max size allocated for playback/ capture is +* 16kB(max period size) * 2(max periods) reserved for playback/capture +* in ALSA driver +* Turn off all SRAM banks except above banks during playback/capture +*/ +u32 val, bank;I didn't see any runtime management of the other SRAM bank power, seems like that'd be a good idea?
Quoted 4 lines
Quoted 2 lines
SRAM banks are part of ACP IP. With ACP's runtime PM handling, all blocks within ACP IP can be powered-off and on.
So why can't that cope with these banks then?
Maybe Iam not clear before. I mean that memory banks which wont be needed at all are turned off forever. Using runtime PM, when complete ACP IP gets powered-off all the banks(including the ones used for play/capture) within IP are turned off. When IP is runtime resumed, though all banks gets turned on, the unused banks are turned off again. With this, Iam trying to achieve runtime management.
Quoted 13 lines
Quoted 12 lines
Quoted 12 lines
sound/soc/amd/acp.c line 670
Quoted 7 lines
sound/soc/amd/acp.c new file +6
-0+/* Update DMA postion in audio ring buffer at period level granularity. +* This will be used by ALSA PCM driver +*/ +u32 acp_update_dma_pointer (void __iomem *acp_mmio,int direction, +u32 period_size) +{Don't limit the accuracy to period level if the harwdare can do better, report the current position as accurately as possible please. This is also feeling like we've got an unneeded abstraction here - why was this not just directly the pointer operation?
Quoted 4 lines
Quoted 1 line
The current version of hardware has the limitation of accuracy reporting.
If the hardware is limited why does the comment suggest that we are limiting based on periods?
I will modify accordingly.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerRe: [alsa-devel] [PATCH 8/8] ASoC: AMD: add AMD ASoC ACP-I2S driver
Quoted 11 lines · maruthi srinivas
Quoted 8 lines · Mark Brown
Quoted 8 lines
Quoted 5 lines
sound/soc/amd/acp.c line 522
Quoted 5 lines
sound/soc/amd/acp.c new file +5
-0+static void acp_turnoff_sram_banks (void __iomem *acp_mmio) +{ +/* Bank 0 : used for DMA descriptors +* Bank 1 to 4 : used for playback +* Bank 5 to 8 : used for capture SRAM banks are part of ACP IP. With ACP's runtime PM handling, all blocks within ACP IP can be powered-off and on.
Quoted 8 lines
Quoted 1 line
So why can't that cope with these banks then?
Maybe Iam not clear before. I mean that memory banks which wont be needed at all are turned off forever. Using runtime PM, when complete ACP IP gets powered-off all the banks(including the ones used for play/capture) within IP are turned off. When IP is runtime resumed, though all banks gets turned on, the unused banks are turned off again. With this, Iam trying to achieve runtime management.
So the initialisation that's done to power off the unused memory banks somehow gets preserved when the block is powered off during runtime power management? It's really not clear, this looks like it's only called once on init.
Obviously it's also less power efficient than it could be too since it's going to (so far as I can tell) keep the playback and capture areas powered up even when only one is in use.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · Alex Deucher
This patch set implements support for i2s audio and new AMD GPUs. The i2s codec is fed by a DMA engine on the GPU. To handle this we create mfd cells which we hang the i2s codec and DMA engine on. Because of this, this patch set covers two subsystems: drm and alsa. The drm patches add support for the ACP hw block which provides the DMA engine for the i2s codec. The alsa patches add the ASoC driver for the i2s codec. Since the alsa changes depend on the drm changes in this patch set as well as some other drm changes queued for 4.3, I'd like to take the alsa patches in via the drm tree.
Ping? Anyone had a chance to look over this latest revision? I think we've addressed all the outstanding comments.
Thanks,
Alex
Quoted 82 lines
V2 changes:
- Use the MFD subsystem rather than adding our own bus
- Squash all sub-feature patches together
- fix comments mentioned in previous reviewV3 changes:
- Update the designware driver to handle slave mode, amd specific features
- Use the designware driver directly for i2s
- Move the DMA handling from the GPU driver into the AMD ASoC driver
- Change the license on the ASoC driver to GPLv4 changes:
- patch "ASoC : dwc : support dw i2s in slave mode" accepted
- Add a_dai_fmt()operation that checks to make sure that the mode we're setting corresponds to what we read back from the hardware.
- Split specific quirks into separate patches
- Set the specific quirks that apply to AMD chips in the acp driverPatch 7 adds the register headers for the ACP block which is a pretty big patch so I've excluded it from email. The entire patch set can be viewed here:
http://cgit.freedesktop.org/~agd5f/linux/log/?h=acp-upstream5Thanks,
Alex
Maruthi Bayyavarapu (1):
drm/amd: add ACP driver supportMaruthi Srinivas Bayyavarapu (7):
ASoC : dwc : add check for master/slave format ASoC : dwc : add different playback/capture base ASoC : dwc : add quirk for dwc controller instances ASoC : dwc : add quirk for different register offset ASoC : dwc : reconfigure dwc in 'resume' from 'suspend' ASoC : AMD : add ACP 2.2 register headers
ASoC: AMD: add AMD ASoC ACP-I2S driverdrivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/amd/acp/Kconfig | 10 + drivers/gpu/drm/amd/acp/Makefile | 9 + drivers/gpu/drm/amd/acp/acp_hw.c | 127 ++ drivers/gpu/drm/amd/acp/include/acp_gfx_if.h | 49 + drivers/gpu/drm/amd/amdgpu/Makefile | 13 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 12 + drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 275 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h | 41 + drivers/gpu/drm/amd/amdgpu/vi.c | 12 + drivers/gpu/drm/amd/include/amd_shared.h | 1 + include/linux/mfd/amd_acp.h | 43 + include/sound/designware_i2s.h | 6 + sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/amd/Kconfig | 4 + sound/soc/amd/Makefile | 3 + sound/soc/amd/acp-pcm-dma.c | 518 ++++++ sound/soc/amd/acp.c | 736 +++++++++ sound/soc/amd/acp.h | 147 ++ sound/soc/amd/include/acp_2_2_d.h | 609 +++++++ sound/soc/amd/include/acp_2_2_enum.h | 1068 ++++++++++++ sound/soc/amd/include/acp_2_2_sh_mask.h | 2292 ++++++++++++++++++++++++++ sound/soc/dwc/designware_i2s.c | 206 ++- 24 files changed, 6121 insertions(+), 64 deletions(-) create mode 100644 drivers/gpu/drm/amd/acp/Kconfig create mode 100644 drivers/gpu/drm/amd/acp/Makefile create mode 100644 drivers/gpu/drm/amd/acp/acp_hw.c create mode 100644 drivers/gpu/drm/amd/acp/include/acp_gfx_if.h create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h create mode 100644 include/linux/mfd/amd_acp.h create mode 100644 sound/soc/amd/Kconfig create mode 100644 sound/soc/amd/Makefile create mode 100644 sound/soc/amd/acp-pcm-dma.c create mode 100644 sound/soc/amd/acp.c create mode 100644 sound/soc/amd/acp.h create mode 100644 sound/soc/amd/include/acp_2_2_d.h create mode 100644 sound/soc/amd/include/acp_2_2_enum.h create mode 100644 sound/soc/amd/include/acp_2_2_sh_mask.h
Quoted 3 lines
--
1.8.3.1
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerQuoted 2 lines · Alex Deucher
Ping? Anyone had a chance to look over this latest revision? I think we've addressed all the outstanding comments.
Please don't send content free pings and please allow a reasonable time for review. People get busy, go on holiday, attend conferences and so on so unless there is some reason for urgency (like critical bug fixes) please allow at least a couple of weeks for review. Sending content free pings just adds to the mail volume (if they are seen at all) and if something has gone wrong you'll have to resend the patches anyway.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerQuoted 11 lines · Mark Brown
Quoted 2 lines · Alex Deucher
Ping? Anyone had a chance to look over this latest revision? I think we've addressed all the outstanding comments.
Please don't send content free pings and please allow a reasonable time for review. People get busy, go on holiday, attend conferences and so on so unless there is some reason for urgency (like critical bug fixes) please allow at least a couple of weeks for review. Sending content free pings just adds to the mail volume (if they are seen at all) and if something has gone wrong you'll have to resend the patches anyway.
Hi Mark,
To be honest, maintainers also forget, get busy doing other things, get diverted down rabbit holes,
get tasked to do something else. We also don't know when maintainers are at conferences,
or on holidays.
I don't think repinging patches after 11 days is that unreasonable if you've gotten replies quicker
than that previously.
I'd prefer a content free ping, rather than another round of the patches with two spelling mistakes
fixed etc.
Dave.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerQuoted 9 lines · Dave Airlie
Quoted 6 lines · Mark Brown
Please don't send content free pings and please allow a reasonable time for review. People get busy, go on holiday, attend conferences and so on so unless there is some reason for urgency (like critical bug fixes) please allow at least a couple of weeks for review. Sending content free pings just adds to the mail volume (if they are seen at all) and if something has gone wrong you'll have to resend the patches anyway.
Quoted 5 lines
To be honest, maintainers also forget, get busy doing other things, get diverted down rabbit holes,
get tasked to do something else. We also don't know when maintainers are at conferences,
or on holidays.
This is why I'm saying leave a reasonable amount of time, for relatively short delays on non-critical stuff the most likely explanation is that something like the above has happened and there is no problem.
Quoted 3 lines
I don't think repinging patches after 11 days is that unreasonable if you've gotten replies quicker
than that previously.
It's a waste of time, if it's just a delay then at best what's going to happen is that the mail is going to get threaded in with the original posting and make handling the series take longer when it does get looked at (something made worse by the tendency for content free pings to do things like not bother trimming context or top post). If things have been dropped then all it does is require that the maintainer ask that the patch be resent again which just makes things take even longer. Either way a content free ping, especially a rapid one, is at best slowing things down.
When people chase me to review their patches ahead of other people's without some reason for it my standard response is to defer reviewing those changes, I don't want to create the impression that this is a good way for people to get their work prioritised.
If people are taking the fact that sometimes responses come faster as a sign that content free pings are a good idea then I begin to see why some maintainers are just generally unresponsive. :(
Quoted 3 lines
I'd prefer a content free ping, rather than another round of the patches with two spelling mistakes
fixed etc.
It's very easy to just discard old serieses and never even look at them, we have to do that all the time anyway when other people help out with review and identify issues.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel