forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/sound/drivers/vx/vx_core.c
....@@ -1,23 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for Digigram VX soundcards
34 *
45 * Hardware core part
56 *
67 * 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
218 */
229
2310 #include <linux/delay.h>
....@@ -52,7 +39,7 @@
5239 int snd_vx_check_reg_bit(struct vx_core *chip, int reg, int mask, int bit, int time)
5340 {
5441 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] = {
5643 "ICR", "CVR", "ISR", "IVR", "RXH", "RXM", "RXL",
5744 "DMA", "CDSP", "RFREQ", "RUER/V2", "DATA", "MEMIRQ",
5845 "ACQ", "BIT0", "BIT1", "MIC0", "MIC1", "MIC2",
....@@ -524,8 +511,9 @@
524511 /* The start on time code conditions are filled (ie the time code
525512 * received by the board is equal to one of those given to it).
526513 */
527
- if (events & TIME_CODE_EVENT_PENDING)
514
+ if (events & TIME_CODE_EVENT_PENDING) {
528515 ; /* so far, nothing to do yet */
516
+ }
529517
530518 /* The frequency has changed on the board (UER mode). */
531519 if (events & FREQUENCY_CHANGE_EVENT_PENDING)
....@@ -601,17 +589,17 @@
601589 static void vx_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
602590 {
603591 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" };
609597
610598 snd_iprintf(buffer, "%s\n", chip->card->longname);
611599 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");
613601 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");
615603 snd_iprintf(buffer, "DSP audio info:");
616604 if (chip->audio_info & VX_AUDIO_INFO_REAL_TIME)
617605 snd_iprintf(buffer, " realtime");
....@@ -643,10 +631,7 @@
643631
644632 static void vx_proc_init(struct vx_core *chip)
645633 {
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);
650635 }
651636
652637
....@@ -732,12 +717,8 @@
732717 */
733718 int snd_vx_suspend(struct vx_core *chip)
734719 {
735
- unsigned int i;
736
-
737720 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot);
738721 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]);
741722
742723 return 0;
743724 }
....@@ -785,8 +766,9 @@
785766 *
786767 * return the instance pointer if successful, NULL in error.
787768 */
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,
790772 int extra_size)
791773 {
792774 struct vx_core *chip;