Commit 68ca91d7 authored by Sebastian Reichel's avatar Sebastian Reichel Committed by Tomi Valkeinen

drm/omap: dsi: use pixel-format and mode from attach

In order to reduce the amount of custom functionality, this moves
handling of pixel format and DSI mode from set_config() to dsi
attach.
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201215104657.802264-22-tomi.valkeinen@ti.com
parent d4b561c3
...@@ -549,8 +549,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata) ...@@ -549,8 +549,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
u8 id1, id2, id3; u8 id1, id2, id3;
int r; int r;
struct omap_dss_dsi_config dsi_config = { struct omap_dss_dsi_config dsi_config = {
.mode = OMAP_DSS_DSI_CMD_MODE,
.pixel_format = MIPI_DSI_FMT_RGB888,
.vm = &ddata->vm, .vm = &ddata->vm,
.hs_clk_min = 150000000, .hs_clk_min = 150000000,
.hs_clk_max = 300000000, .hs_clk_max = 300000000,
......
...@@ -4576,24 +4576,19 @@ static int dsi_set_config(struct omap_dss_device *dssdev, ...@@ -4576,24 +4576,19 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
{ {
struct dsi_data *dsi = to_dsi_data(dssdev); struct dsi_data *dsi = to_dsi_data(dssdev);
struct dsi_clk_calc_ctx ctx; struct dsi_clk_calc_ctx ctx;
struct omap_dss_dsi_config cfg = *config;
bool ok; bool ok;
int r; int r;
mutex_lock(&dsi->lock); mutex_lock(&dsi->lock);
dsi->pix_fmt = config->pixel_format; cfg.mode = dsi->mode;
dsi->mode = config->mode; cfg.pixel_format = dsi->pix_fmt;
if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) { if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
DSSERR("invalid pixel format\n"); ok = dsi_vm_calc(dsi, &cfg, &ctx);
r = -EINVAL;
goto err;
}
if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
ok = dsi_vm_calc(dsi, config, &ctx);
else else
ok = dsi_cm_calc(dsi, config, &ctx); ok = dsi_cm_calc(dsi, &cfg, &ctx);
if (!ok) { if (!ok) {
DSSERR("failed to find suitable DSI clock settings\n"); DSSERR("failed to find suitable DSI clock settings\n");
...@@ -4604,7 +4599,7 @@ static int dsi_set_config(struct omap_dss_device *dssdev, ...@@ -4604,7 +4599,7 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo); dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI], r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
config->lp_clk_min, config->lp_clk_max, &dsi->user_lp_cinfo); cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
if (r) { if (r) {
DSSERR("failed to find suitable DSI LP clock settings\n"); DSSERR("failed to find suitable DSI LP clock settings\n");
goto err; goto err;
...@@ -4782,7 +4777,19 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host, ...@@ -4782,7 +4777,19 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
return -EBUSY; return -EBUSY;
} }
if (mipi_dsi_pixel_format_to_bpp(client->format) < 0) {
DSSERR("invalid pixel format\n");
return -EINVAL;
}
dsi->vc[channel].dest = client; dsi->vc[channel].dest = client;
dsi->pix_fmt = client->format;
if (client->mode_flags & MIPI_DSI_MODE_VIDEO)
dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
else
dsi->mode = OMAP_DSS_DSI_CMD_MODE;
return 0; return 0;
} }
......
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