hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/sound/ppc/tumbler.c
....@@ -1,26 +1,12 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * PMac Tumbler/Snapper lowlevel functions
34 *
45 * Copyright (c) by Takashi Iwai <tiwai@suse.de>
56 *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- *
207 * Rene Rebe <rene.rebe@gmx.net>:
218 * * update from shadow registers on wakeup and headphone plug
229 * * automatically toggle DRC on headphone plug
23
- *
2410 */
2511
2612
....@@ -120,7 +106,7 @@
120106 /*
121107 */
122108
123
-static int send_init_client(struct pmac_keywest *i2c, unsigned int *regs)
109
+static int send_init_client(struct pmac_keywest *i2c, const unsigned int *regs)
124110 {
125111 while (*regs > 0) {
126112 int err, count = 10;
....@@ -142,7 +128,7 @@
142128
143129 static int tumbler_init_client(struct pmac_keywest *i2c)
144130 {
145
- static unsigned int regs[] = {
131
+ static const unsigned int regs[] = {
146132 /* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */
147133 TAS_REG_MCS, (1<<6)|(2<<4)|(2<<2)|0,
148134 0, /* terminator */
....@@ -153,7 +139,7 @@
153139
154140 static int snapper_init_client(struct pmac_keywest *i2c)
155141 {
156
- static unsigned int regs[] = {
142
+ static const unsigned int regs[] = {
157143 /* normal operation, SCLK=64fps, i2s output, 16bit width */
158144 TAS_REG_MCS, (1<<6)|(2<<4)|0,
159145 /* normal operation, all-pass mode */
....@@ -492,11 +478,11 @@
492478 int reg;
493479 int bytes;
494480 unsigned int max;
495
- unsigned int *table;
481
+ const unsigned int *table;
496482 };
497483
498484 static int tumbler_set_mono_volume(struct pmac_tumbler *mix,
499
- struct tumbler_mono_vol *info)
485
+ const struct tumbler_mono_vol *info)
500486 {
501487 unsigned char block[4];
502488 unsigned int vol;
....@@ -567,7 +553,7 @@
567553 }
568554
569555 /* TAS3001c mono volumes */
570
-static struct tumbler_mono_vol tumbler_pcm_vol_info = {
556
+static const struct tumbler_mono_vol tumbler_pcm_vol_info = {
571557 .index = VOL_IDX_PCM_MONO,
572558 .reg = TAS_REG_PCM,
573559 .bytes = 3,
....@@ -575,7 +561,7 @@
575561 .table = mixer_volume_table,
576562 };
577563
578
-static struct tumbler_mono_vol tumbler_bass_vol_info = {
564
+static const struct tumbler_mono_vol tumbler_bass_vol_info = {
579565 .index = VOL_IDX_BASS,
580566 .reg = TAS_REG_BASS,
581567 .bytes = 1,
....@@ -583,7 +569,7 @@
583569 .table = bass_volume_table,
584570 };
585571
586
-static struct tumbler_mono_vol tumbler_treble_vol_info = {
572
+static const struct tumbler_mono_vol tumbler_treble_vol_info = {
587573 .index = VOL_IDX_TREBLE,
588574 .reg = TAS_REG_TREBLE,
589575 .bytes = 1,
....@@ -592,7 +578,7 @@
592578 };
593579
594580 /* TAS3004 mono volumes */
595
-static struct tumbler_mono_vol snapper_bass_vol_info = {
581
+static const struct tumbler_mono_vol snapper_bass_vol_info = {
596582 .index = VOL_IDX_BASS,
597583 .reg = TAS_REG_BASS,
598584 .bytes = 1,
....@@ -600,7 +586,7 @@
600586 .table = snapper_bass_volume_table,
601587 };
602588
603
-static struct tumbler_mono_vol snapper_treble_vol_info = {
589
+static const struct tumbler_mono_vol snapper_treble_vol_info = {
604590 .index = VOL_IDX_TREBLE,
605591 .reg = TAS_REG_TREBLE,
606592 .bytes = 1,
....@@ -840,7 +826,7 @@
840826
841827 /*
842828 */
843
-static struct snd_kcontrol_new tumbler_mixers[] = {
829
+static const struct snd_kcontrol_new tumbler_mixers[] = {
844830 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
845831 .name = "Master Playback Volume",
846832 .info = tumbler_info_master_volume,
....@@ -864,7 +850,7 @@
864850 },
865851 };
866852
867
-static struct snd_kcontrol_new snapper_mixers[] = {
853
+static const struct snd_kcontrol_new snapper_mixers[] = {
868854 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
869855 .name = "Master Playback Volume",
870856 .info = tumbler_info_master_volume,
....@@ -1365,12 +1351,13 @@
13651351 mix->anded_reset = 0;
13661352 mix->reset_on_sleep = 1;
13671353
1368
- for (np = chip->node->child; np; np = np->sibling) {
1369
- if (!strcmp(np->name, "sound")) {
1354
+ for_each_child_of_node(chip->node, np) {
1355
+ if (of_node_name_eq(np, "sound")) {
13701356 if (of_get_property(np, "has-anded-reset", NULL))
13711357 mix->anded_reset = 1;
13721358 if (of_get_property(np, "layout-id", NULL))
13731359 mix->reset_on_sleep = 0;
1360
+ of_node_put(np);
13741361 break;
13751362 }
13761363 }