int tfa98xxDiagLoadConfig(int slave) { Tfa98xx_handle_t handle; int result = 1; // 1 is failure Tfa98xx_Config_t cfg; TRACEIN; lastApiError = Tfa98xx_Open(slave << 1, &handle); if (lastApiError != Tfa98xx_Error_Ok) return 2; coldStartup(handle); lastApiError = Tfa98xx_DspWriteConfig(handle, TFA98XX_CONFIG_LENGTH, settings_Setup87_config); assert(lastApiError == Tfa98xx_Error_Ok); lastApiError = Tfa98xx_DspGetParam(handle, 1 /*MODULE_SPEAKERBOOST */ , 0x80, sizeof(cfg), cfg); assert(lastApiError == Tfa98xx_Error_Ok); result = 0 != memcmp(settings_Setup87_config, cfg, sizeof(Tfa98xx_Config_t)); if (result) sprintf(lastErrorString, "DSP parameters mismatch"); stop: Tfa98xx_Close(handle); lastError = result; TRACEOUT; return result; }
static void setConfig(int handle_cnt, Tfa98xx_handle_t handles[], struct tfa98xx_param_data *config) { enum Tfa98xx_Error err; if (config == NULL || config->data == NULL) { pr_info("%s: not use config data\n", __func__); return; } pr_debug("%s: start\n", __func__); if (handle_cnt >= 2) err = Tfa98xx_DspWriteConfigMultiple(handle_cnt, handles, config->size, config->data); else err = Tfa98xx_DspWriteConfig(handles[0], config->size, config->data); if (err != Tfa98xx_Error_Ok) pr_err("%s: Tfa98xx_DspWriteConfig failed\n", __func__); }