mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 10:57:46 +00:00
ALSA: hda: make use of core codec fns
Now that we have introduced the core fns we should make hda use these helpers Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
1b5e6167c2
commit
70b4891cc8
3 changed files with 15 additions and 54 deletions
|
@ -90,50 +90,6 @@ static int codec_exec_verb(struct hdac_device *dev, unsigned int cmd,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* snd_hda_codec_read - send a command and get the response
|
|
||||||
* @codec: the HDA codec
|
|
||||||
* @nid: NID to send the command
|
|
||||||
* @flags: optional bit flags
|
|
||||||
* @verb: the verb to send
|
|
||||||
* @parm: the parameter for the verb
|
|
||||||
*
|
|
||||||
* Send a single command and read the corresponding response.
|
|
||||||
*
|
|
||||||
* Returns the obtained response value, or -1 for an error.
|
|
||||||
*/
|
|
||||||
unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid,
|
|
||||||
int flags,
|
|
||||||
unsigned int verb, unsigned int parm)
|
|
||||||
{
|
|
||||||
unsigned int cmd = snd_hdac_make_cmd(&codec->core, nid, verb, parm);
|
|
||||||
unsigned int res;
|
|
||||||
if (snd_hdac_exec_verb(&codec->core, cmd, flags, &res))
|
|
||||||
return -1;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(snd_hda_codec_read);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* snd_hda_codec_write - send a single command without waiting for response
|
|
||||||
* @codec: the HDA codec
|
|
||||||
* @nid: NID to send the command
|
|
||||||
* @flags: optional bit flags
|
|
||||||
* @verb: the verb to send
|
|
||||||
* @parm: the parameter for the verb
|
|
||||||
*
|
|
||||||
* Send a single command without waiting for response.
|
|
||||||
*
|
|
||||||
* Returns 0 if successful, or a negative error code.
|
|
||||||
*/
|
|
||||||
int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int flags,
|
|
||||||
unsigned int verb, unsigned int parm)
|
|
||||||
{
|
|
||||||
unsigned int cmd = snd_hdac_make_cmd(&codec->core, nid, verb, parm);
|
|
||||||
return snd_hdac_exec_verb(&codec->core, cmd, flags, NULL);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(snd_hda_codec_write);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* snd_hda_sequence_write - sequence writes
|
* snd_hda_sequence_write - sequence writes
|
||||||
* @codec: the HDA codec
|
* @codec: the HDA codec
|
||||||
|
|
|
@ -309,11 +309,21 @@ int snd_hda_codec_update_widgets(struct hda_codec *codec);
|
||||||
/*
|
/*
|
||||||
* low level functions
|
* low level functions
|
||||||
*/
|
*/
|
||||||
unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid,
|
static inline unsigned int
|
||||||
|
snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid,
|
||||||
int flags,
|
int flags,
|
||||||
unsigned int verb, unsigned int parm);
|
unsigned int verb, unsigned int parm)
|
||||||
int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int flags,
|
{
|
||||||
unsigned int verb, unsigned int parm);
|
return snd_hdac_codec_read(&codec->core, nid, flags, verb, parm);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int flags,
|
||||||
|
unsigned int verb, unsigned int parm)
|
||||||
|
{
|
||||||
|
return snd_hdac_codec_write(&codec->core, nid, flags, verb, parm);
|
||||||
|
}
|
||||||
|
|
||||||
#define snd_hda_param_read(codec, nid, param) \
|
#define snd_hda_param_read(codec, nid, param) \
|
||||||
snd_hdac_read_parm(&(codec)->core, nid, param)
|
snd_hdac_read_parm(&(codec)->core, nid, param)
|
||||||
#define snd_hda_get_sub_nodes(codec, nid, start_nid) \
|
#define snd_hda_get_sub_nodes(codec, nid, start_nid) \
|
||||||
|
|
|
@ -681,12 +681,7 @@ static inline bool
|
||||||
snd_hda_check_power_state(struct hda_codec *codec, hda_nid_t nid,
|
snd_hda_check_power_state(struct hda_codec *codec, hda_nid_t nid,
|
||||||
unsigned int target_state)
|
unsigned int target_state)
|
||||||
{
|
{
|
||||||
unsigned int state = snd_hda_codec_read(codec, nid, 0,
|
return snd_hdac_check_power_state(&codec->core, nid, target_state);
|
||||||
AC_VERB_GET_POWER_STATE, 0);
|
|
||||||
if (state & AC_PWRST_ERROR)
|
|
||||||
return true;
|
|
||||||
state = (state >> 4) & 0x0f;
|
|
||||||
return (state == target_state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec,
|
unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec,
|
||||||
|
|
Loading…
Reference in a new issue