aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2009-12-08 11:45:25 -0500
committerJaroslav Kysela <perex@perex.cz>2009-12-15 03:33:17 -0500
commit9e3fd8719f624a43575b56a4777b1552399a8be8 (patch)
tree273a7f8a6e264eb74f966abb18f0a69608f62d88 /sound/pci/hda/hda_codec.c
parent5b0cb1d850c26893b1468b3a519433a1b7a176be (diff)
ALSA: hda - introduce HDA_SUBDEV_AMP_FLAG (ControlAmp in proc)
The purpose of this changeset is to show information about amplifier setting in the codec proc file. Something like: Control: name="Front Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Front Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 20100b1548e1..c9af15ed7f10 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1723,19 +1723,22 @@ EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl);
1723 * 1723 *
1724 * snd_hda_ctl_add() checks the control subdev id field whether 1724 * snd_hda_ctl_add() checks the control subdev id field whether
1725 * #HDA_SUBDEV_NID_FLAG bit is set. If set (and @nid is zero), the lower 1725 * #HDA_SUBDEV_NID_FLAG bit is set. If set (and @nid is zero), the lower
1726 * bits value is taken as the NID to assign. 1726 * bits value is taken as the NID to assign. The #HDA_NID_ITEM_AMP bit
1727 * specifies if kctl->private_value is a HDA amplifier value.
1727 */ 1728 */
1728int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid, 1729int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid,
1729 struct snd_kcontrol *kctl) 1730 struct snd_kcontrol *kctl)
1730{ 1731{
1731 int err; 1732 int err;
1733 unsigned short flags = 0;
1732 struct hda_nid_item *item; 1734 struct hda_nid_item *item;
1733 1735
1734 if (kctl->id.subdevice & HDA_SUBDEV_NID_FLAG) { 1736 if (kctl->id.subdevice & HDA_SUBDEV_AMP_FLAG)
1735 if (nid == 0) 1737 flags |= HDA_NID_ITEM_AMP;
1736 nid = kctl->id.subdevice & 0xffff; 1738 if ((kctl->id.subdevice & HDA_SUBDEV_NID_FLAG) != 0 && nid == 0)
1739 nid = kctl->id.subdevice & 0xffff;
1740 if (kctl->id.subdevice & 0xf0000000)
1737 kctl->id.subdevice = 0; 1741 kctl->id.subdevice = 0;
1738 }
1739 err = snd_ctl_add(codec->bus->card, kctl); 1742 err = snd_ctl_add(codec->bus->card, kctl);
1740 if (err < 0) 1743 if (err < 0)
1741 return err; 1744 return err;
@@ -1744,6 +1747,7 @@ int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid,
1744 return -ENOMEM; 1747 return -ENOMEM;
1745 item->kctl = kctl; 1748 item->kctl = kctl;
1746 item->nid = nid; 1749 item->nid = nid;
1750 item->flags = flags;
1747 return 0; 1751 return 0;
1748} 1752}
1749EXPORT_SYMBOL_HDA(snd_hda_ctl_add); 1753EXPORT_SYMBOL_HDA(snd_hda_ctl_add);