diff options
Diffstat (limited to 'sound/arm')
-rw-r--r-- | sound/arm/sa11xx-uda1341.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c index 6ee912259cc5..97dffcc3f75f 100644 --- a/sound/arm/sa11xx-uda1341.c +++ b/sound/arm/sa11xx-uda1341.c | |||
@@ -21,7 +21,7 @@ | |||
21 | * merged HAL layer (patches from Brian) | 21 | * merged HAL layer (patches from Brian) |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* $Id: sa11xx-uda1341.c,v 1.23 2005/09/09 13:22:34 tiwai Exp $ */ | 24 | /* $Id: sa11xx-uda1341.c,v 1.24 2005/11/17 10:25:22 tiwai Exp $ */ |
25 | 25 | ||
26 | /*************************************************************************************************** | 26 | /*************************************************************************************************** |
27 | * | 27 | * |
@@ -141,8 +141,6 @@ typedef struct snd_card_sa11xx_uda1341 { | |||
141 | audio_stream_t s[2]; /* playback & capture */ | 141 | audio_stream_t s[2]; /* playback & capture */ |
142 | } sa11xx_uda1341_t; | 142 | } sa11xx_uda1341_t; |
143 | 143 | ||
144 | static struct snd_card_sa11xx_uda1341 *sa11xx_uda1341 = NULL; | ||
145 | |||
146 | static unsigned int rates[] = { | 144 | static unsigned int rates[] = { |
147 | 8000, 10666, 10985, 14647, | 145 | 8000, 10666, 10985, 14647, |
148 | 16000, 21970, 22050, 24000, | 146 | 16000, 21970, 22050, 24000, |
@@ -411,8 +409,8 @@ static int audio_dma_request(audio_stream_t *s, void (*callback)(void *)) | |||
411 | 409 | ||
412 | static void audio_dma_free(audio_stream_t *s) | 410 | static void audio_dma_free(audio_stream_t *s) |
413 | { | 411 | { |
414 | sa1100_free_dma((s)->dma_regs); | 412 | sa1100_free_dma(s->dma_regs); |
415 | (s)->dma_regs = 0; | 413 | s->dma_regs = 0; |
416 | } | 414 | } |
417 | 415 | ||
418 | #endif | 416 | #endif |
@@ -835,8 +833,8 @@ static int __init snd_card_sa11xx_uda1341_pcm(sa11xx_uda1341_t *sa11xx_uda1341, | |||
835 | * isa works but I'm not sure why (or if) it's the right choice | 833 | * isa works but I'm not sure why (or if) it's the right choice |
836 | * this may be too large, trying it for now | 834 | * this may be too large, trying it for now |
837 | */ | 835 | */ |
838 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_ISA, | 836 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
839 | snd_pcm_dma_flags(0), | 837 | snd_dma_isa_data(), |
840 | 64*1024, 64*1024); | 838 | 64*1024, 64*1024); |
841 | 839 | ||
842 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_sa11xx_uda1341_playback_ops); | 840 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_sa11xx_uda1341_playback_ops); |
@@ -900,15 +898,15 @@ void snd_sa11xx_uda1341_free(snd_card_t *card) | |||
900 | 898 | ||
901 | audio_dma_free(&chip->s[SNDRV_PCM_STREAM_PLAYBACK]); | 899 | audio_dma_free(&chip->s[SNDRV_PCM_STREAM_PLAYBACK]); |
902 | audio_dma_free(&chip->s[SNDRV_PCM_STREAM_CAPTURE]); | 900 | audio_dma_free(&chip->s[SNDRV_PCM_STREAM_CAPTURE]); |
903 | sa11xx_uda1341 = NULL; | ||
904 | card->private_data = NULL; | ||
905 | kfree(chip); | ||
906 | } | 901 | } |
907 | 902 | ||
903 | static snd_card_t *sa11xx_uda1341_card; | ||
904 | |||
908 | static int __init sa11xx_uda1341_init(void) | 905 | static int __init sa11xx_uda1341_init(void) |
909 | { | 906 | { |
910 | int err; | 907 | int err; |
911 | snd_card_t *card; | 908 | snd_card_t *card; |
909 | sa11xx_uda1341_t *chip; | ||
912 | 910 | ||
913 | if (!machine_is_h3xxx()) | 911 | if (!machine_is_h3xxx()) |
914 | return -ENODEV; | 912 | return -ENODEV; |
@@ -921,26 +919,25 @@ static int __init sa11xx_uda1341_init(void) | |||
921 | sa11xx_uda1341 = kzalloc(sizeof(*sa11xx_uda1341), GFP_KERNEL); | 919 | sa11xx_uda1341 = kzalloc(sizeof(*sa11xx_uda1341), GFP_KERNEL); |
922 | if (sa11xx_uda1341 == NULL) | 920 | if (sa11xx_uda1341 == NULL) |
923 | return -ENOMEM; | 921 | return -ENOMEM; |
922 | card->private_free = snd_sa11xx_uda1341_free; | ||
923 | chip = card->private_data; | ||
924 | spin_lock_init(&chip->s[0].dma_lock); | 924 | spin_lock_init(&chip->s[0].dma_lock); |
925 | spin_lock_init(&chip->s[1].dma_lock); | 925 | spin_lock_init(&chip->s[1].dma_lock); |
926 | 926 | ||
927 | card->private_data = (void *)sa11xx_uda1341; | 927 | chip->card = card; |
928 | card->private_free = snd_sa11xx_uda1341_free; | 928 | chip->samplerate = AUDIO_RATE_DEFAULT; |
929 | |||
930 | sa11xx_uda1341->card = card; | ||
931 | sa11xx_uda1341->samplerate = AUDIO_RATE_DEFAULT; | ||
932 | 929 | ||
933 | // mixer | 930 | // mixer |
934 | if ((err = snd_chip_uda1341_mixer_new(sa11xx_uda1341->card, &sa11xx_uda1341->uda1341))) | 931 | if ((err = snd_chip_uda1341_mixer_new(chip->card, &sa11xx_uda1341->uda1341))) |
935 | goto nodev; | 932 | goto nodev; |
936 | 933 | ||
937 | // PCM | 934 | // PCM |
938 | if ((err = snd_card_sa11xx_uda1341_pcm(sa11xx_uda1341, 0)) < 0) | 935 | if ((err = snd_card_sa11xx_uda1341_pcm(chip, 0)) < 0) |
939 | goto nodev; | 936 | goto nodev; |
940 | 937 | ||
941 | snd_card_set_generic_pm_callback(card, | 938 | snd_card_set_generic_pm_callback(card, |
942 | snd_sa11xx_uda1341_suspend, snd_sa11_uda1341_resume, | 939 | snd_sa11xx_uda1341_suspend, snd_sa11_uda1341_resume, |
943 | sa11xx_uda1341); | 940 | chip); |
944 | 941 | ||
945 | strcpy(card->driver, "UDA1341"); | 942 | strcpy(card->driver, "UDA1341"); |
946 | strcpy(card->shortname, "H3600 UDA1341TS"); | 943 | strcpy(card->shortname, "H3600 UDA1341TS"); |
@@ -951,6 +948,7 @@ static int __init sa11xx_uda1341_init(void) | |||
951 | 948 | ||
952 | if ((err = snd_card_register(card)) == 0) { | 949 | if ((err = snd_card_register(card)) == 0) { |
953 | printk( KERN_INFO "iPAQ audio support initialized\n" ); | 950 | printk( KERN_INFO "iPAQ audio support initialized\n" ); |
951 | sa11xx_uda1341_card = card; | ||
954 | return 0; | 952 | return 0; |
955 | } | 953 | } |
956 | 954 | ||
@@ -961,7 +959,7 @@ static int __init sa11xx_uda1341_init(void) | |||
961 | 959 | ||
962 | static void __exit sa11xx_uda1341_exit(void) | 960 | static void __exit sa11xx_uda1341_exit(void) |
963 | { | 961 | { |
964 | snd_card_free(sa11xx_uda1341->card); | 962 | snd_card_free(sa11xx_uda1341_card); |
965 | } | 963 | } |
966 | 964 | ||
967 | module_init(sa11xx_uda1341_init); | 965 | module_init(sa11xx_uda1341_init); |