* [PATCH 1/2] snd-ice1712: restore AK4xxx volumes on resume
@ 2014-04-03 21:09 Ondrej Zary
2014-04-03 21:09 ` [PATCH 2/2] snd-ice1712: Save/restore routing and rate registers Ondrej Zary
2014-04-04 14:24 ` [PATCH 1/2] snd-ice1712: restore AK4xxx volumes on resume Takashi Iwai
0 siblings, 2 replies; 3+ messages in thread
From: Ondrej Zary @ 2014-04-03 21:09 UTC (permalink / raw)
To: alsa-devel
Also restore AK4xxx mixer volumes on resume for M-Audio ICE1712-based cards.
This fixes incorrect (sound working) zero mixer volumes after resume.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
sound/pci/ice1712/delta.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index 3764a27..bb34608 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -578,7 +578,8 @@ static struct snd_ak4xxx_private akm_vx442_priv = {
#ifdef CONFIG_PM_SLEEP
static int snd_ice1712_delta_resume(struct snd_ice1712 *ice)
{
- unsigned char akm_backup[AK4XXX_IMAGE_SIZE];
+ unsigned char akm_img_bak[AK4XXX_IMAGE_SIZE];
+ unsigned char akm_vol_bak[AK4XXX_IMAGE_SIZE];
/* init spdif */
switch (ice->eeprom.subvendor) {
@@ -603,9 +604,11 @@ static int snd_ice1712_delta_resume(struct snd_ice1712 *ice)
/* init codec and restore registers */
if (ice->akm_codecs) {
- memcpy(akm_backup, ice->akm->images, sizeof(akm_backup));
+ memcpy(akm_img_bak, ice->akm->images, sizeof(akm_img_bak));
+ memcpy(akm_vol_bak, ice->akm->volumes, sizeof(akm_vol_bak));
snd_akm4xxx_init(ice->akm);
- memcpy(ice->akm->images, akm_backup, sizeof(akm_backup));
+ memcpy(ice->akm->images, akm_img_bak, sizeof(akm_img_bak));
+ memcpy(ice->akm->volumes, akm_vol_bak, sizeof(akm_vol_bak));
snd_akm4xxx_reset(ice->akm, 0);
}
--
Ondrej Zary
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] snd-ice1712: Save/restore routing and rate registers
2014-04-03 21:09 [PATCH 1/2] snd-ice1712: restore AK4xxx volumes on resume Ondrej Zary
@ 2014-04-03 21:09 ` Ondrej Zary
2014-04-04 14:24 ` [PATCH 1/2] snd-ice1712: restore AK4xxx volumes on resume Takashi Iwai
1 sibling, 0 replies; 3+ messages in thread
From: Ondrej Zary @ 2014-04-03 21:09 UTC (permalink / raw)
To: alsa-devel
Save/restore routing and rate registers during suspend/resume.
This fixes S/PDIF input being disabled after resume.
Tested with Audiophile 24/96.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
sound/pci/ice1712/ice1712.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index dbb0f96..fcd46d9 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -1047,6 +1047,8 @@ __out:
old = inb(ICEMT(ice, RATE));
if (!force && old == val)
goto __out;
+
+ ice->cur_rate = rate;
outb(val, ICEMT(ice, RATE));
spin_unlock_irqrestore(&ice->reg_lock, flags);
@@ -2826,6 +2828,12 @@ static int snd_ice1712_suspend(struct device *dev)
snd_pcm_suspend_all(ice->pcm_ds);
snd_ac97_suspend(ice->ac97);
+ spin_lock_irq(&ice->reg_lock);
+ ice->pm_saved_is_spdif_master = is_spdif_master(ice);
+ ice->pm_saved_spdif_ctrl = inw(ICEMT(ice, ROUTE_SPDOUT));
+ ice->pm_saved_route = inw(ICEMT(ice, ROUTE_PSDOUT03));
+ spin_unlock_irq(&ice->reg_lock);
+
if (ice->pm_suspend)
ice->pm_suspend(ice);
@@ -2840,6 +2848,7 @@ static int snd_ice1712_resume(struct device *dev)
struct pci_dev *pci = to_pci_dev(dev);
struct snd_card *card = dev_get_drvdata(dev);
struct snd_ice1712 *ice = card->private_data;
+ int rate;
if (!ice->pm_suspend_enabled)
return 0;
@@ -2854,14 +2863,37 @@ static int snd_ice1712_resume(struct device *dev)
pci_set_master(pci);
+ if (ice->cur_rate)
+ rate = ice->cur_rate;
+ else
+ rate = PRO_RATE_DEFAULT;
+
if (snd_ice1712_chip_init(ice) < 0) {
snd_card_disconnect(card);
return -EIO;
}
+ ice->cur_rate = rate;
+
if (ice->pm_resume)
ice->pm_resume(ice);
+ if (ice->pm_saved_is_spdif_master) {
+ /* switching to external clock via SPDIF */
+ spin_lock_irq(&ice->reg_lock);
+ outb(inb(ICEMT(ice, RATE)) | ICE1712_SPDIF_MASTER,
+ ICEMT(ice, RATE));
+ spin_unlock_irq(&ice->reg_lock);
+ snd_ice1712_set_input_clock_source(ice, 1);
+ } else {
+ /* internal on-card clock */
+ snd_ice1712_set_pro_rate(ice, rate, 1);
+ snd_ice1712_set_input_clock_source(ice, 0);
+ }
+
+ outw(ice->pm_saved_spdif_ctrl, ICEMT(ice, ROUTE_SPDOUT));
+ outw(ice->pm_saved_route, ICEMT(ice, ROUTE_PSDOUT03));
+
if (ice->ac97)
snd_ac97_resume(ice->ac97);
--
Ondrej Zary
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] snd-ice1712: restore AK4xxx volumes on resume
2014-04-03 21:09 [PATCH 1/2] snd-ice1712: restore AK4xxx volumes on resume Ondrej Zary
2014-04-03 21:09 ` [PATCH 2/2] snd-ice1712: Save/restore routing and rate registers Ondrej Zary
@ 2014-04-04 14:24 ` Takashi Iwai
1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2014-04-04 14:24 UTC (permalink / raw)
To: Ondrej Zary; +Cc: alsa-devel
At Thu, 3 Apr 2014 23:09:37 +0200,
Ondrej Zary wrote:
>
> Also restore AK4xxx mixer volumes on resume for M-Audio ICE1712-based cards.
> This fixes incorrect (sound working) zero mixer volumes after resume.
>
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Applied, thanks.
But at the next time, put maintainers to Cc.
Takashi
> ---
> sound/pci/ice1712/delta.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
> index 3764a27..bb34608 100644
> --- a/sound/pci/ice1712/delta.c
> +++ b/sound/pci/ice1712/delta.c
> @@ -578,7 +578,8 @@ static struct snd_ak4xxx_private akm_vx442_priv = {
> #ifdef CONFIG_PM_SLEEP
> static int snd_ice1712_delta_resume(struct snd_ice1712 *ice)
> {
> - unsigned char akm_backup[AK4XXX_IMAGE_SIZE];
> + unsigned char akm_img_bak[AK4XXX_IMAGE_SIZE];
> + unsigned char akm_vol_bak[AK4XXX_IMAGE_SIZE];
>
> /* init spdif */
> switch (ice->eeprom.subvendor) {
> @@ -603,9 +604,11 @@ static int snd_ice1712_delta_resume(struct snd_ice1712 *ice)
>
> /* init codec and restore registers */
> if (ice->akm_codecs) {
> - memcpy(akm_backup, ice->akm->images, sizeof(akm_backup));
> + memcpy(akm_img_bak, ice->akm->images, sizeof(akm_img_bak));
> + memcpy(akm_vol_bak, ice->akm->volumes, sizeof(akm_vol_bak));
> snd_akm4xxx_init(ice->akm);
> - memcpy(ice->akm->images, akm_backup, sizeof(akm_backup));
> + memcpy(ice->akm->images, akm_img_bak, sizeof(akm_img_bak));
> + memcpy(ice->akm->volumes, akm_vol_bak, sizeof(akm_vol_bak));
> snd_akm4xxx_reset(ice->akm, 0);
> }
>
> --
> Ondrej Zary
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-04 14:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-03 21:09 [PATCH 1/2] snd-ice1712: restore AK4xxx volumes on resume Ondrej Zary
2014-04-03 21:09 ` [PATCH 2/2] snd-ice1712: Save/restore routing and rate registers Ondrej Zary
2014-04-04 14:24 ` [PATCH 1/2] snd-ice1712: restore AK4xxx volumes on resume Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).