hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/sound/sparc/cs4231.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Driver for CS4231 sound chips found on Sparcs.
34 * Copyright (C) 2002, 2008 David S. Miller <davem@davemloft.net>
....@@ -183,7 +184,7 @@
183184 * Some variables
184185 */
185186
186
-static unsigned char freq_bits[14] = {
187
+static const unsigned char freq_bits[14] = {
187188 /* 5510 */ 0x00 | CS4231_XTAL2,
188189 /* 6620 */ 0x0E | CS4231_XTAL2,
189190 /* 8000 */ 0x00 | CS4231_XTAL1,
....@@ -217,7 +218,7 @@
217218 &hw_constraints_rates);
218219 }
219220
220
-static unsigned char snd_cs4231_original_image[32] =
221
+static const unsigned char snd_cs4231_original_image[32] =
221222 {
222223 0x00, /* 00/00 - lic */
223224 0x00, /* 01/01 - ric */
....@@ -868,7 +869,7 @@
868869 return 0;
869870 }
870871
871
-static struct snd_timer_hardware snd_cs4231_timer_table = {
872
+static const struct snd_timer_hardware snd_cs4231_timer_table = {
872873 .flags = SNDRV_TIMER_HW_AUTO,
873874 .resolution = 9945,
874875 .ticks = 65535,
....@@ -888,12 +889,7 @@
888889 {
889890 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
890891 unsigned char new_pdfr;
891
- int err;
892892
893
- err = snd_pcm_lib_malloc_pages(substream,
894
- params_buffer_bytes(hw_params));
895
- if (err < 0)
896
- return err;
897893 new_pdfr = snd_cs4231_get_format(chip, params_format(hw_params),
898894 params_channels(hw_params)) |
899895 snd_cs4231_get_rate(params_rate(hw_params));
....@@ -932,12 +928,7 @@
932928 {
933929 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
934930 unsigned char new_cdfr;
935
- int err;
936931
937
- err = snd_pcm_lib_malloc_pages(substream,
938
- params_buffer_bytes(hw_params));
939
- if (err < 0)
940
- return err;
941932 new_cdfr = snd_cs4231_get_format(chip, params_format(hw_params),
942933 params_channels(hw_params)) |
943934 snd_cs4231_get_rate(params_rate(hw_params));
....@@ -1202,9 +1193,7 @@
12021193 static const struct snd_pcm_ops snd_cs4231_playback_ops = {
12031194 .open = snd_cs4231_playback_open,
12041195 .close = snd_cs4231_playback_close,
1205
- .ioctl = snd_pcm_lib_ioctl,
12061196 .hw_params = snd_cs4231_playback_hw_params,
1207
- .hw_free = snd_pcm_lib_free_pages,
12081197 .prepare = snd_cs4231_playback_prepare,
12091198 .trigger = snd_cs4231_trigger,
12101199 .pointer = snd_cs4231_playback_pointer,
....@@ -1213,9 +1202,7 @@
12131202 static const struct snd_pcm_ops snd_cs4231_capture_ops = {
12141203 .open = snd_cs4231_capture_open,
12151204 .close = snd_cs4231_capture_close,
1216
- .ioctl = snd_pcm_lib_ioctl,
12171205 .hw_params = snd_cs4231_capture_hw_params,
1218
- .hw_free = snd_pcm_lib_free_pages,
12191206 .prepare = snd_cs4231_capture_prepare,
12201207 .trigger = snd_cs4231_trigger,
12211208 .pointer = snd_cs4231_capture_pointer,
....@@ -1241,9 +1228,8 @@
12411228 pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX;
12421229 strcpy(pcm->name, "CS4231");
12431230
1244
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1245
- &chip->op->dev,
1246
- 64 * 1024, 128 * 1024);
1231
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
1232
+ &chip->op->dev, 64 * 1024, 128 * 1024);
12471233
12481234 chip->pcm = pcm;
12491235
....@@ -1493,7 +1479,7 @@
14931479 .private_value = (left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | \
14941480 ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22) }
14951481
1496
-static struct snd_kcontrol_new snd_cs4231_controls[] = {
1482
+static const struct snd_kcontrol_new snd_cs4231_controls[] = {
14971483 CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT,
14981484 CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
14991485 CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT,
....@@ -1785,7 +1771,7 @@
17851771 return snd_cs4231_sbus_free(cp);
17861772 }
17871773
1788
-static struct snd_device_ops snd_cs4231_sbus_dev_ops = {
1774
+static const struct snd_device_ops snd_cs4231_sbus_dev_ops = {
17891775 .dev_free = snd_cs4231_sbus_dev_free,
17901776 };
17911777
....@@ -1951,7 +1937,7 @@
19511937 return snd_cs4231_ebus_free(cp);
19521938 }
19531939
1954
-static struct snd_device_ops snd_cs4231_ebus_dev_ops = {
1940
+static const struct snd_device_ops snd_cs4231_ebus_dev_ops = {
19551941 .dev_free = snd_cs4231_ebus_dev_free,
19561942 };
19571943
....@@ -2071,12 +2057,12 @@
20712057 static int cs4231_probe(struct platform_device *op)
20722058 {
20732059 #ifdef EBUS_SUPPORT
2074
- if (!strcmp(op->dev.of_node->parent->name, "ebus"))
2060
+ if (of_node_name_eq(op->dev.of_node->parent, "ebus"))
20752061 return cs4231_ebus_probe(op);
20762062 #endif
20772063 #ifdef SBUS_SUPPORT
2078
- if (!strcmp(op->dev.of_node->parent->name, "sbus") ||
2079
- !strcmp(op->dev.of_node->parent->name, "sbi"))
2064
+ if (of_node_name_eq(op->dev.of_node->parent, "sbus") ||
2065
+ of_node_name_eq(op->dev.of_node->parent, "sbi"))
20802066 return cs4231_sbus_probe(op);
20812067 #endif
20822068 return -ENODEV;