All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* PATCH: ALSA - hda - Add support for Dell E6400 docking station
@ 2009-11-16 23:20 Christian Hergert
  2009-11-17  9:37 ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Christian Hergert @ 2009-11-16 23:20 UTC (permalink / raw
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 668 bytes --]

Hi,

I made a patch to fix bug 4657[1] on the tracker.  I'm fairly certain that
it isn't the correct approach but would like some feedback on what that
would be.

The power-mappings in patch_sigmatel.c seem to allow you to flip multiple
bits.  In the case of the Dell docking station, you need to enable some bits
while disabling others.  Therefore, instead of using the power mappings I
just hacked in a quick check to work for the hardware I have on hand.  If
there is a proper way to fix this that I have missed, I'll be more than
happy to fix the patch appropriately.

[1] https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4657

Regards,
--
Christian Hergert

[-- Attachment #2: 0001-ALSA-hda-Add-support-for-Dell-E6400-docking-station.patch --]
[-- Type: text/x-patch, Size: 1218 bytes --]

From 5650b1e722182c1ddd7dcaef6885033a0ef10b9c Mon Sep 17 00:00:00 2001
From: Christian Hergert <chris@dronelabs.com>
Date: Mon, 16 Nov 2009 14:27:22 -0800
Subject: [PATCH] ALSA: hda - Add support for Dell E6400 docking station

BugLink: https://bugs.launchpad.net/alsa-driver/+bug/383756
BugLink: https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4657

Mute the internal speakers when the output jack on the
docking station is enabled.
---
 sound/pci/hda/patch_sigmatel.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 0f6c33d..ed5d9b1 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4567,6 +4567,17 @@ static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
 	else
 		val |= idx;
 
+	if (codec->vendor_id == 0x111d76b2 &&
+			spec->board_config == STAC_DELL_M4_1 &&
+			idx == 4) {
+		/* the internal speakers need to be muted when the
+		 * docking station output is enabled. */
+		if (enable)
+			val |= 2;
+		else
+			val &= ~2;
+	}
+
 	/* power down unused output ports */
 	snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
 }
-- 
1.6.3.3


[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: PATCH: ALSA - hda - Add support for Dell E6400 docking station
  2009-11-16 23:20 PATCH: ALSA - hda - Add support for Dell E6400 docking station Christian Hergert
@ 2009-11-17  9:37 ` Takashi Iwai
  2009-11-17 20:17   ` Christian Hergert
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2009-11-17  9:37 UTC (permalink / raw
  To: Christian Hergert; +Cc: alsa-devel

At Mon, 16 Nov 2009 15:20:32 -0800,
Christian Hergert wrote:
> 
> Hi,
> 
> I made a patch to fix bug 4657[1] on the tracker.  I'm fairly certain that
> it isn't the correct approach but would like some feedback on what that
> would be.
> 
> The power-mappings in patch_sigmatel.c seem to allow you to flip multiple
> bits.  In the case of the Dell docking station, you need to enable some bits
> while disabling others.  Therefore, instead of using the power mappings I
> just hacked in a quick check to work for the hardware I have on hand.  If
> there is a proper way to fix this that I have missed, I'll be more than
> happy to fix the patch appropriately.
> 
> [1] https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4657

The jack detection of the docking station is already there, but it seems
just a missing call to toggle the power-map.

How about the patch below?


thanks,

Takashi

---
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 7f76a97..bd9a2dd 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4396,10 +4396,12 @@ static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
 		pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
 	
 	pin_ctl |= flag;
-	if (old_ctl != pin_ctl)
+	if (old_ctl != pin_ctl) {
 		snd_hda_codec_write_cache(codec, nid, 0,
 					  AC_VERB_SET_PIN_WIDGET_CONTROL,
 					  pin_ctl);
+		stac_toggle_power_map(codec, nid, 1);
+	}
 }
 
 static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
@@ -4407,10 +4409,12 @@ static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
 {
 	unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
 			0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
-	if (pin_ctl & flag)
+	if (pin_ctl & flag) {
 		snd_hda_codec_write_cache(codec, nid, 0,
 					  AC_VERB_SET_PIN_WIDGET_CONTROL,
 					  pin_ctl & ~flag);
+		stac_toggle_power_map(codec, nid, 0);
+	}
 }
 
 static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: PATCH: ALSA - hda - Add support for Dell E6400 docking station
  2009-11-17  9:37 ` Takashi Iwai
@ 2009-11-17 20:17   ` Christian Hergert
  2009-11-18  6:15     ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Christian Hergert @ 2009-11-17 20:17 UTC (permalink / raw
  To: Takashi Iwai; +Cc: alsa-devel

On Tue, Nov 17, 2009 at 1:37 AM, Takashi Iwai <tiwai@suse.de> wrote:
>
> At Mon, 16 Nov 2009 15:20:32 -0800,
> Christian Hergert wrote:
> >
> > Hi,
> >
> > I made a patch to fix bug 4657[1] on the tracker.  I'm fairly certain that
> > it isn't the correct approach but would like some feedback on what that
> > would be.
> >
> > The power-mappings in patch_sigmatel.c seem to allow you to flip multiple
> > bits.  In the case of the Dell docking station, you need to enable some bits
> > while disabling others.  Therefore, instead of using the power mappings I
> > just hacked in a quick check to work for the hardware I have on hand.  If
> > there is a proper way to fix this that I have missed, I'll be more than
> > happy to fix the patch appropriately.
> >
> > [1] https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4657
>
> The jack detection of the docking station is already there, but it seems
> just a missing call to toggle the power-map.
>
> How about the patch below?
>
>
> thanks,
>
> Takashi
>
> ---
> diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
> index 7f76a97..bd9a2dd 100644
> --- a/sound/pci/hda/patch_sigmatel.c
> +++ b/sound/pci/hda/patch_sigmatel.c
> @@ -4396,10 +4396,12 @@ static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
>                pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
>
>        pin_ctl |= flag;
> -       if (old_ctl != pin_ctl)
> +       if (old_ctl != pin_ctl) {
>                snd_hda_codec_write_cache(codec, nid, 0,
>                                          AC_VERB_SET_PIN_WIDGET_CONTROL,
>                                          pin_ctl);
> +               stac_toggle_power_map(codec, nid, 1);
> +       }
>  }
>
>  static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
> @@ -4407,10 +4409,12 @@ static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
>  {
>        unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
>                        0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
> -       if (pin_ctl & flag)
> +       if (pin_ctl & flag) {
>                snd_hda_codec_write_cache(codec, nid, 0,
>                                          AC_VERB_SET_PIN_WIDGET_CONTROL,
>                                          pin_ctl & ~flag);
> +               stac_toggle_power_map(codec, nid, 0);
> +       }
>  }
>
>  static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)

I tried this on top of 2.6.31.4 and, unfortunately, it did not solve
the problem.  I'll investigate a bit to figure out why.

-- Christian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: ALSA - hda - Add support for Dell E6400 docking station
  2009-11-17 20:17   ` Christian Hergert
@ 2009-11-18  6:15     ` Takashi Iwai
  2009-11-18 22:34       ` Christian Hergert
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2009-11-18  6:15 UTC (permalink / raw
  To: Christian Hergert; +Cc: alsa-devel

At Tue, 17 Nov 2009 12:17:59 -0800,
Christian Hergert wrote:
> 
> On Tue, Nov 17, 2009 at 1:37 AM, Takashi Iwai <tiwai@suse.de> wrote:
> >
> > At Mon, 16 Nov 2009 15:20:32 -0800,
> > Christian Hergert wrote:
> > >
> > > Hi,
> > >
> > > I made a patch to fix bug 4657[1] on the tracker.  I'm fairly certain that
> > > it isn't the correct approach but would like some feedback on what that
> > > would be.
> > >
> > > The power-mappings in patch_sigmatel.c seem to allow you to flip multiple
> > > bits.  In the case of the Dell docking station, you need to enable some bits
> > > while disabling others.  Therefore, instead of using the power mappings I
> > > just hacked in a quick check to work for the hardware I have on hand.  If
> > > there is a proper way to fix this that I have missed, I'll be more than
> > > happy to fix the patch appropriately.
> > >
> > > [1] https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4657
> >
> > The jack detection of the docking station is already there, but it seems
> > just a missing call to toggle the power-map.
> >
> > How about the patch below?
> >
> >
> > thanks,
> >
> > Takashi
> >
> > ---
> > diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
> > index 7f76a97..bd9a2dd 100644
> > --- a/sound/pci/hda/patch_sigmatel.c
> > +++ b/sound/pci/hda/patch_sigmatel.c
> > @@ -4396,10 +4396,12 @@ static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
> >                pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
> >
> >        pin_ctl |= flag;
> > -       if (old_ctl != pin_ctl)
> > +       if (old_ctl != pin_ctl) {
> >                snd_hda_codec_write_cache(codec, nid, 0,
> >                                          AC_VERB_SET_PIN_WIDGET_CONTROL,
> >                                          pin_ctl);
> > +               stac_toggle_power_map(codec, nid, 1);
> > +       }
> >  }
> >
> >  static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
> > @@ -4407,10 +4409,12 @@ static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
> >  {
> >        unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
> >                        0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
> > -       if (pin_ctl & flag)
> > +       if (pin_ctl & flag) {
> >                snd_hda_codec_write_cache(codec, nid, 0,
> >                                          AC_VERB_SET_PIN_WIDGET_CONTROL,
> >                                          pin_ctl & ~flag);
> > +               stac_toggle_power_map(codec, nid, 0);
> > +       }
> >  }
> >
> >  static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
> 
> I tried this on top of 2.6.31.4 and, unfortunately, it did not solve
> the problem.  I'll investigate a bit to figure out why.

Could you try 2.6.32-rc7 with the patch?
(Or, you can just copy sound/pci/hda/* from 2.6.32 to 31, in this case.)


thanks,

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: ALSA - hda - Add support for Dell E6400 docking station
  2009-11-18  6:15     ` Takashi Iwai
@ 2009-11-18 22:34       ` Christian Hergert
  2009-11-19  5:09         ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Christian Hergert @ 2009-11-18 22:34 UTC (permalink / raw
  To: Takashi Iwai; +Cc: alsa-devel

Hi,

On Tue, Nov 17, 2009 at 10:15 PM, Takashi Iwai <tiwai@suse.de> wrote:
> At Tue, 17 Nov 2009 12:17:59 -0800,
> Christian Hergert wrote:
>>
>> On Tue, Nov 17, 2009 at 1:37 AM, Takashi Iwai <tiwai@suse.de> wrote:
>> >
>> > At Mon, 16 Nov 2009 15:20:32 -0800,
>> > Christian Hergert wrote:
>> > >
>> > > Hi,
>> > >
>> > > I made a patch to fix bug 4657[1] on the tracker.  I'm fairly certain that
>> > > it isn't the correct approach but would like some feedback on what that
>> > > would be.
>> > >
>> > > The power-mappings in patch_sigmatel.c seem to allow you to flip multiple
>> > > bits.  In the case of the Dell docking station, you need to enable some bits
>> > > while disabling others.  Therefore, instead of using the power mappings I
>> > > just hacked in a quick check to work for the hardware I have on hand.  If
>> > > there is a proper way to fix this that I have missed, I'll be more than
>> > > happy to fix the patch appropriately.
>> > >
>> > > [1] https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4657
>> >
>> > The jack detection of the docking station is already there, but it seems
>> > just a missing call to toggle the power-map.
>> >
>> > How about the patch below?
>> >
>> >
>> > thanks,
>> >
>> > Takashi
>> >
>> > ---
>> > diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
>> > index 7f76a97..bd9a2dd 100644
>> > --- a/sound/pci/hda/patch_sigmatel.c
>> > +++ b/sound/pci/hda/patch_sigmatel.c
>> > @@ -4396,10 +4396,12 @@ static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
>> >                pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
>> >
>> >        pin_ctl |= flag;
>> > -       if (old_ctl != pin_ctl)
>> > +       if (old_ctl != pin_ctl) {
>> >                snd_hda_codec_write_cache(codec, nid, 0,
>> >                                          AC_VERB_SET_PIN_WIDGET_CONTROL,
>> >                                          pin_ctl);
>> > +               stac_toggle_power_map(codec, nid, 1);
>> > +       }
>> >  }
>> >
>> >  static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
>> > @@ -4407,10 +4409,12 @@ static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
>> >  {
>> >        unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
>> >                        0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
>> > -       if (pin_ctl & flag)
>> > +       if (pin_ctl & flag) {
>> >                snd_hda_codec_write_cache(codec, nid, 0,
>> >                                          AC_VERB_SET_PIN_WIDGET_CONTROL,
>> >                                          pin_ctl & ~flag);
>> > +               stac_toggle_power_map(codec, nid, 0);
>> > +       }
>> >  }
>> >
>> >  static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
>>
>> I tried this on top of 2.6.31.4 and, unfortunately, it did not solve
>> the problem.  I'll investigate a bit to figure out why.
>
> Could you try 2.6.32-rc7 with the patch?
> (Or, you can just copy sound/pci/hda/* from 2.6.32 to 31, in this case.)
>
>
> thanks,
>
> Takashi
>

I tried with and without your patch on top of 2.6.32-rc7 and both
seemed to work.  So I guess the patch is not needed.  I apologize for
not trying tip before sending a patch.

-- Christian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: ALSA - hda - Add support for Dell E6400 docking station
  2009-11-18 22:34       ` Christian Hergert
@ 2009-11-19  5:09         ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2009-11-19  5:09 UTC (permalink / raw
  To: Christian Hergert; +Cc: alsa-devel

At Wed, 18 Nov 2009 14:34:29 -0800,
Christian Hergert wrote:
> 
> Hi,
> 
> On Tue, Nov 17, 2009 at 10:15 PM, Takashi Iwai <tiwai@suse.de> wrote:
> > At Tue, 17 Nov 2009 12:17:59 -0800,
> > Christian Hergert wrote:
> >>
> >> On Tue, Nov 17, 2009 at 1:37 AM, Takashi Iwai <tiwai@suse.de> wrote:
> >> >
> >> > At Mon, 16 Nov 2009 15:20:32 -0800,
> >> > Christian Hergert wrote:
> >> > >
> >> > > Hi,
> >> > >
> >> > > I made a patch to fix bug 4657[1] on the tracker.  I'm fairly certain that
> >> > > it isn't the correct approach but would like some feedback on what that
> >> > > would be.
> >> > >
> >> > > The power-mappings in patch_sigmatel.c seem to allow you to flip multiple
> >> > > bits.  In the case of the Dell docking station, you need to enable some bits
> >> > > while disabling others.  Therefore, instead of using the power mappings I
> >> > > just hacked in a quick check to work for the hardware I have on hand.  If
> >> > > there is a proper way to fix this that I have missed, I'll be more than
> >> > > happy to fix the patch appropriately.
> >> > >
> >> > > [1] https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4657
> >> >
> >> > The jack detection of the docking station is already there, but it seems
> >> > just a missing call to toggle the power-map.
> >> >
> >> > How about the patch below?
> >> >
> >> >
> >> > thanks,
> >> >
> >> > Takashi
> >> >
> >> > ---
> >> > diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
> >> > index 7f76a97..bd9a2dd 100644
> >> > --- a/sound/pci/hda/patch_sigmatel.c
> >> > +++ b/sound/pci/hda/patch_sigmatel.c
> >> > @@ -4396,10 +4396,12 @@ static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
> >> >                pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN);
> >> >
> >> >        pin_ctl |= flag;
> >> > -       if (old_ctl != pin_ctl)
> >> > +       if (old_ctl != pin_ctl) {
> >> >                snd_hda_codec_write_cache(codec, nid, 0,
> >> >                                          AC_VERB_SET_PIN_WIDGET_CONTROL,
> >> >                                          pin_ctl);
> >> > +               stac_toggle_power_map(codec, nid, 1);
> >> > +       }
> >> >  }
> >> >
> >> >  static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
> >> > @@ -4407,10 +4409,12 @@ static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
> >> >  {
> >> >        unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
> >> >                        0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
> >> > -       if (pin_ctl & flag)
> >> > +       if (pin_ctl & flag) {
> >> >                snd_hda_codec_write_cache(codec, nid, 0,
> >> >                                          AC_VERB_SET_PIN_WIDGET_CONTROL,
> >> >                                          pin_ctl & ~flag);
> >> > +               stac_toggle_power_map(codec, nid, 0);
> >> > +       }
> >> >  }
> >> >
> >> >  static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
> >>
> >> I tried this on top of 2.6.31.4 and, unfortunately, it did not solve
> >> the problem.  I'll investigate a bit to figure out why.
> >
> > Could you try 2.6.32-rc7 with the patch?
> > (Or, you can just copy sound/pci/hda/* from 2.6.32 to 31, in this case.)
> >
> >
> > thanks,
> >
> > Takashi
> >
> 
> I tried with and without your patch on top of 2.6.32-rc7 and both
> seemed to work.  So I guess the patch is not needed.  I apologize for
> not trying tip before sending a patch.

Good to hear that it works.
Thanks for reporting and checking!


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-11-19  5:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-16 23:20 PATCH: ALSA - hda - Add support for Dell E6400 docking station Christian Hergert
2009-11-17  9:37 ` Takashi Iwai
2009-11-17 20:17   ` Christian Hergert
2009-11-18  6:15     ` Takashi Iwai
2009-11-18 22:34       ` Christian Hergert
2009-11-19  5:09         ` Takashi Iwai

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.