#include "sof-priv.h"
#include "sof-utils.h"
-static void sof_set_transferred_bytes(struct snd_compr_tstamp *tstamp,
+static void sof_set_transferred_bytes(struct sof_compr_stream *sstream,
u64 host_pos, u64 buffer_size)
{
u64 prev_pos;
unsigned int copied;
- div64_u64_rem(tstamp->copied_total, buffer_size, &prev_pos);
+ div64_u64_rem(sstream->copied_total, buffer_size, &prev_pos);
if (host_pos < prev_pos)
copied = (buffer_size - prev_pos) + host_pos;
else
copied = host_pos - prev_pos;
- tstamp->copied_total += copied;
+ sstream->copied_total += copied;
}
static void snd_sof_compr_fragment_elapsed_work(struct work_struct *work)
struct snd_soc_pcm_runtime *rtd;
struct snd_compr_runtime *crtd;
struct snd_soc_component *component;
- struct snd_compr_tstamp *tstamp;
+ struct sof_compr_stream *sstream;
struct snd_sof_pcm *spcm;
if (!cstream)
rtd = cstream->private_data;
crtd = cstream->runtime;
- tstamp = crtd->private_data;
+ sstream = crtd->private_data;
component = snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME);
spcm = snd_sof_find_spcm_dai(component, rtd);
return;
}
- sof_set_transferred_bytes(tstamp, spcm->stream[cstream->direction].posn.host_posn,
+ sof_set_transferred_bytes(sstream, spcm->stream[cstream->direction].posn.host_posn,
crtd->buffer_size);
/* use the same workqueue-based solution as for PCM, cf. snd_sof_pcm_elapsed */
{
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_compr_runtime *crtd = cstream->runtime;
- struct snd_compr_tstamp *tstamp;
+ struct sof_compr_stream *sstream;
struct snd_sof_pcm *spcm;
int dir;
- tstamp = kzalloc(sizeof(*tstamp), GFP_KERNEL);
- if (!tstamp)
+ sstream = kzalloc(sizeof(*sstream), GFP_KERNEL);
+ if (!sstream)
return -ENOMEM;
spcm = snd_sof_find_spcm_dai(component, rtd);
if (!spcm) {
- kfree(tstamp);
+ kfree(sstream);
return -EINVAL;
}
dir = cstream->direction;
if (spcm->stream[dir].cstream) {
- kfree(tstamp);
+ kfree(sstream);
return -EBUSY;
}
spcm->stream[dir].posn.dai_posn = 0;
spcm->prepared[dir] = false;
- crtd->private_data = tstamp;
+ crtd->private_data = sstream;
return 0;
}
struct snd_compr_stream *cstream)
{
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
- struct snd_compr_tstamp *tstamp = cstream->runtime->private_data;
+ struct sof_compr_stream *sstream = cstream->runtime->private_data;
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct sof_ipc_stream stream;
struct sof_ipc_reply reply;
cancel_work_sync(&spcm->stream[cstream->direction].period_elapsed_work);
spcm->stream[cstream->direction].cstream = NULL;
- kfree(tstamp);
+ kfree(sstream);
return ret;
}
struct sof_ipc_pcm_params_reply ipc_params_reply;
struct sof_ipc_fw_ready *ready = &sdev->fw_ready;
struct sof_ipc_fw_version *v = &ready->version;
- struct snd_compr_tstamp *tstamp;
+ struct sof_compr_stream *sstream;
struct sof_ipc_pcm_params *pcm;
struct snd_sof_pcm *spcm;
size_t ext_data_size;
return -EINVAL;
}
- tstamp = crtd->private_data;
+ sstream = crtd->private_data;
spcm = snd_sof_find_spcm_dai(component, rtd);
goto out;
}
- tstamp->sampling_rate = params->codec.sample_rate;
+ sstream->sampling_rate = params->codec.sample_rate;
spcm->prepared[cstream->direction] = true;
struct snd_compr_stream *cstream,
struct snd_compr_tstamp *tstamp)
{
- struct snd_compr_tstamp *pstamp = cstream->runtime->private_data;
+ struct sof_compr_stream *sstream = cstream->runtime->private_data;
- tstamp->sampling_rate = pstamp->sampling_rate;
- tstamp->copied_total = pstamp->copied_total;
+ tstamp->sampling_rate = sstream->sampling_rate;
+ tstamp->copied_total = sstream->copied_total;
return 0;
}