linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add Mac mini sound support
@ 2005-04-09 11:51 Per Christian Henden
  2005-04-09 23:28 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Per Christian Henden @ 2005-04-09 11:51 UTC (permalink / raw)
  To: benh; +Cc: linux-kernel

The patch below adds sound support on the Mac Mini by making a small change to the PowerMac sound card detection code.

Details: 

Original code:
>From sound/ppc/pmac.c  __init snd_pmac_detect(pmac_t *chip) :

 chip->model = PMAC_AWACS;
 ...
 if (device_is_compatible(sound, "AOAKeylargo")) {
  ...
  chip->model = PMAC_SNAPPER;
  ...
 }

The chip model is first set to AWACS, then because the check above returns true, it gets set to SNAPPER.
Using AWACS gives perfect sound, using SNAPPER gives no sound at all, so it should use AWACS instead.
Note that the mixer still doesn't work.

My simple patch makes the mentioned check return false on a Mac Mini.

Patch against 2.6.12-rc2:

diff -urpN -X dontdiff linux-2.6.12-rc2.orig/sound/ppc/pmac.c linux-2.6.12-rc2/sound/ppc/pmac.c
--- linux-2.6.12-rc2.orig/sound/ppc/pmac.c      2005-04-09 11:59:18.000000000 +0200
+++ linux-2.6.12-rc2/sound/ppc/pmac.c   2005-04-09 12:35:50.000000000 +0200
@@ -904,6 +904,8 @@ static int __init snd_pmac_detect(pmac_t
        else if (machine_is_compatible("PowerBook1,1")
                 || machine_is_compatible("AAPL,PowerBook1998"))
                chip->is_pbook_G3 = 1;
+       else if (machine_is_compatible("PowerMac10,1"))
+               chip->is_macmini = 1;
        chip->node = find_devices("awacs");
        if (chip->node)
                return 0; /* ok */
@@ -961,7 +963,7 @@ static int __init snd_pmac_detect(pmac_t
                chip->freq_table = tumbler_freqs;
                chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */
        }
-       if (device_is_compatible(sound, "AOAKeylargo")) {
+       if (device_is_compatible(sound, "AOAKeylargo") && chip->is_macmini!=1) {
                /* Seems to support the stock AWACS frequencies, but has
                   a snapper mixer */
                chip->model = PMAC_SNAPPER;
diff -urpN -X dontdiff linux-2.6.12-rc2.orig/sound/ppc/pmac.h linux-2.6.12-rc2/sound/ppc/pmac.h
--- linux-2.6.12-rc2.orig/sound/ppc/pmac.h      2005-03-02 08:38:12.000000000 +0100
+++ linux-2.6.12-rc2/sound/ppc/pmac.h   2005-04-09 12:04:42.000000000 +0200
@@ -110,6 +110,7 @@ struct snd_pmac {
        unsigned int has_iic : 1;
        unsigned int is_pbook_3400 : 1;
        unsigned int is_pbook_G3 : 1;
+       unsigned int is_macmini : 1;

        unsigned int can_byte_swap : 1;
        unsigned int can_duplex : 1;


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

The patch was tested by checking if I got sound support with the patch applied on my Mac Mini.

Thanks to Owen Stampflee at Yellowdog Linux for discovering that sound works when setting chip->model=PMAC_AWACS on the mini.

Please CC replies.

Cheers,
Per Christian Henden

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

* Re: [PATCH] Add Mac mini sound support
  2005-04-09 11:51 [PATCH] Add Mac mini sound support Per Christian Henden
@ 2005-04-09 23:28 ` Benjamin Herrenschmidt
  2005-04-11 17:12   ` Per Christian Henden
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2005-04-09 23:28 UTC (permalink / raw)
  To: Per Christian Henden; +Cc: Linux Kernel list

On Sat, 2005-04-09 at 13:51 +0200, Per Christian Henden wrote:
> The patch below adds sound support on the Mac Mini by making a small change to the PowerMac sound card detection code.
> 
> Details: 
> 
> Original code:
> >From sound/ppc/pmac.c  __init snd_pmac_detect(pmac_t *chip) :
> 
>  chip->model = PMAC_AWACS;
>  ...
>  if (device_is_compatible(sound, "AOAKeylargo")) {
>   ...
>   chip->model = PMAC_SNAPPER;
>   ...
>  }
> 
> The chip model is first set to AWACS, then because the check above returns true, it gets set to SNAPPER.
> Using AWACS gives perfect sound, using SNAPPER gives no sound at all, so it should use AWACS instead.
> Note that the mixer still doesn't work.
> 
> My simple patch makes the mentioned check return false on a Mac Mini.

And is not correct. It might appear to work but it is not the right
thing to do. There is no AWACS chip in there. There is a fixed function
codec controlled by a couple of GPIOs afaik. I'm working on a major
rework of the alsa driver that will include support for the mini and the
G5s.

Ben.



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

* Re: [PATCH] Add Mac mini sound support
  2005-04-09 23:28 ` Benjamin Herrenschmidt
@ 2005-04-11 17:12   ` Per Christian Henden
  0 siblings, 0 replies; 3+ messages in thread
From: Per Christian Henden @ 2005-04-11 17:12 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Linux Kernel list

On Sunday 10 April 2005 01:28, Benjamin Herrenschmidt wrote:
> On Sat, 2005-04-09 at 13:51 +0200, Per Christian Henden wrote:
> > The patch below adds sound support on the Mac Mini by making a small 
change to the PowerMac sound card detection code.
[Snip, details]
> And is not correct. It might appear to work but it is not the right
> thing to do. There is no AWACS chip in there. There is a fixed function
> codec controlled by a couple of GPIOs afaik. I'm working on a major
> rework of the alsa driver that will include support for the mini and the
> G5s.

Ok. It /does/ work, I've been using the AWACS driver for weeks now, and I 
don't have any stability or audio issues (that I notice), and my Mini is on 
24/7.

People that want sound support on their Minis right away can use this patch 
while waiting for the rework of the drivers, without fear of their computer 
exploding or so.

Cheers, 

PER

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

end of thread, other threads:[~2005-04-11 17:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-09 11:51 [PATCH] Add Mac mini sound support Per Christian Henden
2005-04-09 23:28 ` Benjamin Herrenschmidt
2005-04-11 17:12   ` Per Christian Henden

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).