Skip to contentSkip to conversation

Power management questions...

DISCUSSION Tehn Yit Chin 2 participants 2 messages Mar 8, 2006

lore
Share & tools
lore
#0 lore raw

Hi all,

1) suspending/resuming
I am putting some power managment coding into my alsa driver. When I want to suspend, I inform ALSA via the following two calls.

snd_pcm_suspend_all(card->pcm); snd_power_change_state(card->card, SNDRV_CTL_POWER_D3cold);

When I am doing a resume, I would have assumed that they is an equivalent to snd_pcm_suspend_all(), but all I could find snd_pcmd_resume() which is usually OK, but this is declared as a static as in

static int snd_pcm_resume(snd_pcm_substream_t *substream)

At the moment, all I am doing when I am resuming is to call

snd_power_change_state(card->card, SNDRV_CTL_POWER_D0);

This seems to be working, but I think that I am doing the wrong thing.

2) SND_PCM_TRIGGER_SUSPEND and SND_PCM_TRIGGER_RESUME
If I follow the call tree down for snd_pcm_suspend_call(), it calls a trigger callback with a command of SND_PCM_TRIGGER_SUSPEND. A similiar thing occurs for resume where the trigger callback is called with the command of SND_PCM_TRIGGER_RESUME. Should I handling these two commands in my trigger callback and manage the DMA transfer accordingly?

any pointers is appreciated.

thanks,
Tehn Yit Chin

#1 lore raw

At Wed, 8 Mar 2006 14:55:55 +1100,

Quoted 14 lines · Tehn Yit Chin

Hi all,

1) suspending/resuming
I am putting some power managment coding into my alsa driver. When I want to suspend, I inform ALSA via the following two calls.

snd_pcm_suspend_all(card->pcm); snd_power_change_state(card->card, SNDRV_CTL_POWER_D3cold);

When I am doing a resume, I would have assumed that they is an equivalent to snd_pcm_suspend_all(), but all I could find snd_pcmd_resume() which is usually OK, but this is declared as a static as in

Quoted 7 lines

static int snd_pcm_resume(snd_pcm_substream_t *substream)

At the moment, all I am doing when I am resuming is to call

snd_power_change_state(card->card, SNDRV_CTL_POWER_D0);

This seems to be working, but I think that I am doing the wrong thing.

It's OK as long as you do _not_ set SNDRV_PCM_INFO_RESUME flag in hw.info field. If this bit isn't set, the app usually resets the PCM state and restarts it again by itself.

Quoted 6 lines

2) SND_PCM_TRIGGER_SUSPEND and SND_PCM_TRIGGER_RESUME
If I follow the call tree down for snd_pcm_suspend_call(), it calls a trigger callback with a command of SND_PCM_TRIGGER_SUSPEND. A similiar thing occurs for resume where the trigger callback is called with the command of SND_PCM_TRIGGER_RESUME. Should I handling these two commands in my trigger callback and manage the DMA transfer accordingly?

Yes, these callbacks should be added if PM is supported.

I updated the document a bit, so please refer to the latest version.

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642