diff mbox series

[14/16] drm/exynos: add callback for enabling i80 mode

Message ID 20200903165717.1272492-15-m.tretter@pengutronix.de (mailing list archive)
State Not Applicable
Headers show
Series drm/exynos: Convert driver to drm bridge | expand

Commit Message

Michael Tretter Sept. 3, 2020, 4:57 p.m. UTC
Display controllers need to know if the MIPI DSI bridge is running in
command or video mode. Allow platform drivers to register a callback for
being notified about the used mode.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 993402f1f7c7..a9dac66c834f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -255,6 +255,7 @@  struct exynos_dsi_driver_data {
 	unsigned int num_bits_resol;
 	const unsigned int *reg_values;
 	void (*te_handler)(struct drm_encoder *encoder);
+	void (*set_command_node)(struct drm_encoder *encoder, bool enable);
 };
 
 struct exynos_dsi {
@@ -471,6 +472,19 @@  static void exynos_dsi_te_handler(struct drm_encoder *encoder)
 	exynos_drm_crtc_te_handler(encoder->crtc);
 }
 
+static void exynos_dsi_set_command_mode(struct drm_encoder *encoder,
+					bool enable)
+{
+	struct drm_device *drm = encoder->dev;
+	struct exynos_drm_crtc *crtc;
+
+	crtc = exynos_drm_crtc_get_by_type(drm, EXYNOS_DISPLAY_TYPE_LCD);
+	if (IS_ERR(crtc))
+		return;
+
+	crtc->i80_mode = enable;
+}
+
 static const struct exynos_dsi_driver_data exynos3_dsi_driver_data = {
 	.reg_ofs = EXYNOS_REG_OFS,
 	.plltmr_reg = 0x50,
@@ -482,6 +496,7 @@  static const struct exynos_dsi_driver_data exynos3_dsi_driver_data = {
 	.num_bits_resol = 11,
 	.reg_values = reg_values,
 	.te_handler = exynos_dsi_te_handler,
+	.set_command_node = exynos_dsi_set_command_mode,
 };
 
 static const struct exynos_dsi_driver_data exynos4_dsi_driver_data = {
@@ -495,6 +510,7 @@  static const struct exynos_dsi_driver_data exynos4_dsi_driver_data = {
 	.num_bits_resol = 11,
 	.reg_values = reg_values,
 	.te_handler = exynos_dsi_te_handler,
+	.set_command_node = exynos_dsi_set_command_mode,
 };
 
 static const struct exynos_dsi_driver_data exynos5_dsi_driver_data = {
@@ -506,6 +522,7 @@  static const struct exynos_dsi_driver_data exynos5_dsi_driver_data = {
 	.num_bits_resol = 11,
 	.reg_values = reg_values,
 	.te_handler = exynos_dsi_te_handler,
+	.set_command_node = exynos_dsi_set_command_mode,
 };
 
 static const struct exynos_dsi_driver_data exynos5433_dsi_driver_data = {
@@ -518,6 +535,7 @@  static const struct exynos_dsi_driver_data exynos5433_dsi_driver_data = {
 	.num_bits_resol = 12,
 	.reg_values = exynos5433_reg_values,
 	.te_handler = exynos_dsi_te_handler,
+	.set_command_node = exynos_dsi_set_command_mode,
 };
 
 static const struct exynos_dsi_driver_data exynos5422_dsi_driver_data = {
@@ -530,6 +548,7 @@  static const struct exynos_dsi_driver_data exynos5422_dsi_driver_data = {
 	.num_bits_resol = 12,
 	.reg_values = exynos5422_reg_values,
 	.te_handler = exynos_dsi_te_handler,
+	.set_command_node = exynos_dsi_set_command_mode,
 };
 
 static const struct of_device_id exynos_dsi_of_match[] = {
@@ -1651,8 +1670,9 @@  static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
 	dsi->lanes = device->lanes;
 	dsi->format = device->format;
 	dsi->mode_flags = device->mode_flags;
-	exynos_drm_crtc_get_by_type(drm, EXYNOS_DISPLAY_TYPE_LCD)->i80_mode =
-			!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO);
+	if (dsi->driver_data->set_command_node)
+		dsi->driver_data->set_command_node(encoder,
+				!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO));
 
 	mutex_unlock(&drm->mode_config.mutex);