diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-02 12:26:49 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-11-04 07:25:53 -0500 |
commit | 985be54ba8b042923f5a76276a1c0490aa8af7a1 (patch) | |
tree | 93abfe8da6aa0b1ddfce2c71ff3251e05f1e3465 /sound/pci/hda/hda_local.h | |
parent | b7027cc29e158ec2d1c5e53c69f3e9e6a0d02a48 (diff) |
[ALSA] hda-codec - Minor rewrites
Modules: HDA Codec driver,HDA generic driver
- Make bound controls global to all patches
- Clean up analog patches (for the upcoming extension to AD1988)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_local.h')
-rw-r--r-- | sound/pci/hda/hda_local.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 810cfd2d9bba..f51a56f813c8 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -27,28 +27,36 @@ | |||
27 | * for mixer controls | 27 | * for mixer controls |
28 | */ | 28 | */ |
29 | #define HDA_COMPOSE_AMP_VAL(nid,chs,idx,dir) ((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19)) | 29 | #define HDA_COMPOSE_AMP_VAL(nid,chs,idx,dir) ((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19)) |
30 | /* mono volume with index (index=0,1,...) (channel=1,2) */ | ||
30 | #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | 31 | #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ |
31 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | 32 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ |
32 | .info = snd_hda_mixer_amp_volume_info, \ | 33 | .info = snd_hda_mixer_amp_volume_info, \ |
33 | .get = snd_hda_mixer_amp_volume_get, \ | 34 | .get = snd_hda_mixer_amp_volume_get, \ |
34 | .put = snd_hda_mixer_amp_volume_put, \ | 35 | .put = snd_hda_mixer_amp_volume_put, \ |
35 | .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) } | 36 | .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) } |
37 | /* stereo volume with index */ | ||
36 | #define HDA_CODEC_VOLUME_IDX(xname, xcidx, nid, xindex, direction) \ | 38 | #define HDA_CODEC_VOLUME_IDX(xname, xcidx, nid, xindex, direction) \ |
37 | HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, 3, xindex, direction) | 39 | HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, 3, xindex, direction) |
40 | /* mono volume */ | ||
38 | #define HDA_CODEC_VOLUME_MONO(xname, nid, channel, xindex, direction) \ | 41 | #define HDA_CODEC_VOLUME_MONO(xname, nid, channel, xindex, direction) \ |
39 | HDA_CODEC_VOLUME_MONO_IDX(xname, 0, nid, channel, xindex, direction) | 42 | HDA_CODEC_VOLUME_MONO_IDX(xname, 0, nid, channel, xindex, direction) |
43 | /* stereo volume */ | ||
40 | #define HDA_CODEC_VOLUME(xname, nid, xindex, direction) \ | 44 | #define HDA_CODEC_VOLUME(xname, nid, xindex, direction) \ |
41 | HDA_CODEC_VOLUME_MONO(xname, nid, 3, xindex, direction) | 45 | HDA_CODEC_VOLUME_MONO(xname, nid, 3, xindex, direction) |
46 | /* mono mute switch with index (index=0,1,...) (channel=1,2) */ | ||
42 | #define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | 47 | #define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ |
43 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | 48 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ |
44 | .info = snd_hda_mixer_amp_switch_info, \ | 49 | .info = snd_hda_mixer_amp_switch_info, \ |
45 | .get = snd_hda_mixer_amp_switch_get, \ | 50 | .get = snd_hda_mixer_amp_switch_get, \ |
46 | .put = snd_hda_mixer_amp_switch_put, \ | 51 | .put = snd_hda_mixer_amp_switch_put, \ |
47 | .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) } | 52 | .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) } |
53 | /* stereo mute switch with index */ | ||
48 | #define HDA_CODEC_MUTE_IDX(xname, xcidx, nid, xindex, direction) \ | 54 | #define HDA_CODEC_MUTE_IDX(xname, xcidx, nid, xindex, direction) \ |
49 | HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, 3, xindex, direction) | 55 | HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, 3, xindex, direction) |
56 | /* mono mute switch */ | ||
50 | #define HDA_CODEC_MUTE_MONO(xname, nid, channel, xindex, direction) \ | 57 | #define HDA_CODEC_MUTE_MONO(xname, nid, channel, xindex, direction) \ |
51 | HDA_CODEC_MUTE_MONO_IDX(xname, 0, nid, channel, xindex, direction) | 58 | HDA_CODEC_MUTE_MONO_IDX(xname, 0, nid, channel, xindex, direction) |
59 | /* stereo mute switch */ | ||
52 | #define HDA_CODEC_MUTE(xname, nid, xindex, direction) \ | 60 | #define HDA_CODEC_MUTE(xname, nid, xindex, direction) \ |
53 | HDA_CODEC_MUTE_MONO(xname, nid, 3, xindex, direction) | 61 | HDA_CODEC_MUTE_MONO(xname, nid, 3, xindex, direction) |
54 | 62 | ||
@@ -59,6 +67,20 @@ int snd_hda_mixer_amp_switch_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t | |||
59 | int snd_hda_mixer_amp_switch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); | 67 | int snd_hda_mixer_amp_switch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); |
60 | int snd_hda_mixer_amp_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); | 68 | int snd_hda_mixer_amp_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); |
61 | 69 | ||
70 | /* mono switch binding multiple inputs */ | ||
71 | #define HDA_BIND_MUTE_MONO(xname, nid, channel, indices, direction) \ | ||
72 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | ||
73 | .info = snd_hda_mixer_amp_switch_info, \ | ||
74 | .get = snd_hda_mixer_bind_switch_get, \ | ||
75 | .put = snd_hda_mixer_bind_switch_put, \ | ||
76 | .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, indices, direction) } | ||
77 | |||
78 | /* stereo switch binding multiple inputs */ | ||
79 | #define HDA_BIND_MUTE(xname,nid,indices,dir) HDA_BIND_MUTE_MONO(xname,nid,3,indices,dir) | ||
80 | |||
81 | int snd_hda_mixer_bind_switch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); | ||
82 | int snd_hda_mixer_bind_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); | ||
83 | |||
62 | int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid); | 84 | int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid); |
63 | int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid); | 85 | int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid); |
64 | 86 | ||