xref: /linux/sound/pci/hda/hda_generic.h (revision be602cde657ee43d23adbf309be6d700d0106dc9)
162810dbdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2352f7f91STakashi Iwai /*
3352f7f91STakashi Iwai  * Generic BIOS auto-parser helper functions for HD-audio
4352f7f91STakashi Iwai  *
5352f7f91STakashi Iwai  * Copyright (c) 2012 Takashi Iwai <tiwai@suse.de>
6352f7f91STakashi Iwai  */
7352f7f91STakashi Iwai 
8352f7f91STakashi Iwai #ifndef __SOUND_HDA_GENERIC_H
9352f7f91STakashi Iwai #define __SOUND_HDA_GENERIC_H
10352f7f91STakashi Iwai 
117cdf8c49STakashi Iwai #include <linux/leds.h>
1264e05321SRichard Fitzgerald #include "hda_auto_parser.h"
1364e05321SRichard Fitzgerald 
1464e05321SRichard Fitzgerald struct hda_jack_callback;
157cdf8c49STakashi Iwai 
16352f7f91STakashi Iwai /* table entry for multi-io paths */
17352f7f91STakashi Iwai struct hda_multi_io {
18352f7f91STakashi Iwai 	hda_nid_t pin;		/* multi-io widget pin NID */
19352f7f91STakashi Iwai 	hda_nid_t dac;		/* DAC to be connected */
20352f7f91STakashi Iwai 	unsigned int ctl_in;	/* cached input-pin control value */
21352f7f91STakashi Iwai };
22352f7f91STakashi Iwai 
23352f7f91STakashi Iwai /* Widget connection path
24352f7f91STakashi Iwai  *
25352f7f91STakashi Iwai  * For output, stored in the order of DAC -> ... -> pin,
26352f7f91STakashi Iwai  * for input, pin -> ... -> ADC.
27352f7f91STakashi Iwai  *
28352f7f91STakashi Iwai  * idx[i] contains the source index number to select on of the widget path[i];
29352f7f91STakashi Iwai  * e.g. idx[1] is the index of the DAC (path[0]) selected by path[1] widget
30352f7f91STakashi Iwai  * multi[] indicates whether it's a selector widget with multi-connectors
31352f7f91STakashi Iwai  * (i.e. the connection selection is mandatory)
32352f7f91STakashi Iwai  * vol_ctl and mute_ctl contains the NIDs for the assigned mixers
33352f7f91STakashi Iwai  */
34352f7f91STakashi Iwai 
35d94ddd85STakashi Iwai #define MAX_NID_PATH_DEPTH	10
36352f7f91STakashi Iwai 
37352f7f91STakashi Iwai enum {
38352f7f91STakashi Iwai 	NID_PATH_VOL_CTL,
39352f7f91STakashi Iwai 	NID_PATH_MUTE_CTL,
40352f7f91STakashi Iwai 	NID_PATH_BOOST_CTL,
41352f7f91STakashi Iwai 	NID_PATH_NUM_CTLS
42352f7f91STakashi Iwai };
43352f7f91STakashi Iwai 
44352f7f91STakashi Iwai struct nid_path {
45352f7f91STakashi Iwai 	int depth;
46352f7f91STakashi Iwai 	hda_nid_t path[MAX_NID_PATH_DEPTH];
47352f7f91STakashi Iwai 	unsigned char idx[MAX_NID_PATH_DEPTH];
48352f7f91STakashi Iwai 	unsigned char multi[MAX_NID_PATH_DEPTH];
49352f7f91STakashi Iwai 	unsigned int ctls[NID_PATH_NUM_CTLS]; /* NID_PATH_XXX_CTL */
50e6feb5d0STakashi Iwai 	bool active:1;		/* activated by driver */
51e6feb5d0STakashi Iwai 	bool pin_enabled:1;	/* pins are enabled */
526b275b14STakashi Iwai 	bool pin_fixed:1;	/* path with fixed pin */
53e6feb5d0STakashi Iwai 	bool stream_enabled:1;	/* stream is active */
54352f7f91STakashi Iwai };
55352f7f91STakashi Iwai 
56352f7f91STakashi Iwai /* mic/line-in auto switching entry */
57352f7f91STakashi Iwai 
58352f7f91STakashi Iwai #define MAX_AUTO_MIC_PINS	3
59352f7f91STakashi Iwai 
60352f7f91STakashi Iwai struct automic_entry {
61352f7f91STakashi Iwai 	hda_nid_t pin;		/* pin */
62352f7f91STakashi Iwai 	int idx;		/* imux index, -1 = invalid */
63352f7f91STakashi Iwai 	unsigned int attr;	/* pin attribute (INPUT_PIN_ATTR_*) */
64352f7f91STakashi Iwai };
65352f7f91STakashi Iwai 
6638cf6f1aSTakashi Iwai /* active stream id */
6738cf6f1aSTakashi Iwai enum { STREAM_MULTI_OUT, STREAM_INDEP_HP };
6838cf6f1aSTakashi Iwai 
69e6b85f3cSTakashi Iwai /* PCM hook action */
70e6b85f3cSTakashi Iwai enum {
71e6b85f3cSTakashi Iwai 	HDA_GEN_PCM_ACT_OPEN,
72e6b85f3cSTakashi Iwai 	HDA_GEN_PCM_ACT_PREPARE,
73e6b85f3cSTakashi Iwai 	HDA_GEN_PCM_ACT_CLEANUP,
74e6b85f3cSTakashi Iwai 	HDA_GEN_PCM_ACT_CLOSE,
75e6b85f3cSTakashi Iwai };
76e6b85f3cSTakashi Iwai 
7798bd1115STakashi Iwai /* DAC assignment badness table */
7898bd1115STakashi Iwai struct badness_table {
7998bd1115STakashi Iwai 	int no_primary_dac;	/* no primary DAC */
8098bd1115STakashi Iwai 	int no_dac;		/* no secondary DACs */
8198bd1115STakashi Iwai 	int shared_primary;	/* primary DAC is shared with main output */
8298bd1115STakashi Iwai 	int shared_surr;	/* secondary DAC shared with main or primary */
8398bd1115STakashi Iwai 	int shared_clfe;	/* third DAC shared with main or primary */
8498bd1115STakashi Iwai 	int shared_surr_main;	/* secondary DAC sahred with main/DAC0 */
8598bd1115STakashi Iwai };
8698bd1115STakashi Iwai 
8798bd1115STakashi Iwai extern const struct badness_table hda_main_out_badness;
8898bd1115STakashi Iwai extern const struct badness_table hda_extra_out_badness;
8998bd1115STakashi Iwai 
90352f7f91STakashi Iwai struct hda_gen_spec {
91352f7f91STakashi Iwai 	char stream_name_analog[32];	/* analog PCM stream */
92352f7f91STakashi Iwai 	const struct hda_pcm_stream *stream_analog_playback;
93352f7f91STakashi Iwai 	const struct hda_pcm_stream *stream_analog_capture;
94a607148fSTakashi Iwai 
95a607148fSTakashi Iwai 	char stream_name_alt_analog[32]; /* alternative analog PCM stream */
96352f7f91STakashi Iwai 	const struct hda_pcm_stream *stream_analog_alt_playback;
97352f7f91STakashi Iwai 	const struct hda_pcm_stream *stream_analog_alt_capture;
98352f7f91STakashi Iwai 
99352f7f91STakashi Iwai 	char stream_name_digital[32];	/* digital PCM stream */
100352f7f91STakashi Iwai 	const struct hda_pcm_stream *stream_digital_playback;
101352f7f91STakashi Iwai 	const struct hda_pcm_stream *stream_digital_capture;
102352f7f91STakashi Iwai 
10338cf6f1aSTakashi Iwai 	/* PCM */
10438cf6f1aSTakashi Iwai 	unsigned int active_streams;
10538cf6f1aSTakashi Iwai 	struct mutex pcm_mutex;
10638cf6f1aSTakashi Iwai 
107352f7f91STakashi Iwai 	/* playback */
108352f7f91STakashi Iwai 	struct hda_multi_out multiout;	/* playback set-up
109352f7f91STakashi Iwai 					 * max_channels, dacs must be set
110352f7f91STakashi Iwai 					 * dig_out_nid and hp_nid are optional
111352f7f91STakashi Iwai 					 */
112352f7f91STakashi Iwai 	hda_nid_t alt_dac_nid;
1139ab0cb30STakashi Iwai 	hda_nid_t follower_dig_outs[3];	/* optional - for auto-parsing */
114352f7f91STakashi Iwai 	int dig_out_type;
115352f7f91STakashi Iwai 
116352f7f91STakashi Iwai 	/* capture */
117352f7f91STakashi Iwai 	unsigned int num_adc_nids;
118cf799aa3STakashi Iwai 	hda_nid_t adc_nids[AUTO_CFG_MAX_INS];
119352f7f91STakashi Iwai 	hda_nid_t dig_in_nid;		/* digital-in NID; optional */
120352f7f91STakashi Iwai 	hda_nid_t mixer_nid;		/* analog-mixer NID */
121e4a395e7STakashi Iwai 	hda_nid_t mixer_merge_nid;	/* aamix merge-point NID (optional) */
122cf799aa3STakashi Iwai 	const char *input_labels[HDA_MAX_NUM_INPUTS];
123cf799aa3STakashi Iwai 	int input_label_idxs[HDA_MAX_NUM_INPUTS];
124352f7f91STakashi Iwai 
125352f7f91STakashi Iwai 	/* capture setup for dynamic dual-adc switch */
126352f7f91STakashi Iwai 	hda_nid_t cur_adc;
127352f7f91STakashi Iwai 	unsigned int cur_adc_stream_tag;
128352f7f91STakashi Iwai 	unsigned int cur_adc_format;
129352f7f91STakashi Iwai 
130352f7f91STakashi Iwai 	/* capture source */
131352f7f91STakashi Iwai 	struct hda_input_mux input_mux;
132352f7f91STakashi Iwai 	unsigned int cur_mux[3];
133352f7f91STakashi Iwai 
134352f7f91STakashi Iwai 	/* channel model */
135a07a949bSTakashi Iwai 	/* min_channel_count contains the minimum channel count for primary
136a07a949bSTakashi Iwai 	 * outputs.  When multi_ios is set, the channels can be configured
137a07a949bSTakashi Iwai 	 * between min_channel_count and (min_channel_count + multi_ios * 2).
138a07a949bSTakashi Iwai 	 *
139a07a949bSTakashi Iwai 	 * ext_channel_count contains the current channel count of the primary
140a07a949bSTakashi Iwai 	 * out.  This varies in the range above.
141a07a949bSTakashi Iwai 	 *
142a07a949bSTakashi Iwai 	 * Meanwhile, const_channel_count is the channel count for all outputs
143a07a949bSTakashi Iwai 	 * including headphone and speakers.  It's a constant value, and the
144a07a949bSTakashi Iwai 	 * PCM is set up as max(ext_channel_count, const_channel_count).
145a07a949bSTakashi Iwai 	 */
146a07a949bSTakashi Iwai 	int min_channel_count;		/* min. channel count for primary out */
147a07a949bSTakashi Iwai 	int ext_channel_count;		/* current channel count for primary */
148a07a949bSTakashi Iwai 	int const_channel_count;	/* channel count for all */
149352f7f91STakashi Iwai 
150352f7f91STakashi Iwai 	/* PCM information */
151bbbc7e85STakashi Iwai 	struct hda_pcm *pcm_rec[3];	/* used in build_pcms() */
152352f7f91STakashi Iwai 
153352f7f91STakashi Iwai 	/* dynamic controls, init_verbs and input_mux */
154352f7f91STakashi Iwai 	struct auto_pin_cfg autocfg;
155352f7f91STakashi Iwai 	struct snd_array kctls;
156352f7f91STakashi Iwai 	hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
157352f7f91STakashi Iwai 	hda_nid_t imux_pins[HDA_MAX_NUM_INPUTS];
158352f7f91STakashi Iwai 	unsigned int dyn_adc_idx[HDA_MAX_NUM_INPUTS];
159967303daSTakashi Iwai 	/* shared hp/mic */
160352f7f91STakashi Iwai 	hda_nid_t shared_mic_vref_pin;
161967303daSTakashi Iwai 	hda_nid_t hp_mic_pin;
162967303daSTakashi Iwai 	int hp_mic_mux_idx;
163352f7f91STakashi Iwai 
1640ffd534eSTakashi Iwai 	/* DAC/ADC lists */
165352f7f91STakashi Iwai 	int num_all_dacs;
166352f7f91STakashi Iwai 	hda_nid_t all_dacs[16];
1670ffd534eSTakashi Iwai 	int num_all_adcs;
168cf799aa3STakashi Iwai 	hda_nid_t all_adcs[AUTO_CFG_MAX_INS];
169352f7f91STakashi Iwai 
170352f7f91STakashi Iwai 	/* path list */
171352f7f91STakashi Iwai 	struct snd_array paths;
172352f7f91STakashi Iwai 
173196c1766STakashi Iwai 	/* path indices */
174196c1766STakashi Iwai 	int out_paths[AUTO_CFG_MAX_OUTS];
175196c1766STakashi Iwai 	int hp_paths[AUTO_CFG_MAX_OUTS];
176196c1766STakashi Iwai 	int speaker_paths[AUTO_CFG_MAX_OUTS];
177c30aa7b2STakashi Iwai 	int aamix_out_paths[3];
178196c1766STakashi Iwai 	int digout_paths[AUTO_CFG_MAX_OUTS];
179d3d982f7SDavid Henningsson 	int input_paths[HDA_MAX_NUM_INPUTS][AUTO_CFG_MAX_INS];
180196c1766STakashi Iwai 	int loopback_paths[HDA_MAX_NUM_INPUTS];
181e4a395e7STakashi Iwai 	int loopback_merge_path;
1822430d7b7STakashi Iwai 	int digin_path;
183196c1766STakashi Iwai 
184352f7f91STakashi Iwai 	/* auto-mic stuff */
185352f7f91STakashi Iwai 	int am_num_entries;
186352f7f91STakashi Iwai 	struct automic_entry am_entry[MAX_AUTO_MIC_PINS];
187352f7f91STakashi Iwai 
188352f7f91STakashi Iwai 	/* for pin sensing */
189d13a8f6dSChristophe JAILLET 	/* current status; set in hda_generic.c */
190352f7f91STakashi Iwai 	unsigned int hp_jack_present:1;
191352f7f91STakashi Iwai 	unsigned int line_jack_present:1;
192acc47aafSTakashi Iwai 	unsigned int speaker_muted:1; /* current status of speaker mute */
193acc47aafSTakashi Iwai 	unsigned int line_out_muted:1; /* current status of LO mute */
194acc47aafSTakashi Iwai 
195acc47aafSTakashi Iwai 	/* internal states of automute / autoswitch behavior */
196352f7f91STakashi Iwai 	unsigned int auto_mic:1;
197352f7f91STakashi Iwai 	unsigned int automute_speaker:1; /* automute speaker outputs */
198352f7f91STakashi Iwai 	unsigned int automute_lo:1; /* automute LO outputs */
199acc47aafSTakashi Iwai 
200acc47aafSTakashi Iwai 	/* capabilities detected by parser */
201352f7f91STakashi Iwai 	unsigned int detect_hp:1;	/* Headphone detection enabled */
202352f7f91STakashi Iwai 	unsigned int detect_lo:1;	/* Line-out detection enabled */
203352f7f91STakashi Iwai 	unsigned int automute_speaker_possible:1; /* there are speakers and either LO or HP */
204352f7f91STakashi Iwai 	unsigned int automute_lo_possible:1;	  /* there are line outs and HP */
205acc47aafSTakashi Iwai 
206acc47aafSTakashi Iwai 	/* additional parameters set by codec drivers */
207acc47aafSTakashi Iwai 	unsigned int master_mute:1;	/* master mute over all */
208352f7f91STakashi Iwai 	unsigned int keep_vref_in_automute:1; /* Don't clear VREF in automute */
209352f7f91STakashi Iwai 	unsigned int line_in_auto_switch:1; /* allow line-in auto switch */
2107eebffd3STakashi Iwai 	unsigned int auto_mute_via_amp:1; /* auto-mute via amp instead of pinctl */
211352f7f91STakashi Iwai 
212acc47aafSTakashi Iwai 	/* parser behavior flags; set before snd_hda_gen_parse_auto_config() */
213acc47aafSTakashi Iwai 	unsigned int suppress_auto_mute:1; /* suppress input jack auto mute */
214acc47aafSTakashi Iwai 	unsigned int suppress_auto_mic:1; /* suppress input jack auto switch */
215acc47aafSTakashi Iwai 
216acc47aafSTakashi Iwai 	/* other parse behavior flags */
217352f7f91STakashi Iwai 	unsigned int need_dac_fix:1; /* need to limit DACs for multi channels */
218967303daSTakashi Iwai 	unsigned int hp_mic:1; /* Allow HP as a mic-in */
219967303daSTakashi Iwai 	unsigned int suppress_hp_mic_detect:1; /* Don't detect HP/mic */
220352f7f91STakashi Iwai 	unsigned int no_primary_hp:1; /* Don't prefer HP pins to speaker pins */
221da96fb5bSTakashi Iwai 	unsigned int no_multi_io:1; /* Don't try multi I/O config */
222352f7f91STakashi Iwai 	unsigned int multi_cap_vol:1; /* allow multiple capture xxx volumes */
223352f7f91STakashi Iwai 	unsigned int inv_dmic_split:1; /* inverted dmic w/a for conexant */
224731dc301STakashi Iwai 	unsigned int own_eapd_ctl:1; /* set EAPD by own function */
22505909d5cSTakashi Iwai 	unsigned int keep_eapd_on:1; /* don't turn off EAPD automatically */
226e65bf997SJaroslav Kysela 	unsigned int vmaster_mute_led:1; /* add SPK-LED flag to vmaster mute switch */
227e65bf997SJaroslav Kysela 	unsigned int mic_mute_led:1; /* add MIC-LED flag to capture mute switch */
22838cf6f1aSTakashi Iwai 	unsigned int indep_hp:1; /* independent HP supported */
229ea46c3c8STakashi Iwai 	unsigned int prefer_hp_amp:1; /* enable HP amp for speaker if any */
23074f14b36STakashi Iwai 	unsigned int add_stereo_mix_input:2; /* add aamix as a capture src */
231f811c3cfSTakashi Iwai 	unsigned int add_jack_modes:1; /* add i/o jack mode enum ctls */
23255196fffSTakashi Iwai 	unsigned int power_down_unused:1; /* power down unused widgets */
233d89c6c0cSTakashi Iwai 	unsigned int dac_min_mute:1; /* minimal = mute for DACs */
2347480316cSTakashi Iwai 	unsigned int suppress_vmaster:1; /* don't create vmaster kctls */
235352f7f91STakashi Iwai 
236acc47aafSTakashi Iwai 	/* other internal flags */
237acc47aafSTakashi Iwai 	unsigned int no_analog:1; /* digital I/O only */
238acc47aafSTakashi Iwai 	unsigned int dyn_adc_switch:1; /* switch ADCs (for ALC275) */
239acc47aafSTakashi Iwai 	unsigned int indep_hp_enabled:1; /* independent HP enabled */
240a1e908edSTakashi Iwai 	unsigned int have_aamix_ctl:1;
2418ba955ceSTakashi Iwai 	unsigned int hp_mic_jack_modes:1;
24289781d08STakashi Iwai 	unsigned int skip_verbs:1; /* don't apply verbs at snd_hda_gen_init() */
243acc47aafSTakashi Iwai 
2447eebffd3STakashi Iwai 	/* additional mute flags (only effective with auto_mute_via_amp=1) */
2457eebffd3STakashi Iwai 	u64 mute_bits;
2467eebffd3STakashi Iwai 
247a1114a8cSTakashi Iwai 	/* bitmask for skipping volume controls */
248a1114a8cSTakashi Iwai 	u64 out_vol_mask;
249a1114a8cSTakashi Iwai 
25098bd1115STakashi Iwai 	/* badness tables for output path evaluations */
25198bd1115STakashi Iwai 	const struct badness_table *main_out_badness;
25298bd1115STakashi Iwai 	const struct badness_table *extra_out_badness;
25398bd1115STakashi Iwai 
2543690739bSTakashi Iwai 	/* preferred pin/DAC pairs; an array of paired NIDs */
2553690739bSTakashi Iwai 	const hda_nid_t *preferred_dacs;
2563690739bSTakashi Iwai 
257c30aa7b2STakashi Iwai 	/* loopback mixing mode */
258c30aa7b2STakashi Iwai 	bool aamix_mode;
259c30aa7b2STakashi Iwai 
2607504b6cdSTakashi Iwai 	/* digital beep */
2617504b6cdSTakashi Iwai 	hda_nid_t beep_nid;
2627504b6cdSTakashi Iwai 
263352f7f91STakashi Iwai 	/* for virtual master */
264352f7f91STakashi Iwai 	hda_nid_t vmaster_nid;
2657a71bbf3STakashi Iwai 	unsigned int vmaster_tlv[4];
266352f7f91STakashi Iwai 	struct hda_vmaster_mute_hook vmaster_mute;
26746a14481STakashi Iwai 
268352f7f91STakashi Iwai 	struct hda_loopback_check loopback;
2690186f4f4STakashi Iwai 	struct snd_array loopback_list;
270352f7f91STakashi Iwai 
271352f7f91STakashi Iwai 	/* multi-io */
272352f7f91STakashi Iwai 	int multi_ios;
273352f7f91STakashi Iwai 	struct hda_multi_io multi_io[4];
274352f7f91STakashi Iwai 
275352f7f91STakashi Iwai 	/* hooks */
276352f7f91STakashi Iwai 	void (*init_hook)(struct hda_codec *codec);
277352f7f91STakashi Iwai 	void (*automute_hook)(struct hda_codec *codec);
278a90229e0STakashi Iwai 	void (*cap_sync_hook)(struct hda_codec *codec,
2797fe30711STakashi Iwai 			      struct snd_kcontrol *kcontrol,
280a90229e0STakashi Iwai 			      struct snd_ctl_elem_value *ucontrol);
2812e03e952STakashi Iwai 
282ac2e8736STakashi Iwai 	/* PCM hooks */
283e6b85f3cSTakashi Iwai 	void (*pcm_playback_hook)(struct hda_pcm_stream *hinfo,
284e6b85f3cSTakashi Iwai 				  struct hda_codec *codec,
285e6b85f3cSTakashi Iwai 				  struct snd_pcm_substream *substream,
286e6b85f3cSTakashi Iwai 				  int action);
287ac2e8736STakashi Iwai 	void (*pcm_capture_hook)(struct hda_pcm_stream *hinfo,
288ac2e8736STakashi Iwai 				 struct hda_codec *codec,
289ac2e8736STakashi Iwai 				 struct snd_pcm_substream *substream,
290ac2e8736STakashi Iwai 				 int action);
291e6b85f3cSTakashi Iwai 
2922e03e952STakashi Iwai 	/* automute / autoswitch hooks */
2932e03e952STakashi Iwai 	void (*hp_automute_hook)(struct hda_codec *codec,
2941a4f69d5STakashi Iwai 				 struct hda_jack_callback *cb);
2952e03e952STakashi Iwai 	void (*line_automute_hook)(struct hda_codec *codec,
2961a4f69d5STakashi Iwai 				   struct hda_jack_callback *cb);
2972e03e952STakashi Iwai 	void (*mic_autoswitch_hook)(struct hda_codec *codec,
2981a4f69d5STakashi Iwai 				    struct hda_jack_callback *cb);
299549f8ffcSTakashi Iwai 
300549f8ffcSTakashi Iwai 	/* leds */
301549f8ffcSTakashi Iwai 	struct led_classdev *led_cdevs[NUM_AUDIO_LEDS];
302352f7f91STakashi Iwai };
303352f7f91STakashi Iwai 
30474f14b36STakashi Iwai /* values for add_stereo_mix_input flag */
30574f14b36STakashi Iwai enum {
30674f14b36STakashi Iwai 	HDA_HINT_STEREO_MIX_DISABLE,	/* No stereo mix input */
30774f14b36STakashi Iwai 	HDA_HINT_STEREO_MIX_ENABLE,	/* Add stereo mix input */
30874f14b36STakashi Iwai 	HDA_HINT_STEREO_MIX_AUTO,	/* Add only if auto-mic is disabled */
30974f14b36STakashi Iwai };
31074f14b36STakashi Iwai 
311352f7f91STakashi Iwai int snd_hda_gen_spec_init(struct hda_gen_spec *spec);
312352f7f91STakashi Iwai 
313352f7f91STakashi Iwai int snd_hda_gen_init(struct hda_codec *codec);
314fce52a3bSTakashi Iwai void snd_hda_gen_free(struct hda_codec *codec);
315352f7f91STakashi Iwai 
316196c1766STakashi Iwai int snd_hda_get_path_idx(struct hda_codec *codec, struct nid_path *path);
317196c1766STakashi Iwai struct nid_path *snd_hda_get_path_from_idx(struct hda_codec *codec, int idx);
318352f7f91STakashi Iwai struct nid_path *
319352f7f91STakashi Iwai snd_hda_add_new_path(struct hda_codec *codec, hda_nid_t from_nid,
3203ca529d3STakashi Iwai 		     hda_nid_t to_nid, int anchor_nid);
321352f7f91STakashi Iwai void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path,
322352f7f91STakashi Iwai 			   bool enable, bool add_aamix);
323352f7f91STakashi Iwai 
32412c93df6STakashi Iwai struct snd_kcontrol_new *
32512c93df6STakashi Iwai snd_hda_gen_add_kctl(struct hda_gen_spec *spec, const char *name,
32612c93df6STakashi Iwai 		     const struct snd_kcontrol_new *temp);
32712c93df6STakashi Iwai 
328352f7f91STakashi Iwai int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
3299eb413e5STakashi Iwai 				  struct auto_pin_cfg *cfg);
330352f7f91STakashi Iwai int snd_hda_gen_build_controls(struct hda_codec *codec);
331352f7f91STakashi Iwai int snd_hda_gen_build_pcms(struct hda_codec *codec);
332352f7f91STakashi Iwai 
3335d550e15STakashi Iwai /* standard jack event callbacks */
3345d550e15STakashi Iwai void snd_hda_gen_hp_automute(struct hda_codec *codec,
3351a4f69d5STakashi Iwai 			     struct hda_jack_callback *jack);
3365d550e15STakashi Iwai void snd_hda_gen_line_automute(struct hda_codec *codec,
3371a4f69d5STakashi Iwai 			       struct hda_jack_callback *jack);
3385d550e15STakashi Iwai void snd_hda_gen_mic_autoswitch(struct hda_codec *codec,
3391a4f69d5STakashi Iwai 				struct hda_jack_callback *jack);
3405d550e15STakashi Iwai void snd_hda_gen_update_outputs(struct hda_codec *codec);
3415d550e15STakashi Iwai 
342fce52a3bSTakashi Iwai int snd_hda_gen_check_power_status(struct hda_codec *codec, hda_nid_t nid);
343dfc6e469STakashi Iwai unsigned int snd_hda_gen_path_power_filter(struct hda_codec *codec,
344dfc6e469STakashi Iwai 					   hda_nid_t nid,
345dfc6e469STakashi Iwai 					   unsigned int power_state);
346e6feb5d0STakashi Iwai void snd_hda_gen_stream_pm(struct hda_codec *codec, hda_nid_t nid, bool on);
3476b275b14STakashi Iwai int snd_hda_gen_fix_pin_power(struct hda_codec *codec, hda_nid_t pin);
348fce52a3bSTakashi Iwai 
34915509b63STakashi Iwai int snd_hda_gen_add_mute_led_cdev(struct hda_codec *codec,
35015509b63STakashi Iwai 				  int (*callback)(struct led_classdev *,
35115509b63STakashi Iwai 						  enum led_brightness));
3527cdf8c49STakashi Iwai int snd_hda_gen_add_micmute_led_cdev(struct hda_codec *codec,
3537cdf8c49STakashi Iwai 				     int (*callback)(struct led_classdev *,
3547cdf8c49STakashi Iwai 						     enum led_brightness));
355*6cd23b26STakashi Iwai bool snd_hda_gen_shutup_speakers(struct hda_codec *codec);
356f567b788STakashi Iwai 
357352f7f91STakashi Iwai #endif /* __SOUND_HDA_GENERIC_H */
358