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

Commit fbf5d518 authored by sangwoo's avatar sangwoo Committed by Vineeta Srivastava
Browse files

audio: Fix to send voice calibration during voice call

To voice cal, use the acdb_send_voice_cal interface.

Bug: 8966887

Change-Id: I95361d90bd74e4b8096bd2eb109e3eba05951fd9
parent 6961109b
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -524,6 +524,12 @@ static int set_voice_volume(struct mixer *mixer,
{
    struct mixer_ctl *ctl;
    const char *mixer_ctl_name = "Voice Rx Volume";

    // Voice volume levels are mapped to adsp volume levels as follows.
    // 100 -> 5, 80 -> 4, 60 -> 3, 40 -> 2, 20 -> 1  0 -> 0
    // But this values don't changed in kernel. So, below change is need.
    volume = volume / 20;

    ctl = mixer_get_ctl_by_name(mixer, mixer_ctl_name);
    if (!ctl) {
        ALOGE("%s: Could not get ctl for mixer cmd - %s",
@@ -953,6 +959,19 @@ static int select_devices(struct audio_device *adev,
                      acdb_rx_id, acdb_tx_id);
            }
        }
    } else if (usecase->type == VOICE_CALL) {
        if (adev->acdb_send_voice_cal == NULL) {
            ALOGE("%s: dlsym error for acdb_send_voice_call", __func__);
        } else {
            acdb_rx_id = get_acdb_device_id(out_snd_device);
            acdb_tx_id = get_acdb_device_id(in_snd_device);

            if (acdb_rx_id > 0 && acdb_tx_id > 0)
                adev->acdb_send_voice_cal(acdb_rx_id, acdb_tx_id);
            else
                ALOGE("%s: Incorrect ACDB IDs (rx: %d tx: %d)", __func__,
                      acdb_rx_id, acdb_tx_id);
        }
    }

    return status;