.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Driver for CS4231 sound chips found on Sparcs. |
---|
3 | 4 | * Copyright (C) 2002, 2008 David S. Miller <davem@davemloft.net> |
---|
.. | .. |
---|
183 | 184 | * Some variables |
---|
184 | 185 | */ |
---|
185 | 186 | |
---|
186 | | -static unsigned char freq_bits[14] = { |
---|
| 187 | +static const unsigned char freq_bits[14] = { |
---|
187 | 188 | /* 5510 */ 0x00 | CS4231_XTAL2, |
---|
188 | 189 | /* 6620 */ 0x0E | CS4231_XTAL2, |
---|
189 | 190 | /* 8000 */ 0x00 | CS4231_XTAL1, |
---|
.. | .. |
---|
217 | 218 | &hw_constraints_rates); |
---|
218 | 219 | } |
---|
219 | 220 | |
---|
220 | | -static unsigned char snd_cs4231_original_image[32] = |
---|
| 221 | +static const unsigned char snd_cs4231_original_image[32] = |
---|
221 | 222 | { |
---|
222 | 223 | 0x00, /* 00/00 - lic */ |
---|
223 | 224 | 0x00, /* 01/01 - ric */ |
---|
.. | .. |
---|
868 | 869 | return 0; |
---|
869 | 870 | } |
---|
870 | 871 | |
---|
871 | | -static struct snd_timer_hardware snd_cs4231_timer_table = { |
---|
| 872 | +static const struct snd_timer_hardware snd_cs4231_timer_table = { |
---|
872 | 873 | .flags = SNDRV_TIMER_HW_AUTO, |
---|
873 | 874 | .resolution = 9945, |
---|
874 | 875 | .ticks = 65535, |
---|
.. | .. |
---|
888 | 889 | { |
---|
889 | 890 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); |
---|
890 | 891 | unsigned char new_pdfr; |
---|
891 | | - int err; |
---|
892 | 892 | |
---|
893 | | - err = snd_pcm_lib_malloc_pages(substream, |
---|
894 | | - params_buffer_bytes(hw_params)); |
---|
895 | | - if (err < 0) |
---|
896 | | - return err; |
---|
897 | 893 | new_pdfr = snd_cs4231_get_format(chip, params_format(hw_params), |
---|
898 | 894 | params_channels(hw_params)) | |
---|
899 | 895 | snd_cs4231_get_rate(params_rate(hw_params)); |
---|
.. | .. |
---|
932 | 928 | { |
---|
933 | 929 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); |
---|
934 | 930 | unsigned char new_cdfr; |
---|
935 | | - int err; |
---|
936 | 931 | |
---|
937 | | - err = snd_pcm_lib_malloc_pages(substream, |
---|
938 | | - params_buffer_bytes(hw_params)); |
---|
939 | | - if (err < 0) |
---|
940 | | - return err; |
---|
941 | 932 | new_cdfr = snd_cs4231_get_format(chip, params_format(hw_params), |
---|
942 | 933 | params_channels(hw_params)) | |
---|
943 | 934 | snd_cs4231_get_rate(params_rate(hw_params)); |
---|
.. | .. |
---|
1202 | 1193 | static const struct snd_pcm_ops snd_cs4231_playback_ops = { |
---|
1203 | 1194 | .open = snd_cs4231_playback_open, |
---|
1204 | 1195 | .close = snd_cs4231_playback_close, |
---|
1205 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1206 | 1196 | .hw_params = snd_cs4231_playback_hw_params, |
---|
1207 | | - .hw_free = snd_pcm_lib_free_pages, |
---|
1208 | 1197 | .prepare = snd_cs4231_playback_prepare, |
---|
1209 | 1198 | .trigger = snd_cs4231_trigger, |
---|
1210 | 1199 | .pointer = snd_cs4231_playback_pointer, |
---|
.. | .. |
---|
1213 | 1202 | static const struct snd_pcm_ops snd_cs4231_capture_ops = { |
---|
1214 | 1203 | .open = snd_cs4231_capture_open, |
---|
1215 | 1204 | .close = snd_cs4231_capture_close, |
---|
1216 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
1217 | 1205 | .hw_params = snd_cs4231_capture_hw_params, |
---|
1218 | | - .hw_free = snd_pcm_lib_free_pages, |
---|
1219 | 1206 | .prepare = snd_cs4231_capture_prepare, |
---|
1220 | 1207 | .trigger = snd_cs4231_trigger, |
---|
1221 | 1208 | .pointer = snd_cs4231_capture_pointer, |
---|
.. | .. |
---|
1241 | 1228 | pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; |
---|
1242 | 1229 | strcpy(pcm->name, "CS4231"); |
---|
1243 | 1230 | |
---|
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); |
---|
1247 | 1233 | |
---|
1248 | 1234 | chip->pcm = pcm; |
---|
1249 | 1235 | |
---|
.. | .. |
---|
1493 | 1479 | .private_value = (left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | \ |
---|
1494 | 1480 | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22) } |
---|
1495 | 1481 | |
---|
1496 | | -static struct snd_kcontrol_new snd_cs4231_controls[] = { |
---|
| 1482 | +static const struct snd_kcontrol_new snd_cs4231_controls[] = { |
---|
1497 | 1483 | CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, |
---|
1498 | 1484 | CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), |
---|
1499 | 1485 | CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, |
---|
.. | .. |
---|
1785 | 1771 | return snd_cs4231_sbus_free(cp); |
---|
1786 | 1772 | } |
---|
1787 | 1773 | |
---|
1788 | | -static struct snd_device_ops snd_cs4231_sbus_dev_ops = { |
---|
| 1774 | +static const struct snd_device_ops snd_cs4231_sbus_dev_ops = { |
---|
1789 | 1775 | .dev_free = snd_cs4231_sbus_dev_free, |
---|
1790 | 1776 | }; |
---|
1791 | 1777 | |
---|
.. | .. |
---|
1951 | 1937 | return snd_cs4231_ebus_free(cp); |
---|
1952 | 1938 | } |
---|
1953 | 1939 | |
---|
1954 | | -static struct snd_device_ops snd_cs4231_ebus_dev_ops = { |
---|
| 1940 | +static const struct snd_device_ops snd_cs4231_ebus_dev_ops = { |
---|
1955 | 1941 | .dev_free = snd_cs4231_ebus_dev_free, |
---|
1956 | 1942 | }; |
---|
1957 | 1943 | |
---|
.. | .. |
---|
2071 | 2057 | static int cs4231_probe(struct platform_device *op) |
---|
2072 | 2058 | { |
---|
2073 | 2059 | #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")) |
---|
2075 | 2061 | return cs4231_ebus_probe(op); |
---|
2076 | 2062 | #endif |
---|
2077 | 2063 | #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")) |
---|
2080 | 2066 | return cs4231_sbus_probe(op); |
---|
2081 | 2067 | #endif |
---|
2082 | 2068 | return -ENODEV; |
---|