Changeset 679 for GPL/trunk/alsa-kernel/pci/cs5535audio
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (5 years ago)
- Location:
- GPL/trunk
- Files:
-
- 6 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/cs5535audio/cs5535audio.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for audio on multifunction CS5535/6 companion device … … 5 6 * Based on Jaroslav Kysela and Takashi Iwai's examples. 6 7 * This work was sponsored by CIS(M) Sdn Bhd. 7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (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 of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 *22 8 */ 23 9 … … 27 13 #include <linux/pci.h> 28 14 #include <linux/slab.h> 29 #include <linux/module param.h>30 #include < asm/io.h>15 #include <linux/module.h> 16 #include <linux/io.h> 31 17 #include <sound/core.h> 32 18 #include <sound/control.h> … … 39 25 40 26 #define DRIVER_NAME "cs5535audio" 27 #ifdef TARGET_OS2 28 #define KBUILD_MODNAME DRIVER_NAME 29 #include <linux/dma-mapping.h> 30 #endif 41 31 42 32 static char *ac97_quirk; … … 44 34 MODULE_PARM_DESC(ac97_quirk, "AC'97 board specific workarounds."); 45 35 46 static struct ac97_quirk ac97_quirks[] __devinitdata= {36 static const struct ac97_quirk ac97_quirks[] = { 47 37 #if 0 /* Not yet confirmed if all 5536 boards are HP only */ 48 38 { … … 58 48 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 59 49 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 60 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;50 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 61 51 62 52 module_param_array(index, int, NULL, 0444); … … 67 57 MODULE_PARM_DESC(enable, "Enable " DRIVER_NAME); 68 58 69 static DEFINE_PCI_DEVICE_TABLE(snd_cs5535audio_ids)= {59 static const struct pci_device_id snd_cs5535audio_ids[] = { 70 60 { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_AUDIO) }, 71 61 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_AUDIO) }, … … 85 75 } while (--timeout); 86 76 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"); 88 79 } 89 80 … … 110 101 } while (--timeout); 111 102 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); 114 106 115 107 return (unsigned short) val; … … 145 137 } 146 138 147 static int __devinitsnd_cs5535audio_mixer(struct cs5535audio *cs5535au)139 static int snd_cs5535audio_mixer(struct cs5535audio *cs5535au) 148 140 { 149 141 struct snd_card *card = cs5535au->card; … … 151 143 struct snd_ac97_template ac97; 152 144 int err; 153 static struct snd_ac97_bus_ops ops = {145 static const struct snd_ac97_bus_ops ops = { 154 146 .write = snd_cs5535audio_ac97_codec_write, 155 147 .read = snd_cs5535audio_ac97_codec_read, … … 169 161 170 162 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"); 172 164 return err; 173 165 } … … 177 169 err = olpc_quirks(card, cs5535au->ac97); 178 170 if (err < 0) { 179 snd_printk(KERN_ERR"olpc quirks failed\n");171 dev_err(card->dev, "olpc quirks failed\n"); 180 172 return err; 181 173 } … … 191 183 spin_unlock(&cs5535au->reg_lock); 192 184 if (bm_stat & EOP) { 193 struct cs5535audio_dma *dma;194 dma = cs5535au->playback_substream->runtime->private_data;195 185 snd_pcm_period_elapsed(cs5535au->playback_substream); 196 186 } 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); 199 190 } 200 191 } … … 206 197 bm_stat = cs_readb(cs5535au, ACC_BM1_STATUS); 207 198 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) 211 200 snd_pcm_period_elapsed(cs5535au->capture_substream); 212 }213 201 } 214 202 … … 242 230 break; 243 231 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); 246 235 break; 247 236 } … … 253 242 static int snd_cs5535audio_free(struct cs5535audio *cs5535au) 254 243 { 255 synchronize_irq(cs5535au->irq); 256 pci_set_power_state(cs5535au->pci, 3); 244 pci_set_power_state(cs5535au->pci, PCI_D3hot); 257 245 258 246 if (cs5535au->irq >= 0) … … 271 259 } 272 260 273 static int __devinitsnd_cs5535audio_create(struct snd_card *card,274 275 261 static int snd_cs5535audio_create(struct snd_card *card, 262 struct pci_dev *pci, 263 struct cs5535audio **rcs5535au) 276 264 { 277 265 struct cs5535audio *cs5535au; 278 266 279 267 int err; 280 static struct snd_device_ops ops = {268 static const struct snd_device_ops ops = { 281 269 .dev_free = snd_cs5535audio_dev_free, 282 270 }; … … 286 274 return err; 287 275 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"); 291 279 err = -ENXIO; 292 280 goto pcifail; … … 312 300 313 301 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); 316 304 err = -EBUSY; 317 305 goto sndfail; … … 319 307 320 308 cs5535au->irq = pci->irq; 309 card->sync_irq = cs5535au->irq; 321 310 pci_set_master(pci); 322 311 … … 325 314 goto sndfail; 326 315 327 snd_card_set_dev(card, &pci->dev);328 329 316 *rcs5535au = cs5535au; 330 317 return 0; … … 339 326 } 340 327 341 static int __devinitsnd_cs5535audio_probe(struct pci_dev *pci,342 328 static int snd_cs5535audio_probe(struct pci_dev *pci, 329 const struct pci_device_id *pci_id) 343 330 { 344 331 static int dev; … … 354 341 } 355 342 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); 357 345 if (err < 0) 358 346 return err; … … 388 376 } 389 377 390 static void __devexitsnd_cs5535audio_remove(struct pci_dev *pci)378 static void snd_cs5535audio_remove(struct pci_dev *pci) 391 379 { 392 380 olpc_quirks_cleanup(); 393 381 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 384 static struct pci_driver cs5535audio_driver = { 385 .name = KBUILD_MODNAME, 399 386 .id_table = snd_cs5535audio_ids, 400 387 .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 }, 405 393 #endif 406 394 }; 407 395 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) 396 module_pci_driver(cs5535audio_driver); 420 397 421 398 MODULE_AUTHOR("Jaya Kumar"); -
GPL/trunk/alsa-kernel/pci/cs5535audio/cs5535audio.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0 */ 1 2 #ifndef __SOUND_CS5535AUDIO_H 2 3 #define __SOUND_CS5535AUDIO_H … … 67 68 68 69 struct cs5535audio_dma_desc { 69 u32 addr;70 u16 size;71 u16 ctlreserved;70 __le32 addr; 71 __le16 size; 72 __le16 ctlreserved; 72 73 }; 73 74 … … 95 96 }; 96 97 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 98 extern const struct dev_pm_ops snd_cs5535audio_pm; 101 99 102 100 #ifdef CONFIG_OLPC 103 void __devinitolpc_prequirks(struct snd_card *card,104 struct snd_ac97_template *ac97);105 int __devinitolpc_quirks(struct snd_card *card, struct snd_ac97 *ac97);106 void __devexitolpc_quirks_cleanup(void);101 void olpc_prequirks(struct snd_card *card, 102 struct snd_ac97_template *ac97); 103 int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97); 104 void olpc_quirks_cleanup(void); 107 105 void olpc_analog_input(struct snd_ac97 *ac97, int on); 108 106 void olpc_mic_bias(struct snd_ac97 *ac97, int on); … … 137 135 #endif 138 136 139 int __devinitsnd_cs5535audio_pcm(struct cs5535audio *cs5535audio);137 int snd_cs5535audio_pcm(struct cs5535audio *cs5535audio); 140 138 141 139 #endif /* __SOUND_CS5535AUDIO_H */ -
GPL/trunk/alsa-kernel/pci/cs5535audio/cs5535audio_olpc.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * OLPC XO-1 additional sound features … … 4 5 * Copyright © 2006 Jaya Kumar <jayakumar.lkml@gmail.com> 5 6 * Copyright © 2007-2008 Andres Salomon <dilinger@debian.org> 6 *7 * This program is free software; you can redistribute it and/or modify8 * it under the terms of the GNU General Public License as published by9 * the Free Software Foundation; either version 2 of the License, or10 * (at your option) any later version.11 7 */ 12 8 #include <sound/core.h> … … 37 33 1 << AC97_AD_HPFD_SHIFT, on << AC97_AD_HPFD_SHIFT); 38 34 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); 40 37 return; 41 38 } … … 59 56 1 << AC97_AD_VREFD_SHIFT, on << AC97_AD_VREFD_SHIFT); 60 57 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); 62 59 } 63 60 … … 115 112 } 116 113 117 static struct snd_kcontrol_new olpc_cs5535audio_ctls[] __devinitdata= {114 static const struct snd_kcontrol_new olpc_cs5535audio_ctls[] = { 118 115 { 119 116 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 134 131 }; 135 132 136 void __devinitolpc_prequirks(struct snd_card *card,137 struct snd_ac97_template *ac97)133 void olpc_prequirks(struct snd_card *card, 134 struct snd_ac97_template *ac97) 138 135 { 139 136 if (!machine_is_olpc()) … … 145 142 } 146 143 147 int __devinitolpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)144 int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97) 148 145 { 149 146 struct snd_ctl_elem_id elem; … … 154 151 155 152 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"); 157 154 return -EIO; 158 155 } … … 162 159 memset(&elem, 0, sizeof(elem)); 163 160 elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 164 str ncpy(elem.name, "High Pass Filter Enable", sizeof(elem.name));161 strlcpy(elem.name, "High Pass Filter Enable", sizeof(elem.name)); 165 162 snd_ctl_remove_id(card, &elem); 166 163 … … 168 165 memset(&elem, 0, sizeof(elem)); 169 166 elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 170 str ncpy(elem.name, "V_REFOUT Enable", sizeof(elem.name));167 strlcpy(elem.name, "V_REFOUT Enable", sizeof(elem.name)); 171 168 snd_ctl_remove_id(card, &elem); 172 169 … … 186 183 } 187 184 188 void __devexitolpc_quirks_cleanup(void)185 void olpc_quirks_cleanup(void) 189 186 { 190 187 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 1 2 /* 2 3 * Driver for audio on multifunction CS5535 companion device … … 5 6 * Based on Jaroslav Kysela and Takashi Iwai's examples. 6 7 * This work was sponsored by CIS(M) Sdn Bhd. 7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (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 of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 8 * 22 9 * todo: add be fmt support, spdif, pm … … 34 21 #include "cs5535audio.h" 35 22 36 static struct snd_pcm_hardware snd_cs5535audio_playback =23 static const struct snd_pcm_hardware snd_cs5535audio_playback = 37 24 { 38 25 .info = ( … … 63 50 }; 64 51 65 static struct snd_pcm_hardware snd_cs5535audio_capture =52 static const struct snd_pcm_hardware snd_cs5535audio_capture = 66 53 { 67 54 .info = ( … … 131 118 if (dma->desc_buf.area == NULL) { 132 119 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, 133 snd_dma_pci_data(cs5535au->pci),120 &cs5535au->pci->dev, 134 121 CS5535AUDIO_DESC_LIST_SIZE+1, 135 122 &dma->desc_buf) < 0) … … 149 136 &((struct cs5535audio_dma_desc *) dma->desc_buf.area)[i]; 150 137 desc->addr = cpu_to_le32(addr); 151 desc->size = cpu_to_le 32(period_bytes);152 desc->ctlreserved = cpu_to_le 32(PRD_EOP);138 desc->size = cpu_to_le16(period_bytes); 139 desc->ctlreserved = cpu_to_le16(PRD_EOP); 153 140 desc_addr += sizeof(struct cs5535audio_dma_desc); 154 141 addr += period_bytes; … … 158 145 lastdesc->addr = cpu_to_le32((u32) dma->desc_buf.addr); 159 146 lastdesc->size = 0; 160 lastdesc->ctlreserved = cpu_to_le 32(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; 163 150 164 151 dma->substream = substream; … … 250 237 int err; 251 238 252 err = snd_pcm_lib_malloc_pages(substream,253 params_buffer_bytes(hw_params));254 if (err < 0)255 return err;256 239 dma->buf_addr = substream->runtime->dma_addr; 257 240 dma->buf_bytes = params_buffer_bytes(hw_params); … … 281 264 } 282 265 cs5535audio_clear_dma_packets(cs5535au, dma, substream); 283 return snd_pcm_lib_free_pages(substream);266 return 0; 284 267 } 285 268 … … 318 301 break; 319 302 default: 320 snd_printk(KERN_ERR"unhandled trigger\n");303 dev_err(cs5535au->card->dev, "unhandled trigger\n"); 321 304 err = -EINVAL; 322 305 break; … … 336 319 curdma = dma->ops->read_dma_pntr(cs5535au); 337 320 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", 339 322 curdma, dma->buf_addr); 340 323 return 0; … … 342 325 curdma -= dma->buf_addr; 343 326 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", 345 328 curdma, dma->buf_bytes); 346 329 return 0; … … 381 364 } 382 365 383 static struct snd_pcm_ops snd_cs5535audio_playback_ops = {366 static const struct snd_pcm_ops snd_cs5535audio_playback_ops = { 384 367 .open = snd_cs5535audio_playback_open, 385 368 .close = snd_cs5535audio_playback_close, 386 .ioctl = snd_pcm_lib_ioctl,387 369 .hw_params = snd_cs5535audio_hw_params, 388 370 .hw_free = snd_cs5535audio_hw_free, … … 392 374 }; 393 375 394 static struct snd_pcm_ops snd_cs5535audio_capture_ops = {376 static const struct snd_pcm_ops snd_cs5535audio_capture_ops = { 395 377 .open = snd_cs5535audio_capture_open, 396 378 .close = snd_cs5535audio_capture_close, 397 .ioctl = snd_pcm_lib_ioctl,398 379 .hw_params = snd_cs5535audio_hw_params, 399 380 .hw_free = snd_cs5535audio_hw_free, … … 403 384 }; 404 385 405 static struct cs5535audio_dma_ops snd_cs5535audio_playback_dma_ops = {386 static const struct cs5535audio_dma_ops snd_cs5535audio_playback_dma_ops = { 406 387 .type = CS5535AUDIO_DMA_PLAYBACK, 407 388 .enable_dma = cs5535audio_playback_enable_dma, … … 413 394 }; 414 395 415 static struct cs5535audio_dma_ops snd_cs5535audio_capture_dma_ops = {396 static const struct cs5535audio_dma_ops snd_cs5535audio_capture_dma_ops = { 416 397 .type = CS5535AUDIO_DMA_CAPTURE, 417 398 .enable_dma = cs5535audio_capture_enable_dma, … … 423 404 }; 424 405 425 int __devinitsnd_cs5535audio_pcm(struct cs5535audio *cs5535au)406 int snd_cs5535audio_pcm(struct cs5535audio *cs5535au) 426 407 { 427 408 struct snd_pcm *pcm; … … 445 426 strcpy(pcm->name, "CS5535 Audio"); 446 427 447 snd_pcm_ lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,448 snd_dma_pci_data(cs5535au->pci),449 428 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, 429 &cs5535au->pci->dev, 430 64*1024, 128*1024); 450 431 cs5535au->pcm = pcm; 451 432 -
GPL/trunk/alsa-kernel/pci/cs5535audio/cs5535audio_pm.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Power management for audio on multifunction CS5535 companion device 3 4 * Copyright (C) Jaya Kumar 4 *5 * This program is free software; you can redistribute it and/or modify6 * it under the terms of the GNU General Public License as published by7 * the Free Software Foundation; either version 2 of the License, or8 * (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 of12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * GNU General Public License for more details.14 *15 * You should have received a copy of the GNU General Public License16 * along with this program; if not, write to the Free Software17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18 *19 5 */ 20 6 … … 56 42 } 57 43 58 int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state)44 static int __maybe_unused snd_cs5535audio_suspend(struct device *dev) 59 45 { 60 struct snd_card *card = pci_get_drvdata(pci);46 struct snd_card *card = dev_get_drvdata(dev); 61 47 struct cs5535audio *cs5535au = card->private_data; 62 48 int i; 63 49 64 50 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 65 snd_pcm_suspend_all(cs5535au->pcm);66 51 snd_ac97_suspend(cs5535au->ac97); 67 52 for (i = 0; i < NUM_CS5535AUDIO_DMAS; i++) { … … 72 57 /* save important regs, then disable aclink in hw */ 73 58 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));81 59 return 0; 82 60 } 83 61 84 int snd_cs5535audio_resume(struct pci_dev *pci)62 static int __maybe_unused snd_cs5535audio_resume(struct device *dev) 85 63 { 86 struct snd_card *card = pci_get_drvdata(pci);64 struct snd_card *card = dev_get_drvdata(dev); 87 65 struct cs5535audio *cs5535au = card->private_data; 88 66 u32 tmp; 89 67 int timeout; 90 68 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);101 69 102 70 /* set LNK_WRM_RST to reset AC link */ … … 112 80 113 81 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"); 115 83 116 84 /* set up rate regs, dma. actual initiation is done in trig */ … … 130 98 } 131 99 100 SIMPLE_DEV_PM_OPS(snd_cs5535audio_pm, snd_cs5535audio_suspend, snd_cs5535audio_resume);
Note:
See TracChangeset
for help on using the changeset viewer.