Commit e290c812 authored by Sebastian Reichel's avatar Sebastian Reichel Committed by Tomi Valkeinen

drm/omap: dsi: Reverse direction of the DSS device enable/disable operations

Complete the direction reversal of the DSS device enable/disable
operations started by commit 19b4200d ("drm/omap: Reverse direction
of the DSS device enable/disable operations").

This effectively drops the requirement of calling DSS specific
code from the DSI panel driver moving it a bit further to a
standard drm_panel driver.
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201215104657.802264-31-tomi.valkeinen@ti.com
parent 2a4703c2
...@@ -284,27 +284,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata) ...@@ -284,27 +284,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
struct omap_dss_device *src = ddata->src; struct omap_dss_device *src = ddata->src;
u8 id1, id2, id3; u8 id1, id2, id3;
int r; int r;
struct omap_dss_dsi_config dsi_config = {
.vm = &ddata->vm,
.hs_clk_min = 150000000,
.hs_clk_max = 300000000,
.lp_clk_min = 7000000,
.lp_clk_max = 10000000,
};
r = regulator_bulk_enable(ARRAY_SIZE(ddata->supplies), ddata->supplies);
if (r) {
dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
return r;
}
r = src->ops->dsi.set_config(src, &dsi_config);
if (r) {
dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
goto err_regulators;
}
src->ops->enable(src);
dsicm_hw_reset(ddata); dsicm_hw_reset(ddata);
...@@ -359,12 +338,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata) ...@@ -359,12 +338,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
dsicm_hw_reset(ddata); dsicm_hw_reset(ddata);
src->ops->disable(src);
err_regulators:
r = regulator_bulk_disable(ARRAY_SIZE(ddata->supplies), ddata->supplies);
if (r)
dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
return r; return r;
} }
...@@ -373,6 +346,8 @@ static void dsicm_power_off(struct panel_drv_data *ddata) ...@@ -373,6 +346,8 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
struct omap_dss_device *src = ddata->src; struct omap_dss_device *src = ddata->src;
int r; int r;
ddata->enabled = false;
src->ops->dsi.disable_video_output(src, ddata->dsi->channel); src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
r = mipi_dsi_dcs_set_display_off(ddata->dsi); r = mipi_dsi_dcs_set_display_off(ddata->dsi);
...@@ -384,14 +359,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata) ...@@ -384,14 +359,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
"error disabling panel, issuing HW reset\n"); "error disabling panel, issuing HW reset\n");
dsicm_hw_reset(ddata); dsicm_hw_reset(ddata);
} }
src->ops->disable(src);
r = regulator_bulk_disable(ARRAY_SIZE(ddata->supplies), ddata->supplies);
if (r)
dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
ddata->enabled = false;
} }
static int dsicm_connect(struct omap_dss_device *src, static int dsicm_connect(struct omap_dss_device *src,
...@@ -411,6 +378,29 @@ static void dsicm_disconnect(struct omap_dss_device *src, ...@@ -411,6 +378,29 @@ static void dsicm_disconnect(struct omap_dss_device *src,
ddata->src = NULL; ddata->src = NULL;
} }
static void dsicm_pre_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *src = ddata->src;
int r;
struct omap_dss_dsi_config dsi_config = {
.vm = &ddata->vm,
.hs_clk_min = 150000000,
.hs_clk_max = 300000000,
.lp_clk_min = 7000000,
.lp_clk_max = 10000000,
};
r = regulator_bulk_enable(ARRAY_SIZE(ddata->supplies), ddata->supplies);
if (r)
dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
r = src->ops->dsi.set_config(src, &dsi_config);
if (r) {
dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
}
}
static void dsicm_enable(struct omap_dss_device *dssdev) static void dsicm_enable(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
...@@ -445,6 +435,16 @@ static void dsicm_disable(struct omap_dss_device *dssdev) ...@@ -445,6 +435,16 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
mutex_unlock(&ddata->lock); mutex_unlock(&ddata->lock);
} }
static void dsicm_post_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
int r;
r = regulator_bulk_disable(ARRAY_SIZE(ddata->supplies), ddata->supplies);
if (r)
dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
}
static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable) static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
{ {
struct mipi_dsi_device *dsi = ddata->dsi; struct mipi_dsi_device *dsi = ddata->dsi;
...@@ -498,8 +498,10 @@ static const struct omap_dss_device_ops dsicm_ops = { ...@@ -498,8 +498,10 @@ static const struct omap_dss_device_ops dsicm_ops = {
.connect = dsicm_connect, .connect = dsicm_connect,
.disconnect = dsicm_disconnect, .disconnect = dsicm_disconnect,
.pre_enable = dsicm_pre_enable,
.enable = dsicm_enable, .enable = dsicm_enable,
.disable = dsicm_disable, .disable = dsicm_disable,
.post_disable = dsicm_post_disable,
.get_modes = dsicm_get_modes, .get_modes = dsicm_get_modes,
.check_timings = dsicm_check_timings, .check_timings = dsicm_check_timings,
...@@ -655,8 +657,6 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi) ...@@ -655,8 +657,6 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
omapdss_device_unregister(dssdev); omapdss_device_unregister(dssdev);
if (omapdss_device_is_enabled(dssdev))
dsicm_disable(dssdev);
omapdss_device_disconnect(ddata->src, dssdev); omapdss_device_disconnect(ddata->src, dssdev);
sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group); sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
......
...@@ -136,16 +136,10 @@ static void omap_encoder_disable(struct drm_encoder *encoder) ...@@ -136,16 +136,10 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
*/ */
omapdss_device_disable(dssdev->next); omapdss_device_disable(dssdev->next);
/* /* Disable the internal encoder. This will disable the DSS output. */
* Disable the internal encoder. This will disable the DSS output. The
* DSI is treated as an exception as DSI pipelines still use the legacy
* flow where the pipeline output controls the encoder.
*/
if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
if (dssdev->ops && dssdev->ops->disable) if (dssdev->ops && dssdev->ops->disable)
dssdev->ops->disable(dssdev); dssdev->ops->disable(dssdev);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED; dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
/* /*
* Perform the post-disable operations on the chain of external devices * Perform the post-disable operations on the chain of external devices
...@@ -165,16 +159,10 @@ static void omap_encoder_enable(struct drm_encoder *encoder) ...@@ -165,16 +159,10 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
/* Prepare the chain of external devices for pipeline enable. */ /* Prepare the chain of external devices for pipeline enable. */
omapdss_device_pre_enable(dssdev->next); omapdss_device_pre_enable(dssdev->next);
/* /* Enable the internal encoder. This will enable the DSS output. */
* Enable the internal encoder. This will enable the DSS output. The
* DSI is treated as an exception as DSI pipelines still use the legacy
* flow where the pipeline output controls the encoder.
*/
if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
if (dssdev->ops && dssdev->ops->enable) if (dssdev->ops && dssdev->ops->enable)
dssdev->ops->enable(dssdev); dssdev->ops->enable(dssdev);
dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
}
/* /*
* Enable the chain of external devices, starting at the one at the * Enable the chain of external devices, starting at the one at the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment