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

Merge changes from Paul's uniaud32next branch.

Location:
GPL/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/pci/cs5535audio/cs5535audio.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 * Driver for audio on multifunction CS5535/6 companion device
     
    56 * Based on Jaroslav Kysela and Takashi Iwai's examples.
    67 * This work was sponsored by CIS(M) Sdn Bhd.
    7  *
    8  * This program is free software; you can redistribute it and/or modify
    9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  *
    18  * You should have received a copy of the GNU General Public License
    19  * along with this program; if not, write to the Free Software
    20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    21  *
    228 */
    239
     
    2713#include <linux/pci.h>
    2814#include <linux/slab.h>
    29 #include <linux/moduleparam.h>
    30 #include <asm/io.h>
     15#include <linux/module.h>
     16#include <linux/io.h>
    3117#include <sound/core.h>
    3218#include <sound/control.h>
     
    3925
    4026#define DRIVER_NAME "cs5535audio"
     27#ifdef TARGET_OS2
     28#define KBUILD_MODNAME DRIVER_NAME
     29#include <linux/dma-mapping.h>
     30#endif
    4131
    4232static char *ac97_quirk;
     
    4434MODULE_PARM_DESC(ac97_quirk, "AC'97 board specific workarounds.");
    4535
    46 static struct ac97_quirk ac97_quirks[] __devinitdata = {
     36static const struct ac97_quirk ac97_quirks[] = {
    4737#if 0 /* Not yet confirmed if all 5536 boards are HP only */
    4838        {
     
    5848static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
    5949static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
    60 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
     50static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
    6151
    6252module_param_array(index, int, NULL, 0444);
     
    6757MODULE_PARM_DESC(enable, "Enable " DRIVER_NAME);
    6858
    69 static DEFINE_PCI_DEVICE_TABLE(snd_cs5535audio_ids) = {
     59static const struct pci_device_id snd_cs5535audio_ids[] = {
    7060        { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_AUDIO) },
    7161        { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_AUDIO) },
     
    8575        } while (--timeout);
    8676        if (!timeout)
    87                 snd_printk(KERN_ERR "Failure writing to cs5535 codec\n");
     77                dev_err(cs5535au->card->dev,
     78                        "Failure writing to cs5535 codec\n");
    8879}
    8980
     
    110101        } while (--timeout);
    111102        if (!timeout)
    112                 snd_printk(KERN_ERR "Failure reading codec reg 0x%x,"
    113                                         "Last value=0x%x\n", reg, val);
     103                dev_err(cs5535au->card->dev,
     104                        "Failure reading codec reg 0x%x, Last value=0x%x\n",
     105                        reg, val);
    114106
    115107        return (unsigned short) val;
     
    145137}
    146138
    147 static int __devinit snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
     139static int snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
    148140{
    149141        struct snd_card *card = cs5535au->card;
     
    151143        struct snd_ac97_template ac97;
    152144        int err;
    153         static struct snd_ac97_bus_ops ops = {
     145        static const struct snd_ac97_bus_ops ops = {
    154146                .write = snd_cs5535audio_ac97_codec_write,
    155147                .read = snd_cs5535audio_ac97_codec_read,
     
    169161
    170162        if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) {
    171                 snd_printk(KERN_ERR "mixer failed\n");
     163                dev_err(card->dev, "mixer failed\n");
    172164                return err;
    173165        }
     
    177169        err = olpc_quirks(card, cs5535au->ac97);
    178170        if (err < 0) {
    179                 snd_printk(KERN_ERR "olpc quirks failed\n");
     171                dev_err(card->dev, "olpc quirks failed\n");
    180172                return err;
    181173        }
     
    191183        spin_unlock(&cs5535au->reg_lock);
    192184        if (bm_stat & EOP) {
    193                 struct cs5535audio_dma *dma;
    194                 dma = cs5535au->playback_substream->runtime->private_data;
    195185                snd_pcm_period_elapsed(cs5535au->playback_substream);
    196186        } else {
    197                 snd_printk(KERN_ERR "unexpected bm0 irq src, bm_stat=%x\n",
    198                                         bm_stat);
     187                dev_err(cs5535au->card->dev,
     188                        "unexpected bm0 irq src, bm_stat=%x\n",
     189                        bm_stat);
    199190        }
    200191}
     
    206197        bm_stat = cs_readb(cs5535au, ACC_BM1_STATUS);
    207198        spin_unlock(&cs5535au->reg_lock);
    208         if (bm_stat & EOP) {
    209                 struct cs5535audio_dma *dma;
    210                 dma = cs5535au->capture_substream->runtime->private_data;
     199        if (bm_stat & EOP)
    211200                snd_pcm_period_elapsed(cs5535au->capture_substream);
    212         }
    213201}
    214202
     
    242230                                break;
    243231                        default:
    244                                 snd_printk(KERN_ERR "Unexpected irq src: "
    245                                                 "0x%x\n", acc_irq_stat);
     232                                dev_err(cs5535au->card->dev,
     233                                        "Unexpected irq src: 0x%x\n",
     234                                        acc_irq_stat);
    246235                                break;
    247236                        }
     
    253242static int snd_cs5535audio_free(struct cs5535audio *cs5535au)
    254243{
    255         synchronize_irq(cs5535au->irq);
    256         pci_set_power_state(cs5535au->pci, 3);
     244        pci_set_power_state(cs5535au->pci, PCI_D3hot);
    257245
    258246        if (cs5535au->irq >= 0)
     
    271259}
    272260
    273 static int __devinit snd_cs5535audio_create(struct snd_card *card,
    274                                             struct pci_dev *pci,
    275                                             struct cs5535audio **rcs5535au)
     261static int snd_cs5535audio_create(struct snd_card *card,
     262                                  struct pci_dev *pci,
     263                                  struct cs5535audio **rcs5535au)
    276264{
    277265        struct cs5535audio *cs5535au;
    278266
    279267        int err;
    280         static struct snd_device_ops ops = {
     268        static const struct snd_device_ops ops = {
    281269                .dev_free =     snd_cs5535audio_dev_free,
    282270        };
     
    286274                return err;
    287275
    288         if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 ||
    289             pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
    290                 printk(KERN_WARNING "unable to get 32bit dma\n");
     276        if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 ||
     277            dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) {
     278                dev_warn(card->dev, "unable to get 32bit dma\n");
    291279                err = -ENXIO;
    292280                goto pcifail;
     
    312300
    313301        if (request_irq(pci->irq, snd_cs5535audio_interrupt,
    314                         IRQF_SHARED, "CS5535 Audio", cs5535au)) {
    315                 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
     302                        IRQF_SHARED, KBUILD_MODNAME, cs5535au)) {
     303                dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
    316304                err = -EBUSY;
    317305                goto sndfail;
     
    319307
    320308        cs5535au->irq = pci->irq;
     309        card->sync_irq = cs5535au->irq;
    321310        pci_set_master(pci);
    322311
     
    325314                goto sndfail;
    326315
    327         snd_card_set_dev(card, &pci->dev);
    328 
    329316        *rcs5535au = cs5535au;
    330317        return 0;
     
    339326}
    340327
    341 static int __devinit snd_cs5535audio_probe(struct pci_dev *pci,
    342                                           const struct pci_device_id *pci_id)
     328static int snd_cs5535audio_probe(struct pci_dev *pci,
     329                                const struct pci_device_id *pci_id)
    343330{
    344331        static int dev;
     
    354341        }
    355342
    356         err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
     343        err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
     344                           0, &card);
    357345        if (err < 0)
    358346                return err;
     
    388376}
    389377
    390 static void __devexit snd_cs5535audio_remove(struct pci_dev *pci)
     378static void snd_cs5535audio_remove(struct pci_dev *pci)
    391379{
    392380        olpc_quirks_cleanup();
    393381        snd_card_free(pci_get_drvdata(pci));
    394         pci_set_drvdata(pci, NULL);
    395 }
    396 
    397 static struct pci_driver driver = {
    398         .name = DRIVER_NAME,
     382}
     383
     384static struct pci_driver cs5535audio_driver = {
     385        .name = KBUILD_MODNAME,
    399386        .id_table = snd_cs5535audio_ids,
    400387        .probe = snd_cs5535audio_probe,
    401         .remove = __devexit_p(snd_cs5535audio_remove),
    402 #ifdef CONFIG_PM
    403         .suspend = snd_cs5535audio_suspend,
    404         .resume = snd_cs5535audio_resume,
     388        .remove = snd_cs5535audio_remove,
     389#ifdef CONFIG_PM_SLEEP
     390        .driver = {
     391                .pm = &snd_cs5535audio_pm,
     392        },
    405393#endif
    406394};
    407395
    408 static int __init alsa_card_cs5535audio_init(void)
    409 {
    410         return pci_register_driver(&driver);
    411 }
    412 
    413 static void __exit alsa_card_cs5535audio_exit(void)
    414 {
    415         pci_unregister_driver(&driver);
    416 }
    417 
    418 module_init(alsa_card_cs5535audio_init)
    419 module_exit(alsa_card_cs5535audio_exit)
     396module_pci_driver(cs5535audio_driver);
    420397
    421398MODULE_AUTHOR("Jaya Kumar");
  • GPL/trunk/alsa-kernel/pci/cs5535audio/cs5535audio.h

    r598 r679  
     1/* SPDX-License-Identifier: GPL-2.0 */
    12#ifndef __SOUND_CS5535AUDIO_H
    23#define __SOUND_CS5535AUDIO_H
     
    6768
    6869struct cs5535audio_dma_desc {
    69         u32 addr;
    70         u16 size;
    71         u16 ctlreserved;
     70        __le32 addr;
     71        __le16 size;
     72        __le16 ctlreserved;
    7273};
    7374
     
    9596};
    9697
    97 #ifdef CONFIG_PM
    98 int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state);
    99 int snd_cs5535audio_resume(struct pci_dev *pci);
    100 #endif
     98extern const struct dev_pm_ops snd_cs5535audio_pm;
    10199
    102100#ifdef CONFIG_OLPC
    103 void __devinit olpc_prequirks(struct snd_card *card,
    104                 struct snd_ac97_template *ac97);
    105 int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97);
    106 void __devexit olpc_quirks_cleanup(void);
     101void olpc_prequirks(struct snd_card *card,
     102                    struct snd_ac97_template *ac97);
     103int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97);
     104void olpc_quirks_cleanup(void);
    107105void olpc_analog_input(struct snd_ac97 *ac97, int on);
    108106void olpc_mic_bias(struct snd_ac97 *ac97, int on);
     
    137135#endif
    138136
    139 int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535audio);
     137int snd_cs5535audio_pcm(struct cs5535audio *cs5535audio);
    140138
    141139#endif /* __SOUND_CS5535AUDIO_H */
  • GPL/trunk/alsa-kernel/pci/cs5535audio/cs5535audio_olpc.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 * OLPC XO-1 additional sound features
     
    45 * Copyright © 2006  Jaya Kumar <jayakumar.lkml@gmail.com>
    56 * Copyright © 2007-2008  Andres Salomon <dilinger@debian.org>
    6  *
    7  * This program is free software; you can redistribute it and/or modify
    8  * it under the terms of the GNU General Public License as published by
    9  * the Free Software Foundation; either version 2 of the License, or
    10  * (at your option) any later version.
    117 */
    128#include <sound/core.h>
     
    3733                        1 << AC97_AD_HPFD_SHIFT, on << AC97_AD_HPFD_SHIFT);
    3834        if (err < 0) {
    39                 snd_printk(KERN_ERR "setting High Pass Filter - %d\n", err);
     35                dev_err(ac97->bus->card->dev,
     36                        "setting High Pass Filter - %d\n", err);
    4037                return;
    4138        }
     
    5956                        1 << AC97_AD_VREFD_SHIFT, on << AC97_AD_VREFD_SHIFT);
    6057        if (err < 0)
    61                 snd_printk(KERN_ERR "setting MIC Bias - %d\n", err);
     58                dev_err(ac97->bus->card->dev, "setting MIC Bias - %d\n", err);
    6259}
    6360
     
    115112}
    116113
    117 static struct snd_kcontrol_new olpc_cs5535audio_ctls[] __devinitdata = {
     114static const struct snd_kcontrol_new olpc_cs5535audio_ctls[] = {
    118115{
    119116        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
     
    134131};
    135132
    136 void __devinit olpc_prequirks(struct snd_card *card,
    137                 struct snd_ac97_template *ac97)
     133void olpc_prequirks(struct snd_card *card,
     134                    struct snd_ac97_template *ac97)
    138135{
    139136        if (!machine_is_olpc())
     
    145142}
    146143
    147 int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
     144int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
    148145{
    149146        struct snd_ctl_elem_id elem;
     
    154151
    155152        if (gpio_request(OLPC_GPIO_MIC_AC, DRV_NAME)) {
    156                 printk(KERN_ERR DRV_NAME ": unable to allocate MIC GPIO\n");
     153                dev_err(card->dev, "unable to allocate MIC GPIO\n");
    157154                return -EIO;
    158155        }
     
    162159        memset(&elem, 0, sizeof(elem));
    163160        elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
    164         strncpy(elem.name, "High Pass Filter Enable", sizeof(elem.name));
     161        strlcpy(elem.name, "High Pass Filter Enable", sizeof(elem.name));
    165162        snd_ctl_remove_id(card, &elem);
    166163
     
    168165        memset(&elem, 0, sizeof(elem));
    169166        elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
    170         strncpy(elem.name, "V_REFOUT Enable", sizeof(elem.name));
     167        strlcpy(elem.name, "V_REFOUT Enable", sizeof(elem.name));
    171168        snd_ctl_remove_id(card, &elem);
    172169
     
    186183}
    187184
    188 void __devexit olpc_quirks_cleanup(void)
     185void olpc_quirks_cleanup(void)
    189186{
    190187        gpio_free(OLPC_GPIO_MIC_AC);
  • GPL/trunk/alsa-kernel/pci/cs5535audio/cs5535audio_pcm.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 * Driver for audio on multifunction CS5535 companion device
     
    56 * Based on Jaroslav Kysela and Takashi Iwai's examples.
    67 * This work was sponsored by CIS(M) Sdn Bhd.
    7  *
    8  * This program is free software; you can redistribute it and/or modify
    9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  *
    18  * You should have received a copy of the GNU General Public License
    19  * along with this program; if not, write to the Free Software
    20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    218 *
    229 * todo: add be fmt support, spdif, pm
     
    3421#include "cs5535audio.h"
    3522
    36 static struct snd_pcm_hardware snd_cs5535audio_playback =
     23static const struct snd_pcm_hardware snd_cs5535audio_playback =
    3724{
    3825        .info =                 (
     
    6350};
    6451
    65 static struct snd_pcm_hardware snd_cs5535audio_capture =
     52static const struct snd_pcm_hardware snd_cs5535audio_capture =
    6653{
    6754        .info =                 (
     
    131118        if (dma->desc_buf.area == NULL) {
    132119                if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
    133                                         snd_dma_pci_data(cs5535au->pci),
     120                                        &cs5535au->pci->dev,
    134121                                        CS5535AUDIO_DESC_LIST_SIZE+1,
    135122                                        &dma->desc_buf) < 0)
     
    149136                        &((struct cs5535audio_dma_desc *) dma->desc_buf.area)[i];
    150137                desc->addr = cpu_to_le32(addr);
    151                 desc->size = cpu_to_le32(period_bytes);
    152                 desc->ctlreserved = cpu_to_le32(PRD_EOP);
     138                desc->size = cpu_to_le16(period_bytes);
     139                desc->ctlreserved = cpu_to_le16(PRD_EOP);
    153140                desc_addr += sizeof(struct cs5535audio_dma_desc);
    154141                addr += period_bytes;
     
    158145        lastdesc->addr = cpu_to_le32((u32) dma->desc_buf.addr);
    159146        lastdesc->size = 0;
    160         lastdesc->ctlreserved = cpu_to_le32(PRD_JMP);
    161         jmpprd_addr = cpu_to_le32(lastdesc->addr +
    162                                   (sizeof(struct cs5535audio_dma_desc)*periods));
     147        lastdesc->ctlreserved = cpu_to_le16(PRD_JMP);
     148        jmpprd_addr = (u32)dma->desc_buf.addr +
     149                sizeof(struct cs5535audio_dma_desc) * periods;
    163150
    164151        dma->substream = substream;
     
    250237        int err;
    251238
    252         err = snd_pcm_lib_malloc_pages(substream,
    253                                         params_buffer_bytes(hw_params));
    254         if (err < 0)
    255                 return err;
    256239        dma->buf_addr = substream->runtime->dma_addr;
    257240        dma->buf_bytes = params_buffer_bytes(hw_params);
     
    281264        }
    282265        cs5535audio_clear_dma_packets(cs5535au, dma, substream);
    283         return snd_pcm_lib_free_pages(substream);
     266        return 0;
    284267}
    285268
     
    318301                break;
    319302        default:
    320                 snd_printk(KERN_ERR "unhandled trigger\n");
     303                dev_err(cs5535au->card->dev, "unhandled trigger\n");
    321304                err = -EINVAL;
    322305                break;
     
    336319        curdma = dma->ops->read_dma_pntr(cs5535au);
    337320        if (curdma < dma->buf_addr) {
    338                 snd_printk(KERN_ERR "curdma=%x < %x bufaddr.\n",
     321                dev_err(cs5535au->card->dev, "curdma=%x < %x bufaddr.\n",
    339322                                        curdma, dma->buf_addr);
    340323                return 0;
     
    342325        curdma -= dma->buf_addr;
    343326        if (curdma >= dma->buf_bytes) {
    344                 snd_printk(KERN_ERR "diff=%x >= %x buf_bytes.\n",
     327                dev_err(cs5535au->card->dev, "diff=%x >= %x buf_bytes.\n",
    345328                                        curdma, dma->buf_bytes);
    346329                return 0;
     
    381364}
    382365
    383 static struct snd_pcm_ops snd_cs5535audio_playback_ops = {
     366static const struct snd_pcm_ops snd_cs5535audio_playback_ops = {
    384367        .open =         snd_cs5535audio_playback_open,
    385368        .close =        snd_cs5535audio_playback_close,
    386         .ioctl =        snd_pcm_lib_ioctl,
    387369        .hw_params =    snd_cs5535audio_hw_params,
    388370        .hw_free =      snd_cs5535audio_hw_free,
     
    392374};
    393375
    394 static struct snd_pcm_ops snd_cs5535audio_capture_ops = {
     376static const struct snd_pcm_ops snd_cs5535audio_capture_ops = {
    395377        .open =         snd_cs5535audio_capture_open,
    396378        .close =        snd_cs5535audio_capture_close,
    397         .ioctl =        snd_pcm_lib_ioctl,
    398379        .hw_params =    snd_cs5535audio_hw_params,
    399380        .hw_free =      snd_cs5535audio_hw_free,
     
    403384};
    404385
    405 static struct cs5535audio_dma_ops snd_cs5535audio_playback_dma_ops = {
     386static const struct cs5535audio_dma_ops snd_cs5535audio_playback_dma_ops = {
    406387        .type = CS5535AUDIO_DMA_PLAYBACK,
    407388        .enable_dma = cs5535audio_playback_enable_dma,
     
    413394};
    414395
    415 static struct cs5535audio_dma_ops snd_cs5535audio_capture_dma_ops = {
     396static const struct cs5535audio_dma_ops snd_cs5535audio_capture_dma_ops = {
    416397        .type = CS5535AUDIO_DMA_CAPTURE,
    417398        .enable_dma = cs5535audio_capture_enable_dma,
     
    423404};
    424405
    425 int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535au)
     406int snd_cs5535audio_pcm(struct cs5535audio *cs5535au)
    426407{
    427408        struct snd_pcm *pcm;
     
    445426        strcpy(pcm->name, "CS5535 Audio");
    446427
    447         snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
    448                                         snd_dma_pci_data(cs5535au->pci),
    449                                         64*1024, 128*1024);
     428        snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
     429                                       &cs5535au->pci->dev,
     430                                       64*1024, 128*1024);
    450431        cs5535au->pcm = pcm;
    451432
  • GPL/trunk/alsa-kernel/pci/cs5535audio/cs5535audio_pm.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 * Power management for audio on multifunction CS5535 companion device
    34 * Copyright (C) Jaya Kumar
    4  *
    5  * This program is free software; you can redistribute it and/or modify
    6  * it under the terms of the GNU General Public License as published by
    7  * the Free Software Foundation; either version 2 of the License, or
    8  * (at your option) any later version.
    9  *
    10  * This program is distributed in the hope that it will be useful,
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  * GNU General Public License for more details.
    14  *
    15  * You should have received a copy of the GNU General Public License
    16  * along with this program; if not, write to the Free Software
    17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    18  *
    195 */
    206
     
    5642}
    5743
    58 int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state)
     44static int __maybe_unused snd_cs5535audio_suspend(struct device *dev)
    5945{
    60         struct snd_card *card = pci_get_drvdata(pci);
     46        struct snd_card *card = dev_get_drvdata(dev);
    6147        struct cs5535audio *cs5535au = card->private_data;
    6248        int i;
    6349
    6450        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
    65         snd_pcm_suspend_all(cs5535au->pcm);
    6651        snd_ac97_suspend(cs5535au->ac97);
    6752        for (i = 0; i < NUM_CS5535AUDIO_DMAS; i++) {
     
    7257        /* save important regs, then disable aclink in hw */
    7358        snd_cs5535audio_stop_hardware(cs5535au);
    74 
    75         if (pci_save_state(pci)) {
    76                 printk(KERN_ERR "cs5535audio: pci_save_state failed!\n");
    77                 return -EIO;
    78         }
    79         pci_disable_device(pci);
    80         pci_set_power_state(pci, pci_choose_state(pci, state));
    8159        return 0;
    8260}
    8361
    84 int snd_cs5535audio_resume(struct pci_dev *pci)
     62static int __maybe_unused snd_cs5535audio_resume(struct device *dev)
    8563{
    86         struct snd_card *card = pci_get_drvdata(pci);
     64        struct snd_card *card = dev_get_drvdata(dev);
    8765        struct cs5535audio *cs5535au = card->private_data;
    8866        u32 tmp;
    8967        int timeout;
    9068        int i;
    91 
    92         pci_set_power_state(pci, PCI_D0);
    93         pci_restore_state(pci);
    94         if (pci_enable_device(pci) < 0) {
    95                 printk(KERN_ERR "cs5535audio: pci_enable_device failed, "
    96                        "disabling device\n");
    97                 snd_card_disconnect(card);
    98                 return -EIO;
    99         }
    100         pci_set_master(pci);
    10169
    10270        /* set LNK_WRM_RST to reset AC link */
     
    11280
    11381        if (!timeout)
    114                 snd_printk(KERN_ERR "Failure getting AC Link ready\n");
     82                dev_err(cs5535au->card->dev, "Failure getting AC Link ready\n");
    11583
    11684        /* set up rate regs, dma. actual initiation is done in trig */
     
    13098}
    13199
     100SIMPLE_DEV_PM_OPS(snd_cs5535audio_pm, snd_cs5535audio_suspend, snd_cs5535audio_resume);
Note: See TracChangeset for help on using the changeset viewer.