/************************************************************************************
- * Name: alc5658_scalevolume
+ * Name: alc5658_setvolume
*
* Description:
* Set the right and left volume values in the ALC5658 device based on the current
*
************************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
-static inline uint16_t alc5658_scalevolume(uint16_t volume, b16_t scale)
+static void alc5658_setvolume(FAR struct alc5658_dev_s *priv, uint16_t volume, bool mute)
{
- return b16toi((b16_t) volume * scale);
+
+ audvdbg(" alc5658_setvolume volume=%u mute=%u\n", volume, mute);
+
+ priv->volume = volume;
+ priv->mute = mute;
+
}
#endif /* CONFIG_AUDIO_EXCLUDE_VOLUME */
/************************************************************************************
- * Name: alc5658_setvolume
+ * Name: alc5658_scalevolume
*
* Description:
* Set the right and left volume values in the ALC5658 device based on the current
*
************************************************************************************/
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
-static void alc5658_setvolume(FAR struct alc5658_dev_s *priv, uint16_t volume, bool mute)
+static inline uint16_t alc5658_scalevolume(uint16_t volume, b16_t scale)
{
-
- audvdbg(" alc5658_setvolume volume=%u mute=%u\n", volume, mute);
- /* ADD VOLUME CODE HERE */
-
- /* Remember the volume level and mute settings */
- alc5658_takesem(&priv->devsem);
- priv->volume = volume;
- priv->mute = mute;
- alc5658_givesem(&priv->devsem);
+ return b16toi((b16_t) volume * scale);
}
-#endif /* CONFIG_AUDIO_EXCLUDE_VOLUME */
+#endif
/************************************************************************************
* Name: alc5658_setbass
#endif
int ret = OK;
+
+
DEBUGASSERT(priv && caps);
audvdbg("ac_type: %d\n", caps->ac_type);
break;
}
+ alc5658_setregs(priv);
+
+ alc5658_getregs(priv);
return ret;
}
alc5658_exec_i2c_script(priv, codec_init_pll_16K, sizeof(codec_init_pll_16K) / sizeof(t_codec_init_script_entry));
alc5658_exec_i2c_script(priv, codec_init_inout_script2, sizeof(codec_init_inout_script2) / sizeof(t_codec_init_script_entry));
+
+ alc5658_setregs(priv);
+ alc5658_getregs(priv);
+
alc5658_takesem(&priv->devsem);
- priv->running = 1;
+ priv->running = true;
dq_entry_t *tmp = NULL;
dq_queue_t * q = &priv->pendq;
}
alc5658_givesem(&priv->devsem);
+
/* Exit reduced power modes of operation */
/* REVISIT */
/* Need to run the stop script here */
alc5658_exec_i2c_script(priv, codec_stop_script, sizeof(codec_stop_script) / sizeof(t_codec_init_script_entry));
+ alc5658_takesem(&priv->devsem);
+ priv->running = false;
+ alc5658_givesem(&priv->devsem);
+
/* Enter into a reduced power usage mode */
/* REVISIT: */
DEBUGASSERT(priv && apb);
audvdbg("alc5658_rxcallback, devaddr= 0x%x, apbaddr =0x%x\n", dev, apb);
- /* Call upper callback, let it post msg to user q */
- priv->dev.upper(priv->dev.priv, AUDIO_CALLBACK_DEQUEUE, apb, OK);
-
+
alc5658_takesem(&priv->devsem);
dq_entry_t *tmp;
for (tmp = (dq_entry_t*)dq_peek(&priv->pendq); tmp; tmp = dq_next(tmp)) {
alc5658_givesem(&priv->devsem);
return OK;
}
+
if (priv->inout) /* record */
- ret = I2S_RECEIVE(priv->i2s, apb, alc5658_rxtxcallback, priv, 0);
+ ret = I2S_RECEIVE(priv->i2s, apb, alc5658_rxtxcallback, priv, 100);
else /* playback */
- ret = I2S_SEND(priv->i2s, apb, alc5658_rxtxcallback, priv, 0);
+ ret = I2S_SEND(priv->i2s, apb, alc5658_rxtxcallback, priv, 100);
audvdbg("I2s returned 0x%x\n", ret);
alc5658_exec_i2c_script(priv, codec_reset_script, sizeof(codec_reset_script) / sizeof(t_codec_init_script_entry));
- //alc5658_audio_output(priv);
-
- /* Configure interrupts */
-
- /* Configure the FLL and the LRCLK */
-
- //alc5658_set_i2s_samplerate(priv);
-
- /* NOt sure if htis is needed */
alc5658_writereg(priv, ALC5658_IN1_CTRL, (10 + 16) << 8);
audvdbg("MIC GAIN 0x%x\n", (uint32_t) alc5658_readreg(priv, ALC5658_IN1_CTRL));
/* Sanity check */
DEBUGASSERT(i2c && i2s && lower);
+ auddbg("I2s dev addr is 0x%x\n", i2s);
+
/* Allocate a ALC5658 device structure */
priv = (FAR struct alc5658_dev_s *)kmm_zalloc(sizeof(struct alc5658_dev_s));
if (priv) {