Through a gross hack, I was able to get the pxa-uda1380 sound driver to
attach to the sound card. I can set mixer levels and "play" sound, but
it comes out all wrong.
Lots of modules are needed:
snd_pxa_uda1380 7368 0 - Live 0xbf0c1000
snd_uda1380 8488 1 snd_pxa_uda1380, Live 0xbf0bd000
snd_pxa_i2s 2272 0 - Live 0xbf0bb000
snd_i2c 4800 0 - Live 0xbf0b8000
snd_pcm_oss 56356 0 - Live 0xbf0a9000
snd_pcm 92648 2 snd_pxa_uda1380,snd_pcm_oss, Live 0xbf091000
snd_page_alloc 6436 1 snd_pcm, Live 0xbf08e000
snd_timer 22184 1 snd_pcm, Live 0xbf087000
snd_mixer_oss 16864 1 snd_pcm_oss, Live 0xbf081000
snd 47388 7
snd_pxa_uda1380,snd_uda1380,snd_i2c,snd_pcm_oss,snd_pcm,snd_timer,snd_mixer_oss,
Live 0xbf074000
soundcore 7016 1 snd, Live 0xbf071000
i2c_pxa 4284 0 - Live 0xbf06e000
i2c_algo_pxa 3584 2 i2c_pxa,[unsafe],[permanent], Live 0xbf06c000
i2c_core 18308 3 snd_pxa_uda1380,snd_uda1380,i2c_algo_pxa, Live 0xbf066000
Hold your nose: attached is an *ugly* patch that gets sound to this
point. (Don't even think about committing it in this state!) I wanted to
make it available so someone else could pick it up and run with it.
We'll need to figure out a clean way to conditionalize for the machine
type (h3900, h2200, h19xx), and how to replace the
h3600_audio_{power|mute} functions. But first it would be nice to hear
real sound come out. :-)
Matt
Index: sound/arm/pxa-uda1380.c
===================================================================
RCS file: /cvs/linux/kernel26/sound/arm/pxa-uda1380.c,v
retrieving revision 1.2
diff -u -p -r1.2 pxa-uda1380.c
--- sound/arm/pxa-uda1380.c 16 Dec 2003 23:16:49 -0000 1.2
+++ sound/arm/pxa-uda1380.c 27 Mar 2004 20:28:48 -0000
@@ -62,13 +62,14 @@ Copyright (c) 2000 Nicolas Pitre <nico@c
#include <asm/hardware.h>
#include <asm/dma.h>
#include <asm/arch-pxa/h3900_asic.h>
+#include <asm/arch-pxa/h2200-gpio.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/initval.h>
#undef DEBUG
-#define DEBUG 1
+/*#define DEBUG 1*/
#ifdef DEBUG
#define DPRINTK( format, x... ) printk( format, ## x )
#else
@@ -242,16 +243,21 @@ static void pxa_uda1380_audio_init(pxa_u
/* Blip the UDA1380 reset line */
local_irq_save(flags);
- H3900_ASIC3_GPIO_B_OUT |= GPIO3_AUD_RESET;
+/*mjr H3900_ASIC3_GPIO_B_OUT |= GPIO3_AUD_RESET; */
+SET_H2200_GPIO(CODEC_RESET, 1);
local_irq_restore(flags);
/* Enable the audio power */
- h3600_audio_power(audio_samplerate);
+/*mjr h3600_audio_power(audio_samplerate);*/
+SET_H2200_GPIO(CODEC_ON, 1);
+SET_H2200_GPIO(SPEAKER_ON, 1);
+SET_H2200_GPIO(TDA_MODE, 0);
mdelay(1);
local_irq_save(flags);
- H3900_ASIC3_GPIO_B_OUT &= ~GPIO3_AUD_RESET;
+/*mjr H3900_ASIC3_GPIO_B_OUT &= ~GPIO3_AUD_RESET;*/
+SET_H2200_GPIO(CODEC_RESET, 0);
local_irq_restore(flags);
/* Wait for the UDA1380 to wake up */
@@ -262,7 +268,7 @@ static void pxa_uda1380_audio_init(pxa_u
pxa_uda1380_set_samplerate(pxa_uda1380, pxa_uda1380->samplerate, 1);
- h3600_audio_mute(0);
+/*mjr h3600_audio_mute(0);*/
DPRINTK("%s done\n", __FUNCTION__);
}
@@ -271,13 +277,13 @@ static void pxa_uda1380_audio_shutdown(p
{
DPRINTK("%s\n", __FUNCTION__);
- h3600_audio_mute(1);
+/*mjr h3600_audio_mute(1);*/
i2c_clients_command(pxa_uda1380->uda1380->adapter, I2C_UDA1380_CLOSE, 0);
PXA_SACR0 = 0;
PXA_SACR1 = 0;
- h3600_audio_power(0);
+/*mjr h3600_audio_power(0);*/
DPRINTK("%s done\n", __FUNCTION__);
}
@@ -836,8 +842,8 @@ static int __init snd_card_pxa_uda1380_p
// isa works but I'm not sure why (or if) it's the right choice
// this may be too large, trying it for now
- //err = snd_pcm_lib_preallocate_pages_for_all(pxa_uda1380->pcm, 64*1024, 64*1024, GFP_KERNEL | GFP_DMA);
- err = snd_pcm_lib_preallocate_isa_pages_for_all(pxa_uda1380->pcm, 64*1024, 64*1024);
+ err = snd_pcm_lib_preallocate_pages_for_all(pxa_uda1380->pcm, 64*1024, 64*1024, GFP_KERNEL | GFP_DMA);
+ //err = snd_pcm_lib_preallocate_isa_pages_for_all(pxa_uda1380->pcm, 64*1024, 64*1024);
if (err < 0) {
printk("preallocate failed with code %d\n", err);
}
@@ -959,10 +965,10 @@ static int __init pxa_uda1380_init(void)
snd_card_t *card;
DPRINTK("pxa_uda1380_init\n");
-
+/*
if (!machine_is_h3900())
return -ENODEV;
-
+*/
/* register the soundcard */
card = snd_card_new(-1, id, THIS_MODULE, 0);
if (card == NULL)
@@ -979,7 +985,10 @@ static int __init pxa_uda1380_init(void)
/* try to bring in i2c support */
request_module("i2c-adap-pxa");
+/*
pxa_uda1380->uda1380 = i2c_get_client(I2C_DRIVERID_UDA1380, I2C_ALGO_PXA, NULL);
+*/
+ pxa_uda1380->uda1380 = uda1380;
if (!pxa_uda1380->uda1380) {
printk("cannot find mixer!\n");
}
Index: sound/i2c/uda1380.c
===================================================================
RCS file: /cvs/linux/kernel26/sound/i2c/uda1380.c,v
retrieving revision 1.1
diff -u -p -r1.1 uda1380.c
--- sound/i2c/uda1380.c 16 Dec 2003 16:18:19 -0000 1.1
+++ sound/i2c/uda1380.c 27 Mar 2004 20:28:48 -0000
@@ -85,6 +85,9 @@ Supported Alsa controls:
#include <asm/arch-sa1100/h3600_asic.h>
#include <asm/arch-pxa/h3900_asic.h>
#endif
+#include <asm/arch-pxa/hardware.h>
+#include <asm/arch-pxa/h2200-gpio.h>
+
/* code from uda1380.c. basically just an ALSA interface around this */
@@ -138,7 +141,8 @@ typedef struct uda1380 uda1380_t;
typedef struct i2c_client i2c_client_t;
#define chip_t i2c_client_t
-static struct i2c_client *uda1380=NULL;
+struct i2c_client *uda1380=NULL;
+EXPORT_SYMBOL(uda1380);
static void uda1380_write_reg(struct i2c_client *clnt, struct uda1380 *uda, int regaddr)
{
@@ -360,6 +364,7 @@ int uda1380_mute(struct i2c_client *clnt
return ret;
}
+EXPORT_SYMBOL(uda1380_mute);
/* ALSA specific code */
@@ -504,6 +509,8 @@ static int __init uda1380_init(void)
#ifdef CONFIG_ARCH_H3900
H3900_ASIC3_GPIO_B_OUT |= GPIO3_AUD_PWR_ON;
#endif
+SET_H2200_GPIO(CODEC_ON, 1);
+
return i2c_add_driver(&uda1380_driver);
}
@@ -515,6 +522,7 @@ static void __exit uda1380_exit(void)
#ifdef CONFIG_ARCH_H3900
H3900_ASIC3_GPIO_B_OUT &= ~GPIO3_AUD_PWR_ON;
#endif
+SET_H2200_GPIO(CODEC_ON, 0);
}
static struct i2c_client client_template = {
@@ -548,6 +556,8 @@ static int uda1380_attach(struct i2c_ada
clnt->adapter = adap;
clnt->addr = addr;
strcpy(clnt->name, "uda1380");
+ uda1380 = clnt;
+DPRINTK("uda1380_attach: clnt is 0x%08x\n", clnt);
i2c_attach_client(clnt);
@@ -743,11 +753,13 @@ int snd_chip_uda1380_mixer_new(snd_card_
DPRINTK("%s:\n", __FUNCTION__);
snd_assert(card != NULL, return -EINVAL);
-
+/*
*clnt = i2c_get_client(I2C_DRIVERID_UDA1380, I2C_ALGO_PXA, NULL);
if (!clnt)
printk("uda1380 panic: connot get i2c client\n");
uda1380 = *clnt;
+*/
+printk("snd_chip_uda1380_mixer_new: uda1380 is 0x%08x\n", uda1380);
for (idx = 0; idx < UDA1380_CONTROLS; idx++) {
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_uda1380_controls[idx], uda1380))) < 0)
@@ -773,11 +785,13 @@ int snd_chip_uda1380_mixer_new(snd_card_
return 0;
}
+EXPORT_SYMBOL(snd_chip_uda1380_mixer_new);
void snd_chip_uda1380_mixer_del(snd_card_t *card)
{
DPRINTK("uda1380 mixer_del\n");
}
+EXPORT_SYMBOL(snd_chip_uda1380_mixer_del);
module_init(uda1380_init);
module_exit(uda1380_exit);
Index: sound/i2c/uda1380.h
===================================================================
RCS file: /cvs/linux/kernel26/sound/i2c/uda1380.h,v
retrieving revision 1.1
diff -u -p -r1.1 uda1380.h
--- sound/i2c/uda1380.h 16 Dec 2003 16:18:19 -0000 1.1
+++ sound/i2c/uda1380.h 27 Mar 2004 20:28:48 -0000
@@ -233,6 +233,8 @@ struct i2c_agc {
#define DEC_AGC_EN (1 << 0)
+extern struct i2c_client *uda1380;
+
int uda1380_command(struct i2c_client *clnt, unsigned int cmd, void *arg);
int snd_chip_uda1380_mixer_new(snd_card_t *card, struct i2c_client **clnt);
void snd_chip_uda1380_mixer_del(snd_card_t *card);
Received on Sat Mar 27 20:34:42 2004
This archive was generated by hypermail 2.1.8 : Tue May 04 2004 - 09:41:47 EDT