]> git.wh0rd.org - patches.git/blame_incremental - bfin-alsa-ad1836-cleanup.patch
initial import
[patches.git] / bfin-alsa-ad1836-cleanup.patch
... / ...
CommitLineData
1Index: ad1836.c
2===================================================================
3RCS file: /usr/local/src/blackfin/rsync/uclinux533/uClinux-dist/linux-2.6.x/sound/blackfin/ad1836.c,v
4retrieving revision 1.57
5diff -u -p -r1.57 ad1836.c
6--- ad1836.c 29 Aug 2006 09:36:12 -0000 1.57
7+++ ad1836.c 8 Sep 2006 23:25:58 -0000
8@@ -917,6 +917,7 @@ static int snd_ad1836_playback_close(snd
9 }
10 }
11 #else
12+ snd_printk_marker();
13 chip->tx_substream = NULL;
14 #endif
15
16@@ -946,11 +947,13 @@ static int snd_ad1836_hw_params(snd_pcm_
17 */
18 #ifdef CONFIG_SND_BLACKFIN_AD1836_TDM
19
20-#ifdef MULTI_SUBSTREAM
21+# ifdef MULTI_SUBSTREAM
22 substream_info_t *sub_info = NULL;
23 ad1836_t *chip = snd_pcm_substream_chip(substream);
24 int index = find_substream(chip, substream, &sub_info);
25
26+ snd_printk_marker();
27+
28 if (chip->rx_substream == substream) {
29 substream->runtime->dma_area = chip->rx_dma_buf;
30 substream->runtime->dma_addr = (unsigned int)chip->rx_dma_buf;
31@@ -961,18 +964,19 @@ static int snd_ad1836_hw_params(snd_pcm_
32 substream->runtime->dma_bytes = AD1836_BUF_SZ;
33 }
34
35-#else
36+# else
37+ snd_printk_marker();
38 if (snd_pcm_lib_malloc_pages(substream, AD1836_BUF_SZ) < 0)
39 return -ENOMEM;
40-#endif
41+# endif
42
43 #else
44+ snd_printk_marker();
45 if (snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hwparams)) < 0)
46 return -ENOMEM;
47 #endif
48
49 return 0;
50-
51 }
52
53 static int snd_ad1836_hw_free(snd_pcm_substream_t * substream)
54@@ -1080,6 +1084,8 @@ static int snd_ad1836_playback_trigger(s
55 snd_assert((index >= 0 && index <= 2 && sub_info), return -EINVAL);
56 #endif
57
58+ snd_printk_marker();
59+
60 spin_lock(&chip->ad1836_lock);
61 switch (cmd) {
62 case SNDRV_PCM_TRIGGER_START:
63@@ -1121,6 +1127,8 @@ static int snd_ad1836_capture_trigger(sn
64 {
65 ad1836_t *chip = snd_pcm_substream_chip(substream);
66
67+ snd_printk_marker();
68+
69 spin_lock(&chip->ad1836_lock);
70 snd_assert(substream == chip->rx_substream, return -EINVAL);
71 switch (cmd) {
72@@ -1158,6 +1166,8 @@ static snd_pcm_uframes_t snd_ad1836_play
73 #endif
74 size_t frames = diff / bytes_per_frame;
75
76+ snd_printk_marker();
77+
78 #ifdef MULTI_SUBSTREAM
79 find_substream(chip, substream, &sub_info);
80 frames = (frames + DMA_BUFFER_FRAMES - sub_info->dma_offset) % \
81@@ -1197,8 +1207,10 @@ static snd_pcm_uframes_t snd_ad1836_capt
82 #endif
83 size_t frames = diff / bytes_per_frame;
84
85+ snd_printk_marker();
86+
87 #ifdef CONFIG_SND_DEBUG_CURRPTR
88- snd_printk(KERN_INFO " capture pos: 0x%04x / %lx\n", frames,
89+ snd_printk(KERN_DEBUG "capture pos: 0x%04x / %lx\n", frames,
90 runtime->buffer_size);
91 #endif
92
93@@ -1399,7 +1411,7 @@ static int snd_ad1836_playback_silence(s
94 frames_to_bytes(substream->runtime, count));
95 #endif
96 #ifdef CONFIG_SND_DEBUG_CURRPTR
97- snd_printk(KERN_INFO "silence: pos %x, count %x\n", (uint)pos, (uint)count);
98+ snd_printk(KERN_DEBUG "silence: pos %x, count %x\n", (uint)pos, (uint)count);
99 #endif
100
101 return 0;
102@@ -1411,7 +1423,7 @@ static int snd_ad1836_capture_silence(sn
103 unsigned char *buf = substream->runtime->dma_area;
104
105 #ifdef CONFIG_SND_DEBUG
106- snd_printk(KERN_INFO "silence: pos %x, count %x\n",
107+ snd_printk(KERN_DEBUG "silence: pos %x, count %x\n",
108 (uint)pos, (uint)count);
109 #endif
110 #ifdef CONFIG_SND_BLACKFIN_AD1836_TDM
111@@ -1457,6 +1469,8 @@ static snd_pcm_ops_t snd_ad1836_capture_
112 *************************************************************/
113 static int snd_ad1836_stop(struct snd_ad1836 *chip)
114 {
115+ snd_printk_marker();
116+
117 snd_ad1836_set_register(chip, DAC_CTRL_2, DAC_MUTE_MASK, DAC_MUTE_MASK);
118 snd_ad1836_set_register(chip, ADC_CTRL_2, ADC_MUTE_MASK, ADC_MUTE_MASK);
119 snd_ad1836_set_register(chip, DAC_CTRL_1, DAC_PWRDWN, DAC_PWRDWN);
120@@ -1469,6 +1483,8 @@ static int snd_ad1836_dev_free(snd_devic
121 {
122 struct snd_ad1836 *chip = (ad1836_t *)device->device_data;
123
124+ snd_printk_marker();
125+
126 #ifdef MULTI_SUBSTREAM
127 dma_free_coherent(NULL, AD1836_BUF_SZ, chip->rx_dma_buf, 0);
128 dma_free_coherent(NULL, AD1836_BUF_SZ, chip->tx_dma_buf, 0);
129@@ -1514,7 +1530,7 @@ static int snd_bf53x_ad1836_reset(ad1836
130
131 bfin_write(FlashA_PortA_Dir,0x1); /* configure flag as an output pin */
132
133- snd_printk(KERN_INFO "resetting ezkit 1836 using flash flag pin\n");
134+ snd_printk(KERN_INFO "resetting ezkit using flash flag pin\n");
135 bfin_write(FlashA_PortA_Data,0x0); /* reset is active low */
136 udelay(1); /* hold low */
137
138@@ -1532,6 +1548,8 @@ static int snd_ad1836_configure(ad1836_t
139 int err = 0;
140 struct bf53x_sport *sport= chip->sport;
141
142+ snd_printk_marker();
143+
144 snd_bf53x_ad1836_reset(chip);
145
146 /* see if we are connected by writing (preferably something useful)
147@@ -1592,6 +1610,8 @@ static int snd_ad1836_configure(ad1836_t
148 int err = 0;
149 struct bf53x_sport *sport= chip->sport;
150
151+ snd_printk_marker();
152+
153 snd_bf53x_ad1836_reset(chip);
154
155 /* Power up DAC and ADC */
156@@ -1672,7 +1692,7 @@ static void snd_ad1836_dma_tx(void *data
157
158 static void snd_ad1836_sport_err(void *data)
159 {
160- printk(KERN_ERR "%s: err happened on sport\n", __FUNCTION__);
161+ printk(KERN_ERR DRIVER_NAME ":%s: err happened on sport\n", __FUNCTION__);
162 }
163
164 static void snd_ad1836_proc_registers_read(snd_info_entry_t * entry,
165@@ -1742,6 +1762,8 @@ static int __devinit snd_ad1836_pcm(stru
166 struct snd_pcm *pcm;
167 int err = 0;
168
169+ snd_printk_marker();
170+
171 #ifdef MULTI_SUBSTREAM
172 /* 3 playback and 1 capture substream, 2 channels each */
173 err = snd_pcm_new(ad1836->card, PCM_NAME, 0, 3, 1, &pcm);
174@@ -1779,12 +1801,16 @@ static int __devinit snd_ad1836_probe(st
175 dma_addr_t addr;
176 #endif
177
178+ snd_printk_marker();
179+
180 if (device != NULL)
181 return -ENOENT;
182
183 card = snd_card_new(-1, NULL, THIS_MODULE, sizeof(struct snd_ad1836));
184- if (card == NULL)
185+ if (card == NULL) {
186+ snd_printdd(KERN_DEBUG "%s: snd_card_new() failed\n", __FUNCTION__);
187 return -ENOMEM;
188+ }
189
190 ad1836 = card->private_data;
191 ad1836->card = card;
192@@ -1810,7 +1836,7 @@ static int __devinit snd_ad1836_probe(st
193 ad1836->rx_dma_buf = dma_alloc_coherent(NULL, AD1836_BUF_SZ, &addr, 0);
194 ad1836->tx_dma_buf = dma_alloc_coherent(NULL, AD1836_BUF_SZ, &addr, 0);
195 if (!ad1836->rx_dma_buf || !ad1836->tx_dma_buf) {
196- printk(KERN_ERR"Failed to allocate DMA buffer\n");
197+ printk(KERN_ERR DRIVER_NAME ": Failed to allocate DMA buffer\n");
198 return -ENOMEM;
199 }
200 #endif
201@@ -1820,6 +1846,7 @@ static int __devinit snd_ad1836_probe(st
202 SPORT_DMA_TX, snd_ad1836_dma_tx,
203 SPORT_IRQ_ERR, snd_ad1836_sport_err, ad1836))
204 == NULL) {
205+ printk(KERN_ERR DRIVER_NAME ": Failed to find device on sport\n");
206 err = -ENODEV;
207 goto __nodev;
208 }
209@@ -1891,6 +1918,8 @@ static int snd_ad1836_suspend(struct pla
210 struct snd_card *card = platform_get_drvdata(pdev);
211 struct snd_ad1836 *ad1836 = card->private_data;
212
213+ snd_printk_marker();
214+
215 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
216 snd_pcm_suspend_all(ad1836->pcm);
217 return 0;
218@@ -1900,6 +1929,8 @@ static int snd_ad1836_resume(struct plat
219 {
220 struct snd_card *card = platform_get_drvdata(pdev);
221
222+ snd_printk_marker();
223+
224 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
225 return 0;
226 }