-/*
- * Gets fdt values for wm8994 config parameters
- *
- * @param pcodec_info codec information structure
- * @param blob FDT blob
- * @return int value, 0 for success
- */
-static int get_sound_wm8994_values(struct sound_codec_info *pcodec_info)
-{
- int error = 0;
-
- switch (AUDIO_COMPAT) {
- case AUDIO_COMPAT_SPI:
- debug("%s: Support not added for SPI interface\n", __func__);
- return -1;
- break;
- case AUDIO_COMPAT_I2C:
- pcodec_info->i2c_bus = AUDIO_I2C_BUS;
- pcodec_info->i2c_dev_addr = AUDIO_I2C_REG;
- debug("i2c dev addr = %d\n", pcodec_info->i2c_dev_addr);
- break;
- default:
- debug("%s: Unknown compat id %d\n", __func__, AUDIO_COMPAT);
- return -1;
- }
-
- if (error == -1) {
- debug("fail to get wm8994 codec node properties\n");
- return -1;
- }
-
- return 0;
-}
-
-/*
- * Gets fdt values for codec config parameters
- *
- * @param pcodec_info codec information structure
- * @param blob FDT blob
- * @return int value, 0 for success
- */
-static int get_sound_codec_values(struct sound_codec_info *pcodec_info)
-{
- int error = 0;
- const char *codectype;
-
- codectype = AUDIO_CODEC;
-
- if (!strcmp(codectype, "wm8994")) {
- pcodec_info->codec_type = CODEC_WM_8994;
- error = get_sound_wm8994_values(pcodec_info);
- } else {
- error = -1;
- }
-
- if (error == -1) {
- debug("fail to get sound codec node properties\n");
- return -1;
- }
-
- return 0;
-}
-
-int sound_init(void)
-{
- int ret;
- struct i2stx_info *pi2s_tx = &g_i2stx_pri;
- struct sound_codec_info *pcodec_info = &g_codec_info;
-
- /* Get the I2S Values */
- get_sound_i2s_values(pi2s_tx);
-
- /* Get the codec Values */
- if (get_sound_codec_values(pcodec_info) < 0)
- return -1;
-
- ret = i2s_tx_init(pi2s_tx);
- if (ret) {
- debug("%s: Failed to init i2c transmit: ret=%d\n", __func__,
- ret);
- return ret;
- }
-
- /* Check the codec type and initialise the same */
- if (pcodec_info->codec_type == CODEC_WM_8994) {
- ret = wm8994_init(pcodec_info, WM8994_AIF2,
- pi2s_tx->samplingrate,
- (pi2s_tx->samplingrate * (pi2s_tx->rfs)),
- pi2s_tx->bitspersample, pi2s_tx->channels);
- } else {
- debug("%s: Unknown code type %d\n", __func__,
- pcodec_info->codec_type);
- return -1;
- }
- if (ret) {
- debug("%s: Codec init failed\n", __func__);
- return -1;
- }
-
- return ret;
-}
-
-/*
- * Generates square wave sound data for 1 second
- *
- * @param data data buffer pointer
- * @param size size of the buffer
- * @param freq frequency of the wave
- */
-static void sound_prepare_buffer(unsigned short *data, int size, uint32_t freq)