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

Commit 94937c1c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hal: update the notification of HDMI/DisplayPort connection" into...

Merge "hal: update the notification of HDMI/DisplayPort connection" into audio-userspace.lnx.2.2-dev
parents 5e4ccbc1 9426c291
Loading
Loading
Loading
Loading
+38 −3
Original line number Original line Diff line number Diff line
@@ -180,6 +180,41 @@ static int update_ext_disp_sysfs_node(const struct audio_device *adev, int node_
    return ret;
    return ret;
}
}


static int update_audio_ack_state(const struct audio_device *adev, int node_value)
{
    const char *mixer_ctl_name = "External Display Audio Ack";
    struct mixer_ctl *ctl;
    int ret = 0;

    ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
    /* If no mixer command support, fall back to sysfs node approach */
    if (!ctl) {
        ALOGI("%s: could not get ctl for mixer cmd(%s), use sysfs node instead\n",
              __func__, mixer_ctl_name);
        ret = update_ext_disp_sysfs_node(adev, node_value);
    } else {
        char *ack_str = NULL;

        if (node_value == EXT_DISPLAY_PLUG_STATUS_NOTIFY_ENABLE)
            ack_str = "Ack_Enable";
        else if (node_value == 1)
            ack_str = "Connect";
        else if (node_value == 0)
            ack_str = "Disconnect";
        else {
            ALOGE("%s: Invalid input parameter - 0x%x\n",
                  __func__, node_value);
            return -EINVAL;
        }

        ret = mixer_ctl_set_enum_by_string(ctl, ack_str);
        if (ret)
            ALOGE("%s: Could not set ctl for mixer cmd - %s ret %d\n",
                  __func__, mixer_ctl_name, ret);
    }
    return ret;
}

static void audio_extn_ext_disp_set_parameters(const struct audio_device *adev,
static void audio_extn_ext_disp_set_parameters(const struct audio_device *adev,
                                                     struct str_parms *parms)
                                                     struct str_parms *parms)
{
{
@@ -192,13 +227,13 @@ static void audio_extn_ext_disp_set_parameters(const struct audio_device *adev,
        if (is_hdmi_sysfs_node_init == false) {
        if (is_hdmi_sysfs_node_init == false) {
            //check if this is different for dp and hdmi
            //check if this is different for dp and hdmi
            is_hdmi_sysfs_node_init = true;
            is_hdmi_sysfs_node_init = true;
            update_ext_disp_sysfs_node(adev, EXT_DISPLAY_PLUG_STATUS_NOTIFY_ENABLE);
            update_audio_ack_state(adev, EXT_DISPLAY_PLUG_STATUS_NOTIFY_ENABLE);
        }
        }
        update_ext_disp_sysfs_node(adev, 1);
        update_audio_ack_state(adev, 1);
    } else if(str_parms_get_str(parms, "disconnect", value, sizeof(value)) >= 0
    } else if(str_parms_get_str(parms, "disconnect", value, sizeof(value)) >= 0
            && (atoi(value) & AUDIO_DEVICE_OUT_AUX_DIGITAL)){
            && (atoi(value) & AUDIO_DEVICE_OUT_AUX_DIGITAL)){
        //params = "disconnect=1024" for external display disconnection.
        //params = "disconnect=1024" for external display disconnection.
        update_ext_disp_sysfs_node(adev, 0);
        update_audio_ack_state(adev, 0);
        ALOGV("invalidate cached edid");
        ALOGV("invalidate cached edid");
        platform_invalidate_hdmi_config(adev->platform);
        platform_invalidate_hdmi_config(adev->platform);
    } else {
    } else {