On Tue, Nov 22, 2011 at 02:21:59PM +0530, Vinod Koul wrote:
Looks mostly good.
+static int snd_compr_resume(struct snd_compr_stream *stream) +{
- int retval;
- if (stream->runtime->state != SNDRV_PCM_STATE_PAUSED)
return -EPERM;
- retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_RELEASE);
- if (!retval)
stream->runtime->state = SNDRV_PCM_STATE_RUNNING;
- return retval;
Here we do the state transition if the trigger is successful but...
+static int snd_compr_start(struct snd_compr_stream *stream) +{
- int retval;
- if (stream->runtime->state != SNDRV_PCM_STATE_PREPARED)
return -EPERM;
- retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_START);
- stream->runtime->state = SNDRV_PCM_STATE_RUNNING;
- return retval;
...here we unconditionally set the new state.
+static int snd_compress_add_device(struct snd_compr *device) +{
- int ret;
- struct snd_card *card;
- ret = snd_card_create(SNDRV_DEFAULT_IDX1, device->name,
THIS_MODULE, 0, &card);
- if (ret < 0)
goto out;
It's a bit surprising that this is doing snd_card_create() - I'd expect a compressed device to be added as a subdevice on a card being passed in. At least in the embedded case you'd normally get a card with a mix of PCM and compressed streams in one unified card.
- mutex_init(&device->lock);
- /* todo integrate with asoc */
The core code shouldn't know anything about ASoC, ASoC should be able to use the core API like any other card driver.