summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-01-22 15:24:30 +0100
committerTakashi Iwai <tiwai@suse.de>2013-01-22 15:25:25 +0100
commitdc870f38e9faf7dd89355aae2252126688a1a372 (patch)
treedf231e38831d3f38ddeba4148934a7b0c047614a
parenta836dbf685fa58c7db6cd56ad4559b2e6c02c8d9 (diff)
downloadlinux-3.10-dc870f38e9faf7dd89355aae2252126688a1a372.tar.gz
linux-3.10-dc870f38e9faf7dd89355aae2252126688a1a372.tar.bz2
linux-3.10-dc870f38e9faf7dd89355aae2252126688a1a372.zip
ALSA: hda - Combine snd_hda_codec_flush_*_cache() to a single function
Since both snd_hda_codec_flush_amp_cache() and snd_hda_codec_flush_cmd_cache() are called usually at the same time, we can simply combine them to a single function, snd_hda_codec_flush_cache(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_codec.c11
-rw-r--r--sound/pci/hda/hda_codec.h6
-rw-r--r--sound/pci/hda/hda_generic.c6
-rw-r--r--sound/pci/hda/hda_local.h4
-rw-r--r--sound/pci/hda/patch_realtek.c2
5 files changed, 16 insertions, 13 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index e6cdad71373..77ddd34fffe 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3637,6 +3637,17 @@ void snd_hda_sequence_write_cache(struct hda_codec *codec,
}
EXPORT_SYMBOL_HDA(snd_hda_sequence_write_cache);
+/**
+ * snd_hda_codec_flush_cache - Execute all pending (cached) amps / verbs
+ * @codec: HD-audio codec
+ */
+void snd_hda_codec_flush_cache(struct hda_codec *codec)
+{
+ snd_hda_codec_resume_amp(codec);
+ snd_hda_codec_resume_cache(codec);
+}
+EXPORT_SYMBOL_HDA(snd_hda_codec_flush_cache);
+
void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg,
unsigned int power_state,
bool eapd_workaround)
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 61085b31105..cc73287341d 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -974,10 +974,8 @@ void snd_hda_sequence_write_cache(struct hda_codec *codec,
int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid,
int direct, unsigned int verb, unsigned int parm);
void snd_hda_codec_resume_cache(struct hda_codec *codec);
-
-/* it's alias but a bit clearer meaning */
-#define snd_hda_codec_flush_cmd_cache(codec) \
- snd_hda_codec_resume_cache(codec)
+/* both for cmd & amp caches */
+void snd_hda_codec_flush_cache(struct hda_codec *codec);
/* the struct for codec->pin_configs */
struct hda_pincfg {
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index b301952dc08..758dcc1a07b 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -2839,8 +2839,7 @@ static int cap_put_caller(struct snd_kcontrol *kcontrol,
error:
codec->cached_write = 0;
mutex_unlock(&codec->control_mutex);
- snd_hda_codec_flush_amp_cache(codec); /* flush the updates */
- snd_hda_codec_flush_cmd_cache(codec);
+ snd_hda_codec_flush_cache(codec); /* flush the updates */
if (err >= 0 && spec->cap_sync_hook)
spec->cap_sync_hook(codec, ucontrol);
return err;
@@ -4773,8 +4772,7 @@ int snd_hda_gen_init(struct hda_codec *codec)
/* call init functions of standard auto-mute helpers */
update_automute_all(codec);
- snd_hda_codec_flush_amp_cache(codec);
- snd_hda_codec_flush_cmd_cache(codec);
+ snd_hda_codec_flush_cache(codec);
if (spec->vmaster_mute.sw_kctl && spec->vmaster_mute.hook)
snd_hda_sync_vmaster_hook(&spec->vmaster_mute);
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 9e6353aafb1..f92979c6b02 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -139,10 +139,6 @@ int snd_hda_codec_amp_init_stereo(struct hda_codec *codec, hda_nid_t nid,
int dir, int idx, int mask, int val);
void snd_hda_codec_resume_amp(struct hda_codec *codec);
-/* it's alias but a bit clearer meaning */
-#define snd_hda_codec_flush_amp_cache(codec) \
- snd_hda_codec_resume_amp(codec)
-
void snd_hda_set_vmaster_tlv(struct hda_codec *codec, hda_nid_t nid, int dir,
unsigned int *tlv);
struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec,
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6eb9551e972..feb8cef341e 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -621,7 +621,7 @@ static void alc_inv_dmic_sync_adc(struct hda_codec *codec, int adc_idx)
(dir == HDA_OUTPUT ? AC_AMP_SET_OUTPUT : AC_AMP_SET_INPUT);
/* flush all cached amps at first */
- snd_hda_codec_flush_amp_cache(codec);
+ snd_hda_codec_flush_cache(codec);
/* we care only right channel */
val = snd_hda_codec_amp_read(codec, nid, 1, dir, 0);