aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/trident/trident_main.c
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /sound/pci/trident/trident_main.c
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'sound/pci/trident/trident_main.c')
-rw-r--r--sound/pci/trident/trident_main.c67
1 files changed, 31 insertions, 36 deletions
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index fb0e1586a6f..5bd57a7c52d 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -35,13 +35,12 @@
35#include <linux/vmalloc.h> 35#include <linux/vmalloc.h>
36#include <linux/gameport.h> 36#include <linux/gameport.h>
37#include <linux/dma-mapping.h> 37#include <linux/dma-mapping.h>
38#include <linux/export.h>
39 38
40#include <sound/core.h> 39#include <sound/core.h>
41#include <sound/info.h> 40#include <sound/info.h>
42#include <sound/control.h> 41#include <sound/control.h>
43#include <sound/tlv.h> 42#include <sound/tlv.h>
44#include "trident.h" 43#include <sound/trident.h>
45#include <sound/asoundef.h> 44#include <sound/asoundef.h>
46 45
47#include <asm/io.h> 46#include <asm/io.h>
@@ -2171,8 +2170,8 @@ static struct snd_pcm_ops snd_trident_spdif_7018_ops = {
2171 2170
2172 ---------------------------------------------------------------------------*/ 2171 ---------------------------------------------------------------------------*/
2173 2172
2174int snd_trident_pcm(struct snd_trident *trident, 2173int __devinit snd_trident_pcm(struct snd_trident * trident,
2175 int device, struct snd_pcm **rpcm) 2174 int device, struct snd_pcm ** rpcm)
2176{ 2175{
2177 struct snd_pcm *pcm; 2176 struct snd_pcm *pcm;
2178 int err; 2177 int err;
@@ -2229,8 +2228,8 @@ int snd_trident_pcm(struct snd_trident *trident,
2229 2228
2230 ---------------------------------------------------------------------------*/ 2229 ---------------------------------------------------------------------------*/
2231 2230
2232int snd_trident_foldback_pcm(struct snd_trident *trident, 2231int __devinit snd_trident_foldback_pcm(struct snd_trident * trident,
2233 int device, struct snd_pcm **rpcm) 2232 int device, struct snd_pcm ** rpcm)
2234{ 2233{
2235 struct snd_pcm *foldback; 2234 struct snd_pcm *foldback;
2236 int err; 2235 int err;
@@ -2286,8 +2285,8 @@ int snd_trident_foldback_pcm(struct snd_trident *trident,
2286 2285
2287 ---------------------------------------------------------------------------*/ 2286 ---------------------------------------------------------------------------*/
2288 2287
2289int snd_trident_spdif_pcm(struct snd_trident *trident, 2288int __devinit snd_trident_spdif_pcm(struct snd_trident * trident,
2290 int device, struct snd_pcm **rpcm) 2289 int device, struct snd_pcm ** rpcm)
2291{ 2290{
2292 struct snd_pcm *spdif; 2291 struct snd_pcm *spdif;
2293 int err; 2292 int err;
@@ -2371,7 +2370,7 @@ static int snd_trident_spdif_control_put(struct snd_kcontrol *kcontrol,
2371 return change; 2370 return change;
2372} 2371}
2373 2372
2374static struct snd_kcontrol_new snd_trident_spdif_control = 2373static struct snd_kcontrol_new snd_trident_spdif_control __devinitdata =
2375{ 2374{
2376 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2375 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2377 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 2376 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH),
@@ -2434,7 +2433,7 @@ static int snd_trident_spdif_default_put(struct snd_kcontrol *kcontrol,
2434 return change; 2433 return change;
2435} 2434}
2436 2435
2437static struct snd_kcontrol_new snd_trident_spdif_default = 2436static struct snd_kcontrol_new snd_trident_spdif_default __devinitdata =
2438{ 2437{
2439 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2438 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
2440 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), 2439 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
@@ -2467,7 +2466,7 @@ static int snd_trident_spdif_mask_get(struct snd_kcontrol *kcontrol,
2467 return 0; 2466 return 0;
2468} 2467}
2469 2468
2470static struct snd_kcontrol_new snd_trident_spdif_mask = 2469static struct snd_kcontrol_new snd_trident_spdif_mask __devinitdata =
2471{ 2470{
2472 .access = SNDRV_CTL_ELEM_ACCESS_READ, 2471 .access = SNDRV_CTL_ELEM_ACCESS_READ,
2473 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2472 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -2529,7 +2528,7 @@ static int snd_trident_spdif_stream_put(struct snd_kcontrol *kcontrol,
2529 return change; 2528 return change;
2530} 2529}
2531 2530
2532static struct snd_kcontrol_new snd_trident_spdif_stream = 2531static struct snd_kcontrol_new snd_trident_spdif_stream __devinitdata =
2533{ 2532{
2534 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, 2533 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
2535 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2534 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -2579,7 +2578,7 @@ static int snd_trident_ac97_control_put(struct snd_kcontrol *kcontrol,
2579 return change; 2578 return change;
2580} 2579}
2581 2580
2582static struct snd_kcontrol_new snd_trident_ac97_rear_control = 2581static struct snd_kcontrol_new snd_trident_ac97_rear_control __devinitdata =
2583{ 2582{
2584 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2583 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2585 .name = "Rear Path", 2584 .name = "Rear Path",
@@ -2637,7 +2636,7 @@ static int snd_trident_vol_control_put(struct snd_kcontrol *kcontrol,
2637 return change; 2636 return change;
2638} 2637}
2639 2638
2640static struct snd_kcontrol_new snd_trident_vol_music_control = 2639static struct snd_kcontrol_new snd_trident_vol_music_control __devinitdata =
2641{ 2640{
2642 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2641 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2643 .name = "Music Playback Volume", 2642 .name = "Music Playback Volume",
@@ -2648,7 +2647,7 @@ static struct snd_kcontrol_new snd_trident_vol_music_control =
2648 .tlv = { .p = db_scale_gvol }, 2647 .tlv = { .p = db_scale_gvol },
2649}; 2648};
2650 2649
2651static struct snd_kcontrol_new snd_trident_vol_wave_control = 2650static struct snd_kcontrol_new snd_trident_vol_wave_control __devinitdata =
2652{ 2651{
2653 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2652 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2654 .name = "Wave Playback Volume", 2653 .name = "Wave Playback Volume",
@@ -2715,7 +2714,7 @@ static int snd_trident_pcm_vol_control_put(struct snd_kcontrol *kcontrol,
2715 return change; 2714 return change;
2716} 2715}
2717 2716
2718static struct snd_kcontrol_new snd_trident_pcm_vol_control = 2717static struct snd_kcontrol_new snd_trident_pcm_vol_control __devinitdata =
2719{ 2718{
2720 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2719 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2721 .name = "PCM Front Playback Volume", 2720 .name = "PCM Front Playback Volume",
@@ -2779,7 +2778,7 @@ static int snd_trident_pcm_pan_control_put(struct snd_kcontrol *kcontrol,
2779 return change; 2778 return change;
2780} 2779}
2781 2780
2782static struct snd_kcontrol_new snd_trident_pcm_pan_control = 2781static struct snd_kcontrol_new snd_trident_pcm_pan_control __devinitdata =
2783{ 2782{
2784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2783 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2785 .name = "PCM Pan Playback Control", 2784 .name = "PCM Pan Playback Control",
@@ -2836,7 +2835,7 @@ static int snd_trident_pcm_rvol_control_put(struct snd_kcontrol *kcontrol,
2836 2835
2837static const DECLARE_TLV_DB_SCALE(db_scale_crvol, -3175, 25, 1); 2836static const DECLARE_TLV_DB_SCALE(db_scale_crvol, -3175, 25, 1);
2838 2837
2839static struct snd_kcontrol_new snd_trident_pcm_rvol_control = 2838static struct snd_kcontrol_new snd_trident_pcm_rvol_control __devinitdata =
2840{ 2839{
2841 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2840 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2842 .name = "PCM Reverb Playback Volume", 2841 .name = "PCM Reverb Playback Volume",
@@ -2892,7 +2891,7 @@ static int snd_trident_pcm_cvol_control_put(struct snd_kcontrol *kcontrol,
2892 return change; 2891 return change;
2893} 2892}
2894 2893
2895static struct snd_kcontrol_new snd_trident_pcm_cvol_control = 2894static struct snd_kcontrol_new snd_trident_pcm_cvol_control __devinitdata =
2896{ 2895{
2897 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2896 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2898 .name = "PCM Chorus Playback Volume", 2897 .name = "PCM Chorus Playback Volume",
@@ -2972,7 +2971,7 @@ static int snd_trident_pcm_mixer_free(struct snd_trident *trident, struct snd_tr
2972 2971
2973 ---------------------------------------------------------------------------*/ 2972 ---------------------------------------------------------------------------*/
2974 2973
2975static int snd_trident_mixer(struct snd_trident *trident, int pcm_spdif_device) 2974static int __devinit snd_trident_mixer(struct snd_trident * trident, int pcm_spdif_device)
2976{ 2975{
2977 struct snd_ac97_template _ac97; 2976 struct snd_ac97_template _ac97;
2978 struct snd_card *card = trident->card; 2977 struct snd_card *card = trident->card;
@@ -3191,7 +3190,7 @@ static int snd_trident_gameport_open(struct gameport *gameport, int mode)
3191 } 3190 }
3192} 3191}
3193 3192
3194int snd_trident_create_gameport(struct snd_trident *chip) 3193int __devinit snd_trident_create_gameport(struct snd_trident *chip)
3195{ 3194{
3196 struct gameport *gp; 3195 struct gameport *gp;
3197 3196
@@ -3225,7 +3224,7 @@ static inline void snd_trident_free_gameport(struct snd_trident *chip)
3225 } 3224 }
3226} 3225}
3227#else 3226#else
3228int snd_trident_create_gameport(struct snd_trident *chip) { return -ENOSYS; } 3227int __devinit snd_trident_create_gameport(struct snd_trident *chip) { return -ENOSYS; }
3229static inline void snd_trident_free_gameport(struct snd_trident *chip) { } 3228static inline void snd_trident_free_gameport(struct snd_trident *chip) { }
3230#endif /* CONFIG_GAMEPORT */ 3229#endif /* CONFIG_GAMEPORT */
3231 3230
@@ -3329,7 +3328,7 @@ static void snd_trident_proc_read(struct snd_info_entry *entry,
3329 } 3328 }
3330} 3329}
3331 3330
3332static void snd_trident_proc_init(struct snd_trident *trident) 3331static void __devinit snd_trident_proc_init(struct snd_trident * trident)
3333{ 3332{
3334 struct snd_info_entry *entry; 3333 struct snd_info_entry *entry;
3335 const char *s = "trident"; 3334 const char *s = "trident";
@@ -3358,7 +3357,7 @@ static int snd_trident_dev_free(struct snd_device *device)
3358 3357
3359 ---------------------------------------------------------------------------*/ 3358 ---------------------------------------------------------------------------*/
3360 3359
3361static int snd_trident_tlb_alloc(struct snd_trident *trident) 3360static int __devinit snd_trident_tlb_alloc(struct snd_trident *trident)
3362{ 3361{
3363 int i; 3362 int i;
3364 3363
@@ -3539,7 +3538,7 @@ static int snd_trident_sis_init(struct snd_trident *trident)
3539 3538
3540 ---------------------------------------------------------------------------*/ 3539 ---------------------------------------------------------------------------*/
3541 3540
3542int snd_trident_create(struct snd_card *card, 3541int __devinit snd_trident_create(struct snd_card *card,
3543 struct pci_dev *pci, 3542 struct pci_dev *pci,
3544 int pcm_streams, 3543 int pcm_streams,
3545 int pcm_spdif_device, 3544 int pcm_spdif_device,
@@ -3919,11 +3918,10 @@ static void snd_trident_clear_voices(struct snd_trident * trident, unsigned shor
3919 } 3918 }
3920} 3919}
3921 3920
3922#ifdef CONFIG_PM_SLEEP 3921#ifdef CONFIG_PM
3923static int snd_trident_suspend(struct device *dev) 3922int snd_trident_suspend(struct pci_dev *pci, pm_message_t state)
3924{ 3923{
3925 struct pci_dev *pci = to_pci_dev(dev); 3924 struct snd_card *card = pci_get_drvdata(pci);
3926 struct snd_card *card = dev_get_drvdata(dev);
3927 struct snd_trident *trident = card->private_data; 3925 struct snd_trident *trident = card->private_data;
3928 3926
3929 trident->in_suspend = 1; 3927 trident->in_suspend = 1;
@@ -3937,14 +3935,13 @@ static int snd_trident_suspend(struct device *dev)
3937 3935
3938 pci_disable_device(pci); 3936 pci_disable_device(pci);
3939 pci_save_state(pci); 3937 pci_save_state(pci);
3940 pci_set_power_state(pci, PCI_D3hot); 3938 pci_set_power_state(pci, pci_choose_state(pci, state));
3941 return 0; 3939 return 0;
3942} 3940}
3943 3941
3944static int snd_trident_resume(struct device *dev) 3942int snd_trident_resume(struct pci_dev *pci)
3945{ 3943{
3946 struct pci_dev *pci = to_pci_dev(dev); 3944 struct snd_card *card = pci_get_drvdata(pci);
3947 struct snd_card *card = dev_get_drvdata(dev);
3948 struct snd_trident *trident = card->private_data; 3945 struct snd_trident *trident = card->private_data;
3949 3946
3950 pci_set_power_state(pci, PCI_D0); 3947 pci_set_power_state(pci, PCI_D0);
@@ -3981,6 +3978,4 @@ static int snd_trident_resume(struct device *dev)
3981 trident->in_suspend = 0; 3978 trident->in_suspend = 0;
3982 return 0; 3979 return 0;
3983} 3980}
3984 3981#endif /* CONFIG_PM */
3985SIMPLE_DEV_PM_OPS(snd_trident_pm, snd_trident_suspend, snd_trident_resume);
3986#endif /* CONFIG_PM_SLEEP */