Skip to contentSkip to conversation

pm, hello ??

DISCUSSION Giuliano Pochini 3 participants 4 messages Jan 30, 2006 – Feb 9, 2006

lore
Share & tools
lore
#0 lore raw

I'm trying to add suspend/resume capability to the echoaudio driver. I wrote susp/res functions, I attached them to struct pci_driver, I added SNDRV_PCM_INFO_RESUME in struct snd_pcm_hardware.info, I added the two cases in the trigger callback and the kernel has CONFIG_PM enabled. None of the new code is called when I write in /sys/devices/pci0001:10/0001:10:15.0/power/state . What am I missing ?

--
Giuliano.

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#1 lore raw

At Mon, 30 Jan 2006 22:55:11 +0100,

Quoted 8 lines · Giuliano Pochini

I'm trying to add suspend/resume capability to the echoaudio driver. I wrote susp/res functions, I attached them to struct pci_driver, I added SNDRV_PCM_INFO_RESUME in struct snd_pcm_hardware.info, I added the two cases in the trigger callback and the kernel has CONFIG_PM enabled. None of the new code is called when I write in /sys/devices/pci0001:10/0001:10:15.0/power/state . What am I missing ?

No idea. I bet something wrong in your kernel configuration or a simple mistake like wrongly installed kernel image, etc.

BTW, SNDRV_PCM_INFO_RESUME should be added only if your driver really supports the "full resume" mode. i.e. the stream restarts at the very same position where suspended. Otherwise, dont' set that flag. Still the driver works as "partial resume". Then the prepare is called after resume to reset to a sane state.

Takashi

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#2 lore raw
Quoted 10 lines · On Tue, 31 Jan 2006 15:06:35 +0100 Takashi Iwai <[email protected]> wrote:

At Mon, 30 Jan 2006 22:55:11 +0100,

Quoted 7 lines · Giuliano Pochini

I'm trying to add suspend/resume capability to the echoaudio driver. I wrote susp/res functions, I attached them to struct pci_driver, I added SNDRV_PCM_INFO_RESUME in struct snd_pcm_hardware.info, I added the two cases in the trigger callback and the kernel has CONFIG_PM enabled. None of the new code is called when I write in /sys/devices/pci0001:10/0001:10:15.0/power/state . What am I missing ?

Quoted 2 lines

No idea. I bet something wrong in your kernel configuration or a simple mistake like wrongly installed kernel image, etc.

Finally I found some time to debug it.

It happens that "echo 3 > file" actually writes "3\n" into the file. lib/vsprintf.c:simple_strtoul() returns the first non-digit character in the second argument. Then driver/base/power/sysfs.c:state_store() does:

	if (*rest)
		return -EINVAL;

*rest is always '\n', so it exits here.

Quoted 5 lines

BTW, SNDRV_PCM_INFO_RESUME should be added only if your driver really supports the "full resume" mode. i.e. the stream restarts at the very same position where suspended. Otherwise, dont' set that flag. Still the driver works as "partial resume". Then the prepare is called after resume to reset to a sane state.

Nice to know. I can't resume the card exactly as it was before, indeed, because the internal state of the DSP is unknown to the driver. I can only restore all gains, monitors, etc., and restart transport from the last period(s).

--
Giuliano.

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#3 lore raw
Quoted 9 lines · Giuliano Pochini

Finally I found some time to debug it.

It happens that "echo 3 > file" actually writes "3\n" into the file. lib/vsprintf.c:simple_strtoul() returns the first non-digit character in the
second argument. Then driver/base/power/sysfs.c:state_store() does:

        if (*rest)
                return -EINVAL;

*rest is always '\n', so it exits here.

There was a discussion not long ago on LKML about whether sysfs should strip the trailing newline. The consensus was that this is bloat, and echo -n should be used. I'm not sure I agree...

Lee

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642