Skip to content

Commit

Permalink
ALSA: x86: Minor cleanup of reset buffer procedure
Browse files Browse the repository at this point in the history
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: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Feb 5, 2017
1 parent 83af57d commit f4566aa
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions sound/x86/intel_hdmi_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
u8 reset)
/* Reset buffer pointers */
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);
}

/*
Expand Down Expand Up @@ -893,8 +894,7 @@ static void snd_intelhad_handle_underrun(struct snd_intelhad *intelhaddata)
/* Handle Underrun interrupt within Audio Unit */
had_write_register(intelhaddata, AUD_CONFIG, 0);
/* Reset buffer pointers */
had_write_register(intelhaddata, AUD_HDMI_STATUS, 1);
had_write_register(intelhaddata, AUD_HDMI_STATUS, 0);
had_reset_audio(intelhaddata);
/*
* The interrupt status 'sticky' bits might not be cleared by
* setting '1' to that bit once...
Expand Down Expand Up @@ -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(substream, intelhaddata, false);
/* Reset buffer pointers */
snd_intelhad_reset_audio(intelhaddata, 1);
snd_intelhad_reset_audio(intelhaddata, 0);
had_reset_audio(intelhaddata);
snd_intelhad_enable_audio_int(intelhaddata, false);
break;

Expand Down

0 comments on commit f4566aa

Please sign in to comment.