| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for Digigram VX soundcards |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Hardware core part |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | | - * (at your option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License |
|---|
| 19 | | - * along with this program; if not, write to the Free Software |
|---|
| 20 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 21 | 8 | */ |
|---|
| 22 | 9 | |
|---|
| 23 | 10 | #include <linux/delay.h> |
|---|
| .. | .. |
|---|
| 52 | 39 | int snd_vx_check_reg_bit(struct vx_core *chip, int reg, int mask, int bit, int time) |
|---|
| 53 | 40 | { |
|---|
| 54 | 41 | unsigned long end_time = jiffies + (time * HZ + 999) / 1000; |
|---|
| 55 | | - static char *reg_names[VX_REG_MAX] = { |
|---|
| 42 | + static const char * const reg_names[VX_REG_MAX] = { |
|---|
| 56 | 43 | "ICR", "CVR", "ISR", "IVR", "RXH", "RXM", "RXL", |
|---|
| 57 | 44 | "DMA", "CDSP", "RFREQ", "RUER/V2", "DATA", "MEMIRQ", |
|---|
| 58 | 45 | "ACQ", "BIT0", "BIT1", "MIC0", "MIC1", "MIC2", |
|---|
| .. | .. |
|---|
| 524 | 511 | /* The start on time code conditions are filled (ie the time code |
|---|
| 525 | 512 | * received by the board is equal to one of those given to it). |
|---|
| 526 | 513 | */ |
|---|
| 527 | | - if (events & TIME_CODE_EVENT_PENDING) |
|---|
| 514 | + if (events & TIME_CODE_EVENT_PENDING) { |
|---|
| 528 | 515 | ; /* so far, nothing to do yet */ |
|---|
| 516 | + } |
|---|
| 529 | 517 | |
|---|
| 530 | 518 | /* The frequency has changed on the board (UER mode). */ |
|---|
| 531 | 519 | if (events & FREQUENCY_CHANGE_EVENT_PENDING) |
|---|
| .. | .. |
|---|
| 601 | 589 | static void vx_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) |
|---|
| 602 | 590 | { |
|---|
| 603 | 591 | struct vx_core *chip = entry->private_data; |
|---|
| 604 | | - static char *audio_src_vxp[] = { "Line", "Mic", "Digital" }; |
|---|
| 605 | | - static char *audio_src_vx2[] = { "Analog", "Analog", "Digital" }; |
|---|
| 606 | | - static char *clock_mode[] = { "Auto", "Internal", "External" }; |
|---|
| 607 | | - static char *clock_src[] = { "Internal", "External" }; |
|---|
| 608 | | - static char *uer_type[] = { "Consumer", "Professional", "Not Present" }; |
|---|
| 592 | + static const char * const audio_src_vxp[] = { "Line", "Mic", "Digital" }; |
|---|
| 593 | + static const char * const audio_src_vx2[] = { "Analog", "Analog", "Digital" }; |
|---|
| 594 | + static const char * const clock_mode[] = { "Auto", "Internal", "External" }; |
|---|
| 595 | + static const char * const clock_src[] = { "Internal", "External" }; |
|---|
| 596 | + static const char * const uer_type[] = { "Consumer", "Professional", "Not Present" }; |
|---|
| 609 | 597 | |
|---|
| 610 | 598 | snd_iprintf(buffer, "%s\n", chip->card->longname); |
|---|
| 611 | 599 | snd_iprintf(buffer, "Xilinx Firmware: %s\n", |
|---|
| 612 | | - chip->chip_status & VX_STAT_XILINX_LOADED ? "Loaded" : "No"); |
|---|
| 600 | + (chip->chip_status & VX_STAT_XILINX_LOADED) ? "Loaded" : "No"); |
|---|
| 613 | 601 | snd_iprintf(buffer, "Device Initialized: %s\n", |
|---|
| 614 | | - chip->chip_status & VX_STAT_DEVICE_INIT ? "Yes" : "No"); |
|---|
| 602 | + (chip->chip_status & VX_STAT_DEVICE_INIT) ? "Yes" : "No"); |
|---|
| 615 | 603 | snd_iprintf(buffer, "DSP audio info:"); |
|---|
| 616 | 604 | if (chip->audio_info & VX_AUDIO_INFO_REAL_TIME) |
|---|
| 617 | 605 | snd_iprintf(buffer, " realtime"); |
|---|
| .. | .. |
|---|
| 643 | 631 | |
|---|
| 644 | 632 | static void vx_proc_init(struct vx_core *chip) |
|---|
| 645 | 633 | { |
|---|
| 646 | | - struct snd_info_entry *entry; |
|---|
| 647 | | - |
|---|
| 648 | | - if (! snd_card_proc_new(chip->card, "vx-status", &entry)) |
|---|
| 649 | | - snd_info_set_text_ops(entry, chip, vx_proc_read); |
|---|
| 634 | + snd_card_ro_proc_new(chip->card, "vx-status", chip, vx_proc_read); |
|---|
| 650 | 635 | } |
|---|
| 651 | 636 | |
|---|
| 652 | 637 | |
|---|
| .. | .. |
|---|
| 732 | 717 | */ |
|---|
| 733 | 718 | int snd_vx_suspend(struct vx_core *chip) |
|---|
| 734 | 719 | { |
|---|
| 735 | | - unsigned int i; |
|---|
| 736 | | - |
|---|
| 737 | 720 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); |
|---|
| 738 | 721 | chip->chip_status |= VX_STAT_IN_SUSPEND; |
|---|
| 739 | | - for (i = 0; i < chip->hw->num_codecs; i++) |
|---|
| 740 | | - snd_pcm_suspend_all(chip->pcm[i]); |
|---|
| 741 | 722 | |
|---|
| 742 | 723 | return 0; |
|---|
| 743 | 724 | } |
|---|
| .. | .. |
|---|
| 785 | 766 | * |
|---|
| 786 | 767 | * return the instance pointer if successful, NULL in error. |
|---|
| 787 | 768 | */ |
|---|
| 788 | | -struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw, |
|---|
| 789 | | - struct snd_vx_ops *ops, |
|---|
| 769 | +struct vx_core *snd_vx_create(struct snd_card *card, |
|---|
| 770 | + const struct snd_vx_hardware *hw, |
|---|
| 771 | + const struct snd_vx_ops *ops, |
|---|
| 790 | 772 | int extra_size) |
|---|
| 791 | 773 | { |
|---|
| 792 | 774 | struct vx_core *chip; |
|---|