Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=35b26722a1716b45b5b92d5af2f1ea1fdd4d0a25
Commit:     35b26722a1716b45b5b92d5af2f1ea1fdd4d0a25
Parent:     713fb93936bebc158b4bbae6be61a6310923543c
Author:     Takashi Iwai <[EMAIL PROTECTED]>
AuthorDate: Sat May 5 12:17:17 2007 +0200
Committer:  Jaroslav Kysela <[EMAIL PROTECTED]>
CommitDate: Fri May 11 16:56:15 2007 +0200

    [ALSA] hda-codec - Fix AD1988 SPDIF playback route control
    
    Fix AD1988 SPDIF playback route control for selecting ADC1-3.
    
    Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>
    Signed-off-by: Jaroslav Kysela <[EMAIL PROTECTED]>
---
 sound/pci/hda/patch_analog.c |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index f6f3c2c..0e1a879 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -1898,8 +1898,9 @@ static int ad1988_spdif_playback_source_get(struct 
snd_kcontrol *kcontrol,
 
        sel = snd_hda_codec_read(codec, 0x02, 0, AC_VERB_GET_CONNECT_SEL, 0);
        if (sel > 0) {
-               sel = snd_hda_codec_read(codec, 0x0b, 0, 
AC_VERB_GET_CONNECT_SEL, 0);
-               if (sel <= 3)
+               sel = snd_hda_codec_read(codec, 0x0b, 0,
+                                        AC_VERB_GET_CONNECT_SEL, 0);
+               if (sel < 3)
                        sel++;
                else
                        sel = 0;
@@ -1912,23 +1913,27 @@ static int ad1988_spdif_playback_source_put(struct 
snd_kcontrol *kcontrol,
                                            struct snd_ctl_elem_value *ucontrol)
 {
        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
-       unsigned int sel;
+       unsigned int val, sel;
        int change;
 
+       val = ucontrol->value.enumerated.item[0];
        sel = snd_hda_codec_read(codec, 0x02, 0, AC_VERB_GET_CONNECT_SEL, 0);
-       if (! ucontrol->value.enumerated.item[0]) {
+       if (!val) {
                change = sel != 0;
-               if (change)
-                       snd_hda_codec_write(codec, 0x02, 0, 
AC_VERB_SET_CONNECT_SEL, 0);
+               if (change || codec->in_resume)
+                       snd_hda_codec_write(codec, 0x02, 0,
+                                           AC_VERB_SET_CONNECT_SEL, 0);
        } else {
                change = sel == 0;
-               if (change)
-                       snd_hda_codec_write(codec, 0x02, 0, 
AC_VERB_SET_CONNECT_SEL, 1);
-               sel = snd_hda_codec_read(codec, 0x0b, 0, 
AC_VERB_GET_CONNECT_SEL, 0) + 1;
-               change |= sel == ucontrol->value.enumerated.item[0];
-               if (change)
-                       snd_hda_codec_write(codec, 0x02, 0, 
AC_VERB_SET_CONNECT_SEL,
-                                           ucontrol->value.enumerated.item[0] 
- 1);
+               if (change || codec->in_resume)
+                       snd_hda_codec_write(codec, 0x02, 0,
+                                           AC_VERB_SET_CONNECT_SEL, 1);
+               sel = snd_hda_codec_read(codec, 0x0b, 0,
+                                        AC_VERB_GET_CONNECT_SEL, 0) + 1;
+               change |= sel != val;
+               if (change || codec->in_resume)
+                       snd_hda_codec_write(codec, 0x0b, 0,
+                                           AC_VERB_SET_CONNECT_SEL, val - 1);
        }
        return change;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to