Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d20c7a03 authored by Kunlei Zhang's avatar Kunlei Zhang
Browse files

hal: update correct speaker type for mono speaker based

If right speaker is used, mono speaker type still is set
to left speaker by default.

Set correct mono speaker type based on key-value of mono-speaker.

Change-Id: I3f7b6a261636fe981ae853a08ed5f3b4376e3c56
parent daa27ca9
Loading
Loading
Loading
Loading
+21 −14
Original line number Diff line number Diff line
@@ -6635,8 +6635,12 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o
                        snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_VBAT;
                    else
                        snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT;
                } else
                } else {
                    if (my_data->mono_speaker == SPKR_1)
                        snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_VBAT;
                    else
                        snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT;
                }
            } else if (my_data->is_wsa_speaker) {
                    if (my_data->mono_speaker == SPKR_1)
                        snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_WSA;
@@ -6659,8 +6663,12 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o
                    }
                } else if (adev->enable_hfp)
                    snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_HFP;
                else
                else {
                    if (my_data->mono_speaker == SPKR_1)
                        snd_device = SND_DEVICE_OUT_VOICE_SPEAKER;
                    else
                        snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_2;
                }
            }
        } else if (is_a2dp_out_device_type(&devices)) {
            snd_device = SND_DEVICE_OUT_BT_A2DP;
@@ -8438,7 +8446,6 @@ int platform_set_parameters(void *platform, struct str_parms *parms)
        }
    }
    if (hw_info_is_stereo_spkr(my_data->hw_info)) {
    err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_MONO_SPEAKER, value, len);
    if (err >= 0) {
        if (!strncmp("left", value, sizeof("left")))
@@ -8448,7 +8455,7 @@ int platform_set_parameters(void *platform, struct str_parms *parms)
       str_parms_del(parms, AUDIO_PARAMETER_KEY_MONO_SPEAKER);
    }
    }
   err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_EXT_AUDIO_DEVICE,
                            value, len);
    if (err >= 0) {