aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ice1712/juli.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-01-18 07:36:07 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:30:05 -0500
commit7cda8ba9f4e471dfba914ecf67fd14ebffb17c16 (patch)
tree5786b450d9099809b974929ea356b444c9f2bc07 /sound/pci/ice1712/juli.c
parent797760ab14db4e82a50c06a9916dd5c6147b415b (diff)
[ALSA] ice1712, ice1724 - Code clean up
Clean up ice1712/ice1724 codes. The board-specific data is allocated locally in each code instead of having an ungly union in struct ice1712. Also, fix coding issues in prodigy_hifi.c. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/ice1712/juli.c')
-rw-r--r--sound/pci/ice1712/juli.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c
index 1a435df423c6..e8038c0ceb72 100644
--- a/sound/pci/ice1712/juli.c
+++ b/sound/pci/ice1712/juli.c
@@ -32,6 +32,11 @@
32#include "envy24ht.h" 32#include "envy24ht.h"
33#include "juli.h" 33#include "juli.h"
34 34
35struct juli_spec {
36 struct ak4114 *ak4114;
37 unsigned int analog: 1;
38};
39
35/* 40/*
36 * chip addresses on I2C bus 41 * chip addresses on I2C bus
37 */ 42 */
@@ -137,12 +142,13 @@ static struct snd_akm4xxx akm_juli_dac __devinitdata = {
137 142
138static int __devinit juli_add_controls(struct snd_ice1712 *ice) 143static int __devinit juli_add_controls(struct snd_ice1712 *ice)
139{ 144{
145 struct juli_spec *spec = ice->spec;
140 int err; 146 int err;
141 err = snd_ice1712_akm4xxx_build_controls(ice); 147 err = snd_ice1712_akm4xxx_build_controls(ice);
142 if (err < 0) 148 if (err < 0)
143 return err; 149 return err;
144 /* only capture SPDIF over AK4114 */ 150 /* only capture SPDIF over AK4114 */
145 err = snd_ak4114_build(ice->spec.juli.ak4114, NULL, 151 err = snd_ak4114_build(spec->ak4114, NULL,
146 ice->pcm_pro->streams[SNDRV_PCM_STREAM_CAPTURE].substream); 152 ice->pcm_pro->streams[SNDRV_PCM_STREAM_CAPTURE].substream);
147 if (err < 0) 153 if (err < 0)
148 return err; 154 return err;
@@ -166,13 +172,19 @@ static int __devinit juli_init(struct snd_ice1712 *ice)
166 0x41, 0x02, 0x2c, 0x00, 0x00 172 0x41, 0x02, 0x2c, 0x00, 0x00
167 }; 173 };
168 int err; 174 int err;
175 struct juli_spec *spec;
169 struct snd_akm4xxx *ak; 176 struct snd_akm4xxx *ak;
170 177
178 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
179 if (!spec)
180 return -ENOMEM;
181 ice->spec = spec;
182
171 err = snd_ak4114_create(ice->card, 183 err = snd_ak4114_create(ice->card,
172 juli_ak4114_read, 184 juli_ak4114_read,
173 juli_ak4114_write, 185 juli_ak4114_write,
174 ak4114_init_vals, ak4114_init_txcsb, 186 ak4114_init_vals, ak4114_init_txcsb,
175 ice, &ice->spec.juli.ak4114); 187 ice, &spec->ak4114);
176 if (err < 0) 188 if (err < 0)
177 return err; 189 return err;
178 190
@@ -180,12 +192,12 @@ static int __devinit juli_init(struct snd_ice1712 *ice)
180 /* it seems that the analog doughter board detection does not work 192 /* it seems that the analog doughter board detection does not work
181 reliably, so force the analog flag; it should be very rare 193 reliably, so force the analog flag; it should be very rare
182 to use Juli@ without the analog doughter board */ 194 to use Juli@ without the analog doughter board */
183 ice->spec.juli.analog = (ice->gpio.get_data(ice) & GPIO_ANALOG_PRESENT) ? 0 : 1; 195 spec->analog = (ice->gpio.get_data(ice) & GPIO_ANALOG_PRESENT) ? 0 : 1;
184#else 196#else
185 ice->spec.juli.analog = 1; 197 spec->analog = 1;
186#endif 198#endif
187 199
188 if (ice->spec.juli.analog) { 200 if (spec->analog) {
189 printk(KERN_INFO "juli@: analog I/O detected\n"); 201 printk(KERN_INFO "juli@: analog I/O detected\n");
190 ice->num_total_dacs = 2; 202 ice->num_total_dacs = 2;
191 ice->num_total_adcs = 2; 203 ice->num_total_adcs = 2;