Commit ce40a6d3 authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'topic/kerneldoc' into for-next

parents eafe8404 95a962c3
...@@ -99,6 +99,8 @@ ...@@ -99,6 +99,8 @@
<chapter><title>Compress Offload</title> <chapter><title>Compress Offload</title>
<sect1><title>Compress Offload API</title> <sect1><title>Compress Offload API</title>
!Esound/core/compress_offload.c !Esound/core/compress_offload.c
!Iinclude/uapi/sound/compress_offload.h
!Iinclude/uapi/sound/compress_params.h
!Iinclude/sound/compress_driver.h !Iinclude/sound/compress_driver.h
</sect1> </sect1>
</chapter> </chapter>
......
...@@ -28,7 +28,21 @@ ...@@ -28,7 +28,21 @@
struct input_dev; struct input_dev;
/** /**
* enum snd_jack_types: Jack types which can be reported * enum snd_jack_types - Jack types which can be reported
* @SND_JACK_HEADPHONE: Headphone
* @SND_JACK_MICROPHONE: Microphone
* @SND_JACK_HEADSET: Headset
* @SND_JACK_LINEOUT: Line out
* @SND_JACK_MECHANICAL: Mechanical switch
* @SND_JACK_VIDEOOUT: Video out
* @SND_JACK_AVOUT: AV (Audio Video) out
* @SND_JACK_LINEIN: Line in
* @SND_JACK_BTN_0: Button 0
* @SND_JACK_BTN_1: Button 1
* @SND_JACK_BTN_2: Button 2
* @SND_JACK_BTN_3: Button 3
* @SND_JACK_BTN_4: Button 4
* @SND_JACK_BTN_5: Button 5
* *
* These values are used as a bitmask. * These values are used as a bitmask.
* *
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2) #define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2)
/** /**
* struct snd_compressed_buffer: compressed buffer * struct snd_compressed_buffer - compressed buffer
* @fragment_size: size of buffer fragment in bytes * @fragment_size: size of buffer fragment in bytes
* @fragments: number of such fragments * @fragments: number of such fragments
*/ */
...@@ -42,7 +42,7 @@ struct snd_compressed_buffer { ...@@ -42,7 +42,7 @@ struct snd_compressed_buffer {
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
/** /**
* struct snd_compr_params: compressed stream params * struct snd_compr_params - compressed stream params
* @buffer: buffer description * @buffer: buffer description
* @codec: codec parameters * @codec: codec parameters
* @no_wake_mode: dont wake on fragment elapsed * @no_wake_mode: dont wake on fragment elapsed
...@@ -54,7 +54,7 @@ struct snd_compr_params { ...@@ -54,7 +54,7 @@ struct snd_compr_params {
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
/** /**
* struct snd_compr_tstamp: timestamp descriptor * struct snd_compr_tstamp - timestamp descriptor
* @byte_offset: Byte offset in ring buffer to DSP * @byte_offset: Byte offset in ring buffer to DSP
* @copied_total: Total number of bytes copied from/to ring buffer to/by DSP * @copied_total: Total number of bytes copied from/to ring buffer to/by DSP
* @pcm_frames: Frames decoded or encoded by DSP. This field will evolve by * @pcm_frames: Frames decoded or encoded by DSP. This field will evolve by
...@@ -73,7 +73,7 @@ struct snd_compr_tstamp { ...@@ -73,7 +73,7 @@ struct snd_compr_tstamp {
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
/** /**
* struct snd_compr_avail: avail descriptor * struct snd_compr_avail - avail descriptor
* @avail: Number of bytes available in ring buffer for writing/reading * @avail: Number of bytes available in ring buffer for writing/reading
* @tstamp: timestamp infomation * @tstamp: timestamp infomation
*/ */
...@@ -88,7 +88,7 @@ enum snd_compr_direction { ...@@ -88,7 +88,7 @@ enum snd_compr_direction {
}; };
/** /**
* struct snd_compr_caps: caps descriptor * struct snd_compr_caps - caps descriptor
* @codecs: pointer to array of codecs * @codecs: pointer to array of codecs
* @direction: direction supported. Of type snd_compr_direction * @direction: direction supported. Of type snd_compr_direction
* @min_fragment_size: minimum fragment supported by DSP * @min_fragment_size: minimum fragment supported by DSP
...@@ -110,7 +110,7 @@ struct snd_compr_caps { ...@@ -110,7 +110,7 @@ struct snd_compr_caps {
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
/** /**
* struct snd_compr_codec_caps: query capability of codec * struct snd_compr_codec_caps - query capability of codec
* @codec: codec for which capability is queried * @codec: codec for which capability is queried
* @num_descriptors: number of codec descriptors * @num_descriptors: number of codec descriptors
* @descriptor: array of codec capability descriptor * @descriptor: array of codec capability descriptor
...@@ -122,18 +122,19 @@ struct snd_compr_codec_caps { ...@@ -122,18 +122,19 @@ struct snd_compr_codec_caps {
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
/** /**
* enum sndrv_compress_encoder
* @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the
* end of the track * end of the track
* @SNDRV_COMPRESS_ENCODER_DELAY: no of samples inserted by the encoder at the * @SNDRV_COMPRESS_ENCODER_DELAY: no of samples inserted by the encoder at the
* beginning of the track * beginning of the track
*/ */
enum { enum sndrv_compress_encoder {
SNDRV_COMPRESS_ENCODER_PADDING = 1, SNDRV_COMPRESS_ENCODER_PADDING = 1,
SNDRV_COMPRESS_ENCODER_DELAY = 2, SNDRV_COMPRESS_ENCODER_DELAY = 2,
}; };
/** /**
* struct snd_compr_metadata: compressed stream metadata * struct snd_compr_metadata - compressed stream metadata
* @key: key id * @key: key id
* @value: key value * @value: key value
*/ */
......
...@@ -441,6 +441,13 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, ...@@ -441,6 +441,13 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
} }
EXPORT_SYMBOL_GPL(snd_hda_parse_pin_defcfg); EXPORT_SYMBOL_GPL(snd_hda_parse_pin_defcfg);
/**
* snd_hda_get_input_pin_attr - Get the input pin attribute from pin config
* @def_conf: pin configuration value
*
* Guess the input pin attribute (INPUT_PIN_ATTR_XXX) from the given
* default pin configuration value.
*/
int snd_hda_get_input_pin_attr(unsigned int def_conf) int snd_hda_get_input_pin_attr(unsigned int def_conf)
{ {
unsigned int loc = get_defcfg_location(def_conf); unsigned int loc = get_defcfg_location(def_conf);
...@@ -464,12 +471,15 @@ EXPORT_SYMBOL_GPL(snd_hda_get_input_pin_attr); ...@@ -464,12 +471,15 @@ EXPORT_SYMBOL_GPL(snd_hda_get_input_pin_attr);
/** /**
* hda_get_input_pin_label - Give a label for the given input pin * hda_get_input_pin_label - Give a label for the given input pin
* @codec: the HDA codec
* @item: ping config item to refer
* @pin: the pin NID
* @check_location: flag to add the jack location prefix
* *
* When check_location is true, the function checks the pin location * When @check_location is true, the function checks the pin location
* for mic and line-in pins, and set an appropriate prefix like "Front", * for mic and line-in pins, and set an appropriate prefix like "Front",
* "Rear", "Internal". * "Rear", "Internal".
*/ */
static const char *hda_get_input_pin_label(struct hda_codec *codec, static const char *hda_get_input_pin_label(struct hda_codec *codec,
const struct auto_pin_cfg_item *item, const struct auto_pin_cfg_item *item,
hda_nid_t pin, bool check_location) hda_nid_t pin, bool check_location)
...@@ -550,6 +560,9 @@ static int check_mic_location_need(struct hda_codec *codec, ...@@ -550,6 +560,9 @@ static int check_mic_location_need(struct hda_codec *codec,
/** /**
* hda_get_autocfg_input_label - Get a label for the given input * hda_get_autocfg_input_label - Get a label for the given input
* @codec: the HDA codec
* @cfg: the parsed pin configuration
* @input: the input index number
* *
* Get a label for the given input pin defined by the autocfg item. * Get a label for the given input pin defined by the autocfg item.
* Unlike hda_get_input_pin_label(), this function checks all inputs * Unlike hda_get_input_pin_label(), this function checks all inputs
...@@ -677,6 +690,12 @@ static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid, ...@@ -677,6 +690,12 @@ static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid,
/** /**
* snd_hda_get_pin_label - Get a label for the given I/O pin * snd_hda_get_pin_label - Get a label for the given I/O pin
* @codec: the HDA codec
* @nid: pin NID
* @cfg: the parsed pin configuration
* @label: the string buffer to store
* @maxlen: the max length of string buffer (including termination)
* @indexp: the pointer to return the index number (for multiple ctls)
* *
* Get a label for the given pin. This function works for both input and * Get a label for the given pin. This function works for both input and
* output pins. When @cfg is given as non-NULL, the function tries to get * output pins. When @cfg is given as non-NULL, the function tries to get
...@@ -748,6 +767,14 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, ...@@ -748,6 +767,14 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
} }
EXPORT_SYMBOL_GPL(snd_hda_get_pin_label); EXPORT_SYMBOL_GPL(snd_hda_get_pin_label);
/**
* snd_hda_add_verbs - Add verbs to the init list
* @codec: the HDA codec
* @list: zero-terminated verb list to add
*
* Append the given verb list to the execution list. The verbs will be
* performed at init and resume time via snd_hda_apply_verbs().
*/
int snd_hda_add_verbs(struct hda_codec *codec, int snd_hda_add_verbs(struct hda_codec *codec,
const struct hda_verb *list) const struct hda_verb *list)
{ {
...@@ -760,6 +787,10 @@ int snd_hda_add_verbs(struct hda_codec *codec, ...@@ -760,6 +787,10 @@ int snd_hda_add_verbs(struct hda_codec *codec,
} }
EXPORT_SYMBOL_GPL(snd_hda_add_verbs); EXPORT_SYMBOL_GPL(snd_hda_add_verbs);
/**
* snd_hda_apply_verbs - Execute the init verb lists
* @codec: the HDA codec
*/
void snd_hda_apply_verbs(struct hda_codec *codec) void snd_hda_apply_verbs(struct hda_codec *codec)
{ {
int i; int i;
...@@ -770,6 +801,11 @@ void snd_hda_apply_verbs(struct hda_codec *codec) ...@@ -770,6 +801,11 @@ void snd_hda_apply_verbs(struct hda_codec *codec)
} }
EXPORT_SYMBOL_GPL(snd_hda_apply_verbs); EXPORT_SYMBOL_GPL(snd_hda_apply_verbs);
/**
* snd_hda_apply_pincfgs - Set each pin config in the given list
* @codec: the HDA codec
* @cfg: NULL-terminated pin config table
*/
void snd_hda_apply_pincfgs(struct hda_codec *codec, void snd_hda_apply_pincfgs(struct hda_codec *codec,
const struct hda_pintbl *cfg) const struct hda_pintbl *cfg)
{ {
...@@ -837,6 +873,11 @@ static void apply_fixup(struct hda_codec *codec, int id, int action, int depth) ...@@ -837,6 +873,11 @@ static void apply_fixup(struct hda_codec *codec, int id, int action, int depth)
} }
} }
/**
* snd_hda_apply_fixup - Apply the fixup chain with the given action
* @codec: the HDA codec
* @action: fixup action (HDA_FIXUP_ACT_XXX)
*/
void snd_hda_apply_fixup(struct hda_codec *codec, int action) void snd_hda_apply_fixup(struct hda_codec *codec, int action)
{ {
if (codec->fixup_list) if (codec->fixup_list)
...@@ -855,6 +896,12 @@ static bool pin_config_match(struct hda_codec *codec, ...@@ -855,6 +896,12 @@ static bool pin_config_match(struct hda_codec *codec,
return true; return true;
} }
/**
* snd_hda_pick_pin_fixup - Pick up a fixup matching with the pin quirk list
* @codec: the HDA codec
* @pin_quirk: zero-terminated pin quirk list
* @fixlist: the fixup list
*/
void snd_hda_pick_pin_fixup(struct hda_codec *codec, void snd_hda_pick_pin_fixup(struct hda_codec *codec,
const struct snd_hda_pin_quirk *pin_quirk, const struct snd_hda_pin_quirk *pin_quirk,
const struct hda_fixup *fixlist) const struct hda_fixup *fixlist)
...@@ -881,6 +928,21 @@ void snd_hda_pick_pin_fixup(struct hda_codec *codec, ...@@ -881,6 +928,21 @@ void snd_hda_pick_pin_fixup(struct hda_codec *codec,
} }
EXPORT_SYMBOL_GPL(snd_hda_pick_pin_fixup); EXPORT_SYMBOL_GPL(snd_hda_pick_pin_fixup);
/**
* snd_hda_pick_fixup - Pick up a fixup matching with PCI/codec SSID or model string
* @codec: the HDA codec
* @models: NULL-terminated model string list
* @quirk: zero-terminated PCI/codec SSID quirk list
* @fixlist: the fixup list
*
* Pick up a fixup entry matching with the given model string or SSID.
* If a fixup was already set beforehand, the function doesn't do anything.
* When a special model string "nofixup" is given, also no fixup is applied.
*
* The function tries to find the matching model name at first, if given.
* If nothing matched, try to look up the PCI SSID.
* If still nothing matched, try to look up the codec SSID.
*/
void snd_hda_pick_fixup(struct hda_codec *codec, void snd_hda_pick_fixup(struct hda_codec *codec,
const struct hda_model_fixup *models, const struct hda_model_fixup *models,
const struct snd_pci_quirk *quirk, const struct snd_pci_quirk *quirk,
......
...@@ -175,6 +175,11 @@ static int snd_hda_do_attach(struct hda_beep *beep) ...@@ -175,6 +175,11 @@ static int snd_hda_do_attach(struct hda_beep *beep)
return 0; return 0;
} }
/**
* snd_hda_enable_beep_device - Turn on/off beep sound
* @codec: the HDA codec
* @enable: flag to turn on/off
*/
int snd_hda_enable_beep_device(struct hda_codec *codec, int enable) int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
{ {
struct hda_beep *beep = codec->beep; struct hda_beep *beep = codec->beep;
...@@ -191,6 +196,20 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable) ...@@ -191,6 +196,20 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
} }
EXPORT_SYMBOL_GPL(snd_hda_enable_beep_device); EXPORT_SYMBOL_GPL(snd_hda_enable_beep_device);
/**
* snd_hda_attach_beep_device - Attach a beep input device
* @codec: the HDA codec
* @nid: beep NID
*
* Attach a beep object to the given widget. If beep hint is turned off
* explicitly or beep_mode of the codec is turned off, this doesn't nothing.
*
* The attached beep device has to be registered via
* snd_hda_register_beep_device() and released via snd_hda_detach_beep_device()
* appropriately.
*
* Currently, only one beep device is allowed to each codec.
*/
int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
{ {
struct hda_beep *beep; struct hda_beep *beep;
...@@ -228,6 +247,10 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) ...@@ -228,6 +247,10 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
} }
EXPORT_SYMBOL_GPL(snd_hda_attach_beep_device); EXPORT_SYMBOL_GPL(snd_hda_attach_beep_device);
/**
* snd_hda_detach_beep_device - Detach the beep device
* @codec: the HDA codec
*/
void snd_hda_detach_beep_device(struct hda_codec *codec) void snd_hda_detach_beep_device(struct hda_codec *codec)
{ {
struct hda_beep *beep = codec->beep; struct hda_beep *beep = codec->beep;
...@@ -240,6 +263,10 @@ void snd_hda_detach_beep_device(struct hda_codec *codec) ...@@ -240,6 +263,10 @@ void snd_hda_detach_beep_device(struct hda_codec *codec)
} }
EXPORT_SYMBOL_GPL(snd_hda_detach_beep_device); EXPORT_SYMBOL_GPL(snd_hda_detach_beep_device);
/**
* snd_hda_register_beep_device - Register the beep device
* @codec: the HDA codec
*/
int snd_hda_register_beep_device(struct hda_codec *codec) int snd_hda_register_beep_device(struct hda_codec *codec)
{ {
struct hda_beep *beep = codec->beep; struct hda_beep *beep = codec->beep;
...@@ -269,6 +296,12 @@ static bool ctl_has_mute(struct snd_kcontrol *kcontrol) ...@@ -269,6 +296,12 @@ static bool ctl_has_mute(struct snd_kcontrol *kcontrol)
} }
/* get/put callbacks for beep mute mixer switches */ /* get/put callbacks for beep mute mixer switches */
/**
* snd_hda_mixer_amp_switch_get_beep - Get callback for beep controls
* @kcontrol: ctl element
* @ucontrol: pointer to get/store the data
*/
int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol, int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
...@@ -283,6 +316,11 @@ int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol, ...@@ -283,6 +316,11 @@ int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol,
} }
EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_get_beep); EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_get_beep);
/**
* snd_hda_mixer_amp_switch_put_beep - Put callback for beep controls
* @kcontrol: ctl element
* @ucontrol: pointer to get/store the data
*/
int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol, int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
......
...@@ -77,6 +77,10 @@ static struct hda_vendor_id hda_vendor_ids[] = { ...@@ -77,6 +77,10 @@ static struct hda_vendor_id hda_vendor_ids[] = {
static DEFINE_MUTEX(preset_mutex); static DEFINE_MUTEX(preset_mutex);
static LIST_HEAD(hda_preset_tables); static LIST_HEAD(hda_preset_tables);
/**
* snd_hda_add_codec_preset - Add a codec preset to the chain
* @preset: codec preset table to add
*/
int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset) int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset)
{ {
mutex_lock(&preset_mutex); mutex_lock(&preset_mutex);
...@@ -86,6 +90,10 @@ int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset) ...@@ -86,6 +90,10 @@ int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset)
} }
EXPORT_SYMBOL_GPL(snd_hda_add_codec_preset); EXPORT_SYMBOL_GPL(snd_hda_add_codec_preset);
/**
* snd_hda_delete_codec_preset - Delete a codec preset from the chain
* @preset: codec preset table to delete
*/
int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset) int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset)
{ {
mutex_lock(&preset_mutex); mutex_lock(&preset_mutex);
...@@ -416,7 +424,6 @@ static int read_and_add_raw_conns(struct hda_codec *codec, hda_nid_t nid) ...@@ -416,7 +424,6 @@ static int read_and_add_raw_conns(struct hda_codec *codec, hda_nid_t nid)
* snd_hda_get_conn_list - get connection list * snd_hda_get_conn_list - get connection list
* @codec: the HDA codec * @codec: the HDA codec
* @nid: NID to parse * @nid: NID to parse
* @len: number of connection list entries
* @listp: the pointer to store NID list * @listp: the pointer to store NID list
* *
* Parses the connection list of the given widget and stores the pointer * Parses the connection list of the given widget and stores the pointer
...@@ -1188,7 +1195,16 @@ unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid) ...@@ -1188,7 +1195,16 @@ unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid)
} }
EXPORT_SYMBOL_GPL(snd_hda_codec_get_pincfg); EXPORT_SYMBOL_GPL(snd_hda_codec_get_pincfg);
/* remember the current pinctl target value */ /**
* snd_hda_codec_set_pin_target - remember the current pinctl target value
* @codec: the HDA codec
* @nid: pin NID
* @val: assigned pinctl value
*
* This function stores the given value to a pinctl target value in the
* pincfg table. This isn't always as same as the actually written value
* but can be referred at any time via snd_hda_codec_get_pin_target().
*/
int snd_hda_codec_set_pin_target(struct hda_codec *codec, hda_nid_t nid, int snd_hda_codec_set_pin_target(struct hda_codec *codec, hda_nid_t nid,
unsigned int val) unsigned int val)
{ {
...@@ -1202,7 +1218,11 @@ int snd_hda_codec_set_pin_target(struct hda_codec *codec, hda_nid_t nid, ...@@ -1202,7 +1218,11 @@ int snd_hda_codec_set_pin_target(struct hda_codec *codec, hda_nid_t nid,
} }
EXPORT_SYMBOL_GPL(snd_hda_codec_set_pin_target); EXPORT_SYMBOL_GPL(snd_hda_codec_set_pin_target);
/* return the current pinctl target value */ /**
* snd_hda_codec_get_pin_target - return the current pinctl target value
* @codec: the HDA codec
* @nid: pin NID
*/
int snd_hda_codec_get_pin_target(struct hda_codec *codec, hda_nid_t nid) int snd_hda_codec_get_pin_target(struct hda_codec *codec, hda_nid_t nid)
{ {
struct hda_pincfg *pin; struct hda_pincfg *pin;
...@@ -1574,6 +1594,13 @@ int snd_hda_codec_new(struct hda_bus *bus, ...@@ -1574,6 +1594,13 @@ int snd_hda_codec_new(struct hda_bus *bus,
} }
EXPORT_SYMBOL_GPL(snd_hda_codec_new); EXPORT_SYMBOL_GPL(snd_hda_codec_new);
/**
* snd_hda_codec_update_widgets - Refresh widget caps and pin defaults
* @codec: the HDA codec
*
* Forcibly refresh the all widget caps and the init pin configurations of
* the given codec.
*/
int snd_hda_codec_update_widgets(struct hda_codec *codec) int snd_hda_codec_update_widgets(struct hda_codec *codec)
{ {
hda_nid_t fg; hda_nid_t fg;
...@@ -2004,6 +2031,7 @@ EXPORT_SYMBOL_GPL(query_amp_caps); ...@@ -2004,6 +2031,7 @@ EXPORT_SYMBOL_GPL(query_amp_caps);
* @codec: the HD-audio codec * @codec: the HD-audio codec
* @nid: the NID to query * @nid: the NID to query
* @dir: either #HDA_INPUT or #HDA_OUTPUT * @dir: either #HDA_INPUT or #HDA_OUTPUT
* @bits: bit mask to check the result
* *
* Check whether the widget has the given amp capability for the direction. * Check whether the widget has the given amp capability for the direction.
*/ */
...@@ -2023,7 +2051,7 @@ EXPORT_SYMBOL_GPL(snd_hda_check_amp_caps); ...@@ -2023,7 +2051,7 @@ EXPORT_SYMBOL_GPL(snd_hda_check_amp_caps);
* snd_hda_override_amp_caps - Override the AMP capabilities * snd_hda_override_amp_caps - Override the AMP capabilities
* @codec: the CODEC to clean up * @codec: the CODEC to clean up
* @nid: the NID to clean up * @nid: the NID to clean up
* @direction: either #HDA_INPUT or #HDA_OUTPUT * @dir: either #HDA_INPUT or #HDA_OUTPUT
* @caps: the capability bits to set * @caps: the capability bits to set
* *
* Override the cached AMP caps bits value by the given one. * Override the cached AMP caps bits value by the given one.
...@@ -2239,7 +2267,17 @@ int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid, ...@@ -2239,7 +2267,17 @@ int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid,
} }
EXPORT_SYMBOL_GPL(snd_hda_codec_amp_stereo); EXPORT_SYMBOL_GPL(snd_hda_codec_amp_stereo);
/* Works like snd_hda_codec_amp_update() but it writes the value only at /**
* snd_hda_codec_amp_init - initialize the AMP value
* @codec: the HDA codec
* @nid: NID to read the AMP value
* @ch: channel (left=0 or right=1)
* @dir: #HDA_INPUT or #HDA_OUTPUT
* @idx: the index value (only for input direction)
* @mask: bit mask to set
* @val: the bits value to set
*
* Works like snd_hda_codec_amp_update() but it writes the value only at
* the first access. If the amp was already initialized / updated beforehand, * the first access. If the amp was already initialized / updated beforehand,
* this does nothing. * this does nothing.
*/ */
...@@ -2250,6 +2288,17 @@ int snd_hda_codec_amp_init(struct hda_codec *codec, hda_nid_t nid, int ch, ...@@ -2250,6 +2288,17 @@ int snd_hda_codec_amp_init(struct hda_codec *codec, hda_nid_t nid, int ch,
} }
EXPORT_SYMBOL_GPL(snd_hda_codec_amp_init); EXPORT_SYMBOL_GPL(snd_hda_codec_amp_init);
/**
* snd_hda_codec_amp_init_stereo - initialize the stereo AMP value
* @codec: the HDA codec
* @nid: NID to read the AMP value
* @dir: #HDA_INPUT or #HDA_OUTPUT
* @idx: the index value (only for input direction)
* @mask: bit mask to set
* @val: the bits value to set
*
* Call snd_hda_codec_amp_init() for both stereo channels.
*/
int snd_hda_codec_amp_init_stereo(struct hda_codec *codec, hda_nid_t nid, int snd_hda_codec_amp_init_stereo(struct hda_codec *codec, hda_nid_t nid,
int dir, int idx, int mask, int val) int dir, int idx, int mask, int val)
{ {
...@@ -2320,6 +2369,8 @@ static u32 get_amp_max_value(struct hda_codec *codec, hda_nid_t nid, int dir, ...@@ -2320,6 +2369,8 @@ static u32 get_amp_max_value(struct hda_codec *codec, hda_nid_t nid, int dir,
/** /**
* snd_hda_mixer_amp_volume_info - Info callback for a standard AMP mixer * snd_hda_mixer_amp_volume_info - Info callback for a standard AMP mixer
* @kcontrol: referred ctl element
* @uinfo: pointer to get/store the data
* *
* The control element is supposed to have the private_value field * The control element is supposed to have the private_value field
* set up via HDA_COMPOSE_AMP_VAL*() or related macros. * set up via HDA_COMPOSE_AMP_VAL*() or related macros.
...@@ -2381,6 +2432,8 @@ update_amp_value(struct hda_codec *codec, hda_nid_t nid, ...@@ -2381,6 +2432,8 @@ update_amp_value(struct hda_codec *codec, hda_nid_t nid,
/** /**
* snd_hda_mixer_amp_volume_get - Get callback for a standard AMP mixer volume * snd_hda_mixer_amp_volume_get - Get callback for a standard AMP mixer volume
* @kcontrol: ctl element
* @ucontrol: pointer to get/store the data
* *
* The control element is supposed to have the private_value field * The control element is supposed to have the private_value field
* set up via HDA_COMPOSE_AMP_VAL*() or related macros. * set up via HDA_COMPOSE_AMP_VAL*() or related macros.
...@@ -2406,6 +2459,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_get); ...@@ -2406,6 +2459,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_get);
/** /**
* snd_hda_mixer_amp_volume_put - Put callback for a standard AMP mixer volume * snd_hda_mixer_amp_volume_put - Put callback for a standard AMP mixer volume
* @kcontrol: ctl element
* @ucontrol: pointer to get/store the data
* *
* The control element is supposed to have the private_value field * The control element is supposed to have the private_value field
* set up via HDA_COMPOSE_AMP_VAL*() or related macros. * set up via HDA_COMPOSE_AMP_VAL*() or related macros.
...@@ -2436,6 +2491,10 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_put); ...@@ -2436,6 +2491,10 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_put);
/** /**
* snd_hda_mixer_amp_volume_put - TLV callback for a standard AMP mixer volume * snd_hda_mixer_amp_volume_put - TLV callback for a standard AMP mixer volume
* @kcontrol: ctl element
* @op_flag: operation flag
* @size: byte size of input TLV
* @_tlv: TLV data
* *
* The control element is supposed to have the private_value field * The control element is supposed to have the private_value field
* set up via HDA_COMPOSE_AMP_VAL*() or related macros. * set up via HDA_COMPOSE_AMP_VAL*() or related macros.
...@@ -2634,7 +2693,10 @@ void snd_hda_ctls_clear(struct hda_codec *codec) ...@@ -2634,7 +2693,10 @@ void snd_hda_ctls_clear(struct hda_codec *codec)
snd_array_free(&codec->nids); snd_array_free(&codec->nids);
} }
/* pseudo device locking /**
* snd_hda_lock_devices - pseudo device locking
* @bus: the BUS
*
* toggle card->shutdown to allow/disallow the device access (as a hack) * toggle card->shutdown to allow/disallow the device access (as a hack)
*/ */
int snd_hda_lock_devices(struct hda_bus *bus) int snd_hda_lock_devices(struct hda_bus *bus)
...@@ -2671,6 +2733,10 @@ int snd_hda_lock_devices(struct hda_bus *bus) ...@@ -2671,6 +2733,10 @@ int snd_hda_lock_devices(struct hda_bus *bus)
} }
EXPORT_SYMBOL_GPL(snd_hda_lock_devices); EXPORT_SYMBOL_GPL(snd_hda_lock_devices);
/**
* snd_hda_unlock_devices - pseudo device unlocking
* @bus: the BUS
*/
void snd_hda_unlock_devices(struct hda_bus *bus) void snd_hda_unlock_devices(struct hda_bus *bus)
{ {
struct snd_card *card = bus->card; struct snd_card *card = bus->card;
...@@ -2857,7 +2923,7 @@ static int add_slave(struct hda_codec *codec, ...@@ -2857,7 +2923,7 @@ static int add_slave(struct hda_codec *codec,
} }
/** /**
* snd_hda_add_vmaster - create a virtual master control and add slaves * __snd_hda_add_vmaster - create a virtual master control and add slaves
* @codec: HD-audio codec * @codec: HD-audio codec
* @name: vmaster control name * @name: vmaster control name
* @tlv: TLV data (optional) * @tlv: TLV data (optional)
...@@ -2960,10 +3026,15 @@ static struct snd_kcontrol_new vmaster_mute_mode = { ...@@ -2960,10 +3026,15 @@ static struct snd_kcontrol_new vmaster_mute_mode = {
.put = vmaster_mute_mode_put, .put = vmaster_mute_mode_put,
}; };
/* /**
* Add a mute-LED hook with the given vmaster switch kctl * snd_hda_add_vmaster_hook - Add a vmaster hook for mute-LED
* "Mute-LED Mode" control is automatically created and associated with * @codec: the HDA codec
* the given hook. * @hook: the vmaster hook object
* @expose_enum_ctl: flag to create an enum ctl
*
* Add a mute-LED hook with the given vmaster switch kctl.
* When @expose_enum_ctl is set, "Mute-LED Mode" control is automatically
* created and associated with the given hook.
*/ */
int snd_hda_add_vmaster_hook(struct hda_codec *codec, int snd_hda_add_vmaster_hook(struct hda_codec *codec,
struct hda_vmaster_mute_hook *hook, struct hda_vmaster_mute_hook *hook,
...@@ -2985,9 +3056,12 @@ int snd_hda_add_vmaster_hook(struct hda_codec *codec, ...@@ -2985,9 +3056,12 @@ int snd_hda_add_vmaster_hook(struct hda_codec *codec,
} }
EXPORT_SYMBOL_GPL(snd_hda_add_vmaster_hook); EXPORT_SYMBOL_GPL(snd_hda_add_vmaster_hook);
/* /**
* Call the hook with the current value for synchronization * snd_hda_sync_vmaster_hook - Sync vmaster hook
* Should be called in init callback * @hook: the vmaster hook
*
* Call the hook with the current value for synchronization.
* Should be called in init callback.
*/ */
void snd_hda_sync_vmaster_hook(struct hda_vmaster_mute_hook *hook) void snd_hda_sync_vmaster_hook(struct hda_vmaster_mute_hook *hook)
{ {
...@@ -3012,6 +3086,8 @@ EXPORT_SYMBOL_GPL(snd_hda_sync_vmaster_hook); ...@@ -3012,6 +3086,8 @@ EXPORT_SYMBOL_GPL(snd_hda_sync_vmaster_hook);
/** /**
* snd_hda_mixer_amp_switch_info - Info callback for a standard AMP mixer switch * snd_hda_mixer_amp_switch_info - Info callback for a standard AMP mixer switch
* @kcontrol: referred ctl element
* @uinfo: pointer to get/store the data
* *
* The control element is supposed to have the private_value field * The control element is supposed to have the private_value field
* set up via HDA_COMPOSE_AMP_VAL*() or related macros. * set up via HDA_COMPOSE_AMP_VAL*() or related macros.
...@@ -3031,6 +3107,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_info); ...@@ -3031,6 +3107,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_info);
/** /**
* snd_hda_mixer_amp_switch_get - Get callback for a standard AMP mixer switch * snd_hda_mixer_amp_switch_get - Get callback for a standard AMP mixer switch
* @kcontrol: ctl element
* @ucontrol: pointer to get/store the data
* *
* The control element is supposed to have the private_value field * The control element is supposed to have the private_value field
* set up via HDA_COMPOSE_AMP_VAL*() or related macros. * set up via HDA_COMPOSE_AMP_VAL*() or related macros.
...@@ -3057,6 +3135,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_get); ...@@ -3057,6 +3135,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_get);
/** /**
* snd_hda_mixer_amp_switch_put - Put callback for a standard AMP mixer switch * snd_hda_mixer_amp_switch_put - Put callback for a standard AMP mixer switch
* @kcontrol: ctl element
* @ucontrol: pointer to get/store the data
* *
* The control element is supposed to have the private_value field * The control element is supposed to have the private_value field
* set up via HDA_COMPOSE_AMP_VAL*() or related macros. * set up via HDA_COMPOSE_AMP_VAL*() or related macros.
...@@ -3100,6 +3180,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_put); ...@@ -3100,6 +3180,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_put);
/** /**
* snd_hda_mixer_bind_switch_get - Get callback for a bound volume control * snd_hda_mixer_bind_switch_get - Get callback for a bound volume control
* @kcontrol: ctl element
* @ucontrol: pointer to get/store the data
* *
* The control element is supposed to have the private_value field * The control element is supposed to have the private_value field
* set up via HDA_BIND_MUTE*() macros. * set up via HDA_BIND_MUTE*() macros.
...@@ -3123,6 +3205,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_switch_get); ...@@ -3123,6 +3205,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_switch_get);
/** /**
* snd_hda_mixer_bind_switch_put - Put callback for a bound volume control * snd_hda_mixer_bind_switch_put - Put callback for a bound volume control
* @kcontrol: ctl element
* @ucontrol: pointer to get/store the data
* *
* The control element is supposed to have the private_value field * The control element is supposed to have the private_value field
* set up via HDA_BIND_MUTE*() macros. * set up via HDA_BIND_MUTE*() macros.
...@@ -3153,6 +3237,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_switch_put); ...@@ -3153,6 +3237,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_switch_put);
/** /**
* snd_hda_mixer_bind_ctls_info - Info callback for a generic bound control * snd_hda_mixer_bind_ctls_info - Info callback for a generic bound control
* @kcontrol: referred ctl element
* @uinfo: pointer to get/store the data
* *
* The control element is supposed to have the private_value field * The control element is supposed to have the private_value field
* set up via HDA_BIND_VOL() or HDA_BIND_SW() macros. * set up via HDA_BIND_VOL() or HDA_BIND_SW() macros.
...@@ -3176,6 +3262,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_info); ...@@ -3176,6 +3262,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_info);
/** /**
* snd_hda_mixer_bind_ctls_get - Get callback for a generic bound control * snd_hda_mixer_bind_ctls_get - Get callback for a generic bound control
* @kcontrol: ctl element
* @ucontrol: pointer to get/store the data
* *
* The control element is supposed to have the private_value field * The control element is supposed to have the private_value field
* set up via HDA_BIND_VOL() or HDA_BIND_SW() macros. * set up via HDA_BIND_VOL() or HDA_BIND_SW() macros.
...@@ -3199,6 +3287,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_get); ...@@ -3199,6 +3287,8 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_get);
/** /**
* snd_hda_mixer_bind_ctls_put - Put callback for a generic bound control * snd_hda_mixer_bind_ctls_put - Put callback for a generic bound control
* @kcontrol: ctl element
* @ucontrol: pointer to get/store the data
* *
* The control element is supposed to have the private_value field * The control element is supposed to have the private_value field
* set up via HDA_BIND_VOL() or HDA_BIND_SW() macros. * set up via HDA_BIND_VOL() or HDA_BIND_SW() macros.
...@@ -3228,6 +3318,10 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_put); ...@@ -3228,6 +3318,10 @@ EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_put);
/** /**
* snd_hda_mixer_bind_tlv - TLV callback for a generic bound control * snd_hda_mixer_bind_tlv - TLV callback for a generic bound control
* @kcontrol: ctl element
* @op_flag: operation flag
* @size: byte size of input TLV
* @tlv: TLV data
* *
* The control element is supposed to have the private_value field * The control element is supposed to have the private_value field
* set up via HDA_BIND_VOL() macro. * set up via HDA_BIND_VOL() macro.
...@@ -3569,7 +3663,11 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec, ...@@ -3569,7 +3663,11 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
} }
EXPORT_SYMBOL_GPL(snd_hda_create_dig_out_ctls); EXPORT_SYMBOL_GPL(snd_hda_create_dig_out_ctls);
/* get the hda_spdif_out entry from the given NID /**
* snd_hda_spdif_out_of_nid - get the hda_spdif_out entry from the given NID
* @codec: the HDA codec
* @nid: widget NID
*
* call within spdif_mutex lock * call within spdif_mutex lock
*/ */
struct hda_spdif_out *snd_hda_spdif_out_of_nid(struct hda_codec *codec, struct hda_spdif_out *snd_hda_spdif_out_of_nid(struct hda_codec *codec,
...@@ -3586,6 +3684,13 @@ struct hda_spdif_out *snd_hda_spdif_out_of_nid(struct hda_codec *codec, ...@@ -3586,6 +3684,13 @@ struct hda_spdif_out *snd_hda_spdif_out_of_nid(struct hda_codec *codec,
} }
EXPORT_SYMBOL_GPL(snd_hda_spdif_out_of_nid); EXPORT_SYMBOL_GPL(snd_hda_spdif_out_of_nid);
/**
* snd_hda_spdif_ctls_unassign - Unassign the given SPDIF ctl
* @codec: the HDA codec
* @idx: the SPDIF ctl index
*
* Unassign the widget from the given SPDIF control.
*/
void snd_hda_spdif_ctls_unassign(struct hda_codec *codec, int idx) void snd_hda_spdif_ctls_unassign(struct hda_codec *codec, int idx)
{ {
struct hda_spdif_out *spdif; struct hda_spdif_out *spdif;
...@@ -3597,6 +3702,14 @@ void snd_hda_spdif_ctls_unassign(struct hda_codec *codec, int idx) ...@@ -3597,6 +3702,14 @@ void snd_hda_spdif_ctls_unassign(struct hda_codec *codec, int idx)
} }
EXPORT_SYMBOL_GPL(snd_hda_spdif_ctls_unassign); EXPORT_SYMBOL_GPL(snd_hda_spdif_ctls_unassign);
/**
* snd_hda_spdif_ctls_assign - Assign the SPDIF controls to the given NID
* @codec: the HDA codec
* @idx: the SPDIF ctl idx
* @nid: widget NID
*
* Assign the widget to the SPDIF control with the given index.
*/
void snd_hda_spdif_ctls_assign(struct hda_codec *codec, int idx, hda_nid_t nid) void snd_hda_spdif_ctls_assign(struct hda_codec *codec, int idx, hda_nid_t nid)
{ {
struct hda_spdif_out *spdif; struct hda_spdif_out *spdif;
...@@ -3916,6 +4029,16 @@ void snd_hda_codec_flush_cache(struct hda_codec *codec) ...@@ -3916,6 +4029,16 @@ void snd_hda_codec_flush_cache(struct hda_codec *codec)
} }
EXPORT_SYMBOL_GPL(snd_hda_codec_flush_cache); EXPORT_SYMBOL_GPL(snd_hda_codec_flush_cache);
/**
* snd_hda_codec_set_power_to_all - Set the power state to all widgets
* @codec: the HDA codec
* @fg: function group (not used now)
* @power_state: the power state to set (AC_PWRST_*)
*
* Set the given power state to all widgets that have the power control.
* If the codec has power_filter set, it evaluates the power state and
* filter out if it's unchanged as D3.
*/
void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg, void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg,
unsigned int power_state) unsigned int power_state)
{ {
...@@ -3980,7 +4103,15 @@ static unsigned int hda_sync_power_state(struct hda_codec *codec, ...@@ -3980,7 +4103,15 @@ static unsigned int hda_sync_power_state(struct hda_codec *codec,
return state; return state;
} }
/* don't power down the widget if it controls eapd and EAPD_BTLENABLE is set */ /**
* snd_hda_codec_eapd_power_filter - A power filter callback for EAPD
* @codec: the HDA codec
* @nid: widget NID
* @power_state: power state to evalue
*
* Don't power down the widget if it controls eapd and EAPD_BTLENABLE is set.
* This can be used a codec power_filter callback.
*/
unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec, unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec,
hda_nid_t nid, hda_nid_t nid,
unsigned int power_state) unsigned int power_state)
...@@ -4305,6 +4436,7 @@ static struct hda_rate_tbl rate_bits[] = { ...@@ -4305,6 +4436,7 @@ static struct hda_rate_tbl rate_bits[] = {
* @channels: the number of channels * @channels: the number of channels
* @format: the PCM format (SNDRV_PCM_FORMAT_XXX) * @format: the PCM format (SNDRV_PCM_FORMAT_XXX)
* @maxbps: the max. bps * @maxbps: the max. bps
* @spdif_ctls: HD-audio SPDIF status bits (0 if irrelevant)
* *
* Calculate the format bitset from the given rate, channels and th PCM format. * Calculate the format bitset from the given rate, channels and th PCM format.
* *
...@@ -4640,6 +4772,17 @@ static int set_pcm_default_values(struct hda_codec *codec, ...@@ -4640,6 +4772,17 @@ static int set_pcm_default_values(struct hda_codec *codec,
/* /*
* codec prepare/cleanup entries * codec prepare/cleanup entries
*/ */
/**
* snd_hda_codec_prepare - Prepare a stream
* @codec: the HDA codec
* @hinfo: PCM information
* @stream: stream tag to assign
* @format: format id to assign
* @substream: PCM substream to assign
*
* Calls the prepare callback set by the codec with the given arguments.
* Clean up the inactive streams when successful.
*/
int snd_hda_codec_prepare(struct hda_codec *codec, int snd_hda_codec_prepare(struct hda_codec *codec,
struct hda_pcm_stream *hinfo, struct hda_pcm_stream *hinfo,
unsigned int stream, unsigned int stream,
...@@ -4656,6 +4799,14 @@ int snd_hda_codec_prepare(struct hda_codec *codec, ...@@ -4656,6 +4799,14 @@ int snd_hda_codec_prepare(struct hda_codec *codec,
} }
EXPORT_SYMBOL_GPL(snd_hda_codec_prepare); EXPORT_SYMBOL_GPL(snd_hda_codec_prepare);
/**
* snd_hda_codec_cleanup - Prepare a stream
* @codec: the HDA codec
* @hinfo: PCM information
* @substream: PCM substream
*
* Calls the cleanup callback set by the codec with the given arguments.
*/
void snd_hda_codec_cleanup(struct hda_codec *codec, void snd_hda_codec_cleanup(struct hda_codec *codec,
struct hda_pcm_stream *hinfo, struct hda_pcm_stream *hinfo,
struct snd_pcm_substream *substream) struct snd_pcm_substream *substream)
...@@ -4980,6 +5131,7 @@ static void __snd_hda_power_down(struct hda_codec *codec) ...@@ -4980,6 +5131,7 @@ static void __snd_hda_power_down(struct hda_codec *codec)
* snd_hda_power_save - Power-up/down/sync the codec * snd_hda_power_save - Power-up/down/sync the codec
* @codec: HD-audio codec * @codec: HD-audio codec
* @delta: the counter delta to change * @delta: the counter delta to change
* @d3wait: sync for D3 transition complete
* *
* Change the power-up counter via @delta, and power up or down the hardware * Change the power-up counter via @delta, and power up or down the hardware
* appropriately. For the power-down, queue to the delayed action. * appropriately. For the power-down, queue to the delayed action.
...@@ -5055,6 +5207,10 @@ EXPORT_SYMBOL_GPL(snd_hda_check_amp_list_power); ...@@ -5055,6 +5207,10 @@ EXPORT_SYMBOL_GPL(snd_hda_check_amp_list_power);
/** /**
* snd_hda_ch_mode_info - Info callback helper for the channel mode enum * snd_hda_ch_mode_info - Info callback helper for the channel mode enum
* @codec: the HDA codec
* @uinfo: pointer to get/store the data
* @chmode: channel mode array
* @num_chmodes: channel mode array size
*/ */
int snd_hda_ch_mode_info(struct hda_codec *codec, int snd_hda_ch_mode_info(struct hda_codec *codec,
struct snd_ctl_elem_info *uinfo, struct snd_ctl_elem_info *uinfo,
...@@ -5074,6 +5230,11 @@ EXPORT_SYMBOL_GPL(snd_hda_ch_mode_info); ...@@ -5074,6 +5230,11 @@ EXPORT_SYMBOL_GPL(snd_hda_ch_mode_info);
/** /**
* snd_hda_ch_mode_get - Get callback helper for the channel mode enum * snd_hda_ch_mode_get - Get callback helper for the channel mode enum
* @codec: the HDA codec
* @ucontrol: pointer to get/store the data
* @chmode: channel mode array
* @num_chmodes: channel mode array size
* @max_channels: max number of channels
*/ */
int snd_hda_ch_mode_get(struct hda_codec *codec, int snd_hda_ch_mode_get(struct hda_codec *codec,
struct snd_ctl_elem_value *ucontrol, struct snd_ctl_elem_value *ucontrol,
...@@ -5095,6 +5256,11 @@ EXPORT_SYMBOL_GPL(snd_hda_ch_mode_get); ...@@ -5095,6 +5256,11 @@ EXPORT_SYMBOL_GPL(snd_hda_ch_mode_get);
/** /**
* snd_hda_ch_mode_put - Put callback helper for the channel mode enum * snd_hda_ch_mode_put - Put callback helper for the channel mode enum
* @codec: the HDA codec
* @ucontrol: pointer to get/store the data
* @chmode: channel mode array
* @num_chmodes: channel mode array size
* @max_channelsp: pointer to store the max channels
*/ */
int snd_hda_ch_mode_put(struct hda_codec *codec, int snd_hda_ch_mode_put(struct hda_codec *codec,
struct snd_ctl_elem_value *ucontrol, struct snd_ctl_elem_value *ucontrol,
...@@ -5123,6 +5289,8 @@ EXPORT_SYMBOL_GPL(snd_hda_ch_mode_put); ...@@ -5123,6 +5289,8 @@ EXPORT_SYMBOL_GPL(snd_hda_ch_mode_put);
/** /**
* snd_hda_input_mux_info_info - Info callback helper for the input-mux enum * snd_hda_input_mux_info_info - Info callback helper for the input-mux enum
* @imux: imux helper object
* @uinfo: pointer to get/store the data
*/ */
int snd_hda_input_mux_info(const struct hda_input_mux *imux, int snd_hda_input_mux_info(const struct hda_input_mux *imux,
struct snd_ctl_elem_info *uinfo) struct snd_ctl_elem_info *uinfo)
...@@ -5144,6 +5312,11 @@ EXPORT_SYMBOL_GPL(snd_hda_input_mux_info); ...@@ -5144,6 +5312,11 @@ EXPORT_SYMBOL_GPL(snd_hda_input_mux_info);
/** /**
* snd_hda_input_mux_info_put - Put callback helper for the input-mux enum * snd_hda_input_mux_info_put - Put callback helper for the input-mux enum
* @codec: the HDA codec
* @imux: imux helper object
* @ucontrol: pointer to get/store the data
* @nid: input mux NID
* @cur_val: pointer to get/store the current imux value
*/ */
int snd_hda_input_mux_put(struct hda_codec *codec, int snd_hda_input_mux_put(struct hda_codec *codec,
const struct hda_input_mux *imux, const struct hda_input_mux *imux,
...@@ -5168,7 +5341,13 @@ int snd_hda_input_mux_put(struct hda_codec *codec, ...@@ -5168,7 +5341,13 @@ int snd_hda_input_mux_put(struct hda_codec *codec,
EXPORT_SYMBOL_GPL(snd_hda_input_mux_put); EXPORT_SYMBOL_GPL(snd_hda_input_mux_put);
/* /**
* snd_hda_enum_helper_info - Helper for simple enum ctls
* @kcontrol: ctl element
* @uinfo: pointer to get/store the data
* @num_items: number of enum items
* @texts: enum item string array
*
* process kcontrol info callback of a simple string enum array * process kcontrol info callback of a simple string enum array
* when @num_items is 0 or @texts is NULL, assume a boolean enum array * when @num_items is 0 or @texts is NULL, assume a boolean enum array
*/ */
...@@ -5257,6 +5436,8 @@ EXPORT_SYMBOL_GPL(snd_hda_bus_reboot_notify); ...@@ -5257,6 +5436,8 @@ EXPORT_SYMBOL_GPL(snd_hda_bus_reboot_notify);
/** /**
* snd_hda_multi_out_dig_open - open the digital out in the exclusive mode * snd_hda_multi_out_dig_open - open the digital out in the exclusive mode
* @codec: the HDA codec
* @mout: hda_multi_out object
*/ */
int snd_hda_multi_out_dig_open(struct hda_codec *codec, int snd_hda_multi_out_dig_open(struct hda_codec *codec,
struct hda_multi_out *mout) struct hda_multi_out *mout)
...@@ -5273,6 +5454,11 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_open); ...@@ -5273,6 +5454,11 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_open);
/** /**
* snd_hda_multi_out_dig_prepare - prepare the digital out stream * snd_hda_multi_out_dig_prepare - prepare the digital out stream
* @codec: the HDA codec
* @mout: hda_multi_out object
* @stream_tag: stream tag to assign
* @format: format id to assign
* @substream: PCM substream to assign
*/ */
int snd_hda_multi_out_dig_prepare(struct hda_codec *codec, int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
struct hda_multi_out *mout, struct hda_multi_out *mout,
...@@ -5289,6 +5475,8 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_prepare); ...@@ -5289,6 +5475,8 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_prepare);
/** /**
* snd_hda_multi_out_dig_cleanup - clean-up the digital out stream * snd_hda_multi_out_dig_cleanup - clean-up the digital out stream
* @codec: the HDA codec
* @mout: hda_multi_out object
*/ */
int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec, int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec,
struct hda_multi_out *mout) struct hda_multi_out *mout)
...@@ -5302,6 +5490,8 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_cleanup); ...@@ -5302,6 +5490,8 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_cleanup);
/** /**
* snd_hda_multi_out_dig_close - release the digital out stream * snd_hda_multi_out_dig_close - release the digital out stream
* @codec: the HDA codec
* @mout: hda_multi_out object
*/ */
int snd_hda_multi_out_dig_close(struct hda_codec *codec, int snd_hda_multi_out_dig_close(struct hda_codec *codec,
struct hda_multi_out *mout) struct hda_multi_out *mout)
...@@ -5315,6 +5505,10 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_close); ...@@ -5315,6 +5505,10 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_close);
/** /**
* snd_hda_multi_out_analog_open - open analog outputs * snd_hda_multi_out_analog_open - open analog outputs
* @codec: the HDA codec
* @mout: hda_multi_out object
* @substream: PCM substream to assign
* @hinfo: PCM information to assign
* *
* Open analog outputs and set up the hw-constraints. * Open analog outputs and set up the hw-constraints.
* If the digital outputs can be opened as slave, open the digital * If the digital outputs can be opened as slave, open the digital
...@@ -5365,6 +5559,11 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_open); ...@@ -5365,6 +5559,11 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_open);
/** /**
* snd_hda_multi_out_analog_prepare - Preapre the analog outputs. * snd_hda_multi_out_analog_prepare - Preapre the analog outputs.
* @codec: the HDA codec
* @mout: hda_multi_out object
* @stream_tag: stream tag to assign
* @format: format id to assign
* @substream: PCM substream to assign
* *
* Set up the i/o for analog out. * Set up the i/o for analog out.
* When the digital out is available, copy the front out to digital out, too. * When the digital out is available, copy the front out to digital out, too.
...@@ -5442,6 +5641,8 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_prepare); ...@@ -5442,6 +5641,8 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_prepare);
/** /**
* snd_hda_multi_out_analog_cleanup - clean up the setting for analog out * snd_hda_multi_out_analog_cleanup - clean up the setting for analog out
* @codec: the HDA codec
* @mout: hda_multi_out object
*/ */
int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec, int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
struct hda_multi_out *mout) struct hda_multi_out *mout)
...@@ -5473,6 +5674,8 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_cleanup); ...@@ -5473,6 +5674,8 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_cleanup);
/** /**
* snd_hda_get_default_vref - Get the default (mic) VREF pin bits * snd_hda_get_default_vref - Get the default (mic) VREF pin bits
* @codec: the HDA codec
* @pin: referred pin NID
* *
* Guess the suitable VREF pin bits to be set as the pin-control value. * Guess the suitable VREF pin bits to be set as the pin-control value.
* Note: the function doesn't set the AC_PINCTL_IN_EN bit. * Note: the function doesn't set the AC_PINCTL_IN_EN bit.
...@@ -5498,7 +5701,12 @@ unsigned int snd_hda_get_default_vref(struct hda_codec *codec, hda_nid_t pin) ...@@ -5498,7 +5701,12 @@ unsigned int snd_hda_get_default_vref(struct hda_codec *codec, hda_nid_t pin)
} }
EXPORT_SYMBOL_GPL(snd_hda_get_default_vref); EXPORT_SYMBOL_GPL(snd_hda_get_default_vref);
/* correct the pin ctl value for matching with the pin cap */ /**
* snd_hda_correct_pin_ctl - correct the pin ctl value for matching with the pin cap
* @codec: the HDA codec
* @pin: referred pin NID
* @val: pin ctl value to audit
*/
unsigned int snd_hda_correct_pin_ctl(struct hda_codec *codec, unsigned int snd_hda_correct_pin_ctl(struct hda_codec *codec,
hda_nid_t pin, unsigned int val) hda_nid_t pin, unsigned int val)
{ {
...@@ -5549,6 +5757,19 @@ unsigned int snd_hda_correct_pin_ctl(struct hda_codec *codec, ...@@ -5549,6 +5757,19 @@ unsigned int snd_hda_correct_pin_ctl(struct hda_codec *codec,
} }
EXPORT_SYMBOL_GPL(snd_hda_correct_pin_ctl); EXPORT_SYMBOL_GPL(snd_hda_correct_pin_ctl);
/**
* _snd_hda_pin_ctl - Helper to set pin ctl value
* @codec: the HDA codec
* @pin: referred pin NID
* @val: pin control value to set
* @cached: access over codec pinctl cache or direct write
*
* This function is a helper to set a pin ctl value more safely.
* It corrects the pin ctl value via snd_hda_correct_pin_ctl(), stores the
* value in pin target array via snd_hda_codec_set_pin_target(), then
* actually writes the value via either snd_hda_codec_update_cache() or
* snd_hda_codec_write() depending on @cached flag.
*/
int _snd_hda_set_pin_ctl(struct hda_codec *codec, hda_nid_t pin, int _snd_hda_set_pin_ctl(struct hda_codec *codec, hda_nid_t pin,
unsigned int val, bool cached) unsigned int val, bool cached)
{ {
...@@ -5565,6 +5786,11 @@ EXPORT_SYMBOL_GPL(_snd_hda_set_pin_ctl); ...@@ -5565,6 +5786,11 @@ EXPORT_SYMBOL_GPL(_snd_hda_set_pin_ctl);
/** /**
* snd_hda_add_imux_item - Add an item to input_mux * snd_hda_add_imux_item - Add an item to input_mux
* @codec: the HDA codec
* @imux: imux helper object
* @label: the name of imux item to assign
* @index: index number of imux item to assign
* @type_idx: pointer to store the resultant label index
* *
* When the same label is used already in the existing items, the number * When the same label is used already in the existing items, the number
* suffix is appended to the label. This label index number is stored * suffix is appended to the label. This label index number is stored
......
...@@ -371,7 +371,7 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid, ...@@ -371,7 +371,7 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid,
return ret; return ret;
} }
/** /*
* SNDRV_PCM_RATE_* and AC_PAR_PCM values don't match, print correct rates with * SNDRV_PCM_RATE_* and AC_PAR_PCM values don't match, print correct rates with
* hdmi-specific routine. * hdmi-specific routine.
*/ */
......
...@@ -20,6 +20,16 @@ ...@@ -20,6 +20,16 @@
#include "hda_auto_parser.h" #include "hda_auto_parser.h"
#include "hda_jack.h" #include "hda_jack.h"
/**
* is_jack_detectable - Check whether the given pin is jack-detectable
* @codec: the HDA codec
* @nid: pin NID
*
* Check whether the given pin is capable to report the jack detection.
* The jack detection might not work by various reasons, e.g. the jack
* detection is prohibited in the codec level, the pin config has
* AC_DEFCFG_MISC_NO_PRESENCE bit, no unsol support, etc.
*/
bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
{ {
if (codec->no_jack_detect) if (codec->no_jack_detect)
...@@ -57,6 +67,8 @@ static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid) ...@@ -57,6 +67,8 @@ static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid)
/** /**
* snd_hda_jack_tbl_get - query the jack-table entry for the given NID * snd_hda_jack_tbl_get - query the jack-table entry for the given NID
* @codec: the HDA codec
* @nid: pin NID to refer to
*/ */
struct hda_jack_tbl * struct hda_jack_tbl *
snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid) snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid)
...@@ -75,6 +87,8 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_tbl_get); ...@@ -75,6 +87,8 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_tbl_get);
/** /**
* snd_hda_jack_tbl_get_from_tag - query the jack-table entry for the given tag * snd_hda_jack_tbl_get_from_tag - query the jack-table entry for the given tag
* @codec: the HDA codec
* @tag: tag value to refer to
*/ */
struct hda_jack_tbl * struct hda_jack_tbl *
snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec, unsigned char tag) snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec, unsigned char tag)
...@@ -93,6 +107,8 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_tbl_get_from_tag); ...@@ -93,6 +107,8 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_tbl_get_from_tag);
/** /**
* snd_hda_jack_tbl_new - create a jack-table entry for the given NID * snd_hda_jack_tbl_new - create a jack-table entry for the given NID
* @codec: the HDA codec
* @nid: pin NID to assign
*/ */
static struct hda_jack_tbl * static struct hda_jack_tbl *
snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid) snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid)
...@@ -162,6 +178,7 @@ static void jack_detect_update(struct hda_codec *codec, ...@@ -162,6 +178,7 @@ static void jack_detect_update(struct hda_codec *codec,
/** /**
* snd_hda_set_dirty_all - Mark all the cached as dirty * snd_hda_set_dirty_all - Mark all the cached as dirty
* @codec: the HDA codec
* *
* This function sets the dirty flag to all entries of jack table. * This function sets the dirty flag to all entries of jack table.
* It's called from the resume path in hda_codec.c. * It's called from the resume path in hda_codec.c.
...@@ -218,6 +235,9 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_detect_state); ...@@ -218,6 +235,9 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_detect_state);
/** /**
* snd_hda_jack_detect_enable - enable the jack-detection * snd_hda_jack_detect_enable - enable the jack-detection
* @codec: the HDA codec
* @nid: pin NID to enable
* @func: callback function to register
* *
* In the case of error, the return value will be a pointer embedded with * In the case of error, the return value will be a pointer embedded with
* errno. Check and handle the return value appropriately with standard * errno. Check and handle the return value appropriately with standard
...@@ -258,6 +278,14 @@ snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid, ...@@ -258,6 +278,14 @@ snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid,
} }
EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable_callback); EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable_callback);
/**
* snd_hda_jack_detect_enable - Enable the jack detection on the given pin
* @codec: the HDA codec
* @nid: pin NID to enable jack detection
*
* Enable the jack detection with the default callback. Returns zero if
* successful or a negative error code.
*/
int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid) int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid)
{ {
return PTR_ERR_OR_ZERO(snd_hda_jack_detect_enable_callback(codec, nid, NULL)); return PTR_ERR_OR_ZERO(snd_hda_jack_detect_enable_callback(codec, nid, NULL));
...@@ -266,6 +294,9 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable); ...@@ -266,6 +294,9 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable);
/** /**
* snd_hda_jack_set_gating_jack - Set gating jack. * snd_hda_jack_set_gating_jack - Set gating jack.
* @codec: the HDA codec
* @gated_nid: gated pin NID
* @gating_nid: gating pin NID
* *
* Indicates the gated jack is only valid when the gating jack is plugged. * Indicates the gated jack is only valid when the gating jack is plugged.
*/ */
...@@ -287,6 +318,7 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_set_gating_jack); ...@@ -287,6 +318,7 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_set_gating_jack);
/** /**
* snd_hda_jack_report_sync - sync the states of all jacks and report if changed * snd_hda_jack_report_sync - sync the states of all jacks and report if changed
* @codec: the HDA codec
*/ */
void snd_hda_jack_report_sync(struct hda_codec *codec) void snd_hda_jack_report_sync(struct hda_codec *codec)
{ {
...@@ -349,6 +381,11 @@ static void hda_free_jack_priv(struct snd_jack *jack) ...@@ -349,6 +381,11 @@ static void hda_free_jack_priv(struct snd_jack *jack)
/** /**
* snd_hda_jack_add_kctl - Add a kctl for the given pin * snd_hda_jack_add_kctl - Add a kctl for the given pin
* @codec: the HDA codec
* @nid: pin NID to assign
* @name: string name for the jack
* @idx: index number for the jack
* @phantom_jack: flag to deal as a phantom jack
* *
* This assigns a jack-detection kctl to the given pin. The kcontrol * This assigns a jack-detection kctl to the given pin. The kcontrol
* will have the given name and index. * will have the given name and index.
...@@ -391,6 +428,15 @@ static int __snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, ...@@ -391,6 +428,15 @@ static int __snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
return 0; return 0;
} }
/**
* snd_hda_jack_add_kctl - Add a jack kctl for the given pin
* @codec: the HDA codec
* @nid: pin NID
* @name: the name string for the jack ctl
* @idx: the ctl index for the jack ctl
*
* This is a simple helper calling __snd_hda_jack_add_kctl().
*/
int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
const char *name, int idx) const char *name, int idx)
{ {
...@@ -456,6 +502,8 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, ...@@ -456,6 +502,8 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,
/** /**
* snd_hda_jack_add_kctls - Add kctls for all pins included in the given pincfg * snd_hda_jack_add_kctls - Add kctls for all pins included in the given pincfg
* @codec: the HDA codec
* @cfg: pin config table to parse
*/ */
int snd_hda_jack_add_kctls(struct hda_codec *codec, int snd_hda_jack_add_kctls(struct hda_codec *codec,
const struct auto_pin_cfg *cfg) const struct auto_pin_cfg *cfg)
...@@ -531,6 +579,11 @@ static void call_jack_callback(struct hda_codec *codec, ...@@ -531,6 +579,11 @@ static void call_jack_callback(struct hda_codec *codec,
} }
} }
/**
* snd_hda_jack_unsol_event - Handle an unsolicited event
* @codec: the HDA codec
* @res: the unsolicited event data
*/
void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res) void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res)
{ {
struct hda_jack_tbl *event; struct hda_jack_tbl *event;
...@@ -546,6 +599,13 @@ void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res) ...@@ -546,6 +599,13 @@ void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res)
} }
EXPORT_SYMBOL_GPL(snd_hda_jack_unsol_event); EXPORT_SYMBOL_GPL(snd_hda_jack_unsol_event);
/**
* snd_hda_jack_poll_all - Poll all jacks
* @codec: the HDA codec
*
* Poll all detectable jacks with dirty flag, update the status, call
* callbacks and call snd_hda_jack_report_sync() if any changes are found.
*/
void snd_hda_jack_poll_all(struct hda_codec *codec) void snd_hda_jack_poll_all(struct hda_codec *codec)
{ {
struct hda_jack_tbl *jack = codec->jacktbl.list; struct hda_jack_tbl *jack = codec->jacktbl.list;
......
...@@ -72,6 +72,11 @@ enum { ...@@ -72,6 +72,11 @@ enum {
int snd_hda_jack_detect_state(struct hda_codec *codec, hda_nid_t nid); int snd_hda_jack_detect_state(struct hda_codec *codec, hda_nid_t nid);
/**
* snd_hda_jack_detect - Detect the jack
* @codec: the HDA codec
* @nid: pin NID to check jack detection
*/
static inline bool snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) static inline bool snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid)
{ {
return snd_hda_jack_detect_state(codec, nid) != HDA_JACK_NOT_PRESENT; return snd_hda_jack_detect_state(codec, nid) != HDA_JACK_NOT_PRESENT;
......
...@@ -417,8 +417,13 @@ static DEVICE_ATTR_RW(user_pin_configs); ...@@ -417,8 +417,13 @@ static DEVICE_ATTR_RW(user_pin_configs);
static DEVICE_ATTR_WO(reconfig); static DEVICE_ATTR_WO(reconfig);
static DEVICE_ATTR_WO(clear); static DEVICE_ATTR_WO(clear);
/* /**
* Look for hint string * snd_hda_get_hint - Look for hint string
* @codec: the HDA codec
* @key: the hint key string
*
* Look for a hint key/value pair matching with the given key string
* and returns the value string. If nothing found, returns NULL.
*/ */
const char *snd_hda_get_hint(struct hda_codec *codec, const char *key) const char *snd_hda_get_hint(struct hda_codec *codec, const char *key)
{ {
...@@ -427,6 +432,15 @@ const char *snd_hda_get_hint(struct hda_codec *codec, const char *key) ...@@ -427,6 +432,15 @@ const char *snd_hda_get_hint(struct hda_codec *codec, const char *key)
} }
EXPORT_SYMBOL_GPL(snd_hda_get_hint); EXPORT_SYMBOL_GPL(snd_hda_get_hint);
/**
* snd_hda_get_bool_hint - Get a boolean hint value
* @codec: the HDA codec
* @key: the hint key string
*
* Look for a hint key/value pair matching with the given key string
* and returns a boolean value parsed from the value. If no matching
* key is found, return a negative value.
*/
int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key) int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key)
{ {
const char *p; const char *p;
...@@ -453,6 +467,16 @@ int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key) ...@@ -453,6 +467,16 @@ int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key)
} }
EXPORT_SYMBOL_GPL(snd_hda_get_bool_hint); EXPORT_SYMBOL_GPL(snd_hda_get_bool_hint);
/**
* snd_hda_get_bool_hint - Get a boolean hint value
* @codec: the HDA codec
* @key: the hint key string
* @valp: pointer to store a value
*
* Look for a hint key/value pair matching with the given key string
* and stores the integer value to @valp. If no matching key is found,
* return a negative error code. Otherwise it returns zero.
*/
int snd_hda_get_int_hint(struct hda_codec *codec, const char *key, int *valp) int snd_hda_get_int_hint(struct hda_codec *codec, const char *key, int *valp)
{ {
const char *p; const char *p;
...@@ -690,8 +714,11 @@ static int get_line_from_fw(char *buf, int size, size_t *fw_size_p, ...@@ -690,8 +714,11 @@ static int get_line_from_fw(char *buf, int size, size_t *fw_size_p,
return 1; return 1;
} }
/* /**
* load a "patch" firmware file and parse it * snd_hda_load_patch - load a "patch" firmware file and parse it
* @bus: HD-audio bus
* @fw_size: the firmware byte size
* @fw_buf: the firmware data
*/ */
int snd_hda_load_patch(struct hda_bus *bus, size_t fw_size, const void *fw_buf) int snd_hda_load_patch(struct hda_bus *bus, size_t fw_size, const void *fw_buf)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment