From bd47e3e63b26936876524406bf4172f051f2c949 Mon Sep 17 00:00:00 2001 From: boyuyan Date: Tue, 10 Oct 2023 17:21:01 +0800 Subject: [PATCH 1/3] 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; From b83f11f2241e7af6c977537e6a052720accc3715 Mon Sep 17 00:00:00 2001 From: Nilesh Laad Date: Wed, 6 Dec 2023 17:03:32 +0530 Subject: [PATCH 2/3] disp: msm: sde: address array index out-of-bound issue Add a check on number of built in displays to avoid array index out of bounds issue. Signed-off-by: Nilesh Laad Change-Id: I1af626d2f05bf822e02c8e228c28823370d32b4f --- msm/sde/sde_kms.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/msm/sde/sde_kms.c b/msm/sde/sde_kms.c index e0df3cc96fd8..43c436d6ba3a 100644 --- a/msm/sde/sde_kms.c +++ b/msm/sde/sde_kms.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark @@ -4493,6 +4493,12 @@ static int _sde_kms_get_splash_data(struct sde_kms *sde_kms, + dp_display_get_num_of_boot_displays(); num_regions = of_property_count_u64_elems(node, "reg") / 2; + if (num_displays >= MAX_DSI_DISPLAYS) { + SDE_ERROR("invalid number of built in displays %d\n", + num_displays); + return -EINVAL; + } + data->num_splash_displays = num_displays; SDE_DEBUG("splash mem num_regions:%d\n", num_regions); From 0f45eca383838f4d20955d11f6058e70052a6cad Mon Sep 17 00:00:00 2001 From: boyuyan Date: Fri, 20 Oct 2023 14:55:19 +0800 Subject: [PATCH 3/3] disp: msm: dp: add support of hotplug for eDP interface. Add for eDP display support pluggable and support eDP as secondary. Change-Id: I25d153282f08b8db21fdad15d3c971f609cdf49a Signed-off-by: Boyuan Yan --- msm/dp/dp_catalog.c | 10 ++++++---- msm/dp/dp_display.c | 9 ++++++--- msm/dp/dp_display.h | 3 ++- msm/dp/dp_drm.c | 20 +++++++++++++++++--- msm/dp/dp_parser.c | 12 +++++++++--- msm/dp/dp_parser.h | 6 +++++- 6 files changed, 45 insertions(+), 15 deletions(-) diff --git a/msm/dp/dp_catalog.c b/msm/dp/dp_catalog.c index f24d61d2ce6e..cd8f62654f9e 100644 --- a/msm/dp/dp_catalog.c +++ b/msm/dp/dp_catalog.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. */ @@ -2301,6 +2301,7 @@ static void dp_catalog_hpd_config_hpd(struct dp_catalog_hpd *hpd, bool en) { struct dp_catalog_private *catalog; struct dp_io_data *io_data; + struct dp_parser *parser; if (!hpd) { DP_ERR("invalid input\n"); @@ -2309,16 +2310,17 @@ static void dp_catalog_hpd_config_hpd(struct dp_catalog_hpd *hpd, bool en) catalog = dp_catalog_get_priv(hpd); io_data = catalog->io.dp_aux; + parser = catalog->parser; if (en) { u32 reftimer = dp_read(DP_DP_HPD_REFTIMER); /* - * Arm only the UNPLUG and HPD_IRQ interrupts for DP - * whereas for EDP arm only the HPD_IRQ interrupt + * Arm only the UNPLUG and HPD_IRQ interrupts for DP and pluggable EDP + * whereas for buitin EDP arm only the HPD_IRQ interrupt */ dp_write(DP_DP_HPD_INT_ACK, 0xF); - if (hpd->is_edp) + if ((hpd->is_edp) && (!parser->ext_hpd_en)) dp_write(DP_DP_HPD_INT_MASK, 0x2); else dp_write(DP_DP_HPD_INT_MASK, 0xA); diff --git a/msm/dp/dp_display.c b/msm/dp/dp_display.c index cca4bccc926c..ed38898f04d1 100644 --- a/msm/dp/dp_display.c +++ b/msm/dp/dp_display.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ @@ -2120,6 +2120,8 @@ static int dp_init_sub_modules(struct dp_display_private *dp) goto error; } + dp->parser->is_edp = dp->dp_display.is_edp; + rc = dp->parser->parse(dp->parser); if (rc) { DP_ERR("device tree parsing failed\n"); @@ -2130,6 +2132,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp) dp->dp_display.dsc_cont_pps = dp->parser->dsc_continuous_pps; dp->dp_display.no_backlight_support = dp->parser->no_backlight_support; + dp->dp_display.ext_hpd_en = dp->parser->ext_hpd_en; dp->catalog = dp_catalog_get(dev, dp->parser); if (IS_ERR(dp->catalog)) { rc = PTR_ERR(dp->catalog); @@ -3916,8 +3919,8 @@ static int dp_display_get_display_type(struct dp_display *dp_display, } dp = container_of(dp_display, struct dp_display_private, dp_display); - - *display_type = dp->parser->display_type; + if (dp->parser) + *display_type = dp->parser->display_type; return 0; } diff --git a/msm/dp/dp_display.h b/msm/dp/dp_display.h index 33488303320d..3202cd793666 100644 --- a/msm/dp/dp_display.h +++ b/msm/dp/dp_display.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. */ @@ -98,6 +98,7 @@ struct dp_display { u32 max_dsc_count; bool cont_splash_enabled; bool no_backlight_support; + bool ext_hpd_en; 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_drm.c b/msm/dp/dp_drm.c index 6398f525dfa9..6af98873cb38 100644 --- a/msm/dp/dp_drm.c +++ b/msm/dp/dp_drm.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ @@ -470,6 +470,7 @@ int dp_connector_get_info(struct drm_connector *connector, struct msm_display_info *info, void *data) { struct dp_display *display = data; + const char *display_type = NULL; if (!info || !display || !display->drm_dev) { DP_ERR("invalid params\n"); @@ -478,6 +479,14 @@ int dp_connector_get_info(struct drm_connector *connector, info->intf_type = DRM_MODE_CONNECTOR_DisplayPort; + display->get_display_type(display, &display_type); + if (display_type){ + if (!strcmp(display_type, "primary")) + info->display_type = SDE_CONNECTOR_PRIMARY; + else if (!strcmp(display_type, "secondary")) + info->display_type = SDE_CONNECTOR_SECONDARY; + } + info->num_of_h_tiles = 1; info->h_tile_instance[0] = 0; info->is_connected = display->is_sst_connected; @@ -486,8 +495,10 @@ int dp_connector_get_info(struct drm_connector *connector, if (display && display->is_edp) { info->intf_type = DRM_MODE_CONNECTOR_eDP; - info->display_type = SDE_CONNECTOR_PRIMARY; - info->is_connected = true; + if(display->ext_hpd_en) + info->capabilities |= MSM_DISPLAY_CAP_HOT_PLUG; + else + info->is_connected = true; } else { info->capabilities |= MSM_DISPLAY_CAP_HOT_PLUG; } @@ -644,6 +655,9 @@ int dp_connector_set_info_blob(struct drm_connector *connector, dp_display->get_display_type(dp_display, &display_type); sde_kms_info_add_keystr(info, "display type", display_type); + if((dp_display->is_edp) && (dp_display->ext_hpd_en)) + sde_kms_info_add_keystr(info, "ext bridge hpd support", "true"); + return 0; } diff --git a/msm/dp/dp_parser.c b/msm/dp/dp_parser.c index be9251d61fdc..16b57ad7dee3 100644 --- a/msm/dp/dp_parser.c +++ b/msm/dp/dp_parser.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ @@ -174,13 +174,19 @@ static int dp_parser_misc(struct dp_parser *parser) } parser->display_type = of_get_property(of_node, "qcom,display-type", NULL); - if (!parser->display_type) - parser->display_type = "unknown"; + if (!parser->display_type) { + if (parser->is_edp) + parser->display_type = "primary"; + else + parser->display_type = "secondary"; + } parser->panel_notifier_support = of_property_read_bool(of_node, "qcom,panel-notifier-support"); DP_DEBUG("panel-notifier-support = %d\n", parser->panel_notifier_support); + parser->ext_hpd_en = of_property_read_bool(of_node, + "qcom,dp-ext-hpd"); return 0; } diff --git a/msm/dp/dp_parser.h b/msm/dp/dp_parser.h index a1ffe2521830..b13cb67f48b2 100644 --- a/msm/dp/dp_parser.h +++ b/msm/dp/dp_parser.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ @@ -232,6 +232,8 @@ static inline char *dp_phy_aux_config_type_to_string(u32 cfg_type) * @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 + * @ext_hpd_en: A boolean value indicates an external dp can support hotplug + * @is_edp: A boolean value indicates an edp interface * @dsc_feature_enable: DSC feature enable status * @fec_feature_enable: FEC feature enable status * @dsc_continuous_pps: PPS sent every frame by HW @@ -273,6 +275,8 @@ struct dp_parser { bool lphw_hpd; bool panel_notifier_support; bool no_backlight_support; + bool ext_hpd_en; + bool is_edp; u32 bl_min_level; u32 bl_max_level; u32 brightness_max_level;