sound working on the macbook pro
PATCH 1/1 sound working on the macbook pro
The problem with the pin config of the macbook pro is that it has no line outs. Because of this, snd_hda_parse_pin_def_config tries to hack the speaker into being a line out. This hack makes the subsequent setup fail.
The attached patch does the followig:
1) install the correct pin config (extracted from macos)
2) removes the hack from snd_hda_parse_pin_def_config
3) stac92xx_parse_auto_config no longuer aborts if line_outs == 0
item 2 might cause some problems for parts of the system that expect this hack. IMHO, we should try to fix these problems and remove the hack. It is very confusing to see an Speaker appearing as a line out!
Cheers,
Rafael
pci/hda/hda_codec.c +0 -20
@@ -2179,26 +2179,6 @@ int snd_hda_parse_pin_def_config(struct cfg->input_pins[AUTO_PIN_CD ], cfg->input_pins[AUTO_PIN_AUX]); -/* -* FIX-UP: if no line-outs are detected, try to use speaker or HP pin -* as a primary output -*/ -if (! cfg->line_outs) { -if (cfg->speaker_outs) { - cfg->line_outs = cfg->speaker_outs; -memcpy (cfg->line_out_pins, cfg->speaker_pins, -sizeof (cfg->speaker_pins)); - cfg->speaker_outs =0 ; -memset (cfg->speaker_pins,0 ,sizeof (cfg->speaker_pins)); - }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)); - } - } -return 0 ; }
pci/hda/patch_sigmatel.c +3 -5
@@ -530,9 +530,9 @@ static unsigned int macbook_pin_configs[ };static unsigned int macbook_pro_pin_configs[10 ] = { -0x0221401f ,0x90a70120 ,0x01813024 ,0x01014010 , -0x400000fd ,0x01016011 ,0x1345e240 ,0x13c5e22e , -0x400000fc ,0x400000fb , +0x012b4050 ,0x90a00110 ,0x90100140 ,0x400000f0 , +0x400000f0 ,0x018b3020 ,0x014be060 ,0x01cbe030 , +0x400000f0 ,0x400000f0 , };static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS ] = {
@@ -1401,8 +1401,6 @@ static int stac92xx_parse_auto_config(st &spec->autocfg, spec->dmic_nids)) < 0)return err; -if (! spec->autocfg.line_outs) -return 0 ;/* can't find valid pin config */ if ((err =stac92xx_add_dyn_out_pins (codec, &spec->autocfg)) <0 )return err;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
At Sun, 18 Feb 2007 17:24:37 +0000,
Quoted 8 lines · =?UTF-8?Q?Rafael_Esp=C3=ADndola?= wrote:
---------- Forwarded message ----------
From: Rafael Espíndola <[email protected]>
Date: Feb 18, 2007 5:06 PM
Subject: [PATCH] sound working on the macbook pro
To: [email protected]
Quoted 4 lines
The problem with the pin config of the macbook pro is that it has no line outs. Because of this,
snd_hda_parse_pin_def_configtries to hack the speaker into being a line out. This hack makes the subsequent setup fail.
How (and what) does it fail exactly?
Quoted 8 lines
The attached patch does the followig:
1) install the correct pin config (extracted from macos)
2) removes the hack fromsnd_hda_parse_pin_def_config
3)stac92xx_parse_auto_configno longuer aborts ifline_outs== 0item 2 might cause some problems for parts of the system that expect this hack. IMHO, we should try to fix these problems and remove the hack. It is very confusing to see an Speaker appearing as a line out!
I'm sure that this would break many other devices. So, the patch is unacceptable as it is, unfortunately.
The line_outs are actually primary outputs, not exactly "line-out". You can find pretty many codes that refer to this as the primary output.
Takashi
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Quoted 1 line
How (and what) does it fail exactly?
a "diff" of the trace without and with the fix-up is:
1) snd_hda_parse_pin_def_config moves the speaker to the line_out
2) stac92xx_add_dyn_out_pins adds two line_outs
3) stac92xx_auto_create_multi_out_ctls creates the controls "Front", "Surround", Center, LFE
4) stac92xx_auto_create_hp_ctls doesn't run add_spec_dacs or create_controls for the speaker. It then creates a control name Master instead of Headphone.
Quoted 6 lines
I'm sure that this would break many other devices. So, the patch is unacceptable as it is, unfortunately.
The
line_outsare actually primary outputs, not exactly "line-out". You can find pretty many codes that refer to this as the primary output.
Do you consider changing this a long term goal? I agree that we should first try to get the sound working on the mac book, but the current implementation is strange IMHO.
Quoted 3 lines
Takashi
Thanks,
Rafael
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
At Tue, 20 Feb 2007 09:40:35 +0000,
Quoted 8 lines · =?UTF-8?Q?Rafael_Esp=C3=ADndola?= wrote:
Quoted 2 lines
How (and what) does it fail exactly?
a "diff" of the trace without and with the fix-up is:
1)
snd_hda_parse_pin_def_configmoves the speaker to theline_out
2)stac92xx_add_dyn_out_pinsadds twoline_outs
3)stac92xx_auto_create_multi_out_ctlscreates the controls "Front", "Surround", Center, LFE
OK, this is basically the problem of stac92xx_add_dyn_out_pins() that it adds surrounds unconditionally.
(BTW, just a curisotiy - would these surround and/or CLFE work as
outputs? Or does it have no [mic/line] input jack?)
Quoted 3 lines
4)
stac92xx_auto_create_hp_ctlsdoesn't runadd_spec_dacsorcreate_controlsfor the speaker. It then creates a control name Master instead of Headphone.
Hm, I don't get this yet. The current auto-config code in patch_sigmatel isn't 100% suitable for the laptop-style configurations but rather for the desktop machines. So, we need a slight redesign of the configurator at first. Let's get things straight now.
Please write down the pins you have on your device and what controls should appear. I suppose you have
- a HP pin
- a speaker pin
- a mic-in pin
What else? And, for these controls, we'll have
- Speaker volume/switch
- Headphone volume/switch
- Captuer volume/switch
- Input Mux
but no Master (as STAC codec controls these outputs individually).
Quoted 9 lines
Quoted 6 lines
I'm sure that this would break many other devices. So, the patch is unacceptable as it is, unfortunately.
The
line_outsare actually primary outputs, not exactly "line-out". You can find pretty many codes that refer to this as the primary output.Do you consider changing this a long term goal? I agree that we should first try to get the sound working on the mac book, but the current implementation is strange IMHO.
Yes, there is certainly a room for improvements.
For example, we can add another field to indicate what is the primary output type (line-out, speaker, HP) and stop moving the pin information itself, so that the check of primary output is kept as simple as now, and the original information won't be lost.
Takashi
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Quoted 4 lines
OK, this is basically the problem of
stac92xx_add_dyn_out_pins()that it adds surrounds unconditionally.
(BTW, just a curisotiy - would these surround and/or CLFE work as
outputs? Or does it have no [mic/line] input jack?)
The control status with the FIX-UP (and the new pin config) is:
Master: controls the hp volume
Front: dummy
Surround: dummy
Center: dummy
LFE: dummy
Quoted 5 lines
Quoted 3 lines
4)
stac92xx_auto_create_hp_ctlsdoesn't runadd_spec_dacsorcreate_controlsfor the speaker. It then creates a control name Master instead of Headphone.Hm, I don't get this yet.
The speaker was moved to line_out, so cfg->speaker_outs == 0.
Quoted 13 lines
The current auto-config code in
patch_sigmatelisn't 100% suitable for the laptop-style configurations but rather for the desktop machines. So, we need a slight redesign of the configurator at first. Let's get things straight now.Please write down the pins you have on your device and what controls should appear. I suppose you have
- a HP pin
- a speaker pin
- a mic-in pin
What else? And, for these controls, we'll have
Quoted 5 lines
- Speaker volume/switch
- Headphone volume/switch
- Captuer volume/switch
- Input Mux
the mac book pro has a built in speaker, a built in microphone and two jacks. One is a spdif output and headphone. The other one is a spdif in and a line in.
The controls should be:
Speaker, Microphone, select builtin mic/line-in . I am not sure if there should be two different controls or one control and one select switch for the mic/line-in. Currently I also have IEC958 to turn on the spdif output.
I don't have any spdif equipment. I also don't have an external microphone, but I am sure I can get one for testing.
Quoted 1 line
but no Master (as STAC codec controls these outputs individually).
Right. I love that :-)
Quoted 5 lines
Yes, there is certainly a room for improvements.
For example, we can add another field to indicate what is the primary output type (line-out, speaker, HP) and stop moving the pin information itself, so that the check of primary output is kept as simple as now, and the original information won't be lost.
I will give it a try latter on.
Quoted 2 lines
Takashi
Rafael
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
At Tue, 20 Feb 2007 20:05:49 +0000,
Quoted 6 lines · =?UTF-8?Q?Rafael_Esp=C3=ADndola?= wrote:
Quoted 5 lines
OK, this is basically the problem of
stac92xx_add_dyn_out_pins()that it adds surrounds unconditionally.
(BTW, just a curisotiy - would these surround and/or CLFE work as
outputs? Or does it have no [mic/line] input jack?)
Quoted 6 lines
The control status with the FIX-UP (and the new pin config) is:
Master: controls the hp volume
Front: dummy
Surround: dummy
Center: dummy
LFE: dummy
Interesting. So, the front (that is hooked to speaker-pin) has no influence, too? And did you get speaker working if you avoid moving from speaker_pin to line_outs?
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
4)
stac92xx_auto_create_hp_ctlsdoesn't runadd_spec_dacsorcreate_controlsfor the speaker. It then creates a control name Master instead of Headphone.Hm, I don't get this yet.
The speaker was moved to
line_out, socfg->speaker_outs== 0.
But, its corresponding dac_nid is mapped, so basically 'Front' should control the speaker output as it is now.
Takashi
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Quoted 3 lines
Interesting. So, the front (that is hooked to speaker-pin) has no influence, too? And did you get speaker working if you avoid moving from
speaker_pintoline_outs?
No influence. For some reason the speaker doesn't work. It works when I remove the fix-up.
Quoted 2 lines
But, its corresponding
dac_nidis mapped, so basically 'Front' should control the speaker output as it is now.
I don't know why it doesn't. Do you have any suggestion on how to find why?
Quoted 3 lines
Takashi
Rafael
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
At Thu, 22 Feb 2007 20:01:06 +0000,
Quoted 6 lines · =?UTF-8?Q?Rafael_Esp=C3=ADndola?= wrote:
Quoted 4 lines
Interesting. So, the front (that is hooked to speaker-pin) has no influence, too? And did you get speaker working if you avoid moving from
speaker_pintoline_outs?No influence. For some reason the speaker doesn't work. It works when I remove the fix-up.
Even if you use the new right pin_config?
Quoted 3 lines
Quoted 2 lines
But, its corresponding
dac_nidis mapped, so basically 'Front' should control the speaker output as it is now.I don't know why it doesn't. Do you have any suggestion on how to find why?
Try to compare the codec proc files between with and without speaker->line_out hacks.
Takashi
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
A message that is not in the archive (sent off-list or not yet received): [email protected]
At Mon, 26 Feb 2007 21:34:17 -0800,
Review
Quoted 13 lines · =?UTF-8?Q?Rafael_Esp=C3=ADndola?= wrote:
Quoted 2 lines
Even if you use the new right
pin_config?Yes
Quoted 2 lines
Try to compare the codec proc files between with and without
speaker->line_outhacks.I believe that the problem is this part:
Pin Default
0x90100140: [Fixed] Speaker at Int N/A
Conn = Unknown, Color = Unknown(quoted diff) +1
-1- Pin-ctls: 0x40: OUT + Pin-ctls: 0x20: IN Connection: 1
Then it means that stac92xx_hp_detect() isn't called properly, or the pin-detection doesn't work with your hardware. Otherwise stac92xx_auto_init_multiout() should enable this pin. Could you check whether stac92xx_hp_detect() is called and how is it processed (e.g. by adding printk's)? Also, add a printk in stac92xx_auto_init_multiout() to make sure that this isn't called.
Takashi
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Quoted 6 lines
Then it means that
stac92xx_hp_detect()isn't called properly, or the pin-detection doesn't work with your hardware. Otherwisestac92xx_auto_init_multiout()should enable this pin. Could you check whetherstac92xx_hp_detect()is called and how is it processed (e.g. by adding printk's)? Also, add a printk instac92xx_auto_init_multiout()to make sure that this isn't called.
all tests performed with the new pin config.
with the fix-up enabled:
*) stac92xx_auto_init_multi_out is not called
*) stac92xx_hp_detect is called:
cfg->hp_outs = 1
presence = 0 after the first loop
cfg->line_outs = 3
cfg->speaker_outs = 0
*) speakers don't work
with the fix-up disabled:
*) stac92xx_auto_init_multi_out in not called
*) stac92xx_hp_detect is called:
cfg->hp_outs = 1
presense = 0 after the first loop
cfg->line_outs = 0
cfg->speaker_outs = 1
*) speakers work
Quoted 2 lines
Takashi
Thanks,
Rafael
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
At Fri, 9 Mar 2007 21:57:45 -0800,
Quoted 18 lines · =?UTF-8?Q?Rafael_Esp=C3=ADndola?= wrote:
Quoted 7 lines
Then it means that
stac92xx_hp_detect()isn't called properly, or the pin-detection doesn't work with your hardware. Otherwisestac92xx_auto_init_multiout()should enable this pin. Could you check whetherstac92xx_hp_detect()is called and how is it processed (e.g. by adding printk's)? Also, add a printk instac92xx_auto_init_multiout()to make sure that this isn't called.all tests performed with the new pin config.
with the fix-up enabled:
*)stac92xx_auto_init_multi_outis not called
*)stac92xx_hp_detectis called:
cfg->hp_outs= 1
presence = 0 after the first loop
cfg->line_outs= 3
cfg->speaker_outs= 0
*) speakers don't work
Quoted 8 lines
with the fix-up disabled:
*)stac92xx_auto_init_multi_outin not called
*)stac92xx_hp_detectis called:
cfg->hp_outs= 1
presense = 0 after the first loop
cfg->line_outs= 0
cfg->speaker_outs= 1
*) speakers work
I guess it's a missing initialization for the first line-out jack. It works on ohter devices because the default PIN setup has AC_PIN_OUT_EN. But, on Mac, it has AC_PIN_IN_EN by some reason.
The patch below should fix the problm. Give it a try.
Takashi
pci/hda/patch_sigmatel.c +5 -0
@@ -1600,6 +1600,11 @@ static int stac92xx_init(struct hda_codefor (i =0 ; i < cfg->hp_outs; i++)enable_pin_detect (codec, cfg->hp_pins[i],STAC_HP_EVENT ); +/* force to enable the first line-out; the others are set up +* in unsol_event +*/ +stac92xx_auto_set_pinctl (codec, spec->autocfg.line_out_pins[0 ], +AC_PINCTL_OUT_EN );stac92xx_auto_init_hp_out (codec);/* fake event to set up pins */ codec->patch_ops.unsol_event (codec,STAC_HP_EVENT <<26 );
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Quoted 5 lines
I guess it's a missing initialization for the first line-out jack. It works on ohter devices because the default PIN setup has
AC_PIN_OUT_EN. But, on Mac, it hasAC_PIN_IN_ENby some reason.The patch below should fix the problm. Give it a try.
It does :-)
The "Front" control now sets the speaker volume.
Quoted 1 line
Takashi
Rafael
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
At Tue, 13 Mar 2007 07:14:19 +0000,
Quoted 9 lines · =?UTF-8?Q?Rafael_Esp=C3=ADndola?= wrote:
Quoted 6 lines
I guess it's a missing initialization for the first line-out jack. It works on ohter devices because the default PIN setup has
AC_PIN_OUT_EN. But, on Mac, it hasAC_PIN_IN_ENby some reason.The patch below should fix the problm. Give it a try.
It does :-)
The "Front" control now sets the speaker volume.
OK, the patch is not on HG tree.
thanks,
Takashi
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV