Re: [PATCH] ppc64: very basic desktop g5 sound support (#2)

2005-04-12 Thread Andreas Schwab
Benjamin Herrenschmidt <[EMAIL PROTECTED]> writes:

> This patch hacks the current PowerMac Alsa driver to add some basic
> support of analog sound output to some desktop G5s. It has severe
> limitations though:
>
>  - Only 44100Khz 16 bits
>  - Only work on G5 models using a TAS3004 analog code, that is early
>single CPU desktops and all dual CPU desktops at this date, but none
>of the more recent ones like iMac G5.
>  - It does analog only, no digital/SPDIF support at all, no native
>AC3 support

On my PowerMac the internal speaker is now working, but unfortunately on
the line-out I get nearly no output.  I have pushed both the master and
pcm control to the maximum and still barely hear anything.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ppc64: very basic desktop g5 sound support (#2)

2005-04-12 Thread Christoph Hellwig
On Tue, Apr 12, 2005 at 09:32:19PM +0200, Andreas Schwab wrote:
> On my PowerMac the internal speaker is now working, but unfortunately on
> the line-out I get nearly no output.  I have pushed both the master and
> pcm control to the maximum and still barely hear anything.

Work fine for me, but I had to turn the volume to the max on the
external amplifier, so this is probably the same problem.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ppc64: very basic desktop g5 sound support (#2)

2005-04-12 Thread Linus Torvalds


On Tue, 12 Apr 2005, Lee Revell wrote:
> 
> Um... why in the heck are you posting this here instead of alsa-devel?

Which list do you think has more people interested? ppc64 or alsa?

Pretty much anybody with a G5 will probably be on the ppc lists. And 
_nobody_ will be on the alsa lists, since it historically has never had 
any sound at all.

In other words, don't believe that "sound" means that it must be an alsa 
list. Lists make sense not because of intent, but because of who they 
reach.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ppc64: very basic desktop g5 sound support (#2)

2005-04-12 Thread Lee Revell
On Tue, 2005-04-12 at 11:49 -0700, Linus Torvalds wrote:
> 
> On Tue, 12 Apr 2005, Lee Revell wrote:
> > 
> > Um... why in the heck are you posting this here instead of alsa-devel?
> 
> Which list do you think has more people interested? ppc64 or alsa?
> 

OK, makes sense.  I still think alsa-devel should be cc'ed, for code
review purposes.

Lee

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ppc64: very basic desktop g5 sound support (#2)

2005-04-12 Thread Andreas Schwab
Benjamin Herrenschmidt <[EMAIL PROTECTED]> writes:

> Doesn't work with version 2 of the patch ? neither the headphone nor the
> line out jack ?

Yes.

> hrm... does it properly detect insertion of the jack and mute the
> speaker in both cases ?

Yes, it does.

> Can you send me a tarball of your device-tree ?

Will do.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ppc64: very basic desktop g5 sound support (#2)

2005-04-12 Thread Benjamin Herrenschmidt
On Wed, 2005-04-13 at 00:33 +0200, Andreas Schwab wrote:
> Benjamin Herrenschmidt <[EMAIL PROTECTED]> writes:
> 
> > Yes, I noticed that too on some models, not sure what's up at this
> > point. What about the headphone jack on the front ? That one appears to
> > work.
> 
> Doesn't work either for me.  Well, I'll have keep my workaround a bit
> longer until you are ready with the rewrite.  Keep up the good work!

Doesn't work with version 2 of the patch ? neither the headphone nor the
line out jack ? hrm... does it properly detect insertion of the jack and
mute the speaker in both cases ? Can you send me a tarball of your
device-tree ?

Ben.
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ppc64: very basic desktop g5 sound support (#2)

2005-04-12 Thread Andreas Schwab
Benjamin Herrenschmidt <[EMAIL PROTECTED]> writes:

> Yes, I noticed that too on some models, not sure what's up at this
> point. What about the headphone jack on the front ? That one appears to
> work.

Doesn't work either for me.  Well, I'll have keep my workaround a bit
longer until you are ready with the rewrite.  Keep up the good work!

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ppc64: very basic desktop g5 sound support (#2)

2005-04-12 Thread Benjamin Herrenschmidt
On Tue, 2005-04-12 at 21:32 +0200, Andreas Schwab wrote:
> Benjamin Herrenschmidt <[EMAIL PROTECTED]> writes:
> 
> > This patch hacks the current PowerMac Alsa driver to add some basic
> > support of analog sound output to some desktop G5s. It has severe
> > limitations though:
> >
> >  - Only 44100Khz 16 bits
> >  - Only work on G5 models using a TAS3004 analog code, that is early
> >single CPU desktops and all dual CPU desktops at this date, but none
> >of the more recent ones like iMac G5.
> >  - It does analog only, no digital/SPDIF support at all, no native
> >AC3 support
> 
> On my PowerMac the internal speaker is now working, but unfortunately on
> the line-out I get nearly no output.  I have pushed both the master and
> pcm control to the maximum and still barely hear anything.

Yes, I noticed that too on some models, not sure what's up at this
point. What about the headphone jack on the front ? That one appears to
work.

Ben.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ppc64: very basic desktop g5 sound support (#2)

2005-04-12 Thread Benjamin Herrenschmidt
On Tue, 2005-04-12 at 11:49 -0700, Linus Torvalds wrote:
> 
> On Tue, 12 Apr 2005, Lee Revell wrote:
> > 
> > Um... why in the heck are you posting this here instead of alsa-devel?
> 
> Which list do you think has more people interested? ppc64 or alsa?
> 
> Pretty much anybody with a G5 will probably be on the ppc lists. And 
> _nobody_ will be on the alsa lists, since it historically has never had 
> any sound at all.
> 
> In other words, don't believe that "sound" means that it must be an alsa 
> list. Lists make sense not because of intent, but because of who they 
> reach.

Yah, that, and i intend to take over this driver, and this is really
only platform specific munging in the driver itself, I pretty much don't
change anything to the way the driver interfaces to Alsa.

Once I am done rewriting it completely (which I started doing but it
will take some time to complete) to get digital, AC3, etc... I will
submit the new one to alsa-devel though for comments.

Ben.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ppc64: very basic desktop g5 sound support (#2)

2005-04-12 Thread Lee Revell
On Tue, 2005-04-12 at 15:07 +1000, Benjamin Herrenschmidt wrote:
> Hi !
> 
> (Andrew: This is an update of the previous patch, it fixes a problem
> with headphone beeing incorrectly muted on some models).
> 
> This patch hacks the current PowerMac Alsa driver to add some basic
> support of analog sound output to some desktop G5s. It has severe
> limitations though:

Um... why in the heck are you posting this here instead of alsa-devel?

Lee

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ppc64: very basic desktop g5 sound support (#2)

2005-04-11 Thread Benjamin Herrenschmidt
Hi !

(Andrew: This is an update of the previous patch, it fixes a problem
with headphone beeing incorrectly muted on some models).

This patch hacks the current PowerMac Alsa driver to add some basic
support of analog sound output to some desktop G5s. It has severe
limitations though:

 - Only 44100Khz 16 bits
 - Only work on G5 models using a TAS3004 analog code, that is early
   single CPU desktops and all dual CPU desktops at this date, but none
   of the more recent ones like iMac G5.
 - It does analog only, no digital/SPDIF support at all, no native
   AC3 support

Better support would require a complete rewrite of the driver (which I
am working on,  but don't hold your breath), to properly support the
diversity of apple sound HW setup, including dual codecs, several i2s
busses,  all the new codecs used in the new machines, proper clock
switching with digital, etc etc etc...

This patch applies on top of the other PowerMac sound patches I posted
in the past couple of days (new powerbook support and sleep fixes). 

Note: This is a FAQ entry for PowerMac sound support with TI codecs:
They have a feature called "DRC" which is automatically enabled for the
internal speaker (at least when auto mute control is enabled) which will
cause your sound to fade out to nothing after half a second of playback
if you don't set a proper "DRC Range" in the mixer. So if you have a
problem like that, check alsamixer and raise your DRC Range to something
reasonable.

Note2: This patch will also add auto-mute of the speaker when line-out
jack is used on some earlier desktop G4s (and on the G5) in addition to
the headphone jack. If that behaviour isn't what you want, just disable
auto-muting and use the manual mute controls in alsamixer.

Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>

Index: linux-work/sound/ppc/pmac.c
===
--- linux-work.orig/sound/ppc/pmac.c2005-04-11 22:09:18.0 +1000
+++ linux-work/sound/ppc/pmac.c 2005-04-11 22:27:37.0 +1000
@@ -27,14 +27,13 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include "pmac.h"
 #include 
-#ifdef CONFIG_PPC_HAS_FEATURE_CALLS
 #include 
-#else
-#include 
-#endif
+#include 
 
 
 #if defined(CONFIG_PM) && defined(CONFIG_PMAC_PBOOK)
@@ -57,22 +56,29 @@
 /*
  * allocate DBDMA command arrays
  */
-static int snd_pmac_dbdma_alloc(pmac_dbdma_t *rec, int size)
+static int snd_pmac_dbdma_alloc(pmac_t *chip, pmac_dbdma_t *rec, int size)
 {
-   rec->space = kmalloc(sizeof(struct dbdma_cmd) * (size + 1), GFP_KERNEL);
+   unsigned int rsize = sizeof(struct dbdma_cmd) * (size + 1);
+
+   rec->space = dma_alloc_coherent(&chip->pdev->dev, rsize,
+   &rec->dma_base, GFP_KERNEL);
if (rec->space == NULL)
return -ENOMEM;
rec->size = size;
-   memset(rec->space, 0, sizeof(struct dbdma_cmd) * (size + 1));
+   memset(rec->space, 0, rsize);
rec->cmds = (void __iomem *)DBDMA_ALIGN(rec->space);
-   rec->addr = virt_to_bus(rec->cmds);
+   rec->addr = rec->dma_base + (unsigned long)((char *)rec->cmds - (char 
*)rec->space);
+
return 0;
 }
 
-static void snd_pmac_dbdma_free(pmac_dbdma_t *rec)
+static void snd_pmac_dbdma_free(pmac_t *chip, pmac_dbdma_t *rec)
 {
-   if (rec)
-   kfree(rec->space);
+   if (rec) {
+   unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1);
+
+   dma_free_coherent(&chip->pdev->dev, rsize, rec->space, 
rec->dma_base);
+   }
 }
 
 
@@ -237,7 +243,7 @@
/* continuous DMA memory type doesn't provide the physical address,
 * so we need to resolve the address here...
 */
-   offset = virt_to_bus(runtime->dma_area);
+   offset = runtime->dma_addr;
for (i = 0, cp = rec->cmd.cmds; i < rec->nperiods; i++, cp++) {
st_le32(&cp->phy_addr, offset);
st_le16(&cp->req_count, rec->period_size);
@@ -664,8 +670,8 @@
chip->capture.cur_freqs = chip->freqs_ok;
 
/* preallocate 64k buffer */
-   snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, 
- 
snd_dma_continuous_data(GFP_KERNEL),
+   snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 
+ &chip->pdev->dev,
  64 * 1024, 64 * 1024);
 
return 0;
@@ -757,28 +763,10 @@
 /*
  * a wrapper to feature call for compatibility
  */
-#if defined(CONFIG_PM) && defined(CONFIG_PMAC_PBOOK)
 static void snd_pmac_sound_feature(pmac_t *chip, int enable)
 {
-#ifdef CONFIG_PPC_HAS_FEATURE_CALLS
ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable);
-#else
-   if (chip->is_pbook_G3) {
-   pmu_suspend();
-   feature_clear(chip->node, FEATURE_Sound_power);
-   fea