disp: msm: dp: Add abstract and wcd939x aux switch support

Add functionality to change which aux switch is used
at compile time for different targets. Add wcd939x
switch support.

Change-Id: Iced3b11733009680063790dfa8f180b19002f963
Signed-off-by: Nisarg Bhavsar <quic_bhavsar@quicinc.com>
This commit is contained in:
Nisarg Bhavsar
2022-10-28 12:08:29 -07:00
bovenliggende 1c465e0434
commit 4a2e5b3fe1
5 gewijzigde bestanden met toevoegingen van 92 en 17 verwijderingen

Bestand weergeven

@@ -11,7 +11,6 @@
#include <linux/component.h>
#include <linux/of_irq.h>
#include <linux/delay.h>
#include <linux/soc/qcom/fsa4480-i2c.h>
#include <linux/usb/phy.h>
#include <linux/jiffies.h>
#include <linux/pm_qos.h>
@@ -1221,8 +1220,8 @@ static int dp_display_process_hpd_high(struct dp_display_private *dp)
dp->debug->max_pclk_khz);
if (!dp->debug->sim_mode && !dp->no_aux_switch && !dp->parser->gpio_aux_switch
&& dp->aux_switch_node) {
rc = dp->aux->aux_switch(dp->aux, true, dp->hpd->orientation);
&& dp->aux_switch_node && dp->aux->switch_configure) {
rc = dp->aux->switch_configure(dp->aux, true, dp->hpd->orientation);
if (rc) {
mutex_unlock(&dp->session_lock);
return rc;
@@ -1400,7 +1399,7 @@ static int dp_display_process_hpd_low(struct dp_display_private *dp, bool skip_w
return rc;
}
static int dp_display_fsa4480_callback(struct notifier_block *self,
static int dp_display_aux_switch_callback(struct notifier_block *self,
unsigned long event, void *data)
{
return 0;
@@ -1416,9 +1415,12 @@ static int dp_display_init_aux_switch(struct dp_display_private *dp)
if (dp->aux_switch_ready)
return rc;
if (!dp->aux->switch_register_notifier)
return rc;
SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_ENTRY);
nb.notifier_call = dp_display_fsa4480_callback;
nb.notifier_call = dp_display_aux_switch_callback;
nb.priority = 0;
/*
@@ -1426,7 +1428,7 @@ static int dp_display_init_aux_switch(struct dp_display_private *dp)
* Bootup DP with cable connected usecase can hit this scenario.
*/
for (retry = 0; retry < max_retries; retry++) {
rc = fsa4480_reg_notifier(&nb, dp->aux_switch_node);
rc = dp->aux->switch_register_notifier(&nb, dp->aux_switch_node);
if (rc == 0) {
DP_DEBUG("registered notifier successfully\n");
dp->aux_switch_ready = true;
@@ -1443,7 +1445,8 @@ static int dp_display_init_aux_switch(struct dp_display_private *dp)
return rc;
}
fsa4480_unreg_notifier(&nb, dp->aux_switch_node);
if (dp->aux->switch_unregister_notifier)
dp->aux->switch_unregister_notifier(&nb, dp->aux_switch_node);
SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_EXIT, rc);
return rc;
@@ -1466,12 +1469,12 @@ static int dp_display_usbpd_configure_cb(struct device *dev)
}
if (!dp->debug->sim_mode && !dp->no_aux_switch
&& !dp->parser->gpio_aux_switch && dp->aux_switch_node) {
&& !dp->parser->gpio_aux_switch && dp->aux_switch_node && dp->aux->switch_configure) {
rc = dp_display_init_aux_switch(dp);
if (rc)
return rc;
rc = dp->aux->aux_switch(dp->aux, true, dp->hpd->orientation);
rc = dp->aux->switch_configure(dp->aux, true, dp->hpd->orientation);
if (rc)
return rc;
}
@@ -1656,8 +1659,8 @@ static void dp_display_disconnect_sync(struct dp_display_private *dp)
flush_workqueue(dp->wq);
if (!dp->debug->sim_mode && !dp->no_aux_switch
&& !dp->parser->gpio_aux_switch)
dp->aux->aux_switch(dp->aux, false, ORIENTATION_NONE);
&& !dp->parser->gpio_aux_switch && dp->aux->switch_configure)
dp->aux->switch_configure(dp->aux, false, ORIENTATION_NONE);
/*
* Delay the teardown of the mainlink for better interop experience.