| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
|---|
| 3 | 4 | * Creative Labs, Inc. |
|---|
| .. | .. |
|---|
| 11 | 12 | * |
|---|
| 12 | 13 | * TODO: |
|---|
| 13 | 14 | * -- |
|---|
| 14 | | - * |
|---|
| 15 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 16 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 17 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 18 | | - * (at your option) any later version. |
|---|
| 19 | | - * |
|---|
| 20 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 21 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 22 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 23 | | - * GNU General Public License for more details. |
|---|
| 24 | | - * |
|---|
| 25 | | - * You should have received a copy of the GNU General Public License |
|---|
| 26 | | - * along with this program; if not, write to the Free Software |
|---|
| 27 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 28 | | - * |
|---|
| 29 | 15 | */ |
|---|
| 30 | 16 | |
|---|
| 31 | 17 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 40 | 26 | int status_reg, |
|---|
| 41 | 27 | int rate_reg) |
|---|
| 42 | 28 | { |
|---|
| 43 | | - static char *clkaccy[4] = { "1000ppm", "50ppm", "variable", "unknown" }; |
|---|
| 44 | | - static int samplerate[16] = { 44100, 1, 48000, 32000, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; |
|---|
| 45 | | - static char *channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" }; |
|---|
| 46 | | - static char *emphasis[8] = { "none", "50/15 usec 2 channel", "2", "3", "4", "5", "6", "7" }; |
|---|
| 29 | + static const char * const clkaccy[4] = { "1000ppm", "50ppm", "variable", "unknown" }; |
|---|
| 30 | + static const int samplerate[16] = { 44100, 1, 48000, 32000, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; |
|---|
| 31 | + static const char * const channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" }; |
|---|
| 32 | + static const char * const emphasis[8] = { "none", "50/15 usec 2 channel", "2", "3", "4", "5", "6", "7" }; |
|---|
| 47 | 33 | unsigned int status, rate = 0; |
|---|
| 48 | 34 | |
|---|
| 49 | 35 | status = snd_emu10k1_ptr_read(emu, status_reg, 0); |
|---|
| .. | .. |
|---|
| 81 | 67 | struct snd_info_buffer *buffer) |
|---|
| 82 | 68 | { |
|---|
| 83 | 69 | /* FIXME - output names are in emufx.c too */ |
|---|
| 84 | | - static char *creative_outs[32] = { |
|---|
| 70 | + static const char * const creative_outs[32] = { |
|---|
| 85 | 71 | /* 00 */ "AC97 Left", |
|---|
| 86 | 72 | /* 01 */ "AC97 Right", |
|---|
| 87 | 73 | /* 02 */ "Optical IEC958 Left", |
|---|
| .. | .. |
|---|
| 116 | 102 | /* 31 */ "???" |
|---|
| 117 | 103 | }; |
|---|
| 118 | 104 | |
|---|
| 119 | | - static char *audigy_outs[64] = { |
|---|
| 105 | + static const char * const audigy_outs[64] = { |
|---|
| 120 | 106 | /* 00 */ "Digital Front Left", |
|---|
| 121 | 107 | /* 01 */ "Digital Front Right", |
|---|
| 122 | 108 | /* 02 */ "Digital Center", |
|---|
| .. | .. |
|---|
| 186 | 172 | struct snd_emu10k1 *emu = entry->private_data; |
|---|
| 187 | 173 | unsigned int val, val1; |
|---|
| 188 | 174 | int nefx = emu->audigy ? 64 : 32; |
|---|
| 189 | | - char **outputs = emu->audigy ? audigy_outs : creative_outs; |
|---|
| 175 | + const char * const *outputs = emu->audigy ? audigy_outs : creative_outs; |
|---|
| 190 | 176 | int idx; |
|---|
| 191 | 177 | |
|---|
| 192 | 178 | snd_iprintf(buffer, "EMU10K1\n\n"); |
|---|
| .. | .. |
|---|
| 276 | 262 | static void snd_emu10k1_proc_rates_read(struct snd_info_entry *entry, |
|---|
| 277 | 263 | struct snd_info_buffer *buffer) |
|---|
| 278 | 264 | { |
|---|
| 279 | | - static int samplerate[8] = { 44100, 48000, 96000, 192000, 4, 5, 6, 7 }; |
|---|
| 265 | + static const int samplerate[8] = { 44100, 48000, 96000, 192000, 4, 5, 6, 7 }; |
|---|
| 280 | 266 | struct snd_emu10k1 *emu = entry->private_data; |
|---|
| 281 | 267 | unsigned int val, tmp, n; |
|---|
| 282 | 268 | val = snd_emu10k1_ptr20_read(emu, CAPTURE_RATE_STATUS, 0); |
|---|
| .. | .. |
|---|
| 559 | 545 | } |
|---|
| 560 | 546 | #endif |
|---|
| 561 | 547 | |
|---|
| 562 | | -static struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = { |
|---|
| 548 | +static const struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = { |
|---|
| 563 | 549 | .read = snd_emu10k1_fx8010_read, |
|---|
| 564 | 550 | }; |
|---|
| 565 | 551 | |
|---|
| .. | .. |
|---|
| 568 | 554 | struct snd_info_entry *entry; |
|---|
| 569 | 555 | #ifdef CONFIG_SND_DEBUG |
|---|
| 570 | 556 | if (emu->card_capabilities->emu_model) { |
|---|
| 571 | | - if (! snd_card_proc_new(emu->card, "emu1010_regs", &entry)) |
|---|
| 572 | | - snd_info_set_text_ops(entry, emu, snd_emu_proc_emu1010_reg_read); |
|---|
| 557 | + snd_card_ro_proc_new(emu->card, "emu1010_regs", |
|---|
| 558 | + emu, snd_emu_proc_emu1010_reg_read); |
|---|
| 573 | 559 | } |
|---|
| 574 | | - if (! snd_card_proc_new(emu->card, "io_regs", &entry)) { |
|---|
| 575 | | - snd_info_set_text_ops(entry, emu, snd_emu_proc_io_reg_read); |
|---|
| 576 | | - entry->c.text.write = snd_emu_proc_io_reg_write; |
|---|
| 577 | | - entry->mode |= 0200; |
|---|
| 578 | | - } |
|---|
| 579 | | - if (! snd_card_proc_new(emu->card, "ptr_regs00a", &entry)) { |
|---|
| 580 | | - snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00a); |
|---|
| 581 | | - entry->c.text.write = snd_emu_proc_ptr_reg_write00; |
|---|
| 582 | | - entry->mode |= 0200; |
|---|
| 583 | | - } |
|---|
| 584 | | - if (! snd_card_proc_new(emu->card, "ptr_regs00b", &entry)) { |
|---|
| 585 | | - snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00b); |
|---|
| 586 | | - entry->c.text.write = snd_emu_proc_ptr_reg_write00; |
|---|
| 587 | | - entry->mode |= 0200; |
|---|
| 588 | | - } |
|---|
| 589 | | - if (! snd_card_proc_new(emu->card, "ptr_regs20a", &entry)) { |
|---|
| 590 | | - snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20a); |
|---|
| 591 | | - entry->c.text.write = snd_emu_proc_ptr_reg_write20; |
|---|
| 592 | | - entry->mode |= 0200; |
|---|
| 593 | | - } |
|---|
| 594 | | - if (! snd_card_proc_new(emu->card, "ptr_regs20b", &entry)) { |
|---|
| 595 | | - snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20b); |
|---|
| 596 | | - entry->c.text.write = snd_emu_proc_ptr_reg_write20; |
|---|
| 597 | | - entry->mode |= 0200; |
|---|
| 598 | | - } |
|---|
| 599 | | - if (! snd_card_proc_new(emu->card, "ptr_regs20c", &entry)) { |
|---|
| 600 | | - snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20c); |
|---|
| 601 | | - entry->c.text.write = snd_emu_proc_ptr_reg_write20; |
|---|
| 602 | | - entry->mode |= 0200; |
|---|
| 603 | | - } |
|---|
| 560 | + snd_card_rw_proc_new(emu->card, "io_regs", emu, |
|---|
| 561 | + snd_emu_proc_io_reg_read, |
|---|
| 562 | + snd_emu_proc_io_reg_write); |
|---|
| 563 | + snd_card_rw_proc_new(emu->card, "ptr_regs00a", emu, |
|---|
| 564 | + snd_emu_proc_ptr_reg_read00a, |
|---|
| 565 | + snd_emu_proc_ptr_reg_write00); |
|---|
| 566 | + snd_card_rw_proc_new(emu->card, "ptr_regs00b", emu, |
|---|
| 567 | + snd_emu_proc_ptr_reg_read00b, |
|---|
| 568 | + snd_emu_proc_ptr_reg_write00); |
|---|
| 569 | + snd_card_rw_proc_new(emu->card, "ptr_regs20a", emu, |
|---|
| 570 | + snd_emu_proc_ptr_reg_read20a, |
|---|
| 571 | + snd_emu_proc_ptr_reg_write20); |
|---|
| 572 | + snd_card_rw_proc_new(emu->card, "ptr_regs20b", emu, |
|---|
| 573 | + snd_emu_proc_ptr_reg_read20b, |
|---|
| 574 | + snd_emu_proc_ptr_reg_write20); |
|---|
| 575 | + snd_card_rw_proc_new(emu->card, "ptr_regs20c", emu, |
|---|
| 576 | + snd_emu_proc_ptr_reg_read20c, |
|---|
| 577 | + snd_emu_proc_ptr_reg_write20); |
|---|
| 604 | 578 | #endif |
|---|
| 605 | 579 | |
|---|
| 606 | | - if (! snd_card_proc_new(emu->card, "emu10k1", &entry)) |
|---|
| 607 | | - snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_read); |
|---|
| 580 | + snd_card_ro_proc_new(emu->card, "emu10k1", emu, snd_emu10k1_proc_read); |
|---|
| 608 | 581 | |
|---|
| 609 | | - if (emu->card_capabilities->emu10k2_chip) { |
|---|
| 610 | | - if (! snd_card_proc_new(emu->card, "spdif-in", &entry)) |
|---|
| 611 | | - snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_spdif_read); |
|---|
| 612 | | - } |
|---|
| 613 | | - if (emu->card_capabilities->ca0151_chip) { |
|---|
| 614 | | - if (! snd_card_proc_new(emu->card, "capture-rates", &entry)) |
|---|
| 615 | | - snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_rates_read); |
|---|
| 616 | | - } |
|---|
| 582 | + if (emu->card_capabilities->emu10k2_chip) |
|---|
| 583 | + snd_card_ro_proc_new(emu->card, "spdif-in", emu, |
|---|
| 584 | + snd_emu10k1_proc_spdif_read); |
|---|
| 585 | + if (emu->card_capabilities->ca0151_chip) |
|---|
| 586 | + snd_card_ro_proc_new(emu->card, "capture-rates", emu, |
|---|
| 587 | + snd_emu10k1_proc_rates_read); |
|---|
| 617 | 588 | |
|---|
| 618 | | - if (! snd_card_proc_new(emu->card, "voices", &entry)) |
|---|
| 619 | | - snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_voices_read); |
|---|
| 589 | + snd_card_ro_proc_new(emu->card, "voices", emu, |
|---|
| 590 | + snd_emu10k1_proc_voices_read); |
|---|
| 620 | 591 | |
|---|
| 621 | 592 | if (! snd_card_proc_new(emu->card, "fx8010_gpr", &entry)) { |
|---|
| 622 | 593 | entry->content = SNDRV_INFO_CONTENT_DATA; |
|---|
| .. | .. |
|---|
| 646 | 617 | entry->size = emu->audigy ? A_TOTAL_SIZE_CODE : TOTAL_SIZE_CODE; |
|---|
| 647 | 618 | entry->c.ops = &snd_emu10k1_proc_ops_fx8010; |
|---|
| 648 | 619 | } |
|---|
| 649 | | - if (! snd_card_proc_new(emu->card, "fx8010_acode", &entry)) { |
|---|
| 650 | | - entry->content = SNDRV_INFO_CONTENT_TEXT; |
|---|
| 651 | | - entry->private_data = emu; |
|---|
| 652 | | - entry->mode = S_IFREG | 0444 /*| S_IWUSR*/; |
|---|
| 653 | | - entry->c.text.read = snd_emu10k1_proc_acode_read; |
|---|
| 654 | | - } |
|---|
| 620 | + snd_card_ro_proc_new(emu->card, "fx8010_acode", emu, |
|---|
| 621 | + snd_emu10k1_proc_acode_read); |
|---|
| 655 | 622 | return 0; |
|---|
| 656 | 623 | } |
|---|