24 #include <linux/pci.h>
27 #include <linux/slab.h>
28 #include <linux/module.h>
45 static int mixart_wait_nice_for_register_value(
struct mixart_mgr *mgr,
49 unsigned long end_time =
jiffies + (timeout *
HZ / 100);
59 if(read == value)
return 0;
62 if(read != value)
return 0;
103 char elf32_magic_number[4] = {0x7f,
'E',
'L',
'F'};
109 if ( elf32_magic_number[i] != elf_header->
e_ident[i] )
112 if( elf_header->
e_phoff != 0 ) {
118 memcpy( &elf_programheader, dsp->
data + pos,
sizeof(elf_programheader) );
120 if(elf_programheader.p_type != 0) {
121 if( elf_programheader.p_filesz != 0 ) {
137 #define MIXART_FIRST_ANA_AUDIO_ID 0
138 #define MIXART_FIRST_DIG_AUDIO_ID 8
140 static int mixart_enum_connectors(
struct mixart_mgr *mgr)
152 if (! connector || ! audio_info_req || ! audio_info) {
173 for(k=0; k < connector->
uid_count; k++) {
177 pipe = &mgr->
chip[k/2]->pipe_out_ana;
191 request.
uid = connector->
uid[
k];
192 request.
data = audio_info_req;
193 request.
size =
sizeof(*audio_info_req);
215 for(k=0; k < connector->
uid_count; k++) {
219 pipe = &mgr->
chip[k/2]->pipe_in_ana;
233 request.
uid = connector->
uid[
k];
234 request.
data = audio_info_req;
235 request.
size =
sizeof(*audio_info_req);
248 kfree(audio_info_req);
254 static int mixart_enum_physio(
struct mixart_mgr *mgr)
264 get_console_mgr.object_id = 0;
269 request.data = &get_console_mgr;
270 request.size =
sizeof(get_console_mgr);
274 if( (err < 0) || (console_mgr.error_code != 0) ) {
284 request.data = &console_mgr.uid;
285 request.size =
sizeof(console_mgr.uid);
288 if( (err < 0) || ( phys_io.error_code != 0 ) ) {
289 snd_printk(
KERN_ERR "error MSG_SYSTEM_ENUM_PHYSICAL_IO err(%x) error_code(%x)\n", err, phys_io.error_code );
298 mgr->
chip[
k]->uid_in_analog_physio = phys_io.uid[
k];
299 mgr->
chip[
k]->uid_out_analog_physio = phys_io.uid[phys_io.nb_uid/2 +
k];
306 static int mixart_first_init(
struct mixart_mgr *mgr)
312 if((err = mixart_enum_connectors(mgr)) < 0)
return err;
314 if((err = mixart_enum_physio(mgr)) < 0)
return err;
324 if( (err < 0) || (k != 0) ) {
334 #define MIXART_MOTHERBOARD_XLX_BASE_ADDRESS 0x00600000
339 u32 status_xilinx, status_elf, status_daught;
350 if (status_xilinx == 5) {
359 if (status_xilinx == 4) {
364 if (status_xilinx != 0) {
371 if (((
u32*)(dsp->
data))[0] == 0xffffffff)
395 if (status_elf == 4) {
401 if (status_elf != 0) {
411 "could not be started\n");
423 err = mixart_load_elf( mgr, dsp );
424 if (err < 0)
return err;
445 if (status_elf != 4 || status_xilinx != 4) {
447 "successfully loaded\n");
469 if (status_daught != 0) {
476 if (((
u32*)(dsp->
data))[0] == 0xffffffff)
513 "daughter board could not be initialised\n");
521 err = mixart_first_init(mgr);
528 for (card_index = 0; card_index < mgr->
num_cards; card_index++) {
534 if (card_index == 0) {
543 snd_printdd(
"miXart firmware downloaded and successfully set up\n");
549 #if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
550 #if !defined(CONFIG_USE_MIXARTLOADER) && !defined(CONFIG_SND_MIXART)
551 #define SND_MIXART_FW_LOADER
555 #ifdef SND_MIXART_FW_LOADER
559 static char *fw_files[3] = {
560 "miXart8.xlx",
"miXart8.elf",
"miXart8AES.xlx"
567 for (i = 0; i < 3; i++) {
568 sprintf(path,
"mixart/%s", fw_files[i]);
574 err = mixart_dsp_load(mgr, i, fw_entry);
590 #define SND_MIXART_HWDEP_ID "miXart Loader"
592 static int mixart_hwdep_dsp_status(
struct snd_hwdep *
hw,
607 static int mixart_hwdep_dsp_load(
struct snd_hwdep *
hw,
625 err = mixart_dsp_load(mgr, dsp->
index, &
fw);
644 hw->
ops.dsp_status = mixart_hwdep_dsp_status;
645 hw->
ops.dsp_load = mixart_hwdep_dsp_load;