From ba8480ade08a9856331739b5abda3a1bf3099f03 Mon Sep 17 00:00:00 2001 From: Minecrell Date: Sat, 9 Apr 2022 11:53:12 +0200 Subject: [PATCH] lk2nd: panel: oem_panel: Enable tps65132 for huawei-kiwi This might need a better solution in the future, but for now lets place the necessary code directly into oem_panel. [Raymond: reimplement for huawei-kiwi] --- lk2nd/display/panel/oem_panel.c | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/lk2nd/display/panel/oem_panel.c b/lk2nd/display/panel/oem_panel.c index 0cf8cf20b..7231b9f05 100644 --- a/lk2nd/display/panel/oem_panel.c +++ b/lk2nd/display/panel/oem_panel.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -17,6 +18,14 @@ uint32_t panel_regulator_settings[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static struct gpio_pin enp_gpio = { + "msmgpio", 97, 3, 1, 0, 1 +}; + +static struct gpio_pin enn_gpio = { + "msmgpio", 32, 3, 1, 0, 1 +}; #endif int oem_panel_rotation() @@ -42,14 +51,44 @@ uint32_t oem_panel_max_auto_detect_panels() #define _panel_select(panel) panel_##panel##_select #define panel_select(panel) _panel_select(panel) +#if TARGET_MSM8916 +static int oem_tps65132_ctrl(uint8_t enable) +{ + if (enable) { + /* for tps65132 ENP pin */ + gpio_tlmm_config(enp_gpio.pin_id, 0, + enp_gpio.pin_direction, enp_gpio.pin_pull, + enp_gpio.pin_strength, + enp_gpio.pin_state); + gpio_set_dir(enp_gpio.pin_id, 2); + + /* for tps65132 ENN pin*/ + gpio_tlmm_config(enn_gpio.pin_id, 0, + enn_gpio.pin_direction, enn_gpio.pin_pull, + enn_gpio.pin_strength, + enn_gpio.pin_state); + gpio_set_dir(enn_gpio.pin_id, 2); + } else { + gpio_set_dir(enp_gpio.pin_id, 0); /* ENP */ + gpio_set_dir(enn_gpio.pin_id, 0); /* ENN */ + } + return NO_ERROR; +} +#endif + int oem_panel_select(const char *panel_name, struct panel_struct *panel, struct msm_panel_info *pinfo, struct mdss_dsi_phy_ctrl *phy_db) { + int enable = 1; + panel_select(LK2ND_DISPLAY)(panel, pinfo, phy_db); lk2nd_dev.panel.name = panel->paneldata->panel_node_id; #if TARGET_MSM8916 + if (panel_select(LK2ND_DISPLAY) == panel_cmi_nt35532_5p5_1080pxa_video_select) + oem_tps65132_ctrl(enable); + if (phy_db->regulator_mode == DSI_PHY_REGULATOR_LDO_MODE) memcpy(panel_regulator_settings, ldo_regulator_settings, REGULATOR_SIZE); else