xref: /linux/sound/pci/hda/hda_generic.h (revision 242d990c158d5b1dabd166516e21992baef5f26a)
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>
127cdf8c49STakashi Iwai 
13352f7f91STakashi Iwai /* table entry for multi-io paths */
14352f7f91STakashi Iwai struct hda_multi_io {
15352f7f91STakashi Iwai 	hda_nid_t pin;		/* multi-io widget pin NID */
16352f7f91STakashi Iwai 	hda_nid_t dac;		/* DAC to be connected */
17352f7f91STakashi Iwai 	unsigned int ctl_in;	/* cached input-pin control value */
18352f7f91STakashi Iwai };
19352f7f91STakashi Iwai 
20352f7f91STakashi Iwai /* Widget connection path
21352f7f91STakashi Iwai  *
22352f7f91STakashi Iwai  * For output, stored in the order of DAC -> ... -> pin,
23352f7f91STakashi Iwai  * for input, pin -> ... -> ADC.
24352f7f91STakashi Iwai  *
25352f7f91STakashi Iwai  * idx[i] contains the source index number to select on of the widget path[i];
26352f7f91STakashi Iwai  * e.g. idx[1] is the index of the DAC (path[0]) selected by path[1] widget
27352f7f91STakashi Iwai  * multi[] indicates whether it's a selector widget with multi-connectors
28352f7f91STakashi Iwai  * (i.e. the connection selection is mandatory)
29352f7f91STakashi Iwai  * vol_ctl and mute_ctl contains the NIDs for the assigned mixers
30352f7f91STakashi Iwai  */
31352f7f91STakashi Iwai 
32d94ddd85STakashi Iwai #define MAX_NID_PATH_DEPTH	10
33352f7f91STakashi Iwai 
34352f7f91STakashi Iwai enum {
35352f7f91STakashi Iwai 	NID_PATH_VOL_CTL,
36352f7f91STakashi Iwai 	NID_PATH_MUTE_CTL,
37352f7f91STakashi Iwai 	NID_PATH_BOOST_CTL,
38352f7f91STakashi Iwai 	NID_PATH_NUM_CTLS
39352f7f91STakashi Iwai };
40352f7f91STakashi Iwai 
41352f7f91STakashi Iwai struct nid_path {
42352f7f91STakashi Iwai 	int depth;
43352f7f91STakashi Iwai 	hda_nid_t path[MAX_NID_PATH_DEPTH];
44352f7f91STakashi Iwai 	unsigned char idx[MAX_NID_PATH_DEPTH];
45352f7f91STakashi Iwai 	unsigned char multi[MAX_NID_PATH_DEPTH];
46352f7f91STakashi Iwai 	unsigned int ctls[NID_PATH_NUM_CTLS]; /* NID_PATH_XXX_CTL */
47e6feb5d0STakashi Iwai 	bool active:1;		/* activated by driver */
48e6feb5d0STakashi Iwai 	bool pin_enabled:1;	/* pins are enabled */
496b275b14STakashi Iwai 	bool pin_fixed:1;	/* path with fixed pin */
50e6feb5d0STakashi Iwai 	bool stream_enabled:1;	/* stream is active */
51352f7f91STakashi Iwai };
52352f7f91STakashi Iwai 
53352f7f91STakashi Iwai /* mic/line-in auto switching entry */
54352f7f91STakashi Iwai 
55352f7f91STakashi Iwai #define MAX_AUTO_MIC_PINS	3
56352f7f91STakashi Iwai 
57352f7f91STakashi Iwai struct automic_entry {
58352f7f91STakashi Iwai 	hda_nid_t pin;		/* pin */
59352f7f91STakashi Iwai 	int idx;		/* imux index, -1 = invalid */
60352f7f91STakashi Iwai 	unsigned int attr;	/* pin attribute (INPUT_PIN_ATTR_*) */
61352f7f91STakashi Iwai };
62352f7f91STakashi Iwai 
6338cf6f1aSTakashi Iwai /* active stream id */
6438cf6f1aSTakashi Iwai enum { STREAM_MULTI_OUT, STREAM_INDEP_HP };
6538cf6f1aSTakashi Iwai 
66e6b85f3cSTakashi Iwai /* PCM hook action */
67e6b85f3cSTakashi Iwai enum {
68e6b85f3cSTakashi Iwai 	HDA_GEN_PCM_ACT_OPEN,
69e6b85f3cSTakashi Iwai 	HDA_GEN_PCM_ACT_PREPARE,
70e6b85f3cSTakashi Iwai 	HDA_GEN_PCM_ACT_CLEANUP,
71e6b85f3cSTakashi Iwai 	HDA_GEN_PCM_ACT_CLOSE,
72e6b85f3cSTakashi Iwai };
73e6b85f3cSTakashi Iwai 
7498bd1115STakashi Iwai /* DAC assignment badness table */
7598bd1115STakashi Iwai struct badness_table {
7698bd1115STakashi Iwai 	int no_primary_dac;	/* no primary DAC */
7798bd1115STakashi Iwai 	int no_dac;		/* no secondary DACs */
7898bd1115STakashi Iwai 	int shared_primary;	/* primary DAC is shared with main output */
7998bd1115STakashi Iwai 	int shared_surr;	/* secondary DAC shared with main or primary */
8098bd1115STakashi Iwai 	int shared_clfe;	/* third DAC shared with main or primary */
8198bd1115STakashi Iwai 	int shared_surr_main;	/* secondary DAC sahred with main/DAC0 */
8298bd1115STakashi Iwai };
8398bd1115STakashi Iwai 
8498bd1115STakashi Iwai extern const struct badness_table hda_main_out_badness;
8598bd1115STakashi Iwai extern const struct badness_table hda_extra_out_badness;
8698bd1115STakashi Iwai 
87f567b788STakashi Iwai struct hda_micmute_hook {
88f567b788STakashi Iwai 	unsigned int led_mode;
89f567b788STakashi Iwai 	unsigned int capture;
90f567b788STakashi Iwai 	unsigned int led_value;
91f567b788STakashi Iwai 	void (*old_hook)(struct hda_codec *codec,
92f567b788STakashi Iwai 			 struct snd_kcontrol *kcontrol,
93f567b788STakashi Iwai 			 struct snd_ctl_elem_value *ucontrol);
94f567b788STakashi Iwai };
95f567b788STakashi Iwai 
96352f7f91STakashi Iwai struct hda_gen_spec {
97352f7f91STakashi Iwai 	char stream_name_analog[32];	/* analog PCM stream */
98352f7f91STakashi Iwai 	const struct hda_pcm_stream *stream_analog_playback;
99352f7f91STakashi Iwai 	const struct hda_pcm_stream *stream_analog_capture;
100a607148fSTakashi Iwai 
101a607148fSTakashi Iwai 	char stream_name_alt_analog[32]; /* alternative analog PCM stream */
102352f7f91STakashi Iwai 	const struct hda_pcm_stream *stream_analog_alt_playback;
103352f7f91STakashi Iwai 	const struct hda_pcm_stream *stream_analog_alt_capture;
104352f7f91STakashi Iwai 
105352f7f91STakashi Iwai 	char stream_name_digital[32];	/* digital PCM stream */
106352f7f91STakashi Iwai 	const struct hda_pcm_stream *stream_digital_playback;
107352f7f91STakashi Iwai 	const struct hda_pcm_stream *stream_digital_capture;
108352f7f91STakashi Iwai 
10938cf6f1aSTakashi Iwai 	/* PCM */
11038cf6f1aSTakashi Iwai 	unsigned int active_streams;
11138cf6f1aSTakashi Iwai 	struct mutex pcm_mutex;
11238cf6f1aSTakashi Iwai 
113352f7f91STakashi Iwai 	/* playback */
114352f7f91STakashi Iwai 	struct hda_multi_out multiout;	/* playback set-up
115352f7f91STakashi Iwai 					 * max_channels, dacs must be set
116352f7f91STakashi Iwai 					 * dig_out_nid and hp_nid are optional
117352f7f91STakashi Iwai 					 */
118352f7f91STakashi Iwai 	hda_nid_t alt_dac_nid;
1199ab0cb30STakashi Iwai 	hda_nid_t follower_dig_outs[3];	/* optional - for auto-parsing */
120352f7f91STakashi Iwai 	int dig_out_type;
121352f7f91STakashi Iwai 
122352f7f91STakashi Iwai 	/* capture */
123352f7f91STakashi Iwai 	unsigned int num_adc_nids;
124cf799aa3STakashi Iwai 	hda_nid_t adc_nids[AUTO_CFG_MAX_INS];
125352f7f91STakashi Iwai 	hda_nid_t dig_in_nid;		/* digital-in NID; optional */
126352f7f91STakashi Iwai 	hda_nid_t mixer_nid;		/* analog-mixer NID */
127e4a395e7STakashi Iwai 	hda_nid_t mixer_merge_nid;	/* aamix merge-point NID (optional) */
128cf799aa3STakashi Iwai 	const char *input_labels[HDA_MAX_NUM_INPUTS];
129cf799aa3STakashi Iwai 	int input_label_idxs[HDA_MAX_NUM_INPUTS];
130352f7f91STakashi Iwai 
131352f7f91STakashi Iwai 	/* capture setup for dynamic dual-adc switch */
132352f7f91STakashi Iwai 	hda_nid_t cur_adc;
133352f7f91STakashi Iwai 	unsigned int cur_adc_stream_tag;
134352f7f91STakashi Iwai 	unsigned int cur_adc_format;
135352f7f91STakashi Iwai 
136352f7f91STakashi Iwai 	/* capture source */
137352f7f91STakashi Iwai 	struct hda_input_mux input_mux;
138352f7f91STakashi Iwai 	unsigned int cur_mux[3];
139352f7f91STakashi Iwai 
140352f7f91STakashi Iwai 	/* channel model */
141a07a949bSTakashi Iwai 	/* min_channel_count contains the minimum channel count for primary
142a07a949bSTakashi Iwai 	 * outputs.  When multi_ios is set, the channels can be configured
143a07a949bSTakashi Iwai 	 * between min_channel_count and (min_channel_count + multi_ios * 2).
144a07a949bSTakashi Iwai 	 *
145a07a949bSTakashi Iwai 	 * ext_channel_count contains the current channel count of the primary
146a07a949bSTakashi Iwai 	 * out.  This varies in the range above.
147a07a949bSTakashi Iwai 	 *
148a07a949bSTakashi Iwai 	 * Meanwhile, const_channel_count is the channel count for all outputs
149a07a949bSTakashi Iwai 	 * including headphone and speakers.  It's a constant value, and the
150a07a949bSTakashi Iwai 	 * PCM is set up as max(ext_channel_count, const_channel_count).
151a07a949bSTakashi Iwai 	 */
152a07a949bSTakashi Iwai 	int min_channel_count;		/* min. channel count for primary out */
153a07a949bSTakashi Iwai 	int ext_channel_count;		/* current channel count for primary */
154a07a949bSTakashi Iwai 	int const_channel_count;	/* channel count for all */
155352f7f91STakashi Iwai 
156352f7f91STakashi Iwai 	/* PCM information */
157bbbc7e85STakashi Iwai 	struct hda_pcm *pcm_rec[3];	/* used in build_pcms() */
158352f7f91STakashi Iwai 
159352f7f91STakashi Iwai 	/* dynamic controls, init_verbs and input_mux */
160352f7f91STakashi Iwai 	struct auto_pin_cfg autocfg;
161352f7f91STakashi Iwai 	struct snd_array kctls;
162352f7f91STakashi Iwai 	hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
163352f7f91STakashi Iwai 	hda_nid_t imux_pins[HDA_MAX_NUM_INPUTS];
164352f7f91STakashi Iwai 	unsigned int dyn_adc_idx[HDA_MAX_NUM_INPUTS];
165967303daSTakashi Iwai 	/* shared hp/mic */
166352f7f91STakashi Iwai 	hda_nid_t shared_mic_vref_pin;
167967303daSTakashi Iwai 	hda_nid_t hp_mic_pin;
168967303daSTakashi Iwai 	int hp_mic_mux_idx;
169352f7f91STakashi Iwai 
1700ffd534eSTakashi Iwai 	/* DAC/ADC lists */
171352f7f91STakashi Iwai 	int num_all_dacs;
172352f7f91STakashi Iwai 	hda_nid_t all_dacs[16];
1730ffd534eSTakashi Iwai 	int num_all_adcs;
174cf799aa3STakashi Iwai 	hda_nid_t all_adcs[AUTO_CFG_MAX_INS];
175352f7f91STakashi Iwai 
176352f7f91STakashi Iwai 	/* path list */
177352f7f91STakashi Iwai 	struct snd_array paths;
178352f7f91STakashi Iwai 
179196c1766STakashi Iwai 	/* path indices */
180196c1766STakashi Iwai 	int out_paths[AUTO_CFG_MAX_OUTS];
181196c1766STakashi Iwai 	int hp_paths[AUTO_CFG_MAX_OUTS];
182196c1766STakashi Iwai 	int speaker_paths[AUTO_CFG_MAX_OUTS];
183c30aa7b2STakashi Iwai 	int aamix_out_paths[3];
184196c1766STakashi Iwai 	int digout_paths[AUTO_CFG_MAX_OUTS];
185d3d982f7SDavid Henningsson 	int input_paths[HDA_MAX_NUM_INPUTS][AUTO_CFG_MAX_INS];
186196c1766STakashi Iwai 	int loopback_paths[HDA_MAX_NUM_INPUTS];
187e4a395e7STakashi Iwai 	int loopback_merge_path;
1882430d7b7STakashi Iwai 	int digin_path;
189196c1766STakashi Iwai 
190352f7f91STakashi Iwai 	/* auto-mic stuff */
191352f7f91STakashi Iwai 	int am_num_entries;
192352f7f91STakashi Iwai 	struct automic_entry am_entry[MAX_AUTO_MIC_PINS];
193352f7f91STakashi Iwai 
194352f7f91STakashi Iwai 	/* for pin sensing */
195acc47aafSTakashi Iwai 	/* current status; set in hda_geneic.c */
196352f7f91STakashi Iwai 	unsigned int hp_jack_present:1;
197352f7f91STakashi Iwai 	unsigned int line_jack_present:1;
198acc47aafSTakashi Iwai 	unsigned int speaker_muted:1; /* current status of speaker mute */
199acc47aafSTakashi Iwai 	unsigned int line_out_muted:1; /* current status of LO mute */
200acc47aafSTakashi Iwai 
201acc47aafSTakashi Iwai 	/* internal states of automute / autoswitch behavior */
202352f7f91STakashi Iwai 	unsigned int auto_mic:1;
203352f7f91STakashi Iwai 	unsigned int automute_speaker:1; /* automute speaker outputs */
204352f7f91STakashi Iwai 	unsigned int automute_lo:1; /* automute LO outputs */
205acc47aafSTakashi Iwai 
206acc47aafSTakashi Iwai 	/* capabilities detected by parser */
207352f7f91STakashi Iwai 	unsigned int detect_hp:1;	/* Headphone detection enabled */
208352f7f91STakashi Iwai 	unsigned int detect_lo:1;	/* Line-out detection enabled */
209352f7f91STakashi Iwai 	unsigned int automute_speaker_possible:1; /* there are speakers and either LO or HP */
210352f7f91STakashi Iwai 	unsigned int automute_lo_possible:1;	  /* there are line outs and HP */
211acc47aafSTakashi Iwai 
212acc47aafSTakashi Iwai 	/* additional parameters set by codec drivers */
213acc47aafSTakashi Iwai 	unsigned int master_mute:1;	/* master mute over all */
214352f7f91STakashi Iwai 	unsigned int keep_vref_in_automute:1; /* Don't clear VREF in automute */
215352f7f91STakashi Iwai 	unsigned int line_in_auto_switch:1; /* allow line-in auto switch */
2167eebffd3STakashi Iwai 	unsigned int auto_mute_via_amp:1; /* auto-mute via amp instead of pinctl */
217352f7f91STakashi Iwai 
218acc47aafSTakashi Iwai 	/* parser behavior flags; set before snd_hda_gen_parse_auto_config() */
219acc47aafSTakashi Iwai 	unsigned int suppress_auto_mute:1; /* suppress input jack auto mute */
220acc47aafSTakashi Iwai 	unsigned int suppress_auto_mic:1; /* suppress input jack auto switch */
221acc47aafSTakashi Iwai 
222acc47aafSTakashi Iwai 	/* other parse behavior flags */
223352f7f91STakashi Iwai 	unsigned int need_dac_fix:1; /* need to limit DACs for multi channels */
224967303daSTakashi Iwai 	unsigned int hp_mic:1; /* Allow HP as a mic-in */
225967303daSTakashi Iwai 	unsigned int suppress_hp_mic_detect:1; /* Don't detect HP/mic */
226352f7f91STakashi Iwai 	unsigned int no_primary_hp:1; /* Don't prefer HP pins to speaker pins */
227da96fb5bSTakashi Iwai 	unsigned int no_multi_io:1; /* Don't try multi I/O config */
228352f7f91STakashi Iwai 	unsigned int multi_cap_vol:1; /* allow multiple capture xxx volumes */
229352f7f91STakashi Iwai 	unsigned int inv_dmic_split:1; /* inverted dmic w/a for conexant */
230731dc301STakashi Iwai 	unsigned int own_eapd_ctl:1; /* set EAPD by own function */
23105909d5cSTakashi Iwai 	unsigned int keep_eapd_on:1; /* don't turn off EAPD automatically */
232fd25a97aSTakashi Iwai 	unsigned int vmaster_mute_enum:1; /* add vmaster mute mode enum */
23338cf6f1aSTakashi Iwai 	unsigned int indep_hp:1; /* independent HP supported */
234ea46c3c8STakashi Iwai 	unsigned int prefer_hp_amp:1; /* enable HP amp for speaker if any */
23574f14b36STakashi Iwai 	unsigned int add_stereo_mix_input:2; /* add aamix as a capture src */
236f811c3cfSTakashi Iwai 	unsigned int add_jack_modes:1; /* add i/o jack mode enum ctls */
23755196fffSTakashi Iwai 	unsigned int power_down_unused:1; /* power down unused widgets */
238d89c6c0cSTakashi Iwai 	unsigned int dac_min_mute:1; /* minimal = mute for DACs */
2397480316cSTakashi Iwai 	unsigned int suppress_vmaster:1; /* don't create vmaster kctls */
240*242d990cSTakashi Iwai 	unsigned int obey_preferred_dacs:1; /* obey preferred_dacs assignment */
241352f7f91STakashi Iwai 
242acc47aafSTakashi Iwai 	/* other internal flags */
243acc47aafSTakashi Iwai 	unsigned int no_analog:1; /* digital I/O only */
244acc47aafSTakashi Iwai 	unsigned int dyn_adc_switch:1; /* switch ADCs (for ALC275) */
245acc47aafSTakashi Iwai 	unsigned int indep_hp_enabled:1; /* independent HP enabled */
246a1e908edSTakashi Iwai 	unsigned int have_aamix_ctl:1;
2478ba955ceSTakashi Iwai 	unsigned int hp_mic_jack_modes:1;
24889781d08STakashi Iwai 	unsigned int skip_verbs:1; /* don't apply verbs at snd_hda_gen_init() */
249acc47aafSTakashi Iwai 
2507eebffd3STakashi Iwai 	/* additional mute flags (only effective with auto_mute_via_amp=1) */
2517eebffd3STakashi Iwai 	u64 mute_bits;
2527eebffd3STakashi Iwai 
253a1114a8cSTakashi Iwai 	/* bitmask for skipping volume controls */
254a1114a8cSTakashi Iwai 	u64 out_vol_mask;
255a1114a8cSTakashi Iwai 
25698bd1115STakashi Iwai 	/* badness tables for output path evaluations */
25798bd1115STakashi Iwai 	const struct badness_table *main_out_badness;
25898bd1115STakashi Iwai 	const struct badness_table *extra_out_badness;
25998bd1115STakashi Iwai 
2603690739bSTakashi Iwai 	/* preferred pin/DAC pairs; an array of paired NIDs */
2613690739bSTakashi Iwai 	const hda_nid_t *preferred_dacs;
2623690739bSTakashi Iwai 
263c30aa7b2STakashi Iwai 	/* loopback mixing mode */
264c30aa7b2STakashi Iwai 	bool aamix_mode;
265c30aa7b2STakashi Iwai 
2667504b6cdSTakashi Iwai 	/* digital beep */
2677504b6cdSTakashi Iwai 	hda_nid_t beep_nid;
2687504b6cdSTakashi Iwai 
269352f7f91STakashi Iwai 	/* for virtual master */
270352f7f91STakashi Iwai 	hda_nid_t vmaster_nid;
2717a71bbf3STakashi Iwai 	unsigned int vmaster_tlv[4];
272352f7f91STakashi Iwai 	struct hda_vmaster_mute_hook vmaster_mute;
27346a14481STakashi Iwai 
274352f7f91STakashi Iwai 	struct hda_loopback_check loopback;
2750186f4f4STakashi Iwai 	struct snd_array loopback_list;
276352f7f91STakashi Iwai 
277352f7f91STakashi Iwai 	/* multi-io */
278352f7f91STakashi Iwai 	int multi_ios;
279352f7f91STakashi Iwai 	struct hda_multi_io multi_io[4];
280352f7f91STakashi Iwai 
281352f7f91STakashi Iwai 	/* hooks */
282352f7f91STakashi Iwai 	void (*init_hook)(struct hda_codec *codec);
283352f7f91STakashi Iwai 	void (*automute_hook)(struct hda_codec *codec);
284a90229e0STakashi Iwai 	void (*cap_sync_hook)(struct hda_codec *codec,
2857fe30711STakashi Iwai 			      struct snd_kcontrol *kcontrol,
286a90229e0STakashi Iwai 			      struct snd_ctl_elem_value *ucontrol);
2872e03e952STakashi Iwai 
288f567b788STakashi Iwai 	/* mic mute LED hook; called via cap_sync_hook */
289f567b788STakashi Iwai 	struct hda_micmute_hook micmute_led;
290f567b788STakashi Iwai 
291ac2e8736STakashi Iwai 	/* PCM hooks */
292e6b85f3cSTakashi Iwai 	void (*pcm_playback_hook)(struct hda_pcm_stream *hinfo,
293e6b85f3cSTakashi Iwai 				  struct hda_codec *codec,
294e6b85f3cSTakashi Iwai 				  struct snd_pcm_substream *substream,
295e6b85f3cSTakashi Iwai 				  int action);
296ac2e8736STakashi Iwai 	void (*pcm_capture_hook)(struct hda_pcm_stream *hinfo,
297ac2e8736STakashi Iwai 				 struct hda_codec *codec,
298ac2e8736STakashi Iwai 				 struct snd_pcm_substream *substream,
299ac2e8736STakashi Iwai 				 int action);
300e6b85f3cSTakashi Iwai 
3012e03e952STakashi Iwai 	/* automute / autoswitch hooks */
3022e03e952STakashi Iwai 	void (*hp_automute_hook)(struct hda_codec *codec,
3031a4f69d5STakashi Iwai 				 struct hda_jack_callback *cb);
3042e03e952STakashi Iwai 	void (*line_automute_hook)(struct hda_codec *codec,
3051a4f69d5STakashi Iwai 				   struct hda_jack_callback *cb);
3062e03e952STakashi Iwai 	void (*mic_autoswitch_hook)(struct hda_codec *codec,
3071a4f69d5STakashi Iwai 				    struct hda_jack_callback *cb);
308352f7f91STakashi Iwai };
309352f7f91STakashi Iwai 
31074f14b36STakashi Iwai /* values for add_stereo_mix_input flag */
31174f14b36STakashi Iwai enum {
31274f14b36STakashi Iwai 	HDA_HINT_STEREO_MIX_DISABLE,	/* No stereo mix input */
31374f14b36STakashi Iwai 	HDA_HINT_STEREO_MIX_ENABLE,	/* Add stereo mix input */
31474f14b36STakashi Iwai 	HDA_HINT_STEREO_MIX_AUTO,	/* Add only if auto-mic is disabled */
31574f14b36STakashi Iwai };
31674f14b36STakashi Iwai 
317352f7f91STakashi Iwai int snd_hda_gen_spec_init(struct hda_gen_spec *spec);
318352f7f91STakashi Iwai 
319352f7f91STakashi Iwai int snd_hda_gen_init(struct hda_codec *codec);
320fce52a3bSTakashi Iwai void snd_hda_gen_free(struct hda_codec *codec);
321352f7f91STakashi Iwai 
322196c1766STakashi Iwai int snd_hda_get_path_idx(struct hda_codec *codec, struct nid_path *path);
323196c1766STakashi Iwai struct nid_path *snd_hda_get_path_from_idx(struct hda_codec *codec, int idx);
324352f7f91STakashi Iwai struct nid_path *
325352f7f91STakashi Iwai snd_hda_add_new_path(struct hda_codec *codec, hda_nid_t from_nid,
3263ca529d3STakashi Iwai 		     hda_nid_t to_nid, int anchor_nid);
327352f7f91STakashi Iwai void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path,
328352f7f91STakashi Iwai 			   bool enable, bool add_aamix);
329352f7f91STakashi Iwai 
33012c93df6STakashi Iwai struct snd_kcontrol_new *
33112c93df6STakashi Iwai snd_hda_gen_add_kctl(struct hda_gen_spec *spec, const char *name,
33212c93df6STakashi Iwai 		     const struct snd_kcontrol_new *temp);
33312c93df6STakashi Iwai 
334352f7f91STakashi Iwai int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
3359eb413e5STakashi Iwai 				  struct auto_pin_cfg *cfg);
336352f7f91STakashi Iwai int snd_hda_gen_build_controls(struct hda_codec *codec);
337352f7f91STakashi Iwai int snd_hda_gen_build_pcms(struct hda_codec *codec);
338871b9066SHui Wang void snd_hda_gen_reboot_notify(struct hda_codec *codec);
339352f7f91STakashi Iwai 
3405d550e15STakashi Iwai /* standard jack event callbacks */
3415d550e15STakashi Iwai void snd_hda_gen_hp_automute(struct hda_codec *codec,
3421a4f69d5STakashi Iwai 			     struct hda_jack_callback *jack);
3435d550e15STakashi Iwai void snd_hda_gen_line_automute(struct hda_codec *codec,
3441a4f69d5STakashi Iwai 			       struct hda_jack_callback *jack);
3455d550e15STakashi Iwai void snd_hda_gen_mic_autoswitch(struct hda_codec *codec,
3461a4f69d5STakashi Iwai 				struct hda_jack_callback *jack);
3475d550e15STakashi Iwai void snd_hda_gen_update_outputs(struct hda_codec *codec);
3485d550e15STakashi Iwai 
349fce52a3bSTakashi Iwai #ifdef CONFIG_PM
350fce52a3bSTakashi Iwai int snd_hda_gen_check_power_status(struct hda_codec *codec, hda_nid_t nid);
351fce52a3bSTakashi Iwai #endif
352dfc6e469STakashi Iwai unsigned int snd_hda_gen_path_power_filter(struct hda_codec *codec,
353dfc6e469STakashi Iwai 					   hda_nid_t nid,
354dfc6e469STakashi Iwai 					   unsigned int power_state);
355e6feb5d0STakashi Iwai void snd_hda_gen_stream_pm(struct hda_codec *codec, hda_nid_t nid, bool on);
3566b275b14STakashi Iwai int snd_hda_gen_fix_pin_power(struct hda_codec *codec, hda_nid_t pin);
357fce52a3bSTakashi Iwai 
35815509b63STakashi Iwai int snd_hda_gen_add_mute_led_cdev(struct hda_codec *codec,
35915509b63STakashi Iwai 				  int (*callback)(struct led_classdev *,
36015509b63STakashi Iwai 						  enum led_brightness));
3617cdf8c49STakashi Iwai int snd_hda_gen_add_micmute_led_cdev(struct hda_codec *codec,
3627cdf8c49STakashi Iwai 				     int (*callback)(struct led_classdev *,
3637cdf8c49STakashi Iwai 						     enum led_brightness));
364f567b788STakashi Iwai 
365352f7f91STakashi Iwai #endif /* __SOUND_HDA_GENERIC_H */
366