hal: Code clean up for audio extension
Clean up some code for sound track and speaker protection CRs-Fixed: 1001383 Change-Id: I303d31d244864cb8852ef084eff86b71ba0643b7
This commit is contained in:
parent
603dfeb3af
commit
47795c72a7
|
@ -448,8 +448,8 @@ static void send_soundfocus_sourcetracking_params(struct str_parms *reply,
|
|||
if ((i >=4) && (sound_focus_data.start_angle[i] == 0xFFFF))
|
||||
continue;
|
||||
if (i)
|
||||
snprintf(value + strlen(value) - 1, MAX_STR_SIZE, ",");
|
||||
snprintf(value + strlen(value) - 1, MAX_STR_SIZE, "%d", sound_focus_data.start_angle[i]);
|
||||
snprintf(value + strlen(value), MAX_STR_SIZE - strlen(value) - 1, ",");
|
||||
snprintf(value + strlen(value), MAX_STR_SIZE - strlen(value) - 1, "%d", sound_focus_data.start_angle[i]);
|
||||
}
|
||||
str_parms_add_str(reply, AUDIO_PARAMETER_KEY_SOUND_FOCUS_START_ANGLES, value);
|
||||
}
|
||||
|
@ -460,8 +460,8 @@ static void send_soundfocus_sourcetracking_params(struct str_parms *reply,
|
|||
if ((i >=4) && (sound_focus_data.enable[i] == 0xFF))
|
||||
continue;
|
||||
if (i)
|
||||
snprintf(value + strlen(value), MAX_STR_SIZE, ",");
|
||||
snprintf(value + strlen(value), MAX_STR_SIZE, "%d", sound_focus_data.enable[i]);
|
||||
snprintf(value + strlen(value), MAX_STR_SIZE - strlen(value) - 1, ",");
|
||||
snprintf(value + strlen(value), MAX_STR_SIZE - strlen(value) - 1, "%d", sound_focus_data.enable[i]);
|
||||
}
|
||||
str_parms_add_str(reply, AUDIO_PARAMETER_KEY_SOUND_FOCUS_ENABLE_SECTORS, value);
|
||||
}
|
||||
|
@ -475,8 +475,8 @@ static void send_soundfocus_sourcetracking_params(struct str_parms *reply,
|
|||
if ((i >=4) && (source_tracking_data.vad[i] == 0xFF))
|
||||
continue;
|
||||
if (i)
|
||||
snprintf(value + strlen(value) - 1, MAX_STR_SIZE, ",");
|
||||
snprintf(value + strlen(value) - 1, MAX_STR_SIZE, "%d", source_tracking_data.vad[i]);
|
||||
snprintf(value + strlen(value), MAX_STR_SIZE - strlen(value) - 1, ",");
|
||||
snprintf(value + strlen(value), MAX_STR_SIZE - strlen(value) - 1, "%d", source_tracking_data.vad[i]);
|
||||
}
|
||||
str_parms_add_str(reply, AUDIO_PARAMETER_KEY_SOURCE_TRACK_VAD, value);
|
||||
}
|
||||
|
@ -495,8 +495,8 @@ static void send_soundfocus_sourcetracking_params(struct str_parms *reply,
|
|||
if (bitmask & BITMASK_AUDIO_PARAMETER_KEY_SOURCE_TRACK_POLAR_ACTIVITY) {
|
||||
for (i = 0; i < 360; i++) {
|
||||
if (i)
|
||||
snprintf(value + strlen(value) - 1, MAX_STR_SIZE, ",");
|
||||
snprintf(value + strlen(value) - 1, MAX_STR_SIZE, "%d", source_tracking_data.polar_activity[i]);
|
||||
snprintf(value + strlen(value), MAX_STR_SIZE - strlen(value) - 1, ",");
|
||||
snprintf(value + strlen(value), MAX_STR_SIZE - strlen(value) - 1, "%d", source_tracking_data.polar_activity[i]);
|
||||
}
|
||||
str_parms_add_str(reply, AUDIO_PARAMETER_KEY_SOURCE_TRACK_POLAR_ACTIVITY, value);
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
#define WSA_ANALOG_MODE_CHANNELS 2
|
||||
|
||||
#define MAX_PATH (256)
|
||||
#define MAX_STR_SIZE (1024)
|
||||
#define THERMAL_SYSFS "/sys/class/thermal"
|
||||
#define TZ_TYPE "/sys/class/thermal/thermal_zone%d/type"
|
||||
#define TZ_WSA "/sys/class/thermal/thermal_zone%d/temp"
|
||||
|
@ -965,7 +966,8 @@ static void get_spkr_prot_thermal_cal(char *param)
|
|||
ALOGE("%s: failed to open cal file\n", __func__);
|
||||
status = -EINVAL;
|
||||
}
|
||||
sprintf(param, "SpkrCalStatus: %d; R0: %lf, %lf; T0: %lf, %lf",
|
||||
snprintf(param, MAX_STR_SIZE - strlen(param) - 1,
|
||||
"SpkrCalStatus: %d; R0: %lf, %lf; T0: %lf, %lf",
|
||||
status, dr0[SP_V2_SPKR_1], dr0[SP_V2_SPKR_2],
|
||||
dt0[SP_V2_SPKR_1], dt0[SP_V2_SPKR_2]);
|
||||
ALOGD("%s:: param = %s\n", __func__, param);
|
||||
|
@ -1089,7 +1091,8 @@ static void get_spkr_prot_ftm_param(char *param)
|
|||
ftm_status[i] = -EINVAL;
|
||||
}
|
||||
}
|
||||
sprintf(param, "SpkrParamStatus: %d, %d; Rdc: %lf, %lf; Temp: %lf, %lf;"
|
||||
snprintf(param, MAX_STR_SIZE - strlen(param) - 1,
|
||||
"SpkrParamStatus: %d, %d; Rdc: %lf, %lf; Temp: %lf, %lf;"
|
||||
" Freq: %lf, %lf; Rect: %lf, %lf; Qmct: %lf, %lf",
|
||||
ftm_status[SP_V2_SPKR_1], ftm_status[SP_V2_SPKR_2],
|
||||
rdc[SP_V2_SPKR_1], rdc[SP_V2_SPKR_2], temp[SP_V2_SPKR_1],
|
||||
|
@ -1219,7 +1222,7 @@ int audio_extn_fbsp_get_parameters(struct str_parms *query,
|
|||
struct str_parms *reply)
|
||||
{
|
||||
int err = 0;
|
||||
char value[1024] = {0};
|
||||
char value[MAX_STR_SIZE] = {0};
|
||||
|
||||
if (!handle.spkr_prot_enable) {
|
||||
ALOGD("%s: Speaker protection disabled", __func__);
|
||||
|
|
Loading…
Reference in New Issue