From 487a672d7604323b7f832a023440c4872890e199 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 31 Jul 2014 15:00:45 -0600 Subject: [PATCH] WM8904: Was not saving i2s interface instance --- drivers/audio/wm8904.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/audio/wm8904.c b/drivers/audio/wm8904.c index 91c645f375..02f83f3752 100644 --- a/drivers/audio/wm8904.c +++ b/drivers/audio/wm8904.c @@ -1171,6 +1171,7 @@ static void *wm8904_workerthread(pthread_addr_t pvarg) apb_free(apb); } + wm8904_givesem(&priv->pendsem); /* Return any pending buffers in our done queue */ @@ -1398,17 +1399,23 @@ static int wm8904_enqueuebuffer(FAR struct audio_lowerhalf_s *dev, dq_addlast(&apb->dq_entry, &priv->pendq); wm8904_givesem(&priv->pendsem); - /* Send a message indicating a new buffer enqueued */ + /* Send a message to the worker thread indicating that a new buffer has been + * enqueued. If mq is NULL, then the playing has not yet started. In that + * case we are just "priming the pump" and we don't need to send any message. + */ + ret = OK; if (priv->mq != NULL) { term_msg.msgId = AUDIO_MSG_ENQUEUE; term_msg.u.data = 0; + ret = mq_send(priv->mq, &term_msg, sizeof(term_msg), CONFIG_WM8904_MSG_PRIO); if (ret < 0) { int errcode = errno; DEBUGASSERT(errcode > 0); + auddbg("ERROR: mq_send failed: %d\n", errcode); UNUSED(errcode); } @@ -1789,6 +1796,7 @@ FAR struct audio_lowerhalf_s * priv->dev.ops = &g_audioops; priv->lower = lower; priv->i2c = i2c; + priv->i2s = i2s; #if !defined(CONFIG_AUDIO_EXCLUDE_VOLUME) && !defined(CONFIG_AUDIO_EXCLUDE_BALANCE) priv->balance = b16HALF; /* Center balance */ #endif