Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41322aa6 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen
Browse files

drm/omap: Pass drm_display_mode to .check_timings() and .set_timings()



The omap_dss_device .check_timings() and .set_timings() operations
operate on struct videomode, while the DRM API operates on struct
drm_display_mode. This forces conversion from to videomode in the
callers. While that's not a problem per se, it creates a difference with
the drm_bridge API.

Replace the videomode parameter to the .check_timings() and
.set_timings() operations with a drm_display_mode. This pushed the
conversion to videomode down to the DSS devices in some cases. If needed
they will be converted to operate on drm_display_mode natively.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent d68164fe
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1127,20 +1127,20 @@ static int dsicm_get_modes(struct omap_dss_device *dssdev,
}

static int dsicm_check_timings(struct omap_dss_device *dssdev,
			       struct videomode *vm)
			       struct drm_display_mode *mode)
{
	struct panel_drv_data *ddata = to_panel_data(dssdev);
	int ret = 0;

	if (vm->hactive != ddata->vm.hactive)
	if (mode->hdisplay != ddata->vm.hactive)
		ret = -EINVAL;

	if (vm->vactive != ddata->vm.vactive)
	if (mode->vdisplay != ddata->vm.vactive)
		ret = -EINVAL;

	if (ret) {
		dev_warn(dssdev->dev, "wrong resolution: %d x %d",
			 vm->hactive, vm->vactive);
			 mode->hdisplay, mode->vdisplay);
		dev_warn(dssdev->dev, "panel resolution: %d x %d",
			 ddata->vm.hactive, ddata->vm.vactive);
	}
+8 −8
Original line number Diff line number Diff line
@@ -459,7 +459,7 @@ static void dpi_display_disable(struct omap_dss_device *dssdev)
}

static void dpi_set_timings(struct omap_dss_device *dssdev,
			    const struct videomode *vm)
			    const struct drm_display_mode *mode)
{
	struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);

@@ -467,13 +467,13 @@ static void dpi_set_timings(struct omap_dss_device *dssdev,

	mutex_lock(&dpi->lock);

	dpi->vm = *vm;
	drm_display_mode_to_videomode(mode, &dpi->vm);

	mutex_unlock(&dpi->lock);
}

static int dpi_check_timings(struct omap_dss_device *dssdev,
			     struct videomode *vm)
			     struct drm_display_mode *mode)
{
	struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
	int lck_div, pck_div;
@@ -482,20 +482,20 @@ static int dpi_check_timings(struct omap_dss_device *dssdev,
	struct dpi_clk_calc_ctx ctx;
	bool ok;

	if (vm->hactive % 8 != 0)
	if (mode->hdisplay % 8 != 0)
		return -EINVAL;

	if (vm->pixelclock == 0)
	if (mode->clock == 0)
		return -EINVAL;

	if (dpi->pll) {
		ok = dpi_pll_clk_calc(dpi, vm->pixelclock, &ctx);
		ok = dpi_pll_clk_calc(dpi, mode->clock * 1000, &ctx);
		if (!ok)
			return -EINVAL;

		fck = ctx.pll_cinfo.clkout[ctx.clkout_idx];
	} else {
		ok = dpi_dss_clk_calc(dpi, vm->pixelclock, &ctx);
		ok = dpi_dss_clk_calc(dpi, mode->clock * 1000, &ctx);
		if (!ok)
			return -EINVAL;

@@ -507,7 +507,7 @@ static int dpi_check_timings(struct omap_dss_device *dssdev,

	pck = fck / lck_div / pck_div;

	vm->pixelclock = pck;
	mode->clock = pck / 1000;

	return 0;
}
+3 −3
Original line number Diff line number Diff line
@@ -249,15 +249,15 @@ static void hdmi_power_off_full(struct omap_hdmi *hdmi)
}

static void hdmi_display_set_timings(struct omap_dss_device *dssdev,
				     const struct videomode *vm)
				     const struct drm_display_mode *mode)
{
	struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev);

	mutex_lock(&hdmi->lock);

	hdmi->cfg.vm = *vm;
	drm_display_mode_to_videomode(mode, &hdmi->cfg.vm);

	dispc_set_tv_pclk(hdmi->dss->dispc, vm->pixelclock);
	dispc_set_tv_pclk(hdmi->dss->dispc, mode->clock * 1000);

	mutex_unlock(&hdmi->lock);
}
+3 −3
Original line number Diff line number Diff line
@@ -248,15 +248,15 @@ static void hdmi_power_off_full(struct omap_hdmi *hdmi)
}

static void hdmi_display_set_timings(struct omap_dss_device *dssdev,
				     const struct videomode *vm)
				     const struct drm_display_mode *mode)
{
	struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev);

	mutex_lock(&hdmi->lock);

	hdmi->cfg.vm = *vm;
	drm_display_mode_to_videomode(mode, &hdmi->cfg.vm);

	dispc_set_tv_pclk(hdmi->dss->dispc, vm->pixelclock);
	dispc_set_tv_pclk(hdmi->dss->dispc, mode->clock * 1000);

	mutex_unlock(&hdmi->lock);
}
+2 −2
Original line number Diff line number Diff line
@@ -366,9 +366,9 @@ struct omap_dss_device_ops {
	void (*post_disable)(struct omap_dss_device *dssdev);

	int (*check_timings)(struct omap_dss_device *dssdev,
			     struct videomode *vm);
			     struct drm_display_mode *mode);
	void (*set_timings)(struct omap_dss_device *dssdev,
			    const struct videomode *vm);
			    const struct drm_display_mode *mode);

	bool (*detect)(struct omap_dss_device *dssdev);

Loading