--- zzzz-none-000/linux-3.10.107/sound/pci/echoaudio/echoaudio_dsp.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/sound/pci/echoaudio/echoaudio_dsp.c 2021-02-04 17:41:59.000000000 +0000 @@ -53,7 +53,7 @@ udelay(1); } - snd_printk(KERN_ERR "wait_handshake(): Timeout waiting for DSP\n"); + dev_err(chip->card->dev, "wait_handshake(): Timeout waiting for DSP\n"); return -EBUSY; } @@ -80,7 +80,7 @@ udelay(1); } - DE_ACT((KERN_ERR "timeout on send_vector\n")); + dev_err(chip->card->dev, "timeout on send_vector\n"); return -EBUSY; } @@ -103,8 +103,8 @@ cond_resched(); } - chip->bad_board = TRUE; /* Set TRUE until DSP re-loaded */ - DE_ACT((KERN_ERR "write_dsp: Set bad_board to TRUE\n")); + chip->bad_board = true; /* Set true until DSP re-loaded */ + dev_dbg(chip->card->dev, "write_dsp: Set bad_board to true\n"); return -EIO; } @@ -126,8 +126,8 @@ cond_resched(); } - chip->bad_board = TRUE; /* Set TRUE until DSP re-loaded */ - DE_INIT((KERN_ERR "read_dsp: Set bad_board to TRUE\n")); + chip->bad_board = true; /* Set true until DSP re-loaded */ + dev_err(chip->card->dev, "read_dsp: Set bad_board to true\n"); return -EIO; } @@ -149,12 +149,14 @@ for (i = 0; i < 5; i++) { if (read_dsp(chip, &sn[i])) { - snd_printk(KERN_ERR "Failed to read serial number\n"); + dev_err(chip->card->dev, + "Failed to read serial number\n"); return -EIO; } } - DE_INIT(("Read serial number %08x %08x %08x %08x %08x\n", - sn[0], sn[1], sn[2], sn[3], sn[4])); + dev_dbg(chip->card->dev, + "Read serial number %08x %08x %08x %08x %08x\n", + sn[0], sn[1], sn[2], sn[3], sn[4]); return 0; } @@ -164,7 +166,7 @@ /* This card has no ASIC, just return ok */ static inline int check_asic_status(struct echoaudio *chip) { - chip->asic_loaded = TRUE; + chip->asic_loaded = true; return 0; } @@ -184,7 +186,7 @@ err = get_firmware(&fw, chip, asic); if (err < 0) { - snd_printk(KERN_WARNING "Firmware not found !\n"); + dev_warn(chip->card->dev, "Firmware not found !\n"); return err; } @@ -204,13 +206,12 @@ goto la_error; } - DE_INIT(("ASIC loaded\n")); - free_firmware(fw); + free_firmware(fw, chip); return 0; la_error: - DE_INIT(("failed on write_dsp\n")); - free_firmware(fw); + dev_err(chip->card->dev, "failed on write_dsp\n"); + free_firmware(fw, chip); return -EIO; } @@ -240,14 +241,15 @@ loader is already installed, host flag 5 will be on. */ status = get_dsp_register(chip, CHI32_STATUS_REG); if (status & CHI32_STATUS_REG_HF5) { - DE_INIT(("Resident loader already installed; status is 0x%x\n", - status)); + dev_dbg(chip->card->dev, + "Resident loader already installed; status is 0x%x\n", + status); return 0; } i = get_firmware(&fw, chip, FW_361_LOADER); if (i < 0) { - snd_printk(KERN_WARNING "Firmware not found !\n"); + dev_warn(chip->card->dev, "Firmware not found !\n"); return i; } @@ -282,12 +284,14 @@ /* Write the count to the DSP */ if (write_dsp(chip, words)) { - DE_INIT(("install_resident_loader: Failed to write word count!\n")); + dev_err(chip->card->dev, + "install_resident_loader: Failed to write word count!\n"); goto irl_error; } /* Write the DSP address */ if (write_dsp(chip, address)) { - DE_INIT(("install_resident_loader: Failed to write DSP address!\n")); + dev_err(chip->card->dev, + "install_resident_loader: Failed to write DSP address!\n"); goto irl_error; } /* Write out this block of code to the DSP */ @@ -296,7 +300,8 @@ data = ((u32)code[index] << 16) + code[index + 1]; if (write_dsp(chip, data)) { - DE_INIT(("install_resident_loader: Failed to write DSP code\n")); + dev_err(chip->card->dev, + "install_resident_loader: Failed to write DSP code\n"); goto irl_error; } index += 2; @@ -311,16 +316,16 @@ } if (i == 200) { - DE_INIT(("Resident loader failed to set HF5\n")); + dev_err(chip->card->dev, "Resident loader failed to set HF5\n"); goto irl_error; } - DE_INIT(("Resident loader successfully installed\n")); - free_firmware(fw); + dev_dbg(chip->card->dev, "Resident loader successfully installed\n"); + free_firmware(fw, chip); return 0; irl_error: - free_firmware(fw); + free_firmware(fw, chip); return -EIO; } @@ -333,14 +338,14 @@ int index, words, i; if (chip->dsp_code == code) { - DE_INIT(("DSP is already loaded!\n")); + dev_warn(chip->card->dev, "DSP is already loaded!\n"); return 0; } - chip->bad_board = TRUE; /* Set TRUE until DSP loaded */ + chip->bad_board = true; /* Set true until DSP loaded */ chip->dsp_code = NULL; /* Current DSP code not loaded */ - chip->asic_loaded = FALSE; /* Loading the DSP code will reset the ASIC */ + chip->asic_loaded = false; /* Loading the DSP code will reset the ASIC */ - DE_INIT(("load_dsp: Set bad_board to TRUE\n")); + dev_dbg(chip->card->dev, "load_dsp: Set bad_board to true\n"); /* If this board requires a resident loader, install it. */ #ifdef DSP_56361 @@ -350,7 +355,8 @@ /* Send software reset command */ if (send_vector(chip, DSP_VC_RESET) < 0) { - DE_INIT(("LoadDsp: send_vector DSP_VC_RESET failed, Critical Failure\n")); + dev_err(chip->card->dev, + "LoadDsp: send_vector DSP_VC_RESET failed, Critical Failure\n"); return -EIO; } /* Delay 10us */ @@ -365,7 +371,8 @@ } if (i == 1000) { - DE_INIT(("load_dsp: Timeout waiting for CHI32_STATUS_REG_HF3\n")); + dev_err(chip->card->dev, + "load_dsp: Timeout waiting for CHI32_STATUS_REG_HF3\n"); return -EIO; } @@ -402,29 +409,34 @@ index += 2; if (write_dsp(chip, words) < 0) { - DE_INIT(("load_dsp: failed to write number of DSP words\n")); + dev_err(chip->card->dev, + "load_dsp: failed to write number of DSP words\n"); return -EIO; } if (write_dsp(chip, address) < 0) { - DE_INIT(("load_dsp: failed to write DSP address\n")); + dev_err(chip->card->dev, + "load_dsp: failed to write DSP address\n"); return -EIO; } if (write_dsp(chip, mem_type) < 0) { - DE_INIT(("load_dsp: failed to write DSP memory type\n")); + dev_err(chip->card->dev, + "load_dsp: failed to write DSP memory type\n"); return -EIO; } /* Code */ for (i = 0; i < words; i++, index+=2) { data = ((u32)code[index] << 16) + code[index + 1]; if (write_dsp(chip, data) < 0) { - DE_INIT(("load_dsp: failed to write DSP data\n")); + dev_err(chip->card->dev, + "load_dsp: failed to write DSP data\n"); return -EIO; } } } if (write_dsp(chip, 0) < 0) { /* We're done!!! */ - DE_INIT(("load_dsp: Failed to write final zero\n")); + dev_err(chip->card->dev, + "load_dsp: Failed to write final zero\n"); return -EIO; } udelay(10); @@ -437,12 +449,14 @@ get_dsp_register(chip, CHI32_CONTROL_REG) & ~0x1b00); if (write_dsp(chip, DSP_FNC_SET_COMMPAGE_ADDR) < 0) { - DE_INIT(("load_dsp: Failed to write DSP_FNC_SET_COMMPAGE_ADDR\n")); + dev_err(chip->card->dev, + "load_dsp: Failed to write DSP_FNC_SET_COMMPAGE_ADDR\n"); return -EIO; } if (write_dsp(chip, chip->comm_page_phys) < 0) { - DE_INIT(("load_dsp: Failed to write comm page address\n")); + dev_err(chip->card->dev, + "load_dsp: Failed to write comm page address\n"); return -EIO; } @@ -451,19 +465,20 @@ We don't actually use the serial number but we have to get it as part of the DSP init voodoo. */ if (read_sn(chip) < 0) { - DE_INIT(("load_dsp: Failed to read serial number\n")); + dev_err(chip->card->dev, + "load_dsp: Failed to read serial number\n"); return -EIO; } chip->dsp_code = code; /* Show which DSP code loaded */ - chip->bad_board = FALSE; /* DSP OK */ - DE_INIT(("load_dsp: OK!\n")); + chip->bad_board = false; /* DSP OK */ return 0; } udelay(100); } - DE_INIT(("load_dsp: DSP load timed out waiting for HF4\n")); + dev_err(chip->card->dev, + "load_dsp: DSP load timed out waiting for HF4\n"); return -EIO; } @@ -490,7 +505,7 @@ if (err < 0) return err; err = load_dsp(chip, (u16 *)fw->data); - free_firmware(fw); + free_firmware(fw, chip); if (err < 0) return err; @@ -657,7 +672,6 @@ static int restore_dsp_rettings(struct echoaudio *chip) { int i, o, err; - DE_INIT(("restore_dsp_settings\n")); if ((err = check_asic_status(chip)) < 0) return err; @@ -754,7 +768,6 @@ if (send_vector(chip, DSP_VC_UPDATE_FLAGS) < 0) return -EIO; - DE_INIT(("restore_dsp_rettings done\n")); return 0; } @@ -834,7 +847,8 @@ break; } } - DE_ACT(("set_audio_format[%d] = %x\n", pipe_index, dsp_format)); + dev_dbg(chip->card->dev, + "set_audio_format[%d] = %x\n", pipe_index, dsp_format); chip->comm_page->audio_format[pipe_index] = cpu_to_le16(dsp_format); } @@ -847,7 +861,6 @@ static int start_transport(struct echoaudio *chip, u32 channel_mask, u32 cyclic_mask) { - DE_ACT(("start_transport %x\n", channel_mask)); if (wait_handshake(chip)) return -EIO; @@ -865,7 +878,7 @@ return 0; } - DE_ACT(("start_transport: No pipes to start!\n")); + dev_err(chip->card->dev, "start_transport: No pipes to start!\n"); return -EINVAL; } @@ -873,7 +886,6 @@ static int pause_transport(struct echoaudio *chip, u32 channel_mask) { - DE_ACT(("pause_transport %x\n", channel_mask)); if (wait_handshake(chip)) return -EIO; @@ -892,7 +904,7 @@ return 0; } - DE_ACT(("pause_transport: No pipes to stop!\n")); + dev_warn(chip->card->dev, "pause_transport: No pipes to stop!\n"); return 0; } @@ -900,7 +912,6 @@ static int stop_transport(struct echoaudio *chip, u32 channel_mask) { - DE_ACT(("stop_transport %x\n", channel_mask)); if (wait_handshake(chip)) return -EIO; @@ -919,7 +930,7 @@ return 0; } - DE_ACT(("stop_transport: No pipes to stop!\n")); + dev_warn(chip->card->dev, "stop_transport: No pipes to stop!\n"); return 0; } @@ -936,15 +947,14 @@ stopped and unallocated. */ static int rest_in_peace(struct echoaudio *chip) { - DE_ACT(("rest_in_peace() open=%x\n", chip->pipe_alloc_mask)); /* Stops all active pipes (just to be sure) */ stop_transport(chip, chip->active_mask); - set_meters_on(chip, FALSE); + set_meters_on(chip, false); #ifdef ECHOCARD_HAS_MIDI - enable_midi_input(chip, FALSE); + enable_midi_input(chip, false); #endif /* Go to sleep */ @@ -964,15 +974,16 @@ { /* Check if the compiler added extra padding inside the structure */ if (offsetof(struct comm_page, midi_output) != 0xbe0) { - DE_INIT(("init_dsp_comm_page() - Invalid struct comm_page structure\n")); + dev_err(chip->card->dev, + "init_dsp_comm_page() - Invalid struct comm_page structure\n"); return -EPERM; } /* Init all the basic stuff */ chip->card_name = ECHOCARD_NAME; - chip->bad_board = TRUE; /* Set TRUE until DSP loaded */ + chip->bad_board = true; /* Set true until DSP loaded */ chip->dsp_code = NULL; /* Current DSP code not loaded */ - chip->asic_loaded = FALSE; + chip->asic_loaded = false; memset(chip->comm_page, 0, sizeof(struct comm_page)); /* Init the comm page */ @@ -998,7 +1009,6 @@ */ static int init_line_levels(struct echoaudio *chip) { - DE_INIT(("init_line_levels\n")); memset(chip->output_gain, ECHOGAIN_MUTED, sizeof(chip->output_gain)); memset(chip->input_gain, ECHOGAIN_MUTED, sizeof(chip->input_gain)); memset(chip->monitor_gain, ECHOGAIN_MUTED, sizeof(chip->monitor_gain)); @@ -1050,7 +1060,8 @@ u32 channel_mask; char is_cyclic; - DE_ACT(("allocate_pipes: ch=%d int=%d\n", pipe_index, interleave)); + dev_dbg(chip->card->dev, + "allocate_pipes: ch=%d int=%d\n", pipe_index, interleave); if (chip->bad_board) return -EIO; @@ -1060,7 +1071,8 @@ for (channel_mask = i = 0; i < interleave; i++) channel_mask |= 1 << (pipe_index + i); if (chip->pipe_alloc_mask & channel_mask) { - DE_ACT(("allocate_pipes: channel already open\n")); + dev_err(chip->card->dev, + "allocate_pipes: channel already open\n"); return -EAGAIN; } @@ -1077,7 +1089,6 @@ it moves data. The DMA counter is in units of bytes, not samples. */ pipe->dma_counter = &chip->comm_page->position[pipe_index]; *pipe->dma_counter = 0; - DE_ACT(("allocate_pipes: ok\n")); return pipe_index; } @@ -1088,7 +1099,6 @@ u32 channel_mask; int i; - DE_ACT(("free_pipes: Pipe %d\n", pipe->index)); if (snd_BUG_ON(!is_pipe_allocated(chip, pipe->index))) return -EINVAL; if (snd_BUG_ON(pipe->state != PIPE_STATE_STOPPED)) @@ -1130,7 +1140,7 @@ list[head].size = cpu_to_le32(length); pipe->sglist_head++; } else { - DE_ACT(("SGlist: too many fragments\n")); + dev_err(chip->card->dev, "SGlist: too many fragments\n"); return -ENOMEM; } return 0;