Loading hal/audio_hw.c +1 −13 Original line number Diff line number Diff line Loading @@ -2244,19 +2244,7 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) status = -EINVAL; } if (status == 0) { if (adev->speaker_lr_swap != reverse_speakers) { adev->speaker_lr_swap = reverse_speakers; // only update the selected device if there is active pcm playback struct audio_usecase *usecase; struct listnode *node; list_for_each(node, &adev->usecase_list) { usecase = node_to_item(node, struct audio_usecase, list); if (usecase->type == PCM_PLAYBACK) { select_devices(adev, usecase->id); break; } } } platform_swap_lr_channels(adev, reverse_speakers); } } Loading hal/audio_hw.h +0 −1 Original line number Diff line number Diff line Loading @@ -211,7 +211,6 @@ struct audio_device { struct listnode usecase_list; struct audio_route *audio_route; int acdb_settings; bool speaker_lr_swap; struct voice voice; unsigned int cur_hdmi_channels; bool bt_wb_speech_enabled; Loading hal/msm8960/platform.c +32 −1 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ struct platform_data { bool fluence_in_voice_call; bool fluence_in_voice_rec; int dualmic_config; bool speaker_lr_swap; void *acdb_handle; acdb_init_t acdb_init; Loading Loading @@ -655,7 +656,7 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) { snd_device = SND_DEVICE_OUT_HEADPHONES; } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) { if (adev->speaker_lr_swap) if (my_data->speaker_lr_swap) snd_device = SND_DEVICE_OUT_SPEAKER_REVERSE; else snd_device = SND_DEVICE_OUT_SPEAKER; Loading Loading @@ -1004,3 +1005,33 @@ void platform_set_echo_reference(struct audio_device *adev, bool enable, audio_d { return; } int platform_swap_lr_channels(struct audio_device *adev, bool swap_channels) { // only update the selected device if there is active pcm playback struct audio_usecase *usecase; struct listnode *node; struct platform_data *my_data = (struct platform_data *)adev->platform; int status = 0; if (my_data->speaker_lr_swap != swap_channels) { my_data->speaker_lr_swap = swap_channels; list_for_each(node, &adev->usecase_list) { usecase = node_to_item(node, struct audio_usecase, list); if (usecase->type == PCM_PLAYBACK && usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER) { const char *mixer_path; if (swap_channels) { mixer_path = platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_REVERSE); audio_route_apply_and_update_path(adev->audio_route, mixer_path); } else { mixer_path = platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER); audio_route_apply_and_update_path(adev->audio_route, mixer_path); } break; } } } return status; } hal/msm8974/platform.c +32 −1 Original line number Diff line number Diff line Loading @@ -78,6 +78,8 @@ struct platform_data { bool fluence_in_voice_comm; bool fluence_in_voice_rec; int dualmic_config; bool speaker_lr_swap; void *acdb_handle; acdb_init_t acdb_init; acdb_deallocate_t acdb_deallocate; Loading Loading @@ -1265,7 +1267,7 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi } else if (devices & AUDIO_DEVICE_OUT_SPEAKER_SAFE) { snd_device = SND_DEVICE_OUT_SPEAKER_SAFE; } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) { if (adev->speaker_lr_swap) if (my_data->speaker_lr_swap) snd_device = SND_DEVICE_OUT_SPEAKER_REVERSE; else snd_device = SND_DEVICE_OUT_SPEAKER; Loading Loading @@ -1734,3 +1736,32 @@ int platform_set_usecase_pcm_id(audio_usecase_t usecase, int32_t type, int32_t p done: return ret; } int platform_swap_lr_channels(struct audio_device *adev, bool swap_channels) { // only update if there is active pcm playback on speaker struct audio_usecase *usecase; struct listnode *node; struct platform_data *my_data = (struct platform_data *)adev->platform; if (my_data->speaker_lr_swap != swap_channels) { my_data->speaker_lr_swap = swap_channels; list_for_each(node, &adev->usecase_list) { usecase = node_to_item(node, struct audio_usecase, list); if (usecase->type == PCM_PLAYBACK && usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER) { const char *mixer_path; if (swap_channels) { mixer_path = platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_REVERSE); audio_route_apply_and_update_path(adev->audio_route, mixer_path); } else { mixer_path = platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER); audio_route_apply_and_update_path(adev->audio_route, mixer_path); } break; } } } return 0; } hal/platform_api.h +1 −1 Original line number Diff line number Diff line Loading @@ -64,5 +64,5 @@ int platform_info_init(void); int platform_get_usecase_index(const char * usecase); int platform_set_usecase_pcm_id(audio_usecase_t usecase, int32_t type, int32_t pcm_id); void platform_set_echo_reference(struct audio_device *adev, bool enable, audio_devices_t out_device); int platform_swap_lr_channels(struct audio_device *adev, bool swap_channels); #endif // AUDIO_PLATFORM_API_H Loading
hal/audio_hw.c +1 −13 Original line number Diff line number Diff line Loading @@ -2244,19 +2244,7 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) status = -EINVAL; } if (status == 0) { if (adev->speaker_lr_swap != reverse_speakers) { adev->speaker_lr_swap = reverse_speakers; // only update the selected device if there is active pcm playback struct audio_usecase *usecase; struct listnode *node; list_for_each(node, &adev->usecase_list) { usecase = node_to_item(node, struct audio_usecase, list); if (usecase->type == PCM_PLAYBACK) { select_devices(adev, usecase->id); break; } } } platform_swap_lr_channels(adev, reverse_speakers); } } Loading
hal/audio_hw.h +0 −1 Original line number Diff line number Diff line Loading @@ -211,7 +211,6 @@ struct audio_device { struct listnode usecase_list; struct audio_route *audio_route; int acdb_settings; bool speaker_lr_swap; struct voice voice; unsigned int cur_hdmi_channels; bool bt_wb_speech_enabled; Loading
hal/msm8960/platform.c +32 −1 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ struct platform_data { bool fluence_in_voice_call; bool fluence_in_voice_rec; int dualmic_config; bool speaker_lr_swap; void *acdb_handle; acdb_init_t acdb_init; Loading Loading @@ -655,7 +656,7 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) { snd_device = SND_DEVICE_OUT_HEADPHONES; } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) { if (adev->speaker_lr_swap) if (my_data->speaker_lr_swap) snd_device = SND_DEVICE_OUT_SPEAKER_REVERSE; else snd_device = SND_DEVICE_OUT_SPEAKER; Loading Loading @@ -1004,3 +1005,33 @@ void platform_set_echo_reference(struct audio_device *adev, bool enable, audio_d { return; } int platform_swap_lr_channels(struct audio_device *adev, bool swap_channels) { // only update the selected device if there is active pcm playback struct audio_usecase *usecase; struct listnode *node; struct platform_data *my_data = (struct platform_data *)adev->platform; int status = 0; if (my_data->speaker_lr_swap != swap_channels) { my_data->speaker_lr_swap = swap_channels; list_for_each(node, &adev->usecase_list) { usecase = node_to_item(node, struct audio_usecase, list); if (usecase->type == PCM_PLAYBACK && usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER) { const char *mixer_path; if (swap_channels) { mixer_path = platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_REVERSE); audio_route_apply_and_update_path(adev->audio_route, mixer_path); } else { mixer_path = platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER); audio_route_apply_and_update_path(adev->audio_route, mixer_path); } break; } } } return status; }
hal/msm8974/platform.c +32 −1 Original line number Diff line number Diff line Loading @@ -78,6 +78,8 @@ struct platform_data { bool fluence_in_voice_comm; bool fluence_in_voice_rec; int dualmic_config; bool speaker_lr_swap; void *acdb_handle; acdb_init_t acdb_init; acdb_deallocate_t acdb_deallocate; Loading Loading @@ -1265,7 +1267,7 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi } else if (devices & AUDIO_DEVICE_OUT_SPEAKER_SAFE) { snd_device = SND_DEVICE_OUT_SPEAKER_SAFE; } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) { if (adev->speaker_lr_swap) if (my_data->speaker_lr_swap) snd_device = SND_DEVICE_OUT_SPEAKER_REVERSE; else snd_device = SND_DEVICE_OUT_SPEAKER; Loading Loading @@ -1734,3 +1736,32 @@ int platform_set_usecase_pcm_id(audio_usecase_t usecase, int32_t type, int32_t p done: return ret; } int platform_swap_lr_channels(struct audio_device *adev, bool swap_channels) { // only update if there is active pcm playback on speaker struct audio_usecase *usecase; struct listnode *node; struct platform_data *my_data = (struct platform_data *)adev->platform; if (my_data->speaker_lr_swap != swap_channels) { my_data->speaker_lr_swap = swap_channels; list_for_each(node, &adev->usecase_list) { usecase = node_to_item(node, struct audio_usecase, list); if (usecase->type == PCM_PLAYBACK && usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER) { const char *mixer_path; if (swap_channels) { mixer_path = platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_REVERSE); audio_route_apply_and_update_path(adev->audio_route, mixer_path); } else { mixer_path = platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER); audio_route_apply_and_update_path(adev->audio_route, mixer_path); } break; } } } return 0; }
hal/platform_api.h +1 −1 Original line number Diff line number Diff line Loading @@ -64,5 +64,5 @@ int platform_info_init(void); int platform_get_usecase_index(const char * usecase); int platform_set_usecase_pcm_id(audio_usecase_t usecase, int32_t type, int32_t pcm_id); void platform_set_echo_reference(struct audio_device *adev, bool enable, audio_devices_t out_device); int platform_swap_lr_channels(struct audio_device *adev, bool swap_channels); #endif // AUDIO_PLATFORM_API_H