return alc5658_readreg(priv, regaddr);
}
+static void alc5658_setregs(struct alc5658_dev_s *priv)
+{
+ alc5658_writereg(priv, ALC5658_IN1_CTRL, (0 + 16) << 8);
+ alc5658_writereg(priv, ALC5658_HPOUT_MUTE, 0);
+ alc5658_writereg(priv, ALC5658_HPOUT_VLML, 0xd00);
+ alc5658_writereg(priv, ALC5658_HPOUT_VLMR, 0x700);
+}
+
+static void alc5658_getregs(struct alc5658_dev_s *priv)
+{
+ audvdbg("MIC GAIN 0x%x\n", (uint32_t) alc5658_readreg(priv, ALC5658_IN1_CTRL));
+ audvdbg("MUTE HPOUT MUTE %x\n", (uint32_t) alc5658_readreg(priv, ALC5658_HPOUT_MUTE));
+ audvdbg("VOLL 0x%x\n", (uint32_t) alc5658_readreg(priv, ALC5658_HPOUT_VLML));
+ audvdbg("VOLR 0x%x\n", (uint32_t) alc5658_readreg(priv, ALC5658_HPOUT_VLMR));
+}
+
/************************************************************************************
* Name: alc5658_exec_i2c_script
*
} while (ret < 0);
}
+
/************************************************************************************
* Name: alc5658_scalevolume
*
{
return b16toi((b16_t) volume * scale);
}
-#endif
+#endif /* CONFIG_AUDIO_EXCLUDE_VOLUME */
/************************************************************************************
* Name: alc5658_setvolume
/* Reconfigure the FLL to support the resulting number or channels,
* bits per sample, and bitrate.
*/
-#if 0
- alc5658_set_i2s_datawidth(priv);
- alc5658_set_i2s_samplerate(priv);
-
- alc5658_clock_analysis(&priv->dev, "AUDIO_TYPE_OUTPUT");
-#endif
priv->inout = true;
ret = OK;
}
/* Reconfigure the FLL to support the resulting number or channels,
* bits per sample, and bitrate.
*/
-#if 0
- alc5658_set_i2s_datawidth(priv);
- alc5658_set_i2s_samplerate(priv);
-
- alc5658_clock_analysis(&priv->dev, "AUDIO_TYPE_OUTPUT");
-#endif
ret = OK;
priv->inout = false;
}
break;
}
}
+
+ /* Call upper callback, let it post msg to user q */
+ priv->dev.upper(priv->dev.priv, AUDIO_CALLBACK_DEQUEUE, apb, OK);
+
alc5658_givesem(&priv->devsem);
}
alc5658_givesem(&priv->devsem);
return OK;
}
-
if (priv->inout) /* record */
ret = I2S_RECEIVE(priv->i2s, apb, alc5658_rxtxcallback, priv, 0);
else /* playback */
/* Dump some information and return the device instance */
- alc5658_dump_registers(&priv->dev, "After configuration");
- alc5658_clock_analysis(&priv->dev, "After configuration");
}
/****************************************************************************
/****************************************************************************
* Included Files
****************************************************************************/
-
#include <tinyara/config.h>
#include <tinyara/compiler.h>
#include <tinyara/fs/ioctl.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
-
+
#define ALC5658_DEFAULT_SAMPRATE 16000
#define ALC5658_DEFAULT_NCHANNELS 2
#define ALC5658_DEFAULT_BPSAMP 16
#define FAIL 0xFFFF
+#define alc5658_givesem(s) sem_post(s)
/* Commonly defined and redefined macros */
#ifndef MIN
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef MAX
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
/****************************************************************************
static void alc5658_takesem(sem_t *sem);
static uint16_t alc5658_modifyreg(FAR struct alc5658_dev_s *priv, uint16_t regaddr, uint16_t set, uint16_t clear);
-#define alc5658_givesem(s) sem_post(s)
-
#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);
static void alc5658_setbass(FAR struct alc5658_dev_s *priv, uint8_t bass);
static void alc5658_settreble(FAR struct alc5658_dev_s *priv, uint8_t treble);
#endif
-
static void alc5658_set_i2s_datawidth(FAR struct alc5658_dev_s *priv);
static void alc5658_set_i2s_samplerate(FAR struct alc5658_dev_s *priv);
static int alc5658_interrupt(FAR const struct alc5658_lower_s *lower, FAR void *arg);
#endif
-
/* Initialization */
static void alc5658_audio_output(FAR struct alc5658_dev_s *priv);
static void alc5658_audio_input(FAR struct alc5658_dev_s *priv);
static void alc5658_hw_reset(FAR struct alc5658_dev_s *priv);
uint16_t alc5658_readreg(FAR struct alc5658_dev_s *priv, uint16_t regaddr);
-
#endif /* CONFIG_AUDIO */
#endif /* __DRIVERS_AUDIO_ALC5658_H */