diff --git a/msm/dsi/dsi_display.c b/msm/dsi/dsi_display.c index 155111f5b7..b87d1cad91 100644 --- a/msm/dsi/dsi_display.c +++ b/msm/dsi/dsi_display.c @@ -5443,22 +5443,49 @@ static int dsi_display_get_io_resources(struct msm_io_res *io_res, void *data) { int rc = 0; struct dsi_display *display; + struct platform_device *pdev; + int te_gpio, avdd_gpio; if (!data) return -EINVAL; + display = (struct dsi_display *)data; + + pdev = display->pdev; + if (!pdev) + return -EINVAL; + rc = dsi_ctrl_get_io_resources(io_res); if (rc) - goto end; + return rc; rc = dsi_phy_get_io_resources(io_res); if (rc) - goto end; + return rc; - display = (struct dsi_display *)data; rc = dsi_panel_get_io_resources(display->panel, io_res); + if (rc) + return rc; + + te_gpio = of_get_named_gpio(pdev->dev.of_node, "qcom,platform-te-gpio", 0); + if (gpio_is_valid(te_gpio)) { + rc = msm_dss_get_gpio_io_mem(te_gpio, &io_res->mem); + if (rc) { + DSI_ERR("[%s] failed to retrieve the te gpio address\n", + display->panel->name); + return rc; + } + } + + avdd_gpio = of_get_named_gpio(pdev->dev.of_node, + "qcom,avdd-regulator-gpio", 0); + if (gpio_is_valid(avdd_gpio)) { + rc = msm_dss_get_gpio_io_mem(avdd_gpio, &io_res->mem); + if (rc) + DSI_ERR("[%s] failed to retrieve the avdd gpio address\n", + display->panel->name); + } -end: return rc; } diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index 7b6ba80fc2..9c5d62d5fe 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -2217,34 +2217,21 @@ error: int dsi_panel_get_io_resources(struct dsi_panel *panel, struct msm_io_res *io_res) { - struct list_head temp_head; - struct msm_io_mem_entry *io_mem, *pos, *tmp; + struct dsi_parser_utils *utils = &panel->utils; struct list_head *mem_list = &io_res->mem; - int i, rc = 0; + int reset_gpio; + int rc = 0; - INIT_LIST_HEAD(&temp_head); - - for (i = 0; i < panel->tlmm_gpio_count; i++) { - io_mem = kzalloc(sizeof(*io_mem), GFP_KERNEL); - if (!io_mem) { - rc = -ENOMEM; - goto parse_fail; + reset_gpio = utils->get_named_gpio(utils->data, + "qcom,platform-reset-gpio", 0); + if (gpio_is_valid(reset_gpio)) { + rc = msm_dss_get_gpio_io_mem(reset_gpio, mem_list); + if (rc) { + DSI_ERR("[%s] failed to retrieve the reset gpio address\n", panel->name); + goto end; } - - io_mem->base = panel->tlmm_gpio[i].addr; - io_mem->size = panel->tlmm_gpio[i].size; - - list_add(&io_mem->list, &temp_head); } - list_splice(&temp_head, mem_list); - goto end; - -parse_fail: - list_for_each_entry_safe(pos, tmp, &temp_head, list) { - list_del(&pos->list); - kfree(pos); - } end: return rc; } @@ -2333,54 +2320,6 @@ error: return rc; } -static int dsi_panel_parse_tlmm_gpio(struct dsi_panel *panel) -{ - struct dsi_parser_utils *utils = &panel->utils; - u32 base, size, pin; - int pin_count, address_count, name_count, i; - - address_count = utils->count_u32_elems(utils->data, - "qcom,dsi-panel-gpio-address"); - if (address_count != 2) { - DSI_DEBUG("panel gpio address not defined\n"); - return 0; - } - - utils->read_u32_index(utils->data, - "qcom,dsi-panel-gpio-address", 0, &base); - utils->read_u32_index(utils->data, - "qcom,dsi-panel-gpio-address", 1, &size); - - pin_count = utils->count_u32_elems(utils->data, - "qcom,dsi-panel-gpio-pins"); - name_count = utils->count_strings(utils->data, - "qcom,dsi-panel-gpio-names"); - if ((pin_count < 0) || (name_count < 0) || (pin_count != name_count)) { - DSI_ERR("invalid gpio pins/names\n"); - return -EINVAL; - } - - panel->tlmm_gpio = kcalloc(pin_count, - sizeof(struct dsi_tlmm_gpio), GFP_KERNEL); - if (!panel->tlmm_gpio) - return -ENOMEM; - - panel->tlmm_gpio_count = pin_count; - for (i = 0; i < pin_count; i++) { - utils->read_u32_index(utils->data, - "qcom,dsi-panel-gpio-pins", i, &pin); - panel->tlmm_gpio[i].num = pin; - panel->tlmm_gpio[i].addr = base + (pin * size); - panel->tlmm_gpio[i].size = size; - - utils->read_string_index(utils->data, - "qcom,dsi-panel-gpio-names", i, - &(panel->tlmm_gpio[i].name)); - } - - return 0; -} - static int dsi_panel_parse_bl_pwm_config(struct dsi_panel *panel) { int rc = 0; @@ -3591,12 +3530,6 @@ struct dsi_panel *dsi_panel_get(struct device *parent, goto error; } - rc = dsi_panel_parse_tlmm_gpio(panel); - if (rc) { - DSI_ERR("failed to parse panel tlmm gpios, rc=%d\n", rc); - goto error; - } - rc = panel->panel_ops.parse_power_cfg(panel); if (rc) DSI_ERR("failed to parse power config, rc=%d\n", rc); @@ -3752,7 +3685,6 @@ int dsi_panel_drv_deinit(struct dsi_panel *panel) if (rc) DSI_ERR("[%s] failed to put regs, rc=%d\n", panel->name, rc); - kfree(panel->tlmm_gpio); panel->host = NULL; memset(&panel->mipi_device, 0x0, sizeof(panel->mipi_device)); diff --git a/msm/dsi/dsi_panel.h b/msm/dsi/dsi_panel.h index 918e406568..72e66f490f 100644 --- a/msm/dsi/dsi_panel.h +++ b/msm/dsi/dsi_panel.h @@ -191,13 +191,6 @@ struct dsi_panel_spr_info { enum msm_display_spr_pack_type pack_type; }; -struct dsi_tlmm_gpio { - u32 num; - u32 addr; - u32 size; - const char *name; -}; - struct dsi_panel; struct dsi_panel_ops { @@ -273,9 +266,6 @@ struct dsi_panel { int power_mode; enum dsi_panel_physical_type panel_type; - struct dsi_tlmm_gpio *tlmm_gpio; - u32 tlmm_gpio_count; - struct dsi_panel_ops panel_ops; };