aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/opti9xx/opti92x-ad1848.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-24 16:37:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-24 16:37:37 -0400
commitdbf7b5915b39bfff548e4c6a3a753fc291a60e25 (patch)
tree55c457a22aa869d2ab558317877138369ae5f9bb /sound/isa/opti9xx/opti92x-ad1848.c
parentd14b7a419a664cd7c1c585c9e7fffee9e9051d53 (diff)
parentc1b623d9e4117d18d244e9b7fb30d2c27aeaf074 (diff)
Merge tag 'sound-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound update from Takashi Iwai: "This is a fairly quiet release in all sound area. Only a little bit of changes in the core side while most of changes are seen in the drivers. HD-audio: - A few new codec additions for Nvidia, Realtek and VIA - Intel Haswell audio support - Support for "phantom" jacks for consistent jack reporting - Major clean-ups in HDMI/DP driver codes - A workaround for inverted digital-mic pins with Realtek codecs - Removal of beep_mode=2 option ASoC: - Added the ability to add and remove DAPM paths dynamically, mostly for reparenting on clock changes - New machine drivers for Marvell Brownstone, ST-Ericsson Ux500 reference platform and ttc-dkp - New CPU drivers for Blackfin BF6xx SPORTs in I2S mode, Marvell MMP, Synopsis Designware I2S controllers, and SPEAr DMA and S/PDIF - New CODEC drivers for Dialog DA732x, ST STA529, ST-Ericsson AB8500, TI Isabelle and Wolfson Microelectronics WM5102 and WM5110 - DAPM fixes for the recent locking changes - Fix for _PRE and _POST widgets (which have been broken for a few releases now) - A couple of minor driver updates Misc - Conversion to new dev_pm_ops in platform and PCI drivers - LTC support and some fixes in PCXHR driver - A few fixes and PM support for ISA OPti9xx and WSS cards - Some TLV code cleanup - Move driver-specific headers from include/sound to local dirs" * tag 'sound-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (212 commits) ASoC: dapm: Fix _PRE and _POST events for DAPM performance improvements ALSA: hda - add dock support for Thinkpad X230 Tablet ALSA: hda - Turn on PIN_OUT from hdmi playback prepare. ASoC imx-audmux: add MX31_AUDMUX_PORT7_SSI_PINS_7 define ASoC: littlemill: Add userspace control of the WM1250 I/O ASoC: wm8994: Update micdet for irqdomain conversion ALSA: hda - make sure alc268 does not OOPS on codec parse ALSA: hda - Add support for Realtek ALC282 ALSA: hda - Fix index number conflicts of phantom jacks ALSA: opti9xx: Fix section mismatch by PM support ALSA: snd-opti9xx: Implement suspend/resume ALSA: hda - Add new GPU codec ID to snd-hda ALSA: hda - Fix driver type of Haswell controller to AZX_DRIVER_SCH ALSA: hda - add Haswell HDMI codec id ALSA: hda - Add DeviceID for Haswell HDA ALSA: wss_lib: Fix resume on Yamaha OPL3-SAx ALSA: wss_lib: fix suspend/resume ALSA: es1938: replace TLV_DB_RANGE_HEAD with DECLARE_TLV_DB_RANGE ALSA: tlv: add DECLARE_TLV_DB_RANGE() ALSA: tlv: add DECLARE_TLV_CONTAINER() ...
Diffstat (limited to 'sound/isa/opti9xx/opti92x-ad1848.c')
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c86
1 files changed, 72 insertions, 14 deletions
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index d7ccf28bd66a..f8fbe22515c9 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -135,10 +135,9 @@ struct snd_opti9xx {
135 unsigned long mc_base_size; 135 unsigned long mc_base_size;
136#ifdef OPTi93X 136#ifdef OPTi93X
137 unsigned long mc_indir_index; 137 unsigned long mc_indir_index;
138 unsigned long mc_indir_size;
139 struct resource *res_mc_indir; 138 struct resource *res_mc_indir;
140 struct snd_wss *codec;
141#endif /* OPTi93X */ 139#endif /* OPTi93X */
140 struct snd_wss *codec;
142 unsigned long pwd_reg; 141 unsigned long pwd_reg;
143 142
144 spinlock_t lock; 143 spinlock_t lock;
@@ -245,10 +244,8 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
245 case OPTi9XX_HW_82C931: 244 case OPTi9XX_HW_82C931:
246 case OPTi9XX_HW_82C933: 245 case OPTi9XX_HW_82C933:
247 chip->mc_base = (hardware == OPTi9XX_HW_82C930) ? 0xf8f : 0xf8d; 246 chip->mc_base = (hardware == OPTi9XX_HW_82C930) ? 0xf8f : 0xf8d;
248 if (!chip->mc_indir_index) { 247 if (!chip->mc_indir_index)
249 chip->mc_indir_index = 0xe0e; 248 chip->mc_indir_index = 0xe0e;
250 chip->mc_indir_size = 2;
251 }
252 chip->password = 0xe4; 249 chip->password = 0xe4;
253 chip->pwd_reg = 0; 250 chip->pwd_reg = 0;
254 break; 251 break;
@@ -351,7 +348,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg,
351 (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask))) 348 (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask)))
352 349
353 350
354static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, 351static int snd_opti9xx_configure(struct snd_opti9xx *chip,
355 long port, 352 long port,
356 int irq, int dma1, int dma2, 353 int irq, int dma1, int dma2,
357 long mpu_port, int mpu_irq) 354 long mpu_port, int mpu_irq)
@@ -403,7 +400,9 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
403 400
404#else /* OPTi93X */ 401#else /* OPTi93X */
405 case OPTi9XX_HW_82C931: 402 case OPTi9XX_HW_82C931:
406 case OPTi9XX_HW_82C933: 403 /* disable 3D sound (set GPIO1 as output, low) */
404 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(20), 0x04, 0x0c);
405 case OPTi9XX_HW_82C933: /* FALL THROUGH */
407 /* 406 /*
408 * The BTC 1817DW has QS1000 wavetable which is connected 407 * The BTC 1817DW has QS1000 wavetable which is connected
409 * to the serial digital input of the OPTI931. 408 * to the serial digital input of the OPTI931.
@@ -696,8 +695,7 @@ static int __devinit snd_opti9xx_read_check(struct snd_opti9xx *chip)
696 if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1))) 695 if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1)))
697 return 0; 696 return 0;
698#else /* OPTi93X */ 697#else /* OPTi93X */
699 chip->res_mc_indir = request_region(chip->mc_indir_index, 698 chip->res_mc_indir = request_region(chip->mc_indir_index, 2,
700 chip->mc_indir_size,
701 "OPTi93x MC"); 699 "OPTi93x MC");
702 if (chip->res_mc_indir == NULL) 700 if (chip->res_mc_indir == NULL)
703 return -EBUSY; 701 return -EBUSY;
@@ -770,8 +768,9 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
770#ifdef OPTi93X 768#ifdef OPTi93X
771 port = pnp_port_start(pdev, 0) - 4; 769 port = pnp_port_start(pdev, 0) - 4;
772 fm_port = pnp_port_start(pdev, 1) + 8; 770 fm_port = pnp_port_start(pdev, 1) + 8;
773 chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; 771 /* adjust mc_indir_index - some cards report it at 0xe?d,
774 chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; 772 other at 0xe?c but it really is always at 0xe?e */
773 chip->mc_indir_index = (pnp_port_start(pdev, 3) & ~0xf) | 0xe;
775#else 774#else
776 devmc = pnp_request_card_device(card, pid->devs[2].id, NULL); 775 devmc = pnp_request_card_device(card, pid->devs[2].id, NULL);
777 if (devmc == NULL) 776 if (devmc == NULL)
@@ -871,9 +870,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
871 &codec); 870 &codec);
872 if (error < 0) 871 if (error < 0)
873 return error; 872 return error;
874#ifdef OPTi93X
875 chip->codec = codec; 873 chip->codec = codec;
876#endif
877 error = snd_wss_pcm(codec, 0, &pcm); 874 error = snd_wss_pcm(codec, 0, &pcm);
878 if (error < 0) 875 if (error < 0)
879 return error; 876 return error;
@@ -1054,11 +1051,55 @@ static int __devexit snd_opti9xx_isa_remove(struct device *devptr,
1054 return 0; 1051 return 0;
1055} 1052}
1056 1053
1054#ifdef CONFIG_PM
1055static int snd_opti9xx_suspend(struct snd_card *card)
1056{
1057 struct snd_opti9xx *chip = card->private_data;
1058
1059 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
1060 chip->codec->suspend(chip->codec);
1061 return 0;
1062}
1063
1064static int snd_opti9xx_resume(struct snd_card *card)
1065{
1066 struct snd_opti9xx *chip = card->private_data;
1067 int error, xdma2;
1068#if defined(CS4231) || defined(OPTi93X)
1069 xdma2 = dma2;
1070#else
1071 xdma2 = -1;
1072#endif
1073
1074 error = snd_opti9xx_configure(chip, port, irq, dma1, xdma2,
1075 mpu_port, mpu_irq);
1076 if (error)
1077 return error;
1078 chip->codec->resume(chip->codec);
1079 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
1080 return 0;
1081}
1082
1083static int snd_opti9xx_isa_suspend(struct device *dev, unsigned int n,
1084 pm_message_t state)
1085{
1086 return snd_opti9xx_suspend(dev_get_drvdata(dev));
1087}
1088
1089static int snd_opti9xx_isa_resume(struct device *dev, unsigned int n)
1090{
1091 return snd_opti9xx_resume(dev_get_drvdata(dev));
1092}
1093#endif
1094
1057static struct isa_driver snd_opti9xx_driver = { 1095static struct isa_driver snd_opti9xx_driver = {
1058 .match = snd_opti9xx_isa_match, 1096 .match = snd_opti9xx_isa_match,
1059 .probe = snd_opti9xx_isa_probe, 1097 .probe = snd_opti9xx_isa_probe,
1060 .remove = __devexit_p(snd_opti9xx_isa_remove), 1098 .remove = __devexit_p(snd_opti9xx_isa_remove),
1061 /* FIXME: suspend/resume */ 1099#ifdef CONFIG_PM
1100 .suspend = snd_opti9xx_isa_suspend,
1101 .resume = snd_opti9xx_isa_resume,
1102#endif
1062 .driver = { 1103 .driver = {
1063 .name = DEV_NAME 1104 .name = DEV_NAME
1064 }, 1105 },
@@ -1124,12 +1165,29 @@ static void __devexit snd_opti9xx_pnp_remove(struct pnp_card_link * pcard)
1124 snd_opti9xx_pnp_is_probed = 0; 1165 snd_opti9xx_pnp_is_probed = 0;
1125} 1166}
1126 1167
1168#ifdef CONFIG_PM
1169static int snd_opti9xx_pnp_suspend(struct pnp_card_link *pcard,
1170 pm_message_t state)
1171{
1172 return snd_opti9xx_suspend(pnp_get_card_drvdata(pcard));
1173}
1174
1175static int snd_opti9xx_pnp_resume(struct pnp_card_link *pcard)
1176{
1177 return snd_opti9xx_resume(pnp_get_card_drvdata(pcard));
1178}
1179#endif
1180
1127static struct pnp_card_driver opti9xx_pnpc_driver = { 1181static struct pnp_card_driver opti9xx_pnpc_driver = {
1128 .flags = PNP_DRIVER_RES_DISABLE, 1182 .flags = PNP_DRIVER_RES_DISABLE,
1129 .name = "opti9xx", 1183 .name = "opti9xx",
1130 .id_table = snd_opti9xx_pnpids, 1184 .id_table = snd_opti9xx_pnpids,
1131 .probe = snd_opti9xx_pnp_probe, 1185 .probe = snd_opti9xx_pnp_probe,
1132 .remove = __devexit_p(snd_opti9xx_pnp_remove), 1186 .remove = __devexit_p(snd_opti9xx_pnp_remove),
1187#ifdef CONFIG_PM
1188 .suspend = snd_opti9xx_pnp_suspend,
1189 .resume = snd_opti9xx_pnp_resume,
1190#endif
1133}; 1191};
1134#endif 1192#endif
1135 1193