aboutsummaryrefslogtreecommitdiffstats
path: root/sound/arm/sa11xx-uda1341.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 09:10:58 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:20:04 -0500
commitaf0fbfb58dbb2081ae91789892933321ee95d71f (patch)
tree16ba6aaffb6e6319f652d30db40fd9ed61ac1cfd /sound/arm/sa11xx-uda1341.c
parentd18f83764e376dea9e14a8ac53d1e14004fa9c13 (diff)
[ALSA] Remove xxx_t typedefs: ARM SA11xx-UDA1341
Modules: SA11xx UDA1341 driver Remove xxx_t typedefs from the ARM SA11xx-UDA1341 driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/arm/sa11xx-uda1341.c')
-rw-r--r--sound/arm/sa11xx-uda1341.c125
1 files changed, 61 insertions, 64 deletions
diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c
index 97dffcc3f75f..785726e627d0 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.24 2005/11/17 10:25:22 tiwai Exp $ */ 24/* $Id: sa11xx-uda1341.c,v 1.25 2005/11/17 15:10:58 tiwai Exp $ */
25 25
26/*************************************************************************************************** 26/***************************************************************************************************
27* 27*
@@ -115,7 +115,7 @@ static char *id = NULL; /* ID for this card */
115module_param(id, charp, 0444); 115module_param(id, charp, 0444);
116MODULE_PARM_DESC(id, "ID string for SA1100/SA1111 + UDA1341TS soundcard."); 116MODULE_PARM_DESC(id, "ID string for SA1100/SA1111 + UDA1341TS soundcard.");
117 117
118typedef struct audio_stream { 118struct audio_stream {
119 char *id; /* identification string */ 119 char *id; /* identification string */
120 int stream_id; /* numeric identification */ 120 int stream_id; /* numeric identification */
121 dma_device_t dma_dev; /* device identifier for DMA */ 121 dma_device_t dma_dev; /* device identifier for DMA */
@@ -130,16 +130,16 @@ typedef struct audio_stream {
130 int tx_spin; /* are we recoding - flag used to do DMA trans. for sync */ 130 int tx_spin; /* are we recoding - flag used to do DMA trans. for sync */
131 unsigned int old_offset; 131 unsigned int old_offset;
132 spinlock_t dma_lock; /* for locking in DMA operations (see dma-sa1100.c in the kernel) */ 132 spinlock_t dma_lock; /* for locking in DMA operations (see dma-sa1100.c in the kernel) */
133 snd_pcm_substream_t *stream; 133 struct snd_pcm_substream *stream;
134}audio_stream_t; 134};
135 135
136typedef struct snd_card_sa11xx_uda1341 { 136struct sa11xx_uda1341 {
137 snd_card_t *card; 137 struct snd_card *card;
138 struct l3_client *uda1341; 138 struct l3_client *uda1341;
139 snd_pcm_t *pcm; 139 struct snd_pcm *pcm;
140 long samplerate; 140 long samplerate;
141 audio_stream_t s[2]; /* playback & capture */ 141 struct audio_stream s[2]; /* playback & capture */
142} sa11xx_uda1341_t; 142};
143 143
144static unsigned int rates[] = { 144static unsigned int rates[] = {
145 8000, 10666, 10985, 14647, 145 8000, 10666, 10985, 14647,
@@ -147,7 +147,7 @@ static unsigned int rates[] = {
147 29400, 32000, 44100, 48000, 147 29400, 32000, 44100, 48000,
148}; 148};
149 149
150static snd_pcm_hw_constraint_list_t hw_constraints_rates = { 150static struct snd_pcm_hw_constraint_list hw_constraints_rates = {
151 .count = ARRAY_SIZE(rates), 151 .count = ARRAY_SIZE(rates),
152 .list = rates, 152 .list = rates,
153 .mask = 0, 153 .mask = 0,
@@ -193,7 +193,7 @@ static void sa11xx_uda1341_set_audio_clock(long val)
193 } 193 }
194} 194}
195 195
196static void sa11xx_uda1341_set_samplerate(sa11xx_uda1341_t *sa11xx_uda1341, long rate) 196static void sa11xx_uda1341_set_samplerate(struct sa11xx_uda1341 *sa11xx_uda1341, long rate)
197{ 197{
198 int clk_div = 0; 198 int clk_div = 0;
199 int clk=0; 199 int clk=0;
@@ -278,7 +278,7 @@ static void sa11xx_uda1341_set_samplerate(sa11xx_uda1341_t *sa11xx_uda1341, long
278 278
279/* {{{ HW init and shutdown */ 279/* {{{ HW init and shutdown */
280 280
281static void sa11xx_uda1341_audio_init(sa11xx_uda1341_t *sa11xx_uda1341) 281static void sa11xx_uda1341_audio_init(struct sa11xx_uda1341 *sa11xx_uda1341)
282{ 282{
283 unsigned long flags; 283 unsigned long flags;
284 284
@@ -335,7 +335,7 @@ static void sa11xx_uda1341_audio_init(sa11xx_uda1341_t *sa11xx_uda1341)
335#endif 335#endif
336} 336}
337 337
338static void sa11xx_uda1341_audio_shutdown(sa11xx_uda1341_t *sa11xx_uda1341) 338static void sa11xx_uda1341_audio_shutdown(struct sa11xx_uda1341 *sa11xx_uda1341)
339{ 339{
340 /* mute on */ 340 /* mute on */
341#ifdef CONFIG_H3600_HAL 341#ifdef CONFIG_H3600_HAL
@@ -376,7 +376,7 @@ static void sa11xx_uda1341_audio_shutdown(sa11xx_uda1341_t *sa11xx_uda1341)
376 376
377#ifdef HH_VERSION 377#ifdef HH_VERSION
378 378
379static int audio_dma_request(audio_stream_t *s, void (*callback)(void *, int)) 379static int audio_dma_request(struct audio_stream *s, void (*callback)(void *, int))
380{ 380{
381 int ret; 381 int ret;
382 382
@@ -389,7 +389,7 @@ static int audio_dma_request(audio_stream_t *s, void (*callback)(void *, int))
389 return 0; 389 return 0;
390} 390}
391 391
392static inline void audio_dma_free(audio_stream_t *s) 392static inline void audio_dma_free(struct audio_stream *s)
393{ 393{
394 sa1100_free_dma(s->dmach); 394 sa1100_free_dma(s->dmach);
395 s->dmach = -1; 395 s->dmach = -1;
@@ -397,7 +397,7 @@ static inline void audio_dma_free(audio_stream_t *s)
397 397
398#else 398#else
399 399
400static int audio_dma_request(audio_stream_t *s, void (*callback)(void *)) 400static int audio_dma_request(struct audio_stream *s, void (*callback)(void *))
401{ 401{
402 int ret; 402 int ret;
403 403
@@ -407,7 +407,7 @@ static int audio_dma_request(audio_stream_t *s, void (*callback)(void *))
407 return ret; 407 return ret;
408} 408}
409 409
410static void audio_dma_free(audio_stream_t *s) 410static void audio_dma_free(struct audio_stream *s)
411{ 411{
412 sa1100_free_dma(s->dma_regs); 412 sa1100_free_dma(s->dma_regs);
413 s->dma_regs = 0; 413 s->dma_regs = 0;
@@ -415,10 +415,10 @@ static void audio_dma_free(audio_stream_t *s)
415 415
416#endif 416#endif
417 417
418static u_int audio_get_dma_pos(audio_stream_t *s) 418static u_int audio_get_dma_pos(struct audio_stream *s)
419{ 419{
420 snd_pcm_substream_t * substream = s->stream; 420 struct snd_pcm_substream *substream = s->stream;
421 snd_pcm_runtime_t *runtime = substream->runtime; 421 struct snd_pcm_runtime *runtime = substream->runtime;
422 unsigned int offset; 422 unsigned int offset;
423 unsigned long flags; 423 unsigned long flags;
424 dma_addr_t addr; 424 dma_addr_t addr;
@@ -443,7 +443,7 @@ static u_int audio_get_dma_pos(audio_stream_t *s)
443/* 443/*
444 * this stops the dma and clears the dma ptrs 444 * this stops the dma and clears the dma ptrs
445 */ 445 */
446static void audio_stop_dma(audio_stream_t *s) 446static void audio_stop_dma(struct audio_stream *s)
447{ 447{
448 unsigned long flags; 448 unsigned long flags;
449 449
@@ -459,10 +459,10 @@ static void audio_stop_dma(audio_stream_t *s)
459 spin_unlock_irqrestore(&s->dma_lock, flags); 459 spin_unlock_irqrestore(&s->dma_lock, flags);
460} 460}
461 461
462static void audio_process_dma(audio_stream_t *s) 462static void audio_process_dma(struct audio_stream *s)
463{ 463{
464 snd_pcm_substream_t *substream = s->stream; 464 struct snd_pcm_substream *substream = s->stream;
465 snd_pcm_runtime_t *runtime; 465 struct snd_pcm_runtime *runtime;
466 unsigned int dma_size; 466 unsigned int dma_size;
467 unsigned int offset; 467 unsigned int offset;
468 int ret; 468 int ret;
@@ -525,7 +525,7 @@ static void audio_dma_callback(void *data, int size)
525static void audio_dma_callback(void *data) 525static void audio_dma_callback(void *data)
526#endif 526#endif
527{ 527{
528 audio_stream_t *s = data; 528 struct audio_stream *s = data;
529 529
530 /* 530 /*
531 * If we are getting a callback for an active stream then we inform 531 * If we are getting a callback for an active stream then we inform
@@ -547,12 +547,12 @@ static void audio_dma_callback(void *data)
547 547
548/* {{{ trigger & timer */ 548/* {{{ trigger & timer */
549 549
550static int snd_sa11xx_uda1341_trigger(snd_pcm_substream_t * substream, int cmd) 550static int snd_sa11xx_uda1341_trigger(struct snd_pcm_substream *substream, int cmd)
551{ 551{
552 sa11xx_uda1341_t *chip = snd_pcm_substream_chip(substream); 552 struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream);
553 int stream_id = substream->pstr->stream; 553 int stream_id = substream->pstr->stream;
554 audio_stream_t *s = &chip->s[stream_id]; 554 struct audio_stream *s = &chip->s[stream_id];
555 audio_stream_t *s1 = &chip->s[stream_id ^ 1]; 555 struct audio_stream *s1 = &chip->s[stream_id ^ 1];
556 int err = 0; 556 int err = 0;
557 557
558 /* note local interrupts are already disabled in the midlevel code */ 558 /* note local interrupts are already disabled in the midlevel code */
@@ -681,11 +681,11 @@ static int snd_sa11xx_uda1341_trigger(snd_pcm_substream_t * substream, int cmd)
681 return err; 681 return err;
682} 682}
683 683
684static int snd_sa11xx_uda1341_prepare(snd_pcm_substream_t * substream) 684static int snd_sa11xx_uda1341_prepare(struct snd_pcm_substream *substream)
685{ 685{
686 sa11xx_uda1341_t *chip = snd_pcm_substream_chip(substream); 686 struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream);
687 snd_pcm_runtime_t *runtime = substream->runtime; 687 struct snd_pcm_runtime *runtime = substream->runtime;
688 audio_stream_t *s = &chip->s[substream->pstr->stream]; 688 struct audio_stream *s = &chip->s[substream->pstr->stream];
689 689
690 /* set requested samplerate */ 690 /* set requested samplerate */
691 sa11xx_uda1341_set_samplerate(chip, runtime->rate); 691 sa11xx_uda1341_set_samplerate(chip, runtime->rate);
@@ -699,15 +699,15 @@ static int snd_sa11xx_uda1341_prepare(snd_pcm_substream_t * substream)
699 return 0; 699 return 0;
700} 700}
701 701
702static snd_pcm_uframes_t snd_sa11xx_uda1341_pointer(snd_pcm_substream_t * substream) 702static snd_pcm_uframes_t snd_sa11xx_uda1341_pointer(struct snd_pcm_substream *substream)
703{ 703{
704 sa11xx_uda1341_t *chip = snd_pcm_substream_chip(substream); 704 struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream);
705 return audio_get_dma_pos(&chip->s[substream->pstr->stream]); 705 return audio_get_dma_pos(&chip->s[substream->pstr->stream]);
706} 706}
707 707
708/* }}} */ 708/* }}} */
709 709
710static snd_pcm_hardware_t snd_sa11xx_uda1341_capture = 710static struct snd_pcm_hardware snd_sa11xx_uda1341_capture =
711{ 711{
712 .info = (SNDRV_PCM_INFO_INTERLEAVED | 712 .info = (SNDRV_PCM_INFO_INTERLEAVED |
713 SNDRV_PCM_INFO_BLOCK_TRANSFER | 713 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -730,7 +730,7 @@ static snd_pcm_hardware_t snd_sa11xx_uda1341_capture =
730 .fifo_size = 0, 730 .fifo_size = 0,
731}; 731};
732 732
733static snd_pcm_hardware_t snd_sa11xx_uda1341_playback = 733static struct snd_pcm_hardware snd_sa11xx_uda1341_playback =
734{ 734{
735 .info = (SNDRV_PCM_INFO_INTERLEAVED | 735 .info = (SNDRV_PCM_INFO_INTERLEAVED |
736 SNDRV_PCM_INFO_BLOCK_TRANSFER | 736 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -753,10 +753,10 @@ static snd_pcm_hardware_t snd_sa11xx_uda1341_playback =
753 .fifo_size = 0, 753 .fifo_size = 0,
754}; 754};
755 755
756static int snd_card_sa11xx_uda1341_open(snd_pcm_substream_t * substream) 756static int snd_card_sa11xx_uda1341_open(struct snd_pcm_substream *substream)
757{ 757{
758 sa11xx_uda1341_t *chip = snd_pcm_substream_chip(substream); 758 struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream);
759 snd_pcm_runtime_t *runtime = substream->runtime; 759 struct snd_pcm_runtime *runtime = substream->runtime;
760 int stream_id = substream->pstr->stream; 760 int stream_id = substream->pstr->stream;
761 int err; 761 int err;
762 762
@@ -774,9 +774,9 @@ static int snd_card_sa11xx_uda1341_open(snd_pcm_substream_t * substream)
774 return 0; 774 return 0;
775} 775}
776 776
777static int snd_card_sa11xx_uda1341_close(snd_pcm_substream_t * substream) 777static int snd_card_sa11xx_uda1341_close(struct snd_pcm_substream *substream)
778{ 778{
779 sa11xx_uda1341_t *chip = snd_pcm_substream_chip(substream); 779 struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream);
780 780
781 chip->s[substream->pstr->stream].stream = NULL; 781 chip->s[substream->pstr->stream].stream = NULL;
782 return 0; 782 return 0;
@@ -784,21 +784,21 @@ static int snd_card_sa11xx_uda1341_close(snd_pcm_substream_t * substream)
784 784
785/* {{{ HW params & free */ 785/* {{{ HW params & free */
786 786
787static int snd_sa11xx_uda1341_hw_params(snd_pcm_substream_t * substream, 787static int snd_sa11xx_uda1341_hw_params(struct snd_pcm_substream *substream,
788 snd_pcm_hw_params_t * hw_params) 788 struct snd_pcm_hw_params *hw_params)
789{ 789{
790 790
791 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); 791 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
792} 792}
793 793
794static int snd_sa11xx_uda1341_hw_free(snd_pcm_substream_t * substream) 794static int snd_sa11xx_uda1341_hw_free(struct snd_pcm_substream *substream)
795{ 795{
796 return snd_pcm_lib_free_pages(substream); 796 return snd_pcm_lib_free_pages(substream);
797} 797}
798 798
799/* }}} */ 799/* }}} */
800 800
801static snd_pcm_ops_t snd_card_sa11xx_uda1341_playback_ops = { 801static struct snd_pcm_ops snd_card_sa11xx_uda1341_playback_ops = {
802 .open = snd_card_sa11xx_uda1341_open, 802 .open = snd_card_sa11xx_uda1341_open,
803 .close = snd_card_sa11xx_uda1341_close, 803 .close = snd_card_sa11xx_uda1341_close,
804 .ioctl = snd_pcm_lib_ioctl, 804 .ioctl = snd_pcm_lib_ioctl,
@@ -809,7 +809,7 @@ static snd_pcm_ops_t snd_card_sa11xx_uda1341_playback_ops = {
809 .pointer = snd_sa11xx_uda1341_pointer, 809 .pointer = snd_sa11xx_uda1341_pointer,
810}; 810};
811 811
812static snd_pcm_ops_t snd_card_sa11xx_uda1341_capture_ops = { 812static struct snd_pcm_ops snd_card_sa11xx_uda1341_capture_ops = {
813 .open = snd_card_sa11xx_uda1341_open, 813 .open = snd_card_sa11xx_uda1341_open,
814 .close = snd_card_sa11xx_uda1341_close, 814 .close = snd_card_sa11xx_uda1341_close,
815 .ioctl = snd_pcm_lib_ioctl, 815 .ioctl = snd_pcm_lib_ioctl,
@@ -820,9 +820,9 @@ static snd_pcm_ops_t snd_card_sa11xx_uda1341_capture_ops = {
820 .pointer = snd_sa11xx_uda1341_pointer, 820 .pointer = snd_sa11xx_uda1341_pointer,
821}; 821};
822 822
823static int __init snd_card_sa11xx_uda1341_pcm(sa11xx_uda1341_t *sa11xx_uda1341, int device) 823static int __init snd_card_sa11xx_uda1341_pcm(struct sa11xx_uda1341 *sa11xx_uda1341, int device)
824{ 824{
825 snd_pcm_t *pcm; 825 struct snd_pcm *pcm;
826 int err; 826 int err;
827 827
828 if ((err = snd_pcm_new(sa11xx_uda1341->card, "UDA1341 PCM", device, 1, 1, &pcm)) < 0) 828 if ((err = snd_pcm_new(sa11xx_uda1341->card, "UDA1341 PCM", device, 1, 1, &pcm)) < 0)
@@ -860,9 +860,9 @@ static int __init snd_card_sa11xx_uda1341_pcm(sa11xx_uda1341_t *sa11xx_uda1341,
860 860
861#ifdef CONFIG_PM 861#ifdef CONFIG_PM
862 862
863static int snd_sa11xx_uda1341_suspend(snd_card_t *card, pm_message_t state) 863static int snd_sa11xx_uda1341_suspend(struct snd_card *card, pm_message_t state)
864{ 864{
865 sa11xx_uda1341_t *chip = card->pm_private_data; 865 struct sa11xx_uda1341 *chip = card->pm_private_data;
866 866
867 snd_pcm_suspend_all(chip->pcm); 867 snd_pcm_suspend_all(chip->pcm);
868#ifdef HH_VERSION 868#ifdef HH_VERSION
@@ -876,9 +876,9 @@ static int snd_sa11xx_uda1341_suspend(snd_card_t *card, pm_message_t state)
876 return 0; 876 return 0;
877} 877}
878 878
879static int snd_sa11xx_uda1341_resume(snd_card_t *card) 879static int snd_sa11xx_uda1341_resume(struct snd_card *card)
880{ 880{
881 sa11xx_uda1341_t *chip = card->pm_private_data; 881 struct sa11xx_uda1341 *chip = card->pm_private_data;
882 882
883 sa11xx_uda1341_audio_init(chip); 883 sa11xx_uda1341_audio_init(chip);
884 l3_command(chip->uda1341, CMD_RESUME, NULL); 884 l3_command(chip->uda1341, CMD_RESUME, NULL);
@@ -892,43 +892,40 @@ static int snd_sa11xx_uda1341_resume(snd_card_t *card)
892} 892}
893#endif /* COMFIG_PM */ 893#endif /* COMFIG_PM */
894 894
895void snd_sa11xx_uda1341_free(snd_card_t *card) 895void snd_sa11xx_uda1341_free(struct snd_card *card)
896{ 896{
897 sa11xx_uda1341_t *chip = card->private_data; 897 struct sa11xx_uda1341 *chip = card->private_data;
898 898
899 audio_dma_free(&chip->s[SNDRV_PCM_STREAM_PLAYBACK]); 899 audio_dma_free(&chip->s[SNDRV_PCM_STREAM_PLAYBACK]);
900 audio_dma_free(&chip->s[SNDRV_PCM_STREAM_CAPTURE]); 900 audio_dma_free(&chip->s[SNDRV_PCM_STREAM_CAPTURE]);
901} 901}
902 902
903static snd_card_t *sa11xx_uda1341_card; 903static struct snd_card *sa11xx_uda1341_card;
904 904
905static int __init sa11xx_uda1341_init(void) 905static int __init sa11xx_uda1341_init(void)
906{ 906{
907 int err; 907 int err;
908 snd_card_t *card; 908 struct snd_card *card;
909 sa11xx_uda1341_t *chip; 909 struct sa11xx_uda1341 *chip;
910 910
911 if (!machine_is_h3xxx()) 911 if (!machine_is_h3xxx())
912 return -ENODEV; 912 return -ENODEV;
913 913
914 /* register the soundcard */ 914 /* register the soundcard */
915 card = snd_card_new(-1, id, THIS_MODULE, sizeof(sa11xx_uda1341_t)); 915 card = snd_card_new(-1, id, THIS_MODULE, sizeof(struct sa11xx_uda1341));
916 if (card == NULL) 916 if (card == NULL)
917 return -ENOMEM; 917 return -ENOMEM;
918 918
919 sa11xx_uda1341 = kzalloc(sizeof(*sa11xx_uda1341), GFP_KERNEL);
920 if (sa11xx_uda1341 == NULL)
921 return -ENOMEM;
922 card->private_free = snd_sa11xx_uda1341_free; 919 card->private_free = snd_sa11xx_uda1341_free;
923 chip = card->private_data; 920 chip = card->private_data;
924 spin_lock_init(&chip->s[0].dma_lock); 921 spin_lock_init(&chip->s[0].dma_lock);
925 spin_lock_init(&chip->s[1].dma_lock); 922 spin_lock_init(&chip->s[1].dma_lock);
926 923
927 chip->card = card; 924 chip->card = card;
928 chip->samplerate = AUDIO_RATE_DEFAULT; 925 chip->samplerate = AUDIO_RATE_DEFAULT;
929 926
930 // mixer 927 // mixer
931 if ((err = snd_chip_uda1341_mixer_new(chip->card, &sa11xx_uda1341->uda1341))) 928 if ((err = snd_chip_uda1341_mixer_new(card, &chip->uda1341)))
932 goto nodev; 929 goto nodev;
933 930
934 // PCM 931 // PCM