static int snd_card_saudio_pcm_prepare(struct snd_pcm_substream *substream) { const struct snd_saudio *saudio = snd_pcm_substream_chip(substream); const int stream_id = substream->pstr->stream; const int dev = substream->pcm->device; struct saudio_dev_ctrl *dev_ctrl = NULL; struct saudio_msg msg = { 0 }; int result = 0; ADEBUG(); mutex_lock(&saudio->mutex); if(!saudio->state) { mutex_unlock(&saudio->mutex); printk("saudio.c: snd_pcm_prepare error saudio state %d\n",saudio->state); return -EIO; } mutex_unlock(&saudio->mutex); pr_info("%s IN, stream_id=%d\n", __func__, stream_id); dev_ctrl = (struct saudio_dev_ctrl *)&(saudio->dev_ctrl[dev]); msg.command = SAUDIO_CMD_PREPARE; msg.stream_id = stream_id; result = saudio_cmd_prepare_process(dev_ctrl, &msg); pr_info("%s OUT, result=%d\n", __func__, result); return 0; }
static int snd_card_saudio_pcm_prepare(struct snd_pcm_substream *substream) { const struct snd_saudio *saudio = snd_pcm_substream_chip(substream); const int stream_id = substream->pstr->stream; const int dev = substream->pcm->device; struct saudio_dev_ctrl *dev_ctrl = NULL; struct saudio_msg msg = { 0 }; int result = 0; ADEBUG(); dev_ctrl = (struct saudio_dev_ctrl *)&(saudio->dev_ctrl[dev]); msg.command = SAUDIO_CMD_PREPARE; msg.stream_id = stream_id; result = saudio_cmd_prepare_process(dev_ctrl, &msg); return 0; }