xref: /linux/sound/pci/hda/hda_generic.h (revision 6c8fd349)
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>
12*64e05321SRichard Fitzgerald #include "hda_auto_parser.h"
13*64e05321SRichard Fitzgerald 
14*64e05321SRichard 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 */
235242d990cSTakashi Iwai 	unsigned int obey_preferred_dacs:1; /* obey preferred_dacs assignment */
236352f7f91STakashi Iwai 
237acc47aafSTakashi Iwai 	/* other internal flags */
238acc47aafSTakashi Iwai 	unsigned int no_analog:1; /* digital I/O only */
239acc47aafSTakashi Iwai 	unsigned int dyn_adc_switch:1; /* switch ADCs (for ALC275) */
240acc47aafSTakashi Iwai 	unsigned int indep_hp_enabled:1; /* independent HP enabled */
241a1e908edSTakashi Iwai 	unsigned int have_aamix_ctl:1;
2428ba955ceSTakashi Iwai 	unsigned int hp_mic_jack_modes:1;
24389781d08STakashi Iwai 	unsigned int skip_verbs:1; /* don't apply verbs at snd_hda_gen_init() */
244acc47aafSTakashi Iwai 
2457eebffd3STakashi Iwai 	/* additional mute flags (only effective with auto_mute_via_amp=1) */
2467eebffd3STakashi Iwai 	u64 mute_bits;
2477eebffd3STakashi Iwai 
248a1114a8cSTakashi Iwai 	/* bitmask for skipping volume controls */
249a1114a8cSTakashi Iwai 	u64 out_vol_mask;
250a1114a8cSTakashi Iwai 
25198bd1115STakashi Iwai 	/* badness tables for output path evaluations */
25298bd1115STakashi Iwai 	const struct badness_table *main_out_badness;
25398bd1115STakashi Iwai 	const struct badness_table *extra_out_badness;
25498bd1115STakashi Iwai 
2553690739bSTakashi Iwai 	/* preferred pin/DAC pairs; an array of paired NIDs */
2563690739bSTakashi Iwai 	const hda_nid_t *preferred_dacs;
2573690739bSTakashi Iwai 
258c30aa7b2STakashi Iwai 	/* loopback mixing mode */
259c30aa7b2STakashi Iwai 	bool aamix_mode;
260c30aa7b2STakashi Iwai 
2617504b6cdSTakashi Iwai 	/* digital beep */
2627504b6cdSTakashi Iwai 	hda_nid_t beep_nid;
2637504b6cdSTakashi Iwai 
264352f7f91STakashi Iwai 	/* for virtual master */
265352f7f91STakashi Iwai 	hda_nid_t vmaster_nid;
2667a71bbf3STakashi Iwai 	unsigned int vmaster_tlv[4];
267352f7f91STakashi Iwai 	struct hda_vmaster_mute_hook vmaster_mute;
26846a14481STakashi Iwai 
269352f7f91STakashi Iwai 	struct hda_loopback_check loopback;
2700186f4f4STakashi Iwai 	struct snd_array loopback_list;
271352f7f91STakashi Iwai 
272352f7f91STakashi Iwai 	/* multi-io */
273352f7f91STakashi Iwai 	int multi_ios;
274352f7f91STakashi Iwai 	struct hda_multi_io multi_io[4];
275352f7f91STakashi Iwai 
276352f7f91STakashi Iwai 	/* hooks */
277352f7f91STakashi Iwai 	void (*init_hook)(struct hda_codec *codec);
278352f7f91STakashi Iwai 	void (*automute_hook)(struct hda_codec *codec);
279a90229e0STakashi Iwai 	void (*cap_sync_hook)(struct hda_codec *codec,
2807fe30711STakashi Iwai 			      struct snd_kcontrol *kcontrol,
281a90229e0STakashi Iwai 			      struct snd_ctl_elem_value *ucontrol);
2822e03e952STakashi Iwai 
283ac2e8736STakashi Iwai 	/* PCM hooks */
284e6b85f3cSTakashi Iwai 	void (*pcm_playback_hook)(struct hda_pcm_stream *hinfo,
285e6b85f3cSTakashi Iwai 				  struct hda_codec *codec,
286e6b85f3cSTakashi Iwai 				  struct snd_pcm_substream *substream,
287e6b85f3cSTakashi Iwai 				  int action);
288ac2e8736STakashi Iwai 	void (*pcm_capture_hook)(struct hda_pcm_stream *hinfo,
289ac2e8736STakashi Iwai 				 struct hda_codec *codec,
290ac2e8736STakashi Iwai 				 struct snd_pcm_substream *substream,
291ac2e8736STakashi Iwai 				 int action);
292e6b85f3cSTakashi Iwai 
2932e03e952STakashi Iwai 	/* automute / autoswitch hooks */
2942e03e952STakashi Iwai 	void (*hp_automute_hook)(struct hda_codec *codec,
2951a4f69d5STakashi Iwai 				 struct hda_jack_callback *cb);
2962e03e952STakashi Iwai 	void (*line_automute_hook)(struct hda_codec *codec,
2971a4f69d5STakashi Iwai 				   struct hda_jack_callback *cb);
2982e03e952STakashi Iwai 	void (*mic_autoswitch_hook)(struct hda_codec *codec,
2991a4f69d5STakashi Iwai 				    struct hda_jack_callback *cb);
300549f8ffcSTakashi Iwai 
301549f8ffcSTakashi Iwai 	/* leds */
302549f8ffcSTakashi Iwai 	struct led_classdev *led_cdevs[NUM_AUDIO_LEDS];
303352f7f91STakashi Iwai };
304352f7f91STakashi Iwai 
30574f14b36STakashi Iwai /* values for add_stereo_mix_input flag */
30674f14b36STakashi Iwai enum {
30774f14b36STakashi Iwai 	HDA_HINT_STEREO_MIX_DISABLE,	/* No stereo mix input */
30874f14b36STakashi Iwai 	HDA_HINT_STEREO_MIX_ENABLE,	/* Add stereo mix input */
30974f14b36STakashi Iwai 	HDA_HINT_STEREO_MIX_AUTO,	/* Add only if auto-mic is disabled */
31074f14b36STakashi Iwai };
31174f14b36STakashi Iwai 
312352f7f91STakashi Iwai int snd_hda_gen_spec_init(struct hda_gen_spec *spec);
313352f7f91STakashi Iwai 
314352f7f91STakashi Iwai int snd_hda_gen_init(struct hda_codec *codec);
315fce52a3bSTakashi Iwai void snd_hda_gen_free(struct hda_codec *codec);
316352f7f91STakashi Iwai 
317196c1766STakashi Iwai int snd_hda_get_path_idx(struct hda_codec *codec, struct nid_path *path);
318196c1766STakashi Iwai struct nid_path *snd_hda_get_path_from_idx(struct hda_codec *codec, int idx);
319352f7f91STakashi Iwai struct nid_path *
320352f7f91STakashi Iwai snd_hda_add_new_path(struct hda_codec *codec, hda_nid_t from_nid,
3213ca529d3STakashi Iwai 		     hda_nid_t to_nid, int anchor_nid);
322352f7f91STakashi Iwai void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path,
323352f7f91STakashi Iwai 			   bool enable, bool add_aamix);
324352f7f91STakashi Iwai 
32512c93df6STakashi Iwai struct snd_kcontrol_new *
32612c93df6STakashi Iwai snd_hda_gen_add_kctl(struct hda_gen_spec *spec, const char *name,
32712c93df6STakashi Iwai 		     const struct snd_kcontrol_new *temp);
32812c93df6STakashi Iwai 
329352f7f91STakashi Iwai int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
3309eb413e5STakashi Iwai 				  struct auto_pin_cfg *cfg);
331352f7f91STakashi Iwai int snd_hda_gen_build_controls(struct hda_codec *codec);
332352f7f91STakashi Iwai int snd_hda_gen_build_pcms(struct hda_codec *codec);
333352f7f91STakashi Iwai 
3345d550e15STakashi Iwai /* standard jack event callbacks */
3355d550e15STakashi Iwai void snd_hda_gen_hp_automute(struct hda_codec *codec,
3361a4f69d5STakashi Iwai 			     struct hda_jack_callback *jack);
3375d550e15STakashi Iwai void snd_hda_gen_line_automute(struct hda_codec *codec,
3381a4f69d5STakashi Iwai 			       struct hda_jack_callback *jack);
3395d550e15STakashi Iwai void snd_hda_gen_mic_autoswitch(struct hda_codec *codec,
3401a4f69d5STakashi Iwai 				struct hda_jack_callback *jack);
3415d550e15STakashi Iwai void snd_hda_gen_update_outputs(struct hda_codec *codec);
3425d550e15STakashi Iwai 
343fce52a3bSTakashi Iwai int snd_hda_gen_check_power_status(struct hda_codec *codec, hda_nid_t nid);
344dfc6e469STakashi Iwai unsigned int snd_hda_gen_path_power_filter(struct hda_codec *codec,
345dfc6e469STakashi Iwai 					   hda_nid_t nid,
346dfc6e469STakashi Iwai 					   unsigned int power_state);
347e6feb5d0STakashi Iwai void snd_hda_gen_stream_pm(struct hda_codec *codec, hda_nid_t nid, bool on);
3486b275b14STakashi Iwai int snd_hda_gen_fix_pin_power(struct hda_codec *codec, hda_nid_t pin);
349fce52a3bSTakashi Iwai 
35015509b63STakashi Iwai int snd_hda_gen_add_mute_led_cdev(struct hda_codec *codec,
35115509b63STakashi Iwai 				  int (*callback)(struct led_classdev *,
35215509b63STakashi Iwai 						  enum led_brightness));
3537cdf8c49STakashi Iwai int snd_hda_gen_add_micmute_led_cdev(struct hda_codec *codec,
3547cdf8c49STakashi Iwai 				     int (*callback)(struct led_classdev *,
3557cdf8c49STakashi Iwai 						     enum led_brightness));
356f567b788STakashi Iwai 
357352f7f91STakashi Iwai #endif /* __SOUND_HDA_GENERIC_H */
358