All of lore.kernel.org
 help / color / mirror / Atom feed
From: "joey.jiaojg" <joey.jiaojg@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Raymond Yau <superquad.vortex2@gmail.com>,
	pshou@realtek.com.tw,
	ALSA Development Mailing List <alsa-devel@alsa-project.org>,
	kailang@realtek.com.tw
Subject: Re: Bug report - patch_realtek.c - Laptop HP COMPAQ B1900 Series
Date: Wed, 15 Feb 2012 22:45:27 +0800	[thread overview]
Message-ID: <4F3BC507.2040001@gmail.com> (raw)
In-Reply-To: <s5hwr7otep6.wl%tiwai@suse.de>

I think the only question below is about the automute, right?
Then I did another test by modifying like below (so the result is same 
as sending any hda-verb cmd) -- The result is the auto-mute works too:
if (present) {
                 snd_hda_codec_write_cache(codec, 0x01, 0,
                                           AC_VERB_SET_GPIO_MASK, 0);
                 snd_hda_codec_write_cache(codec, 0x01, 0,
                                           AC_VERB_SET_GPIO_DIRECTION,
                                           0);
                 /*snd_hda_codec_write_cache(codec, 0x0f, 0,
                                           AC_VERB_SET_PIN_WIDGET_CONTROL,
                                           PIN_HP);*/
                 snd_hda_codec_read(codec, 0x01, 0,
                                           AC_VERB_GET_GPIO_MASK,
                                           0);
         } else {
                 snd_hda_codec_write_cache(codec, 0x01, 0,
                                           AC_VERB_SET_GPIO_MASK, 1);
                 snd_hda_codec_write_cache(codec, 0x01, 0,
                                           AC_VERB_SET_GPIO_DIRECTION,
                                           1);
                 /*snd_hda_codec_write_cache(codec, 0x0f, 0,
                                           AC_VERB_SET_PIN_WIDGET_CONTROL,
                                           PIN_OUT);*/
                 snd_hda_codec_read(codec, 0x01, 0,
                                           AC_VERB_GET_GPIO_MASK,
                                           0);
         }



On 2012年02月15日 21:21, Takashi Iwai wrote:
> At Wed, 15 Feb 2012 21:14:48 +0800,
> joey.jiaojg wrote:
>> Please check my reply below.
>>
>> On 2012年02月15日 18:11, Takashi Iwai wrote:
>>> At Wed, 15 Feb 2012 18:06:39 +0800,
>>> joey.jiaojg wrote:
>>>> OK, the situation is 0x01 is to control GPIO0:
>>>> 1. if I write (codec,0x01,0,AC_VERB_SET_GPIO_MASK,1) only; the result is
>>>> speaker not work.
>>>>
>>>> 2. if I write (codec,0x01,0,AC_VERB_SET_GPIO_DIRECTION,1) only; the
>>>> result is speaker not work.
>>>>
>>> Sure, GPIO must be always set mask, direction and data all together.
>>> The question is, when you set GPIO mask/dir/data, the speaker starts
>>> playing, and if set to zero (e.g. only data), the speaker is muted?
>> JOEY: I tried set data to 0 or 1 doesn't influence. when I set mask&
>> dir to 1, speaker starts to work and to 0 speaker muted while headphone
>> works if headphone plugged in.
> There is something wrong in tests.  The direction bit controls only
> the direction, so yes, it must match with the value the hardware
> expected.  Otherwise it won't work, thus it's turned off.
>
>>>> 3. If I write step 1&   2 together, speaker works when I reboot.
>>> Then GPIO is likely an external amp control.
>> JOEY: YES.
>>>> 4. Then If I plugged in the headphone, the headphone doesn't work. It
>>>> only works when I write
>>>> (codec,0x0F,0,AC_VERB_SET_PIN_WIDGET_CONTROL,PIN_HP).
>>> This is normal.
>> JOEY: If I don't modify model=will. And headphone can play even without
>> set AC_VERB_SET_PIN_WIDGET_CONTROL to PIN_HP. Of course, automute
>> doesn't work as there is function implemented.
> OK, this is because of model=will strange things.
>
>>>> 5. From step 3&   4, it's similar for cases that I reboot with headphone
>>>> plugged in. That is, if I remove headphone, speaker doesn't work
>>>> automatically. If I write
>>>> (codec,0x0F,0,AC_VERB_SET_PIN_WIDGET_CONTROL,PIN_OUT), the
>>>> auto-detection function works well can switch speaker/headphone
>>>> automatically.
>>> That's odd.  If you don't change from PIN_HP, doesn't the unsolicited
>>> event work?
>> JOEY: the unsolicited works from the register I read also from the
>> printk I previous added. But the audio path doesn't switch between
>> speaker and headphone. I don't know why. It can works manually if I send
>> any hda-verb command to codec, like hda-verb /dev/snd/hwC0D0 0x0F 0xF09
>> 0x0; I think perhaps there needs to be some delay. But I wait seconds
>> and it doesn't switch. Then if I run any hda-verb command, it will then
>> switch.
>> Then after I change from PIN_HP or from PIN_OUT, the automute (actually
>> audio path switch) works.
> Is the effect only with this pin?  In other words, if you change the
> pin control value of other pin, no similar effect?
>
>>> Another question is, when you set PIN_WIDGET_CONTROL on the speaker
>>> pin (not sure which one is) to 0x00, does it mute the speaker, too?
>> JOEY: No, it doesn't mute the speaker. To mute the speaker, I just need
>> to set 0 to dir or mask. Then audio path is to headphone.
> And you are sure that it's the right pin?  Which pin did you test?
>
> The pin-control doesn't always turn off the output in some cases.
> But, we'd need to be sure whether we are looking at the right one.
>
>
> thanks,
>
> Takashi

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2012-02-15 14:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4F35C191.9080401@gmail.com>
2012-02-11  2:05 ` Bug report - patch_realtek.c - Laptop HP COMPAQ B1900 Series Jonathan Woithe
2012-02-15  0:50   ` Raymond Yau
     [not found]     ` <CAKOmCvoS+tgvyPZJey4gfFFq=Uz01pnZY7YvGbxgQPpAzQ7KCA@mail.gmail.com>
2012-02-15  1:29       ` Joey Jiao
2012-02-15  2:49         ` Raymond Yau
     [not found]           ` <4F3B761D.4060306@gmail.com>
2012-02-15  9:22             ` Takashi Iwai
2012-02-15  9:31               ` joey.jiaojg
2012-02-15  9:40                 ` Takashi Iwai
2012-02-15  9:45                   ` joey.jiaojg
2012-02-15  9:58                     ` Takashi Iwai
2012-02-15 10:06                       ` joey.jiaojg
2012-02-15 10:11                         ` Takashi Iwai
2012-02-15 13:14                           ` joey.jiaojg
2012-02-15 13:21                             ` Takashi Iwai
2012-02-15 14:45                               ` joey.jiaojg [this message]
2012-02-15 15:04                                 ` Takashi Iwai
2012-02-16  2:04                                   ` Joey Jiao
2012-02-16  3:41                                     ` joey.jiaojg
2012-02-16  9:36                                       ` Takashi Iwai
2012-02-16  9:35                                     ` Takashi Iwai
2012-02-16  9:38                                       ` joey.jiaojg
2012-02-16  9:41                                         ` Takashi Iwai
2012-02-16  9:42                                           ` Takashi Iwai
2012-02-16  9:52                                             ` joey.jiaojg

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=4F3BC507.2040001@gmail.com \
    --to=joey.jiaojg@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=kailang@realtek.com.tw \
    --cc=pshou@realtek.com.tw \
    --cc=superquad.vortex2@gmail.com \
    --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.