logo       


Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

[PATCH] [UBUNTU:sound/pci/hda/] Add support for multiple headphone pins: msg#00011

Subject: [PATCH] [UBUNTU:sound/pci/hda/] Add support for multiple headphone pins
From 087cba9603a751299d69f09d94ee2e1c6e3c7d94 Mon Sep 17 00:00:00 2001
From: Daniel T. Chen <crimsun@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 7 Oct 2006 21:32:01 -0400
Subject: [PATCH] [UBUNTU:sound/pci/hda/] Add support for multiple headphone pins

UpstreamStatus: Added in upstream alsa-kernel hg changeset:
                b556882ed183 
[http://hg-mirror.alsa-project.org/alsa-kernel?cmd=changeset;node=b556882ed1838ee3e98135257025d4c5f4c38c4f;style=raw]

This commit from Takashi Iwai updates the HDA code to support
multiple HP outputs.

This commit is applicable to both Dapper and Edgy linux-source
(and should be applied alongside the previous two Sigmatel
commits).

Signed-off-by: Daniel T Chen <crimsun@xxxxxxxxxx>
---
 sound/pci/hda/hda_codec.c     |   23 +++++++++++++++--------
 sound/pci/hda/hda_local.h     |    3 ++-
 sound/pci/hda/patch_analog.c  |    4 ++--
 sound/pci/hda/patch_realtek.c |   18 +++++++++---------
 4 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index c5ab756..8f5c8f4 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1967,7 +1967,7 @@ static int is_in_nid_list(hda_nid_t nid,
  * in the order of front, rear, CLFE, side, ...
  *
  * If more extra outputs (speaker and headphone) are found, the pins are
- * assisnged to hp_pin and speaker_pins[], respectively.  If no line-out jack
+ * assigned to hp_pins[] and speaker_pins[], respectively.  If no line-out jack
  * is detected, one of speaker of HP pins is assigned as the primary
  * output, i.e. to line_out_pins[0].  So, line_outs is always positive
  * if any analog output exists.
@@ -2029,7 +2029,10 @@ int snd_hda_parse_pin_def_config(struct 
                        cfg->speaker_outs++;
                        break;
                case AC_JACK_HP_OUT:
-                       cfg->hp_pin = nid;
+                       if (cfg->hp_outs >= ARRAY_SIZE(cfg->hp_pins))
+                               continue;
+                       cfg->hp_pins[cfg->hp_outs] = nid;
+                       cfg->hp_outs++;
                        break;
                case AC_JACK_MIC_IN: {
                        int preferred, alt;
@@ -2111,8 +2114,10 @@ int snd_hda_parse_pin_def_config(struct 
                   cfg->speaker_outs, cfg->speaker_pins[0],
                   cfg->speaker_pins[1], cfg->speaker_pins[2],
                   cfg->speaker_pins[3], cfg->speaker_pins[4]);
-       snd_printd("   hp=0x%x, dig_out=0x%x, din_in=0x%x\n",
-                  cfg->hp_pin, cfg->dig_out_pin, cfg->dig_in_pin);
+       snd_printd("   hp_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
+                       cfg->hp_outs, cfg->hp_pins[0],
+                       cfg->hp_pins[1], cfg->hp_pins[2],
+                       cfg->hp_pins[3], cfg->hp_pins[4]);
        snd_printd("   inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x,"
                   " cd=0x%x, aux=0x%x\n",
                   cfg->input_pins[AUTO_PIN_MIC],
@@ -2133,10 +2138,12 @@ int snd_hda_parse_pin_def_config(struct 
                               sizeof(cfg->speaker_pins));
                        cfg->speaker_outs = 0;
                        memset(cfg->speaker_pins, 0, sizeof(cfg->speaker_pins));
-               } else if (cfg->hp_pin) {
-                       cfg->line_outs = 1;
-                       cfg->line_out_pins[0] = cfg->hp_pin;
-                       cfg->hp_pin = 0;
+               } else if (cfg->hp_outs) {
+                       cfg->line_outs = cfg->hp_outs;
+                       memcpy(cfg->line_out_pins, cfg->hp_pins,
+                               sizeof(cfg->hp_pins));
+                       cfg->hp_outs = 0;
+                       memset(cfg->hp_pins, 0, sizeof(cfg->hp_pins));
                }
        }
 
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index be16d9a..41488cc 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -222,7 +222,8 @@ struct auto_pin_cfg {
        hda_nid_t line_out_pins[5]; /* sorted in the order of 
Front/Surr/CLFE/Side */
        int speaker_outs;
        hda_nid_t speaker_pins[5];
-       hda_nid_t hp_pin;
+       int hp_outs;
+       hda_nid_t hp_pins[5];
        hda_nid_t input_pins[AUTO_PIN_LAST];
        hda_nid_t dig_out_pin;
        hda_nid_t dig_in_pin;
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 3db7c0a..074998e 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -2455,7 +2455,7 @@ static void ad1988_auto_init_extra_out(s
        pin = spec->autocfg.speaker_pins[0];
        if (pin) /* connect to front */
                ad1988_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
-       pin = spec->autocfg.hp_pin;
+       pin = spec->autocfg.hp_pins[0];
        if (pin) /* connect to front */
                ad1988_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
 }
@@ -2507,7 +2507,7 @@ static int ad1988_parse_auto_config(stru
            (err = ad1988_auto_create_extra_out(codec,
                                                spec->autocfg.speaker_pins[0],
                                                "Speaker")) < 0 ||
-           (err = ad1988_auto_create_extra_out(codec, spec->autocfg.hp_pin,
+           (err = ad1988_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
                                                "Headphone")) < 0 ||
            (err = ad1988_auto_create_analog_input_ctls(spec, &spec->autocfg)) 
< 0)
                return err;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index f4310e1..8291e92 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2715,7 +2715,7 @@ static void alc880_auto_init_extra_out(s
        pin = spec->autocfg.speaker_pins[0];
        if (pin) /* connect to front */
                alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
-       pin = spec->autocfg.hp_pin;
+       pin = spec->autocfg.hp_pins[0];
        if (pin) /* connect to front */
                alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
 }
@@ -2756,7 +2756,7 @@ static int alc880_parse_auto_config(stru
            (err = alc880_auto_create_extra_out(spec,
                                                spec->autocfg.speaker_pins[0],
                                                "Speaker")) < 0 ||
-           (err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pin,
+           (err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
                                                "Headphone")) < 0 ||
            (err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg)) 
< 0)
                return err;
@@ -3698,7 +3698,7 @@ static int alc260_auto_create_multi_out_
                        return err;
        }
 
-       nid = cfg->hp_pin;
+       nid = cfg->hp_pins[0];
        if (nid) {
                err = alc260_add_playback_controls(spec, nid, "Headphone");
                if (err < 0)
@@ -3768,7 +3768,7 @@ static void alc260_auto_init_multi_out(s
        if (nid)
                alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
 
-       nid = spec->autocfg.hp_pin;
+       nid = spec->autocfg.hp_pins[0];
        if (nid)
                alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
 }      
@@ -4488,7 +4488,7 @@ static void alc882_auto_init_hp_out(stru
        struct alc_spec *spec = codec->spec;
        hda_nid_t pin;
 
-       pin = spec->autocfg.hp_pin;
+       pin = spec->autocfg.hp_pins[0];
        if (pin) /* connect to front */
                alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); /* 
use dac 0 */
 }
@@ -5173,7 +5173,7 @@ static void alc883_auto_init_hp_out(stru
        struct alc_spec *spec = codec->spec;
        hda_nid_t pin;
 
-       pin = spec->autocfg.hp_pin;
+       pin = spec->autocfg.hp_pins[0];
        if (pin) /* connect to front */
                /* use dac 0 */
                alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
@@ -5595,7 +5595,7 @@ static int alc262_auto_create_multi_out_
                                return err;
                }
        }
-       nid = cfg->hp_pin;
+       nid = cfg->hp_pins[0];
        if (nid) {
                /* spec->multiout.hp_nid = 2; */
                if (nid == 0x16) {
@@ -6595,7 +6595,7 @@ static void alc861_auto_init_hp_out(stru
        struct alc_spec *spec = codec->spec;
        hda_nid_t pin;
 
-       pin = spec->autocfg.hp_pin;
+       pin = spec->autocfg.hp_pins[0];
        if (pin) /* connect to front */
                alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, 
spec->multiout.dac_nids[0]);
 }
@@ -6630,7 +6630,7 @@ static int alc861_parse_auto_config(stru
 
        if ((err = alc861_auto_fill_dac_nids(spec, &spec->autocfg)) < 0 ||
            (err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 
||
-           (err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pin)) < 0 
||
+           (err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0])) 
< 0 ||
            (err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg)) 
< 0)
                return err;
 
-- 
1.4.1


-- 
Daniel T. Chen            crimsun@xxxxxxxxxx
GPG key:  0xC88ABDA3

Attachment: pgpOq0mvyh5v2.pgp
Description: PGP signature


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
db.firebase.por...    text.xml.xalan....    qnx.openqnx.dev...    user-groups.zar...    internationaliz...    kde.devel.konve...    finance.e-gold....    emacs.latex.pre...    gis.therion/200...    web.webmin.gene...    yellowdog.gener...    vserver/2003-08...    redhat.release....    sysutils.tivoli...    xfree86.expert/...    mail.becky.user...    hardware.netapp...    netbsd.ports.xe...    python.distutil...    boot-loaders.gr...    culture.interne...    java.springfram...    activedir/2006-...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe