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

Michael Tretter m.tretter at pengutronix.de
Thu Sep 3 16:57:15 UTC 2020


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 at pengutronix.de>
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

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);
 
-- 
2.20.1



More information about the dri-devel mailing list