diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-01-18 07:36:07 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 11:30:05 -0500 |
commit | 7cda8ba9f4e471dfba914ecf67fd14ebffb17c16 (patch) | |
tree | 5786b450d9099809b974929ea356b444c9f2bc07 /sound/pci/ice1712/revo.c | |
parent | 797760ab14db4e82a50c06a9916dd5c6147b415b (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/revo.c')
-rw-r--r-- | sound/pci/ice1712/revo.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c index 05a751c59893..ddd5fc8d4fe1 100644 --- a/sound/pci/ice1712/revo.c +++ b/sound/pci/ice1712/revo.c | |||
@@ -32,6 +32,12 @@ | |||
32 | #include "envy24ht.h" | 32 | #include "envy24ht.h" |
33 | #include "revo.h" | 33 | #include "revo.h" |
34 | 34 | ||
35 | /* a non-standard I2C device for revo51 */ | ||
36 | struct revo51_spec { | ||
37 | struct snd_i2c_device *dev; | ||
38 | struct snd_pt2258 *pt2258; | ||
39 | } revo51; | ||
40 | |||
35 | static void revo_i2s_mclk_changed(struct snd_ice1712 *ice) | 41 | static void revo_i2s_mclk_changed(struct snd_ice1712 *ice) |
36 | { | 42 | { |
37 | /* assert PRST# to converters; MT05 bit 7 */ | 43 | /* assert PRST# to converters; MT05 bit 7 */ |
@@ -152,8 +158,14 @@ static struct snd_i2c_bit_ops revo51_bit_ops = { | |||
152 | static int revo51_i2c_init(struct snd_ice1712 *ice, | 158 | static int revo51_i2c_init(struct snd_ice1712 *ice, |
153 | struct snd_pt2258 *pt) | 159 | struct snd_pt2258 *pt) |
154 | { | 160 | { |
161 | struct revo51_spec *spec; | ||
155 | int err; | 162 | int err; |
156 | 163 | ||
164 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
165 | if (!spec) | ||
166 | return -ENOMEM; | ||
167 | ice->spec = spec; | ||
168 | |||
157 | /* create the I2C bus */ | 169 | /* create the I2C bus */ |
158 | err = snd_i2c_bus_create(ice->card, "ICE1724 GPIO6", NULL, &ice->i2c); | 170 | err = snd_i2c_bus_create(ice->card, "ICE1724 GPIO6", NULL, &ice->i2c); |
159 | if (err < 0) | 171 | if (err < 0) |
@@ -163,15 +175,14 @@ static int revo51_i2c_init(struct snd_ice1712 *ice, | |||
163 | ice->i2c->hw_ops.bit = &revo51_bit_ops; | 175 | ice->i2c->hw_ops.bit = &revo51_bit_ops; |
164 | 176 | ||
165 | /* create the I2C device */ | 177 | /* create the I2C device */ |
166 | err = snd_i2c_device_create(ice->i2c, "PT2258", 0x40, | 178 | err = snd_i2c_device_create(ice->i2c, "PT2258", 0x40, &spec->dev); |
167 | &ice->spec.revo51.dev); | ||
168 | if (err < 0) | 179 | if (err < 0) |
169 | return err; | 180 | return err; |
170 | 181 | ||
171 | pt->card = ice->card; | 182 | pt->card = ice->card; |
172 | pt->i2c_bus = ice->i2c; | 183 | pt->i2c_bus = ice->i2c; |
173 | pt->i2c_dev = ice->spec.revo51.dev; | 184 | pt->i2c_dev = spec->dev; |
174 | ice->spec.revo51.pt2258 = pt; | 185 | spec->pt2258 = pt; |
175 | 186 | ||
176 | snd_pt2258_reset(pt); | 187 | snd_pt2258_reset(pt); |
177 | 188 | ||
@@ -555,6 +566,7 @@ static int __devinit revo_init(struct snd_ice1712 *ice) | |||
555 | 566 | ||
556 | static int __devinit revo_add_controls(struct snd_ice1712 *ice) | 567 | static int __devinit revo_add_controls(struct snd_ice1712 *ice) |
557 | { | 568 | { |
569 | struct revo51_spec *spec; | ||
558 | int err; | 570 | int err; |
559 | 571 | ||
560 | switch (ice->eeprom.subvendor) { | 572 | switch (ice->eeprom.subvendor) { |
@@ -567,7 +579,8 @@ static int __devinit revo_add_controls(struct snd_ice1712 *ice) | |||
567 | err = snd_ice1712_akm4xxx_build_controls(ice); | 579 | err = snd_ice1712_akm4xxx_build_controls(ice); |
568 | if (err < 0) | 580 | if (err < 0) |
569 | return err; | 581 | return err; |
570 | err = snd_pt2258_build_controls(ice->spec.revo51.pt2258); | 582 | spec = ice->spec; |
583 | err = snd_pt2258_build_controls(spec->pt2258); | ||
571 | if (err < 0) | 584 | if (err < 0) |
572 | return err; | 585 | return err; |
573 | break; | 586 | break; |