diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-08-10 11:12:15 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:58:45 -0400 |
commit | cca3b3718ca96dca51daf1129ac03003bcede751 (patch) | |
tree | 32dc0ee54e783fe0021f26061dfbdd37beef4d1f /sound/pci/hda/patch_sigmatel.c | |
parent | 47fd830acf0b6b5bc75db55d0f2cc64f59a23b5f (diff) |
[ALSA] hda-codec - Clean up bind-controls
We have already a generic bind-control helper, so let's clean up the codes
using it.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 89 |
1 files changed, 20 insertions, 69 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 1690726c1e13..bf5d91b63d15 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -2400,63 +2400,28 @@ static struct hda_verb vaio_ar_init[] = { | |||
2400 | }; | 2400 | }; |
2401 | 2401 | ||
2402 | /* bind volumes of both NID 0x02 and 0x05 */ | 2402 | /* bind volumes of both NID 0x02 and 0x05 */ |
2403 | static int vaio_master_vol_put(struct snd_kcontrol *kcontrol, | 2403 | static struct hda_bind_ctls vaio_bind_master_vol = { |
2404 | struct snd_ctl_elem_value *ucontrol) | 2404 | .ops = &snd_hda_bind_vol, |
2405 | { | 2405 | .values = { |
2406 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2406 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
2407 | long *valp = ucontrol->value.integer.value; | 2407 | HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT), |
2408 | int change; | 2408 | 0 |
2409 | 2409 | }, | |
2410 | change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0, | 2410 | }; |
2411 | HDA_AMP_VOLMASK, valp[0]); | ||
2412 | change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0, | ||
2413 | HDA_AMP_VOLMASK, valp[1]); | ||
2414 | snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, | ||
2415 | HDA_AMP_VOLMASK, valp[0]); | ||
2416 | snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0, | ||
2417 | HDA_AMP_VOLMASK, valp[1]); | ||
2418 | return change; | ||
2419 | } | ||
2420 | 2411 | ||
2421 | /* bind volumes of both NID 0x02 and 0x05 */ | 2412 | /* bind volumes of both NID 0x02 and 0x05 */ |
2422 | static int vaio_master_sw_put(struct snd_kcontrol *kcontrol, | 2413 | static struct hda_bind_ctls vaio_bind_master_sw = { |
2423 | struct snd_ctl_elem_value *ucontrol) | 2414 | .ops = &snd_hda_bind_sw, |
2424 | { | 2415 | .values = { |
2425 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2416 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
2426 | long *valp = ucontrol->value.integer.value; | 2417 | HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT), |
2427 | int change; | 2418 | 0, |
2428 | 2419 | }, | |
2429 | change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0, | 2420 | }; |
2430 | HDA_AMP_MUTE, | ||
2431 | (valp[0] ? 0 : HDA_AMP_MUTE)); | ||
2432 | change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0, | ||
2433 | HDA_AMP_MUTE, | ||
2434 | (valp[1] ? 0 : HDA_AMP_MUTE)); | ||
2435 | snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, | ||
2436 | HDA_AMP_MUTE, (valp[0] ? 0 : HDA_AMP_MUTE)); | ||
2437 | snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0, | ||
2438 | HDA_AMP_MUTE, (valp[1] ? 0 : HDA_AMP_MUTE)); | ||
2439 | return change; | ||
2440 | } | ||
2441 | 2421 | ||
2442 | static struct snd_kcontrol_new vaio_mixer[] = { | 2422 | static struct snd_kcontrol_new vaio_mixer[] = { |
2443 | { | 2423 | HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol), |
2444 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2424 | HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw), |
2445 | .name = "Master Playback Volume", | ||
2446 | .info = snd_hda_mixer_amp_volume_info, | ||
2447 | .get = snd_hda_mixer_amp_volume_get, | ||
2448 | .put = vaio_master_vol_put, | ||
2449 | .tlv = { .c = snd_hda_mixer_amp_tlv }, | ||
2450 | .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
2451 | }, | ||
2452 | { | ||
2453 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2454 | .name = "Master Playback Switch", | ||
2455 | .info = snd_hda_mixer_amp_switch_info, | ||
2456 | .get = snd_hda_mixer_amp_switch_get, | ||
2457 | .put = vaio_master_sw_put, | ||
2458 | .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
2459 | }, | ||
2460 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ | 2425 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ |
2461 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), | 2426 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
2462 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), | 2427 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |
@@ -2472,22 +2437,8 @@ static struct snd_kcontrol_new vaio_mixer[] = { | |||
2472 | }; | 2437 | }; |
2473 | 2438 | ||
2474 | static struct snd_kcontrol_new vaio_ar_mixer[] = { | 2439 | static struct snd_kcontrol_new vaio_ar_mixer[] = { |
2475 | { | 2440 | HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol), |
2476 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2441 | HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw), |
2477 | .name = "Master Playback Volume", | ||
2478 | .info = snd_hda_mixer_amp_volume_info, | ||
2479 | .get = snd_hda_mixer_amp_volume_get, | ||
2480 | .put = vaio_master_vol_put, | ||
2481 | .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
2482 | }, | ||
2483 | { | ||
2484 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2485 | .name = "Master Playback Switch", | ||
2486 | .info = snd_hda_mixer_amp_switch_info, | ||
2487 | .get = snd_hda_mixer_amp_switch_get, | ||
2488 | .put = vaio_master_sw_put, | ||
2489 | .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
2490 | }, | ||
2491 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ | 2442 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ |
2492 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), | 2443 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
2493 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), | 2444 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |