Ignore:
Timestamp:
Jan 1, 2021, 5:31:48 AM (5 years ago)
Author:
Paul Smedley
Message:

Add source for uniaud32 based on code from linux kernel 5.4.86

Location:
GPL/branches/uniaud32-next
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-next/alsa-kernel/isa/cmi8330.c

    r612 r615  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *  Driver for C-Media's CMI8330 and CMI8329 soundcards.
    34 *  Copyright (c) by George Talusan <gstalusan@uwaterloo.ca>
    45 *    http://www.undergrad.math.uwaterloo.ca/~gstalusa
    5  *
    6  *   This program is free software; you can redistribute it and/or modify
    7  *   it under the terms of the GNU General Public License as published by
    8  *   the Free Software Foundation; either version 2 of the License, or
    9  *   (at your option) any later version.
    10  *
    11  *   This program is distributed in the hope that it will be useful,
    12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  *   GNU General Public License for more details.
    15  *
    16  *   You should have received a copy of the GNU General Public License
    17  *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    19  *
    206 */
    217
     
    7056static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
    7157static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
    72 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP;
    73 #ifdef CONFIG_PNP
    74 static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
     58static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP;
     59#ifdef CONFIG_PNP
     60static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
    7561#endif
    7662static long sbport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
     
    9682#endif
    9783
    98 module_param_array(sbport, long, NULL, 0444);
     84module_param_hw_array(sbport, long, ioport, NULL, 0444);
    9985MODULE_PARM_DESC(sbport, "Port # for CMI8330/CMI8329 SB driver.");
    100 module_param_array(sbirq, int, NULL, 0444);
     86module_param_hw_array(sbirq, int, irq, NULL, 0444);
    10187MODULE_PARM_DESC(sbirq, "IRQ # for CMI8330/CMI8329 SB driver.");
    102 module_param_array(sbdma8, int, NULL, 0444);
     88module_param_hw_array(sbdma8, int, dma, NULL, 0444);
    10389MODULE_PARM_DESC(sbdma8, "DMA8 for CMI8330/CMI8329 SB driver.");
    104 module_param_array(sbdma16, int, NULL, 0444);
     90module_param_hw_array(sbdma16, int, dma, NULL, 0444);
    10591MODULE_PARM_DESC(sbdma16, "DMA16 for CMI8330/CMI8329 SB driver.");
    10692
    107 module_param_array(wssport, long, NULL, 0444);
     93module_param_hw_array(wssport, long, ioport, NULL, 0444);
    10894MODULE_PARM_DESC(wssport, "Port # for CMI8330/CMI8329 WSS driver.");
    109 module_param_array(wssirq, int, NULL, 0444);
     95module_param_hw_array(wssirq, int, irq, NULL, 0444);
    11096MODULE_PARM_DESC(wssirq, "IRQ # for CMI8330/CMI8329 WSS driver.");
    111 module_param_array(wssdma, int, NULL, 0444);
     97module_param_hw_array(wssdma, int, dma, NULL, 0444);
    11298MODULE_PARM_DESC(wssdma, "DMA for CMI8330/CMI8329 WSS driver.");
    11399
    114 module_param_array(fmport, long, NULL, 0444);
     100module_param_hw_array(fmport, long, ioport, NULL, 0444);
    115101MODULE_PARM_DESC(fmport, "FM port # for CMI8330/CMI8329 driver.");
    116 module_param_array(mpuport, long, NULL, 0444);
     102module_param_hw_array(mpuport, long, ioport, NULL, 0444);
    117103MODULE_PARM_DESC(mpuport, "MPU-401 port # for CMI8330/CMI8329 driver.");
    118 module_param_array(mpuirq, int, NULL, 0444);
     104module_param_hw_array(mpuirq, int, irq, NULL, 0444);
    119105MODULE_PARM_DESC(mpuirq, "IRQ # for CMI8330/CMI8329 MPU-401 port.");
    120106#ifdef CONFIG_PNP
     
    183169#ifdef CONFIG_PNP
    184170
    185 static struct pnp_card_device_id snd_cmi8330_pnpids[] = {
     171static const struct pnp_card_device_id snd_cmi8330_pnpids[] = {
    186172        { .id = "CMI0001", .devs = { { "@X@0001" }, { "@@@0001" }, { "@H@0001" }, { "A@@0001" } } },
    187173        { .id = "CMI0001", .devs = { { "@@@0001" }, { "@X@0001" }, { "@H@0001" } } },
     
    194180
    195181
    196 static struct snd_kcontrol_new snd_cmi8330_controls[] __devinitdata = {
     182static struct snd_kcontrol_new snd_cmi8330_controls[] = {
    197183WSS_DOUBLE("Master Playback Volume", 0,
    198184                CMI8330_MASTVOL, CMI8330_MASTVOL, 4, 0, 15, 0),
     
    250236
    251237#ifdef ENABLE_SB_MIXER
    252 static struct sbmix_elem cmi8330_sb_mixers[] __devinitdata = {
     238static struct sbmix_elem cmi8330_sb_mixers[] = {
    253239SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31),
    254240SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15),
     
    268254};
    269255
    270 static unsigned char cmi8330_sb_init_values[][2] __devinitdata = {
     256static unsigned char cmi8330_sb_init_values[][2] = {
    271257        { SB_DSP4_MASTER_DEV + 0, 0 },
    272258        { SB_DSP4_MASTER_DEV + 1, 0 },
     
    282268
    283269
    284 static int __devinit cmi8330_add_sb_mixers(struct snd_sb *chip)
     270static int cmi8330_add_sb_mixers(struct snd_sb *chip)
    285271{
    286272        int idx, err;
     
    307293#endif
    308294
    309 static int __devinit snd_cmi8330_mixer(struct snd_card *card, struct snd_cmi8330 *acard)
     295static int snd_cmi8330_mixer(struct snd_card *card, struct snd_cmi8330 *acard)
    310296{
    311297        unsigned int idx;
     
    330316
    331317#ifdef CONFIG_PNP
    332 static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
    333                                      struct pnp_card_link *card,
    334                                      const struct pnp_card_device_id *id)
     318static int snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
     319                           struct pnp_card_link *card,
     320                           const struct pnp_card_device_id *id)
    335321{
    336322        struct pnp_dev *pdev;
     
    438424}
    439425
    440 static int __devinit snd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip)
     426static int snd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip)
    441427{
    442428        struct snd_pcm *pcm;
     
    471457
    472458        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
    473                                               snd_dma_isa_data(),
     459                                              card->dev,
    474460                                              64*1024, 128*1024);
    475461        chip->pcm = pcm;
     
    485471
    486472        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
    487         snd_pcm_suspend_all(acard->pcm);
    488473        acard->wss->suspend(acard->wss);
    489474        snd_sbmixer_suspend(acard->sb);
     
    515500#define PFX     "cmi8330: "
    516501
    517 static int snd_cmi8330_card_new(int dev, struct snd_card **cardp)
     502static int snd_cmi8330_card_new(struct device *pdev, int dev,
     503                                struct snd_card **cardp)
    518504{
    519505        struct snd_card *card;
     
    521507        int err;
    522508
    523         err = snd_card_create(index[dev], id[dev], THIS_MODULE,
    524                               sizeof(struct snd_cmi8330), &card);
     509        err = snd_card_new(pdev, index[dev], id[dev], THIS_MODULE,
     510                           sizeof(struct snd_cmi8330), &card);
    525511        if (err < 0) {
    526512                snd_printk(KERN_ERR PFX "could not get a new card\n");
     
    533519}
    534520
    535 static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev)
     521static int snd_cmi8330_probe(struct snd_card *card, int dev)
    536522{
    537523        struct snd_cmi8330 *acard;
     
    614600}
    615601
    616 static int __devinit snd_cmi8330_isa_match(struct device *pdev,
    617                                           unsigned int dev)
     602static int snd_cmi8330_isa_match(struct device *pdev,
     603                                unsigned int dev)
    618604{
    619605        if (!enable[dev] || is_isapnp_selected(dev))
     
    630616}
    631617
    632 static int __devinit snd_cmi8330_isa_probe(struct device *pdev,
    633                                           unsigned int dev)
     618static int snd_cmi8330_isa_probe(struct device *pdev,
     619                                unsigned int dev)
    634620{
    635621        struct snd_card *card;
    636622        int err;
    637623
    638         err = snd_cmi8330_card_new(dev, &card);
     624        err = snd_cmi8330_card_new(pdev, dev, &card);
    639625        if (err < 0)
    640626                return err;
    641         snd_card_set_dev(card, pdev);
    642627        if ((err = snd_cmi8330_probe(card, dev)) < 0) {
    643628                snd_card_free(card);
     
    648633}
    649634
    650 static int __devexit snd_cmi8330_isa_remove(struct device *devptr,
    651                                             unsigned int dev)
     635static int snd_cmi8330_isa_remove(struct device *devptr,
     636                                  unsigned int dev)
    652637{
    653638        snd_card_free(dev_get_drvdata(devptr));
    654         dev_set_drvdata(devptr, NULL);
    655639        return 0;
    656640}
     
    674658        .match          = snd_cmi8330_isa_match,
    675659        .probe          = snd_cmi8330_isa_probe,
    676         .remove         = __devexit_p(snd_cmi8330_isa_remove),
     660        .remove         = snd_cmi8330_isa_remove,
    677661#ifdef CONFIG_PM
    678662        .suspend        = snd_cmi8330_isa_suspend,
     
    686670
    687671#ifdef CONFIG_PNP
    688 static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard,
    689                                             const struct pnp_card_device_id *pid)
     672static int snd_cmi8330_pnp_detect(struct pnp_card_link *pcard,
     673                                  const struct pnp_card_device_id *pid)
    690674{
    691675        static int dev;
     
    700684                return -ENODEV;
    701685                               
    702         res = snd_cmi8330_card_new(dev, &card);
     686        res = snd_cmi8330_card_new(&pcard->card->dev, dev, &card);
    703687        if (res < 0)
    704688                return res;
     
    708692                return res;
    709693        }
    710         snd_card_set_dev(card, &pcard->card->dev);
    711694        if ((res = snd_cmi8330_probe(card, dev)) < 0) {
    712695                snd_card_free(card);
     
    718701}
    719702
    720 static void __devexit snd_cmi8330_pnp_remove(struct pnp_card_link * pcard)
     703static void snd_cmi8330_pnp_remove(struct pnp_card_link *pcard)
    721704{
    722705        snd_card_free(pnp_get_card_drvdata(pcard));
     
    741724        .id_table = snd_cmi8330_pnpids,
    742725        .probe = snd_cmi8330_pnp_detect,
    743         .remove = __devexit_p(snd_cmi8330_pnp_remove),
     726        .remove = snd_cmi8330_pnp_remove,
    744727#ifdef CONFIG_PM
    745728        .suspend        = snd_cmi8330_pnp_suspend,
Note: See TracChangeset for help on using the changeset viewer.