[Sound-open-firmware] [PATCH 06/25] intel-ipc: add application buffer pointer update from host side

Jie, Yang yang.jie at intel.com
Thu Feb 9 02:46:22 CET 2017


> -----Original Message-----
> From: Liam Girdwood [mailto:liam.r.girdwood at linux.intel.com]
> Sent: Wednesday, February 8, 2017 8:01 PM
> To: Keyon Jie <yang.jie at linux.intel.com>
> Cc: sound-open-firmware at alsa-project.org; Jie, Yang <yang.jie at intel.com>;
> Ingalsuo, Seppo <seppo.ingalsuo at intel.com>
> Subject: Re: [Sound-open-firmware] [PATCH 06/25] intel-ipc: add application
> buffer pointer update from host side
> 
> On Tue, 2017-02-07 at 22:02 +0800, Keyon Jie wrote:
> > We need the application buffer pointer(write pointer for playback)
> > update from the host side, to make the ALSA pcm buffer pointer
> > checking possible.
> >
> > Here we add COMP_CMD_IPC_MMAP_WPOS for the application pointer
> mmap
> > command, and introduce component command COMP_CMD_AVAIL_UPDATE
> for the
> > update event notification.
> >
> > Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
> > ---
> >  src/include/reef/audio/component.h |  2 ++
> >  src/include/uapi/intel-ipc.h       |  1 +
> >  src/ipc/intel-ipc.c                | 42 ++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 45 insertions(+)
> >
> > diff --git a/src/include/reef/audio/component.h
> > b/src/include/reef/audio/component.h
> > index e521753..fcef11e 100644
> > --- a/src/include/reef/audio/component.h
> > +++ b/src/include/reef/audio/component.h
> > @@ -72,10 +72,12 @@
> >  #define COMP_CMD_MUTE		101
> >  #define COMP_CMD_UNMUTE		102
> >  #define COMP_CMD_ROUTE		103
> > +#define COMP_CMD_AVAIL_UPDATE          104
> >
> >  /* MMAP IPC status */
> >  #define COMP_CMD_IPC_MMAP_RPOS	200	/* host read position
> */
> >  #define COMP_CMD_IPC_MMAP_PPOS	201	/* DAI presentation
> position */
> > +#define COMP_CMD_IPC_MMAP_WPOS 202     /* host write position */
> >
> 
> Is the host writing this directly to DSP memory via mmap() or IPC. If IPC then use
> a different macro name.

It is IPC, let me change it to COMP_CMD_IPC_WPOS.

Thanks,
~Keyon

> 
> Liam
> 
> >  #define COMP_CMD_IPC_MMAP_VOL(chan)	(216 + chan)	/* Volume */
> >
> > diff --git a/src/include/uapi/intel-ipc.h
> > b/src/include/uapi/intel-ipc.h index a4589b3..ec2ef32 100644
> > --- a/src/include/uapi/intel-ipc.h
> > +++ b/src/include/uapi/intel-ipc.h
> > @@ -613,6 +613,7 @@ struct sst_intel_ipc_stream_vol {  struct
> > sst_intel_ipc_stream_data {
> >  	uint32_t read_posn;
> >  	uint64_t presentation_posn;
> > +	uint32_t write_posn;
> >  	struct sst_intel_ipc_stream_vol vol[IPC_INTEL_NO_CHANNELS];  }
> > __attribute__((packed));  #endif diff --git a/src/ipc/intel-ipc.c
> > b/src/ipc/intel-ipc.c index 127541d..6084fa4 100644
> > --- a/src/ipc/intel-ipc.c
> > +++ b/src/ipc/intel-ipc.c
> > @@ -393,6 +393,14 @@ static uint32_t ipc_stream_alloc(uint32_t header)
> >  		goto error;
> >  	}
> >
> > +	/* pass the IPC write posn pointer to the host */
> > +	err = comp_cmd(pcm_dev->dev.cd, COMP_CMD_IPC_MMAP_WPOS,
> > +		&_stream_data->write_posn);
> > +	if (err < 0) {
> > +		trace_ipc_error("eAW");
> > +		goto error;
> > +	}
> > +
> >  	/* pass the volume readback posn to the host */
> >  	err = comp_cmd(volume_dev->cd, COMP_CMD_IPC_MMAP_VOL(0),
> >  		&_stream_data->vol[0].vol);
> > @@ -711,9 +719,43 @@ error:
> >
> >  static uint32_t ipc_stage_write_pos(uint32_t header)  {
> > +	struct ipc_comp_dev *stream_dev;
> > +	struct ipc_intel_ipc_stream_set_position app_pos;
> > +	uint32_t stream_id;
> > +	int err;
> > +
> >  	trace_ipc("PoW");
> >
> > +	/* read volume from the inbox */
> > +	mailbox_inbox_read(&app_pos, 0, sizeof(app_pos));
> > +
> > +	trace_value(app_pos.position);
> > +	/* the driver uses stream ID to also identify certain mixers */
> > +	stream_id = header & IPC_INTEL_STR_ID_MASK;
> > +	stream_id >>= IPC_INTEL_STR_ID_SHIFT;
> > +
> > +	/* get the pcm_dev */
> > +	stream_dev = ipc_get_comp(stream_id);
> > +	if (stream_dev == NULL)
> > +		goto error;
> > +
> > +	err = pipeline_cmd(stream_dev->p, stream_dev->cd,
> > +		COMP_CMD_AVAIL_UPDATE, &app_pos);
> > +	if (err < 0)
> > +		goto error;
> > +
> > +	/* drain the pipeline for EOS */
> > +	if (app_pos.end_of_buffer) {
> > +		err = pipeline_cmd(stream_dev->p, stream_dev->cd,
> > +			COMP_CMD_DRAIN, NULL);
> > +		if (err < 0)
> > +			goto error;
> > +	}
> > +
> >  	return IPC_INTEL_GLB_REPLY_SUCCESS;
> > +
> > +error:
> > +	return IPC_INTEL_GLB_REPLY_ERROR_INVALID_PARAM;
> >  }
> >
> >  static uint32_t ipc_stage_message(uint32_t header)
> 



More information about the Sound-open-firmware mailing list