xref: /openbmc/linux/sound/pci/cs5535audio/cs5535audio.c (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
11a59d1b8SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
29b4ffa48SJaya Kumar /*
39ac25594SJaya Kumar  * Driver for audio on multifunction CS5535/6 companion device
49b4ffa48SJaya Kumar  * Copyright (C) Jaya Kumar
59b4ffa48SJaya Kumar  *
69b4ffa48SJaya Kumar  * Based on Jaroslav Kysela and Takashi Iwai's examples.
79b4ffa48SJaya Kumar  * This work was sponsored by CIS(M) Sdn Bhd.
89b4ffa48SJaya Kumar  */
99b4ffa48SJaya Kumar 
109b4ffa48SJaya Kumar #include <linux/delay.h>
119b4ffa48SJaya Kumar #include <linux/interrupt.h>
129b4ffa48SJaya Kumar #include <linux/init.h>
139b4ffa48SJaya Kumar #include <linux/pci.h>
149b4ffa48SJaya Kumar #include <linux/slab.h>
1565a77217SPaul Gortmaker #include <linux/module.h>
166cbbfe1cSTakashi Iwai #include <linux/io.h>
179b4ffa48SJaya Kumar #include <sound/core.h>
189b4ffa48SJaya Kumar #include <sound/control.h>
199b4ffa48SJaya Kumar #include <sound/pcm.h>
209b4ffa48SJaya Kumar #include <sound/rawmidi.h>
219b4ffa48SJaya Kumar #include <sound/ac97_codec.h>
229b4ffa48SJaya Kumar #include <sound/initval.h>
239b4ffa48SJaya Kumar #include <sound/asoundef.h>
249b4ffa48SJaya Kumar #include "cs5535audio.h"
259b4ffa48SJaya Kumar 
269b4ffa48SJaya Kumar #define DRIVER_NAME "cs5535audio"
279b4ffa48SJaya Kumar 
289ac25594SJaya Kumar static char *ac97_quirk;
299ac25594SJaya Kumar module_param(ac97_quirk, charp, 0444);
309ac25594SJaya Kumar MODULE_PARM_DESC(ac97_quirk, "AC'97 board specific workarounds.");
319ac25594SJaya Kumar 
32eab0fbfaSJoe Perches static const struct ac97_quirk ac97_quirks[] = {
339ac25594SJaya Kumar #if 0 /* Not yet confirmed if all 5536 boards are HP only */
349ac25594SJaya Kumar 	{
359ac25594SJaya Kumar 		.subvendor = PCI_VENDOR_ID_AMD,
369ac25594SJaya Kumar 		.subdevice = PCI_DEVICE_ID_AMD_CS5536_AUDIO,
379ac25594SJaya Kumar 		.name = "AMD RDK",
389ac25594SJaya Kumar 		.type = AC97_TUNE_HP_ONLY
399ac25594SJaya Kumar 	},
409ac25594SJaya Kumar #endif
419ac25594SJaya Kumar 	{}
429ac25594SJaya Kumar };
439b4ffa48SJaya Kumar 
44302e4c2fSTakashi Iwai static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
45302e4c2fSTakashi Iwai static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
46a67ff6a5SRusty Russell static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
479b4ffa48SJaya Kumar 
48302e4c2fSTakashi Iwai module_param_array(index, int, NULL, 0444);
491dbfd8c5STakashi Iwai MODULE_PARM_DESC(index, "Index value for " DRIVER_NAME);
50302e4c2fSTakashi Iwai module_param_array(id, charp, NULL, 0444);
511dbfd8c5STakashi Iwai MODULE_PARM_DESC(id, "ID string for " DRIVER_NAME);
52302e4c2fSTakashi Iwai module_param_array(enable, bool, NULL, 0444);
53302e4c2fSTakashi Iwai MODULE_PARM_DESC(enable, "Enable " DRIVER_NAME);
541dbfd8c5STakashi Iwai 
559baa3c34SBenoit Taine static const struct pci_device_id snd_cs5535audio_ids[] = {
569ac25594SJaya Kumar 	{ PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_AUDIO) },
579ac25594SJaya Kumar 	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_AUDIO) },
589b4ffa48SJaya Kumar 	{}
599b4ffa48SJaya Kumar };
609b4ffa48SJaya Kumar 
619b4ffa48SJaya Kumar MODULE_DEVICE_TABLE(pci, snd_cs5535audio_ids);
629b4ffa48SJaya Kumar 
wait_till_cmd_acked(struct cs5535audio * cs5535au,unsigned long timeout)6366f8df6bSTakashi Iwai static void wait_till_cmd_acked(struct cs5535audio *cs5535au, unsigned long timeout)
649b4ffa48SJaya Kumar {
653e873174STakashi Iwai 	unsigned int tmp;
669b4ffa48SJaya Kumar 	do {
679b4ffa48SJaya Kumar 		tmp = cs_readl(cs5535au, ACC_CODEC_CNTL);
689b4ffa48SJaya Kumar 		if (!(tmp & CMD_NEW))
699b4ffa48SJaya Kumar 			break;
701037593cSDavid Vrabel 		udelay(1);
719b4ffa48SJaya Kumar 	} while (--timeout);
729b4ffa48SJaya Kumar 	if (!timeout)
7300980aa9STakashi Iwai 		dev_err(cs5535au->card->dev,
7400980aa9STakashi Iwai 			"Failure writing to cs5535 codec\n");
759b4ffa48SJaya Kumar }
769b4ffa48SJaya Kumar 
snd_cs5535audio_codec_read(struct cs5535audio * cs5535au,unsigned short reg)7766f8df6bSTakashi Iwai static unsigned short snd_cs5535audio_codec_read(struct cs5535audio *cs5535au,
789b4ffa48SJaya Kumar 						 unsigned short reg)
799b4ffa48SJaya Kumar {
803e873174STakashi Iwai 	unsigned int regdata;
8166f8df6bSTakashi Iwai 	unsigned int timeout;
823e873174STakashi Iwai 	unsigned int val;
839b4ffa48SJaya Kumar 
843e873174STakashi Iwai 	regdata = ((unsigned int) reg) << 24;
859b4ffa48SJaya Kumar 	regdata |= ACC_CODEC_CNTL_RD_CMD;
869b4ffa48SJaya Kumar 	regdata |= CMD_NEW;
879b4ffa48SJaya Kumar 
889b4ffa48SJaya Kumar 	cs_writel(cs5535au, ACC_CODEC_CNTL, regdata);
891037593cSDavid Vrabel 	wait_till_cmd_acked(cs5535au, 50);
909b4ffa48SJaya Kumar 
919b4ffa48SJaya Kumar 	timeout = 50;
929b4ffa48SJaya Kumar 	do {
939b4ffa48SJaya Kumar 		val = cs_readl(cs5535au, ACC_CODEC_STATUS);
943e873174STakashi Iwai 		if ((val & STS_NEW) && reg == (val >> 24))
959b4ffa48SJaya Kumar 			break;
961037593cSDavid Vrabel 		udelay(1);
979b4ffa48SJaya Kumar 	} while (--timeout);
989b4ffa48SJaya Kumar 	if (!timeout)
9900980aa9STakashi Iwai 		dev_err(cs5535au->card->dev,
10000980aa9STakashi Iwai 			"Failure reading codec reg 0x%x, Last value=0x%x\n",
10100980aa9STakashi Iwai 			reg, val);
1029b4ffa48SJaya Kumar 
1033e873174STakashi Iwai 	return (unsigned short) val;
1049b4ffa48SJaya Kumar }
1059b4ffa48SJaya Kumar 
snd_cs5535audio_codec_write(struct cs5535audio * cs5535au,unsigned short reg,unsigned short val)10666f8df6bSTakashi Iwai static void snd_cs5535audio_codec_write(struct cs5535audio *cs5535au,
1079b4ffa48SJaya Kumar 					unsigned short reg, unsigned short val)
1089b4ffa48SJaya Kumar {
1093e873174STakashi Iwai 	unsigned int regdata;
1109b4ffa48SJaya Kumar 
1113e873174STakashi Iwai 	regdata = ((unsigned int) reg) << 24;
1123e873174STakashi Iwai 	regdata |= val;
1139b4ffa48SJaya Kumar 	regdata &= CMD_MASK;
1149b4ffa48SJaya Kumar 	regdata |= CMD_NEW;
1159b4ffa48SJaya Kumar 	regdata &= ACC_CODEC_CNTL_WR_CMD;
1169b4ffa48SJaya Kumar 
1179b4ffa48SJaya Kumar 	cs_writel(cs5535au, ACC_CODEC_CNTL, regdata);
1189b4ffa48SJaya Kumar 	wait_till_cmd_acked(cs5535au, 50);
1199b4ffa48SJaya Kumar }
1209b4ffa48SJaya Kumar 
snd_cs5535audio_ac97_codec_write(struct snd_ac97 * ac97,unsigned short reg,unsigned short val)12166f8df6bSTakashi Iwai static void snd_cs5535audio_ac97_codec_write(struct snd_ac97 *ac97,
1229b4ffa48SJaya Kumar 					     unsigned short reg, unsigned short val)
1239b4ffa48SJaya Kumar {
12466f8df6bSTakashi Iwai 	struct cs5535audio *cs5535au = ac97->private_data;
1259b4ffa48SJaya Kumar 	snd_cs5535audio_codec_write(cs5535au, reg, val);
1269b4ffa48SJaya Kumar }
1279b4ffa48SJaya Kumar 
snd_cs5535audio_ac97_codec_read(struct snd_ac97 * ac97,unsigned short reg)12866f8df6bSTakashi Iwai static unsigned short snd_cs5535audio_ac97_codec_read(struct snd_ac97 *ac97,
1299b4ffa48SJaya Kumar 						      unsigned short reg)
1309b4ffa48SJaya Kumar {
13166f8df6bSTakashi Iwai 	struct cs5535audio *cs5535au = ac97->private_data;
1329b4ffa48SJaya Kumar 	return snd_cs5535audio_codec_read(cs5535au, reg);
1339b4ffa48SJaya Kumar }
1349b4ffa48SJaya Kumar 
snd_cs5535audio_mixer(struct cs5535audio * cs5535au)135e23e7a14SBill Pemberton static int snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
1369b4ffa48SJaya Kumar {
13766f8df6bSTakashi Iwai 	struct snd_card *card = cs5535au->card;
13866f8df6bSTakashi Iwai 	struct snd_ac97_bus *pbus;
13966f8df6bSTakashi Iwai 	struct snd_ac97_template ac97;
1409b4ffa48SJaya Kumar 	int err;
14151055da5STakashi Iwai 	static const struct snd_ac97_bus_ops ops = {
1429b4ffa48SJaya Kumar 		.write = snd_cs5535audio_ac97_codec_write,
1439b4ffa48SJaya Kumar 		.read = snd_cs5535audio_ac97_codec_read,
1449b4ffa48SJaya Kumar 	};
1459b4ffa48SJaya Kumar 
146164b3ddeSTakashi Iwai 	err = snd_ac97_bus(card, 0, &ops, NULL, &pbus);
147164b3ddeSTakashi Iwai 	if (err < 0)
1489b4ffa48SJaya Kumar 		return err;
1499b4ffa48SJaya Kumar 
1509b4ffa48SJaya Kumar 	memset(&ac97, 0, sizeof(ac97));
151b035ce0fSJaya Kumar 	ac97.scaps = AC97_SCAP_AUDIO | AC97_SCAP_SKIP_MODEM
152b035ce0fSJaya Kumar 			| AC97_SCAP_POWER_SAVE;
1539b4ffa48SJaya Kumar 	ac97.private_data = cs5535au;
1549b4ffa48SJaya Kumar 	ac97.pci = cs5535au->pci;
1559b4ffa48SJaya Kumar 
1563556d184SAndres Salomon 	/* set any OLPC-specific scaps */
1573556d184SAndres Salomon 	olpc_prequirks(card, &ac97);
1583556d184SAndres Salomon 
159164b3ddeSTakashi Iwai 	err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97);
160164b3ddeSTakashi Iwai 	if (err < 0) {
16100980aa9STakashi Iwai 		dev_err(card->dev, "mixer failed\n");
1629b4ffa48SJaya Kumar 		return err;
1639b4ffa48SJaya Kumar 	}
1649b4ffa48SJaya Kumar 
1659ac25594SJaya Kumar 	snd_ac97_tune_hardware(cs5535au->ac97, ac97_quirks, ac97_quirk);
1669ac25594SJaya Kumar 
16757d4bf6dSJaya Kumar 	err = olpc_quirks(card, cs5535au->ac97);
16857d4bf6dSJaya Kumar 	if (err < 0) {
16900980aa9STakashi Iwai 		dev_err(card->dev, "olpc quirks failed\n");
17057d4bf6dSJaya Kumar 		return err;
17157d4bf6dSJaya Kumar 	}
17257d4bf6dSJaya Kumar 
1739b4ffa48SJaya Kumar 	return 0;
1749b4ffa48SJaya Kumar }
1759b4ffa48SJaya Kumar 
process_bm0_irq(struct cs5535audio * cs5535au)17666f8df6bSTakashi Iwai static void process_bm0_irq(struct cs5535audio *cs5535au)
1779b4ffa48SJaya Kumar {
1789b4ffa48SJaya Kumar 	u8 bm_stat;
1799b4ffa48SJaya Kumar 	spin_lock(&cs5535au->reg_lock);
1809b4ffa48SJaya Kumar 	bm_stat = cs_readb(cs5535au, ACC_BM0_STATUS);
1819b4ffa48SJaya Kumar 	spin_unlock(&cs5535au->reg_lock);
1829b4ffa48SJaya Kumar 	if (bm_stat & EOP) {
1839b4ffa48SJaya Kumar 		snd_pcm_period_elapsed(cs5535au->playback_substream);
1849b4ffa48SJaya Kumar 	} else {
18500980aa9STakashi Iwai 		dev_err(cs5535au->card->dev,
18600980aa9STakashi Iwai 			"unexpected bm0 irq src, bm_stat=%x\n",
1879b4ffa48SJaya Kumar 			bm_stat);
1889b4ffa48SJaya Kumar 	}
1899b4ffa48SJaya Kumar }
1909b4ffa48SJaya Kumar 
process_bm1_irq(struct cs5535audio * cs5535au)19166f8df6bSTakashi Iwai static void process_bm1_irq(struct cs5535audio *cs5535au)
1929b4ffa48SJaya Kumar {
1939b4ffa48SJaya Kumar 	u8 bm_stat;
1949b4ffa48SJaya Kumar 	spin_lock(&cs5535au->reg_lock);
1959b4ffa48SJaya Kumar 	bm_stat = cs_readb(cs5535au, ACC_BM1_STATUS);
1969b4ffa48SJaya Kumar 	spin_unlock(&cs5535au->reg_lock);
19745bf4100SColin Ian King 	if (bm_stat & EOP)
1989b4ffa48SJaya Kumar 		snd_pcm_period_elapsed(cs5535au->capture_substream);
1999b4ffa48SJaya Kumar }
2009b4ffa48SJaya Kumar 
snd_cs5535audio_interrupt(int irq,void * dev_id)2017d12e780SDavid Howells static irqreturn_t snd_cs5535audio_interrupt(int irq, void *dev_id)
2029b4ffa48SJaya Kumar {
2039b4ffa48SJaya Kumar 	u16 acc_irq_stat;
2049b4ffa48SJaya Kumar 	unsigned char count;
20566f8df6bSTakashi Iwai 	struct cs5535audio *cs5535au = dev_id;
2069b4ffa48SJaya Kumar 
2079b4ffa48SJaya Kumar 	if (cs5535au == NULL)
2089b4ffa48SJaya Kumar 		return IRQ_NONE;
2099b4ffa48SJaya Kumar 
2109b4ffa48SJaya Kumar 	acc_irq_stat = cs_readw(cs5535au, ACC_IRQ_STATUS);
2119b4ffa48SJaya Kumar 
2129b4ffa48SJaya Kumar 	if (!acc_irq_stat)
2139b4ffa48SJaya Kumar 		return IRQ_NONE;
2144ea24163SAndres Salomon 	for (count = 0; count < 4; count++) {
2159b4ffa48SJaya Kumar 		if (acc_irq_stat & (1 << count)) {
2169b4ffa48SJaya Kumar 			switch (count) {
2179b4ffa48SJaya Kumar 			case IRQ_STS:
2189b4ffa48SJaya Kumar 				cs_readl(cs5535au, ACC_GPIO_STATUS);
2199b4ffa48SJaya Kumar 				break;
2209b4ffa48SJaya Kumar 			case WU_IRQ_STS:
2219b4ffa48SJaya Kumar 				cs_readl(cs5535au, ACC_GPIO_STATUS);
2229b4ffa48SJaya Kumar 				break;
2239b4ffa48SJaya Kumar 			case BM0_IRQ_STS:
2249b4ffa48SJaya Kumar 				process_bm0_irq(cs5535au);
2259b4ffa48SJaya Kumar 				break;
2269b4ffa48SJaya Kumar 			case BM1_IRQ_STS:
2279b4ffa48SJaya Kumar 				process_bm1_irq(cs5535au);
2289b4ffa48SJaya Kumar 				break;
2299b4ffa48SJaya Kumar 			default:
23000980aa9STakashi Iwai 				dev_err(cs5535au->card->dev,
23100980aa9STakashi Iwai 					"Unexpected irq src: 0x%x\n",
23200980aa9STakashi Iwai 					acc_irq_stat);
2339b4ffa48SJaya Kumar 				break;
2349b4ffa48SJaya Kumar 			}
2359b4ffa48SJaya Kumar 		}
2369b4ffa48SJaya Kumar 	}
2379b4ffa48SJaya Kumar 	return IRQ_HANDLED;
2389b4ffa48SJaya Kumar }
2399b4ffa48SJaya Kumar 
snd_cs5535audio_free(struct snd_card * card)2405eba4c64STakashi Iwai static void snd_cs5535audio_free(struct snd_card *card)
2419b4ffa48SJaya Kumar {
2425eba4c64STakashi Iwai 	olpc_quirks_cleanup();
2439b4ffa48SJaya Kumar }
2449b4ffa48SJaya Kumar 
snd_cs5535audio_create(struct snd_card * card,struct pci_dev * pci)245e23e7a14SBill Pemberton static int snd_cs5535audio_create(struct snd_card *card,
2465eba4c64STakashi Iwai 				  struct pci_dev *pci)
2479b4ffa48SJaya Kumar {
2485eba4c64STakashi Iwai 	struct cs5535audio *cs5535au = card->private_data;
2499b4ffa48SJaya Kumar 	int err;
2509b4ffa48SJaya Kumar 
2515eba4c64STakashi Iwai 	err = pcim_enable_device(pci);
252164b3ddeSTakashi Iwai 	if (err < 0)
2539b4ffa48SJaya Kumar 		return err;
2549b4ffa48SJaya Kumar 
255669f65eaSTakashi Iwai 	if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32))) {
25600980aa9STakashi Iwai 		dev_warn(card->dev, "unable to get 32bit dma\n");
2575eba4c64STakashi Iwai 		return -ENXIO;
2589b4ffa48SJaya Kumar 	}
2599b4ffa48SJaya Kumar 
2609b4ffa48SJaya Kumar 	spin_lock_init(&cs5535au->reg_lock);
2619b4ffa48SJaya Kumar 	cs5535au->card = card;
2629b4ffa48SJaya Kumar 	cs5535au->pci = pci;
2639b4ffa48SJaya Kumar 	cs5535au->irq = -1;
2649b4ffa48SJaya Kumar 
265164b3ddeSTakashi Iwai 	err = pci_request_regions(pci, "CS5535 Audio");
2665eba4c64STakashi Iwai 	if (err < 0)
2675eba4c64STakashi Iwai 		return err;
2689b4ffa48SJaya Kumar 
2699b4ffa48SJaya Kumar 	cs5535au->port = pci_resource_start(pci, 0);
2709b4ffa48SJaya Kumar 
2715eba4c64STakashi Iwai 	if (devm_request_irq(&pci->dev, pci->irq, snd_cs5535audio_interrupt,
272934c2b6dSTakashi Iwai 			     IRQF_SHARED, KBUILD_MODNAME, cs5535au)) {
27300980aa9STakashi Iwai 		dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
2745eba4c64STakashi Iwai 		return -EBUSY;
2759b4ffa48SJaya Kumar 	}
2769b4ffa48SJaya Kumar 
2779b4ffa48SJaya Kumar 	cs5535au->irq = pci->irq;
27825ec679bSTakashi Iwai 	card->sync_irq = cs5535au->irq;
2799b4ffa48SJaya Kumar 	pci_set_master(pci);
2809b4ffa48SJaya Kumar 
2819b4ffa48SJaya Kumar 	return 0;
2829b4ffa48SJaya Kumar }
2839b4ffa48SJaya Kumar 
__snd_cs5535audio_probe(struct pci_dev * pci,const struct pci_device_id * pci_id)284*2a563147STakashi Iwai static int __snd_cs5535audio_probe(struct pci_dev *pci,
2859b4ffa48SJaya Kumar 				   const struct pci_device_id *pci_id)
2869b4ffa48SJaya Kumar {
2879b4ffa48SJaya Kumar 	static int dev;
28866f8df6bSTakashi Iwai 	struct snd_card *card;
28966f8df6bSTakashi Iwai 	struct cs5535audio *cs5535au;
2909b4ffa48SJaya Kumar 	int err;
2919b4ffa48SJaya Kumar 
2929b4ffa48SJaya Kumar 	if (dev >= SNDRV_CARDS)
2939b4ffa48SJaya Kumar 		return -ENODEV;
294302e4c2fSTakashi Iwai 	if (!enable[dev]) {
295302e4c2fSTakashi Iwai 		dev++;
296302e4c2fSTakashi Iwai 		return -ENOENT;
297302e4c2fSTakashi Iwai 	}
2989b4ffa48SJaya Kumar 
2995eba4c64STakashi Iwai 	err = snd_devm_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
3005eba4c64STakashi Iwai 				sizeof(*cs5535au), &card);
3015eba4c64STakashi Iwai 	if (err < 0)
3025eba4c64STakashi Iwai 		return err;
3035eba4c64STakashi Iwai 	cs5535au = card->private_data;
3045eba4c64STakashi Iwai 	card->private_free = snd_cs5535audio_free;
3055eba4c64STakashi Iwai 
3065eba4c64STakashi Iwai 	err = snd_cs5535audio_create(card, pci);
307e58de7baSTakashi Iwai 	if (err < 0)
308e58de7baSTakashi Iwai 		return err;
3099b4ffa48SJaya Kumar 
310164b3ddeSTakashi Iwai 	err = snd_cs5535audio_mixer(cs5535au);
311164b3ddeSTakashi Iwai 	if (err < 0)
3125eba4c64STakashi Iwai 		return err;
3139b4ffa48SJaya Kumar 
314164b3ddeSTakashi Iwai 	err = snd_cs5535audio_pcm(cs5535au);
315164b3ddeSTakashi Iwai 	if (err < 0)
3165eba4c64STakashi Iwai 		return err;
3179b4ffa48SJaya Kumar 
3189b4ffa48SJaya Kumar 	strcpy(card->driver, DRIVER_NAME);
3199b4ffa48SJaya Kumar 
3209b4ffa48SJaya Kumar 	strcpy(card->shortname, "CS5535 Audio");
3219b4ffa48SJaya Kumar 	sprintf(card->longname, "%s %s at 0x%lx, irq %i",
3229b4ffa48SJaya Kumar 		card->shortname, card->driver,
3239b4ffa48SJaya Kumar 		cs5535au->port, cs5535au->irq);
3249b4ffa48SJaya Kumar 
325164b3ddeSTakashi Iwai 	err = snd_card_register(card);
326164b3ddeSTakashi Iwai 	if (err < 0)
3275eba4c64STakashi Iwai 		return err;
3289b4ffa48SJaya Kumar 
3299b4ffa48SJaya Kumar 	pci_set_drvdata(pci, card);
3309b4ffa48SJaya Kumar 	dev++;
3319b4ffa48SJaya Kumar 	return 0;
3329b4ffa48SJaya Kumar }
3339b4ffa48SJaya Kumar 
snd_cs5535audio_probe(struct pci_dev * pci,const struct pci_device_id * pci_id)334*2a563147STakashi Iwai static int snd_cs5535audio_probe(struct pci_dev *pci,
335*2a563147STakashi Iwai 				 const struct pci_device_id *pci_id)
336*2a563147STakashi Iwai {
337*2a563147STakashi Iwai 	return snd_card_free_on_error(&pci->dev, __snd_cs5535audio_probe(pci, pci_id));
338*2a563147STakashi Iwai }
339*2a563147STakashi Iwai 
340e9f66d9bSTakashi Iwai static struct pci_driver cs5535audio_driver = {
3413733e424STakashi Iwai 	.name = KBUILD_MODNAME,
3429b4ffa48SJaya Kumar 	.id_table = snd_cs5535audio_ids,
3439b4ffa48SJaya Kumar 	.probe = snd_cs5535audio_probe,
344c7561cd8STakashi Iwai #ifdef CONFIG_PM_SLEEP
34568cb2b55STakashi Iwai 	.driver = {
34668cb2b55STakashi Iwai 		.pm = &snd_cs5535audio_pm,
34768cb2b55STakashi Iwai 	},
3489ac25594SJaya Kumar #endif
3499b4ffa48SJaya Kumar };
3509b4ffa48SJaya Kumar 
351e9f66d9bSTakashi Iwai module_pci_driver(cs5535audio_driver);
3529b4ffa48SJaya Kumar 
3539b4ffa48SJaya Kumar MODULE_AUTHOR("Jaya Kumar");
3549b4ffa48SJaya Kumar MODULE_LICENSE("GPL");
3559b4ffa48SJaya Kumar MODULE_DESCRIPTION("CS5535 Audio");
356