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

Commit 76ecc0de authored by Vidyakumar Athota's avatar Vidyakumar Athota
Browse files

hal: update bt-sco sample rate before device enable

- Some BT solutions set sample rate only at the time of BT connection
  but not for every device switch. Due to this sample rate is not
  set properly after device switch.
- Update bt-sco sample rate before device enable instead of sample rate
  set parameters call.

Change-Id: I07cb0c186296b00a99713b67628fb87b2f134d32
parent 48a220ae
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -296,6 +296,18 @@ int enable_snd_device(struct audio_device *adev,
        return 0;
    }

    /* Set BT sample rate before enabling the devices. Adding sample rate mixer
     * control in use-case does not work because rate update takes place after
     * AFE port open due to the limitation of mixer control order execution.
     */
    if (snd_device == SND_DEVICE_OUT_BT_SCO) {
        audio_route_apply_path(adev->audio_route, BT_SCO_SAMPLE_RATE);
        audio_route_update_mixer(adev->audio_route);
    } else if (snd_device == SND_DEVICE_OUT_BT_SCO_WB) {
        audio_route_apply_path(adev->audio_route, BT_SCO_WB_SAMPLE_RATE);
        audio_route_update_mixer(adev->audio_route);
    }

    /* start usb playback thread */
    if(SND_DEVICE_OUT_USB_HEADSET == snd_device ||
       SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET == snd_device)
+4 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 * Not a contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -31,6 +31,9 @@
#define VISUALIZER_LIBRARY_PATH "/system/lib/soundfx/libqcomvisualizer.so"
#define OFFLOAD_EFFECTS_BUNDLE_LIBRARY_PATH "/system/lib/soundfx/libqcompostprocbundle.so"

#define BT_SCO_SAMPLE_RATE "bt-sco-samplerate"
#define BT_SCO_WB_SAMPLE_RATE "bt-sco-wb-samplerate"

/* Flags used to initialize acdb_settings variable that goes to ACDB library */
#define DMIC_FLAG       0x00000002
#define QMIC_FLAG       0x00000004
+0 −5
Original line number Diff line number Diff line
@@ -1651,11 +1651,6 @@ int platform_set_parameters(void *platform, struct str_parms *parms)
    if (err >= 0) {
        str_parms_del(parms, AUDIO_PARAMETER_KEY_BTSCO);
        my_data->btsco_sample_rate = val;
        if (val == SAMPLE_RATE_16KHZ) {
            audio_route_apply_path(my_data->adev->audio_route,
                                   "bt-sco-wb-samplerate");
            audio_route_update_mixer(my_data->adev->audio_route);
        }
    }

    err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_SLOWTALK, value, sizeof(value));