summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/omapdrm/dss/dsi.c
diff options
context:
space:
mode:
authorSebastian Reichel <sebastian.reichel@collabora.com>2020-12-15 12:45:54 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2020-12-15 16:08:22 +0200
commit68ca91d7d8c11d5668c0ffc17d9a587dcad0d4c7 (patch)
tree79f16e48219ffdc98c1d9f9834479b5db68e1f0c /drivers/gpu/drm/omapdrm/dss/dsi.c
parentd4b561c376f816dd78807b45f6faddc4d73b1917 (diff)
downloadlinux-68ca91d7d8c11d5668c0ffc17d9a587dcad0d4c7.tar.bz2
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: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201215104657.802264-22-tomi.valkeinen@ti.com
Diffstat (limited to 'drivers/gpu/drm/omapdrm/dss/dsi.c')
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dsi.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index d960335574f3..bf7bee0b9334 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4576,24 +4576,19 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
{
struct dsi_data *dsi = to_dsi_data(dssdev);
struct dsi_clk_calc_ctx ctx;
+ struct omap_dss_dsi_config cfg = *config;
bool ok;
int r;
mutex_lock(&dsi->lock);
- dsi->pix_fmt = config->pixel_format;
- dsi->mode = config->mode;
+ cfg.mode = dsi->mode;
+ cfg.pixel_format = dsi->pix_fmt;
- if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) {
- DSSERR("invalid pixel format\n");
- r = -EINVAL;
- goto err;
- }
-
- if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
- ok = dsi_vm_calc(dsi, config, &ctx);
+ if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
+ ok = dsi_vm_calc(dsi, &cfg, &ctx);
else
- ok = dsi_cm_calc(dsi, config, &ctx);
+ ok = dsi_cm_calc(dsi, &cfg, &ctx);
if (!ok) {
DSSERR("failed to find suitable DSI clock settings\n");
@@ -4604,7 +4599,7 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
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) {
DSSERR("failed to find suitable DSI LP clock settings\n");
goto err;
@@ -4782,7 +4777,19 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
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->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;
}