aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-05-06 11:30:17 -0400
committerTakashi Iwai <tiwai@suse.de>2009-05-06 11:31:52 -0400
commit2bf864ac963c5126a9c7c3dce0958390fb612270 (patch)
treee6201bba5d1a4cf6d65702fc237896035f2b7408
parentd82b64f4764755d765038cf95b1dbe7db039592a (diff)
ALSA: ice1724 - Allow spec driver to create own routing controls
Added a new flag, own_routing, to allow spec drivers to create own routing controls. Also, the basic get/put calls are changed to be external for later use by maya44 driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/ice1712/ice1712.h12
-rw-r--r--sound/pci/ice1712/ice1724.c33
2 files changed, 30 insertions, 15 deletions
diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h
index fdae6deba16b..adc909ec125c 100644
--- a/sound/pci/ice1712/ice1712.h
+++ b/sound/pci/ice1712/ice1712.h
@@ -335,6 +335,7 @@ struct snd_ice1712 {
335 unsigned int force_rdma1:1; /* VT1720/4 - RDMA1 as non-spdif */ 335 unsigned int force_rdma1:1; /* VT1720/4 - RDMA1 as non-spdif */
336 unsigned int midi_output:1; /* VT1720/4: MIDI output triggered */ 336 unsigned int midi_output:1; /* VT1720/4: MIDI output triggered */
337 unsigned int midi_input:1; /* VT1720/4: MIDI input triggered */ 337 unsigned int midi_input:1; /* VT1720/4: MIDI input triggered */
338 unsigned int own_routing:1; /* VT1720/4: use own routing ctls */
338 unsigned int num_total_dacs; /* total DACs */ 339 unsigned int num_total_dacs; /* total DACs */
339 unsigned int num_total_adcs; /* total ADCs */ 340 unsigned int num_total_adcs; /* total ADCs */
340 unsigned int cur_rate; /* current rate */ 341 unsigned int cur_rate; /* current rate */
@@ -458,10 +459,17 @@ static inline int snd_ice1712_gpio_read_bits(struct snd_ice1712 *ice,
458 return snd_ice1712_gpio_read(ice) & mask; 459 return snd_ice1712_gpio_read(ice) & mask;
459} 460}
460 461
462/* route access functions */
463int snd_ice1724_get_route_val(struct snd_ice1712 *ice, int shift);
464int snd_ice1724_put_route_val(struct snd_ice1712 *ice, unsigned int val,
465 int shift);
466
461int snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice); 467int snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice);
462 468
463int snd_ice1712_akm4xxx_init(struct snd_akm4xxx *ak, const struct snd_akm4xxx *template, 469int snd_ice1712_akm4xxx_init(struct snd_akm4xxx *ak,
464 const struct snd_ak4xxx_private *priv, struct snd_ice1712 *ice); 470 const struct snd_akm4xxx *template,
471 const struct snd_ak4xxx_private *priv,
472 struct snd_ice1712 *ice);
465void snd_ice1712_akm4xxx_free(struct snd_ice1712 *ice); 473void snd_ice1712_akm4xxx_free(struct snd_ice1712 *ice);
466int snd_ice1712_akm4xxx_build_controls(struct snd_ice1712 *ice); 474int snd_ice1712_akm4xxx_build_controls(struct snd_ice1712 *ice);
467 475
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 1f05c59690a1..5a735eed317d 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -1975,7 +1975,7 @@ static inline int digital_route_shift(int idx)
1975 return idx * 3; 1975 return idx * 3;
1976} 1976}
1977 1977
1978static int get_route_val(struct snd_ice1712 *ice, int shift) 1978int snd_ice1724_get_route_val(struct snd_ice1712 *ice, int shift)
1979{ 1979{
1980 unsigned long val; 1980 unsigned long val;
1981 unsigned char eitem; 1981 unsigned char eitem;
@@ -1994,7 +1994,8 @@ static int get_route_val(struct snd_ice1712 *ice, int shift)
1994 return eitem; 1994 return eitem;
1995} 1995}
1996 1996
1997static int put_route_val(struct snd_ice1712 *ice, unsigned int val, int shift) 1997int snd_ice1724_put_route_val(struct snd_ice1712 *ice, unsigned int val,
1998 int shift)
1998{ 1999{
1999 unsigned int old_val, nval; 2000 unsigned int old_val, nval;
2000 int change; 2001 int change;
@@ -2022,7 +2023,7 @@ static int snd_vt1724_pro_route_analog_get(struct snd_kcontrol *kcontrol,
2022 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 2023 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
2023 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 2024 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2024 ucontrol->value.enumerated.item[0] = 2025 ucontrol->value.enumerated.item[0] =
2025 get_route_val(ice, analog_route_shift(idx)); 2026 snd_ice1724_get_route_val(ice, analog_route_shift(idx));
2026 return 0; 2027 return 0;
2027} 2028}
2028 2029
@@ -2031,8 +2032,9 @@ static int snd_vt1724_pro_route_analog_put(struct snd_kcontrol *kcontrol,
2031{ 2032{
2032 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 2033 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
2033 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 2034 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2034 return put_route_val(ice, ucontrol->value.enumerated.item[0], 2035 return snd_ice1724_put_route_val(ice,
2035 analog_route_shift(idx)); 2036 ucontrol->value.enumerated.item[0],
2037 analog_route_shift(idx));
2036} 2038}
2037 2039
2038static int snd_vt1724_pro_route_spdif_get(struct snd_kcontrol *kcontrol, 2040static int snd_vt1724_pro_route_spdif_get(struct snd_kcontrol *kcontrol,
@@ -2041,7 +2043,7 @@ static int snd_vt1724_pro_route_spdif_get(struct snd_kcontrol *kcontrol,
2041 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 2043 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
2042 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 2044 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2043 ucontrol->value.enumerated.item[0] = 2045 ucontrol->value.enumerated.item[0] =
2044 get_route_val(ice, digital_route_shift(idx)); 2046 snd_ice1724_get_route_val(ice, digital_route_shift(idx));
2045 return 0; 2047 return 0;
2046} 2048}
2047 2049
@@ -2050,11 +2052,13 @@ static int snd_vt1724_pro_route_spdif_put(struct snd_kcontrol *kcontrol,
2050{ 2052{
2051 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 2053 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
2052 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 2054 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2053 return put_route_val(ice, ucontrol->value.enumerated.item[0], 2055 return snd_ice1724_put_route_val(ice,
2054 digital_route_shift(idx)); 2056 ucontrol->value.enumerated.item[0],
2057 digital_route_shift(idx));
2055} 2058}
2056 2059
2057static struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route __devinitdata = { 2060static struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route __devinitdata =
2061{
2058 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2062 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2059 .name = "H/W Playback Route", 2063 .name = "H/W Playback Route",
2060 .info = snd_vt1724_pro_route_info, 2064 .info = snd_vt1724_pro_route_info,
@@ -2291,9 +2295,12 @@ static int __devinit snd_vt1724_spdif_build_controls(struct snd_ice1712 *ice)
2291 if (snd_BUG_ON(!ice->pcm)) 2295 if (snd_BUG_ON(!ice->pcm))
2292 return -EIO; 2296 return -EIO;
2293 2297
2294 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_vt1724_mixer_pro_spdif_route, ice)); 2298 if (!ice->own_routing) {
2295 if (err < 0) 2299 err = snd_ctl_add(ice->card,
2296 return err; 2300 snd_ctl_new1(&snd_vt1724_mixer_pro_spdif_route, ice));
2301 if (err < 0)
2302 return err;
2303 }
2297 2304
2298 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_vt1724_spdif_switch, ice)); 2305 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_vt1724_spdif_switch, ice));
2299 if (err < 0) 2306 if (err < 0)
@@ -2340,7 +2347,7 @@ static int __devinit snd_vt1724_build_controls(struct snd_ice1712 *ice)
2340 if (err < 0) 2347 if (err < 0)
2341 return err; 2348 return err;
2342 2349
2343 if (ice->num_total_dacs > 0) { 2350 if (!ice->own_routing && ice->num_total_dacs > 0) {
2344 struct snd_kcontrol_new tmp = snd_vt1724_mixer_pro_analog_route; 2351 struct snd_kcontrol_new tmp = snd_vt1724_mixer_pro_analog_route;
2345 tmp.count = ice->num_total_dacs; 2352 tmp.count = ice->num_total_dacs;
2346 if (ice->vt1720 && tmp.count > 2) 2353 if (ice->vt1720 && tmp.count > 2)