lkml.org 
[lkml]   [2020]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v2 9/9] ASoC: q6asm-dai: add support to copy callback
    From
    Date


    > +static int q6asm_compr_copy(struct snd_soc_component *component,
    > + struct snd_compr_stream *stream, char __user *buf,
    > + size_t count)
    > {
    > struct snd_compr_runtime *runtime = stream->runtime;
    > struct q6asm_dai_rtd *prtd = runtime->private_data;
    > unsigned long flags;
    > + u32 wflags = 0;
    > + int avail, bytes_in_flight = 0;
    > + void *dstn;
    > + size_t copy;
    > + u32 app_pointer;
    > + u32 bytes_received;
    > +
    > + bytes_received = prtd->bytes_received;
    > +
    > + /**

    /*

    > + * Make sure that next track data pointer is aligned at 32 bit boundary
    > + * This is a Mandatory requirement from DSP data buffers alignment
    > + */
    > + if (prtd->next_track)
    > + bytes_received = ALIGN(prtd->bytes_received, prtd->pcm_count);
    > +
    > + app_pointer = bytes_received/prtd->pcm_size;
    > + app_pointer = bytes_received - (app_pointer * prtd->pcm_size);
    > + dstn = prtd->dma_buffer.area + app_pointer;
    > +
    > + if (count < prtd->pcm_size - app_pointer) {
    > + if (copy_from_user(dstn, buf, count))
    > + return -EFAULT;
    > + } else {
    > + copy = prtd->pcm_size - app_pointer;
    > + if (copy_from_user(dstn, buf, copy))
    > + return -EFAULT;
    > + if (copy_from_user(prtd->dma_buffer.area, buf + copy,
    > + count - copy))
    > + return -EFAULT;
    > + }

    \
     
     \ /
      Last update: 2020-07-22 01:46    [W:3.156 / U:0.140 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site