diff --git a/arch/arm/boot/dts/qcom/msm8998-pinctrl.dtsi b/arch/arm/boot/dts/qcom/msm8998-pinctrl.dtsi index 1f5facd5cde5..efa4a0ca1096 100644 --- a/arch/arm/boot/dts/qcom/msm8998-pinctrl.dtsi +++ b/arch/arm/boot/dts/qcom/msm8998-pinctrl.dtsi @@ -1508,7 +1508,7 @@ mdss_dp_usbplug_cc_active: mdss_dp_usbplug_cc_active { mux { pins = "gpio38"; - function = "usb_phy"; + function = "gpio"; }; config { @@ -1521,7 +1521,7 @@ mdss_dp_usbplug_cc_suspend: mdss_dp_usbplug_cc_suspend { mux { pins = "gpio38"; - function = "usb_phy"; + function = "gpio"; }; config { diff --git a/drivers/video/fbdev/msm/mdss_dp.c b/drivers/video/fbdev/msm/mdss_dp.c index b7561e49955b..ee0f43573c56 100644 --- a/drivers/video/fbdev/msm/mdss_dp.c +++ b/drivers/video/fbdev/msm/mdss_dp.c @@ -709,7 +709,7 @@ static int mdss_dp_config_gpios(struct mdss_dp_drv_pdata *dp, bool enable) } if (gpio_is_valid(dp->aux_sel_gpio)) { rc = gpio_direction_output( - dp->aux_sel_gpio, 0); + dp->aux_sel_gpio, dp->aux_sel_gpio_output); if (rc) pr_err("unable to set dir for aux_sel gpio\n"); } @@ -1074,11 +1074,6 @@ static int mdss_dp_get_lane_mapping(struct mdss_dp_drv_pdata *dp, lane_map->lane1 = 0; lane_map->lane2 = 2; lane_map->lane3 = 3; - - if (gpio_is_valid(dp->usbplug_cc_gpio)) { - gpio_set_value(dp->usbplug_cc_gpio, 1); - pr_debug("Configured cc gpio for new Orientation\n"); - } } pr_debug("lane0 = %d, lane1 = %d, lane2 =%d, lane3 =%d\n", @@ -1175,7 +1170,6 @@ end: static int mdss_dp_on_irq(struct mdss_dp_drv_pdata *dp_drv) { int ret = 0; - enum plug_orientation orientation = ORIENTATION_NONE; struct lane_mapping ln_map; /* wait until link training is completed */ @@ -1189,15 +1183,14 @@ static int mdss_dp_on_irq(struct mdss_dp_drv_pdata *dp_drv) mutex_lock(&dp_drv->train_mutex); - orientation = usbpd_get_plug_orientation(dp_drv->pd); - pr_debug("plug orientation = %d\n", orientation); - - ret = mdss_dp_get_lane_mapping(dp_drv, orientation, &ln_map); + ret = mdss_dp_get_lane_mapping(dp_drv, dp_drv->orientation, + &ln_map); if (ret) goto exit; mdss_dp_phy_share_lane_config(&dp_drv->phy_io, - orientation, dp_drv->dpcd.max_lane_count); + dp_drv->orientation, + dp_drv->dpcd.max_lane_count); ret = mdss_dp_enable_mainlink_clocks(dp_drv); if (ret) @@ -1226,7 +1219,6 @@ exit: int mdss_dp_on_hpd(struct mdss_dp_drv_pdata *dp_drv) { int ret = 0; - enum plug_orientation orientation = ORIENTATION_NONE; struct lane_mapping ln_map; /* wait until link training is completed */ @@ -1246,10 +1238,7 @@ int mdss_dp_on_hpd(struct mdss_dp_drv_pdata *dp_drv) } mdss_dp_hpd_configure(&dp_drv->ctrl_io, true); - orientation = usbpd_get_plug_orientation(dp_drv->pd); - pr_debug("plug Orientation = %d\n", orientation); - - ret = mdss_dp_get_lane_mapping(dp_drv, orientation, &ln_map); + ret = mdss_dp_get_lane_mapping(dp_drv, dp_drv->orientation, &ln_map); if (ret) goto exit; @@ -1268,8 +1257,8 @@ int mdss_dp_on_hpd(struct mdss_dp_drv_pdata *dp_drv) goto exit; } - mdss_dp_phy_share_lane_config(&dp_drv->phy_io, - orientation, dp_drv->dpcd.max_lane_count); + mdss_dp_phy_share_lane_config(&dp_drv->phy_io, dp_drv->orientation, + dp_drv->dpcd.max_lane_count); pr_debug("link_rate = 0x%x\n", dp_drv->link_rate); @@ -1515,12 +1504,22 @@ static int mdss_dp_host_init(struct mdss_panel_data *pdata) pr_err("%s: host init done already\n", __func__); return 0; } + ret = mdss_dp_regulator_ctrl(dp_drv, true); if (ret) { pr_err("failed to enable regulators\n"); goto vreg_error; } + dp_drv->orientation = usbpd_get_plug_orientation(dp_drv->pd); + + dp_drv->aux_sel_gpio_output = 0; + if (dp_drv->orientation == ORIENTATION_CC2) + dp_drv->aux_sel_gpio_output = 1; + + pr_debug("orientation = %d, aux_sel_gpio_output = %d\n", + dp_drv->orientation, dp_drv->aux_sel_gpio_output); + mdss_dp_pinctrl_set_state(dp_drv, true); mdss_dp_config_gpios(dp_drv, true); @@ -1542,9 +1541,6 @@ static int mdss_dp_host_init(struct mdss_panel_data *pdata) mdss_dp_get_ctrl_hw_version(&dp_drv->ctrl_io), mdss_dp_get_phy_hw_version(&dp_drv->phy_io)); - pr_debug("plug Orientation = %d\n", - usbpd_get_plug_orientation(dp_drv->pd)); - mdss_dp_phy_aux_setup(&dp_drv->phy_io); mdss_dp_irq_enable(dp_drv); diff --git a/drivers/video/fbdev/msm/mdss_dp.h b/drivers/video/fbdev/msm/mdss_dp.h index 04abe9221acc..da3fd3b9c133 100644 --- a/drivers/video/fbdev/msm/mdss_dp.h +++ b/drivers/video/fbdev/msm/mdss_dp.h @@ -387,6 +387,7 @@ struct mdss_dp_drv_pdata { struct platform_device *ext_pdev; struct usbpd *pd; + enum plug_orientation orientation; struct dp_hdcp hdcp; struct usbpd_svid_handler svid_handler; struct dp_alt_mode alt_mode; @@ -437,6 +438,7 @@ struct mdss_dp_drv_pdata { struct dss_module_power power_data[DP_MAX_PM]; struct dp_pinctrl_res pin_res; int aux_sel_gpio; + int aux_sel_gpio_output; int aux_en_gpio; int usbplug_cc_gpio; int hpd_gpio;