Skip to contentSkip to conversation

AC97 plugin suspend/resume

PATCH Superseded Liam Girdwood 2 participants 4 messages Jan 4, 2005 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 AC97 plugin suspend/resume

This patch adds suspend and resume support to OSS AC97 plugins.

Changes :-

o added suspend/resume callbacks to struct ac97_driver
o added suspend/resume handlers to ac97_codec.c

Liam

sound/oss/ac97_codec.c +27 -0
@@ -1391,6 +1421,33 @@
 
 EXPORT_SYMBOL(ac97_restore_state);
 
+int ac97_suspend(struct ac97_codec *codec, int state)
+{
+	struct ac97_driver *driver;
+	int ret = 0;
+
+	down(&codec_sem);
+	driver = codec->driver;
+	if (driver != NULL && driver->suspend)
+		ret = driver->suspend(codec, state);
+	up(&codec_sem);
+
+	return ret;
+}
+EXPORT_SYMBOL(ac97_suspend);
+
+void ac97_resume(struct ac97_codec *codec)
+{
+	struct ac97_driver *driver;
+
+	down(&codec_sem);
+	driver = codec->driver;
+	if (driver != NULL && driver->resume)
+		driver->resume(codec);
+	up(&codec_sem);
+}
+EXPORT_SYMBOL(ac97_resume);
+
 /**
  *	ac97_register_driver	-	register a codec helper
  *	@driver: Driver handler
include/linux/ac97_codec.h +4 -0
@@ -299,6 +300,8 @@
 extern unsigned int ac97_set_dac_rate(struct ac97_codec *codec, unsigned int rate);
 extern int ac97_save_state(struct ac97_codec *codec);
 extern int ac97_restore_state(struct ac97_codec *codec);
+extern int ac97_suspend(struct ac97_codec *codec, int state);
+extern void ac97_resume(struct ac97_codec *codec);
 
 extern struct ac97_codec *ac97_alloc_codec(void);
 extern void ac97_release_codec(struct ac97_codec *codec);
@@ -310,6 +313,8 @@
 	u32 codec_mask;
 	int (*probe) (struct ac97_codec *codec, struct ac97_driver *driver);
 	void (*remove) (struct ac97_codec *codec, struct ac97_driver *driver);
+	int (*suspend) (struct ac97_codec *codec, int state);
+	void (*resume) (struct ac97_codec *codec);
 };
 
 extern int ac97_register_driver(struct ac97_driver *driver);
#1 lore raw
Quoted 8 lines · Liam Girdwood

This patch adds suspend and resume support to OSS AC97 plugins.

Changes :-

o added suspend/resume callbacks to struct ac97_driver
o added suspend/resume handlers to ac97_codec.c

Liam,

Please consider giving credit where credit is due. Thanks.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#2 lore raw
Quoted 3 lines · Russell King

Liam,

Please consider giving credit where credit is due. Thanks.

Sorry Russell,

I had no idea who in the group had originally made the change since yourself and Vince were accepting the kernel patches. I thought it would be better to submit it signed rather than unsigned.

Please let me know who is responsible and if it's ok, I'll then re-submit.

Best Regards

Liam

#3 lore raw
Quoted 5 lines · Liam Girdwood
Quoted 3 lines · Russell King

Liam,

Please consider giving credit where credit is due. Thanks.

Quoted 8 lines

Sorry Russell,

I had no idea who in the group had originally made the change since yourself and Vince were accepting the kernel patches. I thought it would be better to submit it signed rather than unsigned.

Please let me know who is responsible and if it's ok, I'll then re-submit.

Yours truely is responsible for this code change - it was committed into "that" CVS tree with these comments originally:

Reference: 13-wm97xx/03-ac97-pm

- Add suspend/resume methods to the ac97 codec plugin driver structure.
- Add code to ac97_codec to allow these methods to be safely called for the specified codec.
- Convert ac97_plugin_wm97xx to use these two pointers for its suspend and resume hooks.
- Modify pxa-ac97 to call the new ac97_codec suspend/resume functions.

so what you have there is a cut down version of this patch.

If you want an archive of the cvs commit messages for "that" CVS tree, I can throw you a copy.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core