drivers: audio: Fix cxd56_stop in cxd56.c

In the previous implementation, cxd56_stop() checked the internal
state before sending AUDIO_MSG_STOP to the message queue. However,
if the worker thread took time to turn on AMP, cxd560_stop() was
not able to send the message and caused a deadlock.

This commit fixes this issue by always sending AUDIO_MSG_STOP
regardless of the internal state.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masayuki Ishikawa 2020-06-16 12:24:40 +09:00 committed by Alin Jerpelea
parent 8c74a31fe2
commit ae92afd250

View File

@ -2899,15 +2899,12 @@ static int cxd56_stop(FAR struct audio_lowerhalf_s *lower, FAR void *session)
static int cxd56_stop(FAR struct audio_lowerhalf_s *lower)
#endif
{
FAR struct cxd56_dev_s *priv = (FAR struct cxd56_dev_s *)lower;
audinfo("cxd56_stop\n");
if (priv->state != CXD56_DEV_STATE_STOPPED)
{
int ret;
FAR void *value;
struct audio_msg_s msg;
FAR struct cxd56_dev_s *priv = (FAR struct cxd56_dev_s *)lower;
audinfo("cxd56_stop\n");
msg.msg_id = AUDIO_MSG_STOP;
msg.u.data = 0;
@ -2923,7 +2920,6 @@ static int cxd56_stop(FAR struct audio_lowerhalf_s *lower)
pthread_join(priv->threadid, &value);
priv->threadid = 0;
}
return OK;
}