disp: msm: dsi: update gpio mappings using tlmm api

Use tlmm api to retrieve and populate address mappings of
the panel gpio pins participating in the VM swtich
on Trusted UI.

Change-Id: Ibf2d13eac3fe907b729f4c2b54c63a3808022583
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
此提交包含在:
Jeykumar Sankaran
2021-04-27 16:46:31 -07:00
父節點 77d648442f
當前提交 5ec8dc1afc
共有 3 個檔案被更改,包括 41 行新增92 行删除

查看文件

@@ -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));