if (runtime->access == SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) {
appl_bytes = frames_to_bytes(runtime,
runtime->control->appl_ptr);
- if (rtd->appl_bytes > appl_bytes)
- rtd->appl_bytes = 0;
+
+ if (rtd->appl_bytes > appl_bytes) {
+ if (appl_bytes > rtd->buffer_bytes)
+ rtd->appl_bytes =
+ appl_bytes - rtd->buffer_bytes;
+ else
+ rtd->appl_bytes = 0;
+ } else {
+ if ((appl_bytes - rtd->appl_bytes) >
+ rtd->buffer_bytes)
+ rtd->appl_bytes =
+ appl_bytes - rtd->buffer_bytes;
+
+ }
+
offset = rtd->appl_bytes % rtd->buffer_bytes;
space_to_end = rtd->buffer_bytes - offset;
count = appl_bytes - rtd->appl_bytes;
- if (count > rtd->buffer_bytes) {
- pr_info("HDMI is slow,ring buffer size[%ld], count[%ld]!\n",
- rtd->buffer_bytes, count);
- }
+ if (count > rtd->buffer_bytes)
+ count = rtd->buffer_bytes;
+
rtd->appl_bytes = appl_bytes;
if (count <= space_to_end) {
if (runtime->access == SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) {
appl_bytes = frames_to_bytes(runtime,
runtime->control->appl_ptr);
- if (rtd->appl_bytes > appl_bytes)
- rtd->appl_bytes = 0;
+ if (rtd->appl_bytes > appl_bytes) {
+ if (appl_bytes > rtd->buffer_bytes)
+ rtd->appl_bytes =
+ appl_bytes - rtd->buffer_bytes;
+ else
+ rtd->appl_bytes = 0;
+ } else {
+ if ((appl_bytes - rtd->appl_bytes) >
+ rtd->buffer_bytes)
+ rtd->appl_bytes =
+ appl_bytes - rtd->buffer_bytes;
+
+ }
+
offset = rtd->appl_bytes % rtd->buffer_bytes;
space_to_end = rtd->buffer_bytes - offset;
count = appl_bytes - rtd->appl_bytes;
- if (count > rtd->buffer_bytes) {
- pr_info("HDMI is slow,ring buffer size[%ld],count[%ld]!\n",
- rtd->buffer_bytes, count);
- }
+ if (count > rtd->buffer_bytes)
+ count = rtd->buffer_bytes;
rtd->appl_bytes = appl_bytes;
if (count <= space_to_end) {
* keep the old value but the control->
* appl_ptr is clear. Reset it if this
* misalignment happens*/
- if (rtd->appl_bytes > appl_bytes)
- rtd->appl_bytes = 0;
+ if (rtd->appl_bytes > appl_bytes) {
+ if (appl_bytes > rtd->buffer_bytes)
+ rtd->appl_bytes =
+ appl_bytes - rtd->buffer_bytes;
+ else
+ rtd->appl_bytes = 0;
+ } else {
+ if ((appl_bytes - rtd->appl_bytes) >
+ rtd->buffer_bytes)
+ rtd->appl_bytes =
+ appl_bytes - rtd->buffer_bytes;
+
+ }
+
offset = rtd->appl_bytes % rtd->buffer_bytes;
space_to_end = rtd->buffer_bytes - offset;
count = appl_bytes - rtd->appl_bytes;
hdmi_dma_mmap_copy(substream,
0, count - space_to_end);
}
+
}
dumpregs();