forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/sound/pci/cs46xx/dsp_spos.c
....@@ -1,18 +1,5 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
2
- * This program is free software; you can redistribute it and/or modify
3
- * it under the terms of the GNU General Public License as published by
4
- * the Free Software Foundation; either version 2 of the License, or
5
- * (at your option) any later version.
6
- *
7
- * This program is distributed in the hope that it will be useful,
8
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- * GNU General Public License for more details.
11
- *
12
- * You should have received a copy of the GNU General Public License
13
- * along with this program; if not, write to the Free Software
14
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
- *
163 */
174
185 /*
....@@ -40,7 +27,7 @@
4027 static int cs46xx_dsp_async_init (struct snd_cs46xx *chip,
4128 struct dsp_scb_descriptor * fg_entry);
4229
43
-static enum wide_opcode wide_opcodes[] = {
30
+static const enum wide_opcode wide_opcodes[] = {
4431 WIDE_FOR_BEGIN_LOOP,
4532 WIDE_FOR_BEGIN_LOOP2,
4633 WIDE_COND_GOTO_ADDR,
....@@ -799,92 +786,49 @@
799786
800787 ins->snd_card = card;
801788
802
- if ((entry = snd_info_create_card_entry(card, "dsp", card->proc_root)) != NULL) {
803
- entry->content = SNDRV_INFO_CONTENT_TEXT;
789
+ entry = snd_info_create_card_entry(card, "dsp", card->proc_root);
790
+ if (entry)
804791 entry->mode = S_IFDIR | 0555;
805
-
806
- if (snd_info_register(entry) < 0) {
807
- snd_info_free_entry(entry);
808
- entry = NULL;
809
- }
810
- }
811
-
812792 ins->proc_dsp_dir = entry;
813793
814794 if (!ins->proc_dsp_dir)
815795 return -ENOMEM;
816796
817
- if ((entry = snd_info_create_card_entry(card, "spos_symbols", ins->proc_dsp_dir)) != NULL) {
818
- entry->content = SNDRV_INFO_CONTENT_TEXT;
819
- entry->private_data = chip;
820
- entry->mode = S_IFREG | 0644;
821
- entry->c.text.read = cs46xx_dsp_proc_symbol_table_read;
822
- if (snd_info_register(entry) < 0) {
823
- snd_info_free_entry(entry);
824
- entry = NULL;
825
- }
826
- }
827
- ins->proc_sym_info_entry = entry;
797
+ entry = snd_info_create_card_entry(card, "spos_symbols",
798
+ ins->proc_dsp_dir);
799
+ if (entry)
800
+ snd_info_set_text_ops(entry, chip,
801
+ cs46xx_dsp_proc_symbol_table_read);
828802
829
- if ((entry = snd_info_create_card_entry(card, "spos_modules", ins->proc_dsp_dir)) != NULL) {
830
- entry->content = SNDRV_INFO_CONTENT_TEXT;
831
- entry->private_data = chip;
832
- entry->mode = S_IFREG | 0644;
833
- entry->c.text.read = cs46xx_dsp_proc_modules_read;
834
- if (snd_info_register(entry) < 0) {
835
- snd_info_free_entry(entry);
836
- entry = NULL;
837
- }
838
- }
839
- ins->proc_modules_info_entry = entry;
803
+ entry = snd_info_create_card_entry(card, "spos_modules",
804
+ ins->proc_dsp_dir);
805
+ if (entry)
806
+ snd_info_set_text_ops(entry, chip,
807
+ cs46xx_dsp_proc_modules_read);
840808
841
- if ((entry = snd_info_create_card_entry(card, "parameter", ins->proc_dsp_dir)) != NULL) {
842
- entry->content = SNDRV_INFO_CONTENT_TEXT;
843
- entry->private_data = chip;
844
- entry->mode = S_IFREG | 0644;
845
- entry->c.text.read = cs46xx_dsp_proc_parameter_dump_read;
846
- if (snd_info_register(entry) < 0) {
847
- snd_info_free_entry(entry);
848
- entry = NULL;
849
- }
850
- }
851
- ins->proc_parameter_dump_info_entry = entry;
809
+ entry = snd_info_create_card_entry(card, "parameter",
810
+ ins->proc_dsp_dir);
811
+ if (entry)
812
+ snd_info_set_text_ops(entry, chip,
813
+ cs46xx_dsp_proc_parameter_dump_read);
852814
853
- if ((entry = snd_info_create_card_entry(card, "sample", ins->proc_dsp_dir)) != NULL) {
854
- entry->content = SNDRV_INFO_CONTENT_TEXT;
855
- entry->private_data = chip;
856
- entry->mode = S_IFREG | 0644;
857
- entry->c.text.read = cs46xx_dsp_proc_sample_dump_read;
858
- if (snd_info_register(entry) < 0) {
859
- snd_info_free_entry(entry);
860
- entry = NULL;
861
- }
862
- }
863
- ins->proc_sample_dump_info_entry = entry;
815
+ entry = snd_info_create_card_entry(card, "sample",
816
+ ins->proc_dsp_dir);
817
+ if (entry)
818
+ snd_info_set_text_ops(entry, chip,
819
+ cs46xx_dsp_proc_sample_dump_read);
864820
865
- if ((entry = snd_info_create_card_entry(card, "task_tree", ins->proc_dsp_dir)) != NULL) {
866
- entry->content = SNDRV_INFO_CONTENT_TEXT;
867
- entry->private_data = chip;
868
- entry->mode = S_IFREG | 0644;
869
- entry->c.text.read = cs46xx_dsp_proc_task_tree_read;
870
- if (snd_info_register(entry) < 0) {
871
- snd_info_free_entry(entry);
872
- entry = NULL;
873
- }
874
- }
875
- ins->proc_task_info_entry = entry;
821
+ entry = snd_info_create_card_entry(card, "task_tree",
822
+ ins->proc_dsp_dir);
823
+ if (entry)
824
+ snd_info_set_text_ops(entry, chip,
825
+ cs46xx_dsp_proc_task_tree_read);
876826
877
- if ((entry = snd_info_create_card_entry(card, "scb_info", ins->proc_dsp_dir)) != NULL) {
878
- entry->content = SNDRV_INFO_CONTENT_TEXT;
879
- entry->private_data = chip;
880
- entry->mode = S_IFREG | 0644;
881
- entry->c.text.read = cs46xx_dsp_proc_scb_read;
882
- if (snd_info_register(entry) < 0) {
883
- snd_info_free_entry(entry);
884
- entry = NULL;
885
- }
886
- }
887
- ins->proc_scb_info_entry = entry;
827
+ entry = snd_info_create_card_entry(card, "scb_info",
828
+ ins->proc_dsp_dir);
829
+ if (entry)
830
+ snd_info_set_text_ops(entry, chip,
831
+ cs46xx_dsp_proc_scb_read);
888832
889833 mutex_lock(&chip->spos_mutex);
890834 /* register/update SCB's entries on proc */
....@@ -905,24 +849,6 @@
905849
906850 if (!ins)
907851 return 0;
908
-
909
- snd_info_free_entry(ins->proc_sym_info_entry);
910
- ins->proc_sym_info_entry = NULL;
911
-
912
- snd_info_free_entry(ins->proc_modules_info_entry);
913
- ins->proc_modules_info_entry = NULL;
914
-
915
- snd_info_free_entry(ins->proc_parameter_dump_info_entry);
916
- ins->proc_parameter_dump_info_entry = NULL;
917
-
918
- snd_info_free_entry(ins->proc_sample_dump_info_entry);
919
- ins->proc_sample_dump_info_entry = NULL;
920
-
921
- snd_info_free_entry(ins->proc_scb_info_entry);
922
- ins->proc_scb_info_entry = NULL;
923
-
924
- snd_info_free_entry(ins->proc_task_info_entry);
925
- ins->proc_task_info_entry = NULL;
926852
927853 mutex_lock(&chip->spos_mutex);
928854 for (i = 0; i < ins->nscb; ++i) {
....@@ -1112,7 +1038,7 @@
11121038
11131039 int fifo_addr, fifo_span, valid_slots;
11141040
1115
- static struct dsp_spos_control_block sposcb = {
1041
+ static const struct dsp_spos_control_block sposcb = {
11161042 /* 0 */ HFG_TREE_SCB,HFG_STACK,
11171043 /* 1 */ SPOSCB_ADDR,BG_TREE_SCB_ADDR,
11181044 /* 2 */ DSP_SPOS_DC,0,