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

Commit 666786dd authored by Yamit Mehta's avatar Yamit Mehta Committed by Alain Vongsouvanh
Browse files

DO NOT MERGE ANYWHERE hal: Implement Tx mute in ASM loopback

Add TX mute functionality in ASM loopback
for HFP.

BUG: 30169034

Change-Id: Id5873f37adf3479031234cbfb2d900c0b70ba1fc
parent 26ae13f9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -319,9 +319,11 @@ void audio_extn_dolby_send_ddp_endp_params(struct audio_device *adev);
#ifndef HFP_ENABLED
#define audio_extn_hfp_is_active(adev)                  (0)
#define audio_extn_hfp_get_usecase()                    (-1)
#define hfp_set_mic_mute(dev, state)                    (0)
#else
bool audio_extn_hfp_is_active(struct audio_device *adev);
audio_usecase_t audio_extn_hfp_get_usecase();
int hfp_set_mic_mute(struct audio_device *dev, bool state);
#endif

#ifndef DEV_ARBI_ENABLED
+23 −0
Original line number Diff line number Diff line
@@ -302,6 +302,29 @@ bool audio_extn_hfp_is_active(struct audio_device *adev)
        return false;
}

int hfp_set_mic_mute(struct audio_device *adev, bool state)
{
    struct mixer_ctl *ctl;
    const char *mixer_ctl_name = "HFP TX Mute";
    uint32_t set_values[ ] = {0};

    ALOGI("%s: enter, state=%d", __func__, state);

    if (adev->mode == AUDIO_MODE_IN_COMMUNICATION) {
        set_values[0] = state;
        ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
        if (!ctl) {
            ALOGE("%s: Could not get ctl for mixer cmd - %s",
                  __func__, mixer_ctl_name);
            return -EINVAL;
        }
        mixer_ctl_set_array(ctl, set_values, ARRAY_SIZE(set_values));
    }

    ALOGV("%s: exit", __func__);
    return 0;
}

audio_usecase_t audio_extn_hfp_get_usecase()
{
    return hfpmod.ucid;
+4 −1
Original line number Diff line number Diff line
@@ -331,8 +331,11 @@ int voice_set_mic_mute(struct audio_device *adev, bool state)
    adev->voice.mic_mute = state;
    if (adev->mode == AUDIO_MODE_IN_CALL)
        err = platform_set_mic_mute(adev->platform, state);
    if (adev->mode == AUDIO_MODE_IN_COMMUNICATION)
    if (adev->mode == AUDIO_MODE_IN_COMMUNICATION && audio_extn_hfp_is_active(adev)) {
        err = hfp_set_mic_mute(adev, state);
    } else if (adev->mode == AUDIO_MODE_IN_COMMUNICATION) {
        err = voice_extn_compress_voip_set_mic_mute(adev, state);
    }

    return err;
}