aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-11-16 05:25:33 -0500
committerTakashi Iwai <tiwai@suse.de>2009-11-16 05:35:23 -0500
commit9c96fa599fe4f0ccc6e3e606df6652335afe28e8 (patch)
tree319ab013b3bcba5fe750c51873d9977122bdcd98 /sound/pci
parent4d02d1b638af580ae3d69367248539a8b3893064 (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')
-rw-r--r--sound/pci/hda/hda_codec.c2
-rw-r--r--sound/pci/hda/hda_local.h15
-rw-r--r--sound/pci/hda/patch_analog.c2
-rw-r--r--sound/pci/hda/patch_realtek.c2
-rw-r--r--sound/pci/hda/patch_sigmatel.c2
-rw-r--r--sound/pci/hda/patch_via.c2
6 files changed, 17 insertions, 8 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index d71e651046eb..5e21b35207ab 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1523,7 +1523,7 @@ int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid,
1523 int err; 1523 int err;
1524 struct hda_nid_item *item; 1524 struct hda_nid_item *item;
1525 1525
1526 if (kctl->id.subdevice & (1<<31)) { 1526 if (kctl->id.subdevice & HDA_SUBDEV_NID_FLAG) {
1527 if (nid == 0) 1527 if (nid == 0)
1528 nid = kctl->id.subdevice & 0xffff; 1528 nid = kctl->id.subdevice & 0xffff;
1529 kctl->id.subdevice = 0; 1529 kctl->id.subdevice = 0;
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, \
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 2d345606265b..ceb0c603da04 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -2572,7 +2572,7 @@ static int add_control(struct ad198x_spec *spec, int type, const char *name,
2572 if (! knew->name) 2572 if (! knew->name)
2573 return -ENOMEM; 2573 return -ENOMEM;
2574 if (get_amp_nid_(val)) 2574 if (get_amp_nid_(val))
2575 knew->subdevice = (1<<31)|get_amp_nid_(val); 2575 knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val);
2576 knew->private_value = val; 2576 knew->private_value = val;
2577 return 0; 2577 return 0;
2578} 2578}
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index c0a98e724a25..eee3143eef75 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4324,7 +4324,7 @@ static int add_control(struct alc_spec *spec, int type, const char *name,
4324 if (!knew->name) 4324 if (!knew->name)
4325 return -ENOMEM; 4325 return -ENOMEM;
4326 if (get_amp_nid_(val)) 4326 if (get_amp_nid_(val))
4327 knew->subdevice = (1<<31)|get_amp_nid_(val); 4327 knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val);
4328 knew->private_value = val; 4328 knew->private_value = val;
4329 return 0; 4329 return 0;
4330} 4330}
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index d2ddb959c290..7f76a97954f9 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2689,7 +2689,7 @@ stac_control_new(struct sigmatel_spec *spec,
2689 return NULL; 2689 return NULL;
2690 } 2690 }
2691 if (nid) 2691 if (nid)
2692 knew->subdevice = (1<<31)|nid; 2692 knew->subdevice = HDA_SUBDEV_NID_FLAG | nid;
2693 return knew; 2693 return knew;
2694} 2694}
2695 2695
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 14219d898b2e..0c621d74b165 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -443,7 +443,7 @@ static int via_add_control(struct via_spec *spec, int type, const char *name,
443 if (!knew->name) 443 if (!knew->name)
444 return -ENOMEM; 444 return -ENOMEM;
445 if (get_amp_nid_(val)) 445 if (get_amp_nid_(val))
446 knew->subdevice = (1<<31)|get_amp_nid_(val); 446 knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val);
447 knew->private_value = val; 447 knew->private_value = val;
448 return 0; 448 return 0;
449} 449}