2019-05-20 17:08:11 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2012-12-19 11:52:06 +00:00
|
|
|
/*
|
|
|
|
* Generic BIOS auto-parser helper functions for HD-audio
|
|
|
|
*
|
|
|
|
* Copyright (c) 2012 Takashi Iwai <tiwai@suse.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SOUND_HDA_GENERIC_H
|
|
|
|
#define __SOUND_HDA_GENERIC_H
|
|
|
|
|
2020-06-18 11:08:31 +00:00
|
|
|
#include <linux/leds.h>
|
|
|
|
|
2012-12-19 11:52:06 +00:00
|
|
|
/* table entry for multi-io paths */
|
|
|
|
struct hda_multi_io {
|
|
|
|
hda_nid_t pin; /* multi-io widget pin NID */
|
|
|
|
hda_nid_t dac; /* DAC to be connected */
|
|
|
|
unsigned int ctl_in; /* cached input-pin control value */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Widget connection path
|
|
|
|
*
|
|
|
|
* For output, stored in the order of DAC -> ... -> pin,
|
|
|
|
* for input, pin -> ... -> ADC.
|
|
|
|
*
|
|
|
|
* idx[i] contains the source index number to select on of the widget path[i];
|
|
|
|
* e.g. idx[1] is the index of the DAC (path[0]) selected by path[1] widget
|
|
|
|
* multi[] indicates whether it's a selector widget with multi-connectors
|
|
|
|
* (i.e. the connection selection is mandatory)
|
|
|
|
* vol_ctl and mute_ctl contains the NIDs for the assigned mixers
|
|
|
|
*/
|
|
|
|
|
2012-12-20 13:42:42 +00:00
|
|
|
#define MAX_NID_PATH_DEPTH 10
|
2012-12-19 11:52:06 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
NID_PATH_VOL_CTL,
|
|
|
|
NID_PATH_MUTE_CTL,
|
|
|
|
NID_PATH_BOOST_CTL,
|
|
|
|
NID_PATH_NUM_CTLS
|
|
|
|
};
|
|
|
|
|
|
|
|
struct nid_path {
|
|
|
|
int depth;
|
|
|
|
hda_nid_t path[MAX_NID_PATH_DEPTH];
|
|
|
|
unsigned char idx[MAX_NID_PATH_DEPTH];
|
|
|
|
unsigned char multi[MAX_NID_PATH_DEPTH];
|
|
|
|
unsigned int ctls[NID_PATH_NUM_CTLS]; /* NID_PATH_XXX_CTL */
|
ALSA: hda - Support advanced power state controls
This patch enables the finer power state control of each widget
depending on the jack plug state and streaming state in addition to
the existing power_down_unused power optimization. The new feature is
enabled only when codec->power_mgmt flag is set.
Two new flags, pin_enabled and stream_enabled, are introduced in
nid_path struct for marking the two individual power states: the pin
plug/unplug and DAC/ADC stream, respectively. They can be set
statically in case they are static routes (e.g. some mixer paths),
too.
The power up and down events for each pin are triggered via the
standard hda_jack table. The call order is hard-coded, relying on the
current implementation of jack event chain (a la FILO/stack order).
One point to be dealt carefully is that DAC/ADC cannot be powered
on/off while streaming. They are pinned as long as the stream is
running. For controlling the power of DAC/ADC, a new patch_ops is
added. The generic parser provides the default callback for that.
As of this patch, only IDT/Sigmatel codec driver enables the flag.
The support on other codecs will follow.
An assumption we made in this code is that the widget state (e.g. amp,
pinctl, connections) remains after the widget power transition (not
about FG power transition). This is true for IDT codecs, at least.
But if the widget state is lost at widget power transition, we'd need
to implement additional code to sync the cached amp/verbs for the
specific NID.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-16 20:32:11 +00:00
|
|
|
bool active:1; /* activated by driver */
|
|
|
|
bool pin_enabled:1; /* pins are enabled */
|
2015-03-20 17:11:05 +00:00
|
|
|
bool pin_fixed:1; /* path with fixed pin */
|
ALSA: hda - Support advanced power state controls
This patch enables the finer power state control of each widget
depending on the jack plug state and streaming state in addition to
the existing power_down_unused power optimization. The new feature is
enabled only when codec->power_mgmt flag is set.
Two new flags, pin_enabled and stream_enabled, are introduced in
nid_path struct for marking the two individual power states: the pin
plug/unplug and DAC/ADC stream, respectively. They can be set
statically in case they are static routes (e.g. some mixer paths),
too.
The power up and down events for each pin are triggered via the
standard hda_jack table. The call order is hard-coded, relying on the
current implementation of jack event chain (a la FILO/stack order).
One point to be dealt carefully is that DAC/ADC cannot be powered
on/off while streaming. They are pinned as long as the stream is
running. For controlling the power of DAC/ADC, a new patch_ops is
added. The generic parser provides the default callback for that.
As of this patch, only IDT/Sigmatel codec driver enables the flag.
The support on other codecs will follow.
An assumption we made in this code is that the widget state (e.g. amp,
pinctl, connections) remains after the widget power transition (not
about FG power transition). This is true for IDT codecs, at least.
But if the widget state is lost at widget power transition, we'd need
to implement additional code to sync the cached amp/verbs for the
specific NID.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-16 20:32:11 +00:00
|
|
|
bool stream_enabled:1; /* stream is active */
|
2012-12-19 11:52:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* mic/line-in auto switching entry */
|
|
|
|
|
|
|
|
#define MAX_AUTO_MIC_PINS 3
|
|
|
|
|
|
|
|
struct automic_entry {
|
|
|
|
hda_nid_t pin; /* pin */
|
|
|
|
int idx; /* imux index, -1 = invalid */
|
|
|
|
unsigned int attr; /* pin attribute (INPUT_PIN_ATTR_*) */
|
|
|
|
};
|
|
|
|
|
2012-12-21 13:09:42 +00:00
|
|
|
/* active stream id */
|
|
|
|
enum { STREAM_MULTI_OUT, STREAM_INDEP_HP };
|
|
|
|
|
2013-01-07 10:54:34 +00:00
|
|
|
/* PCM hook action */
|
|
|
|
enum {
|
|
|
|
HDA_GEN_PCM_ACT_OPEN,
|
|
|
|
HDA_GEN_PCM_ACT_PREPARE,
|
|
|
|
HDA_GEN_PCM_ACT_CLEANUP,
|
|
|
|
HDA_GEN_PCM_ACT_CLOSE,
|
|
|
|
};
|
|
|
|
|
2013-03-22 13:53:50 +00:00
|
|
|
/* DAC assignment badness table */
|
|
|
|
struct badness_table {
|
|
|
|
int no_primary_dac; /* no primary DAC */
|
|
|
|
int no_dac; /* no secondary DACs */
|
|
|
|
int shared_primary; /* primary DAC is shared with main output */
|
|
|
|
int shared_surr; /* secondary DAC shared with main or primary */
|
|
|
|
int shared_clfe; /* third DAC shared with main or primary */
|
|
|
|
int shared_surr_main; /* secondary DAC sahred with main/DAC0 */
|
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct badness_table hda_main_out_badness;
|
|
|
|
extern const struct badness_table hda_extra_out_badness;
|
|
|
|
|
2012-12-19 11:52:06 +00:00
|
|
|
struct hda_gen_spec {
|
|
|
|
char stream_name_analog[32]; /* analog PCM stream */
|
|
|
|
const struct hda_pcm_stream *stream_analog_playback;
|
|
|
|
const struct hda_pcm_stream *stream_analog_capture;
|
2013-01-21 15:50:09 +00:00
|
|
|
|
|
|
|
char stream_name_alt_analog[32]; /* alternative analog PCM stream */
|
2012-12-19 11:52:06 +00:00
|
|
|
const struct hda_pcm_stream *stream_analog_alt_playback;
|
|
|
|
const struct hda_pcm_stream *stream_analog_alt_capture;
|
|
|
|
|
|
|
|
char stream_name_digital[32]; /* digital PCM stream */
|
|
|
|
const struct hda_pcm_stream *stream_digital_playback;
|
|
|
|
const struct hda_pcm_stream *stream_digital_capture;
|
|
|
|
|
2012-12-21 13:09:42 +00:00
|
|
|
/* PCM */
|
|
|
|
unsigned int active_streams;
|
|
|
|
struct mutex pcm_mutex;
|
|
|
|
|
2012-12-19 11:52:06 +00:00
|
|
|
/* playback */
|
|
|
|
struct hda_multi_out multiout; /* playback set-up
|
|
|
|
* max_channels, dacs must be set
|
|
|
|
* dig_out_nid and hp_nid are optional
|
|
|
|
*/
|
|
|
|
hda_nid_t alt_dac_nid;
|
2020-07-17 15:45:17 +00:00
|
|
|
hda_nid_t follower_dig_outs[3]; /* optional - for auto-parsing */
|
2012-12-19 11:52:06 +00:00
|
|
|
int dig_out_type;
|
|
|
|
|
|
|
|
/* capture */
|
|
|
|
unsigned int num_adc_nids;
|
2013-01-18 15:38:08 +00:00
|
|
|
hda_nid_t adc_nids[AUTO_CFG_MAX_INS];
|
2012-12-19 11:52:06 +00:00
|
|
|
hda_nid_t dig_in_nid; /* digital-in NID; optional */
|
|
|
|
hda_nid_t mixer_nid; /* analog-mixer NID */
|
2013-01-23 16:00:31 +00:00
|
|
|
hda_nid_t mixer_merge_nid; /* aamix merge-point NID (optional) */
|
2013-01-18 15:38:08 +00:00
|
|
|
const char *input_labels[HDA_MAX_NUM_INPUTS];
|
|
|
|
int input_label_idxs[HDA_MAX_NUM_INPUTS];
|
2012-12-19 11:52:06 +00:00
|
|
|
|
|
|
|
/* capture setup for dynamic dual-adc switch */
|
|
|
|
hda_nid_t cur_adc;
|
|
|
|
unsigned int cur_adc_stream_tag;
|
|
|
|
unsigned int cur_adc_format;
|
|
|
|
|
|
|
|
/* capture source */
|
|
|
|
struct hda_input_mux input_mux;
|
|
|
|
unsigned int cur_mux[3];
|
|
|
|
|
|
|
|
/* channel model */
|
2013-01-07 15:44:06 +00:00
|
|
|
/* min_channel_count contains the minimum channel count for primary
|
|
|
|
* outputs. When multi_ios is set, the channels can be configured
|
|
|
|
* between min_channel_count and (min_channel_count + multi_ios * 2).
|
|
|
|
*
|
|
|
|
* ext_channel_count contains the current channel count of the primary
|
|
|
|
* out. This varies in the range above.
|
|
|
|
*
|
|
|
|
* Meanwhile, const_channel_count is the channel count for all outputs
|
|
|
|
* including headphone and speakers. It's a constant value, and the
|
|
|
|
* PCM is set up as max(ext_channel_count, const_channel_count).
|
|
|
|
*/
|
|
|
|
int min_channel_count; /* min. channel count for primary out */
|
|
|
|
int ext_channel_count; /* current channel count for primary */
|
|
|
|
int const_channel_count; /* channel count for all */
|
2012-12-19 11:52:06 +00:00
|
|
|
|
|
|
|
/* PCM information */
|
2015-02-27 16:43:19 +00:00
|
|
|
struct hda_pcm *pcm_rec[3]; /* used in build_pcms() */
|
2012-12-19 11:52:06 +00:00
|
|
|
|
|
|
|
/* dynamic controls, init_verbs and input_mux */
|
|
|
|
struct auto_pin_cfg autocfg;
|
|
|
|
struct snd_array kctls;
|
|
|
|
hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
|
|
|
|
hda_nid_t imux_pins[HDA_MAX_NUM_INPUTS];
|
|
|
|
unsigned int dyn_adc_idx[HDA_MAX_NUM_INPUTS];
|
2013-02-19 16:12:42 +00:00
|
|
|
/* shared hp/mic */
|
2012-12-19 11:52:06 +00:00
|
|
|
hda_nid_t shared_mic_vref_pin;
|
2013-02-19 16:12:42 +00:00
|
|
|
hda_nid_t hp_mic_pin;
|
|
|
|
int hp_mic_mux_idx;
|
2012-12-19 11:52:06 +00:00
|
|
|
|
2013-01-17 14:53:29 +00:00
|
|
|
/* DAC/ADC lists */
|
2012-12-19 11:52:06 +00:00
|
|
|
int num_all_dacs;
|
|
|
|
hda_nid_t all_dacs[16];
|
2013-01-17 14:53:29 +00:00
|
|
|
int num_all_adcs;
|
2013-01-18 15:38:08 +00:00
|
|
|
hda_nid_t all_adcs[AUTO_CFG_MAX_INS];
|
2012-12-19 11:52:06 +00:00
|
|
|
|
|
|
|
/* path list */
|
|
|
|
struct snd_array paths;
|
|
|
|
|
2013-01-04 14:01:40 +00:00
|
|
|
/* path indices */
|
|
|
|
int out_paths[AUTO_CFG_MAX_OUTS];
|
|
|
|
int hp_paths[AUTO_CFG_MAX_OUTS];
|
|
|
|
int speaker_paths[AUTO_CFG_MAX_OUTS];
|
2013-01-04 15:42:48 +00:00
|
|
|
int aamix_out_paths[3];
|
2013-01-04 14:01:40 +00:00
|
|
|
int digout_paths[AUTO_CFG_MAX_OUTS];
|
2013-01-18 14:43:01 +00:00
|
|
|
int input_paths[HDA_MAX_NUM_INPUTS][AUTO_CFG_MAX_INS];
|
2013-01-04 14:01:40 +00:00
|
|
|
int loopback_paths[HDA_MAX_NUM_INPUTS];
|
2013-01-23 16:00:31 +00:00
|
|
|
int loopback_merge_path;
|
2013-01-04 14:09:42 +00:00
|
|
|
int digin_path;
|
2013-01-04 14:01:40 +00:00
|
|
|
|
2012-12-19 11:52:06 +00:00
|
|
|
/* auto-mic stuff */
|
|
|
|
int am_num_entries;
|
|
|
|
struct automic_entry am_entry[MAX_AUTO_MIC_PINS];
|
|
|
|
|
|
|
|
/* for pin sensing */
|
2021-12-04 07:28:40 +00:00
|
|
|
/* current status; set in hda_generic.c */
|
2012-12-19 11:52:06 +00:00
|
|
|
unsigned int hp_jack_present:1;
|
|
|
|
unsigned int line_jack_present:1;
|
2013-01-16 17:28:38 +00:00
|
|
|
unsigned int speaker_muted:1; /* current status of speaker mute */
|
|
|
|
unsigned int line_out_muted:1; /* current status of LO mute */
|
|
|
|
|
|
|
|
/* internal states of automute / autoswitch behavior */
|
2012-12-19 11:52:06 +00:00
|
|
|
unsigned int auto_mic:1;
|
|
|
|
unsigned int automute_speaker:1; /* automute speaker outputs */
|
|
|
|
unsigned int automute_lo:1; /* automute LO outputs */
|
2013-01-16 17:28:38 +00:00
|
|
|
|
|
|
|
/* capabilities detected by parser */
|
2012-12-19 11:52:06 +00:00
|
|
|
unsigned int detect_hp:1; /* Headphone detection enabled */
|
|
|
|
unsigned int detect_lo:1; /* Line-out detection enabled */
|
|
|
|
unsigned int automute_speaker_possible:1; /* there are speakers and either LO or HP */
|
|
|
|
unsigned int automute_lo_possible:1; /* there are line outs and HP */
|
2013-01-16 17:28:38 +00:00
|
|
|
|
|
|
|
/* additional parameters set by codec drivers */
|
|
|
|
unsigned int master_mute:1; /* master mute over all */
|
2012-12-19 11:52:06 +00:00
|
|
|
unsigned int keep_vref_in_automute:1; /* Don't clear VREF in automute */
|
2013-01-16 17:28:38 +00:00
|
|
|
unsigned int line_in_auto_switch:1; /* allow line-in auto switch */
|
2013-06-24 14:00:21 +00:00
|
|
|
unsigned int auto_mute_via_amp:1; /* auto-mute via amp instead of pinctl */
|
2013-01-16 17:28:38 +00:00
|
|
|
|
|
|
|
/* parser behavior flags; set before snd_hda_gen_parse_auto_config() */
|
2013-01-16 17:20:07 +00:00
|
|
|
unsigned int suppress_auto_mute:1; /* suppress input jack auto mute */
|
2013-01-07 15:32:11 +00:00
|
|
|
unsigned int suppress_auto_mic:1; /* suppress input jack auto switch */
|
2012-12-19 11:52:06 +00:00
|
|
|
|
2013-01-16 17:28:38 +00:00
|
|
|
/* other parse behavior flags */
|
2012-12-19 11:52:06 +00:00
|
|
|
unsigned int need_dac_fix:1; /* need to limit DACs for multi channels */
|
2013-02-19 16:12:42 +00:00
|
|
|
unsigned int hp_mic:1; /* Allow HP as a mic-in */
|
|
|
|
unsigned int suppress_hp_mic_detect:1; /* Don't detect HP/mic */
|
2012-12-19 11:52:06 +00:00
|
|
|
unsigned int no_primary_hp:1; /* Don't prefer HP pins to speaker pins */
|
ALSA: hda - Fix invalid multi-io creation on VAIO-Z laptops
VAIO-Z laptops need to use the specific DAC for the speaker output
by some unknown reason although the codec itself supports the flexible
connection. So we implemented a workaround by a new flag,
no_primary_hp, for assigning the speaker pin first.
This worked until 3.8 kernel, but it got broken because the driver
learned for a better multi-io pin mapping, and not it can assign two
mic pins for multi-io. Since the multi-io requires to be the primary
output, the hp and two mic pins are assigned in prior to the speaker
in the end.
Although the machine has two mic pins, one of them is used as a noise-
canceling headphone, thus it's no real retaskable mic jack. Thus, at
best, we can disable the multi-io assignment and make the parser
behavior back to the state before the multi-io.
This patch adds again a new flag, no_multi_io, to indicate that the
device has no multi-io capability, and set it in the fixup for
VAIO-Z. The no_multi_io flag itself can be used generically, added
via a helper line, too.
Reported-by: Tormen <my.nl.abos@gmail.com>
Reported-by: Adam Williamson <awilliam@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-07-29 14:54:36 +00:00
|
|
|
unsigned int no_multi_io:1; /* Don't try multi I/O config */
|
2012-12-19 11:52:06 +00:00
|
|
|
unsigned int multi_cap_vol:1; /* allow multiple capture xxx volumes */
|
|
|
|
unsigned int inv_dmic_split:1; /* inverted dmic w/a for conexant */
|
2012-12-19 12:01:54 +00:00
|
|
|
unsigned int own_eapd_ctl:1; /* set EAPD by own function */
|
2013-05-31 17:55:54 +00:00
|
|
|
unsigned int keep_eapd_on:1; /* don't turn off EAPD automatically */
|
2021-03-17 17:29:43 +00:00
|
|
|
unsigned int vmaster_mute_led:1; /* add SPK-LED flag to vmaster mute switch */
|
|
|
|
unsigned int mic_mute_led:1; /* add MIC-LED flag to capture mute switch */
|
2012-12-21 13:09:42 +00:00
|
|
|
unsigned int indep_hp:1; /* independent HP supported */
|
2013-01-15 17:45:53 +00:00
|
|
|
unsigned int prefer_hp_amp:1; /* enable HP amp for speaker if any */
|
2014-12-15 12:43:59 +00:00
|
|
|
unsigned int add_stereo_mix_input:2; /* add aamix as a capture src */
|
2013-03-07 17:32:59 +00:00
|
|
|
unsigned int add_jack_modes:1; /* add i/o jack mode enum ctls */
|
2013-01-24 16:32:56 +00:00
|
|
|
unsigned int power_down_unused:1; /* power down unused widgets */
|
ALSA: hda - Add TLV_DB_SCALE_MUTE bit for relevant controls
The DACs on Sigmatel/IDT codecs do mute at the lowest volume level,
and in the earlier drivers, we passed TLV_DB_SCALE_MUTE bit for each
volume control element like Speaker and Headphone as well as Master.
Along with the translation to the generic parser, however, the TLV bit
was lost for the slave controls (e.g. Speaker) but set only to
Master. In theory this should have sufficed, but apps, particularly
PA, do care the slave volume bits, so we seem to see a regression in
the volume controls.
This patch adds a flag to hda_gen_spec to specify the DAC mute
feature, and adds the TLV bit properly for all relevant volume
controls. Also, the TLV bit for vmaster is set in hda_generic.c, so
that we can get rid of all tricks from the codec driver side.
As the similar hack is applied to Conexant 5051 stuff, we can get rid
of it as well.
BugLink: https://bugs.launchpad.net/bugs/1357928
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-01 08:07:04 +00:00
|
|
|
unsigned int dac_min_mute:1; /* minimal = mute for DACs */
|
2017-04-10 15:37:34 +00:00
|
|
|
unsigned int suppress_vmaster:1; /* don't create vmaster kctls */
|
2020-11-27 14:11:03 +00:00
|
|
|
unsigned int obey_preferred_dacs:1; /* obey preferred_dacs assignment */
|
2012-12-19 11:52:06 +00:00
|
|
|
|
2013-01-16 17:28:38 +00:00
|
|
|
/* other internal flags */
|
|
|
|
unsigned int no_analog:1; /* digital I/O only */
|
|
|
|
unsigned int dyn_adc_switch:1; /* switch ADCs (for ALC275) */
|
|
|
|
unsigned int indep_hp_enabled:1; /* independent HP enabled */
|
2013-01-21 14:11:25 +00:00
|
|
|
unsigned int have_aamix_ctl:1;
|
2013-03-07 17:40:58 +00:00
|
|
|
unsigned int hp_mic_jack_modes:1;
|
2019-08-30 10:03:38 +00:00
|
|
|
unsigned int skip_verbs:1; /* don't apply verbs at snd_hda_gen_init() */
|
2013-01-16 17:28:38 +00:00
|
|
|
|
2013-06-24 14:00:21 +00:00
|
|
|
/* additional mute flags (only effective with auto_mute_via_amp=1) */
|
|
|
|
u64 mute_bits;
|
|
|
|
|
2013-11-04 15:32:01 +00:00
|
|
|
/* bitmask for skipping volume controls */
|
|
|
|
u64 out_vol_mask;
|
|
|
|
|
2013-03-22 13:53:50 +00:00
|
|
|
/* badness tables for output path evaluations */
|
|
|
|
const struct badness_table *main_out_badness;
|
|
|
|
const struct badness_table *extra_out_badness;
|
|
|
|
|
2013-12-10 16:29:26 +00:00
|
|
|
/* preferred pin/DAC pairs; an array of paired NIDs */
|
|
|
|
const hda_nid_t *preferred_dacs;
|
|
|
|
|
2013-01-04 15:42:48 +00:00
|
|
|
/* loopback mixing mode */
|
|
|
|
bool aamix_mode;
|
|
|
|
|
2013-03-18 10:25:51 +00:00
|
|
|
/* digital beep */
|
|
|
|
hda_nid_t beep_nid;
|
|
|
|
|
2012-12-19 11:52:06 +00:00
|
|
|
/* for virtual master */
|
|
|
|
hda_nid_t vmaster_nid;
|
2013-01-17 09:25:15 +00:00
|
|
|
unsigned int vmaster_tlv[4];
|
2012-12-19 11:52:06 +00:00
|
|
|
struct hda_vmaster_mute_hook vmaster_mute;
|
2013-02-07 08:58:11 +00:00
|
|
|
|
2012-12-19 11:52:06 +00:00
|
|
|
struct hda_loopback_check loopback;
|
2013-02-07 09:45:11 +00:00
|
|
|
struct snd_array loopback_list;
|
2012-12-19 11:52:06 +00:00
|
|
|
|
|
|
|
/* multi-io */
|
|
|
|
int multi_ios;
|
|
|
|
struct hda_multi_io multi_io[4];
|
|
|
|
|
|
|
|
/* hooks */
|
|
|
|
void (*init_hook)(struct hda_codec *codec);
|
|
|
|
void (*automute_hook)(struct hda_codec *codec);
|
2013-01-18 13:10:00 +00:00
|
|
|
void (*cap_sync_hook)(struct hda_codec *codec,
|
2014-01-30 16:59:02 +00:00
|
|
|
struct snd_kcontrol *kcontrol,
|
2013-01-18 13:10:00 +00:00
|
|
|
struct snd_ctl_elem_value *ucontrol);
|
2013-01-03 14:55:06 +00:00
|
|
|
|
2013-01-17 14:57:10 +00:00
|
|
|
/* PCM hooks */
|
2013-01-07 10:54:34 +00:00
|
|
|
void (*pcm_playback_hook)(struct hda_pcm_stream *hinfo,
|
|
|
|
struct hda_codec *codec,
|
|
|
|
struct snd_pcm_substream *substream,
|
|
|
|
int action);
|
2013-01-17 14:57:10 +00:00
|
|
|
void (*pcm_capture_hook)(struct hda_pcm_stream *hinfo,
|
|
|
|
struct hda_codec *codec,
|
|
|
|
struct snd_pcm_substream *substream,
|
|
|
|
int action);
|
2013-01-07 10:54:34 +00:00
|
|
|
|
2013-01-03 14:55:06 +00:00
|
|
|
/* automute / autoswitch hooks */
|
|
|
|
void (*hp_automute_hook)(struct hda_codec *codec,
|
2014-09-11 13:22:46 +00:00
|
|
|
struct hda_jack_callback *cb);
|
2013-01-03 14:55:06 +00:00
|
|
|
void (*line_automute_hook)(struct hda_codec *codec,
|
2014-09-11 13:22:46 +00:00
|
|
|
struct hda_jack_callback *cb);
|
2013-01-03 14:55:06 +00:00
|
|
|
void (*mic_autoswitch_hook)(struct hda_codec *codec,
|
2014-09-11 13:22:46 +00:00
|
|
|
struct hda_jack_callback *cb);
|
2022-01-26 14:50:11 +00:00
|
|
|
|
|
|
|
/* leds */
|
|
|
|
struct led_classdev *led_cdevs[NUM_AUDIO_LEDS];
|
2012-12-19 11:52:06 +00:00
|
|
|
};
|
|
|
|
|
2014-12-15 12:43:59 +00:00
|
|
|
/* values for add_stereo_mix_input flag */
|
|
|
|
enum {
|
|
|
|
HDA_HINT_STEREO_MIX_DISABLE, /* No stereo mix input */
|
|
|
|
HDA_HINT_STEREO_MIX_ENABLE, /* Add stereo mix input */
|
|
|
|
HDA_HINT_STEREO_MIX_AUTO, /* Add only if auto-mic is disabled */
|
|
|
|
};
|
|
|
|
|
2012-12-19 11:52:06 +00:00
|
|
|
int snd_hda_gen_spec_init(struct hda_gen_spec *spec);
|
|
|
|
|
|
|
|
int snd_hda_gen_init(struct hda_codec *codec);
|
2013-01-07 11:42:48 +00:00
|
|
|
void snd_hda_gen_free(struct hda_codec *codec);
|
2012-12-19 11:52:06 +00:00
|
|
|
|
2013-01-04 14:01:40 +00:00
|
|
|
int snd_hda_get_path_idx(struct hda_codec *codec, struct nid_path *path);
|
|
|
|
struct nid_path *snd_hda_get_path_from_idx(struct hda_codec *codec, int idx);
|
2012-12-19 11:52:06 +00:00
|
|
|
struct nid_path *
|
|
|
|
snd_hda_add_new_path(struct hda_codec *codec, hda_nid_t from_nid,
|
2013-01-07 16:25:08 +00:00
|
|
|
hda_nid_t to_nid, int anchor_nid);
|
2012-12-19 11:52:06 +00:00
|
|
|
void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path,
|
|
|
|
bool enable, bool add_aamix);
|
|
|
|
|
2012-12-19 13:38:33 +00:00
|
|
|
struct snd_kcontrol_new *
|
|
|
|
snd_hda_gen_add_kctl(struct hda_gen_spec *spec, const char *name,
|
|
|
|
const struct snd_kcontrol_new *temp);
|
|
|
|
|
2012-12-19 11:52:06 +00:00
|
|
|
int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
|
2012-12-19 13:41:21 +00:00
|
|
|
struct auto_pin_cfg *cfg);
|
2012-12-19 11:52:06 +00:00
|
|
|
int snd_hda_gen_build_controls(struct hda_codec *codec);
|
|
|
|
int snd_hda_gen_build_pcms(struct hda_codec *codec);
|
|
|
|
|
2012-12-19 14:16:44 +00:00
|
|
|
/* standard jack event callbacks */
|
|
|
|
void snd_hda_gen_hp_automute(struct hda_codec *codec,
|
2014-09-11 13:22:46 +00:00
|
|
|
struct hda_jack_callback *jack);
|
2012-12-19 14:16:44 +00:00
|
|
|
void snd_hda_gen_line_automute(struct hda_codec *codec,
|
2014-09-11 13:22:46 +00:00
|
|
|
struct hda_jack_callback *jack);
|
2012-12-19 14:16:44 +00:00
|
|
|
void snd_hda_gen_mic_autoswitch(struct hda_codec *codec,
|
2014-09-11 13:22:46 +00:00
|
|
|
struct hda_jack_callback *jack);
|
2012-12-19 14:16:44 +00:00
|
|
|
void snd_hda_gen_update_outputs(struct hda_codec *codec);
|
|
|
|
|
2013-01-07 11:42:48 +00:00
|
|
|
#ifdef CONFIG_PM
|
|
|
|
int snd_hda_gen_check_power_status(struct hda_codec *codec, hda_nid_t nid);
|
|
|
|
#endif
|
2014-01-13 15:09:57 +00:00
|
|
|
unsigned int snd_hda_gen_path_power_filter(struct hda_codec *codec,
|
|
|
|
hda_nid_t nid,
|
|
|
|
unsigned int power_state);
|
ALSA: hda - Support advanced power state controls
This patch enables the finer power state control of each widget
depending on the jack plug state and streaming state in addition to
the existing power_down_unused power optimization. The new feature is
enabled only when codec->power_mgmt flag is set.
Two new flags, pin_enabled and stream_enabled, are introduced in
nid_path struct for marking the two individual power states: the pin
plug/unplug and DAC/ADC stream, respectively. They can be set
statically in case they are static routes (e.g. some mixer paths),
too.
The power up and down events for each pin are triggered via the
standard hda_jack table. The call order is hard-coded, relying on the
current implementation of jack event chain (a la FILO/stack order).
One point to be dealt carefully is that DAC/ADC cannot be powered
on/off while streaming. They are pinned as long as the stream is
running. For controlling the power of DAC/ADC, a new patch_ops is
added. The generic parser provides the default callback for that.
As of this patch, only IDT/Sigmatel codec driver enables the flag.
The support on other codecs will follow.
An assumption we made in this code is that the widget state (e.g. amp,
pinctl, connections) remains after the widget power transition (not
about FG power transition). This is true for IDT codecs, at least.
But if the widget state is lost at widget power transition, we'd need
to implement additional code to sync the cached amp/verbs for the
specific NID.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-16 20:32:11 +00:00
|
|
|
void snd_hda_gen_stream_pm(struct hda_codec *codec, hda_nid_t nid, bool on);
|
2015-03-20 17:11:05 +00:00
|
|
|
int snd_hda_gen_fix_pin_power(struct hda_codec *codec, hda_nid_t pin);
|
2013-01-07 11:42:48 +00:00
|
|
|
|
2020-06-18 11:08:37 +00:00
|
|
|
int snd_hda_gen_add_mute_led_cdev(struct hda_codec *codec,
|
|
|
|
int (*callback)(struct led_classdev *,
|
|
|
|
enum led_brightness));
|
2020-06-18 11:08:31 +00:00
|
|
|
int snd_hda_gen_add_micmute_led_cdev(struct hda_codec *codec,
|
|
|
|
int (*callback)(struct led_classdev *,
|
|
|
|
enum led_brightness));
|
2018-06-18 15:26:12 +00:00
|
|
|
|
2012-12-19 11:52:06 +00:00
|
|
|
#endif /* __SOUND_HDA_GENERIC_H */
|