NetBSD Problem Report #40054

From kilbi@kilbi.de  Fri Nov 28 14:42:24 2008
Return-Path: <kilbi@kilbi.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id E47BA63B8BD
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 28 Nov 2008 14:42:24 +0000 (UTC)
Message-Id: <20081128144111.0B74010492@mail.kilbi.de>
Date: Fri, 28 Nov 2008 15:41:10 +0100 (MET)
From: mk@kilbi.de
Reply-To: mk@kilbi.de
To: gnats-bugs@gnats.NetBSD.org
Subject: powerbook g4/500 titanium problem with netbsd-5: no speaker output w/ awacs
X-Send-Pr-Version: 3.95

>Number:         40054
>Category:       port-macppc
>Synopsis:       powerbook g4/500 titanium with netbsd-5 kernel and awacs audio can no longer produce builtin speaker output
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-macppc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 28 14:45:00 +0000 2008
>Last-Modified:  Sat Nov 29 09:00:03 +0000 2008
>Originator:     Markus W Kilbinger
>Release:        NetBSD 5.0_BETA
>Organization:
>Environment:


System: NetBSD 5.0_BETA (MAC) #2: Fri Nov 28 09:24:53 MET 2008  root@qie:/usr/u/NetBSD/netbsd-5/src/sys/arch/macppc/compile/MAC macppc
Architecture: powerpc
Machine: macppc
>Description:

	On my powerbook g4/500 titanium installed with a netbsd-4
	userland (and kernel for normal use) I tried to use an actual
	customized (mainly awacs activated and fwohci deactivated (see
	pr #40051)) netbsd-5 kernel. 'awacs'/'audio' seems to be
	detected correctly (dmesg excerpt):

	  awacs0 at obio0 offset 0x14000 Screamer: irq 24,9,10
	  awacs0: speaker
	  audio0 at awacs0: full duplex

	, but there is no hear-able built-in speaker output.

	But there _is_ hear-able/normal audio headphone output if I
	plug in a headphone!? If I remove the headphone there is still
	no built-in speaker output.

	With the netbsd-4 kernel dmesg output looks shorter:

	  awacs0 at obio0 offset 0x14000: irq 24,9,10
	  audio0 at awacs0: full duplex

	, but built-inspeaker output works! To activate headphones
	output I had to manually switch it via 'mixerctl':

	  mixerctl -w monitor.output=headphones

	, which seems to be done automatically with the netbsd-5
	kernel.
>How-To-Repeat:
	Boot a customized, 'awacs' and 'audio at awacs' activated,
	netbsd-5 kernel on a powerbook g4/500 titanium and try to
	produce built-in speaker output ('ogg123 test.ogg' in my
	case). Built-in speaker output does not not work for me, but
	just plugging in headphones produce normal headphones output.
>Fix:
	Unknown.

>Audit-Trail:
From: Michael <macallan@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: port-macppc-maintainer@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: port-macppc/40054: powerbook g4/500 titanium problem with netbsd-5: no speaker output w/ awacs
Date: Fri, 28 Nov 2008 19:49:18 -0500

 Sounds like you just found Yet Another Wiring Variant for awacs'  
 headphone detect gpio.
 Please try this pseudo patch to macppc/dev/awacs.c:
 static int
 awacs_check_headphones(struct awacs_softc *sc)
 {
          uint32_t reg;
          reg = awacs_read_reg(sc, AWACS_CODEC_STATUS);
 -        DPRINTF("%s: codec status reg %08x\n", device_xname(sc- 
  >sc_dev), reg);
 +        printf("%s: codec status reg %08x\n", device_xname(sc- 
  >sc_dev), reg);
          return ((reg & sc->sc_headphones_mask) == sc- 
  >sc_headphones_in);
 }

 Boot a kernel with this and then plug and unplug headphones a few  
 times. The kernel should output the gpio readings every time you  
 (un)plug them. Please mail me the output, this should help me to find  
 out which bit is the headphone status on your particular PowerBook.
 Alternatively you can just add 'options AWACS_DEBUG' to your kernel  
 config but that would probably give too much output.
 Also, please tell me what's in your PowerBook's /compatible property  
 ( Should be something like 'PowerBook5,3' ) so I can add a machine- 
 specific entry to awacs' quirks table.

From: Markus W Kilbinger <mk@kilbi.de>
To: Michael <macallan@netbsd.org>
Cc: gnats-bugs@NetBSD.org,
    port-macppc-maintainer@netbsd.org,
    gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: Re: port-macppc/40054: powerbook g4/500 titanium problem with netbsd-5: no speaker output w/ awacs
Date: Sat, 29 Nov 2008 09:53:37 +0100

 >>>>> "macallan" == Michael  <macallan@netbsd.org> writes:

     macallan> Sounds like you just found Yet Another Wiring Variant
     macallan> for awacs' headphone detect gpio.

 Hopefully it's that easy...

     macallan> Please try this pseudo
     macallan> patch to macppc/dev/awacs.c: static int
     macallan> awacs_check_headphones(struct awacs_softc *sc) {
     macallan>          uint32_t reg; reg = awacs_read_reg(sc,
     macallan>          AWACS_CODEC_STATUS);
     macallan> - DPRINTF("%s: codec status reg %08x\n",
     macallan>          device_xname(sc-
     >> sc_dev), reg);
     macallan> + printf("%s: codec status reg %08x\n", device_xname(sc-
     >> sc_dev), reg);
     macallan>          return ((reg & sc->sc_headphones_mask) == sc-
     >> sc_headphones_in);
     macallan> }

     macallan> Boot a kernel with this and then plug and unplug
     macallan> headphones a few times. The kernel should output the
     macallan> gpio readings every time you (un)plug them. Please mail
     macallan> me the output, this should help me to find out which bit
     macallan> is the headphone status on your particular PowerBook.

 I did: 'awacs' related kernel output is:

   awacs0 at obio0 offset 0x14000 Screamer: irq 24,9,10
   awacs0: awacs0: codec status reg 00403100
   speaker
   audio0 at awacs0: full duplex

 Headphones plug in yields:  <------------
                                         |
   awacs0: codec status reg 00403108     |
                                         |
 Headphones unplugging yields:           |
                                         |
   awacs0: codec status reg 00403100     |
                                         |
 ... and so on.  -------------------------

 'mixerctl monitor.output' correctly reflects the headphones plug-in
 state by stating

   monitor.output=speaker

 if no headphones are plugged in and

   monitor.output=headphones

 if they are plugged in.

     macallan> Also, please tell me what's in your PowerBook's
     macallan> /compatible property ( Should be something like
     macallan> 'PowerBook5,3' ) so I can add a machine- specific entry
     macallan> to awacs' quirks table.

 'ofctl -p' excerpt (incl. awacs part):

   [Caching 94 nodes and 746 properties]
   ff83c1c8: /device-tree

   model                   506f7765 72426f6f 6b332c32 00......   "PowerBook3,2"
   compatible              506f7765 72426f6f 6b332c32 00......   "PowerBook3,2"
               000d:       4d616352 49534332 00...... ........   "MacRISC2"
               0016:       4d616352 49534300 ........ ........   "MacRISC"
               001e:       506f7765 72204d61 63696e74 6f736800   "Power Macintosh"


   ff912728: /pci@f2000000/mac-io@17/davbus@14000/sound

   name                    736f756e 6400.... ........ ........   "sound"
   device_type             736f756e 64636869 7000.... ........   "soundchip"
   compatible              73637265 616d6572 00...... ........   "screamer"
               0009:       61776163 7300.... ........ ........   "awacs"
               000f:       00...... ........ ........ ........   ""
   model                   33343353 30313834 00...... ........   "343S0184"
   vendor-id               0000106b ........ ........ ........   ...k
   device-id               0000000d ........ ........ ........   ....
   #-detects               00000001 ........ ........ ........   ....
   #-inputs                00000004 ........ ........ ........   ....
   #-features              00000001 ........ ........ ........   ....
   #-outputs               00000002 ........ ........ ........   ....
   object-model-version    00000001 ........ ........ ........   ....
   sub-frame               00000000 ........ ........ ........   ....
   icon-id                 ffffbf4d ........ ........ ........   ...M
   info-id                 ffffbf44 ........ ........ ........   ...D
   name-id                 ffffbf4d ........ ........ ........   ...M
   sample-rates            00000003 2b110000 56220000 ac440000   ....+...V"...D..
   default-monitor         6e6f6e65 ........ ........ ........   none
   sound-objects           66656174 75726520 696e6465 78203020   feature index 0 
               0010:       6d6f6465 6c205072 6f6a3130 506f7765   model Proj10Powe
               0020:       72436f6e 74726f6c 00646574 65637420   rControl.detect 
               0030:       6269742d 6d61736b 20312062 69742d6d   bit-mask 1 bit-m
               0040:       61746368 20312064 65766963 65203220   atch 1 device 2 
               0050:       696e6465 78203020 6d6f6465 6c20496e   index 0 model In
               0060:       53656e73 65426974 73446574 65637400   SenseBitsDetect.
               0070:       696e7075 74206963 6f6e2d69 64202d31   input icon-id -1
               0080:       36353235 20696e64 65782030 206e616d   6525 index 0 nam
               0090:       652d6964 202d3230 35333220 20706f72   e-id -20532  por
               00a0:       742d636f 6e6e6563 74696f6e 20312070   t-connection 1 p
               00b0:       6f72742d 74797065 20307836 39364436   ort-type 0x696D6
               00c0:       39363320 7a65726f 2d676169 6e203078   963 zero-gain 0x
               00d0:       30303039 30303030 206d6f64 656c2049   00090000 model I
               00e0:       6e746572 6e616c4d 69630069 6e707574   nternalMic.input
               00f0:       2069636f 6e2d6964 202d3230 31383420    icon-id -20184 
               0100:       696e6465 78203120 6e616d65 2d696420   index 1 name-id 
               0110:       2d323035 34302070 6f72742d 636f6e6e   -20540 port-conn
               0120:       65637469 6f6e2032 20706f72 742d7479   ection 2 port-ty
               0130:       70652030 78364436 46363436 44207a65   pe 0x6D6F646D ze
               0140:       726f2d67 61696e20 30206d6f 64656c20   ro-gain 0 model 
               0150:       496e7075 74506f72 7400696e 70757420   InputPort.input 
               0160:       69636f6e 2d696420 2d323031 38352069   icon-id -20185 i
               0170:       6e646578 2032206e 616d652d 6964202d   ndex 2 name-id -
               0180:       32303534 3120706f 72742d63 6f6e6e65   20541 port-conne
               0190:       6374696f 6e203320 706f7274 2d747970   ction 3 port-typ
               01a0:       65203078 37413736 37303633 207a6572   e 0x7A767063 zer
               01b0:       6f2d6761 696e2030 206d6f64 656c2049   o-gain 0 model I
               01c0:       6e707574 506f7274 00696e70 75742069   nputPort.input i
               01d0:       6e646578 2033206d 6f64656c 204e6f49   ndex 3 model NoI
               01e0:       6e707574 006f7574 70757420 64657669   nput.output devi
               01f0:       63652d6d 61736b20 32206465 76696365   ce-mask 2 device
               0200:       2d6d6174 63682030 2069636f 6e2d6964   -match 0 icon-id
               0210:       202d3136 35363320 696e6465 78203020    -16563 index 0 
               0220:       6e616d65 2d696420 2d323035 32352070   name-id -20525 p
               0230:       6f72742d 636f6e6e 65637469 6f6e2032   ort-connection 2
               0240:       20706f72 742d7479 70652030 78363937    port-type 0x697
               0250:       33373036 42206d6f 64656c20 4f757470   3706B model Outp
               0260:       7574506f 7274006f 75747075 74206465   utPort.output de
               0270:       76696365 2d6d6173 6b203220 64657669   vice-mask 2 devi
               0280:       63652d6d 61746368 20322069 636f6e2d   ce-match 2 icon-
               0290:       6964202d 31363536 3320696e 64657820   id -16563 index 
               02a0:       31206e61 6d652d69 64202d32 30353234   1 name-id -20524
               02b0:       20706f72 742d636f 6e6e6563 74696f6e    port-connection
               02c0:       20312070 6f72742d 74797065 20307836    1 port-type 0x6
               02d0:       38363437 30364520 6d6f6465 6c204f75   864706E model Ou
               02e0:       74707574 506f7274 000000.. ........   tputPort...

   --------------------------------------------------------------------------------

 Regards, Markus.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.