* Re: EMU-1212m "no Audiodock - no firmware" patch
2012-11-22 17:17 ` Takashi Iwai
@ 2012-11-22 20:09 ` oeai
2012-11-23 11:23 ` Takashi Iwai
2012-12-29 2:45 ` oeai
2012-12-29 2:52 ` oeai
2 siblings, 1 reply; 9+ messages in thread
From: oeai @ 2012-11-22 20:09 UTC (permalink / raw)
To: Takashi Iwai, alsa-devel, symbiants
[-- Attachment #1: Type: text/plain, Size: 5727 bytes --]
On 22.11.2012 21:17, Takashi Iwai wrote:
> Right now I fixed a few bugs regarding the firmware loading.
> It should have been improved by that. Take a look at my recent posts
> [PATCH 7/8] ALSA: emu10k1: cache emu1010 firmware
> and
> [PATCH 8/8] ALSA: emu10k1: don't update firmware during suspend/resume
thanks, i'll try to find it and check, aren't they included yet?
i just don't know actually how to find some specific threads here actually
>
>> so in the patch i've changed few more strings for debugging
> Hmm. It's because you have no dock?
> What happens if you don't change this?
well the firmware is trying to load it endlessly and my cpu loads at
100% but it loads only 1 core so that was not so much worse for me
>
>> and here i've changed that the emu_model was firstly enabled and then ecard - since i don't know what's the ecard is, i thought that it is a second module of my emu card.
> This should be harmless. ecard is set only to Emu APS card, and
> exclusive with EMU 1x1x & co.
- well this card i think that i got and it depends on loading the first
part of E-MU as i think kinda a second part, so that's why i decided to
load it a little later.
i can find you a picture of the card it is providing IN OUT analog
>
> What are other essentially required changes?
well i've changed emufx and other file because they were loading some
libs and sliders that are not really needed by the emu_model
>
> Do both Emu1010b and Emu1212 have the same PCI SSID? That sucks.
> I see you set ca_cardbus_chip=1 in the card entry. Is it mandatory?
i think that the cardbus is related to that ecard and yes it looks like
they are the same when i
lspci -s 07:05.0 -nn
07:05.0 Multimedia audio controller [0401]: Creative Labs SB0400 Audigy2
Value [1102:0008]
i don't know how to set the subsystem
>
> Last but not least, please use "diff -up" for creating a patch in the
> unified diff format.
>
>
> thanks,
>
> Takashi
>
>
i've attached diff -u of all changes that i've made and in second reply
i've put the dar.bz2 file with all changed files (not sure if it is on
the deck)
so i'll send it to you too.
i've tried to reply on my own thread today but i don't see the answer,
so i ll dulicate a message for you
=====================
==================================
===========================
> ALoha!
>
> i continued to make -j4 all night long and all day passed through
>
> so now the emu-1212m is working, i've changed some pieces of code -
> the diff file is only 30kb
> but some people don't know how to do that, so i\ll describe a process
> of compiling
> well there's still the bug of getting back from suspend state, but at
> least it is loading and i've described a bug with emu-firmware, so now
> all you need in case you are using suspend or maybe sllep mode (i
> didn't test hibernate too)
> just do "alsa reload" - if you decide to work on project.
> i've setted the adc_1361t something and it says that you can use the
> 24bits of capturing - well, all other was just to disable some
> audiodock commands if no audiodock is installed in system, i've moved
> some tweaks to load_patches function, reorganized some bits, and set
> few states that no need to load ac97 chipset sliders into the main
> window - that was awful.
> i'm thinking of binding some buttons and new volume sliders for DSP
> and capture channels, but it is all can simply be routed through
> @jack, so i'm gonna play some guitar finally at last!
>
> <https://lh5.googleusercontent.com/-qsu_d5TjAX4/UK4X-fSteWI/AAAAAAAAABY/Qy9kEzcFvlQ/s1600/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA+%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0+%D0%BE%D1%82+2012-11-22+16%3A17%3A38.png>
>
>
>
> i've changed not so much of a lot of things - but the good news - it
> is working!
>
> so if you own emu-1212m you can take the dar.bz , download sources
> 1.0.25 from alsa-project unbzip it to the directory and enter it, then
> run next commands
>
> "./configure && make -j4"
>
> the compile process takes about 2-10mins -j4 means multithreading so
> you should set the number as many cores got your CPU
> then go to directory where the emu*.dar.bz2 downloaded
> run
> "bzip2 -x ./emu*bz2"
> you need to "apt-get install dar" or check the rpm package
> "dar -x ./emu*dar" press enter when it ask something
> then open mc and put files in next directories
> assuming the root dir is an alsa sources alsa-xxxx
> /pci/emu10k1/ - you'll emu10k1_main.c there copy 1 file here and
> delete emupmx.o and emufx.o files
> the others 2 copy into
> /alsa-kernel/pci/emu10k1/
> then go to alsa-xxxx dir and run
> "make -j4" again
> then again run "alsa unload" make sure that emu10k1 unloaded, you
> should stop all jackd and any alsa mixers should be unloaded
> you can try
> "rmmod emu10k1" (-f - force)- it will show you maybe something
> then run
> "make install && modprobe snd-emu10k1"
> "alsa reload"
> - ok now you can try to open the device!!!
> i'm using QasMixer for alsa so you will find there DSP 0,1 - Silence -
> Change it to 0202 ADC Left+Right
> And the ADC0 -14dB PAD 0202 - is a GAIN XP button $ ) so you are ready
> to capture.
>
> well it is working and that's more then enough i've debugged one
> superbug so now it's ok =))
>
> Английский понимают многие люди и наверняка те, кто умеет ковыряться в
> линуксе - понимают и то? что ai написал =))
>
>
> --
> RA
> OE
> AI
===========================
=============================
====================================
--
OEAI
[-- Attachment #2: emu10k1.patch --]
[-- Type: text/x-patch, Size: 30771 bytes --]
diff -u ./orig/emu10k1_main.c ./emu10k1/emu10k1_main.c
--- ./orig/emu10k1_main.c 2012-01-25 11:56:49.000000000 +0400
+++ ./emu10k1/emu10k1_main.c 2012-11-22 14:23:47.000000000 +0400
@@ -1,3 +1,5 @@
+#define __NO_VERSION__
+#include "adriver.h"
/*
* Copyright (c) by Jaroslav Kysela <perex@perex.cz>
* Creative Labs, Inc.
@@ -66,6 +68,11 @@
MODULE_FIRMWARE(EMU1010_NOTEBOOK_FILENAME);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
+#define wake_up_process(kt) /* */
+#endif
+
+
/*************************************************************************
* EMU10K1 init / done
*************************************************************************/
@@ -160,7 +167,7 @@
unsigned int silent_page;
int ch;
u32 tmp;
-
+ snd_printk(KERN_INFO "E-MU Loader : Starting emu init \n");
/* disable audio and lock cache */
outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK |
HCFG_MUTEBUTTONENABLE, emu->port + HCFG);
@@ -217,7 +224,7 @@
}
if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */
/* Hacks for Alice3 to work independent of haP16V driver */
- snd_printk(KERN_INFO "Audigy2 value: Special config.\n");
+ snd_printk(KERN_INFO "E-MU Loader : Special config. ca0108 chip ready\n");
/* Setup SRCMulti_I2S SamplingRate */
tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
tmp &= 0xfffff1ff;
@@ -243,7 +250,7 @@
}
if (emu->card_capabilities->spi_dac) { /* Audigy 2 ZS Notebook with DAC Wolfson WM8768/WM8568 */
int size, n;
-
+ snd_printk(KERN_INFO "E-MU Loader : Special config. spi_dac chip ready\n");
size = ARRAY_SIZE(spi_dac_init);
for (n = 0; n < size; n++)
snd_emu10k1_spi_write(emu, spi_dac_init[n]);
@@ -263,7 +270,7 @@
}
if (emu->card_capabilities->i2c_adc) { /* Audigy 2 ZS Notebook with ADC Wolfson WM8775 */
int size, n;
-
+ snd_printk(KERN_INFO "E-MU Loader : Special config. i2c_adc chip ready\n");
snd_emu10k1_ptr20_write(emu, P17V_I2S_SRC_SEL, 0, 0x2020205f);
tmp = inl(emu->port + A_IOCFG);
outl(tmp | 0x4, emu->port + A_IOCFG); /* Set bit 2 for mic input */
@@ -289,6 +296,7 @@
}
if (emu->card_capabilities->emu_model) {
+ snd_printk(KERN_INFO "E-MU Loader : Special config. found emu model !!!\n");
outl(HCFG_AUTOMUTE_ASYNC |
HCFG_EMU32_SLAVE |
HCFG_AUDIOENABLE, emu->port + HCFG);
@@ -667,7 +675,11 @@
unsigned long flags;
const struct firmware *fw_entry;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0)
err = request_firmware(&fw_entry, filename, &emu->pci->dev);
+#else
+ err = request_firmware(&fw_entry, filename, pci_name(emu->pci));
+#endif
if (err != 0) {
snd_printk(KERN_ERR "firmware: %s not found. Err = %d\n", filename, err);
return err;
@@ -717,12 +729,12 @@
for (;;) {
/* Delay to allow Audio Dock to settle */
- msleep_interruptible(1000);
+ msleep_interruptible(1111);
if (kthread_should_stop())
break;
snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp); /* IRQ Status */
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ®); /* OPTIONS: Which cards are attached to the EMU */
- if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) {
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE) {
/* Audio Dock attached */
/* Return to Audio Dock programming mode */
snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n");
@@ -766,8 +778,13 @@
/* Unmute all. Default is muted after a firmware load */
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
}
+ else if ((reg & 0x3f) == 0x15)
+ {
+ snd_printk(KERN_INFO "emu1212m: trying to load config emu_hana_fpga_config");
+ snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG,0x02);
+ }
}
- snd_printk(KERN_INFO "emu1010: firmware thread stopping\n");
+ snd_printk(KERN_INFO "emu1010: emu dock firmware thread stopping\n");
return 0;
}
@@ -802,124 +819,34 @@
* 16 x 16-bit playback - snd_emu10k1_fx8010_playback_ops
* 16 x 32-bit capture - snd_emu10k1_capture_efx_ops
*/
-static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
+
+
+
+static int snd_emu10k1_emu1010_load_patches(struct snd_emu10k1 *emu)
{
unsigned int i;
- u32 tmp, tmp2, reg;
+ u32 tmp, reg;
int err;
- const char *filename = NULL;
-
- snd_printk(KERN_INFO "emu1010: Special config.\n");
- /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
- * Lock Sound Memory Cache, Lock Tank Memory Cache,
- * Mute all codecs.
- */
- outl(0x0005a00c, emu->port + HCFG);
- /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
- * Lock Tank Memory Cache,
- * Mute all codecs.
- */
- outl(0x0005a004, emu->port + HCFG);
- /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
- * Mute all codecs.
- */
- outl(0x0005a000, emu->port + HCFG);
- /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
- * Mute all codecs.
- */
- outl(0x0005a000, emu->port + HCFG);
-
- /* Disable 48Volt power to Audio Dock */
- snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
-
- /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */
- snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®);
- snd_printdd("reg1 = 0x%x\n", reg);
- if ((reg & 0x3f) == 0x15) {
- /* FPGA netlist already present so clear it */
- /* Return to programming mode */
-
- snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02);
- }
- snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®);
- snd_printdd("reg2 = 0x%x\n", reg);
- if ((reg & 0x3f) == 0x15) {
- /* FPGA failed to return to programming mode */
- snd_printk(KERN_INFO "emu1010: FPGA failed to return to programming mode\n");
- return -ENODEV;
- }
- snd_printk(KERN_INFO "emu1010: EMU_HANA_ID = 0x%x\n", reg);
- switch (emu->card_capabilities->emu_model) {
- case EMU_MODEL_EMU1010:
- filename = HANA_FILENAME;
- break;
- case EMU_MODEL_EMU1010B:
- filename = EMU1010B_FILENAME;
- break;
- case EMU_MODEL_EMU1616:
- filename = EMU1010_NOTEBOOK_FILENAME;
- break;
- case EMU_MODEL_EMU0404:
- filename = EMU0404_FILENAME;
- break;
- default:
- filename = NULL;
- return -ENODEV;
- break;
- }
- snd_printk(KERN_INFO "emu1010: filename %s testing\n", filename);
- err = snd_emu1010_load_firmware(emu, filename);
- if (err != 0) {
- snd_printk(
- KERN_INFO "emu1010: Loading Firmware file %s failed\n",
- filename);
- return err;
- }
-
- /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
- snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®);
- if ((reg & 0x3f) != 0x15) {
- /* FPGA failed to be programmed */
- snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg = 0x%x\n", reg);
- return -ENODEV;
- }
-
- snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n");
- snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp);
- snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2);
- snd_printk(KERN_INFO "emu1010: Hana version: %u.%u\n", tmp, tmp2);
- /* Enable 48Volt power to Audio Dock */
- snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON);
-
+
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ®);
- snd_printk(KERN_INFO "emu1010: Card options = 0x%x\n", reg);
+ snd_printk(KERN_INFO "E-Mu Loader : Cards options reading = 0x%x\n", reg);
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ®);
- snd_printk(KERN_INFO "emu1010: Card options = 0x%x\n", reg);
+ snd_printk(KERN_INFO "E-MU Loader : Card optical options reading = 0x%x\n", reg);
snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp);
/* Optical -> ADAT I/O */
/* 0 : SPDIF
* 1 : ADAT
*/
+ snd_printk(KERN_INFO "E-MU Loader : Start writing data registers\n");
emu->emu1010.optical_in = 1; /* IN_ADAT */
emu->emu1010.optical_out = 1; /* IN_ADAT */
- tmp = 0;
+ tmp = 1;
tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : 0) |
(emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : 0);
snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp);
snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp);
- /* Set no attenuation on Audio Dock pads. */
- snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00);
- emu->emu1010.adc_pads = 0x00;
- snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp);
- /* Unmute Audio dock DACs, Headphone source DAC-4. */
- snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30);
- snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);
- snd_emu1010_fpga_read(emu, EMU_HANA_DAC_PADS, &tmp);
- /* DAC PADs. */
- snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, 0x0f);
- emu->emu1010.dac_pads = 0x0f;
- snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp);
- snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30);
+
+
snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp);
/* SPDIF Format. Set Consumer mode, 24bit, copy enable */
snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10);
@@ -939,8 +866,41 @@
/* Word Clock source, Internal 48kHz x1 */
snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K);
/* snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X); */
+
+
+
+
+
+
/* Audio Dock LEDs. */
- snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);
+
+ /* AudioDock Init */
+
+ err = snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON);
+ if (err != 0)
+ {
+ snd_printk( KERN_INFO "E-Mu Loader: No Audiodock - no power 0x%x failed\n", err);
+
+ }
+
+
+ snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ®); /* OPTIONS: Which cards are attached to the EMU */
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+
+ {
+ /* Set no attenuation on Audio Dock pads. */
+
+
+
+ snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp);
+ /* Unmute (0x30) Mute(0x00) Audio dock DACs, Headphone source DAC-4. */
+
+ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x00);
+ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x00);
+ snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp);
+ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x00);
+ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x00);
+}
#if 0
/* For 96kHz */
@@ -974,14 +934,19 @@
#endif
#if 1
/* For 48kHz */
- snd_emu1010_fpga_link_dst_src_write(emu,
- EMU_DST_ALICE2_EMU32_0, EMU_SRC_DOCK_MIC_A1);
- snd_emu1010_fpga_link_dst_src_write(emu,
- EMU_DST_ALICE2_EMU32_1, EMU_SRC_DOCK_MIC_B1);
+
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_2, EMU_SRC_HAMOA_ADC_LEFT2);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_3, EMU_SRC_HAMOA_ADC_LEFT2);
+
+ //AudioDOck? - Nah, i don't have it...
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+ {
+ snd_emu1010_fpga_link_dst_src_write(emu,
+ EMU_DST_ALICE2_EMU32_0, EMU_SRC_DOCK_MIC_A1);
+ snd_emu1010_fpga_link_dst_src_write(emu,
+ EMU_DST_ALICE2_EMU32_1, EMU_SRC_DOCK_MIC_B1);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_4, EMU_SRC_DOCK_ADC1_LEFT1);
snd_emu1010_fpga_link_dst_src_write(emu,
@@ -990,6 +955,7 @@
EMU_DST_ALICE2_EMU32_6, EMU_SRC_DOCK_ADC2_LEFT1);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_7, EMU_SRC_DOCK_ADC2_RIGHT1);
+
/* Pavel Hofman - setting defaults for 8 more capture channels
* Defaults only, users will set their own values anyways, let's
* just copy/paste.
@@ -998,11 +964,9 @@
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_8, EMU_SRC_DOCK_MIC_A1);
snd_emu1010_fpga_link_dst_src_write(emu,
- EMU_DST_ALICE2_EMU32_9, EMU_SRC_DOCK_MIC_B1);
- snd_emu1010_fpga_link_dst_src_write(emu,
- EMU_DST_ALICE2_EMU32_A, EMU_SRC_HAMOA_ADC_LEFT2);
- snd_emu1010_fpga_link_dst_src_write(emu,
- EMU_DST_ALICE2_EMU32_B, EMU_SRC_HAMOA_ADC_LEFT2);
+ EMU_DST_ALICE2_EMU32_9, EMU_SRC_DOCK_MIC_B1);
+
+
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_C, EMU_SRC_DOCK_ADC1_LEFT1);
snd_emu1010_fpga_link_dst_src_write(emu,
@@ -1011,6 +975,15 @@
EMU_DST_ALICE2_EMU32_E, EMU_SRC_DOCK_ADC2_LEFT1);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_F, EMU_SRC_DOCK_ADC2_RIGHT1);
+
+
+ }
+
+ snd_emu1010_fpga_link_dst_src_write(emu,
+ EMU_DST_ALICE2_EMU32_A, EMU_SRC_HAMOA_ADC_LEFT2);
+ snd_emu1010_fpga_link_dst_src_write(emu,
+ EMU_DST_ALICE2_EMU32_B, EMU_SRC_HAMOA_ADC_LEFT2);
+
#endif
#if 0
/* Original */
@@ -1030,14 +1003,24 @@
EMU_DST_ALICE2_EMU32_A, EMU_SRC_HANA_ADAT + 6);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_B, EMU_SRC_HANA_ADAT + 7);
+
+ //AudioDOck? - Nah, i don't have it...
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+ {
+
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_C, EMU_SRC_DOCK_MIC_A1);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_D, EMU_SRC_DOCK_MIC_B1);
+
+ }
+
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_E, EMU_SRC_HAMOA_ADC_LEFT2);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_F, EMU_SRC_HAMOA_ADC_LEFT2);
+
+
#endif
for (i = 0; i < 0x20; i++) {
/* AudioDock Elink <- Silence */
@@ -1055,6 +1038,12 @@
/* Hana ADAT Out <- Silence */
snd_emu1010_fpga_link_dst_src_write(emu, EMU_DST_HANA_ADAT + i, EMU_SRC_SILENCE);
}
+
+ //AudioDOck? - Nah, i don't have it...
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+ {
+
+
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE_I2S0_LEFT, EMU_SRC_DOCK_ADC1_LEFT1);
snd_emu1010_fpga_link_dst_src_write(emu,
@@ -1067,8 +1056,12 @@
EMU_DST_ALICE_I2S2_LEFT, EMU_SRC_DOCK_ADC3_LEFT1);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE_I2S2_RIGHT, EMU_SRC_DOCK_ADC3_RIGHT1);
- snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x01); /* Unmute all */
+
+
+ }
+
+ snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x00); /* Mute all (0x00), Unmute All 0x01 */
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp);
/* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave,
@@ -1114,6 +1107,11 @@
if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616) {
/* 1616(M) cardbus default outputs */
/* ALICE2 bus 0xa0 */
+
+ //AudioDOck? - Nah, i don't have it...
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+ {
+
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_DOCK_DAC1_LEFT1, EMU_SRC_ALICE_EMU32A + 0);
emu->emu1010.output_source[0] = 17;
@@ -1132,6 +1130,8 @@
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_DOCK_DAC3_RIGHT1, EMU_SRC_ALICE_EMU32A + 5);
emu->emu1010.output_source[5] = 22;
+
+ }
/* ALICE2 bus 0xa0 */
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_MANA_DAC_LEFT, EMU_SRC_ALICE_EMU32A + 0);
@@ -1141,6 +1141,10 @@
emu->emu1010.output_source[17] = 18;
} else {
/* ALICE2 bus 0xa0 */
+ //AudioDOck? - Nah, i don't have it...
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+ {
+
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_DOCK_DAC1_LEFT1, EMU_SRC_ALICE_EMU32A + 0);
emu->emu1010.output_source[0] = 21;
@@ -1179,6 +1183,9 @@
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_DOCK_SPDIF_RIGHT1, EMU_SRC_ALICE_EMU32A + 1);
emu->emu1010.output_source[11] = 22;
+
+
+ }
/* ALICE2 bus 0xa0 */
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_HANA_SPDIF_LEFT1, EMU_SRC_ALICE_EMU32A + 0);
@@ -1221,22 +1228,146 @@
}
/* TEMP: Select SPDIF in/out */
/* snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); */ /* Output spdif */
-
+ snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x01); /* Unmute all */
/* TEMP: Select 48kHz SPDIF out */
- snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */
+ //snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */
snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x0); /* Default fallback clock 48kHz */
/* Word Clock source, Internal 48kHz x1 */
snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K);
/* snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X); */
emu->emu1010.internal_clock = 1; /* 48000 */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12); /* Set LEDs on Audio Dock */
- snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x1); /* Unmute all */
+
/* snd_emu1010_fpga_write(emu, 0x7, 0x0); */ /* Mute all */
/* snd_emu1010_fpga_write(emu, 0x7, 0x1); */ /* Unmute all */
/* snd_emu1010_fpga_write(emu, 0xe, 0x12); */ /* Set LEDs on Audio Dock */
+
+
+ /* DAC PADs. */
+ //snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, 0x0f); /* 0x0f - turn on*/
+ //emu->emu1010.dac_pads = 0x0f;
+ //snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x0f);
+ //emu->emu1010.adc_pads = 0x0f;
+ snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, 0x0); /* 0x0f - turn on*/
+ emu->emu1010.dac_pads = 0;
+ snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x0);
+ emu->emu1010.adc_pads = 0;
return 0;
}
+
+
+
+static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
+{
+
+ u32 tmp, tmp2, reg;
+ int err;
+ const char *filename = NULL;
+
+ snd_printk(KERN_INFO "E-MU Loader: Trying initialize special config.\n");
+ /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
+ * Lock Sound Memory Cache, Lock Tank Memory Cache,
+ * Mute all codecs.
+ */
+ outl(0x0005a00c, emu->port + HCFG);
+ /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
+ * Lock Tank Memory Cache,
+ * Mute all codecs.
+ */
+ outl(0x0005a004, emu->port + HCFG);
+ /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
+ * Mute all codecs.
+ */
+ outl(0x0005a000, emu->port + HCFG);
+ /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
+ * Mute all codecs.
+ */
+ outl(0x0005a000, emu->port + HCFG);
+
+ /* Disable 48Volt power to Audio Dock */
+
+ snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ®); /* OPTIONS: Which cards are attached to the EMU */
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+ {
+ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
+ }
+ /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */
+ snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®);
+ snd_printdd("reg1 = 0x%x\n", reg);
+ if ((reg & 0x3f) == 0x15) {
+ /* FPGA netlist already present so clear it */
+ /* Return to programming mode */
+ snd_printk(KERN_INFO "emu1212: hana_fpga_config 0x%x\n", reg);
+ snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02);
+
+ }
+ snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®);
+ snd_printk(KERN_INFO "emu1212: emu_hana_id read_fpga 0x%x\n", reg);
+ if (reg == 0x3f)
+ {
+ snd_printdd("reg2 = 0x%x\n", reg);
+ if ((reg & 0x3f) == 0x15) {
+ /* FPGA failed to return to programming mode */
+ snd_printk(KERN_INFO "emu1010: FPGA failed to return to programming mode\n");
+ return -ENODEV;
+ }
+ snd_printk(KERN_INFO "emu1010: EMU_HANA_ID = 0x%x\n", reg);
+
+
+ switch (emu->card_capabilities->emu_model) {
+ case EMU_MODEL_EMU1010:
+ filename = HANA_FILENAME;
+ break;
+ case EMU_MODEL_EMU1010B:
+ filename = EMU1010B_FILENAME;
+ break;
+ case EMU_MODEL_EMU1616:
+ filename = EMU1010_NOTEBOOK_FILENAME;
+ break;
+ case EMU_MODEL_EMU0404:
+ filename = EMU0404_FILENAME;
+ break;
+ default:
+ filename = NULL;
+ return -ENODEV;
+ break;
+ }
+
+ snd_printk(KERN_INFO "emu1010: filename %s testing\n", filename);
+
+ err = snd_emu1010_load_firmware(emu, filename);
+ if (err != 0) {
+ snd_printk(
+ KERN_INFO "emu1010: Loading Firmware file %s failed\n",
+ filename);
+ return err;
+ }
+
+
+ /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
+ snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®);
+ if ((reg & 0x3f) != 0x15) {
+ /* FPGA failed to be programmed */
+ snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg = 0x%x\n", reg);
+ return -ENODEV;
+ }
+
+ snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n");
+ snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp);
+ snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2);
+ snd_printk(KERN_INFO "emu1010: Hana version: %u.%u\n", tmp, tmp2);
+
+ return snd_emu10k1_emu1010_load_patches(emu);
+
+ }
+
+ return 0;
+
+}
+
+
+
/*
* Create the EMU10K1 instance
*/
@@ -1255,6 +1386,9 @@
}
if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1010) {
/* Disable 48Volt power to Audio Dock */
+ int reg;
+ snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ®); /* OPTIONS: Which cards are attached to the EMU */
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
}
if (emu->emu1010.firmware_thread)
@@ -1399,6 +1533,7 @@
.i2c_adc = 1,
.spk71 = 1} ,
/* Tested by James@superbug.co.uk 4th Nov 2007. */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x42011102,
.driver = "Audigy2", .name = "E-mu 1010 Notebook [MAEM8950]",
.id = "EMU1010",
@@ -1410,11 +1545,12 @@
/* Tested by James@superbug.co.uk 4th Nov 2007. */
/* This is MAEM8960, 0202 is MAEM 8980 */
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40041102,
- .driver = "Audigy2", .name = "E-mu 1010b PCI [MAEM8960]",
+ .driver = "Audigy2", .name = "E-mu 1212m PCI [MAEM8980]",
.id = "EMU1010",
.emu10k2_chip = 1,
.ca0108_chip = 1,
- .spk71 = 1,
+ .ca_cardbus_chip = 1,
+ .adc_1361t = 1,
.emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 new revision */
/* Tested by James@superbug.co.uk 8th July 2005. */
/* This is MAEM8810, 0202 is MAEM8820 */
@@ -1449,6 +1585,7 @@
.ca0108_chip = 1,
.spk71 = 1,
.emu_model = EMU_MODEL_EMU0404}, /* EMU 0404 PCIe ver_03 */
+#endif
/* Note that all E-mu cards require kernel 2.6 or newer. */
{.vendor = 0x1102, .device = 0x0008,
.driver = "Audigy2", .name = "SB Audigy 2 Value [Unknown]",
@@ -1775,7 +1912,7 @@
emu->synth = NULL;
emu->get_synth_voice = NULL;
/* read revision & serial */
- emu->revision = pci->revision;
+ emu->revision = snd_pci_revision(pci);
pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial);
pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model);
snd_printdd("vendor = 0x%x, device = 0x%x, subsystem_vendor_id = 0x%x, subsystem_id = 0x%x\n", pci->vendor, pci->device, emu->serial, emu->model);
@@ -1896,28 +2033,37 @@
emu->fx8010.extout_mask = extout_mask;
emu->enable_ir = enable_ir;
- if (emu->card_capabilities->ca_cardbus_chip) {
- err = snd_emu10k1_cardbus_init(emu);
- if (err < 0)
- goto error;
- }
- if (emu->card_capabilities->ecard) {
- err = snd_emu10k1_ecard_init(emu);
- if (err < 0)
- goto error;
- } else if (emu->card_capabilities->emu_model) {
+
+
+ if (emu->card_capabilities->emu_model)
+ {
err = snd_emu10k1_emu1010_init(emu);
if (err < 0) {
snd_emu10k1_free(emu);
return err;
}
- } else {
+ }
+ else if (emu->card_capabilities->ecard)
+ {
+ err = snd_emu10k1_ecard_init(emu);
+ if (err < 0)
+ goto error;
+
+ }
+ else
+ {
+
/* 5.1: Enable the additional AC97 Slots. If the emu10k1 version
does not support this, it shouldn't do any harm */
snd_emu10k1_ptr_write(emu, AC97SLOT, 0,
AC97SLOT_CNTR|AC97SLOT_LFE);
}
-
+ if (emu->card_capabilities->ca_cardbus_chip)
+ {
+ err = snd_emu10k1_cardbus_init(emu);
+ if (err < 0)
+ goto error;
+ }
/* initialize TRAM setup */
emu->fx8010.itram_size = (16 * 1024)/2;
emu->fx8010.etram_pages.area = NULL;
@@ -1988,7 +2134,7 @@
goto error;
#ifdef CONFIG_PROC_FS
- snd_emu10k1_proc_init(emu);
+ snd_emu10k1_proc_init(emu);
#endif
snd_card_set_dev(card, &pci->dev);
@@ -2064,12 +2210,39 @@
void snd_emu10k1_resume_init(struct snd_emu10k1 *emu)
{
+ u32 reg, tmp, tmp2;
+ if (emu->card_capabilities->emu_model)
+ {
+ snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®);
+ if ((reg & 0x3f) != 0x15)
+ {
+ /* FPGA failed to be programmed */
+ snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg = 0x%x\n", reg);
+
+ }
+
+ snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n");
+ snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp);
+ snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2);
+ snd_printk(KERN_INFO "emu1010: Hana version: %u.%u\n", tmp, tmp2);
+
+
+ snd_emu10k1_emu1010_load_patches(emu);
+
+ //snd_emu10k1_resume_regs(emu);
+
+ }
+
+ //snd_emu10k1_emu1010_init(emu);
+
+
if (emu->card_capabilities->ca_cardbus_chip)
+ {
+
snd_emu10k1_cardbus_init(emu);
- if (emu->card_capabilities->ecard)
+ }
+ else if (emu->card_capabilities->ecard)
snd_emu10k1_ecard_init(emu);
- else if (emu->card_capabilities->emu_model)
- snd_emu10k1_emu1010_init(emu);
else
snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE);
snd_emu10k1_init(emu, emu->enable_ir, 1);
@@ -2097,5 +2270,6 @@
for (i = 0; i < NUM_G; i++, val++)
snd_emu10k1_ptr_write(emu, *reg, i, *val);
}
+
}
#endif
diff -u ./orig/emufx.c ./emu10k1/emufx.c
--- ./orig/emufx.c 2012-01-25 11:56:49.000000000 +0400
+++ ./emu10k1/emufx.c 2012-11-22 06:02:48.000000000 +0400
@@ -1223,6 +1223,7 @@
* where gpr contains attenuation from corresponding mixer control
* (snd_emu10k1_init_stereo_control)
*/
+ if (!emu->card_capabilities->emu_model) {
A_OP(icode, &ptr, iMAC0, A_GPR(playback), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT_FRONT));
A_OP(icode, &ptr, iMAC0, A_GPR(playback+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT_FRONT));
snd_emu10k1_init_stereo_control(&controls[nctl++], "PCM Front Playback Volume", gpr, 100);
@@ -1251,7 +1252,7 @@
A_OP(icode, &ptr, iMAC0, A_GPR(playback+5), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LFE));
snd_emu10k1_init_mono_control(&controls[nctl++], "PCM LFE Playback Volume", gpr, 100);
gpr++;
-
+ }
/*
* Stereo Mix
*/
@@ -1278,7 +1279,7 @@
A_OP(icode, &ptr, iMAC0, A_GPR(capture+1), A_GPR(capture+1), A_GPR(gpr+1), A_FXBUS(FXBUS_MIDI_RIGHT));
snd_emu10k1_init_stereo_control(&controls[nctl++], "Synth Capture Volume", gpr, 0);
gpr += 2;
-
+
/*
* inputs
*/
@@ -1300,6 +1301,18 @@
snd_emu10k1_init_stereo_control(&controls[nctl++], "EMU Capture Volume", gpr, 0);
gpr += 2;
}
+ /* Optical SPDIF Playback Volume */
+ A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_OPT_SPDIF_L);
+ A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_OPT_SPDIF_R);
+ snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",PLAYBACK,VOLUME), gpr, 0);
+ gpr += 2;
+ /* Optical SPDIF Capture Volume */
+ A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_OPT_SPDIF_L);
+ A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_OPT_SPDIF_R);
+ snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",CAPTURE,VOLUME), gpr, 0);
+ gpr += 2;
+
+if (!emu->card_capabilities->emu_model) {
/* AC'97 Playback Volume - used only for mic (renamed later) */
A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_AC97_L);
A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_AC97_R);
@@ -1329,16 +1342,6 @@
gpr, 0);
gpr += 2;
- /* Optical SPDIF Playback Volume */
- A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_OPT_SPDIF_L);
- A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_OPT_SPDIF_R);
- snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",PLAYBACK,VOLUME), gpr, 0);
- gpr += 2;
- /* Optical SPDIF Capture Volume */
- A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_OPT_SPDIF_L);
- A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_OPT_SPDIF_R);
- snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",CAPTURE,VOLUME), gpr, 0);
- gpr += 2;
/* Line2 Playback Volume */
A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_LINE2_L);
@@ -1514,7 +1517,7 @@
}
snd_emu10k1_init_stereo_onoff_control(controls + nctl++, "Tone Control - Switch", gpr, 0);
gpr += 2;
-
+}
/* Master volume (will be renamed later) */
A_OP(icode, &ptr, iMAC0, A_GPR(playback+0+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr), A_GPR(playback+0+SND_EMU10K1_PLAYBACK_CHANNELS));
A_OP(icode, &ptr, iMAC0, A_GPR(playback+1+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr), A_GPR(playback+1+SND_EMU10K1_PLAYBACK_CHANNELS));
diff -u ./orig/emumixer.c ./emu10k1/emumixer.c
--- ./orig/emumixer.c 2012-01-25 11:56:49.000000000 +0400
+++ ./emu10k1/emumixer.c 2012-11-22 14:42:55.000000000 +0400
@@ -603,7 +603,7 @@
static int snd_emu1010_adc_pads_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
- unsigned int mask = kcontrol->private_value & 0xff;
+ unsigned int mask = kcontrol->private_value & 0xff; //0xff || 0x0f
ucontrol->value.integer.value[0] = (emu->emu1010.adc_pads & mask) ? 1 : 0;
return 0;
}
@@ -611,7 +611,7 @@
static int snd_emu1010_adc_pads_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
- unsigned int mask = kcontrol->private_value & 0xff;
+ unsigned int mask = kcontrol->private_value & 0x0f; // 0xff
unsigned int val, cache;
val = ucontrol->value.integer.value[0];
cache = emu->emu1010.adc_pads;
@@ -640,10 +640,10 @@
}
static struct snd_kcontrol_new snd_emu1010_adc_pads[] __devinitdata = {
- EMU1010_ADC_PADS("ADC1 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD1),
- EMU1010_ADC_PADS("ADC2 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD2),
- EMU1010_ADC_PADS("ADC3 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD3),
- EMU1010_ADC_PADS("ADC1 14dB PAD 0202 Capture Switch", EMU_HANA_0202_ADC_PAD1),
+ EMU1010_ADC_PADS("ADC1 -14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD1),
+ EMU1010_ADC_PADS("ADC2 -14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD2),
+ EMU1010_ADC_PADS("ADC3 -14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD3),
+ EMU1010_ADC_PADS("ADC0 -14dB PAD 0202 Capture Switch", EMU_HANA_0202_ADC_PAD1),
};
#define snd_emu1010_dac_pads_info snd_ctl_boolean_mono_info
@@ -688,11 +688,11 @@
}
static struct snd_kcontrol_new snd_emu1010_dac_pads[] __devinitdata = {
- EMU1010_DAC_PADS("DAC1 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD1),
- EMU1010_DAC_PADS("DAC2 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD2),
- EMU1010_DAC_PADS("DAC3 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD3),
- EMU1010_DAC_PADS("DAC4 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD4),
- EMU1010_DAC_PADS("DAC1 0202 14dB PAD Playback Switch", EMU_HANA_0202_DAC_PAD1),
+ EMU1010_DAC_PADS("DAC1 Audio Dock -14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD1),
+ EMU1010_DAC_PADS("DAC2 Audio Dock -14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD2),
+ EMU1010_DAC_PADS("DAC3 Audio Dock -14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD3),
+ EMU1010_DAC_PADS("DAC4 Audio Dock -14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD4),
+ EMU1010_DAC_PADS("DAC1 0202 -14dB PAD Playback Switch", EMU_HANA_0202_DAC_PAD1),
};
@@ -990,8 +990,8 @@
static struct snd_kcontrol_new snd_audigy_i2c_volume_ctls[] __devinitdata = {
- I2C_VOLUME("Mic Capture Volume", 0),
- I2C_VOLUME("Line Capture Volume", 0)
+ I2C_VOLUME("Line Left Capture Volume", 0),
+ I2C_VOLUME("Line Right Capture Volume", 0)
};
#if 0
[-- Attachment #3: emu10k1.1.dar.bz2 --]
[-- Type: application/x-bzip2, Size: 39901 bytes --]
[-- Attachment #4: Снимок экрана от 2012-11-22 16:17:38.png --]
[-- Type: image/png, Size: 179266 bytes --]
[-- Attachment #5: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: EMU-1212m "no Audiodock - no firmware" patch
2012-11-22 17:17 ` Takashi Iwai
2012-11-22 20:09 ` oeai
2012-12-29 2:45 ` oeai
@ 2012-12-29 2:52 ` oeai
2 siblings, 0 replies; 9+ messages in thread
From: oeai @ 2012-12-29 2:52 UTC (permalink / raw)
To: Takashi Iwai, James Courtier-Dutton, alsa-devel
[-- Attachment #1: Type: text/plain, Size: 1147 bytes --]
here's the file with patch
aLoha!
Sorry, being so long, i was doing some other things.
i've downloaded the sound.git and somehow just compiled right what i
needed and changed the code.
i've changed the snd_emu10k1_emu1010_init function so it is now loading
regs from other function load_patches
because of that a lot of space has changed, but it is simplier to
just set to default right now
and the error in the init function was that it was not calling the
load_firmware function in the end
that's the real problem
and a lot of changes that in the load_patches are just to leave
audiodock outside if it is not presented
tried the resume function - it's not working for emu1212 need to
reload alsa
i thought of calling dev_create or dev_free but not sure how to use
it free_emu is hanging up on wake_up
yeah i've done the exclamation !EMU_HANA_OPTION_DOCK_OFFLINE in
firmware_thread and added "else if" to avoid occasional error
well it is Loading!!!
and looks like no loops occuring.
in the bottom there's a emufx.c patch
Disabled most of unuseful sliders for emu_model cards
--
OEAI
[-- Attachment #2: emu10k1.patchy --]
[-- Type: text/plain, Size: 26956 bytes --]
----------------------- sound/pci/emu10k1/emu10k1_main.c -----------------------
index a7c296a..2b2647a 100644
@@ -161,6 +161,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
int ch;
u32 tmp;
+ snd_printk(KERN_INFO "Creative Audio : Starting loader \n");
/* disable audio and lock cache */
outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK |
HCFG_MUTEBUTTONENABLE, emu->port + HCFG);
@@ -217,7 +218,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
}
if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */
/* Hacks for Alice3 to work independent of haP16V driver */
- snd_printk(KERN_INFO "Audigy2 value: Special config.\n");
+ snd_printk(KERN_INFO "Creative Audio : Special config. ca0108 chip ready \n");
/* Setup SRCMulti_I2S SamplingRate */
tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
tmp &= 0xfffff1ff;
@@ -244,6 +245,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
if (emu->card_capabilities->spi_dac) { /* Audigy 2 ZS Notebook with DAC Wolfson WM8768/WM8568 */
int size, n;
+ snd_printk(KERN_INFO "Creative Audio : Special config. spi_dac chip ready \n");
size = ARRAY_SIZE(spi_dac_init);
for (n = 0; n < size; n++)
snd_emu10k1_spi_write(emu, spi_dac_init[n]);
@@ -264,6 +266,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
if (emu->card_capabilities->i2c_adc) { /* Audigy 2 ZS Notebook with ADC Wolfson WM8775 */
int size, n;
+ snd_printk(KERN_INFO "Creative Audio : Special config. i2c_adc chip ready \n");
snd_emu10k1_ptr20_write(emu, P17V_I2S_SRC_SEL, 0, 0x2020205f);
tmp = inl(emu->port + A_IOCFG);
outl(tmp | 0x4, emu->port + A_IOCFG); /* Set bit 2 for mic input */
@@ -289,6 +292,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
}
if (emu->card_capabilities->emu_model) {
+ snd_printk(KERN_INFO "Creative Audio : Special config. Creative E-MU SoundCard found \n");
outl(HCFG_AUTOMUTE_ASYNC |
HCFG_EMU32_SLAVE |
HCFG_AUDIOENABLE, emu->port + HCFG);
@@ -720,7 +724,7 @@ static int emu1010_firmware_thread(void *data)
#endif
snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp); /* IRQ Status */
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ®); /* OPTIONS: Which cards are attached to the EMU */
- if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) {
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE) { /* ! if it is really connected -> it must be online*/
/* Audio Dock attached */
/* Return to Audio Dock programming mode */
snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n");
@@ -751,6 +755,12 @@ static int emu1010_firmware_thread(void *data)
/* Unmute all. Default is muted after a firmware load */
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
}
+ else if ((reg & 0x3f) == 0x15)
+ {
+ snd_printk(KERN_INFO "emu1212m: trying to load config emu_hana_fpga_config"); /*This is what James Courtier-Dutton was talking about i guess*/
+ snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG,0x02); /*Init FPGA firmware if no audiodock is loaded*/
+ }
+
}
snd_printk(KERN_INFO "emu1010: firmware thread stopping\n");
return 0;
@@ -787,95 +797,15 @@ static int emu1010_firmware_thread(void *data)
* 16 x 16-bit playback - snd_emu10k1_fx8010_playback_ops
* 16 x 32-bit capture - snd_emu10k1_capture_efx_ops
*/
-static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
+
+ /*Load patches for emu card after checking of its availability in emu1010_init*/
+static int snd_emu10k1_emu1010_load_patches(struct snd_emu10k1 *emu)
+
{
unsigned int i;
- u32 tmp, tmp2, reg;
- int err;
+ u32 tmp, reg;
- snd_printk(KERN_INFO "emu1010: Special config.\n");
- /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
- * Lock Sound Memory Cache, Lock Tank Memory Cache,
- * Mute all codecs.
- */
- outl(0x0005a00c, emu->port + HCFG);
- /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
- * Lock Tank Memory Cache,
- * Mute all codecs.
- */
- outl(0x0005a004, emu->port + HCFG);
- /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
- * Mute all codecs.
- */
- outl(0x0005a000, emu->port + HCFG);
- /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
- * Mute all codecs.
- */
- outl(0x0005a000, emu->port + HCFG);
- /* Disable 48Volt power to Audio Dock */
- snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
-
- /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */
- snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®);
- snd_printdd("reg1 = 0x%x\n", reg);
- if ((reg & 0x3f) == 0x15) {
- /* FPGA netlist already present so clear it */
- /* Return to programming mode */
-
- snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02);
- }
- snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®);
- snd_printdd("reg2 = 0x%x\n", reg);
- if ((reg & 0x3f) == 0x15) {
- /* FPGA failed to return to programming mode */
- snd_printk(KERN_INFO "emu1010: FPGA failed to return to programming mode\n");
- return -ENODEV;
- }
- snd_printk(KERN_INFO "emu1010: EMU_HANA_ID = 0x%x\n", reg);
-
- if (!emu->firmware) {
- const char *filename;
- switch (emu->card_capabilities->emu_model) {
- case EMU_MODEL_EMU1010:
- filename = HANA_FILENAME;
- break;
- case EMU_MODEL_EMU1010B:
- filename = EMU1010B_FILENAME;
- break;
- case EMU_MODEL_EMU1616:
- filename = EMU1010_NOTEBOOK_FILENAME;
- break;
- case EMU_MODEL_EMU0404:
- filename = EMU0404_FILENAME;
- break;
- default:
- return -ENODEV;
- }
-
- err = request_firmware(&emu->firmware, filename, &emu->pci->dev);
- if (err != 0) {
- snd_printk(KERN_ERR "emu1010: firmware: %s not found. Err = %d\n", filename, err);
- return err;
- }
- snd_printk(KERN_INFO "emu1010: firmware file = %s, size = 0x%zx\n",
- filename, emu->firmware->size);
- }
-
- /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
- snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®);
- if ((reg & 0x3f) != 0x15) {
- /* FPGA failed to be programmed */
- snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg = 0x%x\n", reg);
- return -ENODEV;
- }
-
- snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n");
- snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp);
- snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2);
- snd_printk(KERN_INFO "emu1010: Hana version: %u.%u\n", tmp, tmp2);
- /* Enable 48Volt power to Audio Dock */
- snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON);
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ®);
snd_printk(KERN_INFO "emu1010: Card options = 0x%x\n", reg);
@@ -896,16 +826,12 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
/* Set no attenuation on Audio Dock pads. */
snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00);
emu->emu1010.adc_pads = 0x00;
- snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp);
- /* Unmute Audio dock DACs, Headphone source DAC-4. */
- snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30);
- snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);
+
snd_emu1010_fpga_read(emu, EMU_HANA_DAC_PADS, &tmp);
/* DAC PADs. */
snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, 0x0f);
emu->emu1010.dac_pads = 0x0f;
- snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp);
- snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30);
+
snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp);
/* SPDIF Format. Set Consumer mode, 24bit, copy enable */
snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10);
@@ -925,8 +851,24 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
/* Word Clock source, Internal 48kHz x1 */
snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K);
/* snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X); */
+
+ /* AudioDock Init */
+ snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ®); /* OPTIONS: Which cards are attached to the EMU */
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+ {
+
+ /* Enable 48Volt power to Audio Dock */
+ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON);
+ snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp);
+ /* Unmute Audio dock DACs, Headphone source DAC-4. */
+ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30);
+ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);
+ /* Disable 48Volt power to Audio Dock */
+ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
+
/* Audio Dock LEDs. */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);
+ }
#if 0
/* For 96kHz */
@@ -960,14 +902,19 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
#endif
#if 1
/* For 48kHz */
- snd_emu1010_fpga_link_dst_src_write(emu,
- EMU_DST_ALICE2_EMU32_0, EMU_SRC_DOCK_MIC_A1);
- snd_emu1010_fpga_link_dst_src_write(emu,
- EMU_DST_ALICE2_EMU32_1, EMU_SRC_DOCK_MIC_B1);
+
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_2, EMU_SRC_HAMOA_ADC_LEFT2);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_3, EMU_SRC_HAMOA_ADC_LEFT2);
+
+ //AudioDOck? - Nah, i don't have it...
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+ {
+ snd_emu1010_fpga_link_dst_src_write(emu,
+ EMU_DST_ALICE2_EMU32_0, EMU_SRC_DOCK_MIC_A1);
+ snd_emu1010_fpga_link_dst_src_write(emu,
+ EMU_DST_ALICE2_EMU32_1, EMU_SRC_DOCK_MIC_B1);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_4, EMU_SRC_DOCK_ADC1_LEFT1);
snd_emu1010_fpga_link_dst_src_write(emu,
@@ -980,16 +927,11 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
* Defaults only, users will set their own values anyways, let's
* just copy/paste.
*/
-
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_8, EMU_SRC_DOCK_MIC_A1);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_9, EMU_SRC_DOCK_MIC_B1);
snd_emu1010_fpga_link_dst_src_write(emu,
- EMU_DST_ALICE2_EMU32_A, EMU_SRC_HAMOA_ADC_LEFT2);
- snd_emu1010_fpga_link_dst_src_write(emu,
- EMU_DST_ALICE2_EMU32_B, EMU_SRC_HAMOA_ADC_LEFT2);
- snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_C, EMU_SRC_DOCK_ADC1_LEFT1);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_D, EMU_SRC_DOCK_ADC1_RIGHT1);
@@ -997,6 +939,13 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
EMU_DST_ALICE2_EMU32_E, EMU_SRC_DOCK_ADC2_LEFT1);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_F, EMU_SRC_DOCK_ADC2_RIGHT1);
+ }
+
+ snd_emu1010_fpga_link_dst_src_write(emu,
+ EMU_DST_ALICE2_EMU32_A, EMU_SRC_HAMOA_ADC_LEFT2);
+ snd_emu1010_fpga_link_dst_src_write(emu,
+ EMU_DST_ALICE2_EMU32_B, EMU_SRC_HAMOA_ADC_LEFT2);
+
#endif
#if 0
/* Original */
@@ -1016,10 +965,14 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
EMU_DST_ALICE2_EMU32_A, EMU_SRC_HANA_ADAT + 6);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_B, EMU_SRC_HANA_ADAT + 7);
+ //AudioDOck? - Nah, i don't have it...
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+ {
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_C, EMU_SRC_DOCK_MIC_A1);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_D, EMU_SRC_DOCK_MIC_B1);
+ }
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_E, EMU_SRC_HAMOA_ADC_LEFT2);
snd_emu1010_fpga_link_dst_src_write(emu,
@@ -1041,6 +994,9 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
/* Hana ADAT Out <- Silence */
snd_emu1010_fpga_link_dst_src_write(emu, EMU_DST_HANA_ADAT + i, EMU_SRC_SILENCE);
}
+ //AudioDOck? - Nah, i don't have it...
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+ {
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE_I2S0_LEFT, EMU_SRC_DOCK_ADC1_LEFT1);
snd_emu1010_fpga_link_dst_src_write(emu,
@@ -1053,6 +1009,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
EMU_DST_ALICE_I2S2_LEFT, EMU_SRC_DOCK_ADC3_LEFT1);
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE_I2S2_RIGHT, EMU_SRC_DOCK_ADC3_RIGHT1);
+ }
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x01); /* Unmute all */
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp);
@@ -1100,6 +1057,9 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616) {
/* 1616(M) cardbus default outputs */
/* ALICE2 bus 0xa0 */
+ //AudioDOck? - Nah, i don't have it...
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+ {
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_DOCK_DAC1_LEFT1, EMU_SRC_ALICE_EMU32A + 0);
emu->emu1010.output_source[0] = 17;
@@ -1118,6 +1078,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_DOCK_DAC3_RIGHT1, EMU_SRC_ALICE_EMU32A + 5);
emu->emu1010.output_source[5] = 22;
+ }
/* ALICE2 bus 0xa0 */
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_MANA_DAC_LEFT, EMU_SRC_ALICE_EMU32A + 0);
@@ -1127,6 +1088,9 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
emu->emu1010.output_source[17] = 18;
} else {
/* ALICE2 bus 0xa0 */
+ //AudioDOck? - Nah, i don't have it...
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+ {
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_DOCK_DAC1_LEFT1, EMU_SRC_ALICE_EMU32A + 0);
emu->emu1010.output_source[0] = 21;
@@ -1165,6 +1129,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_DOCK_SPDIF_RIGHT1, EMU_SRC_ALICE_EMU32A + 1);
emu->emu1010.output_source[11] = 22;
+ }
/* ALICE2 bus 0xa0 */
snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_HANA_SPDIF_LEFT1, EMU_SRC_ALICE_EMU32A + 0);
@@ -1215,7 +1180,11 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K);
/* snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X); */
emu->emu1010.internal_clock = 1; /* 48000 */
+ //AudioDOck? - Nah, i don't have it...
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
+ {
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12); /* Set LEDs on Audio Dock */
+ }
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x1); /* Unmute all */
/* snd_emu1010_fpga_write(emu, 0x7, 0x0); */ /* Mute all */
/* snd_emu1010_fpga_write(emu, 0x7, 0x1); */ /* Unmute all */
@@ -1223,6 +1192,120 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
return 0;
}
+
+/*moved this function down because patch_loading function must be declared first*/
+
+static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
+{
+
+ u32 tmp, tmp2, reg;
+ int err;
+
+ snd_printk(KERN_INFO "E-MU 1x1x : Special config. Found Creative EMU \n");
+ /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
+ * Lock Sound Memory Cache, Lock Tank Memory Cache,
+ * Mute all codecs.
+ */
+ outl(0x0005a00c, emu->port + HCFG);
+ /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
+ * Lock Tank Memory Cache,
+ * Mute all codecs.
+ */
+ outl(0x0005a004, emu->port + HCFG);
+ /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
+ * Mute all codecs.
+ */
+ outl(0x0005a000, emu->port + HCFG);
+ /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
+ * Mute all codecs.
+ */
+ outl(0x0005a000, emu->port + HCFG);
+
+
+ /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */
+ snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®);
+ snd_printdd("reg1 = 0x%x\n", reg);
+ if ((reg & 0x3f) == 0x15) {
+ /* FPGA netlist already present so clear it */
+ /* Return to programming mode */
+ snd_printk(KERN_INFO "emu1212: hana_fpga_config 0x%x\n", reg);
+ snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02);
+ }
+ snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®);
+ snd_printdd("reg2 = 0x%x\n", reg);
+ if (reg == 0x3f)
+ {
+ snd_printdd("reg2 = 0x%x\n", reg);
+ if ((reg & 0x3f) == 0x15) {
+ /* FPGA failed to return to programming mode */
+ snd_printk(KERN_INFO "emu1010: FPGA failed to return to programming mode\n");
+ return -ENODEV;
+ }
+ snd_printk(KERN_INFO "emu1010: EMU_HANA_ID = 0x%x\n", reg);
+
+ if (!emu->firmware) {
+ const char *filename;
+ switch (emu->card_capabilities->emu_model) {
+ case EMU_MODEL_EMU1010:
+ filename = HANA_FILENAME;
+ break;
+ case EMU_MODEL_EMU1010B:
+ filename = EMU1010B_FILENAME;
+ break;
+ case EMU_MODEL_EMU1616:
+ filename = EMU1010_NOTEBOOK_FILENAME;
+ break;
+ case EMU_MODEL_EMU0404:
+ filename = EMU0404_FILENAME;
+ break;
+ default:
+ return -ENODEV;
+ }
+
+ snd_printk(KERN_INFO "Creative Audio : firmware file %s testing\n", filename);
+
+ err = request_firmware(&emu->firmware, filename, &emu->pci->dev);
+ if (err != 0) {
+ snd_printk(KERN_ERR "emu1010: firmware: %s not found. Err = %d\n", filename, err);
+ return err;
+ }
+ snd_printk(KERN_INFO "emu1010: firmware file = %s, size = 0x%zx\n",
+ filename, emu->firmware->size);
+
+ err = snd_emu1010_load_firmware(emu);
+ if (err != 0) {
+ snd_printk(
+ KERN_INFO "emu1010: Loading Firmware file %s failed\n",
+ filename);
+ return err;
+ }
+ }
+
+ /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
+ snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®);
+ if ((reg & 0x3f) != 0x15) {
+ /* FPGA failed to be programmed */
+ snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg = 0x%x\n", reg);
+ return -ENODEV;
+ }
+
+ snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n");
+ snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp);
+ snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2);
+ snd_printk(KERN_INFO "emu1010: Hana version: %u.%u\n", tmp, tmp2);
+
+ /*Here it is loading patches after checking and loading firmware*/
+ return snd_emu10k1_emu1010_load_patches(emu);
+
+ }
+
+ return 0;
+
+}
+
+
+
+
/*
* Create the EMU10K1 instance
*/
@@ -1241,6 +1324,9 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu)
}
if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1010) {
/* Disable 48Volt power to Audio Dock */
+ int reg;
+ snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ®); /* Do i have AudioDock online?*/
+ if (reg & !EMU_HANA_OPTION_DOCK_OFFLINE)
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
}
if (emu->emu1010.firmware_thread)
@@ -1393,16 +1479,17 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.emu10k2_chip = 1,
.ca0108_chip = 1,
.ca_cardbus_chip = 1,
- .spk71 = 1 ,
.emu_model = EMU_MODEL_EMU1616},
/* Tested by James@superbug.co.uk 4th Nov 2007. */
/* This is MAEM8960, 0202 is MAEM 8980 */
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40041102,
- .driver = "Audigy2", .name = "E-mu 1010b PCI [MAEM8960]",
+ .driver = "Audigy2", .name = "E-MU 1010b or 1212m PCI [MAEM8960]",
.id = "EMU1010",
.emu10k2_chip = 1,
.ca0108_chip = 1,
.spk71 = 1,
+ .ca_cardbus_chip = 1,
+ .adc_1361t = 1,
.emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 new revision */
/* Tested by Maxim Kachur <mcdebugger@duganet.ru> 17th Oct 2012. */
/* This is MAEM8986, 0202 is MAEM8980 */
@@ -1893,7 +1980,15 @@ int snd_emu10k1_create(struct snd_card *card,
emu->fx8010.extout_mask = extout_mask;
emu->enable_ir = enable_ir;
- if (emu->card_capabilities->ca_cardbus_chip) {
+/*First init the main card then ca_cardbus*/
+
+ if (emu->card_capabilities->emu_model) {
+ err = snd_emu10k1_emu1010_init(emu);
+ if (err < 0) {
+ snd_emu10k1_free(emu);
+ return err;
+ }
+ } else if (emu->card_capabilities->ca_cardbus_chip) {
err = snd_emu10k1_cardbus_init(emu);
if (err < 0)
goto error;
@@ -1902,12 +1997,7 @@ int snd_emu10k1_create(struct snd_card *card,
err = snd_emu10k1_ecard_init(emu);
if (err < 0)
goto error;
- } else if (emu->card_capabilities->emu_model) {
- err = snd_emu10k1_emu1010_init(emu);
- if (err < 0) {
- snd_emu10k1_free(emu);
- return err;
- }
+
} else {
/* 5.1: Enable the additional AC97 Slots. If the emu10k1 version
does not support this, it shouldn't do any harm */
@@ -2061,12 +2151,18 @@ void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu)
void snd_emu10k1_resume_init(struct snd_emu10k1 *emu)
{
+ if (emu->card_capabilities->emu_model)
+ {
+
+ snd_emu10k1_emu1010_init(emu);
+ snd_emu10k1_resume_regs(emu);
+
+ }
if (emu->card_capabilities->ca_cardbus_chip)
snd_emu10k1_cardbus_init(emu);
if (emu->card_capabilities->ecard)
snd_emu10k1_ecard_init(emu);
- else if (emu->card_capabilities->emu_model)
- snd_emu10k1_emu1010_init(emu);
+
else
snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE);
snd_emu10k1_init(emu, emu->enable_ir, 1);
====================================================================================================
so here's the emufx patch, i cannot push to the git directly, so it is the just like this patch.
2426e9f0d705e0741536b07485ae415f4a14e47b (Merge branch 'for-next')
: master
: sound-3.8
:
Disabled most of unuseful sliders for emu_model cards, if there is emu_model no ac97 or spk71 5.1 interfaces is loading
-------------------------- sound/pci/emu10k1/emufx.c --------------------------
index 0275209..5ed7fbb 100644
@@ -1223,6 +1223,7 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
* where gpr contains attenuation from corresponding mixer control
* (snd_emu10k1_init_stereo_control)
*/
+ if (!emu->card_capabilities->emu_model) {
A_OP(icode, &ptr, iMAC0, A_GPR(playback), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT_FRONT));
A_OP(icode, &ptr, iMAC0, A_GPR(playback+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT_FRONT));
snd_emu10k1_init_stereo_control(&controls[nctl++], "PCM Front Playback Volume", gpr, 100);
@@ -1247,6 +1248,7 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
snd_emu10k1_init_mono_control(&controls[nctl++], "PCM Center Playback Volume", gpr, 100);
gpr++;
+ }
/* PCM LFE Playback (independent from stereo mix) */
A_OP(icode, &ptr, iMAC0, A_GPR(playback+5), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LFE));
snd_emu10k1_init_mono_control(&controls[nctl++], "PCM LFE Playback Volume", gpr, 100);
@@ -1300,6 +1302,20 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
snd_emu10k1_init_stereo_control(&controls[nctl++], "EMU Capture Volume", gpr, 0);
gpr += 2;
}
+
+
+ /* Optical SPDIF Playback Volume */
+ A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_OPT_SPDIF_L);
+ A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_OPT_SPDIF_R);
+ snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",PLAYBACK,VOLUME), gpr, 0);
+ gpr += 2;
+ /* Optical SPDIF Capture Volume */
+ A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_OPT_SPDIF_L);
+ A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_OPT_SPDIF_R);
+ snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",CAPTURE,VOLUME), gpr, 0);
+ gpr += 2;
+
+ if (!emu->card_capabilities->emu_model) {
/* AC'97 Playback Volume - used only for mic (renamed later) */
A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_AC97_L);
A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_AC97_R);
@@ -1329,17 +1345,6 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
gpr, 0);
gpr += 2;
- /* Optical SPDIF Playback Volume */
- A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_OPT_SPDIF_L);
- A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_OPT_SPDIF_R);
- snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",PLAYBACK,VOLUME), gpr, 0);
- gpr += 2;
- /* Optical SPDIF Capture Volume */
- A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_OPT_SPDIF_L);
- A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_OPT_SPDIF_R);
- snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",CAPTURE,VOLUME), gpr, 0);
- gpr += 2;
-
/* Line2 Playback Volume */
A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_LINE2_L);
A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_LINE2_R);
@@ -1515,6 +1520,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
snd_emu10k1_init_stereo_onoff_control(controls + nctl++, "Tone Control - Switch", gpr, 0);
gpr += 2;
+ }
/* Master volume (will be renamed later) */
A_OP(icode, &ptr, iMAC0, A_GPR(playback+0+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr), A_GPR(playback+0+SND_EMU10K1_PLAYBACK_CHANNELS));
A_OP(icode, &ptr, iMAC0, A_GPR(playback+1+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr), A_GPR(playback+1+SND_EMU10K1_PLAYBACK_CHANNELS));
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread