diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-11-16 05:25:33 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-16 05:35:23 -0500 |
commit | 9c96fa599fe4f0ccc6e3e606df6652335afe28e8 (patch) | |
tree | 319ab013b3bcba5fe750c51873d9977122bdcd98 /sound/pci/hda/hda_local.h | |
parent | 4d02d1b638af580ae3d69367248539a8b3893064 (diff) |
ALSA: hda - Get rid of magic digits for subdev hack
Define a proper const for a magic 31bit flag for subdev / NID setup
with a brief comment.
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 | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 3bfcf42ff6cf..4e77f4747291 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -23,6 +23,15 @@ | |||
23 | #ifndef __SOUND_HDA_LOCAL_H | 23 | #ifndef __SOUND_HDA_LOCAL_H |
24 | #define __SOUND_HDA_LOCAL_H | 24 | #define __SOUND_HDA_LOCAL_H |
25 | 25 | ||
26 | /* We abuse kcontrol_new.subdev field to pass the NID corresponding to | ||
27 | * the given new control. If id.subdev has a bit flag HDA_SUBDEV_NID_FLAG, | ||
28 | * snd_hda_ctl_add() takes the lower-bit subdev value as a valid NID. | ||
29 | * | ||
30 | * Note that the subdevice field is cleared again before the real registration | ||
31 | * in snd_hda_ctl_add(), so that this value won't appear in the outside. | ||
32 | */ | ||
33 | #define HDA_SUBDEV_NID_FLAG (1U << 31) | ||
34 | |||
26 | /* | 35 | /* |
27 | * for mixer controls | 36 | * for mixer controls |
28 | */ | 37 | */ |
@@ -33,7 +42,7 @@ | |||
33 | /* mono volume with index (index=0,1,...) (channel=1,2) */ | 42 | /* mono volume with index (index=0,1,...) (channel=1,2) */ |
34 | #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | 43 | #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ |
35 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | 44 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ |
36 | .subdevice = (1<<31)|(nid), \ | 45 | .subdevice = HDA_SUBDEV_NID_FLAG | (nid), \ |
37 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | 46 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
38 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | 47 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
39 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ | 48 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ |
@@ -54,7 +63,7 @@ | |||
54 | /* mono mute switch with index (index=0,1,...) (channel=1,2) */ | 63 | /* mono mute switch with index (index=0,1,...) (channel=1,2) */ |
55 | #define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | 64 | #define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ |
56 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | 65 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ |
57 | .subdevice = (1<<31)|(nid), \ | 66 | .subdevice = HDA_SUBDEV_NID_FLAG | (nid), \ |
58 | .info = snd_hda_mixer_amp_switch_info, \ | 67 | .info = snd_hda_mixer_amp_switch_info, \ |
59 | .get = snd_hda_mixer_amp_switch_get, \ | 68 | .get = snd_hda_mixer_amp_switch_get, \ |
60 | .put = snd_hda_mixer_amp_switch_put, \ | 69 | .put = snd_hda_mixer_amp_switch_put, \ |
@@ -71,7 +80,7 @@ | |||
71 | /* special beep mono mute switch with index (index=0,1,...) (channel=1,2) */ | 80 | /* special beep mono mute switch with index (index=0,1,...) (channel=1,2) */ |
72 | #define HDA_CODEC_MUTE_BEEP_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | 81 | #define HDA_CODEC_MUTE_BEEP_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ |
73 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | 82 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ |
74 | .subdevice = (1<<31)|(nid), \ | 83 | .subdevice = HDA_SUBDEV_NID_FLAG | (nid), \ |
75 | .info = snd_hda_mixer_amp_switch_info, \ | 84 | .info = snd_hda_mixer_amp_switch_info, \ |
76 | .get = snd_hda_mixer_amp_switch_get, \ | 85 | .get = snd_hda_mixer_amp_switch_get, \ |
77 | .put = snd_hda_mixer_amp_switch_put_beep, \ | 86 | .put = snd_hda_mixer_amp_switch_put_beep, \ |