Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 210241 Details for
Bug 293181
gentoo-sources-2.6.31-r6 and ice1724 based cards suspend/resume
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
ice1724 prodigy hd2 and juli@ suspend/resume patch
alsa-ice1724-suspend-resume.patch (text/plain), 7.99 KB, created by
Aleksey Kunitskiy
on 2009-11-14 15:28:11 UTC
(
hide
)
Description:
ice1724 prodigy hd2 and juli@ suspend/resume patch
Filename:
MIME Type:
Creator:
Aleksey Kunitskiy
Created:
2009-11-14 15:28:11 UTC
Size:
7.99 KB
patch
obsolete
># HG changeset patch ># User Aleksey Kunitskiy <alexey.kv@gmail.com> ># Date 1258211756 -7200 ># Node ID 9288b53f25e27a2585bc31d6caf91f4278bf1351 ># Parent f1441f908a150bb245f2a392605e888cb3790b1b >ALSA: ice1724 - Patch for suspend/resume for Audiotrak Prodigy HD2 and ESI Juli@ > >Original patch by Igor Chernyshev <igor.ch75+alsa at gmail.com> >ESI Juli@ support by Aleksey Kunitskiy <alexey.kv@gmail.com> > >diff -r f1441f908a15 -r 9288b53f25e2 sound/pci/ice1712/ice1712.h >--- a/sound/pci/ice1712/ice1712.h Sat Nov 14 17:08:46 2009 +0200 >+++ b/sound/pci/ice1712/ice1712.h Sat Nov 14 17:15:56 2009 +0200 >@@ -379,6 +379,15 @@ > unsigned char (*set_mclk)(struct snd_ice1712 *ice, unsigned int rate); > void (*set_spdif_clock)(struct snd_ice1712 *ice); > >+#ifdef CONFIG_PM >+ int (*pm_suspend)(struct snd_ice1712 *); >+ int (*pm_resume)(struct snd_ice1712 *); >+ int pm_suspend_enabled:1; >+ int pm_saved_is_spdif_master:1; >+ unsigned int pm_saved_spdif_ctrl; >+ unsigned char pm_saved_spdif_cfg; >+ unsigned int pm_saved_route; >+#endif > }; > > >diff -r f1441f908a15 -r 9288b53f25e2 sound/pci/ice1712/ice1724.c >--- a/sound/pci/ice1712/ice1724.c Sat Nov 14 17:08:46 2009 +0200 >+++ b/sound/pci/ice1712/ice1724.c Sat Nov 14 17:15:56 2009 +0200 >@@ -560,6 +560,7 @@ > > case SNDRV_PCM_TRIGGER_START: > case SNDRV_PCM_TRIGGER_STOP: >+ case SNDRV_PCM_TRIGGER_SUSPEND: > spin_lock(&ice->reg_lock); > old = inb(ICEMT1724(ice, DMA_CONTROL)); > if (cmd == SNDRV_PCM_TRIGGER_START) >@@ -570,6 +571,10 @@ > spin_unlock(&ice->reg_lock); > break; > >+ case SNDRV_PCM_TRIGGER_RESUME: >+ /* apps will have to restart stream */ >+ break; >+ > default: > return -EINVAL; > } >@@ -2272,7 +2277,7 @@ > msleep(10); > } > >-static int __devinit snd_vt1724_chip_init(struct snd_ice1712 *ice) >+static int snd_vt1724_chip_init(struct snd_ice1712 *ice) > { > outb(ice->eeprom.data[ICE_EEP2_SYSCONF], ICEREG1724(ice, SYS_CFG)); > outb(ice->eeprom.data[ICE_EEP2_ACLINK], ICEREG1724(ice, AC97_CFG)); >@@ -2287,6 +2292,14 @@ > > outb(0, ICEREG1724(ice, POWERDOWN)); > >+ /* MPU_RX and TX irq masks are cleared later dynamically */ >+ outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK)); >+ >+ /* don't handle FIFO overrun/underruns (just yet), >+ * since they cause machine lockups >+ */ >+ outb(VT1724_MULTI_FIFO_ERR, ICEMT1724(ice, DMA_INT_MASK)); >+ > return 0; > } > >@@ -2431,6 +2444,8 @@ > snd_vt1724_proc_init(ice); > synchronize_irq(pci->irq); > >+ card->private_data = ice; >+ > err = pci_request_regions(pci, "ICE1724"); > if (err < 0) { > kfree(ice); >@@ -2459,14 +2474,6 @@ > return -EIO; > } > >- /* MPU_RX and TX irq masks are cleared later dynamically */ >- outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK)); >- >- /* don't handle FIFO overrun/underruns (just yet), >- * since they cause machine lockups >- */ >- outb(VT1724_MULTI_FIFO_ERR, ICEMT1724(ice, DMA_INT_MASK)); >- > err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops); > if (err < 0) { > snd_vt1724_free(ice); >@@ -2650,11 +2657,96 @@ > pci_set_drvdata(pci, NULL); > } > >+#ifdef CONFIG_PM >+static int snd_vt1724_suspend(struct pci_dev *pci, pm_message_t state) >+{ >+ struct snd_card *card = pci_get_drvdata(pci); >+ struct snd_ice1712 *ice = card->private_data; >+ >+ if (!ice->pm_suspend_enabled) >+ return 0; >+ >+ snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); >+ >+ snd_pcm_suspend_all(ice->pcm); >+ snd_pcm_suspend_all(ice->pcm_pro); >+ snd_pcm_suspend_all(ice->pcm_ds); >+ snd_ac97_suspend(ice->ac97); >+ >+ spin_lock_irq(&ice->reg_lock); >+ ice->pm_saved_is_spdif_master = ice->is_spdif_master(ice); >+ ice->pm_saved_spdif_ctrl = inw(ICEMT1724(ice, SPDIF_CTRL)); >+ ice->pm_saved_spdif_cfg = inb(ICEREG1724(ice, SPDIF_CFG)); >+ ice->pm_saved_route = inl(ICEMT1724(ice, ROUTE_PLAYBACK)); >+ spin_unlock_irq(&ice->reg_lock); >+ >+ if (ice->pm_suspend) >+ ice->pm_suspend(ice); >+ >+ pci_disable_device(pci); >+ pci_save_state(pci); >+ pci_set_power_state(pci, pci_choose_state(pci, state)); >+ return 0; >+} >+ >+static int snd_vt1724_resume(struct pci_dev *pci) >+{ >+ struct snd_card *card = pci_get_drvdata(pci); >+ struct snd_ice1712 *ice = card->private_data; >+ >+ if (!ice->pm_suspend_enabled) >+ return 0; >+ >+ pci_set_power_state(pci, PCI_D0); >+ pci_restore_state(pci); >+ >+ if (pci_enable_device(pci) < 0) { >+ snd_card_disconnect(card); >+ return -EIO; >+ } >+ >+ pci_set_master(pci); >+ >+ snd_vt1724_chip_reset(ice); >+ >+ if (snd_vt1724_chip_init(ice) < 0) { >+ snd_card_disconnect(card); >+ return -EIO; >+ } >+ >+ if (ice->pm_resume) >+ ice->pm_resume(ice); >+ >+ if (ice->pm_saved_is_spdif_master) { >+ /* switching to external clock via SPDIF */ >+ ice->set_spdif_clock(ice); >+ } else { >+ /* internal on-card clock */ >+ snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 1); >+ } >+ >+ update_spdif_bits(ice, ice->pm_saved_spdif_ctrl); >+ >+ outb(ice->pm_saved_spdif_cfg, ICEREG1724(ice, SPDIF_CFG)); >+ outl(ice->pm_saved_route, ICEMT1724(ice, ROUTE_PLAYBACK)); >+ >+ if (ice->ac97) >+ snd_ac97_resume(ice->ac97); >+ >+ snd_power_change_state(card, SNDRV_CTL_POWER_D0); >+ return 0; >+} >+#endif >+ > static struct pci_driver driver = { > .name = "ICE1724", > .id_table = snd_vt1724_ids, > .probe = snd_vt1724_probe, > .remove = __devexit_p(snd_vt1724_remove), >+#ifdef CONFIG_PM >+ .suspend = snd_vt1724_suspend, >+ .resume = snd_vt1724_resume, >+#endif > }; > > static int __init alsa_card_ice1724_init(void) >diff -r f1441f908a15 -r 9288b53f25e2 sound/pci/ice1712/juli.c >--- a/sound/pci/ice1712/juli.c Sat Nov 14 17:08:46 2009 +0200 >+++ b/sound/pci/ice1712/juli.c Sat Nov 14 17:15:56 2009 +0200 >@@ -504,6 +504,31 @@ > } > > /* >+ * suspend/resume >+ * */ >+ >+#ifdef CONFIG_PM >+static int juli_resume(struct snd_ice1712 *ice) >+{ >+ struct snd_akm4xxx *ak = ice->akm; >+ struct juli_spec *spec = ice->spec; >+ /* akm4358 un-reset, un-mute */ >+ snd_akm4xxx_reset(ak, 0); >+ /* reinit ak4114 */ >+ snd_ak4114_reinit(spec->ak4114); >+ return 0; >+} >+ >+static int juli_suspend(struct snd_ice1712 *ice) >+{ >+ struct snd_akm4xxx *ak = ice->akm; >+ /* akm4358 reset and soft-mute */ >+ snd_akm4xxx_reset(ak, 1); >+ return 0; >+} >+#endif >+ >+/* > * initialize the chip > */ > >@@ -646,6 +671,13 @@ > ice->set_spdif_clock = juli_set_spdif_clock; > > ice->spdif.ops.open = juli_spdif_in_open; >+ >+#ifdef CONFIG_PM >+ ice->pm_resume = juli_resume; >+ ice->pm_suspend = juli_suspend; >+ ice->pm_suspend_enabled = 1; >+#endif >+ > return 0; > } > >diff -r f1441f908a15 -r 9288b53f25e2 sound/pci/ice1712/prodigy_hifi.c >--- a/sound/pci/ice1712/prodigy_hifi.c Sat Nov 14 17:08:46 2009 +0200 >+++ b/sound/pci/ice1712/prodigy_hifi.c Sat Nov 14 17:15:56 2009 +0200 >@@ -1077,7 +1077,7 @@ > /* > * initialize the chip > */ >-static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) >+static void ak4396_init(struct snd_ice1712 *ice) > { > static unsigned short ak4396_inits[] = { > AK4396_CTRL1, 0x87, /* I2S Normal Mode, 24 bit */ >@@ -1087,8 +1087,36 @@ > AK4396_RCH_ATT, 0x00, > }; > >+ unsigned int i; >+ >+ /* initialize ak4396 codec */ >+ /* reset codec */ >+ ak4396_write(ice, AK4396_CTRL1, 0x86); >+ msleep(100); >+ ak4396_write(ice, AK4396_CTRL1, 0x87); >+ >+ for (i = 0; i < ARRAY_SIZE(ak4396_inits); i += 2) >+ ak4396_write(ice, ak4396_inits[i], ak4396_inits[i+1]); >+} >+ >+#ifdef CONFIG_PM >+static int __devinit prodigy_hd2_resume(struct snd_ice1712 *ice) >+{ >+ /* initialize ak4396 codec and restore previous mixer volumes */ >+ struct prodigy_hifi_spec *spec = ice->spec; >+ int i; >+ mutex_lock(&ice->gpio_mutex); >+ ak4396_init(ice); >+ for (i = 0; i < 2; i++) >+ ak4396_write(ice, AK4396_LCH_ATT + i, spec->vol[i] & 0xff); >+ mutex_unlock(&ice->gpio_mutex); >+ return 0; >+} >+#endif >+ >+static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) >+{ > struct prodigy_hifi_spec *spec; >- unsigned int i; > > ice->vt1720 = 0; > ice->vt1724 = 1; >@@ -1112,14 +1140,12 @@ > return -ENOMEM; > ice->spec = spec; > >- /* initialize ak4396 codec */ >- /* reset codec */ >- ak4396_write(ice, AK4396_CTRL1, 0x86); >- msleep(100); >- ak4396_write(ice, AK4396_CTRL1, 0x87); >- >- for (i = 0; i < ARRAY_SIZE(ak4396_inits); i += 2) >- ak4396_write(ice, ak4396_inits[i], ak4396_inits[i+1]); >+#ifdef CONFIG_PM >+ ice->pm_resume = &prodigy_hd2_resume; >+ ice->pm_suspend_enabled = 1; >+#endif >+ >+ ak4396_init(ice); > > return 0; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 293181
: 210241