diff options
Diffstat (limited to 'cras/src/server/cras_alsa_jack.c')
-rw-r--r-- | cras/src/server/cras_alsa_jack.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/cras/src/server/cras_alsa_jack.c b/cras/src/server/cras_alsa_jack.c index 52a227e7..6d4d7bf5 100644 --- a/cras/src/server/cras_alsa_jack.c +++ b/cras/src/server/cras_alsa_jack.c @@ -734,6 +734,16 @@ static snd_hctl_elem_t *find_eld_control_by_dev_index(snd_hctl_t *hctl, return snd_hctl_find_elem(hctl, elem_id); } +/* For non-gpio jack, check if it's of type hdmi/dp by + * matching jack name. */ +static int is_jack_hdmi_dp(const char *jack_name) +{ + // TODO(hychao): Use the information provided in UCM instead of + // name matching. + static const char *hdmi_dp = "HDMI"; + return !!strstr(jack_name, hdmi_dp); +} + /* Find GPIO jacks for this jack_list. * Args: * jack_list - Jack list to add to. @@ -772,8 +782,9 @@ static int find_gpio_jacks(struct cras_alsa_jack_list *jack_list, if (result_jack) { *result_jack = data.result_jack; - /* Find ELD control for HDMI/DP gpio jack. */ - if (*result_jack) + /* Find ELD control only for HDMI/DP gpio jack. */ + if (*result_jack && + is_jack_hdmi_dp((*result_jack)->gpio.device_name)) (*result_jack)->eld_control = find_eld_control_by_dev_index( jack_list->hctl, @@ -833,14 +844,6 @@ static unsigned int hctl_jack_device_index(const char *name) return (unsigned int)device_index; } -/* For non-gpio jack, check if it's of type hdmi/dp by - * matching jack name. */ -static int is_jack_hdmi_dp(const char *jack_name) -{ - static const char *hdmi_dp = "HDMI/DP"; - return strncmp(jack_name, hdmi_dp, strlen(hdmi_dp)) == 0; -} - /* Checks if the given control name is in the supplied list of possible jack * control base names. */ static int is_jack_control_in_list(const char *const *list, |