Lines Matching +full:firmware +full:- +full:initialised
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * DSP firmware management
12 #include <linux/firmware.h>
25 * mixart_wait_nice_for_register_value - wait for a value on a peudo register,
55 return -EBUSY; in mixart_wait_nice_for_register_value()
90 static int mixart_load_elf(struct mixart_mgr *mgr, const struct firmware *dsp ) in mixart_load_elf()
96 elf_header = (struct snd_mixart_elf32_ehdr *)dsp->data; in mixart_load_elf()
98 if ( elf32_magic_number[i] != elf_header->e_ident[i] ) in mixart_load_elf()
99 return -EINVAL; in mixart_load_elf()
101 if( elf_header->e_phoff != 0 ) { in mixart_load_elf()
104 for( i=0; i < be16_to_cpu(elf_header->e_phnum); i++ ) { in mixart_load_elf()
105 u32 pos = be32_to_cpu(elf_header->e_phoff) + (u32)(i * be16_to_cpu(elf_header->e_phentsize)); in mixart_load_elf()
107 memcpy( &elf_programheader, dsp->data + pos, sizeof(elf_programheader) ); in mixart_load_elf()
112 dsp->data + be32_to_cpu( elf_programheader.p_offset ), in mixart_load_elf()
142 err = -ENOMEM; in mixart_enum_connectors()
146 audio_info_req->line_max_level = MIXART_FLOAT_P_22_0_TO_HEX; in mixart_enum_connectors()
147 audio_info_req->micro_max_level = MIXART_FLOAT_M_20_0_TO_HEX; in mixart_enum_connectors()
148 audio_info_req->cd_max_level = MIXART_FLOAT____0_0_TO_HEX; in mixart_enum_connectors()
156 if((err < 0) || (connector->error_code) || (connector->uid_count > MIXART_MAX_PHYS_CONNECTORS)) { in mixart_enum_connectors()
157 dev_err(&mgr->pci->dev, in mixart_enum_connectors()
159 err = -EINVAL; in mixart_enum_connectors()
163 for(k=0; k < connector->uid_count; k++) { in mixart_enum_connectors()
167 pipe = &mgr->chip[k/2]->pipe_out_ana; in mixart_enum_connectors()
169 pipe = &mgr->chip[(k-MIXART_FIRST_DIG_AUDIO_ID)/2]->pipe_out_dig; in mixart_enum_connectors()
172 pipe->uid_right_connector = connector->uid[k]; /* odd */ in mixart_enum_connectors()
174 pipe->uid_left_connector = connector->uid[k]; /* even */ in mixart_enum_connectors()
177 …/* dev_dbg(&mgr->pci->dev, "playback connector[%d].object_id = %x\n", k, connector->uid[k].object_… in mixart_enum_connectors()
181 request.uid = connector->uid[k]; in mixart_enum_connectors()
187 dev_err(&mgr->pci->dev, in mixart_enum_connectors()
191 …/*dev_dbg(&mgr->pci->dev, "play analog_info.analog_level_present = %x\n", audio_info->info.analog… in mixart_enum_connectors()
200 if((err < 0) || (connector->error_code) || (connector->uid_count > MIXART_MAX_PHYS_CONNECTORS)) { in mixart_enum_connectors()
201 dev_err(&mgr->pci->dev, in mixart_enum_connectors()
203 err = -EINVAL; in mixart_enum_connectors()
207 for(k=0; k < connector->uid_count; k++) { in mixart_enum_connectors()
211 pipe = &mgr->chip[k/2]->pipe_in_ana; in mixart_enum_connectors()
213 pipe = &mgr->chip[(k-MIXART_FIRST_DIG_AUDIO_ID)/2]->pipe_in_dig; in mixart_enum_connectors()
216 pipe->uid_right_connector = connector->uid[k]; /* odd */ in mixart_enum_connectors()
218 pipe->uid_left_connector = connector->uid[k]; /* even */ in mixart_enum_connectors()
221 …/* dev_dbg(&mgr->pci->dev, "capture connector[%d].object_id = %x\n", k, connector->uid[k].object_i… in mixart_enum_connectors()
225 request.uid = connector->uid[k]; in mixart_enum_connectors()
231 dev_err(&mgr->pci->dev, in mixart_enum_connectors()
235 …/*dev_dbg(&mgr->pci->dev, "rec analog_info.analog_level_present = %x\n", audio_info->info.analog_… in mixart_enum_connectors()
268 dev_dbg(&mgr->pci->dev, in mixart_enum_physio()
271 return -EINVAL; in mixart_enum_physio()
275 mgr->uid_console_manager = console_mgr.uid; in mixart_enum_physio()
284 dev_err(&mgr->pci->dev, in mixart_enum_physio()
287 return -EINVAL; in mixart_enum_physio()
292 return -EINVAL; in mixart_enum_physio()
294 for(k=0; k<mgr->num_cards; k++) { in mixart_enum_physio()
295 mgr->chip[k]->uid_in_analog_physio = phys_io.uid[k]; in mixart_enum_physio()
296 mgr->chip[k]->uid_out_analog_physio = phys_io.uid[phys_io.nb_uid/2 + k]; in mixart_enum_physio()
326 dev_err(&mgr->pci->dev, "error MSG_SYSTEM_SEND_SYNCHRO_CMD\n"); in mixart_first_init()
327 return err == 0 ? -EINVAL : err; in mixart_first_init()
334 /* firmware base addresses (when hard coded) */
337 static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmware *dsp) in mixart_dsp_load()
352 dev_err(&mgr->pci->dev, "miXart is resetting !\n"); in mixart_dsp_load()
353 return -EAGAIN; /* try again later */ in mixart_dsp_load()
361 dev_dbg(&mgr->pci->dev, "xilinx is already loaded !\n"); in mixart_dsp_load()
366 dev_err(&mgr->pci->dev, in mixart_dsp_load()
369 return -EIO; /* modprob -r may help ? */ in mixart_dsp_load()
373 if (((u32*)(dsp->data))[0] == 0xffffffff) in mixart_dsp_load()
374 return -EINVAL; in mixart_dsp_load()
375 if (dsp->size % 4) in mixart_dsp_load()
376 return -EINVAL; in mixart_dsp_load()
384 writel_be( dsp->size, MIXART_MEM( mgr, MIXART_PSEUDOREG_MXLX_SIZE_OFFSET )); in mixart_dsp_load()
387 memcpy_toio( MIXART_MEM( mgr, MIXART_MOTHERBOARD_XLX_BASE_ADDRESS), dsp->data, dsp->size); in mixart_dsp_load()
398 dev_dbg(&mgr->pci->dev, "elf file already loaded !\n"); in mixart_dsp_load()
404 dev_err(&mgr->pci->dev, in mixart_dsp_load()
407 return -EIO; /* modprob -r may help ? */ in mixart_dsp_load()
413 dev_err(&mgr->pci->dev, "xilinx was not loaded or " in mixart_dsp_load()
435 dev_err(&mgr->pci->dev, "elf could not be started\n"); in mixart_dsp_load()
440 …writel_be( (u32)mgr->flowinfo.addr, MIXART_MEM( mgr, MIXART_FLOWTABLE_PTR ) ); /* give pointer of … in mixart_dsp_load()
449 dev_err(&mgr->pci->dev, "xilinx or elf not " in mixart_dsp_load()
451 return -EIO; /* modprob -r may help ? */ in mixart_dsp_load()
457 dev_err(&mgr->pci->dev, "error starting elf file\n"); in mixart_dsp_load()
462 …mgr->board_type = (DAUGHTER_TYPE_MASK & readl_be( MIXART_MEM( mgr, MIXART_PSEUDOREG_DBRD_TYPE_OFFS… in mixart_dsp_load()
464 if (mgr->board_type == MIXART_DAUGHTER_TYPE_NONE) in mixart_dsp_load()
468 if (mgr->board_type != MIXART_DAUGHTER_TYPE_AES ) in mixart_dsp_load()
469 return -EINVAL; in mixart_dsp_load()
473 dev_err(&mgr->pci->dev, in mixart_dsp_load()
476 return -EIO; /* modprob -r may help ? */ in mixart_dsp_load()
480 if (((u32*)(dsp->data))[0] == 0xffffffff) in mixart_dsp_load()
481 return -EINVAL; in mixart_dsp_load()
482 if (dsp->size % 4) in mixart_dsp_load()
483 return -EINVAL; in mixart_dsp_load()
486 writel_be( dsp->size, MIXART_MEM( mgr, MIXART_PSEUDOREG_DXLX_SIZE_OFFSET )); in mixart_dsp_load()
494 dev_err(&mgr->pci->dev, "daughter board load error\n"); in mixart_dsp_load()
501 return -EINVAL; in mixart_dsp_load()
504 memcpy_toio( MIXART_MEM( mgr, val), dsp->data, dsp->size); in mixart_dsp_load()
516 dev_err(&mgr->pci->dev, in mixart_dsp_load()
517 "daughter board could not be initialised\n"); in mixart_dsp_load()
527 dev_err(&mgr->pci->dev, "miXart could not be set up\n"); in mixart_dsp_load()
532 for (card_index = 0; card_index < mgr->num_cards; card_index++) { in mixart_dsp_load()
533 struct snd_mixart *chip = mgr->chip[card_index]; in mixart_dsp_load()
540 err = snd_mixart_create_mixer(chip->mgr); in mixart_dsp_load()
545 err = snd_card_register(chip->card); in mixart_dsp_load()
550 dev_dbg(&mgr->pci->dev, in mixart_dsp_load()
551 "miXart firmware downloaded and successfully set up\n"); in mixart_dsp_load()
564 const struct firmware *fw_entry; in snd_mixart_setup_firmware()
569 if (request_firmware(&fw_entry, path, &mgr->pci->dev)) { in snd_mixart_setup_firmware()
570 dev_err(&mgr->pci->dev, in snd_mixart_setup_firmware()
571 "miXart: can't load firmware %s\n", path); in snd_mixart_setup_firmware()
572 return -ENOENT; in snd_mixart_setup_firmware()
579 mgr->dsp_loaded |= 1 << i; in snd_mixart_setup_firmware()