LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Vijendar Mukunda <Vijendar.Mukunda@amd.com>,
	broonie@kernel.org, alsa-devel@alsa-project.org
Cc: Sunil-kumar.Dommati@amd.com,
	open list <linux-kernel@vger.kernel.org>,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Alexander.Deucher@amd.com, krisman@collabora.com
Subject: Re: [PATCH v4 07/12] ASoC: amd: add ACP5x pcm dma driver ops
Date: Tue, 20 Jul 2021 13:27:45 -0500	[thread overview]
Message-ID: <331065bd-32d5-45eb-37fc-d4fc76c23fe8@linux.intel.com> (raw)
In-Reply-To: <20210720163732.23003-8-Vijendar.Mukunda@amd.com>


> +static int acp5x_dma_open(struct snd_soc_component *component,
> +			  struct snd_pcm_substream *substream)
> +{
> +	struct snd_pcm_runtime *runtime;
> +	struct snd_soc_pcm_runtime *prtd;
> +	struct i2s_dev_data *adata;
> +	struct i2s_stream_instance *i2s_data;
> +	int ret;
> +
> +	runtime = substream->runtime;
> +	prtd = asoc_substream_to_rtd(substream);
> +	component = snd_soc_rtdcom_lookup(prtd, DRV_NAME);
> +	adata = dev_get_drvdata(component->dev);
> +
> +	i2s_data = kzalloc(sizeof(*i2s_data), GFP_KERNEL);
> +	if (!i2s_data)
> +		return -EINVAL;

return -ENOMEM?

> +
> +	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> +		runtime->hw = acp5x_pcm_hardware_playback;
> +	else
> +		runtime->hw = acp5x_pcm_hardware_capture;
> +
> +	ret = snd_pcm_hw_constraint_integer(runtime,
> +					    SNDRV_PCM_HW_PARAM_PERIODS);
> +	if (ret < 0) {
> +		dev_err(component->dev, "set integer constraint failed\n");
> +		kfree(i2s_data);
> +		return ret;
> +	}
> +	i2s_data->acp5x_base = adata->acp5x_base;
> +	runtime->private_data = i2s_data;
> +	return ret;
> +}
> +
> +static int acp5x_dma_hw_params(struct snd_soc_component *component,
> +			       struct snd_pcm_substream *substream,
> +			       struct snd_pcm_hw_params *params)
> +{
> +	struct i2s_stream_instance *rtd;
> +	struct snd_soc_pcm_runtime *prtd;
> +	struct snd_soc_card *card;
> +	struct acp5x_platform_info *pinfo;
> +	struct i2s_dev_data *adata;
> +	u64 size;
> +
> +	prtd = asoc_substream_to_rtd(substream);
> +	card = prtd->card;
> +	pinfo = snd_soc_card_get_drvdata(card);
> +	adata = dev_get_drvdata(component->dev);
> +	rtd = substream->runtime->private_data;
> +
> +	if (!rtd)
> +		return -EINVAL;
> +
> +	if (pinfo) {
> +		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> +			rtd->i2s_instance = pinfo->play_i2s_instance;
> +			switch (rtd->i2s_instance) {
> +			case I2S_HS_INSTANCE:
> +				adata->play_stream = substream;
> +				break;
> +			case I2S_SP_INSTANCE:
> +			default:
> +				adata->i2ssp_play_stream = substream;
> +			}
> +		} else {
> +			rtd->i2s_instance = pinfo->cap_i2s_instance;
> +			switch (rtd->i2s_instance) {
> +			case I2S_HS_INSTANCE:
> +				adata->capture_stream = substream;
> +				break;
> +			case I2S_SP_INSTANCE:
> +			default:
> +				adata->i2ssp_capture_stream = substream;
> +			}
> +		}
> +	} else {
> +		dev_err(component->dev, "pinfo failed\n");

should you bail here with e.g. return -EINVAL?

> +	}
> +	size = params_buffer_bytes(params);
> +	rtd->dma_addr = substream->dma_buffer.addr;
> +	rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);
> +	config_acp5x_dma(rtd, substream->stream);
> +	return 0;
> +}


  reply	other threads:[~2021-07-20 18:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210720163732.23003-1-Vijendar.Mukunda@amd.com>
2021-07-20 16:37 ` [PATCH v4 01/12] ASoC: amd: add Vangogh ACP5x IP register header Vijendar Mukunda
2021-07-20 16:37 ` [PATCH v4 02/12] ASoC: amd: add Vangogh ACP PCI driver Vijendar Mukunda
2021-07-20 16:37 ` [PATCH v4 03/12] ASoc: amd: add acp5x init/de-init functions Vijendar Mukunda
2021-07-20 16:37 ` [PATCH v4 04/12] ASoC: amd: create acp5x platform devices Vijendar Mukunda
2021-07-20 16:37 ` [PATCH v4 05/12] ASoC: amd: add ACP5x PCM platform driver Vijendar Mukunda
2021-07-20 18:12   ` Pierre-Louis Bossart
2021-07-20 23:11     ` Mukunda,Vijendar
2021-07-20 16:37 ` [PATCH v4 06/12] ASoC: amd: irq handler changes for ACP5x PCM dma driver Vijendar Mukunda
2021-07-20 16:37 ` [PATCH v4 07/12] ASoC: amd: add ACP5x pcm dma driver ops Vijendar Mukunda
2021-07-20 18:27   ` Pierre-Louis Bossart [this message]
2021-07-20 23:10     ` Mukunda,Vijendar
2021-07-20 16:37 ` [PATCH v4 08/12] ASoC: amd: add vangogh i2s controller driver Vijendar Mukunda
2021-07-20 16:37 ` [PATCH v4 09/12] ASoC: amd: add vangogh i2s dai driver ops Vijendar Mukunda
2021-07-20 18:30   ` Pierre-Louis Bossart
2021-07-20 23:08     ` Mukunda,Vijendar
2021-07-20 16:37 ` [PATCH v4 10/12] ASoC: amd: add vangogh pci driver pm ops Vijendar Mukunda
2021-07-20 16:37 ` [PATCH v4 11/12] ASoC: amd: add vangogh i2s dma " Vijendar Mukunda
2021-07-20 16:37 ` [PATCH v4 12/12] ASoC: amd: enable vangogh acp5x driver build Vijendar Mukunda
2021-07-20 18:31   ` Pierre-Louis Bossart
2021-07-20 23:06     ` Mukunda,Vijendar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=331065bd-32d5-45eb-37fc-d4fc76c23fe8@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Sunil-kumar.Dommati@amd.com \
    --cc=Vijendar.Mukunda@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=krisman@collabora.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tiwai@suse.com \
    --subject='Re: [PATCH v4 07/12] ASoC: amd: add ACP5x pcm dma driver ops' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).