Ignore:
Timestamp:
Mar 18, 2021, 8:57:36 PM (4 years ago)
Author:
David Azarewicz
Message:

Merge changes from Paul's uniaud32next branch.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/pci/emu10k1/emuproc.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
     
    1213 *  TODO:
    1314 *    --
    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  *
    2915 */
    3016
     
    3521#include "p16v.h"
    3622
    37 #ifdef CONFIG_PROC_FS
    3823static void snd_emu10k1_proc_spdif_status(struct snd_emu10k1 * emu,
    3924                                          struct snd_info_buffer *buffer,
     
    4227                                          int rate_reg)
    4328{
    44         static char *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 char *channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" };
    47         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" };
    4833        unsigned int status, rate = 0;
    4934       
     
    8368{
    8469        /* FIXME - output names are in emufx.c too */
    85         static char *creative_outs[32] = {
     70        static const char * const creative_outs[32] = {
    8671                /* 00 */ "AC97 Left",
    8772                /* 01 */ "AC97 Right",
     
    118103        };
    119104
    120         static char *audigy_outs[64] = {
     105        static const char * const audigy_outs[64] = {
    121106                /* 00 */ "Digital Front Left",
    122107                /* 01 */ "Digital Front Right",
     
    137122                /* 16 */ "AC97 Front Left",
    138123                /* 17 */ "AC97 Front Right",
    139                 /* 18 */ "ADC Caputre Left",
     124                /* 18 */ "ADC Capture Left",
    140125                /* 19 */ "ADC Capture Right",
    141126                /* 20 */ "???",
     
    188173        unsigned int val, val1;
    189174        int nefx = emu->audigy ? 64 : 32;
    190         char **outputs = emu->audigy ? audigy_outs : creative_outs;
     175        const char * const *outputs = emu->audigy ? audigy_outs : creative_outs;
    191176        int idx;
    192177       
     
    242227        u32 value;
    243228        u32 value2;
    244         unsigned long flags;
    245229        u32 rate;
    246230
    247231        if (emu->card_capabilities->emu_model) {
    248                 spin_lock_irqsave(&emu->emu_lock, flags);
    249232                snd_emu1010_fpga_read(emu, 0x38, &value);
    250                 spin_unlock_irqrestore(&emu->emu_lock, flags);
    251233                if ((value & 0x1) == 0) {
    252                         spin_lock_irqsave(&emu->emu_lock, flags);
    253234                        snd_emu1010_fpga_read(emu, 0x2a, &value);
    254235                        snd_emu1010_fpga_read(emu, 0x2b, &value2);
    255                         spin_unlock_irqrestore(&emu->emu_lock, flags);
    256236                        rate = 0x1770000 / (((value << 5) | value2)+1);
    257237                        snd_iprintf(buffer, "ADAT Locked : %u\n", rate);
     
    259239                        snd_iprintf(buffer, "ADAT Unlocked\n");
    260240                }
    261                 spin_lock_irqsave(&emu->emu_lock, flags);
    262241                snd_emu1010_fpga_read(emu, 0x20, &value);
    263                 spin_unlock_irqrestore(&emu->emu_lock, flags);
    264242                if ((value & 0x4) == 0) {
    265                         spin_lock_irqsave(&emu->emu_lock, flags);
    266243                        snd_emu1010_fpga_read(emu, 0x28, &value);
    267244                        snd_emu1010_fpga_read(emu, 0x29, &value2);
    268                         spin_unlock_irqrestore(&emu->emu_lock, flags);
    269245                        rate = 0x1770000 / (((value << 5) | value2)+1);
    270246                        snd_iprintf(buffer, "SPDIF Locked : %d\n", rate);
     
    287263                                  struct snd_info_buffer *buffer)
    288264{
    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 };
    290266        struct snd_emu10k1 *emu = entry->private_data;
    291267        unsigned int val, tmp, n;
    292268        val = snd_emu10k1_ptr20_read(emu, CAPTURE_RATE_STATUS, 0);
    293         tmp = (val >> 16) & 0x8;
    294269        for (n = 0; n < 4; n++) {
    295270                tmp = val >> (16 + (n*4));
     
    411386        struct snd_emu10k1 *emu = entry->private_data;
    412387        u32 value;
    413         unsigned long flags;
    414388        int i;
    415389        snd_iprintf(buffer, "EMU1010 Registers:\n\n");
    416390
    417391        for(i = 0; i < 0x40; i+=1) {
    418                 spin_lock_irqsave(&emu->emu_lock, flags);
    419392                snd_emu1010_fpga_read(emu, i, &value);
    420                 spin_unlock_irqrestore(&emu->emu_lock, flags);
    421393                snd_iprintf(buffer, "%02X: %08X, %02X\n", i, value, (value >> 8) & 0x7f);
    422394        }
     
    574546#endif
    575547
    576 static struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = {
     548static const struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = {
    577549        .read = snd_emu10k1_fx8010_read,
    578550};
    579551
    580 int __devinit snd_emu10k1_proc_init(struct snd_emu10k1 * emu)
     552int snd_emu10k1_proc_init(struct snd_emu10k1 *emu)
    581553{
    582554        struct snd_info_entry *entry;
    583555#ifdef CONFIG_SND_DEBUG
    584556        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);
    618578#endif
    619579       
    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);
    634591
    635592        if (! snd_card_proc_new(emu->card, "fx8010_gpr", &entry)) {
    636593                entry->content = SNDRV_INFO_CONTENT_DATA;
    637594                entry->private_data = emu;
    638                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
     595                entry->mode = S_IFREG | 0444 /*| S_IWUSR*/;
    639596                entry->size = emu->audigy ? A_TOTAL_SIZE_GPR : TOTAL_SIZE_GPR;
    640597                entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
     
    643600                entry->content = SNDRV_INFO_CONTENT_DATA;
    644601                entry->private_data = emu;
    645                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
     602                entry->mode = S_IFREG | 0444 /*| S_IWUSR*/;
    646603                entry->size = emu->audigy ? A_TOTAL_SIZE_TANKMEM_DATA : TOTAL_SIZE_TANKMEM_DATA ;
    647604                entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
     
    650607                entry->content = SNDRV_INFO_CONTENT_DATA;
    651608                entry->private_data = emu;
    652                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
     609                entry->mode = S_IFREG | 0444 /*| S_IWUSR*/;
    653610                entry->size = emu->audigy ? A_TOTAL_SIZE_TANKMEM_ADDR : TOTAL_SIZE_TANKMEM_ADDR ;
    654611                entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
     
    657614                entry->content = SNDRV_INFO_CONTENT_DATA;
    658615                entry->private_data = emu;
    659                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
     616                entry->mode = S_IFREG | 0444 /*| S_IWUSR*/;
    660617                entry->size = emu->audigy ? A_TOTAL_SIZE_CODE : TOTAL_SIZE_CODE;
    661618                entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
    662619        }
    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);
    669622        return 0;
    670623}
    671 #endif /* CONFIG_PROC_FS */
Note: See TracChangeset for help on using the changeset viewer.