disp: msm: dsi: reorder resource validation in probe
Reorder resource validation to report probe deferral appropriately. Change-Id: I63aab1b3282bda24dba2b84906564de290345fdd Signed-off-by: Shashank Babu Chinta Venkata <sbchin@codeaurora.org>
This commit is contained in:
@@ -4020,7 +4020,7 @@ error:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dsi_display_res_init(struct dsi_display *display)
|
static int dsi_display_validate_resources(struct dsi_display *display)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int i;
|
int i;
|
||||||
@@ -4033,7 +4033,7 @@ static int dsi_display_res_init(struct dsi_display *display)
|
|||||||
rc = PTR_ERR(ctrl->ctrl);
|
rc = PTR_ERR(ctrl->ctrl);
|
||||||
DSI_ERR("failed to get dsi controller, rc=%d\n", rc);
|
DSI_ERR("failed to get dsi controller, rc=%d\n", rc);
|
||||||
ctrl->ctrl = NULL;
|
ctrl->ctrl = NULL;
|
||||||
goto error_ctrl_put;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctrl->phy = dsi_phy_get(ctrl->phy_of_node);
|
ctrl->phy = dsi_phy_get(ctrl->phy_of_node);
|
||||||
@@ -4042,9 +4042,24 @@ static int dsi_display_res_init(struct dsi_display *display)
|
|||||||
DSI_ERR("failed to get phy controller, rc=%d\n", rc);
|
DSI_ERR("failed to get phy controller, rc=%d\n", rc);
|
||||||
dsi_ctrl_put(ctrl->ctrl);
|
dsi_ctrl_put(ctrl->ctrl);
|
||||||
ctrl->phy = NULL;
|
ctrl->phy = NULL;
|
||||||
goto error_ctrl_put;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
error:
|
||||||
|
for (i = i - 1; i >= 0; i--) {
|
||||||
|
ctrl = &display->ctrl[i];
|
||||||
|
dsi_ctrl_put(ctrl->ctrl);
|
||||||
|
dsi_phy_put(ctrl->phy);
|
||||||
|
}
|
||||||
|
return -EPROBE_DEFER;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dsi_display_res_init(struct dsi_display *display)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
display->panel = dsi_panel_get(&display->pdev->dev,
|
display->panel = dsi_panel_get(&display->pdev->dev,
|
||||||
display->panel_node,
|
display->panel_node,
|
||||||
@@ -4056,7 +4071,7 @@ static int dsi_display_res_init(struct dsi_display *display)
|
|||||||
rc = PTR_ERR(display->panel);
|
rc = PTR_ERR(display->panel);
|
||||||
DSI_ERR("failed to get panel, rc=%d\n", rc);
|
DSI_ERR("failed to get panel, rc=%d\n", rc);
|
||||||
display->panel = NULL;
|
display->panel = NULL;
|
||||||
goto error_ctrl_put;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
display_for_each_ctrl(i, display) {
|
display_for_each_ctrl(i, display) {
|
||||||
@@ -4071,13 +4086,13 @@ static int dsi_display_res_init(struct dsi_display *display)
|
|||||||
rc = dsi_display_parse_lane_map(display);
|
rc = dsi_display_parse_lane_map(display);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
DSI_ERR("Lane map not found, rc=%d\n", rc);
|
DSI_ERR("Lane map not found, rc=%d\n", rc);
|
||||||
goto error_ctrl_put;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = dsi_display_clocks_init(display);
|
rc = dsi_display_clocks_init(display);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
DSI_ERR("Failed to parse clock data, rc=%d\n", rc);
|
DSI_ERR("Failed to parse clock data, rc=%d\n", rc);
|
||||||
goto error_ctrl_put;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4088,14 +4103,7 @@ static int dsi_display_res_init(struct dsi_display *display)
|
|||||||
display->is_active = false;
|
display->is_active = false;
|
||||||
else
|
else
|
||||||
display->is_active = true;
|
display->is_active = true;
|
||||||
|
error:
|
||||||
return 0;
|
|
||||||
error_ctrl_put:
|
|
||||||
for (i = i - 1; i >= 0; i--) {
|
|
||||||
ctrl = &display->ctrl[i];
|
|
||||||
dsi_ctrl_put(ctrl->ctrl);
|
|
||||||
dsi_phy_put(ctrl->phy);
|
|
||||||
}
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5078,12 +5086,6 @@ static int _dsi_display_dev_init(struct dsi_display *display)
|
|||||||
display->parser, display->fw->data,
|
display->parser, display->fw->data,
|
||||||
display->fw->size);
|
display->fw->size);
|
||||||
|
|
||||||
rc = dsi_display_parse_dt(display);
|
|
||||||
if (rc) {
|
|
||||||
DSI_ERR("[%s] failed to parse dt, rc=%d\n", display->name, rc);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = dsi_display_res_init(display);
|
rc = dsi_display_res_init(display);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
DSI_ERR("[%s] failed to initialize resources, rc=%d\n",
|
DSI_ERR("[%s] failed to initialize resources, rc=%d\n",
|
||||||
@@ -5637,8 +5639,6 @@ static int dsi_display_init(struct dsi_display *display)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct platform_device *pdev = display->pdev;
|
struct platform_device *pdev = display->pdev;
|
||||||
|
|
||||||
mutex_init(&display->display_lock);
|
|
||||||
|
|
||||||
rc = _dsi_display_dev_init(display);
|
rc = _dsi_display_dev_init(display);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
DSI_ERR("device init failed, rc=%d\n", rc);
|
DSI_ERR("device init failed, rc=%d\n", rc);
|
||||||
@@ -5720,6 +5720,7 @@ int dsi_display_dev_probe(struct platform_device *pdev)
|
|||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
mutex_init(&display->display_lock);
|
||||||
|
|
||||||
display->dma_cmd_workq = create_singlethread_workqueue(
|
display->dma_cmd_workq = create_singlethread_workqueue(
|
||||||
"dsi_dma_cmd_workq");
|
"dsi_dma_cmd_workq");
|
||||||
@@ -5777,6 +5778,19 @@ int dsi_display_dev_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
platform_set_drvdata(pdev, display);
|
platform_set_drvdata(pdev, display);
|
||||||
|
|
||||||
|
rc = dsi_display_parse_dt(display);
|
||||||
|
if (rc) {
|
||||||
|
DSI_ERR("[%s] failed to parse dt, rc=%d\n", display->name, rc);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = dsi_display_validate_resources(display);
|
||||||
|
if (rc) {
|
||||||
|
DSI_ERR("[%s] needed resources not probed yet, rc=%d\n",
|
||||||
|
display->name, rc);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
/* initialize display in firmware callback */
|
/* initialize display in firmware callback */
|
||||||
if (!boot_disp->boot_disp_en &&
|
if (!boot_disp->boot_disp_en &&
|
||||||
IS_ENABLED(CONFIG_DSI_PARSER) &&
|
IS_ENABLED(CONFIG_DSI_PARSER) &&
|
||||||
@@ -5802,8 +5816,10 @@ int dsi_display_dev_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
end:
|
end:
|
||||||
if (display)
|
if (display) {
|
||||||
|
mutex_destroy(&display->display_lock);
|
||||||
devm_kfree(&pdev->dev, display);
|
devm_kfree(&pdev->dev, display);
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user