Implement basic support for Creative emu1212m and emu1820m.
PATCH 1/1 Implement basic support for Creative emu1212m and emu1820m.
http://alsa-project.org/~james/alsa-driver/emu1212m/emu1212m-10.diff
This patch added some basic ALSA support for the Creative emu1212m and emu1820m
Please review.
What works:
Sound capture and playback to the Audio Dock works.
All sound is captured and played back via the FX bus so works well in jackd. Currently fixed to 48Khz, S32_LE format, 8 channels.
Requires:
The latest alsa-firmware package to be installed. (One firmware file for the FPGA on the EMU1010 PCI card, one firmware file for the FPGA on the Audio Dock.)
TODO:
Implement mixer controls to select different sources for capture. Implement switching between different rates. Currently done with #ifdef's in the source code. (Not a trivial task)
Implement support for hot plug of audio dock. (requires a kernel tasklet polling the device)
Implement some Ardour type interface to load DSP effects and control DSP routing.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
At Fri, 25 Aug 2006 19:18:08 +0100,
Quoted 7 lines · James Courtier-Dutton
http://alsa-project.org/~james/alsa-driver/emu1212m/emu1212m-10.diff
This patch added some basic ALSA support for the Creative emu1212m and emu1820m
Please review.
The patch looks almost good, but just a few minor issues:
Review
Quoted 9 lines
(quoted diff) +9
-0+static int snd_emu1212m_load_firmware(struct snd_emu10k1 * emu, const char * filename) +{ + int err; + int n, i; + int reg; + int value; + const struct firmware *fw_entry; + + if((err = request_firmware(&fw_entry, filename, &emu->pci->dev)) != 0) {
Please fix spaces, not only here but in general around if and for lines. A space if preferred between if and parenthesis, around '=', '<=', etc.
Review
Quoted 1 line
(quoted diff) +1
-0+ snd_printk(KERN_INFO "firmware: %s not found. Err=%d\n",filename, err);
Better to be KERN_WARNING or KERN_ERR?
Review
Quoted 5 lines
(quoted diff) +5
-0+ return err; + } + snd_printk(KERN_INFO "firmware size=0x%x\n",fw_entry->size); + if (fw_entry->size != 0x133a4) { + snd_printk(KERN_INFO "firmware: %s wrong size.\n",filename);
Ditto.
Review
Quoted 11 lines
static int
snd_emu10k1_emu1212m_init(struct snd_emu10k1 * emu){(quoted diff) +5
-1unsigned int i; - int tmp; + int tmp,tmp2; + int reg; + int err; + const char *hana_filename = "emu/hana.fw"; + const char *dock_filename = "emu/audio_dock.fw"; snd_printk(KERN_ERR "emu1212m: Special config.\n");
Is this really an error?
(snip)
Review
Quoted 3 lines
(quoted diff) +3
-0+ /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */ + snd_emu1212m_fpga_read(emu, EMU_HANA_ID, ® ); + snd_printk("reg1=0x%x\n",reg);
Please use snd_printdd or any other debug print functions.
Quoted 8 lines
(quoted diff) +8
-0+ /* Enable 48Volt power to Audio Dock */ + snd_emu1212m_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON ); + + snd_emu1212m_fpga_read(emu, EMU_HANA_OPTION_CARDS, ® ); + snd_printk(KERN_INFO "emu1212m: Card options=0x%x\n",reg); + snd_emu1212m_fpga_read(emu, EMU_HANA_OPTION_CARDS, ® ); + snd_printk(KERN_INFO "emu1212m: Card options=0x%x\n",reg); + snd_emu1212m_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp );
Review
Quoted 10 lines
(quoted diff) +10
-0+ /* ADAT input. */ + snd_emu1212m_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x01 ); + snd_emu1212m_fpga_read(emu, EMU_HANA_DOCK_PADS, &tmp ); + /* Set no attenuation on Audio Dock pads. */ + snd_emu1212m_fpga_write(emu, EMU_HANA_DOCK_PADS, 0x00 ); + snd_emu1212m_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp ); + /* Unmute Audio dock DACs, Headphone source DAC-4. */ + snd_emu1212m_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30 ); + snd_emu1212m_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12 ); + snd_emu1212m_fpga_read(emu, EMU_HANA_UNKNOWN13, &tmp );
In future version, we may optimize this using array and loop. Not necessarily in this patch, though.
(snip)
Quoted 13 lines
(quoted diff) +13
-0+ /* FIXME: The loading of this should be able to happen any time, + * as the user can plug/unplug it at any time + */ + if (reg & (EMU_HANA_OPTION_DOCK_ONLINE | EMU_HANA_OPTION_DOCK_OFFLINE) ) { + /* Audio Dock attached */ + /* Return to Audio Dock programming mode */ + snd_printk(KERN_INFO "emu1212m: Loading Audio Dock Firmware\n"); + snd_emu1212m_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK ); + if ((err = snd_emu1212m_load_firmware(emu, dock_filename)) != 0) { + return err; + } + snd_printk(KERN_INFO "emu1212m: Audio Dock Firmware loaded\n"); + snd_emu1212m_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0 );
Review
Quoted 10 lines
(quoted diff) +10
-0+ snd_emu1212m_fpga_read(emu, EMU_HANA_IRQ_STATUS, ® ); + snd_printk(KERN_INFO "emu1212m: EMU_HANA+DOCK_IRQ_STATUS=0x%x\n",reg); + /* ID, should read & 0x7f = 0x55 when FPGA programmed. */ + snd_emu1212m_fpga_read(emu, EMU_HANA_ID, ® ); + snd_printk(KERN_INFO "emu1212m: EMU_HANA+DOCK_ID=0x%x\n",reg); + if (reg != 0x55) { + /* FPGA failed to be programmed */ + snd_printk(KERN_INFO "emu1212m: Loading Audio Dock Firmware file failed, reg=0x%x\n", reg); + return 0; + return -ENODEV;
Invalid return.
pci/emu10k1/emupcm.c static int snd_emu10k1_capture_trigger(s · line 793
Quoted 8 lines
diff -r
61bfe5b3a7aepci/emu10k1/emupcm.cpci/emu10k1/emupcm.c +1
-0@@ -790,6 +790,7 @@ static int snd_emu10k1_capture_trigger(sif (emu->audigy) {snd_emu10k1_ptr_write (emu,A_FXWC1 ,0 , epcm->capture_cr_val);snd_emu10k1_ptr_write (emu,A_FXWC2 ,0 , epcm->capture_cr_val2); +printk ("cr_val=0x%x, cr_val2=0x%x\n" , epcm->capture_cr_val, epcm->capture_cr_val2);
Use debug prints.
pci/emu10k1/emuproc.c line 31
Quoted 8 lines
diff -r
61bfe5b3a7aepci/emu10k1/emuproc.cpci/emu10k1/emuproc.c +1
-0@@ -28,6 +28,7 @@#include <sound/driver.h> #include <linux/slab.h> #include <linux/init.h> +#include <linux/delay.h> /* For udelay */
Hmm, where is udelay() in this file?
pci/emu10k1/emuproc.c int __devinit snd_emu10k1_proc_init(stru · line 558
Quoted 7 lines
pci/emu10k1/emuproc.c +3
-0@@ -531,6 +553,9 @@ int __devinit snd_emu10k1_proc_init(stru {struct snd_info_entry *entry;#ifdef CONFIG_SND_DEBUG +if (!snd_card_proc_new (emu->card,"emu1212m_regs" , &entry)) { +snd_info_set_text_ops (entry, emu, snd_emu_proc_emu1212m_reg_read); + }
Isn't this proc file only for emu1212? How about to add check of emu->card_capabilities->emu1212m?
thanks,
Takashi
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642