Message ID | 20230625065412.651870-1-chancel.liu@nxp.com |
---|---|
State | Accepted |
Commit | 82770b76abae2ff9d70f354a61983b921e63bae1 |
Headers | show |
Series | ASoC: imx-pcm-rpmsg: Set PCM hardware parameters separately | expand |
On Sun, Jun 25, 2023 at 2:54 PM Chancel Liu <chancel.liu@nxp.com> wrote: > Different PCM devices may have different PCM hardware parameters. It > requires PCM hardware parameters set separately if there is more than > one rpmsg sound card. > > Signed-off-by: Chancel Liu <chancel.liu@nxp.com> > Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com> Best regards Wang Shengjiu > --- > sound/soc/fsl/imx-pcm-rpmsg.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c > index 765dad607bf6..d63782b8bdef 100644 > --- a/sound/soc/fsl/imx-pcm-rpmsg.c > +++ b/sound/soc/fsl/imx-pcm-rpmsg.c > @@ -228,6 +228,10 @@ static int imx_rpmsg_pcm_open(struct > snd_soc_component *component, > struct snd_pcm_substream *substream) > { > struct rpmsg_info *info = dev_get_drvdata(component->dev); > + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); > + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); > + struct fsl_rpmsg *rpmsg = dev_get_drvdata(cpu_dai->dev); > + struct snd_pcm_hardware pcm_hardware; > struct rpmsg_msg *msg; > int ret = 0; > int cmd; > @@ -255,10 +259,11 @@ static int imx_rpmsg_pcm_open(struct > snd_soc_component *component, > > info->send_message(msg, info); > > - imx_rpmsg_pcm_hardware.period_bytes_max = > - imx_rpmsg_pcm_hardware.buffer_bytes_max / 2; > + pcm_hardware = imx_rpmsg_pcm_hardware; > + pcm_hardware.buffer_bytes_max = rpmsg->buffer_size; > + pcm_hardware.period_bytes_max = pcm_hardware.buffer_bytes_max / 2; > > - snd_soc_set_runtime_hwparams(substream, &imx_rpmsg_pcm_hardware); > + snd_soc_set_runtime_hwparams(substream, &pcm_hardware); > > ret = snd_pcm_hw_constraint_integer(substream->runtime, > SNDRV_PCM_HW_PARAM_PERIODS); > @@ -597,7 +602,6 @@ static int imx_rpmsg_pcm_new(struct snd_soc_component > *component, > if (ret) > return ret; > > - imx_rpmsg_pcm_hardware.buffer_bytes_max = rpmsg->buffer_size; > return snd_pcm_set_fixed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV_WC, > pcm->card->dev, > rpmsg->buffer_size); > } > -- > 2.25.1 > >
On Sun, 25 Jun 2023 14:54:12 +0800, Chancel Liu wrote: > Different PCM devices may have different PCM hardware parameters. It > requires PCM hardware parameters set separately if there is more than > one rpmsg sound card. > > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [1/1] ASoC: imx-pcm-rpmsg: Set PCM hardware parameters separately commit: 82770b76abae2ff9d70f354a61983b921e63bae1 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
diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c index 765dad607bf6..d63782b8bdef 100644 --- a/sound/soc/fsl/imx-pcm-rpmsg.c +++ b/sound/soc/fsl/imx-pcm-rpmsg.c @@ -228,6 +228,10 @@ static int imx_rpmsg_pcm_open(struct snd_soc_component *component, struct snd_pcm_substream *substream) { struct rpmsg_info *info = dev_get_drvdata(component->dev); + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); + struct fsl_rpmsg *rpmsg = dev_get_drvdata(cpu_dai->dev); + struct snd_pcm_hardware pcm_hardware; struct rpmsg_msg *msg; int ret = 0; int cmd; @@ -255,10 +259,11 @@ static int imx_rpmsg_pcm_open(struct snd_soc_component *component, info->send_message(msg, info); - imx_rpmsg_pcm_hardware.period_bytes_max = - imx_rpmsg_pcm_hardware.buffer_bytes_max / 2; + pcm_hardware = imx_rpmsg_pcm_hardware; + pcm_hardware.buffer_bytes_max = rpmsg->buffer_size; + pcm_hardware.period_bytes_max = pcm_hardware.buffer_bytes_max / 2; - snd_soc_set_runtime_hwparams(substream, &imx_rpmsg_pcm_hardware); + snd_soc_set_runtime_hwparams(substream, &pcm_hardware); ret = snd_pcm_hw_constraint_integer(substream->runtime, SNDRV_PCM_HW_PARAM_PERIODS); @@ -597,7 +602,6 @@ static int imx_rpmsg_pcm_new(struct snd_soc_component *component, if (ret) return ret; - imx_rpmsg_pcm_hardware.buffer_bytes_max = rpmsg->buffer_size; return snd_pcm_set_fixed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV_WC, pcm->card->dev, rpmsg->buffer_size); }
Different PCM devices may have different PCM hardware parameters. It requires PCM hardware parameters set separately if there is more than one rpmsg sound card. Signed-off-by: Chancel Liu <chancel.liu@nxp.com> --- sound/soc/fsl/imx-pcm-rpmsg.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)