From 956cf6e55bfc7d2dc2bec4d0b7e725416cb084b2 Mon Sep 17 00:00:00 2001 From: Sankeerth Billakanti Date: Thu, 28 Mar 2019 09:47:43 +0530 Subject: [PATCH] drm/msm/dp: skip gpio driving in simulation mode On sm6150, the DP driver is driving the lane switch mux through gpio to toggle super-speed lanes for usb or DP use based on DP connect event. In simulation mode, the mux is toggling the super-speed lanes to DP after connect command is issued through the debugfs node. This is causing a loss of usb connection leading to communication cutoff between the simulation runtime environemnt and the device. These changes will skip gpio toglging during the simulation mode to avoid the usb connection loss. Change-Id: I8dd2a4f0af8451e3037d8c03c75ac711818cd217 Signed-off-by: Sankeerth Billakanti --- drivers/gpu/drm/msm/dp/dp_debug.c | 4 ++++ drivers/gpu/drm/msm/dp/dp_debug.h | 3 +++ drivers/gpu/drm/msm/dp/dp_display.c | 1 + drivers/gpu/drm/msm/dp/dp_power.c | 4 ++-- drivers/gpu/drm/msm/dp/dp_power.h | 5 ++++- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_debug.c b/drivers/gpu/drm/msm/dp/dp_debug.c index c53172fa035a..18a6c329b19c 100644 --- a/drivers/gpu/drm/msm/dp/dp_debug.c +++ b/drivers/gpu/drm/msm/dp/dp_debug.c @@ -50,6 +50,7 @@ struct dp_debug_private { struct dp_debug dp_debug; struct dp_parser *parser; struct dp_ctrl *ctrl; + struct dp_power *power; struct mutex lock; }; @@ -1461,6 +1462,7 @@ static void dp_debug_set_sim_mode(struct dp_debug_private *debug, bool sim) } debug->dp_debug.sim_mode = true; + debug->power->sim_mode = true; debug->aux->set_sim_mode(debug->aux, true, debug->edid, debug->dpcd); } else { @@ -1468,6 +1470,7 @@ static void dp_debug_set_sim_mode(struct dp_debug_private *debug, bool sim) debug->ctrl->abort(debug->ctrl); debug->aux->set_sim_mode(debug->aux, false, NULL, NULL); + debug->power->sim_mode = false; debug->dp_debug.sim_mode = false; debug->panel->set_edid(debug->panel, 0); @@ -2040,6 +2043,7 @@ struct dp_debug *dp_debug_get(struct dp_debug_in *in) debug->catalog = in->catalog; debug->parser = in->parser; debug->ctrl = in->ctrl; + debug->power = in->power; dp_debug = &debug->dp_debug; dp_debug->vdisplay = 0; diff --git a/drivers/gpu/drm/msm/dp/dp_debug.h b/drivers/gpu/drm/msm/dp/dp_debug.h index c1e2cfd62466..2ec72e87a2eb 100644 --- a/drivers/gpu/drm/msm/dp/dp_debug.h +++ b/drivers/gpu/drm/msm/dp/dp_debug.h @@ -63,6 +63,8 @@ struct dp_debug { * @connector: double pointer to display connector * @catalog: instance of catalog module * @parser: instance of parser module + * @ctrl: instance od ctrl module + * @power: instance of power module */ struct dp_debug_in { struct device *dev; @@ -74,6 +76,7 @@ struct dp_debug_in { struct dp_catalog *catalog; struct dp_parser *parser; struct dp_ctrl *ctrl; + struct dp_power *power; }; /** diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index efafdddd10b7..6d7e1595b6e5 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1365,6 +1365,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp) debug_in.catalog = dp->catalog; debug_in.parser = dp->parser; debug_in.ctrl = dp->ctrl; + debug_in.power = dp->power; dp->debug = dp_debug_get(&debug_in); if (IS_ERR(dp->debug)) { diff --git a/drivers/gpu/drm/msm/dp/dp_power.c b/drivers/gpu/drm/msm/dp/dp_power.c index c54ac1b7c7e2..a85f03dd3934 100644 --- a/drivers/gpu/drm/msm/dp/dp_power.c +++ b/drivers/gpu/drm/msm/dp/dp_power.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -123,7 +123,7 @@ static int dp_power_pinctrl_set(struct dp_power_private *power, bool active) parser = power->parser; - if (IS_ERR_OR_NULL(parser->pinctrl.pin)) + if (IS_ERR_OR_NULL(parser->pinctrl.pin) || power->dp_power.sim_mode) return 0; if (parser->no_aux_switch && parser->lphw_hpd) { diff --git a/drivers/gpu/drm/msm/dp/dp_power.h b/drivers/gpu/drm/msm/dp/dp_power.h index c31add55c5d9..a2e9a49de178 100644 --- a/drivers/gpu/drm/msm/dp/dp_power.h +++ b/drivers/gpu/drm/msm/dp/dp_power.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -21,12 +21,15 @@ /** * sruct dp_power - DisplayPort's power related data * + * @sim_mode: simulation mode enable flag * @init: initializes the regulators/core clocks/GPIOs/pinctrl * @deinit: turns off the regulators/core clocks/GPIOs/pinctrl * @clk_enable: enable/disable the DP clocks * @set_pixel_clk_parent: set the parent of DP pixel clock */ struct dp_power { + bool sim_mode; + int (*init)(struct dp_power *power, bool flip); int (*deinit)(struct dp_power *power); int (*clk_enable)(struct dp_power *power, enum dp_pm_type pm_type,