Skip to content
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

Introducing virtual FE #8

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
struct snd_soc_dai **codec_dais;
struct snd_soc_platform *platform;
struct device_node *platform_of_node;
struct snd_pcm_runtime *runtime;
const char *platform_name;
int i;

Expand Down Expand Up @@ -1134,6 +1135,31 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
}

soc_add_pcm_runtime(card, rtd);

/* if this is a virtual FE link, create runtime and set it as active */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what 'active' runtime means. I would think it becomes 'active' when the switch is On, but maybe it's a different concept you are referring to.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, what I mean by active here is when the kcontrol is switched on and the dpcm_runtime_update() is called, it checks to see if playback or capture is active on the FE link. So I set the FE playback/capture active status by default.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, but I wonder if this has negative implications related to suspend/resume? If there is nothing going on it's a bit odd to force a runtime to be active.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thats a good point.

The problem is the runtime_update() method is oblivious to where it is being called from. It just looks for an active link to process the update.

Maybe I can avoid this by activating the FE in the kcontrol IO handler just before calling runtime_update.

if (rtd->dai_link->dynamic && rtd->dai_link->no_pcm) {
runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
if (!runtime)
return -ENOMEM;

/* set playback active status */
if (rtd->dai_link->dpcm_playback) {
rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].runtime = runtime;
rtd->cpu_dai->playback_active = 1;
rtd->codec_dai->playback_active = 1;
}

/* set capture active statue */
if (rtd->dai_link->dpcm_capture) {
rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].runtime = runtime;
rtd->cpu_dai->capture_active = 1;
rtd->codec_dai->capture_active = 1;
}

/* increment the active count for cpu dai */
rtd->cpu_dai->active++;
}

return 0;

_err_defer:
Expand Down