ASoC: mfld-compress: Use dedicated function instead of ioctl
Also pass sst device as an argument to function pointer prototypes of compr_ops. This will be used to derive sst driver context. Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
d8499c9b4b
commit
06cb1eb3de
@ -86,7 +86,7 @@ static int sst_platform_compr_free(struct snd_compr_stream *cstream)
|
||||
/*need to check*/
|
||||
str_id = stream->id;
|
||||
if (str_id)
|
||||
ret_val = stream->compr_ops->close(str_id);
|
||||
ret_val = stream->compr_ops->close(sst->dev, str_id);
|
||||
module_put(sst->dev->driver->owner);
|
||||
kfree(stream);
|
||||
pr_debug("%s: %d\n", __func__, ret_val);
|
||||
@ -158,7 +158,7 @@ static int sst_platform_compr_set_params(struct snd_compr_stream *cstream,
|
||||
cb.drain_cb_param = cstream;
|
||||
cb.drain_notify = sst_drain_notify;
|
||||
|
||||
retval = stream->compr_ops->open(&str_params, &cb);
|
||||
retval = stream->compr_ops->open(sst->dev, &str_params, &cb);
|
||||
if (retval < 0) {
|
||||
pr_err("stream allocation failed %d\n", retval);
|
||||
return retval;
|
||||
@ -170,10 +170,30 @@ static int sst_platform_compr_set_params(struct snd_compr_stream *cstream,
|
||||
|
||||
static int sst_platform_compr_trigger(struct snd_compr_stream *cstream, int cmd)
|
||||
{
|
||||
struct sst_runtime_stream *stream =
|
||||
cstream->runtime->private_data;
|
||||
struct sst_runtime_stream *stream = cstream->runtime->private_data;
|
||||
|
||||
return stream->compr_ops->control(cmd, stream->id);
|
||||
switch (cmd) {
|
||||
case SNDRV_PCM_TRIGGER_START:
|
||||
if (stream->compr_ops->stream_start)
|
||||
return stream->compr_ops->stream_start(sst->dev, stream->id);
|
||||
case SNDRV_PCM_TRIGGER_STOP:
|
||||
if (stream->compr_ops->stream_drop)
|
||||
return stream->compr_ops->stream_drop(sst->dev, stream->id);
|
||||
case SND_COMPR_TRIGGER_DRAIN:
|
||||
if (stream->compr_ops->stream_drain)
|
||||
return stream->compr_ops->stream_drain(sst->dev, stream->id);
|
||||
case SND_COMPR_TRIGGER_PARTIAL_DRAIN:
|
||||
if (stream->compr_ops->stream_partial_drain)
|
||||
return stream->compr_ops->stream_partial_drain(sst->dev, stream->id);
|
||||
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||
if (stream->compr_ops->stream_pause)
|
||||
return stream->compr_ops->stream_pause(sst->dev, stream->id);
|
||||
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
||||
if (stream->compr_ops->stream_pause_release)
|
||||
return stream->compr_ops->stream_pause_release(sst->dev, stream->id);
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
static int sst_platform_compr_pointer(struct snd_compr_stream *cstream,
|
||||
@ -182,7 +202,7 @@ static int sst_platform_compr_pointer(struct snd_compr_stream *cstream,
|
||||
struct sst_runtime_stream *stream;
|
||||
|
||||
stream = cstream->runtime->private_data;
|
||||
stream->compr_ops->tstamp(stream->id, tstamp);
|
||||
stream->compr_ops->tstamp(sst->dev, stream->id, tstamp);
|
||||
tstamp->byte_offset = tstamp->copied_total %
|
||||
(u32)cstream->runtime->buffer_size;
|
||||
pr_debug("calc bytes offset/copied bytes as %d\n", tstamp->byte_offset);
|
||||
@ -195,7 +215,7 @@ static int sst_platform_compr_ack(struct snd_compr_stream *cstream,
|
||||
struct sst_runtime_stream *stream;
|
||||
|
||||
stream = cstream->runtime->private_data;
|
||||
stream->compr_ops->ack(stream->id, (unsigned long)bytes);
|
||||
stream->compr_ops->ack(sst->dev, stream->id, (unsigned long)bytes);
|
||||
stream->bytes_written += bytes;
|
||||
|
||||
return 0;
|
||||
@ -225,7 +245,7 @@ static int sst_platform_compr_set_metadata(struct snd_compr_stream *cstream,
|
||||
struct sst_runtime_stream *stream =
|
||||
cstream->runtime->private_data;
|
||||
|
||||
return stream->compr_ops->set_metadata(stream->id, metadata);
|
||||
return stream->compr_ops->set_metadata(sst->dev, stream->id, metadata);
|
||||
}
|
||||
|
||||
struct snd_compr_ops sst_platform_compr_ops = {
|
||||
|
@ -99,17 +99,24 @@ struct sst_compress_cb {
|
||||
|
||||
struct compress_sst_ops {
|
||||
const char *name;
|
||||
int (*open) (struct snd_sst_params *str_params,
|
||||
struct sst_compress_cb *cb);
|
||||
int (*control) (unsigned int cmd, unsigned int str_id);
|
||||
int (*tstamp) (unsigned int str_id, struct snd_compr_tstamp *tstamp);
|
||||
int (*ack) (unsigned int str_id, unsigned long bytes);
|
||||
int (*close) (unsigned int str_id);
|
||||
int (*get_caps) (struct snd_compr_caps *caps);
|
||||
int (*get_codec_caps) (struct snd_compr_codec_caps *codec);
|
||||
int (*set_metadata) (unsigned int str_id,
|
||||
struct snd_compr_metadata *mdata);
|
||||
int (*open)(struct device *dev,
|
||||
struct snd_sst_params *str_params, struct sst_compress_cb *cb);
|
||||
int (*stream_start)(struct device *dev, unsigned int str_id);
|
||||
int (*stream_drop)(struct device *dev, unsigned int str_id);
|
||||
int (*stream_drain)(struct device *dev, unsigned int str_id);
|
||||
int (*stream_partial_drain)(struct device *dev, unsigned int str_id);
|
||||
int (*stream_pause)(struct device *dev, unsigned int str_id);
|
||||
int (*stream_pause_release)(struct device *dev, unsigned int str_id);
|
||||
|
||||
int (*tstamp)(struct device *dev, unsigned int str_id,
|
||||
struct snd_compr_tstamp *tstamp);
|
||||
int (*ack)(struct device *dev, unsigned int str_id,
|
||||
unsigned long bytes);
|
||||
int (*close)(struct device *dev, unsigned int str_id);
|
||||
int (*get_caps)(struct snd_compr_caps *caps);
|
||||
int (*get_codec_caps)(struct snd_compr_codec_caps *codec);
|
||||
int (*set_metadata)(struct device *dev, unsigned int str_id,
|
||||
struct snd_compr_metadata *mdata);
|
||||
};
|
||||
|
||||
struct sst_ops {
|
||||
|
Loading…
Reference in New Issue
Block a user