Commit f4566aa1 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: x86: Minor cleanup of reset buffer procedure

The procedure to reset buffer pointers is performed in two places and
still open-coded.  Simplify the helper function and use it
consistently.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 83af57dd
...@@ -252,10 +252,11 @@ static void snd_intelhad_enable_audio_int(struct snd_intelhad *ctx, bool enable) ...@@ -252,10 +252,11 @@ static void snd_intelhad_enable_audio_int(struct snd_intelhad *ctx, bool enable)
} }
} }
static void snd_intelhad_reset_audio(struct snd_intelhad *intelhaddata, /* Reset buffer pointers */
u8 reset) static void had_reset_audio(struct snd_intelhad *intelhaddata)
{ {
had_write_register(intelhaddata, AUD_HDMI_STATUS, reset); had_write_register(intelhaddata, AUD_HDMI_STATUS, 1);
had_write_register(intelhaddata, AUD_HDMI_STATUS, 0);
} }
/* /*
...@@ -893,8 +894,7 @@ static void snd_intelhad_handle_underrun(struct snd_intelhad *intelhaddata) ...@@ -893,8 +894,7 @@ static void snd_intelhad_handle_underrun(struct snd_intelhad *intelhaddata)
/* Handle Underrun interrupt within Audio Unit */ /* Handle Underrun interrupt within Audio Unit */
had_write_register(intelhaddata, AUD_CONFIG, 0); had_write_register(intelhaddata, AUD_CONFIG, 0);
/* Reset buffer pointers */ /* Reset buffer pointers */
had_write_register(intelhaddata, AUD_HDMI_STATUS, 1); had_reset_audio(intelhaddata);
had_write_register(intelhaddata, AUD_HDMI_STATUS, 0);
/* /*
* The interrupt status 'sticky' bits might not be cleared by * The interrupt status 'sticky' bits might not be cleared by
* setting '1' to that bit once... * setting '1' to that bit once...
...@@ -1085,8 +1085,7 @@ static int snd_intelhad_pcm_trigger(struct snd_pcm_substream *substream, ...@@ -1085,8 +1085,7 @@ static int snd_intelhad_pcm_trigger(struct snd_pcm_substream *substream,
snd_intelhad_enable_audio_int(intelhaddata, false); snd_intelhad_enable_audio_int(intelhaddata, false);
snd_intelhad_enable_audio(substream, intelhaddata, false); snd_intelhad_enable_audio(substream, intelhaddata, false);
/* Reset buffer pointers */ /* Reset buffer pointers */
snd_intelhad_reset_audio(intelhaddata, 1); had_reset_audio(intelhaddata);
snd_intelhad_reset_audio(intelhaddata, 0);
snd_intelhad_enable_audio_int(intelhaddata, false); snd_intelhad_enable_audio_int(intelhaddata, false);
break; break;
......
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