Changeset 679 for GPL/trunk/alsa-kernel/pci/emu10k1/emuproc.c
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (4 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-linux-3.2.102 (added) merged: 611-614 /GPL/branches/uniaud32-next (added) merged: 615-678
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/pci/emu10k1/emuproc.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> … … 12 13 * TODO: 13 14 * -- 14 *15 * This program is free software; you can redistribute it and/or modify16 * it under the terms of the GNU General Public License as published by17 * the Free Software Foundation; either version 2 of the License, or18 * (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 of22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the23 * GNU General Public License for more details.24 *25 * You should have received a copy of the GNU General Public License26 * along with this program; if not, write to the Free Software27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA28 *29 15 */ 30 16 … … 35 21 #include "p16v.h" 36 22 37 #ifdef CONFIG_PROC_FS38 23 static void snd_emu10k1_proc_spdif_status(struct snd_emu10k1 * emu, 39 24 struct snd_info_buffer *buffer, … … 42 27 int rate_reg) 43 28 { 44 static c har *clkaccy[4] = { "1000ppm", "50ppm", "variable", "unknown" };45 static int samplerate[16] = { 44100, 1, 48000, 32000, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };46 static c har *channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" };47 static c har *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" }; 48 33 unsigned int status, rate = 0; 49 34 … … 83 68 { 84 69 /* FIXME - output names are in emufx.c too */ 85 static c har *creative_outs[32] = {70 static const char * const creative_outs[32] = { 86 71 /* 00 */ "AC97 Left", 87 72 /* 01 */ "AC97 Right", … … 118 103 }; 119 104 120 static c har *audigy_outs[64] = {105 static const char * const audigy_outs[64] = { 121 106 /* 00 */ "Digital Front Left", 122 107 /* 01 */ "Digital Front Right", … … 137 122 /* 16 */ "AC97 Front Left", 138 123 /* 17 */ "AC97 Front Right", 139 /* 18 */ "ADC Cap utre Left",124 /* 18 */ "ADC Capture Left", 140 125 /* 19 */ "ADC Capture Right", 141 126 /* 20 */ "???", … … 188 173 unsigned int val, val1; 189 174 int nefx = emu->audigy ? 64 : 32; 190 c har **outputs = emu->audigy ? audigy_outs : creative_outs;175 const char * const *outputs = emu->audigy ? audigy_outs : creative_outs; 191 176 int idx; 192 177 … … 242 227 u32 value; 243 228 u32 value2; 244 unsigned long flags;245 229 u32 rate; 246 230 247 231 if (emu->card_capabilities->emu_model) { 248 spin_lock_irqsave(&emu->emu_lock, flags);249 232 snd_emu1010_fpga_read(emu, 0x38, &value); 250 spin_unlock_irqrestore(&emu->emu_lock, flags);251 233 if ((value & 0x1) == 0) { 252 spin_lock_irqsave(&emu->emu_lock, flags);253 234 snd_emu1010_fpga_read(emu, 0x2a, &value); 254 235 snd_emu1010_fpga_read(emu, 0x2b, &value2); 255 spin_unlock_irqrestore(&emu->emu_lock, flags);256 236 rate = 0x1770000 / (((value << 5) | value2)+1); 257 237 snd_iprintf(buffer, "ADAT Locked : %u\n", rate); … … 259 239 snd_iprintf(buffer, "ADAT Unlocked\n"); 260 240 } 261 spin_lock_irqsave(&emu->emu_lock, flags);262 241 snd_emu1010_fpga_read(emu, 0x20, &value); 263 spin_unlock_irqrestore(&emu->emu_lock, flags);264 242 if ((value & 0x4) == 0) { 265 spin_lock_irqsave(&emu->emu_lock, flags);266 243 snd_emu1010_fpga_read(emu, 0x28, &value); 267 244 snd_emu1010_fpga_read(emu, 0x29, &value2); 268 spin_unlock_irqrestore(&emu->emu_lock, flags);269 245 rate = 0x1770000 / (((value << 5) | value2)+1); 270 246 snd_iprintf(buffer, "SPDIF Locked : %d\n", rate); … … 287 263 struct snd_info_buffer *buffer) 288 264 { 289 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 }; 290 266 struct snd_emu10k1 *emu = entry->private_data; 291 267 unsigned int val, tmp, n; 292 268 val = snd_emu10k1_ptr20_read(emu, CAPTURE_RATE_STATUS, 0); 293 tmp = (val >> 16) & 0x8;294 269 for (n = 0; n < 4; n++) { 295 270 tmp = val >> (16 + (n*4)); … … 411 386 struct snd_emu10k1 *emu = entry->private_data; 412 387 u32 value; 413 unsigned long flags;414 388 int i; 415 389 snd_iprintf(buffer, "EMU1010 Registers:\n\n"); 416 390 417 391 for(i = 0; i < 0x40; i+=1) { 418 spin_lock_irqsave(&emu->emu_lock, flags);419 392 snd_emu1010_fpga_read(emu, i, &value); 420 spin_unlock_irqrestore(&emu->emu_lock, flags);421 393 snd_iprintf(buffer, "%02X: %08X, %02X\n", i, value, (value >> 8) & 0x7f); 422 394 } … … 574 546 #endif 575 547 576 static struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = {548 static const struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = { 577 549 .read = snd_emu10k1_fx8010_read, 578 550 }; 579 551 580 int __devinit snd_emu10k1_proc_init(struct snd_emu10k1 *emu)552 int snd_emu10k1_proc_init(struct snd_emu10k1 *emu) 581 553 { 582 554 struct snd_info_entry *entry; 583 555 #ifdef CONFIG_SND_DEBUG 584 556 if (emu->card_capabilities->emu_model) { 585 if (! snd_card_proc_new(emu->card, "emu1010_regs", &entry)) 586 snd_info_set_text_ops(entry, emu, snd_emu_proc_emu1010_reg_read); 587 } 588 if (! snd_card_proc_new(emu->card, "io_regs", &entry)) { 589 snd_info_set_text_ops(entry, emu, snd_emu_proc_io_reg_read); 590 entry->c.text.write = snd_emu_proc_io_reg_write; 591 entry->mode |= S_IWUSR; 592 } 593 if (! snd_card_proc_new(emu->card, "ptr_regs00a", &entry)) { 594 snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00a); 595 entry->c.text.write = snd_emu_proc_ptr_reg_write00; 596 entry->mode |= S_IWUSR; 597 } 598 if (! snd_card_proc_new(emu->card, "ptr_regs00b", &entry)) { 599 snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00b); 600 entry->c.text.write = snd_emu_proc_ptr_reg_write00; 601 entry->mode |= S_IWUSR; 602 } 603 if (! snd_card_proc_new(emu->card, "ptr_regs20a", &entry)) { 604 snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20a); 605 entry->c.text.write = snd_emu_proc_ptr_reg_write20; 606 entry->mode |= S_IWUSR; 607 } 608 if (! snd_card_proc_new(emu->card, "ptr_regs20b", &entry)) { 609 snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20b); 610 entry->c.text.write = snd_emu_proc_ptr_reg_write20; 611 entry->mode |= S_IWUSR; 612 } 613 if (! snd_card_proc_new(emu->card, "ptr_regs20c", &entry)) { 614 snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20c); 615 entry->c.text.write = snd_emu_proc_ptr_reg_write20; 616 entry->mode |= S_IWUSR; 617 } 557 snd_card_ro_proc_new(emu->card, "emu1010_regs", 558 emu, snd_emu_proc_emu1010_reg_read); 559 } 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); 618 578 #endif 619 579 620 if (! snd_card_proc_new(emu->card, "emu10k1", &entry)) 621 snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_read); 622 623 if (emu->card_capabilities->emu10k2_chip) { 624 if (! snd_card_proc_new(emu->card, "spdif-in", &entry)) 625 snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_spdif_read); 626 } 627 if (emu->card_capabilities->ca0151_chip) { 628 if (! snd_card_proc_new(emu->card, "capture-rates", &entry)) 629 snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_rates_read); 630 } 631 632 if (! snd_card_proc_new(emu->card, "voices", &entry)) 633 snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_voices_read); 580 snd_card_ro_proc_new(emu->card, "emu10k1", emu, snd_emu10k1_proc_read); 581 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); 588 589 snd_card_ro_proc_new(emu->card, "voices", emu, 590 snd_emu10k1_proc_voices_read); 634 591 635 592 if (! snd_card_proc_new(emu->card, "fx8010_gpr", &entry)) { 636 593 entry->content = SNDRV_INFO_CONTENT_DATA; 637 594 entry->private_data = emu; 638 entry->mode = S_IFREG | S_IRUGO/*| S_IWUSR*/;595 entry->mode = S_IFREG | 0444 /*| S_IWUSR*/; 639 596 entry->size = emu->audigy ? A_TOTAL_SIZE_GPR : TOTAL_SIZE_GPR; 640 597 entry->c.ops = &snd_emu10k1_proc_ops_fx8010; … … 643 600 entry->content = SNDRV_INFO_CONTENT_DATA; 644 601 entry->private_data = emu; 645 entry->mode = S_IFREG | S_IRUGO/*| S_IWUSR*/;602 entry->mode = S_IFREG | 0444 /*| S_IWUSR*/; 646 603 entry->size = emu->audigy ? A_TOTAL_SIZE_TANKMEM_DATA : TOTAL_SIZE_TANKMEM_DATA ; 647 604 entry->c.ops = &snd_emu10k1_proc_ops_fx8010; … … 650 607 entry->content = SNDRV_INFO_CONTENT_DATA; 651 608 entry->private_data = emu; 652 entry->mode = S_IFREG | S_IRUGO/*| S_IWUSR*/;609 entry->mode = S_IFREG | 0444 /*| S_IWUSR*/; 653 610 entry->size = emu->audigy ? A_TOTAL_SIZE_TANKMEM_ADDR : TOTAL_SIZE_TANKMEM_ADDR ; 654 611 entry->c.ops = &snd_emu10k1_proc_ops_fx8010; … … 657 614 entry->content = SNDRV_INFO_CONTENT_DATA; 658 615 entry->private_data = emu; 659 entry->mode = S_IFREG | S_IRUGO/*| S_IWUSR*/;616 entry->mode = S_IFREG | 0444 /*| S_IWUSR*/; 660 617 entry->size = emu->audigy ? A_TOTAL_SIZE_CODE : TOTAL_SIZE_CODE; 661 618 entry->c.ops = &snd_emu10k1_proc_ops_fx8010; 662 619 } 663 if (! snd_card_proc_new(emu->card, "fx8010_acode", &entry)) { 664 entry->content = SNDRV_INFO_CONTENT_TEXT; 665 entry->private_data = emu; 666 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/; 667 entry->c.text.read = snd_emu10k1_proc_acode_read; 668 } 620 snd_card_ro_proc_new(emu->card, "fx8010_acode", emu, 621 snd_emu10k1_proc_acode_read); 669 622 return 0; 670 623 } 671 #endif /* CONFIG_PROC_FS */
Note:
See TracChangeset
for help on using the changeset viewer.