* [ALSA - patch_sigmatel.c for HP dv4-1222nr laptop 9/9Patch to patch_sigmatel.c for HP dv4-1222nr laptop
@ 2009-04-13 22:04 renidragsemaj
2009-04-14 13:10 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: renidragsemaj @ 2009-04-13 22:04 UTC (permalink / raw)
To: patch; +Cc: James Gardiner, alsa-devel
From: James Gardiner <renidragsemaj@yahoo.com>
This patch to patch_sigmatel.c is for the HP dv4-1222nr laptop. It
activates the included microphone(s) and the mute status change light
for this computer. I don't know if this will work for any other dv4
laptop. The commit isn't perfect, for it doesn't seem to work too well
with pulseaudio - the mic boost doesn't work with that audioserver.
Otherwise, it works well with esound, even across reboots and
suspend/hibernate/resume. The built-in microphone sits on node 0x18 and
feeds through node 0x1c. The gpio for the mute light is GPIO #0. I
borrowed the code from the HP HDX. Occasionally if you press the mute
button too fast in succession it lowers the actual volume to 0 and
you'll have to adjust it again...But if you are doing that you probably
are getting a kick out of making me feel bad about the behavior. :) No
autodetect of the laptop seems to work for me, but "model=hp-dv4-1222nr"
as an option to modprobe will make the changes.
Signed-off-by: James Gardiner <renidragsemaj@yahoo.com>
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 61996a2..4286155 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -100,6 +100,7 @@ enum {
STAC_HP_M4,
STAC_HP_DV5,
STAC_HP_HDX,
+ STAC_HP_DV4_1222NR,
STAC_92HD71BXX_MODELS
};
@@ -1847,6 +1848,7 @@ static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
[STAC_HP_M4] = "hp-m4",
[STAC_HP_DV5] = "hp-dv5",
[STAC_HP_HDX] = "hp-hdx",
+ [STAC_HP_DV4_1222NR] = "hp-dv4-1222nr",
};
static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
@@ -4534,6 +4536,28 @@ static int stac92xx_hp_hdx_check_power_status(struct hda_codec *codec,
}
#endif
+static int stac92xx_hp_dv4_1222nr_check_power_status(struct hda_codec *codec,
+ hda_nid_t nid)
+{
+ /* Shamelessly stolen from the function stac92xx_hp_hdx_check_power_status */
+ /* by James Gardiner */
+ struct sigmatel_spec *spec = codec->spec;
+
+ if (nid == 0x10) {
+ if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) &
+ HDA_AMP_MUTE)
+ spec->gpio_data &= ~0x01; /* orange */
+ else
+ spec->gpio_data |= 0x01; /* white */
+
+ stac_gpio_set(codec, spec->gpio_mask,
+ spec->gpio_dir,
+ spec->gpio_data);
+ }
+
+ return 0;
+}
+
static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
{
struct sigmatel_spec *spec = codec->spec;
@@ -5202,6 +5226,19 @@ again:
spec->num_smuxes = 0;
spec->num_dmuxes = 1;
break;
+ case STAC_HP_DV4_1222NR: /* James Gardiner */
+ spec->num_dmics = 1;
+ spec->num_dmuxes = 2;
+ stac92xx_auto_set_pinctl(codec, 0x1c, 2);
+ stac92xx_auto_set_pinctl(codec, 0x18, AC_PINCTL_IN_EN);
+#ifdef CONFIG_SND_HDA_POWER_SAVE
+ spec->gpio_mask |= 0x01;
+ spec->gpio_dir |= 0x01;
+ spec->gpio_data |= 0x01;
+ codec->patch_ops.check_power_status =
+ stac92xx_hp_dv4_1222nr_check_power_status;
+#endif
+ /* fallthrough */
case STAC_HP_DV5:
snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN);
--
1.5.6.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [ALSA - patch_sigmatel.c for HP dv4-1222nr laptop 9/9Patch to patch_sigmatel.c for HP dv4-1222nr laptop
2009-04-13 22:04 [ALSA - patch_sigmatel.c for HP dv4-1222nr laptop 9/9Patch to patch_sigmatel.c for HP dv4-1222nr laptop renidragsemaj
@ 2009-04-14 13:10 ` Takashi Iwai
2009-04-17 5:39 ` James Gardiner
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2009-04-14 13:10 UTC (permalink / raw)
To: renidragsemaj; +Cc: alsa-devel
At Mon, 13 Apr 2009 18:04:16 -0400,
renidragsemaj@yahoo.com wrote:
>
> From: James Gardiner <renidragsemaj@yahoo.com>
>
> This patch to patch_sigmatel.c is for the HP dv4-1222nr laptop. It
> activates the included microphone(s) and the mute status change light
> for this computer. I don't know if this will work for any other dv4
> laptop. The commit isn't perfect, for it doesn't seem to work too well
> with pulseaudio - the mic boost doesn't work with that audioserver.
> Otherwise, it works well with esound, even across reboots and
> suspend/hibernate/resume. The built-in microphone sits on node 0x18 and
> feeds through node 0x1c. The gpio for the mute light is GPIO #0. I
> borrowed the code from the HP HDX. Occasionally if you press the mute
> button too fast in succession it lowers the actual volume to 0 and
> you'll have to adjust it again...But if you are doing that you probably
> are getting a kick out of making me feel bad about the behavior. :) No
> autodetect of the laptop seems to work for me, but "model=hp-dv4-1222nr"
> as an option to modprobe will make the changes.
>
> Signed-off-by: James Gardiner <renidragsemaj@yahoo.com>
Thanks for the patch. The change looks almost good to me.
See some comments below.
> diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
> index 61996a2..4286155 100644
...
> +static int stac92xx_hp_dv4_1222nr_check_power_status(struct hda_codec *codec,
> + hda_nid_t nid)
> +{
> + /* Shamelessly stolen from the function stac92xx_hp_hdx_check_power_status */
> + /* by James Gardiner */
In such a case, it'd be better to share the same function.
Either check spec->board_config to choose the bit to change, or add
some new fields in struct sigmtael_spec.
> static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
> {
> struct sigmatel_spec *spec = codec->spec;
> @@ -5202,6 +5226,19 @@ again:
> spec->num_smuxes = 0;
> spec->num_dmuxes = 1;
> break;
> + case STAC_HP_DV4_1222NR: /* James Gardiner */
No need to add you name here and there unless it's really needed :)
All changes are recorded via git properly, thus users can see easily
who changed what.
> + spec->num_dmics = 1;
> + spec->num_dmuxes = 2;
> + stac92xx_auto_set_pinctl(codec, 0x1c, 2);
The number "2" doesn't look cute...
Could you fix and repost the patch?
thanks,
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ALSA - patch_sigmatel.c for HP dv4-1222nr laptop 9/9Patch to patch_sigmatel.c for HP dv4-1222nr laptop
2009-04-14 13:10 ` Takashi Iwai
@ 2009-04-17 5:39 ` James Gardiner
2009-04-17 6:59 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: James Gardiner @ 2009-04-17 5:39 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
--- On Tue, 4/14/09, Takashi Iwai <tiwai@suse.de> wrote:
>
> Thanks for the patch. The change looks almost good to me.
> See some comments below
>
>
>
> > + spec->num_dmics = 1;
> > + spec->num_dmuxes = 2;
> > + stac92xx_auto_set_pinctl(codec, 0x1c, 2);
>
> The number "2" doesn't look cute...
>
> Could you fix and repost the patch?
>
>
> thanks,
>
> Takashi
Are you worried it looks like a magic number? Or am I supposed to be looking for something else? Or would a '#define' be more what you're talking about?
Oh, and by the way, I figured out what pulseaudio was doing. I still don't like it, but it seems to be the norm for it.
Can you (simple) explain to me what the PCI_QUIRK stuff does? I've tried adding to it to get the autodetect to work and I really don't know what I'm doing there. If not, manual setting is fine, I just wanted to make the patch work automatically. I've read the source, read your driver handbook, and I still don't get it. :P
Thanks,
James
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ALSA - patch_sigmatel.c for HP dv4-1222nr laptop 9/9Patch to patch_sigmatel.c for HP dv4-1222nr laptop
2009-04-17 5:39 ` James Gardiner
@ 2009-04-17 6:59 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2009-04-17 6:59 UTC (permalink / raw)
To: renidragsemaj; +Cc: alsa-devel
At Thu, 16 Apr 2009 22:39:35 -0700 (PDT),
James Gardiner wrote:
>
>
>
>
>
> --- On Tue, 4/14/09, Takashi Iwai <tiwai@suse.de> wrote:
>
> >
> > Thanks for the patch. The change looks almost good to me.
> > See some comments below
> >
> >
> >
> > > + spec->num_dmics = 1;
> > > + spec->num_dmuxes = 2;
> > > + stac92xx_auto_set_pinctl(codec, 0x1c, 2);
> >
> > The number "2" doesn't look cute...
> >
> > Could you fix and repost the patch?
> >
> >
> > thanks,
> >
> > Takashi
>
> Are you worried it looks like a magic number? Or am I supposed to be
> looking for something else? Or would a '#define' be more what
> you're talking about?
Use constants defined in hda_codec.h.
For pin-setup, AC_PINCTL_* can be used.
> Can you (simple) explain to me what the PCI_QUIRK stuff does?
The driver identifies the specific model via PCI SSID (not codec
SSID). Check "lspci -nv" output and pass the value there.
thanks,
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-04-17 6:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-13 22:04 [ALSA - patch_sigmatel.c for HP dv4-1222nr laptop 9/9Patch to patch_sigmatel.c for HP dv4-1222nr laptop renidragsemaj
2009-04-14 13:10 ` Takashi Iwai
2009-04-17 5:39 ` James Gardiner
2009-04-17 6:59 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox