Commit 6ddb3ab6 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: x86: Move the global underrun_count to struct snd_intelhad

The last one is in intel_hdmi_audio.c, underrun_count: this can be
embedded in snd_intelhad object.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 7f2e9ab5
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
/*standard module options for ALSA. This module supports only one card*/ /*standard module options for ALSA. This module supports only one card*/
static int hdmi_card_index = SNDRV_DEFAULT_IDX1; static int hdmi_card_index = SNDRV_DEFAULT_IDX1;
static char *hdmi_card_id = SNDRV_DEFAULT_STR1; static char *hdmi_card_id = SNDRV_DEFAULT_STR1;
static int underrun_count;
module_param_named(index, hdmi_card_index, int, 0444); module_param_named(index, hdmi_card_index, int, 0444);
MODULE_PARM_DESC(index, MODULE_PARM_DESC(index,
...@@ -969,7 +968,7 @@ static int snd_intelhad_open(struct snd_pcm_substream *substream) ...@@ -969,7 +968,7 @@ static int snd_intelhad_open(struct snd_pcm_substream *substream)
intelhaddata = snd_pcm_substream_chip(substream); intelhaddata = snd_pcm_substream_chip(substream);
had_stream = intelhaddata->private_data; had_stream = intelhaddata->private_data;
runtime = substream->runtime; runtime = substream->runtime;
underrun_count = 0; intelhaddata->underrun_count = 0;
pm_runtime_get(intelhaddata->dev); pm_runtime_get(intelhaddata->dev);
...@@ -1376,19 +1375,19 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer( ...@@ -1376,19 +1375,19 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer(
AUD_BUF_A_LENGTH + (buf_id * HAD_REG_WIDTH), &t); AUD_BUF_A_LENGTH + (buf_id * HAD_REG_WIDTH), &t);
if ((t == 0) || (t == ((u32)-1L))) { if ((t == 0) || (t == ((u32)-1L))) {
underrun_count++; intelhaddata->underrun_count++;
pr_debug("discovered buffer done for buf %d, count = %d\n", pr_debug("discovered buffer done for buf %d, count = %d\n",
buf_id, underrun_count); buf_id, intelhaddata->underrun_count);
if (underrun_count > (HAD_MIN_PERIODS/2)) { if (intelhaddata->underrun_count > (HAD_MIN_PERIODS/2)) {
pr_debug("assume audio_codec_reset, underrun = %d - do xrun\n", pr_debug("assume audio_codec_reset, underrun = %d - do xrun\n",
underrun_count); intelhaddata->underrun_count);
underrun_count = 0; intelhaddata->underrun_count = 0;
return SNDRV_PCM_POS_XRUN; return SNDRV_PCM_POS_XRUN;
} }
} else { } else {
/* Reset Counter */ /* Reset Counter */
underrun_count = 0; intelhaddata->underrun_count = 0;
} }
t = intelhaddata->buf_info[buf_id].buf_size - t; t = intelhaddata->buf_info[buf_id].buf_size - t;
......
...@@ -119,6 +119,7 @@ struct had_pvt_data { ...@@ -119,6 +119,7 @@ struct had_pvt_data {
* @chmap: holds channel map info * @chmap: holds channel map info
* @audio_reg_base: hdmi audio register base offset * @audio_reg_base: hdmi audio register base offset
* @hw_silence: flag indicates SoC support for HW silence/Keep alive * @hw_silence: flag indicates SoC support for HW silence/Keep alive
* @underrun_count: PCM stream underrun counter
*/ */
struct snd_intelhad { struct snd_intelhad {
struct snd_card *card; struct snd_card *card;
...@@ -142,6 +143,7 @@ struct snd_intelhad { ...@@ -142,6 +143,7 @@ struct snd_intelhad {
unsigned int *audio_reg_base; unsigned int *audio_reg_base;
unsigned int audio_cfg_offset; unsigned int audio_cfg_offset;
bool hw_silence; bool hw_silence;
int underrun_count;
}; };
int had_event_handler(enum had_event_type event_type, void *data); int had_event_handler(enum had_event_type event_type, void *data);
......
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