From: zhejiang <zhe.jiang@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: patch for Dell 1210 which using stac9221 codec
Date: Thu, 25 Oct 2007 15:44:42 +0800 [thread overview]
Message-ID: <1193298282.3459.18.camel@localhost.localdomain> (raw)
In-Reply-To: <s5hr6jmryaf.wl%tiwai@suse.de>
On Tue, 2007-10-23 at 11:11 +0200, Takashi Iwai wrote:
> At Mon, 22 Oct 2007 14:08:19 +0800,
> zhejiang wrote:
> > > Ah, then it's basically similar like 3-stack model but with two
> > > headphones instead of a pair of line-out and line-in.
> > >
> > > Without your modification of pin config, how the driver detects?
> > > Do you have an output of kernel message with debug option about auto
> > > pin configs?
> > >
> > I don't have the hardware.
> > I have asked the bug reporter to do the experiment,
> > I will post it here if i get any response.
>
> Thanks.
>
According to the response from the reporter,here is the pin config of
the original driver.
ALSA /tmp/alsa-driver-build/alsa-driver-1.0.15/pci/hda/hda_codec.c:2765:
autoconfig: line_outs=3 (0xd/0xc/0xf/0x0/0x0)
ALSA /tmp/alsa-driver-build/alsa-driver-1.0.15/pci/hda/hda_codec.c:2769:
speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
ALSA /tmp/alsa-driver-build/alsa-driver-1.0.15/pci/hda/hda_codec.c:2773:
hp_outs=1 (0xa/0x0/0x0/0x0/0x0)
ALSA /tmp/alsa-driver-build/alsa-driver-1.0.15/pci/hda/hda_codec.c:2781:
inputs: mic=0x0, fmic=0x0, line=0x0, fline=0x0, cd=0x0, aux=0x0
ALSA /tmp/alsa-driver-build/alsa-driver-1.0.15/pci/hda/../../alsa-kernel/pci/hda/patch_sigmatel.c:1652: stac92xx_add_dyn_out_pins: total dac count=4
ALSA /tmp/alsa-driver-build/alsa-driver-1.0.15/pci/hda/../../alsa-kernel/pci/hda/patch_sigmatel.c:1775: dac_nids=3 (0x2/0x3/0x5/0x0/0x0)
> > > Looking through the sigmatel code, we have several known use cases:
> > >
> > > 1. desktop
> > > 1a. 3stack + front panel
> > > front HP, front mic, rear line-out, rear line-in, rear mic
> > >
> > > 1b. 6stack + front panel
> > > front HP, front mic, rear line-out, rear surr, rear CLFE
> > > rear side, rear line-in, rear mic
> > > and variants without front panel.
> > >
> > > In the case 1a, rear line-in and rear mic can be used as surround
> > > outputs.
> > >
> > > 2. laptop
> > > 2a. minimal
> > > HP, speaker, mic, built-in mic
> > > 2b. a la desktop
> > > HP, speaker, line-in, mic, built-in mic
> > > 2c. dell
> > > HP x 2, speaker(s), mic, built-in mic
> > >
> > > Now, the case 2c requires a similar hack. But, before going more
> > > deeply, it's better to recheck patch_sigmatel.c again. Basically, it
> > > has already the code to add output sharing using line-in/mic-in. The
> > > problem is that it checks only limited use-cases (1a) and it adds
> > > cfg->line_outs and thus this influences on all other places.
> > >
> >
> > The call graph of stac92xx_parse_auto_config() :
> >
> > 1.snd_hda_parse_pin_def_config()
> >
> > 2.stac92xx_add_dyn_out_pins()
> > It check the cfg->line_outs and input_pins[] to add dynamic lineouts.
> >
> > 3.stac92xx_auto_fill_dac_nids()
> > It only fills the dac_nids from the cfg->line_out_pins[],
> >
> > 4.stac92xx_auto_create_multi_out_ctls()
> > It add controls according to the cfg->line_outs.
> >
> > we can see that they heavily depend on the line_outs[] info.
> >
> > How about this method?
> >
> > In stac92xx_add_dyn_out_pins(),we check the cfg->hp_outs,IF IT IS 2,then
> > we switch the cfg->hp_pins[] with cfg->line_out_pins[].
>
> Maybe better to check cfg->line_out_type. I guess it's
> AUTO_PIN_SPEAKER_OUT in the case of this Dell laptop. The driver
> takes speaker in prior to headphone as the primary line-out.
>
> > The 2,3,4 may work without change.
> > At the end of the stac92xx_parse_auto_config(),we restore the
> > cfg->hp_pins[] and cfg->line_out_pins[].
>
> Alternatively, instead of saving/restoring informatoin, we can fix
> snd_hda_parse_pin_def_config() itself to check cfg->hp_outs and
> cfg->speaker_outs to determine the primary output. If one of them is
> greater, take it as the primary output.
> It's less hackish but *might* cause some regression in rare cases.
>
I think that we need to restore the cfg->hp_pins and cfg->line_out_pins
for the rest code,because:
1. stac92xx_auto_init_hp_out() need to use the hp_pins to enable the
AC_PINCTL_HP_EN
2. stac92xx_hp_detect() need to use the hp_outs to detect jack presense
and will disable line_out_pins and speaker_pins.
3. stac92xx_init() use the hp_pins to enable unsolicited response.
If we copy cfg->hp_outs to the line_out_pins, all these codes won't
work. ^-^
> > Another things to change :
> > 1.snd_hda_parse_pin_def_config()
> > Should sort the hp_pins[] by sequence.
>
> Yeah, just missing right now.
>
> > 2.stac92xx_auto_fill_dac_nids()
> > Support the "Front Mic" switch as well.
> > 3.stac92xx_io_switch_put()
> > If Mic work as output for laptop,enable pin detect too.
>
> Well, I think the better fix is to fix the "Front Mic". If there is
> only a front mic, it should be basically labelled as "Mic" because
> it's the only one. So, again, snd_hda_parse_pin_def_config(), we can
> reassign input_pins[AUTO_PIN_FRONT_MIC] to input_pins[AUTO_PIN_MIC] if
> there is only one mic. Then the rest wouldn't need changes.
>
Great.
> Of course, another question is what to do when we have both rear and
> front mic and if we still want to handle them as outputs. Well, we
> have no such hardware yet, though.
>
>
> thanks,
>
> Takashi
next prev parent reply other threads:[~2007-10-25 7:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-18 2:49 patch for Dell 1210 which using stac9221 codec zhejiang
2007-10-18 14:55 ` Takashi Iwai
2007-10-19 6:02 ` zhejiang
2007-10-19 5:38 ` Takashi Iwai
2007-10-19 7:42 ` zhejiang
2007-10-19 8:39 ` Takashi Iwai
2007-10-22 6:08 ` zhejiang
2007-10-23 9:11 ` Takashi Iwai
2007-10-25 7:44 ` zhejiang [this message]
2007-10-25 9:07 ` Takashi Iwai
2007-10-30 9:05 ` zhejiang
2007-10-30 13:53 ` Takashi Iwai
2007-10-31 8:49 ` zhejiang
2007-10-31 8:39 ` Takashi Iwai
2007-10-31 14:25 ` Takashi Iwai
2007-11-01 2:14 ` zhejiang
2007-11-08 7:06 ` zhejiang
2007-11-08 4:48 ` Takashi Iwai
2007-11-09 4:53 ` zhejiang
2007-11-13 9:16 ` Jiang, Zhe
2007-11-13 8:10 ` Takashi Iwai
2007-10-30 15:48 ` Tobin Davis
2007-10-30 13:51 ` Takashi Iwai
2007-10-31 8:43 ` zhejiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1193298282.3459.18.camel@localhost.localdomain \
--to=zhe.jiang@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.