mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
ALSA: ice1712: Fix boundary checks in PCM pointer ops
commit 4f8e940095
upstream.
PCM pointer callbacks in ice1712 driver check the buffer size boundary
wrongly between bytes and frames. This leads to PCM core warnings
like:
snd_pcm_update_hw_ptr0: 105 callbacks suppressed
ALSA pcm_lib.c:352 BUG: pcmC3D0c:0, pos = 5461, buffer size = 5461, period size = 2730
This patch fixes these checks to be placed after the proper unit
conversions.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b7b38eb3f2
commit
f4a8f6c0d3
1 changed files with 10 additions and 5 deletions
|
@ -686,9 +686,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_pointer(struct snd_pcm_substream *
|
|||
if (!(snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL) & 1))
|
||||
return 0;
|
||||
ptr = runtime->buffer_size - inw(ice->ddma_port + 4);
|
||||
ptr = bytes_to_frames(substream->runtime, ptr);
|
||||
if (ptr == runtime->buffer_size)
|
||||
ptr = 0;
|
||||
return bytes_to_frames(substream->runtime, ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substream *substream)
|
||||
|
@ -705,9 +706,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substrea
|
|||
addr = ICE1712_DSC_ADDR0;
|
||||
ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) -
|
||||
ice->playback_con_virt_addr[substream->number];
|
||||
ptr = bytes_to_frames(substream->runtime, ptr);
|
||||
if (ptr == substream->runtime->buffer_size)
|
||||
ptr = 0;
|
||||
return bytes_to_frames(substream->runtime, ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *substream)
|
||||
|
@ -718,9 +720,10 @@ static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *s
|
|||
if (!(snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL) & 1))
|
||||
return 0;
|
||||
ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr;
|
||||
ptr = bytes_to_frames(substream->runtime, ptr);
|
||||
if (ptr == substream->runtime->buffer_size)
|
||||
ptr = 0;
|
||||
return bytes_to_frames(substream->runtime, ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static const struct snd_pcm_hardware snd_ice1712_playback = {
|
||||
|
@ -1114,9 +1117,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_pro_pointer(struct snd_pcm_substre
|
|||
if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_PLAYBACK_START))
|
||||
return 0;
|
||||
ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2);
|
||||
ptr = bytes_to_frames(substream->runtime, ptr);
|
||||
if (ptr == substream->runtime->buffer_size)
|
||||
ptr = 0;
|
||||
return bytes_to_frames(substream->runtime, ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substream *substream)
|
||||
|
@ -1127,9 +1131,10 @@ static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substrea
|
|||
if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_CAPTURE_START_SHADOW))
|
||||
return 0;
|
||||
ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2);
|
||||
ptr = bytes_to_frames(substream->runtime, ptr);
|
||||
if (ptr == substream->runtime->buffer_size)
|
||||
ptr = 0;
|
||||
return bytes_to_frames(substream->runtime, ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static const struct snd_pcm_hardware snd_ice1712_playback_pro = {
|
||||
|
|
Loading…
Reference in a new issue