linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PPC,SOUND] Fix audio gpio state detection
@ 2006-02-11 16:10 Andreas Schwab
  2006-02-12 22:35 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2006-02-11 16:10 UTC (permalink / raw)
  To: alsa-devel; +Cc: linuxppc-dev

When booting with line out or headphone plugged, you won't hear anything.
The problem is that after reset all channels are muted, but the actual
value of the gpio port doesn't exactly match the active_val settings as
expected by check_audio_gpio.  For example, the line_mute port is set to
7, but check_audio_gpio would expect 0xd or 0xf, thus its return value
indicates that it is not active, even though it is.  AFAICS only looking
at the low bit is enough to determine whether the port is active.

Signed-off-by: Andreas Schwab <schwab@suse.de>

Index: linux-2.6.16-rc2/sound/ppc/tumbler.c
===================================================================
--- linux-2.6.16-rc2.orig/sound/ppc/tumbler.c	2006-02-03 19:43:50.000000000 +0100
+++ linux-2.6.16-rc2/sound/ppc/tumbler.c	2006-02-11 03:46:30.000000000 +0100
@@ -207,7 +207,7 @@ static int check_audio_gpio(struct pmac_
 
 	ret = do_gpio_read(gp);
 
-	return (ret & 0xd) == (gp->active_val & 0xd);
+	return (ret & 0x1) == (gp->active_val & 0x1);
 }
 
 static int read_audio_gpio(struct pmac_gpio *gp)

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PPC,SOUND] Fix audio gpio state detection
  2006-02-11 16:10 [PPC,SOUND] Fix audio gpio state detection Andreas Schwab
@ 2006-02-12 22:35 ` Benjamin Herrenschmidt
  2006-02-12 22:46   ` Ben Collins
  2006-02-26 17:39   ` Olaf Hering
  0 siblings, 2 replies; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2006-02-12 22:35 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: linuxppc-dev, alsa-devel, Ben Collins

On Sat, 2006-02-11 at 17:10 +0100, Andreas Schwab wrote:
> When booting with line out or headphone plugged, you won't hear anything.
> The problem is that after reset all channels are muted, but the actual
> value of the gpio port doesn't exactly match the active_val settings as
> expected by check_audio_gpio.  For example, the line_mute port is set to
> 7, but check_audio_gpio would expect 0xd or 0xf, thus its return value
> indicates that it is not active, even though it is.  AFAICS only looking
> at the low bit is enough to determine whether the port is active.
> 
> Signed-off-by: Andreas Schwab <schwab@suse.de>
> 
> Index: linux-2.6.16-rc2/sound/ppc/tumbler.c
> ===================================================================
> --- linux-2.6.16-rc2.orig/sound/ppc/tumbler.c	2006-02-03 19:43:50.000000000 +0100
> +++ linux-2.6.16-rc2/sound/ppc/tumbler.c	2006-02-11 03:46:30.000000000 +0100
> @@ -207,7 +207,7 @@ static int check_audio_gpio(struct pmac_
>  
>  	ret = do_gpio_read(gp);
>  
> -	return (ret & 0xd) == (gp->active_val & 0xd);
> +	return (ret & 0x1) == (gp->active_val & 0x1);
>  }
>  
>  static int read_audio_gpio(struct pmac_gpio *gp)

Can you sync with the patches Ben Collins is doing on this as well ?

Ben, what is your status ? Are you feeding those through upstream the
alsa folks ? Or waiting for me to do something ? :)

The above, if it appear to works well enough might be worth merging
now ...

Ben.

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

* Re: [PPC,SOUND] Fix audio gpio state detection
  2006-02-12 22:35 ` Benjamin Herrenschmidt
@ 2006-02-12 22:46   ` Ben Collins
  2006-02-12 23:27     ` Benjamin Herrenschmidt
  2006-02-26 17:39   ` Olaf Hering
  1 sibling, 1 reply; 13+ messages in thread
From: Ben Collins @ 2006-02-12 22:46 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: alsa-devel, Ben Collins, linuxppc-dev

On Mon, 2006-02-13 at 09:35 +1100, Benjamin Herrenschmidt wrote:
> Can you sync with the patches Ben Collins is doing on this as well ?
> 
> Ben, what is your status ? Are you feeding those through upstream the
> alsa folks ? Or waiting for me to do something ? :)
> 
> The above, if it appear to works well enough might be worth merging
> now ...

I haven't synced because I've been waiting for some kind of go ahead
from you. I can rediff against 2.6.16-git and send them to alsa, CC ppc
list.

-- 
Ben Collins
Kernel Developer - Ubuntu Linux

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

* Re: [PPC,SOUND] Fix audio gpio state detection
  2006-02-12 22:46   ` Ben Collins
@ 2006-02-12 23:27     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2006-02-12 23:27 UTC (permalink / raw)
  To: Ben Collins; +Cc: alsa-devel, Ben Collins, linuxppc-dev

On Sun, 2006-02-12 at 17:46 -0500, Ben Collins wrote:
> On Mon, 2006-02-13 at 09:35 +1100, Benjamin Herrenschmidt wrote:
> > Can you sync with the patches Ben Collins is doing on this as well ?
> > 
> > Ben, what is your status ? Are you feeding those through upstream the
> > alsa folks ? Or waiting for me to do something ? :)
> > 
> > The above, if it appear to works well enough might be worth merging
> > now ...
> 
> I haven't synced because I've been waiting for some kind of go ahead
> from you. I can rediff against 2.6.16-git and send them to alsa, CC ppc
> list.

Please, do so !

Thanks,
Ben.

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

* Re: [PPC,SOUND] Fix audio gpio state detection
  2006-02-12 22:35 ` Benjamin Herrenschmidt
  2006-02-12 22:46   ` Ben Collins
@ 2006-02-26 17:39   ` Olaf Hering
  2006-02-26 19:19     ` [Alsa-devel] " Lee Revell
  2006-03-01 22:30     ` Olaf Hering
  1 sibling, 2 replies; 13+ messages in thread
From: Olaf Hering @ 2006-02-26 17:39 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: alsa-devel, Ben Collins, linuxppc-dev

 On Mon, Feb 13, Benjamin Herrenschmidt wrote:

> On Sat, 2006-02-11 at 17:10 +0100, Andreas Schwab wrote:
> > When booting with line out or headphone plugged, you won't hear anything.
> > The problem is that after reset all channels are muted, but the actual
> > value of the gpio port doesn't exactly match the active_val settings as
> > expected by check_audio_gpio.  For example, the line_mute port is set to
> > 7, but check_audio_gpio would expect 0xd or 0xf, thus its return value
> > indicates that it is not active, even though it is.  AFAICS only looking
> > at the low bit is enough to determine whether the port is active.
> > 
> > Signed-off-by: Andreas Schwab <schwab@suse.de>
> > 
> > Index: linux-2.6.16-rc2/sound/ppc/tumbler.c
> > ===================================================================
> > --- linux-2.6.16-rc2.orig/sound/ppc/tumbler.c	2006-02-03 19:43:50.000000000 +0100
> > +++ linux-2.6.16-rc2/sound/ppc/tumbler.c	2006-02-11 03:46:30.000000000 +0100
> > @@ -207,7 +207,7 @@ static int check_audio_gpio(struct pmac_
> >  
> >  	ret = do_gpio_read(gp);
> >  
> > -	return (ret & 0xd) == (gp->active_val & 0xd);
> > +	return (ret & 0x1) == (gp->active_val & 0x1);
> >  }
> >  
> >  static int read_audio_gpio(struct pmac_gpio *gp)

This (sort of) breaks PowerMac3,4 (69 (PowerMac G4 Silver)). I have to
force it on up to now, but with this patch the internal speaker will not
work with or without my patch to force it on.

I get these values:

check_audio_gpio gp c040fc14 addr 0000006f ret 00000007
check_audio_gpio gp c040fbfc addr 00000070 ret 00000004

With speakers plugged in, both give 0x07

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50:
linux,device     cfdc7808
name             "gpio"
linux,phandle    ff90fcd0
reg              00000050 00000030
built-in        
device_type      "gpio"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/extint-gpio16:
name             "extint-gpio16"
linux,phandle    ff910a00
interrupt-parent ff90fa80
interrupts       0000003e 00000000
AAPL,address     80000068
built-in        
one-wire-bus     "speaker-id"
AAPL,driver-name ".DallasDriver"
compatible       "keywest-gpio16"
device_type      "extint-gpio16"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/extint-gpio15:
name             "extint-gpio15"
linux,phandle    ff9107f8
interrupt-parent ff90fa80
interrupts       0000003d 00000000
AAPL,address     80000067
built-in        
compatible       "keywest-gpio15"
device_type      "extint-gpio15"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/gpio11:
name             "gpio11"
linux,phandle    ff9105f8
AAPL,address     80000075
built-in        
audio-gpio-active-state 00000000
audio-gpio       "audio-hw-reset"
compatible       "keywest-11"
device_type      "gpio11"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/gpio6:
name             "gpio6"
linux,phandle    ff910400
AAPL,address     80000070
built-in        
audio-gpio-active-state 00000000
audio-gpio       "amp-mute"
compatible       "keywest-6"
device_type      "gpio6"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/gpio5:
name             "gpio5"
linux,phandle    ff910208
AAPL,address     8000006f
built-in        
audio-gpio-active-state 00000000
audio-gpio       "headphone-mute"
compatible       "keywest-5"
device_type      "gpio5"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/programmer-switch:
name             "programmer-switch"
linux,phandle    ff910058
interrupt-parent ff90fa80
interrupts       00000037 00000000
built-in        
device_type      "programmer-switch"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/extint-gpio1:
name             "extint-gpio1"
linux,phandle    ff90fe38
AAPL,interrupt-priorities 00000001
interrupt-parent ff90fa80
interrupts       0000002f 00000001
built-in        
compatible       "keywest-gpio1"
device_type      "extint-gpio1"

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

* Re: [Alsa-devel] Re: [PPC,SOUND] Fix audio gpio state detection
  2006-02-26 17:39   ` Olaf Hering
@ 2006-02-26 19:19     ` Lee Revell
  2006-02-26 19:26       ` Olaf Hering
  2006-03-01 22:30     ` Olaf Hering
  1 sibling, 1 reply; 13+ messages in thread
From: Lee Revell @ 2006-02-26 19:19 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc-dev, alsa-devel, Ben Collins

On Sun, 2006-02-26 at 18:39 +0100, Olaf Hering wrote:
> /proc/device-tree/pci@f2000000/mac-io@17/gpio@50:
> linux,device     cfdc7808
> name             "gpio"
> linux,phandle    ff90fcd0
> reg              00000050 00000030
> built-in        
> device_type      "gpio"
> 

Argh, /proc abuse... "historical reasons" presumably?

Lee

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

* Re: [Alsa-devel] Re: [PPC,SOUND] Fix audio gpio state detection
  2006-02-26 19:19     ` [Alsa-devel] " Lee Revell
@ 2006-02-26 19:26       ` Olaf Hering
  0 siblings, 0 replies; 13+ messages in thread
From: Olaf Hering @ 2006-02-26 19:26 UTC (permalink / raw)
  To: Lee Revell; +Cc: linuxppc-dev, alsa-devel, Ben Collins

 On Sun, Feb 26, Lee Revell wrote:

> Argh, /proc abuse... "historical reasons" presumably?

No, the way it works.

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

* Re: [PPC,SOUND] Fix audio gpio state detection
  2006-02-26 17:39   ` Olaf Hering
  2006-02-26 19:19     ` [Alsa-devel] " Lee Revell
@ 2006-03-01 22:30     ` Olaf Hering
  2006-03-01 23:09       ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 13+ messages in thread
From: Olaf Hering @ 2006-03-01 22:30 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, alsa-devel, Ben Collins

 On Sun, Feb 26, Olaf Hering wrote:

>  On Mon, Feb 13, Benjamin Herrenschmidt wrote:
> 
> > On Sat, 2006-02-11 at 17:10 +0100, Andreas Schwab wrote:
> > > When booting with line out or headphone plugged, you won't hear anything.
> > > The problem is that after reset all channels are muted, but the actual
> > > value of the gpio port doesn't exactly match the active_val settings as
> > > expected by check_audio_gpio.  For example, the line_mute port is set to
> > > 7, but check_audio_gpio would expect 0xd or 0xf, thus its return value
> > > indicates that it is not active, even though it is.  AFAICS only looking
> > > at the low bit is enough to determine whether the port is active.
> > > 
> > > Signed-off-by: Andreas Schwab <schwab@suse.de>
> > > 
> > > Index: linux-2.6.16-rc2/sound/ppc/tumbler.c
> > > ===================================================================
> > > --- linux-2.6.16-rc2.orig/sound/ppc/tumbler.c	2006-02-03 19:43:50.000000000 +0100
> > > +++ linux-2.6.16-rc2/sound/ppc/tumbler.c	2006-02-11 03:46:30.000000000 +0100
> > > @@ -207,7 +207,7 @@ static int check_audio_gpio(struct pmac_
> > >  
> > >  	ret = do_gpio_read(gp);
> > >  
> > > -	return (ret & 0xd) == (gp->active_val & 0xd);
> > > +	return (ret & 0x1) == (gp->active_val & 0x1);
> > >  }
> > >  
> > >  static int read_audio_gpio(struct pmac_gpio *gp)
> 
> This (sort of) breaks PowerMac3,4 (69 (PowerMac G4 Silver)). I have to
> force it on up to now, but with this patch the internal speaker will not
> work with or without my patch to force it on.

But the patch fixes also my PowerBook4,1, I dont have to toggle the headphone
once to get the built-in speakers enabled.
Looks like 2.6.16 stuff, but its been broken for so long now...

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

* Re: [PPC,SOUND] Fix audio gpio state detection
  2006-03-01 22:30     ` Olaf Hering
@ 2006-03-01 23:09       ` Benjamin Herrenschmidt
  2006-03-01 23:49         ` Ben Collins
  0 siblings, 1 reply; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2006-03-01 23:09 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc-dev, alsa-devel, Ben Collins


> > This (sort of) breaks PowerMac3,4 (69 (PowerMac G4 Silver)). I have to
> > force it on up to now, but with this patch the internal speaker will not
> > work with or without my patch to force it on.
> 
> But the patch fixes also my PowerBook4,1, I dont have to toggle the headphone
> once to get the built-in speakers enabled.
> Looks like 2.6.16 stuff, but its been broken for so long now...

What is the status of Ben's latest stuff ?

Ben.

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

* Re: [PPC,SOUND] Fix audio gpio state detection
  2006-03-01 23:09       ` Benjamin Herrenschmidt
@ 2006-03-01 23:49         ` Ben Collins
  2006-03-02  0:00           ` Olaf Hering
  2006-03-02  0:04           ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 13+ messages in thread
From: Ben Collins @ 2006-03-01 23:49 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, alsa-devel, Ben Collins, Olaf Hering

On Thu, 2006-03-02 at 10:09 +1100, Benjamin Herrenschmidt wrote:
> > > This (sort of) breaks PowerMac3,4 (69 (PowerMac G4 Silver)). I have to
> > > force it on up to now, but with this patch the internal speaker will not
> > > work with or without my patch to force it on.
> > 
> > But the patch fixes also my PowerBook4,1, I dont have to toggle the headphone
> > once to get the built-in speakers enabled.
> > Looks like 2.6.16 stuff, but its been broken for so long now...
> 
> What is the status of Ben's latest stuff ?

I'm rediffing now. However, I may not include my tumbler changes
immediately. For some reason, those are the ones causing problems. I
need to review the diff and see if I can find the problem (which I
cannot reproduce).

The toonie stuff is great. Been working really well for all the folks
I've heard from, and for me on my PowerBook5,9.

-- 
Ubuntu     - http://www.ubuntu.com/
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
SwissDisk  - http://www.swissdisk.com/

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

* Re: [PPC,SOUND] Fix audio gpio state detection
  2006-03-01 23:49         ` Ben Collins
@ 2006-03-02  0:00           ` Olaf Hering
  2006-03-02  0:04             ` Benjamin Herrenschmidt
  2006-03-02  0:04           ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 13+ messages in thread
From: Olaf Hering @ 2006-03-02  0:00 UTC (permalink / raw)
  To: Ben Collins; +Cc: linuxppc-dev, alsa-devel, Ben Collins

 On Wed, Mar 01, Ben Collins wrote:

> I'm rediffing now. However, I may not include my tumbler changes
> immediately. For some reason, those are the ones causing problems. I
> need to review the diff and see if I can find the problem (which I
> cannot reproduce).

Can you make individual patches, each one fixing one thing, going from A
to B.  You know that hch song...

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

* Re: [PPC,SOUND] Fix audio gpio state detection
  2006-03-01 23:49         ` Ben Collins
  2006-03-02  0:00           ` Olaf Hering
@ 2006-03-02  0:04           ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2006-03-02  0:04 UTC (permalink / raw)
  To: Ben Collins; +Cc: linuxppc-dev, alsa-devel, Ben Collins, Olaf Hering

On Wed, 2006-03-01 at 18:49 -0500, Ben Collins wrote:
> On Thu, 2006-03-02 at 10:09 +1100, Benjamin Herrenschmidt wrote:
> > > > This (sort of) breaks PowerMac3,4 (69 (PowerMac G4 Silver)). I have to
> > > > force it on up to now, but with this patch the internal speaker will not
> > > > work with or without my patch to force it on.
> > > 
> > > But the patch fixes also my PowerBook4,1, I dont have to toggle the headphone
> > > once to get the built-in speakers enabled.
> > > Looks like 2.6.16 stuff, but its been broken for so long now...
> > 
> > What is the status of Ben's latest stuff ?
> 
> I'm rediffing now. However, I may not include my tumbler changes
> immediately. For some reason, those are the ones causing problems. I
> need to review the diff and see if I can find the problem (which I
> cannot reproduce).
> 
> The toonie stuff is great. Been working really well for all the folks
> I've heard from, and for me on my PowerBook5,9.

There is an issue with some models where asserting both mutes will reset
the codec, so you have to be careful with that. Then, there is the
old-style GPIOs where you can read the polarity from the device-tree and
the new style ones...

I _think_ apple uses the GPIO platform functions only on machines that
have "include-k2-support" property in macio too, so maybe you are trying
to use them on earlier machines and they are bogus...

Send me the complete patch and I'll see if I spot something. Olaf, can
you give me quick summary of the machines that have problems with  Ben's
code ?

Ben.

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

* Re: [PPC,SOUND] Fix audio gpio state detection
  2006-03-02  0:00           ` Olaf Hering
@ 2006-03-02  0:04             ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2006-03-02  0:04 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc-dev, alsa-devel, Ben Collins

On Thu, 2006-03-02 at 01:00 +0100, Olaf Hering wrote:
>  On Wed, Mar 01, Ben Collins wrote:
> 
> > I'm rediffing now. However, I may not include my tumbler changes
> > immediately. For some reason, those are the ones causing problems. I
> > need to review the diff and see if I can find the problem (which I
> > cannot reproduce).
> 
> Can you make individual patches, each one fixing one thing, going from A
> to B.  You know that hch song...

In that case, it's difficult as it's more like a rewrite of the GPIO
handling from scratch (well... almost)

Ben.

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

end of thread, other threads:[~2006-03-02  0:04 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-11 16:10 [PPC,SOUND] Fix audio gpio state detection Andreas Schwab
2006-02-12 22:35 ` Benjamin Herrenschmidt
2006-02-12 22:46   ` Ben Collins
2006-02-12 23:27     ` Benjamin Herrenschmidt
2006-02-26 17:39   ` Olaf Hering
2006-02-26 19:19     ` [Alsa-devel] " Lee Revell
2006-02-26 19:26       ` Olaf Hering
2006-03-01 22:30     ` Olaf Hering
2006-03-01 23:09       ` Benjamin Herrenschmidt
2006-03-01 23:49         ` Ben Collins
2006-03-02  0:00           ` Olaf Hering
2006-03-02  0:04             ` Benjamin Herrenschmidt
2006-03-02  0:04           ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).