-
Notifications
You must be signed in to change notification settings - Fork 144
ASoC: SOF: Initial support for IPC4 compress offload #5647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: topic/sof-dev
Are you sure you want to change the base?
Changes from all commits
ed05eda
cc11ca2
54afdb9
d53d3e8
90369a3
930dbb5
329ee14
9e5839a
6946767
9895118
42c61e3
2f8be3c
a1a7b17
66c8d8a
1ae0a3c
fe8dcb6
99b7de8
6be8ed0
a7e79c7
4670715
c319fe0
9ae5254
787627d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -207,6 +207,16 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream) | |
| struct snd_soc_dpcm *dpcm; | ||
| int stream = cstream->direction; /* SND_COMPRESS_xxx is same as SNDRV_PCM_STREAM_xxx */ | ||
|
|
||
| /* | ||
| * The core will not send a STOP trigger on free if the device is in | ||
| * DRAIN state, but we need to stop BE and FE before we can proceed to | ||
| * free the stream. | ||
| * Run the a STOP trigger if the DPCM state is START (DRAIN is not | ||
| * changing the DPCM state). | ||
| */ | ||
| if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_START) | ||
| cstream->ops->trigger(cstream, SNDRV_PCM_TRIGGER_STOP); | ||
|
|
||
| snd_soc_card_mutex_lock(fe->card); | ||
|
|
||
| snd_soc_dpcm_mutex_lock(fe); | ||
|
|
@@ -273,31 +283,90 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd) | |
| return ret; | ||
| } | ||
|
|
||
| static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) | ||
| static int soc_compr_trigger_fe_be(struct snd_compr_stream *cstream, int cmd, | ||
| bool fe_first) | ||
| { | ||
| struct snd_soc_pcm_runtime *fe = cstream->private_data; | ||
| struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(fe, 0); | ||
| int ret; | ||
|
|
||
| if (fe_first) { | ||
| dev_dbg(fe->dev, "ASoC: pre trigger FE %s cmd %d\n", | ||
| fe->dai_link->name, cmd); | ||
|
|
||
| ret = snd_soc_dai_compr_trigger(cpu_dai, cstream, cmd); | ||
| if (ret < 0) | ||
| goto out; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could just |
||
|
|
||
| ret = snd_soc_component_compr_trigger(cstream, cmd); | ||
| if (ret < 0) | ||
| goto out; | ||
|
|
||
| ret = dpcm_be_dai_trigger(fe, cstream->direction, cmd); | ||
| } else { | ||
| dev_dbg(fe->dev, "ASoC: post trigger FE %s cmd %d\n", | ||
| fe->dai_link->name, cmd); | ||
|
|
||
| ret = dpcm_be_dai_trigger(fe, cstream->direction, cmd); | ||
| if (ret < 0) | ||
| goto out; | ||
|
|
||
| ret = snd_soc_dai_compr_trigger(cpu_dai, cstream, cmd); | ||
| if (ret < 0) | ||
| goto out; | ||
|
|
||
| ret = snd_soc_component_compr_trigger(cstream, cmd); | ||
| } | ||
|
|
||
| out: | ||
| return ret; | ||
| } | ||
|
|
||
| static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) | ||
| { | ||
| struct snd_soc_pcm_runtime *fe = cstream->private_data; | ||
| int stream = cstream->direction; /* SND_COMPRESS_xxx is same as SNDRV_PCM_STREAM_xxx */ | ||
| bool fe_first = true; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could move the assignment under |
||
| int ret; | ||
|
|
||
| if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN || | ||
| cmd == SND_COMPR_TRIGGER_DRAIN) | ||
| return snd_soc_component_compr_trigger(cstream, cmd); | ||
|
|
||
| switch (fe->dai_link->trigger[stream]) { | ||
| case SND_SOC_DPCM_TRIGGER_PRE: | ||
| fe_first = true; | ||
| break; | ||
| case SND_SOC_DPCM_TRIGGER_POST: | ||
| fe_first = false; | ||
| break; | ||
| default: | ||
| break; | ||
| } | ||
|
|
||
| snd_soc_card_mutex_lock(fe->card); | ||
|
|
||
| ret = snd_soc_dai_compr_trigger(cpu_dai, cstream, cmd); | ||
| if (ret < 0) | ||
| goto out; | ||
| fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | ||
|
|
||
| switch (cmd) { | ||
| case SNDRV_PCM_TRIGGER_START: | ||
| case SNDRV_PCM_TRIGGER_RESUME: | ||
| case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | ||
| ret = soc_compr_trigger_fe_be(cstream, cmd, fe_first); | ||
| break; | ||
| case SNDRV_PCM_TRIGGER_STOP: | ||
| case SNDRV_PCM_TRIGGER_SUSPEND: | ||
| case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | ||
| ret = soc_compr_trigger_fe_be(cstream, cmd, !fe_first); | ||
| break; | ||
| default: | ||
| ret = -EINVAL; | ||
| break; | ||
| } | ||
|
|
||
| ret = snd_soc_component_compr_trigger(cstream, cmd); | ||
| if (ret < 0) | ||
| goto out; | ||
|
|
||
| fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | ||
|
|
||
| ret = dpcm_be_dai_trigger(fe, stream, cmd); | ||
|
|
||
| switch (cmd) { | ||
| case SNDRV_PCM_TRIGGER_START: | ||
| case SNDRV_PCM_TRIGGER_RESUME: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo "the a"