From bd47e3e63b26936876524406bf4172f051f2c949 Mon Sep 17 00:00:00 2001 From: boyuyan Date: Tue, 10 Oct 2023 17:21:01 +0800 Subject: [PATCH] disp: msm: dp: disable pluggable eDP display backlight config Disable pluggable eDP display backlight config. Change-Id: I7a5cde4531422a1a5db0fd59e351de570d859c4c Signed-off-by: Boyuan Yan --- msm/dp/dp_display.c | 12 ++++++++---- msm/dp/dp_display.h | 1 + msm/dp/dp_parser.c | 2 ++ msm/dp/dp_parser.h | 2 ++ msm/dp/dp_power.c | 8 +++++++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/msm/dp/dp_display.c b/msm/dp/dp_display.c index 630767d4bb8d..cca4bccc926c 100644 --- a/msm/dp/dp_display.c +++ b/msm/dp/dp_display.c @@ -2129,6 +2129,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp) dp->dp_display.is_mst_supported = dp->parser->has_mst; dp->dp_display.dsc_cont_pps = dp->parser->dsc_continuous_pps; + dp->dp_display.no_backlight_support = dp->parser->no_backlight_support; dp->catalog = dp_catalog_get(dev, dp->parser); if (IS_ERR(dp->catalog)) { rc = PTR_ERR(dp->catalog); @@ -2633,7 +2634,7 @@ static int dp_display_enable(struct dp_display *dp_display, void *panel) goto end; /*edp backlight enable and edp pwm enable*/ - if (dp_display->is_edp) { + if ((dp_display->is_edp) && (!dp_display->no_backlight_support)) { rc = dp->power->edp_panel_set_gpio(dp->power, DP_GPIO_EDP_BACKLIGHT_PWR, true); if (rc) { DP_ERR("Cannot turn edp backlight power on"); @@ -2733,7 +2734,7 @@ static int dp_display_post_enable(struct dp_display *dp_display, void *panel) dp_display_stream_post_enable(dp, dp_panel); - if (dp_display->is_edp) { + if ((dp_display->is_edp) && (!dp_display->no_backlight_support)) { rc = dp->power->edp_panel_set_gpio(dp->power, DP_GPIO_EDP_BACKLIGHT_EN, true); if (rc) { DP_ERR("Cannot turn edp backlight power on"); @@ -2803,7 +2804,7 @@ static int dp_display_pre_disable(struct dp_display *dp_display, void *panel) goto end; } - if (dp_display->is_edp) { + if ((dp_display->is_edp) && (!dp_display->no_backlight_support)) { rc = dp->power->edp_panel_set_gpio(dp->power, DP_GPIO_EDP_BACKLIGHT_EN, false); if (rc) { DP_ERR("Cannot turn edp backlight power off"); @@ -2886,7 +2887,7 @@ static int dp_display_disable(struct dp_display *dp_display, void *panel) goto end; } - if (dp_display->is_edp) { + if ((dp_display->is_edp) && (!dp_display->no_backlight_support)) { rc = dp->power->edp_panel_set_gpio(dp->power, DP_GPIO_EDP_BACKLIGHT_PWR, false); if (rc) DP_ERR("Cannot turn edp backlight power off\n"); @@ -3418,6 +3419,9 @@ static int dp_display_set_backlight(struct dp_display *dp_display, return -EINVAL; } + if(dp_display->no_backlight_support) + return 0; + dp = container_of(dp_display, struct dp_display_private, dp_display); dp_panel = panel; diff --git a/msm/dp/dp_display.h b/msm/dp/dp_display.h index f7088a4aa93b..33488303320d 100644 --- a/msm/dp/dp_display.h +++ b/msm/dp/dp_display.h @@ -97,6 +97,7 @@ struct dp_display { u32 max_mixer_count; u32 max_dsc_count; bool cont_splash_enabled; + bool no_backlight_support; int (*enable)(struct dp_display *dp_display, void *panel); int (*post_enable)(struct dp_display *dp_display, void *panel); diff --git a/msm/dp/dp_parser.c b/msm/dp/dp_parser.c index 4503df56a81d..be9251d61fdc 100644 --- a/msm/dp/dp_parser.c +++ b/msm/dp/dp_parser.c @@ -295,6 +295,8 @@ static void dp_parser_bl_config(struct dp_parser *parser) } else { parser->pwm_period_usecs = val; } + parser->no_backlight_support = of_property_read_bool(of_node, + "qcom,no-backlight-support"); } static int dp_parser_gpio(struct dp_parser *parser) diff --git a/msm/dp/dp_parser.h b/msm/dp/dp_parser.h index da70b5674d51..a1ffe2521830 100644 --- a/msm/dp/dp_parser.h +++ b/msm/dp/dp_parser.h @@ -231,6 +231,7 @@ static inline char *dp_phy_aux_config_type_to_string(u32 cfg_type) * @has_mst_sideband: MST sideband feature enable status * @no_aux_switch: presence AUX switch status * @gpio_aux_switch: presence GPIO AUX switch status + * @no_backlight_support: For some display type that no support backlight * @dsc_feature_enable: DSC feature enable status * @fec_feature_enable: FEC feature enable status * @dsc_continuous_pps: PPS sent every frame by HW @@ -271,6 +272,7 @@ struct dp_parser { bool gpio_aux_switch; bool lphw_hpd; bool panel_notifier_support; + bool no_backlight_support; u32 bl_min_level; u32 bl_max_level; u32 brightness_max_level; diff --git a/msm/dp/dp_power.c b/msm/dp/dp_power.c index 254f32c36b53..c373de28ae69 100644 --- a/msm/dp/dp_power.c +++ b/msm/dp/dp_power.c @@ -746,7 +746,13 @@ static int dp_power_edp_panel_set_gpio(struct dp_power *dp_power, return -EINVAL; if ((pin_state >= DP_GPIO_EDP_MIN) && (pin_state < DP_GPIO_EDP_MAX)) { - gpio_direction_output(config[pin_state].gpio, enable); + if (gpio_is_valid(config[pin_state].gpio)) { + rc = gpio_direction_output(config[pin_state].gpio, enable); + if (rc) + DP_ERR("unable to set gpio rc=%d\n", rc); + } else { + DP_ERR("gpio invalid for %d pin\n", pin_state); + } } else { pr_err(" Invalid GPIO call\n"); return -EINVAL;