ALSA: hda - Add snd_hda_override_pin_caps() helper function
authorTakashi Iwai <tiwai@suse.de>
Mon, 15 Aug 2011 10:49:07 +0000 (12:49 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 15 Aug 2011 10:49:07 +0000 (12:49 +0200)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_local.h

index 2a8d447c8ed6f9dc8cc9ad707276f60f3e948bf3..83d3eb5e5552c7800e7fbb106a0140987d819f88 100644 (file)
@@ -1692,6 +1692,29 @@ u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid)
 }
 EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps);
 
+/**
+ * snd_hda_override_pin_caps - Override the pin capabilities
+ * @codec: the CODEC
+ * @nid: the NID to override
+ * @caps: the capability bits to set
+ *
+ * Override the cached PIN capabilitiy bits value by the given one.
+ *
+ * Returns zero if successful or a negative error code.
+ */
+int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid,
+                             unsigned int caps)
+{
+       struct hda_amp_info *info;
+       info = get_alloc_amp_hash(codec, HDA_HASH_PINCAP_KEY(nid));
+       if (!info)
+               return -ENOMEM;
+       info->amp_caps = caps;
+       info->head.val |= INFO_AMP_CAPS;
+       return 0;
+}
+EXPORT_SYMBOL_HDA(snd_hda_override_pin_caps);
+
 /**
  * snd_hda_pin_sense - execute pin sense measurement
  * @codec: the CODEC to sense
index 2e7ac31afa8df9b320c0e263c1754df5620c7357..9ed4b0dd6724af8f5fae97988913f506d92a2b5e 100644 (file)
@@ -492,6 +492,8 @@ u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction);
 int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
                              unsigned int caps);
 u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid);
+int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid,
+                             unsigned int caps);
 u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid);
 int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid);