[Sound-open-firmware] [PATCH 3/5] host: host_copy(): add handle for capture

Jie, Yang yang.jie at intel.com
Wed Feb 15 14:51:13 CET 2017


> -----Original Message-----
> From: Liam Girdwood [mailto:liam.r.girdwood at linux.intel.com]
> Sent: Wednesday, February 15, 2017 6:33 PM
> To: Keyon Jie <yang.jie at linux.intel.com>
> Cc: sound-open-firmware at alsa-project.org; Zhang, Keqiao
> <keqiao.zhang at intel.com>; Jie, Yang <yang.jie at intel.com>; Ingalsuo, Seppo
> <seppo.ingalsuo at intel.com>
> Subject: Re: [Sound-open-firmware] [PATCH 3/5] host: host_copy(): add handle
> for capture
> 
> On Wed, 2017-02-15 at 18:07 +0800, Keyon Jie wrote:
> > For playback, don't copy if there is no available data; For capture,
> > don't copy if there is no free host side buffer.
> >
> > Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
> > ---
> >  src/audio/host.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/audio/host.c b/src/audio/host.c index
> > b604ddc..61d2b62 100644
> > --- a/src/audio/host.c
> > +++ b/src/audio/host.c
> > @@ -815,7 +815,10 @@ static int host_copy(struct comp_dev *dev)
> >  	if (dev->state != COMP_STATE_RUNNING)
> >  		return 0;
> >
> > -	if (hd->host_avail == 0)
> > +	/* don't copy if the host side buffer is not ready */
> > +	if (((hd->params.direction == STREAM_DIRECTION_PLAYBACK)
> > +	    &&  (hd->host_avail == 0)) || ((hd->host_free == 0) &&
> > +	    (hd->params.direction == STREAM_DIRECTION_CAPTURE)))
> >  		return 0;
> >
> 
> Better to do for readability :-
> 
>  if (dir == P && host_avail == 0)
> 	return 0;
>  if (dir == C && host_free == 0)
> 	return 0;

OK, will modify like that.

Thanks,
~Keyon

> 
> >  	/* do DMA transfer */
> 



More information about the Sound-open-firmware mailing list