Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 16076
b: refs/heads/master
c: c66d7f7
h: refs/heads/master
v: v3
  • Loading branch information
Takashi Iwai authored and Jaroslav Kysela committed Jan 3, 2006
1 parent 60c8856 commit 977049f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7a8fef1f95e563a93c7d70048b63c1ca20685a1b
refs/heads/master: c66d7f72569e304acc134b2561b148fe7c23c0f7
5 changes: 5 additions & 0 deletions trunk/include/sound/ad1848.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ struct snd_ad1848 {
int dma_size;
int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */

#ifdef CONFIG_PM
void (*suspend)(struct snd_ad1848 *chip);
void (*resume)(struct snd_ad1848 *chip);
#endif

spinlock_t reg_lock;
struct semaphore open_mutex;
};
Expand Down
28 changes: 15 additions & 13 deletions trunk/sound/isa/ad1848/ad1848_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pm.h>
#include <linux/slab.h>
#include <linux/ioport.h>
#include <sound/core.h>
Expand Down Expand Up @@ -642,29 +641,30 @@ static void snd_ad1848_thinkpad_twiddle(struct snd_ad1848 *chip, int on) {
}

#ifdef CONFIG_PM
static int snd_ad1848_suspend(struct snd_card *card, pm_message_t state)
static void snd_ad1848_suspend(struct snd_ad1848 *chip)
{
struct snd_ad1848 *chip = card->pm_private_data;

snd_pcm_suspend_all(chip->pcm);
/* FIXME: save registers? */

if (chip->thinkpad_flag)
snd_ad1848_thinkpad_twiddle(chip, 0);

return 0;
}

static int snd_ad1848_resume(struct snd_card *card)
static void snd_ad1848_resume(struct snd_ad1848 *chip)
{
struct snd_ad1848 *chip = card->pm_private_data;
int i;

if (chip->thinkpad_flag)
snd_ad1848_thinkpad_twiddle(chip, 1);

/* FIXME: restore registers? */
/* clear any pendings IRQ */
inb(AD1848P(chip, STATUS));
outb(0, AD1848P(chip, STATUS));
mb();

return 0;
snd_ad1848_mce_down(chip);
for (i = 0; i < 16; i++)
snd_ad1848_out(chip, i, chip->image[i]);
snd_ad1848_mce_up(chip);
snd_ad1848_mce_down(chip);
}
#endif /* CONFIG_PM */

Expand Down Expand Up @@ -919,7 +919,6 @@ int snd_ad1848_create(struct snd_card *card,
chip->thinkpad_flag = 1;
chip->hardware = AD1848_HW_DETECT; /* reset */
snd_ad1848_thinkpad_twiddle(chip, 1);
snd_card_set_isa_pm_callback(card, snd_ad1848_suspend, snd_ad1848_resume, chip);
}

if (snd_ad1848_probe(chip) < 0) {
Expand All @@ -933,6 +932,9 @@ int snd_ad1848_create(struct snd_card *card,
return err;
}

chip->suspend = snd_ad1848_suspend;
chip->resume = snd_ad1848_resume;

*rchip = chip;
return 0;
}
Expand Down

0 comments on commit 977049f

Please sign in to comment.