disp: msm: dp: fix configuration of aux switches and HPD sources

Decouple the configuration and parsing of aux switches with the
parsing and configuration of HPD sources. HPD notification can come from
either GPIO based approach or a PD module through a SW interface. The
presence of AUX switch on the board should have no bearing in deciding
which configuration for HPD detection is used. Update the implementation
to allow for flexibility in selecting any combination of the HPD source
and aux switches.

Change-Id: I96d558f1d88a359d523fae6dc746045393884d5a
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: Rajkumar Subbiah <quic_rsubbia@quicinc.com>
Signed-off-by: Sandeep Gangadharaiah <quic_sandgang@quicinc.com>
This commit is contained in:
Aravind Venkateswaran
2020-09-29 20:06:08 -07:00
committed by Sandeep Gangadharaiah
parent 135e318102
commit 78c45e9d5d
9 changed files with 67 additions and 107 deletions

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
@@ -45,46 +46,43 @@ struct dp_hpd *dp_hpd_get(struct device *dev, struct dp_parser *parser,
struct dp_aux_bridge *aux_bridge,
struct dp_hpd_cb *cb)
{
struct dp_hpd *dp_hpd;
struct dp_hpd *dp_hpd = NULL;
if (aux_bridge && (aux_bridge->flag & DP_AUX_BRIDGE_HPD)) {
dp_hpd = dp_bridge_hpd_get(dev, cb, aux_bridge);
if (IS_ERR(dp_hpd)) {
pr_err("failed to get bridge hpd\n");
return dp_hpd;
}
dp_hpd->type = DP_HPD_BRIDGE;
} else if (parser->no_aux_switch && parser->lphw_hpd) {
dp_hpd = dp_lphw_hpd_get(dev, parser, catalog, cb);
if (IS_ERR_OR_NULL(dp_hpd)) {
DP_ERR("failed to get lphw hpd\n");
return dp_hpd;
}
dp_hpd->type = DP_HPD_LPHW;
} else if (parser->no_aux_switch) {
dp_hpd = dp_gpio_hpd_get(dev, cb);
if (IS_ERR_OR_NULL(dp_hpd)) {
DP_ERR("failed to get gpio hpd\n");
return dp_hpd;
}
dp_hpd->type = DP_HPD_GPIO;
} else {
dp_hpd = dp_altmode_get(dev, cb);
if (!IS_ERR_OR_NULL(dp_hpd)) {
dp_hpd->type = DP_HPD_ALTMODE;
if (!IS_ERR(dp_hpd)) {
dp_hpd->type = DP_HPD_BRIDGE;
goto config;
}
DP_WARN("dp_altmode failed (%ld), falling back to dp_usbpd\n",
PTR_ERR(dp_hpd));
dp_hpd = dp_usbpd_get(dev, cb);
if (IS_ERR_OR_NULL(dp_hpd)) {
DP_ERR("failed to get usbpd\n");
return dp_hpd;
}
dp_hpd->type = DP_HPD_USBPD;
}
dp_hpd = dp_lphw_hpd_get(dev, parser, catalog, cb);
if (!IS_ERR_OR_NULL(dp_hpd)) {
dp_hpd->type = DP_HPD_LPHW;
goto config;
}
dp_hpd = dp_gpio_hpd_get(dev, cb);
if (!IS_ERR_OR_NULL(dp_hpd)) {
dp_hpd->type = DP_HPD_GPIO;
goto config;
}
dp_hpd = dp_altmode_get(dev, cb);
if (!IS_ERR_OR_NULL(dp_hpd)) {
dp_hpd->type = DP_HPD_ALTMODE;
goto config;
}
dp_hpd = dp_usbpd_get(dev, cb);
if (!IS_ERR_OR_NULL(dp_hpd)) {
dp_hpd->type = DP_HPD_USBPD;
goto config;
}
DP_ERR("Failed to detect HPD type\n");
goto end;
config:
if (!dp_hpd->host_init)
dp_hpd->host_init = dp_hpd_host_init;
@@ -93,6 +91,7 @@ config:
if (!dp_hpd->isr)
dp_hpd->isr = dp_hpd_isr;
end:
return dp_hpd;
}