diff options
author | Christian Pointner <equinox@helsinki.at> | 2025-03-29 11:20:29 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2025-03-29 11:20:29 (GMT) |
commit | 2f0f51426a2331873c2f3795c2ea2290ad04fcab (patch) | |
tree | c32f0fba22c91457a6dd0459a3b67af321de982a /snd-pcxhr-dkms/src/pcxhr_hwdep.c | |
parent | 73b1ed36085870e0cf1abf892479b47404ca23f4 (diff) |
snd-pcxhr: import refreshed version of patchset
Diffstat (limited to 'snd-pcxhr-dkms/src/pcxhr_hwdep.c')
-rw-r--r-- | snd-pcxhr-dkms/src/pcxhr_hwdep.c | 61 |
1 files changed, 28 insertions, 33 deletions
diff --git a/snd-pcxhr-dkms/src/pcxhr_hwdep.c b/snd-pcxhr-dkms/src/pcxhr_hwdep.c index c9c3752..da67207 100644 --- a/snd-pcxhr-dkms/src/pcxhr_hwdep.c +++ b/snd-pcxhr-dkms/src/pcxhr_hwdep.c @@ -1,23 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * Driver for Digigram pcxhr compatible soundcards * * hwdep device manager * * Copyright (c) 2004 by Digigram <alsa@digigram.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/interrupt.h> @@ -26,7 +13,7 @@ #include <linux/pci.h> #include <linux/module.h> #include <linux/delay.h> -#include <asm/io.h> +#include <linux/io.h> #include <sound/core.h> #include <sound/hwdep.h> #include "pcxhr.h" @@ -73,7 +60,8 @@ static int pcxhr_init_board(struct pcxhr_mgr *mgr) /* test max nb substream per pipe */ if (((rmh.stat[1] >> 7) & 0x5F) < PCXHR_PLAYBACK_STREAMS) return -EINVAL; - snd_printdd("supported formats : playback=%x capture=%x\n", + dev_dbg(&mgr->pci->dev, + "supported formats : playback=%x capture=%x\n", rmh.stat[2], rmh.stat[3]); pcxhr_init_rmh(&rmh, CMD_VERSION); @@ -85,7 +73,8 @@ static int pcxhr_init_board(struct pcxhr_mgr *mgr) err = pcxhr_send_msg(mgr, &rmh); if (err) return err; - snd_printdd("PCXHR DSP version is %d.%d.%d\n", (rmh.stat[0]>>16)&0xff, + dev_dbg(&mgr->pci->dev, + "PCXHR DSP version is %d.%d.%d\n", (rmh.stat[0]>>16)&0xff, (rmh.stat[0]>>8)&0xff, rmh.stat[0]&0xff); mgr->dsp_version = rmh.stat[0]; @@ -180,7 +169,7 @@ static int pcxhr_dsp_allocate_pipe(struct pcxhr_mgr *mgr, stream_count = PCXHR_PLAYBACK_STREAMS; audio_count = 2; /* always stereo */ } - snd_printdd("snd_add_ref_pipe pin(%d) pcm%c0\n", + dev_dbg(&mgr->pci->dev, "snd_add_ref_pipe pin(%d) pcm%c0\n", pin, is_capture ? 'c' : 'p'); pipe->is_capture = is_capture; pipe->first_audio = pin; @@ -195,7 +184,7 @@ static int pcxhr_dsp_allocate_pipe(struct pcxhr_mgr *mgr, } err = pcxhr_send_msg(mgr, &rmh); if (err < 0) { - snd_printk(KERN_ERR "error pipe allocation " + dev_err(&mgr->pci->dev, "error pipe allocation " "(CMD_RES_PIPE) err=%x!\n", err); return err; } @@ -223,14 +212,14 @@ static int pcxhr_dsp_free_pipe( struct pcxhr_mgr *mgr, struct pcxhr_pipe *pipe) /* stop one pipe */ err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 0); if (err < 0) - snd_printk(KERN_ERR "error stopping pipe!\n"); + dev_err(&mgr->pci->dev, "error stopping pipe!\n"); /* release the pipe */ pcxhr_init_rmh(&rmh, CMD_FREE_PIPE); pcxhr_set_pipe_cmd_params(&rmh, pipe->is_capture, pipe->first_audio, 0, 0); err = pcxhr_send_msg(mgr, &rmh); if (err < 0) - snd_printk(KERN_ERR "error pipe release " + dev_err(&mgr->pci->dev, "error pipe release " "(CMD_FREE_PIPE) err(%x)\n", err); pipe->status = PCXHR_PIPE_UNDEFINED; return err; @@ -290,7 +279,8 @@ static int pcxhr_dsp_load(struct pcxhr_mgr *mgr, int index, { int err, card_index; - snd_printdd("loading dsp [%d] size = %lu\n", index, dsp->size); + dev_dbg(&mgr->pci->dev, + "loading dsp [%d] size = %zd\n", index, dsp->size); switch (index) { case PCXHR_FIRMWARE_XLX_INT_INDEX: @@ -314,41 +304,45 @@ static int pcxhr_dsp_load(struct pcxhr_mgr *mgr, int index, return err; break; /* continue with first init */ default: - snd_printk(KERN_ERR "wrong file index\n"); + dev_err(&mgr->pci->dev, "wrong file index\n"); return -EFAULT; } /* end of switch file index*/ /* first communication with embedded */ err = pcxhr_init_board(mgr); if (err < 0) { - snd_printk(KERN_ERR "pcxhr could not be set up\n"); + dev_err(&mgr->pci->dev, "pcxhr could not be set up\n"); return err; } err = pcxhr_config_pipes(mgr); if (err < 0) { - snd_printk(KERN_ERR "pcxhr pipes could not be set up\n"); + dev_err(&mgr->pci->dev, "pcxhr pipes could not be set up\n"); return err; } /* create devices and mixer in accordance with HW options*/ for (card_index = 0; card_index < mgr->num_cards; card_index++) { struct snd_pcxhr *chip = mgr->chip[card_index]; - if ((err = pcxhr_create_pcm(chip)) < 0) + err = pcxhr_create_pcm(chip); + if (err < 0) return err; if (card_index == 0) { - if ((err = pcxhr_create_mixer(chip->mgr)) < 0) + err = pcxhr_create_mixer(chip->mgr); + if (err < 0) return err; } - if ((err = snd_card_register(chip->card)) < 0) + err = snd_card_register(chip->card); + if (err < 0) return err; } err = pcxhr_start_pipes(mgr); if (err < 0) { - snd_printk(KERN_ERR "pcxhr pipes could not be started\n"); + dev_err(&mgr->pci->dev, "pcxhr pipes could not be started\n"); return err; } - snd_printdd("pcxhr firmware downloaded and successfully set up\n"); + dev_dbg(&mgr->pci->dev, + "pcxhr firmware downloaded and successfully set up\n"); return 0; } @@ -359,7 +353,7 @@ static int pcxhr_dsp_load(struct pcxhr_mgr *mgr, int index, static int get_xilinx_version(struct pcxhr_mgr *mgr){ if (pcxhr_is_device_compatible_IE (mgr->pci->subsystem_device, PCXHR_DEVICE_IE5_ID)){ int xlx_version = cpu_to_be32(PCXHR_INPL(mgr, PCXHR_DSP, PCXHR_XLX_VERSION)); - snd_printk(KERN_DEBUG "Magic : %04x Version : %04x\n", xlx_version>>16, xlx_version&0x00ff); + dev_err(&mgr->pci->dev, "Magic : %04x Version : %04x\n", xlx_version>>16, xlx_version&0x00ff); } return 0; } @@ -369,7 +363,7 @@ static int get_xilinx_version(struct pcxhr_mgr *mgr){ */ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) { - static char *fw_files[][5] = { + static const char *fw_files[][5] = { /* xilinx 1 xilinx 2 eeprom boot dsp */ [0] = { "xlxint.dat", "xlxc882hr.dat", "dspe882.e56", "dspb882hr.b56", "dspd882.d56" }, [1] = { "xlxint.dat", "xlxc882e.dat", "dspe882.e56", "dspb882e.b56", "dspd882.d56" }, @@ -398,7 +392,8 @@ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) } sprintf(path, "pcxhr/%s", fw_files[fw_set][i]); if (request_firmware(&fw_entry, path, &mgr->pci->dev)) { - snd_printk(KERN_ERR "pcxhr: can't load firmware %s\n", + dev_err(&mgr->pci->dev, + "pcxhr: can't load firmware %s\n", path); return -ENOENT; } |