All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Zhu <jason.zhu@rock-chips.com>
To: Mark Brown <broonie@kernel.org>
Cc: jason.zhu@rock-chips.com, alsa-devel@alsa-project.org,
	tiwai@suse.com, lgirdwood@gmail.com, sugar.zhang@rock-chips.com
Subject: Re: [PATCH 1/1] ASoC: soc-dai: export some symbols
Date: Wed, 21 Sep 2022 10:37:06 +0800	[thread overview]
Message-ID: <dfeac54a-a264-835a-f155-90eb8f093314@rock-chips.com> (raw)
In-Reply-To: <Yym2aURe2+pA3ocn@sirena.org.uk>


在 2022/9/20 20:47, Mark Brown 写道:
> On Tue, Sep 20, 2022 at 11:45:45AM +0800, Jason Zhu wrote:
>
>> Sometimes we need to make some dais alive when close the card, like
>> VAD, so these functions must be exported so that they can be called.
> I'm not sure I fully understand the use case here - why wouldn't
> the core know about the audio stream being kept active?  For
> something like VAD I'd expect this to be just working like a
> normal audio path, if there's a DSP consuming the audio stream
> then it'll keep everything open.  If there is a good use case I
> suspect it'll be clearer if you send the users along with this
> patch.

Thanks. For example, we use the VAD(Voice Activity Detect) & PDM(
Pulse Density Modulation) to record sound>. The PDM is used to
record and copy data to DDR memory by DMA when the system is alive.
The VAD is used to detect voice from PDM and copy data to sram
(The sram is small) when the system is sleep. If the VAD detect
specific sound, wake up the system and continue to record sound.
The data can not be lost in this process. So we attach VAD & PDM
in the same card, then close the card and wake up VAD & PDM again
when the system is goto sleep. Like these code:
vad-sound {
	...
	rockchip,cpu = <&pdm0>;
	rockchip,codec = <&es7202>, <&vad>;
	...
};

static int rockchip_vad_enable_cpudai(struct rockchip_vad *vad)
{
	struct snd_soc_dai *cpu_dai;
	struct snd_pcm_substream *substream;
	int ret = 0;

	cpu_dai = vad->cpu_dai;
	substream = vad->substream;

	if (!cpu_dai || !substream)
		return 0;

	pm_runtime_get_sync(cpu_dai->dev);

	if (cpu_dai->driver->ops && cpu_dai->driver->ops->trigger) {
		ret = cpu_dai->driver->ops->startup(substream,
					    cpu_dai);

		ret = cpu_dai->driver->ops->trigger(substream,
						    SNDRV_PCM_TRIGGER_START,
						    cpu_dai);
	}

	return ret;
}
When the system is waked up, open the sound card. The data in sram
is copied firstly and close the vad. Then use the DMA to move data
to DDR memory from PDM.

Now we prefer to use framework code, like:
static int rockchip_vad_enable_cpudai(struct rockchip_vad *vad)
{
	struct snd_soc_dai *cpu_dai;
	struct snd_pcm_substream *substream;
	int ret = 0;

	cpu_dai = vad->cpu_dai;
	substream = vad->substream;

	if (!cpu_dai || !substream)
		return 0;

	pm_runtime_get_sync(cpu_dai->dev);

	ret = snd_soc_dai_startup(cpu_dai, substream);
	ret |= snd_soc_pcm_dai_prepare(substream);
	ret |= snd_soc_pcm_dai_trigger(substream, SNDRV_PCM_TRIGGER_START);

	return ret;
}
In this situation, those symbols must be exported.
Look forward to your reply and suggestions.


  reply	other threads:[~2022-09-23  8:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20  3:45 [PATCH 0/1] Jason Zhu
2022-09-20  3:45 ` [PATCH 1/1] ASoC: soc-dai: export some symbols Jason Zhu
2022-09-20 12:47   ` Mark Brown
2022-09-21  2:37     ` Jason Zhu [this message]
2022-09-23 12:55       ` Mark Brown
2022-09-26  1:34         ` Jason Zhu
2022-09-26  7:52           ` Pierre-Louis Bossart
2022-09-26 15:33             ` Mark Brown
2022-09-26 16:07               ` Pierre-Louis Bossart
2022-09-27  3:57               ` Jason Zhu
2022-09-28 11:52                 ` Mark Brown
2022-09-29  0:52                   ` Jason Zhu
2022-09-24  4:21   ` kernel test robot
2022-09-24  4:21     ` kernel test robot

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=dfeac54a-a264-835a-f155-90eb8f093314@rock-chips.com \
    --to=jason.zhu@rock-chips.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=sugar.zhang@rock-chips.com \
    --cc=tiwai@suse.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.