aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-10-29 11:03:58 -0400
committerTakashi Iwai <tiwai@suse.de>2014-10-29 11:03:58 -0400
commit95a962c36f6e3c3edb438d1ba59e30964900d16a (patch)
treef3c12eab3e7196297f0114313f48134ceb2cea98
parenta11e9b168646cfc5d3b8d605d430d7e4ff267d72 (diff)
ALSA: hda - More kerneldoc comments
Put more kerneldoc comments to the exported functions. Still the generic parser code and the HD-audio controller code aren't covered yet, though. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_auto_parser.c51
-rw-r--r--sound/pci/hda/hda_beep.c38
-rw-r--r--sound/pci/hda/hda_codec.c148
-rw-r--r--sound/pci/hda/hda_jack.c39
-rw-r--r--sound/pci/hda/hda_jack.h5
-rw-r--r--sound/pci/hda/hda_sysfs.c35
6 files changed, 297 insertions, 19 deletions
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index 7388958b01af..1ede82200ee5 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -441,6 +441,13 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
441} 441}
442EXPORT_SYMBOL_GPL(snd_hda_parse_pin_defcfg); 442EXPORT_SYMBOL_GPL(snd_hda_parse_pin_defcfg);
443 443
444/**
445 * snd_hda_get_input_pin_attr - Get the input pin attribute from pin config
446 * @def_conf: pin configuration value
447 *
448 * Guess the input pin attribute (INPUT_PIN_ATTR_XXX) from the given
449 * default pin configuration value.
450 */
444int snd_hda_get_input_pin_attr(unsigned int def_conf) 451int snd_hda_get_input_pin_attr(unsigned int def_conf)
445{ 452{
446 unsigned int loc = get_defcfg_location(def_conf); 453 unsigned int loc = get_defcfg_location(def_conf);
@@ -473,7 +480,6 @@ EXPORT_SYMBOL_GPL(snd_hda_get_input_pin_attr);
473 * for mic and line-in pins, and set an appropriate prefix like "Front", 480 * for mic and line-in pins, and set an appropriate prefix like "Front",
474 * "Rear", "Internal". 481 * "Rear", "Internal".
475 */ 482 */
476
477static const char *hda_get_input_pin_label(struct hda_codec *codec, 483static const char *hda_get_input_pin_label(struct hda_codec *codec,
478 const struct auto_pin_cfg_item *item, 484 const struct auto_pin_cfg_item *item,
479 hda_nid_t pin, bool check_location) 485 hda_nid_t pin, bool check_location)
@@ -761,6 +767,14 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
761} 767}
762EXPORT_SYMBOL_GPL(snd_hda_get_pin_label); 768EXPORT_SYMBOL_GPL(snd_hda_get_pin_label);
763 769
770/**
771 * snd_hda_add_verbs - Add verbs to the init list
772 * @codec: the HDA codec
773 * @list: zero-terminated verb list to add
774 *
775 * Append the given verb list to the execution list. The verbs will be
776 * performed at init and resume time via snd_hda_apply_verbs().
777 */
764int snd_hda_add_verbs(struct hda_codec *codec, 778int snd_hda_add_verbs(struct hda_codec *codec,
765 const struct hda_verb *list) 779 const struct hda_verb *list)
766{ 780{
@@ -773,6 +787,10 @@ int snd_hda_add_verbs(struct hda_codec *codec,
773} 787}
774EXPORT_SYMBOL_GPL(snd_hda_add_verbs); 788EXPORT_SYMBOL_GPL(snd_hda_add_verbs);
775 789
790/**
791 * snd_hda_apply_verbs - Execute the init verb lists
792 * @codec: the HDA codec
793 */
776void snd_hda_apply_verbs(struct hda_codec *codec) 794void snd_hda_apply_verbs(struct hda_codec *codec)
777{ 795{
778 int i; 796 int i;
@@ -783,6 +801,11 @@ void snd_hda_apply_verbs(struct hda_codec *codec)
783} 801}
784EXPORT_SYMBOL_GPL(snd_hda_apply_verbs); 802EXPORT_SYMBOL_GPL(snd_hda_apply_verbs);
785 803
804/**
805 * snd_hda_apply_pincfgs - Set each pin config in the given list
806 * @codec: the HDA codec
807 * @cfg: NULL-terminated pin config table
808 */
786void snd_hda_apply_pincfgs(struct hda_codec *codec, 809void snd_hda_apply_pincfgs(struct hda_codec *codec,
787 const struct hda_pintbl *cfg) 810 const struct hda_pintbl *cfg)
788{ 811{
@@ -850,6 +873,11 @@ static void apply_fixup(struct hda_codec *codec, int id, int action, int depth)
850 } 873 }
851} 874}
852 875
876/**
877 * snd_hda_apply_fixup - Apply the fixup chain with the given action
878 * @codec: the HDA codec
879 * @action: fixup action (HDA_FIXUP_ACT_XXX)
880 */
853void snd_hda_apply_fixup(struct hda_codec *codec, int action) 881void snd_hda_apply_fixup(struct hda_codec *codec, int action)
854{ 882{
855 if (codec->fixup_list) 883 if (codec->fixup_list)
@@ -868,6 +896,12 @@ static bool pin_config_match(struct hda_codec *codec,
868 return true; 896 return true;
869} 897}
870 898
899/**
900 * snd_hda_pick_pin_fixup - Pick up a fixup matching with the pin quirk list
901 * @codec: the HDA codec
902 * @pin_quirk: zero-terminated pin quirk list
903 * @fixlist: the fixup list
904 */
871void snd_hda_pick_pin_fixup(struct hda_codec *codec, 905void snd_hda_pick_pin_fixup(struct hda_codec *codec,
872 const struct snd_hda_pin_quirk *pin_quirk, 906 const struct snd_hda_pin_quirk *pin_quirk,
873 const struct hda_fixup *fixlist) 907 const struct hda_fixup *fixlist)
@@ -894,6 +928,21 @@ void snd_hda_pick_pin_fixup(struct hda_codec *codec,
894} 928}
895EXPORT_SYMBOL_GPL(snd_hda_pick_pin_fixup); 929EXPORT_SYMBOL_GPL(snd_hda_pick_pin_fixup);
896 930
931/**
932 * snd_hda_pick_fixup - Pick up a fixup matching with PCI/codec SSID or model string
933 * @codec: the HDA codec
934 * @models: NULL-terminated model string list
935 * @quirk: zero-terminated PCI/codec SSID quirk list
936 * @fixlist: the fixup list
937 *
938 * Pick up a fixup entry matching with the given model string or SSID.
939 * If a fixup was already set beforehand, the function doesn't do anything.
940 * When a special model string "nofixup" is given, also no fixup is applied.
941 *
942 * The function tries to find the matching model name at first, if given.
943 * If nothing matched, try to look up the PCI SSID.
944 * If still nothing matched, try to look up the codec SSID.
945 */
897void snd_hda_pick_fixup(struct hda_codec *codec, 946void snd_hda_pick_fixup(struct hda_codec *codec,
898 const struct hda_model_fixup *models, 947 const struct hda_model_fixup *models,
899 const struct snd_pci_quirk *quirk, 948 const struct snd_pci_quirk *quirk,
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 8c6c50afc0b7..1e7de08e77cb 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -175,6 +175,11 @@ static int snd_hda_do_attach(struct hda_beep *beep)
175 return 0; 175 return 0;
176} 176}
177 177
178/**
179 * snd_hda_enable_beep_device - Turn on/off beep sound
180 * @codec: the HDA codec
181 * @enable: flag to turn on/off
182 */
178int snd_hda_enable_beep_device(struct hda_codec *codec, int enable) 183int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
179{ 184{
180 struct hda_beep *beep = codec->beep; 185 struct hda_beep *beep = codec->beep;
@@ -191,6 +196,20 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
191} 196}
192EXPORT_SYMBOL_GPL(snd_hda_enable_beep_device); 197EXPORT_SYMBOL_GPL(snd_hda_enable_beep_device);
193 198
199/**
200 * snd_hda_attach_beep_device - Attach a beep input device
201 * @codec: the HDA codec
202 * @nid: beep NID
203 *
204 * Attach a beep object to the given widget. If beep hint is turned off
205 * explicitly or beep_mode of the codec is turned off, this doesn't nothing.
206 *
207 * The attached beep device has to be registered via
208 * snd_hda_register_beep_device() and released via snd_hda_detach_beep_device()
209 * appropriately.
210 *
211 * Currently, only one beep device is allowed to each codec.
212 */
194int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) 213int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
195{ 214{
196 struct hda_beep *beep; 215 struct hda_beep *beep;
@@ -228,6 +247,10 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
228} 247}
229EXPORT_SYMBOL_GPL(snd_hda_attach_beep_device); 248EXPORT_SYMBOL_GPL(snd_hda_attach_beep_device);
230 249
250/**
251 * snd_hda_detach_beep_device - Detach the beep device
252 * @codec: the HDA codec
253 */
231void snd_hda_detach_beep_device(struct hda_codec *codec) 254void snd_hda_detach_beep_device(struct hda_codec *codec)
232{ 255{
233 struct hda_beep *beep = codec->beep; 256 struct hda_beep *beep = codec->beep;
@@ -240,6 +263,10 @@ void snd_hda_detach_beep_device(struct hda_codec *codec)
240} 263}
241EXPORT_SYMBOL_GPL(snd_hda_detach_beep_device); 264EXPORT_SYMBOL_GPL(snd_hda_detach_beep_device);
242 265
266/**
267 * snd_hda_register_beep_device - Register the beep device
268 * @codec: the HDA codec
269 */
243int snd_hda_register_beep_device(struct hda_codec *codec) 270int snd_hda_register_beep_device(struct hda_codec *codec)
244{ 271{
245 struct hda_beep *beep = codec->beep; 272 struct hda_beep *beep = codec->beep;
@@ -269,6 +296,12 @@ static bool ctl_has_mute(struct snd_kcontrol *kcontrol)
269} 296}
270 297
271/* get/put callbacks for beep mute mixer switches */ 298/* get/put callbacks for beep mute mixer switches */
299
300/**
301 * snd_hda_mixer_amp_switch_get_beep - Get callback for beep controls
302 * @kcontrol: ctl element
303 * @ucontrol: pointer to get/store the data
304 */
272int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol, 305int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol,
273 struct snd_ctl_elem_value *ucontrol) 306 struct snd_ctl_elem_value *ucontrol)
274{ 307{
@@ -283,6 +316,11 @@ int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol,
283} 316}
284EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_get_beep); 317EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_get_beep);
285 318
319/**
320 * snd_hda_mixer_amp_switch_put_beep - Put callback for beep controls
321 * @kcontrol: ctl element
322 * @ucontrol: pointer to get/store the data
323 */
286int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol, 324int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol,
287 struct snd_ctl_elem_value *ucontrol) 325 struct snd_ctl_elem_value *ucontrol)
288{ 326{
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index e15254204c72..ca98f5209f8f 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -77,6 +77,10 @@ static struct hda_vendor_id hda_vendor_ids[] = {
77static DEFINE_MUTEX(preset_mutex); 77static DEFINE_MUTEX(preset_mutex);
78static LIST_HEAD(hda_preset_tables); 78static LIST_HEAD(hda_preset_tables);
79 79
80/**
81 * snd_hda_add_codec_preset - Add a codec preset to the chain
82 * @preset: codec preset table to add
83 */
80int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset) 84int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset)
81{ 85{
82 mutex_lock(&preset_mutex); 86 mutex_lock(&preset_mutex);
@@ -86,6 +90,10 @@ int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset)
86} 90}
87EXPORT_SYMBOL_GPL(snd_hda_add_codec_preset); 91EXPORT_SYMBOL_GPL(snd_hda_add_codec_preset);
88 92
93/**
94 * snd_hda_delete_codec_preset - Delete a codec preset from the chain
95 * @preset: codec preset table to delete
96 */
89int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset) 97int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset)
90{ 98{
91 mutex_lock(&preset_mutex); 99 mutex_lock(&preset_mutex);
@@ -1187,7 +1195,16 @@ unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid)
1187} 1195}
1188EXPORT_SYMBOL_GPL(snd_hda_codec_get_pincfg); 1196EXPORT_SYMBOL_GPL(snd_hda_codec_get_pincfg);
1189 1197
1190/* remember the current pinctl target value */ 1198/**
1199 * snd_hda_codec_set_pin_target - remember the current pinctl target value
1200 * @codec: the HDA codec
1201 * @nid: pin NID
1202 * @val: assigned pinctl value
1203 *
1204 * This function stores the given value to a pinctl target value in the
1205 * pincfg table. This isn't always as same as the actually written value
1206 * but can be referred at any time via snd_hda_codec_get_pin_target().
1207 */
1191int snd_hda_codec_set_pin_target(struct hda_codec *codec, hda_nid_t nid, 1208int snd_hda_codec_set_pin_target(struct hda_codec *codec, hda_nid_t nid,
1192 unsigned int val) 1209 unsigned int val)
1193{ 1210{
@@ -1201,7 +1218,11 @@ int snd_hda_codec_set_pin_target(struct hda_codec *codec, hda_nid_t nid,
1201} 1218}
1202EXPORT_SYMBOL_GPL(snd_hda_codec_set_pin_target); 1219EXPORT_SYMBOL_GPL(snd_hda_codec_set_pin_target);
1203 1220
1204/* return the current pinctl target value */ 1221/**
1222 * snd_hda_codec_get_pin_target - return the current pinctl target value
1223 * @codec: the HDA codec
1224 * @nid: pin NID
1225 */
1205int snd_hda_codec_get_pin_target(struct hda_codec *codec, hda_nid_t nid) 1226int snd_hda_codec_get_pin_target(struct hda_codec *codec, hda_nid_t nid)
1206{ 1227{
1207 struct hda_pincfg *pin; 1228 struct hda_pincfg *pin;
@@ -1573,6 +1594,13 @@ int snd_hda_codec_new(struct hda_bus *bus,
1573} 1594}
1574EXPORT_SYMBOL_GPL(snd_hda_codec_new); 1595EXPORT_SYMBOL_GPL(snd_hda_codec_new);
1575 1596
1597/**
1598 * snd_hda_codec_update_widgets - Refresh widget caps and pin defaults
1599 * @codec: the HDA codec
1600 *
1601 * Forcibly refresh the all widget caps and the init pin configurations of
1602 * the given codec.
1603 */
1576int snd_hda_codec_update_widgets(struct hda_codec *codec) 1604int snd_hda_codec_update_widgets(struct hda_codec *codec)
1577{ 1605{
1578 hda_nid_t fg; 1606 hda_nid_t fg;
@@ -2239,7 +2267,17 @@ int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid,
2239} 2267}
2240EXPORT_SYMBOL_GPL(snd_hda_codec_amp_stereo); 2268EXPORT_SYMBOL_GPL(snd_hda_codec_amp_stereo);
2241 2269
2242/* Works like snd_hda_codec_amp_update() but it writes the value only at 2270/**
2271 * snd_hda_codec_amp_init - initialize the AMP value
2272 * @codec: the HDA codec
2273 * @nid: NID to read the AMP value
2274 * @ch: channel (left=0 or right=1)
2275 * @dir: #HDA_INPUT or #HDA_OUTPUT
2276 * @idx: the index value (only for input direction)
2277 * @mask: bit mask to set
2278 * @val: the bits value to set
2279 *
2280 * Works like snd_hda_codec_amp_update() but it writes the value only at
2243 * the first access. If the amp was already initialized / updated beforehand, 2281 * the first access. If the amp was already initialized / updated beforehand,
2244 * this does nothing. 2282 * this does nothing.
2245 */ 2283 */
@@ -2250,6 +2288,17 @@ int snd_hda_codec_amp_init(struct hda_codec *codec, hda_nid_t nid, int ch,
2250} 2288}
2251EXPORT_SYMBOL_GPL(snd_hda_codec_amp_init); 2289EXPORT_SYMBOL_GPL(snd_hda_codec_amp_init);
2252 2290
2291/**
2292 * snd_hda_codec_amp_init_stereo - initialize the stereo AMP value
2293 * @codec: the HDA codec
2294 * @nid: NID to read the AMP value
2295 * @dir: #HDA_INPUT or #HDA_OUTPUT
2296 * @idx: the index value (only for input direction)
2297 * @mask: bit mask to set
2298 * @val: the bits value to set
2299 *
2300 * Call snd_hda_codec_amp_init() for both stereo channels.
2301 */
2253int snd_hda_codec_amp_init_stereo(struct hda_codec *codec, hda_nid_t nid, 2302int snd_hda_codec_amp_init_stereo(struct hda_codec *codec, hda_nid_t nid,
2254 int dir, int idx, int mask, int val) 2303 int dir, int idx, int mask, int val)
2255{ 2304{
@@ -2644,7 +2693,10 @@ void snd_hda_ctls_clear(struct hda_codec *codec)
2644 snd_array_free(&codec->nids); 2693 snd_array_free(&codec->nids);
2645} 2694}
2646 2695
2647/* pseudo device locking 2696/**
2697 * snd_hda_lock_devices - pseudo device locking
2698 * @bus: the BUS
2699 *
2648 * toggle card->shutdown to allow/disallow the device access (as a hack) 2700 * toggle card->shutdown to allow/disallow the device access (as a hack)
2649 */ 2701 */
2650int snd_hda_lock_devices(struct hda_bus *bus) 2702int snd_hda_lock_devices(struct hda_bus *bus)
@@ -2681,6 +2733,10 @@ int snd_hda_lock_devices(struct hda_bus *bus)
2681} 2733}
2682EXPORT_SYMBOL_GPL(snd_hda_lock_devices); 2734EXPORT_SYMBOL_GPL(snd_hda_lock_devices);
2683 2735
2736/**
2737 * snd_hda_unlock_devices - pseudo device unlocking
2738 * @bus: the BUS
2739 */
2684void snd_hda_unlock_devices(struct hda_bus *bus) 2740void snd_hda_unlock_devices(struct hda_bus *bus)
2685{ 2741{
2686 struct snd_card *card = bus->card; 2742 struct snd_card *card = bus->card;
@@ -2867,7 +2923,7 @@ static int add_slave(struct hda_codec *codec,
2867} 2923}
2868 2924
2869/** 2925/**
2870 * snd_hda_add_vmaster - create a virtual master control and add slaves 2926 * __snd_hda_add_vmaster - create a virtual master control and add slaves
2871 * @codec: HD-audio codec 2927 * @codec: HD-audio codec
2872 * @name: vmaster control name 2928 * @name: vmaster control name
2873 * @tlv: TLV data (optional) 2929 * @tlv: TLV data (optional)
@@ -2970,10 +3026,15 @@ static struct snd_kcontrol_new vmaster_mute_mode = {
2970 .put = vmaster_mute_mode_put, 3026 .put = vmaster_mute_mode_put,
2971}; 3027};
2972 3028
2973/* 3029/**
2974 * Add a mute-LED hook with the given vmaster switch kctl 3030 * snd_hda_add_vmaster_hook - Add a vmaster hook for mute-LED
2975 * "Mute-LED Mode" control is automatically created and associated with 3031 * @codec: the HDA codec
2976 * the given hook. 3032 * @hook: the vmaster hook object
3033 * @expose_enum_ctl: flag to create an enum ctl
3034 *
3035 * Add a mute-LED hook with the given vmaster switch kctl.
3036 * When @expose_enum_ctl is set, "Mute-LED Mode" control is automatically
3037 * created and associated with the given hook.
2977 */ 3038 */
2978int snd_hda_add_vmaster_hook(struct hda_codec *codec, 3039int snd_hda_add_vmaster_hook(struct hda_codec *codec,
2979 struct hda_vmaster_mute_hook *hook, 3040 struct hda_vmaster_mute_hook *hook,
@@ -2995,9 +3056,12 @@ int snd_hda_add_vmaster_hook(struct hda_codec *codec,
2995} 3056}
2996EXPORT_SYMBOL_GPL(snd_hda_add_vmaster_hook); 3057EXPORT_SYMBOL_GPL(snd_hda_add_vmaster_hook);
2997 3058
2998/* 3059/**
2999 * Call the hook with the current value for synchronization 3060 * snd_hda_sync_vmaster_hook - Sync vmaster hook
3000 * Should be called in init callback 3061 * @hook: the vmaster hook
3062 *
3063 * Call the hook with the current value for synchronization.
3064 * Should be called in init callback.
3001 */ 3065 */
3002void snd_hda_sync_vmaster_hook(struct hda_vmaster_mute_hook *hook) 3066void snd_hda_sync_vmaster_hook(struct hda_vmaster_mute_hook *hook)
3003{ 3067{
@@ -3599,7 +3663,11 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
3599} 3663}
3600EXPORT_SYMBOL_GPL(snd_hda_create_dig_out_ctls); 3664EXPORT_SYMBOL_GPL(snd_hda_create_dig_out_ctls);
3601 3665
3602/* get the hda_spdif_out entry from the given NID 3666/**
3667 * snd_hda_spdif_out_of_nid - get the hda_spdif_out entry from the given NID
3668 * @codec: the HDA codec
3669 * @nid: widget NID
3670 *
3603 * call within spdif_mutex lock 3671 * call within spdif_mutex lock
3604 */ 3672 */
3605struct hda_spdif_out *snd_hda_spdif_out_of_nid(struct hda_codec *codec, 3673struct hda_spdif_out *snd_hda_spdif_out_of_nid(struct hda_codec *codec,
@@ -3616,6 +3684,13 @@ struct hda_spdif_out *snd_hda_spdif_out_of_nid(struct hda_codec *codec,
3616} 3684}
3617EXPORT_SYMBOL_GPL(snd_hda_spdif_out_of_nid); 3685EXPORT_SYMBOL_GPL(snd_hda_spdif_out_of_nid);
3618 3686
3687/**
3688 * snd_hda_spdif_ctls_unassign - Unassign the given SPDIF ctl
3689 * @codec: the HDA codec
3690 * @idx: the SPDIF ctl index
3691 *
3692 * Unassign the widget from the given SPDIF control.
3693 */
3619void snd_hda_spdif_ctls_unassign(struct hda_codec *codec, int idx) 3694void snd_hda_spdif_ctls_unassign(struct hda_codec *codec, int idx)
3620{ 3695{
3621 struct hda_spdif_out *spdif; 3696 struct hda_spdif_out *spdif;
@@ -3627,6 +3702,14 @@ void snd_hda_spdif_ctls_unassign(struct hda_codec *codec, int idx)
3627} 3702}
3628EXPORT_SYMBOL_GPL(snd_hda_spdif_ctls_unassign); 3703EXPORT_SYMBOL_GPL(snd_hda_spdif_ctls_unassign);
3629 3704
3705/**
3706 * snd_hda_spdif_ctls_assign - Assign the SPDIF controls to the given NID
3707 * @codec: the HDA codec
3708 * @idx: the SPDIF ctl idx
3709 * @nid: widget NID
3710 *
3711 * Assign the widget to the SPDIF control with the given index.
3712 */
3630void snd_hda_spdif_ctls_assign(struct hda_codec *codec, int idx, hda_nid_t nid) 3713void snd_hda_spdif_ctls_assign(struct hda_codec *codec, int idx, hda_nid_t nid)
3631{ 3714{
3632 struct hda_spdif_out *spdif; 3715 struct hda_spdif_out *spdif;
@@ -3946,6 +4029,16 @@ void snd_hda_codec_flush_cache(struct hda_codec *codec)
3946} 4029}
3947EXPORT_SYMBOL_GPL(snd_hda_codec_flush_cache); 4030EXPORT_SYMBOL_GPL(snd_hda_codec_flush_cache);
3948 4031
4032/**
4033 * snd_hda_codec_set_power_to_all - Set the power state to all widgets
4034 * @codec: the HDA codec
4035 * @fg: function group (not used now)
4036 * @power_state: the power state to set (AC_PWRST_*)
4037 *
4038 * Set the given power state to all widgets that have the power control.
4039 * If the codec has power_filter set, it evaluates the power state and
4040 * filter out if it's unchanged as D3.
4041 */
3949void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg, 4042void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg,
3950 unsigned int power_state) 4043 unsigned int power_state)
3951{ 4044{
@@ -4010,7 +4103,15 @@ static unsigned int hda_sync_power_state(struct hda_codec *codec,
4010 return state; 4103 return state;
4011} 4104}
4012 4105
4013/* don't power down the widget if it controls eapd and EAPD_BTLENABLE is set */ 4106/**
4107 * snd_hda_codec_eapd_power_filter - A power filter callback for EAPD
4108 * @codec: the HDA codec
4109 * @nid: widget NID
4110 * @power_state: power state to evalue
4111 *
4112 * Don't power down the widget if it controls eapd and EAPD_BTLENABLE is set.
4113 * This can be used a codec power_filter callback.
4114 */
4014unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec, 4115unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec,
4015 hda_nid_t nid, 4116 hda_nid_t nid,
4016 unsigned int power_state) 4117 unsigned int power_state)
@@ -4671,6 +4772,17 @@ static int set_pcm_default_values(struct hda_codec *codec,
4671/* 4772/*
4672 * codec prepare/cleanup entries 4773 * codec prepare/cleanup entries
4673 */ 4774 */
4775/**
4776 * snd_hda_codec_prepare - Prepare a stream
4777 * @codec: the HDA codec
4778 * @hinfo: PCM information
4779 * @stream: stream tag to assign
4780 * @format: format id to assign
4781 * @substream: PCM substream to assign
4782 *
4783 * Calls the prepare callback set by the codec with the given arguments.
4784 * Clean up the inactive streams when successful.
4785 */
4674int snd_hda_codec_prepare(struct hda_codec *codec, 4786int snd_hda_codec_prepare(struct hda_codec *codec,
4675 struct hda_pcm_stream *hinfo, 4787 struct hda_pcm_stream *hinfo,
4676 unsigned int stream, 4788 unsigned int stream,
@@ -4687,6 +4799,14 @@ int snd_hda_codec_prepare(struct hda_codec *codec,
4687} 4799}
4688EXPORT_SYMBOL_GPL(snd_hda_codec_prepare); 4800EXPORT_SYMBOL_GPL(snd_hda_codec_prepare);
4689 4801
4802/**
4803 * snd_hda_codec_cleanup - Prepare a stream
4804 * @codec: the HDA codec
4805 * @hinfo: PCM information
4806 * @substream: PCM substream
4807 *
4808 * Calls the cleanup callback set by the codec with the given arguments.
4809 */
4690void snd_hda_codec_cleanup(struct hda_codec *codec, 4810void snd_hda_codec_cleanup(struct hda_codec *codec,
4691 struct hda_pcm_stream *hinfo, 4811 struct hda_pcm_stream *hinfo,
4692 struct snd_pcm_substream *substream) 4812 struct snd_pcm_substream *substream)
diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c
index b2d81ab22fb0..e664307617bd 100644
--- a/sound/pci/hda/hda_jack.c
+++ b/sound/pci/hda/hda_jack.c
@@ -20,6 +20,16 @@
20#include "hda_auto_parser.h" 20#include "hda_auto_parser.h"
21#include "hda_jack.h" 21#include "hda_jack.h"
22 22
23/**
24 * is_jack_detectable - Check whether the given pin is jack-detectable
25 * @codec: the HDA codec
26 * @nid: pin NID
27 *
28 * Check whether the given pin is capable to report the jack detection.
29 * The jack detection might not work by various reasons, e.g. the jack
30 * detection is prohibited in the codec level, the pin config has
31 * AC_DEFCFG_MISC_NO_PRESENCE bit, no unsol support, etc.
32 */
23bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) 33bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
24{ 34{
25 if (codec->no_jack_detect) 35 if (codec->no_jack_detect)
@@ -268,6 +278,14 @@ snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid,
268} 278}
269EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable_callback); 279EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable_callback);
270 280
281/**
282 * snd_hda_jack_detect_enable - Enable the jack detection on the given pin
283 * @codec: the HDA codec
284 * @nid: pin NID to enable jack detection
285 *
286 * Enable the jack detection with the default callback. Returns zero if
287 * successful or a negative error code.
288 */
271int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid) 289int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid)
272{ 290{
273 return PTR_ERR_OR_ZERO(snd_hda_jack_detect_enable_callback(codec, nid, NULL)); 291 return PTR_ERR_OR_ZERO(snd_hda_jack_detect_enable_callback(codec, nid, NULL));
@@ -410,6 +428,15 @@ static int __snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
410 return 0; 428 return 0;
411} 429}
412 430
431/**
432 * snd_hda_jack_add_kctl - Add a jack kctl for the given pin
433 * @codec: the HDA codec
434 * @nid: pin NID
435 * @name: the name string for the jack ctl
436 * @idx: the ctl index for the jack ctl
437 *
438 * This is a simple helper calling __snd_hda_jack_add_kctl().
439 */
413int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, 440int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
414 const char *name, int idx) 441 const char *name, int idx)
415{ 442{
@@ -552,6 +579,11 @@ static void call_jack_callback(struct hda_codec *codec,
552 } 579 }
553} 580}
554 581
582/**
583 * snd_hda_jack_unsol_event - Handle an unsolicited event
584 * @codec: the HDA codec
585 * @res: the unsolicited event data
586 */
555void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res) 587void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res)
556{ 588{
557 struct hda_jack_tbl *event; 589 struct hda_jack_tbl *event;
@@ -567,6 +599,13 @@ void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res)
567} 599}
568EXPORT_SYMBOL_GPL(snd_hda_jack_unsol_event); 600EXPORT_SYMBOL_GPL(snd_hda_jack_unsol_event);
569 601
602/**
603 * snd_hda_jack_poll_all - Poll all jacks
604 * @codec: the HDA codec
605 *
606 * Poll all detectable jacks with dirty flag, update the status, call
607 * callbacks and call snd_hda_jack_report_sync() if any changes are found.
608 */
570void snd_hda_jack_poll_all(struct hda_codec *codec) 609void snd_hda_jack_poll_all(struct hda_codec *codec)
571{ 610{
572 struct hda_jack_tbl *jack = codec->jacktbl.list; 611 struct hda_jack_tbl *jack = codec->jacktbl.list;
diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h
index 13cb375454f6..b279e327a23b 100644
--- a/sound/pci/hda/hda_jack.h
+++ b/sound/pci/hda/hda_jack.h
@@ -72,6 +72,11 @@ enum {
72 72
73int snd_hda_jack_detect_state(struct hda_codec *codec, hda_nid_t nid); 73int snd_hda_jack_detect_state(struct hda_codec *codec, hda_nid_t nid);
74 74
75/**
76 * snd_hda_jack_detect - Detect the jack
77 * @codec: the HDA codec
78 * @nid: pin NID to check jack detection
79 */
75static inline bool snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) 80static inline bool snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid)
76{ 81{
77 return snd_hda_jack_detect_state(codec, nid) != HDA_JACK_NOT_PRESENT; 82 return snd_hda_jack_detect_state(codec, nid) != HDA_JACK_NOT_PRESENT;
diff --git a/sound/pci/hda/hda_sysfs.c b/sound/pci/hda/hda_sysfs.c
index 9b49f156a12e..bef721592c3a 100644
--- a/sound/pci/hda/hda_sysfs.c
+++ b/sound/pci/hda/hda_sysfs.c
@@ -417,8 +417,13 @@ static DEVICE_ATTR_RW(user_pin_configs);
417static DEVICE_ATTR_WO(reconfig); 417static DEVICE_ATTR_WO(reconfig);
418static DEVICE_ATTR_WO(clear); 418static DEVICE_ATTR_WO(clear);
419 419
420/* 420/**
421 * Look for hint string 421 * snd_hda_get_hint - Look for hint string
422 * @codec: the HDA codec
423 * @key: the hint key string
424 *
425 * Look for a hint key/value pair matching with the given key string
426 * and returns the value string. If nothing found, returns NULL.
422 */ 427 */
423const char *snd_hda_get_hint(struct hda_codec *codec, const char *key) 428const char *snd_hda_get_hint(struct hda_codec *codec, const char *key)
424{ 429{
@@ -427,6 +432,15 @@ const char *snd_hda_get_hint(struct hda_codec *codec, const char *key)
427} 432}
428EXPORT_SYMBOL_GPL(snd_hda_get_hint); 433EXPORT_SYMBOL_GPL(snd_hda_get_hint);
429 434
435/**
436 * snd_hda_get_bool_hint - Get a boolean hint value
437 * @codec: the HDA codec
438 * @key: the hint key string
439 *
440 * Look for a hint key/value pair matching with the given key string
441 * and returns a boolean value parsed from the value. If no matching
442 * key is found, return a negative value.
443 */
430int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key) 444int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key)
431{ 445{
432 const char *p; 446 const char *p;
@@ -453,6 +467,16 @@ int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key)
453} 467}
454EXPORT_SYMBOL_GPL(snd_hda_get_bool_hint); 468EXPORT_SYMBOL_GPL(snd_hda_get_bool_hint);
455 469
470/**
471 * snd_hda_get_bool_hint - Get a boolean hint value
472 * @codec: the HDA codec
473 * @key: the hint key string
474 * @valp: pointer to store a value
475 *
476 * Look for a hint key/value pair matching with the given key string
477 * and stores the integer value to @valp. If no matching key is found,
478 * return a negative error code. Otherwise it returns zero.
479 */
456int snd_hda_get_int_hint(struct hda_codec *codec, const char *key, int *valp) 480int snd_hda_get_int_hint(struct hda_codec *codec, const char *key, int *valp)
457{ 481{
458 const char *p; 482 const char *p;
@@ -690,8 +714,11 @@ static int get_line_from_fw(char *buf, int size, size_t *fw_size_p,
690 return 1; 714 return 1;
691} 715}
692 716
693/* 717/**
694 * load a "patch" firmware file and parse it 718 * snd_hda_load_patch - load a "patch" firmware file and parse it
719 * @bus: HD-audio bus
720 * @fw_size: the firmware byte size
721 * @fw_buf: the firmware data
695 */ 722 */
696int snd_hda_load_patch(struct hda_bus *bus, size_t fw_size, const void *fw_buf) 723int snd_hda_load_patch(struct hda_bus *bus, size_t fw_size, const void *fw_buf)
697{ 724{