Lines Matching refs:path
83 struct mixer_path *path; member
128 static void path_print(struct audio_route *ar, struct mixer_path *path)
133 ALOGE("Path: %s, length: %d", path->name, path->length);
134 for (i = 0; i < path->length; i++) {
135 struct mixer_ctl *ctl = index_to_ctl(ar, path->setting[i].ctl_index);
139 for (j = 0; j < path->setting[i].num_values; j++)
140 ALOGE(" id=%d value=0x%02x", j, path->setting[i].value.bytes[j]);
142 for (j = 0; j < path->setting[i].num_values; j++)
143 ALOGE(" id=%d value=%d", j, path->setting[i].value.enumerated[j]);
145 for (j = 0; j < path->setting[i].num_values; j++)
146 ALOGE(" id=%d value=%ld", j, path->setting[i].value.integer[j]);
223 static int find_ctl_index_in_path(struct mixer_path *path, in find_ctl_index_in_path() argument
228 for (i = 0; i < path->length; i++) in find_ctl_index_in_path()
229 if (path->setting[i].ctl_index == ctl_index) in find_ctl_index_in_path()
235 static int alloc_path_setting(struct mixer_path *path) in alloc_path_setting() argument
241 if (path->size <= path->length) { in alloc_path_setting()
242 if (path->size == 0) in alloc_path_setting()
243 path->size = INITIAL_MIXER_PATH_SIZE; in alloc_path_setting()
245 path->size *= 2; in alloc_path_setting()
247 new_path_setting = realloc(path->setting, in alloc_path_setting()
248 path->size * sizeof(struct mixer_setting)); in alloc_path_setting()
253 path->setting = new_path_setting; in alloc_path_setting()
257 path_index = path->length; in alloc_path_setting()
258 path->length++; in alloc_path_setting()
263 static int path_add_setting(struct audio_route *ar, struct mixer_path *path, in path_add_setting() argument
268 if (find_ctl_index_in_path(path, setting->ctl_index) != -1) { in path_add_setting()
272 mixer_ctl_get_name(ctl), path->name); in path_add_setting()
281 path_index = alloc_path_setting(path); in path_add_setting()
285 path->setting[path_index].ctl_index = setting->ctl_index; in path_add_setting()
286 path->setting[path_index].type = setting->type; in path_add_setting()
287 path->setting[path_index].num_values = setting->num_values; in path_add_setting()
291 path->setting[path_index].value.ptr = calloc(setting->num_values, value_sz); in path_add_setting()
293 memcpy(path->setting[path_index].value.ptr, setting->value.ptr, in path_add_setting()
299 static int path_add_value(struct audio_route *ar, struct mixer_path *path, in path_add_value() argument
316 path_index = find_ctl_index_in_path(path, mixer_value->ctl_index); in path_add_value()
325 path_index = alloc_path_setting(path); in path_add_value()
330 path->setting[path_index].ctl_index = mixer_value->ctl_index; in path_add_value()
331 path->setting[path_index].num_values = num_values; in path_add_value()
332 path->setting[path_index].type = type; in path_add_value()
335 path->setting[path_index].value.ptr = calloc(num_values, value_sz); in path_add_value()
336 if (path->setting[path_index].type == MIXER_CTL_TYPE_BYTE) in path_add_value()
337 path->setting[path_index].value.bytes[0] = mixer_value->value; in path_add_value()
338 else if (path->setting[path_index].type == MIXER_CTL_TYPE_ENUM) in path_add_value()
339 path->setting[path_index].value.enumerated[0] = mixer_value->value; in path_add_value()
341 path->setting[path_index].value.integer[0] = mixer_value->value; in path_add_value()
346 if (path->setting[path_index].type == MIXER_CTL_TYPE_BYTE) { in path_add_value()
348 path->setting[path_index].value.bytes[i] = mixer_value->value; in path_add_value()
349 } else if (path->setting[path_index].type == MIXER_CTL_TYPE_ENUM) { in path_add_value()
351 path->setting[path_index].value.enumerated[i] = mixer_value->value; in path_add_value()
354 path->setting[path_index].value.integer[i] = mixer_value->value; in path_add_value()
358 if (path->setting[path_index].type == MIXER_CTL_TYPE_BYTE) in path_add_value()
359 path->setting[path_index].value.bytes[mixer_value->index] = mixer_value->value; in path_add_value()
360 else if (path->setting[path_index].type == MIXER_CTL_TYPE_ENUM) in path_add_value()
361 path->setting[path_index].value.enumerated[mixer_value->index] = mixer_value->value; in path_add_value()
363 path->setting[path_index].value.integer[mixer_value->index] = mixer_value->value; in path_add_value()
369 static int path_add_path(struct audio_route *ar, struct mixer_path *path, in path_add_path() argument
375 if (path_add_setting(ar, path, &sub_path->setting[i]) < 0) in path_add_path()
381 static int path_apply(struct audio_route *ar, struct mixer_path *path) in path_apply() argument
388 ALOGD("Apply path: %s", path->name != NULL ? path->name : "none"); in path_apply()
389 for (i = 0; i < path->length; i++) { in path_apply()
390 ctl_index = path->setting[i].ctl_index; in path_apply()
396 memcpy(ar->mixer_state[ctl_index].new_value.ptr, path->setting[i].value.ptr, in path_apply()
397 path->setting[i].num_values * value_sz); in path_apply()
403 static int path_reset(struct audio_route *ar, struct mixer_path *path) in path_reset() argument
410 ALOGV("Reset path: %s", path->name != NULL ? path->name : "none"); in path_reset()
411 for (i = 0; i < path->length; i++) { in path_reset()
412 ctl_index = path->setting[i].ctl_index; in path_reset()
485 state->path = path_create(ar, (char *)attr_name); in start_tag()
486 if (state->path == NULL) in start_tag()
493 } else if (state->path != NULL) { in start_tag()
494 path_add_path(ar, state->path, sub_path); in start_tag()
568 if (state->path != NULL) in start_tag()
569 path_add_value(ar, state->path, &mixer_value); in start_tag()
743 struct mixer_path *path; in audio_route_apply_path() local
750 path = path_get_by_name(ar, name); in audio_route_apply_path()
751 if (!path) { in audio_route_apply_path()
756 path_apply(ar, path); in audio_route_apply_path()
764 struct mixer_path *path; in audio_route_reset_path() local
771 path = path_get_by_name(ar, name); in audio_route_reset_path()
772 if (!path) { in audio_route_reset_path()
777 path_reset(ar, path); in audio_route_reset_path()
788 struct mixer_path *path; in audio_route_update_path() local
796 path = path_get_by_name(ar, name); in audio_route_update_path()
797 if (!path) { in audio_route_update_path()
802 for (size_t i = 0; i < path->length; ++i) { in audio_route_update_path()
806 ctl_index = path->setting[reverse ? path->length - 1 - i : i].ctl_index; in audio_route_update_path()