Skip to contentSkip to conversation

drm/msm: Initial add DSI support

PATCH Superseded Hai Li 1 participant 6 messages Mar 26, 2015 – Mar 31, 2015

Subsystems (3)
lore
Share & tools
lore

Hai Li

author
#0 lore raw

v2 cover drm/msm: Initial add DSI support

Resending initial MSM DSI patches
DSI is supported by both mdp4 and mdp5. This patch series adds the common DSI controller driver and also enable it in mdp5.

Hai Li (4):
drm/msm/mdp5: Move *_modeset_init out of construct_encoder function drm/msm: Add split display interface
drm/msm: Initial add DSI connector support
drm/msm/mdp5: Enable DSI connector in msm drm driver

 drivers/gpu/drm/msm/Kconfig                     |   11 +
 drivers/gpu/drm/msm/Makefile                    |    5 +
 drivers/gpu/drm/msm/dsi/dsi.c                   |  212 +++
 drivers/gpu/drm/msm/dsi/dsi.h                   |  117 ++
 drivers/gpu/drm/msm/dsi/dsi_host.c              | 1992 +++++++++++++++++++++++
 drivers/gpu/drm/msm/dsi/dsi_manager.c           |  699 ++++++++
 drivers/gpu/drm/msm/dsi/dsi_phy.c               |  352 ++++
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c         |    4 +
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c |  343 ++++
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c        |   11 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c     |   43 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c         |  159 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h         |   28 +-
 drivers/gpu/drm/msm/msm_drv.c                   |    2 +
 drivers/gpu/drm/msm/msm_drv.h                   |   29 +
 drivers/gpu/drm/msm/msm_kms.h                   |    4 +
 16 files changed, 3970 insertions(+), 41 deletions(-)
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi.c
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi.h
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi_host.c
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi_manager.c
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi_phy.c
 create mode 100644 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
author
#1 lore raw

PATCH v2 1/4 drm/msm/mdp5: Move *_modeset_init out of construct_encoder function

This change is to make the content in construct_encoder reflect its name.
Also, DSI connector may be connected to video mode or command mode encoder, so that 2 different encoders need to be constructed for DSI.

---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 89 ++++++++++++++++++++-------------
 1 file changed, 54 insertions(+), 35 deletions(-)
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +54 -35
index f882019..6d967a8 100644
@@ -163,8 +163,9 @@ int mdp5_enable(struct mdp5_kms *mdp5_kms)
 	return 0;
 }
 
-static int construct_encoder(struct mdp5_kms *mdp5_kms,
-		enum mdp5_intf_type intf_type, int intf_num)
+static struct drm_encoder *construct_encoder(struct mdp5_kms *mdp5_kms,
+		enum mdp5_intf_type intf_type, int intf_num,
+		enum mdp5_intf_mode intf_mode)
 {
 	struct drm_device *dev = mdp5_kms->dev;
 	struct msm_drm_private *priv = dev->dev_private;
@@ -172,30 +173,64 @@ static int construct_encoder(struct mdp5_kms *mdp5_kms,
 	struct mdp5_interface intf = {
 			.num	= intf_num,
 			.type	= intf_type,
-			.mode	= MDP5_INTF_MODE_NONE,
+			.mode	= intf_mode,
 	};
-	int ret = 0;
 
 	encoder = mdp5_encoder_init(dev, &intf);
 	if (IS_ERR(encoder)) {
-		ret = PTR_ERR(encoder);
-		dev_err(dev->dev, "failed to construct encoder: %d\n", ret);
-		return ret;
+		dev_err(dev->dev, "failed to construct encoder\n");
+		return encoder;
 	}
 
 	encoder->possible_crtcs = (1 << priv->num_crtcs) - 1;
 	priv->encoders[priv->num_encoders++] = encoder;
 
-	if (intf_type == INTF_HDMI) {
-		ret = hdmi_modeset_init(priv->hdmi, dev, encoder);
-		if (ret)
-			dev_err(dev->dev, "failed to init HDMI: %d\n", ret);
+	return encoder;
+}
+
+static int modeset_init_intf(struct mdp5_kms *mdp5_kms, int intf_num)
+{
+	struct drm_device *dev = mdp5_kms->dev;
+	struct msm_drm_private *priv = dev->dev_private;
+	const struct mdp5_cfg_hw *hw_cfg =
+					mdp5_cfg_get_hw_config(mdp5_kms->cfg);
+	enum mdp5_intf_type intf_type = hw_cfg->intfs[intf_num];
+	struct drm_encoder *encoder;
+	int ret = 0;
+
+	switch (intf_type) {
+	case INTF_DISABLED:
+		break;
+	case INTF_eDP:
+		if (!priv->edp)
+			break;
+
+		encoder = construct_encoder(mdp5_kms, INTF_eDP, intf_num,
+					MDP5_INTF_MODE_NONE);
+		if (IS_ERR(encoder)) {
+			ret = PTR_ERR(encoder);
+			break;
+		}
 
-	} else if (intf_type == INTF_eDP) {
-		/* Construct bridge/connector for eDP: */
 		ret = msm_edp_modeset_init(priv->edp, dev, encoder);
-		if (ret)
-			dev_err(dev->dev, "failed to init eDP: %d\n", ret);
+		break;
+	case INTF_HDMI:
+		if (!priv->hdmi)
+			break;
+
+		encoder = construct_encoder(mdp5_kms, INTF_HDMI, intf_num,
+					MDP5_INTF_MODE_NONE);
+		if (IS_ERR(encoder)) {
+			ret = PTR_ERR(encoder);
+			break;
+		}
+
+		ret = hdmi_modeset_init(priv->hdmi, dev, encoder);
+		break;
+	default:
+		dev_err(dev->dev, "unknown intf: %d\n", intf_type);
+		ret = -EINVAL;
+		break;
 	}
 
 	return ret;
@@ -261,27 +296,11 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
 		}
 	}
 
-	/* Construct external display interfaces' encoders: */
+	/* Construct encoders and modeset initialize connector devices
+	 * for each external display interface.
+	 */
 	for (i = 0; i < ARRAY_SIZE(hw_cfg->intfs); i++) {
-		enum mdp5_intf_type intf_type = hw_cfg->intfs[i];
-
-		switch (intf_type) {
-		case INTF_DISABLED:
-			break;
-		case INTF_eDP:
-			if (priv->edp)
-				ret = construct_encoder(mdp5_kms, INTF_eDP, i);
-			break;
-		case INTF_HDMI:
-			if (priv->hdmi)
-				ret = construct_encoder(mdp5_kms, INTF_HDMI, i);
-			break;
-		default:
-			dev_err(dev->dev, "unknown intf: %d\n", intf_type);
-			ret = -EINVAL;
-			break;
-		}
-
+		ret = modeset_init_intf(mdp5_kms, i);
 		if (ret)
 			goto fail;
 	}
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#2 lore raw

PATCH v2 2/4 drm/msm: Add split display interface

In reply to Hai Li

This change is to add an interface to MDP for connector devices setting split display information.

---
 drivers/gpu/drm/msm/msm_kms.h | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/msm_kms.h +4 -0
index 3a78cb4..a9f17bd 100644
@@ -47,6 +47,10 @@ struct msm_kms_funcs {
 	const struct msm_format *(*get_format)(struct msm_kms *kms, uint32_t format);
 	long (*round_pixclk)(struct msm_kms *kms, unsigned long rate,
 			struct drm_encoder *encoder);
+	int (*set_split_display)(struct msm_kms *kms,
+			struct drm_encoder *encoder,
+			struct drm_encoder *slave_encoder,
+			bool is_cmd_mode);
 	/* cleanup: */
 	void (*preclose)(struct msm_kms *kms, struct drm_file *file);
 	void (*destroy)(struct msm_kms *kms);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#3 lore raw

PATCH v2 3/4 drm/msm: Initial add DSI connector support

In reply to Hai Li

This change adds the DSI connector support in msm drm driver.

v1: Initial change
v2:
- Address comments from Archit + minor clean-ups
- Rebase to not depend on msm_drm_sub_dev change [Rob's comment]

---
 drivers/gpu/drm/msm/Kconfig           |   11 +
 drivers/gpu/drm/msm/Makefile          |    4 +
 drivers/gpu/drm/msm/dsi/dsi.c         |  212 ++++
 drivers/gpu/drm/msm/dsi/dsi.h         |  117 ++
 drivers/gpu/drm/msm/dsi/dsi_host.c    | 1992 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/msm/dsi/dsi_manager.c |  699 ++++++++++++
 drivers/gpu/drm/msm/dsi/dsi_phy.c     |  352 ++++++
 drivers/gpu/drm/msm/msm_drv.h         |   29 +
 8 files changed, 3416 insertions(+)
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi.c
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi.h
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi_host.c
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi_manager.c
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi_phy.c
drivers/gpu/drm/msm/Kconfig +11 -0
index 1e6a907..5ba5631 100644
@@ -35,3 +35,14 @@ config DRM_MSM_REGISTER_LOGGING
 	  Compile in support for logging register reads/writes in a format
 	  that can be parsed by envytools demsm tool.  If enabled, register
 	  logging can be switched on via msm.reglog=y module param.
+
+config DRM_MSM_DSI
+	bool "Enable DSI support in MSM DRM driver"
+	depends on DRM_MSM
+	select DRM_PANEL
+	select DRM_MIPI_DSI
+	default y
+	help
+	  Choose this option if you have a need for MIPI DSI connector
+	  support.
+
drivers/gpu/drm/msm/Makefile +4 -0
index 674a132..5c144cc 100644
@@ -50,5 +50,9 @@ msm-y := \
 
 msm-$(CONFIG_DRM_MSM_FBDEV) += msm_fbdev.o
 msm-$(CONFIG_COMMON_CLK) += mdp/mdp4/mdp4_lvds_pll.o
+msm-$(CONFIG_DRM_MSM_DSI) += dsi/dsi.o \
+			dsi/dsi_host.o \
+			dsi/dsi_manager.o \
+			dsi/dsi_phy.o
 
 obj-$(CONFIG_DRM_MSM)	+= msm.o
drivers/gpu/drm/msm/dsi/dsi.c new file +212 -0

212 lines not on this page · raw message

drivers/gpu/drm/msm/dsi/dsi.h new file +117 -0

117 lines not on this page · raw message

drivers/gpu/drm/msm/dsi/dsi_host.c new file +1992 -0

1,992 lines not on this page · raw message

drivers/gpu/drm/msm/dsi/dsi_manager.c new file +699 -0

656 lines not on this page · raw message

drivers/gpu/drm/msm/dsi/dsi_phy.c new file +352 -0

352 lines not on this page · raw message

drivers/gpu/drm/msm/msm_drv.h +29 -0
index 9e8d441..04db4bd 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

Part of the diff is not shown here. View the raw message.

author
#4 lore raw

PATCH v3 1/1 drm/msm: Initial add DSI connector support

This change adds the DSI connector support in msm drm driver.

v1: Initial change
v2:
- Address comments from Archit + minor clean-ups
- Rebase to not depend on msm_drm_sub_dev change [Rob's comment]
v3: Fix issues when initialization is failed

---
 drivers/gpu/drm/msm/Kconfig           |   11 +
 drivers/gpu/drm/msm/Makefile          |    4 +
 drivers/gpu/drm/msm/dsi/dsi.c         |  212 ++++
 drivers/gpu/drm/msm/dsi/dsi.h         |  117 ++
 drivers/gpu/drm/msm/dsi/dsi_host.c    | 1993 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/msm/dsi/dsi_manager.c |  705 ++++++++++++
 drivers/gpu/drm/msm/dsi/dsi_phy.c     |  352 ++++++
 drivers/gpu/drm/msm/msm_drv.h         |   29 +
 8 files changed, 3423 insertions(+)
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi.c
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi.h
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi_host.c
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi_manager.c
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi_phy.c
drivers/gpu/drm/msm/Kconfig +11 -0
index 1e6a907..5ba5631 100644
@@ -35,3 +35,14 @@ config DRM_MSM_REGISTER_LOGGING
 	  Compile in support for logging register reads/writes in a format
 	  that can be parsed by envytools demsm tool.  If enabled, register
 	  logging can be switched on via msm.reglog=y module param.
+
+config DRM_MSM_DSI
+	bool "Enable DSI support in MSM DRM driver"
+	depends on DRM_MSM
+	select DRM_PANEL
+	select DRM_MIPI_DSI
+	default y
+	help
+	  Choose this option if you have a need for MIPI DSI connector
+	  support.
+
drivers/gpu/drm/msm/Makefile +4 -0
index 674a132..5c144cc 100644
@@ -50,5 +50,9 @@ msm-y := \
 
 msm-$(CONFIG_DRM_MSM_FBDEV) += msm_fbdev.o
 msm-$(CONFIG_COMMON_CLK) += mdp/mdp4/mdp4_lvds_pll.o
+msm-$(CONFIG_DRM_MSM_DSI) += dsi/dsi.o \
+			dsi/dsi_host.o \
+			dsi/dsi_manager.o \
+			dsi/dsi_phy.o
 
 obj-$(CONFIG_DRM_MSM)	+= msm.o
drivers/gpu/drm/msm/dsi/dsi.c new file +212 -0

212 lines not on this page · raw message

drivers/gpu/drm/msm/dsi/dsi.h new file +117 -0

117 lines not on this page · raw message

drivers/gpu/drm/msm/dsi/dsi_host.c new file +1993 -0

1,993 lines not on this page · raw message

drivers/gpu/drm/msm/dsi/dsi_manager.c new file +705 -0

655 lines not on this page · raw message

drivers/gpu/drm/msm/dsi/dsi_phy.c new file +352 -0

352 lines not on this page · raw message

drivers/gpu/drm/msm/msm_drv.h +29 -0
index 9e8d441..04db4bd 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

Part of the diff is not shown here. View the raw message.

author
#5 lore raw

PATCH v2 4/4 drm/msm/mdp5: Enable DSI connector in msm drm driver

In reply to Hai Li

This change adds the support in mdp5 kms driver for single and dual DSI. Dual DSI case depends on the framework API and sequence change to support dual data path.

v1: Initial change
v2: Address Rob Clark's comment
- Separate command mode encoder to a new file mdp5_cmd_encoder.c
- Rebase to not depend on msm_drm_sub_dev change

---
 drivers/gpu/drm/msm/Makefile                    |   3 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c         |   4 +
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c | 343 ++++++++++++++++++++++++
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c        |  11 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c     |  43 ++-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c         |  70 ++++-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h         |  28 +-
 drivers/gpu/drm/msm/msm_drv.c                   |   2 +
 8 files changed, 497 insertions(+), 7 deletions(-)
 create mode 100644 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c
drivers/gpu/drm/msm/Makefile +2 -1
index 5c144cc..ab20867 100644
@@ -53,6 +53,7 @@ msm-$(CONFIG_COMMON_CLK) += mdp/mdp4/mdp4_lvds_pll.o
 msm-$(CONFIG_DRM_MSM_DSI) += dsi/dsi.o \
 			dsi/dsi_host.o \
 			dsi/dsi_manager.o \
-			dsi/dsi_phy.o
+			dsi/dsi_phy.o \
+			mdp/mdp5/mdp5_cmd_encoder.o
 
 obj-$(CONFIG_DRM_MSM)	+= msm.o
drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c +4 -0
index 6c467fb..2c9a9dc 100644
@@ -68,6 +68,8 @@ const struct mdp5_cfg_hw msm8x74_config = {
 	},
 	.intfs = {
 		[0] = INTF_eDP,
+		[1] = INTF_DSI,
+		[2] = INTF_DSI,
 		[3] = INTF_HDMI,
 	},
 	.max_clk = 200000000,
@@ -125,6 +127,8 @@ const struct mdp5_cfg_hw apq8084_config = {
 	},
 	.intfs = {
 		[0] = INTF_eDP,
+		[1] = INTF_DSI,
+		[2] = INTF_DSI,
 		[3] = INTF_HDMI,
 	},
 	.max_clk = 320000000,
drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c new file +343 -0

343 lines not on this page · raw message

drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c +10 -1
index 9b38cde..f877e1d 100644
@@ -626,7 +626,16 @@ void mdp5_crtc_set_intf(struct drm_crtc *crtc, struct mdp5_interface *intf)
 
 	/* now that we know what irq's we want: */
 	mdp5_crtc->err.irqmask = intf2err(intf->num);
-	mdp5_crtc->vblank.irqmask = intf2vblank(lm, intf);
+
+	/* Register command mode Pingpong done as vblank for now,
+	 * so that atomic commit should wait for it to finish.
+	 * Ideally, in the future, we should take rd_ptr done as vblank,
+	 * and let atomic commit wait for pingpong done for commond mode.
+	 */
+	if (intf->mode == MDP5_INTF_DSI_MODE_COMMAND)
+		mdp5_crtc->vblank.irqmask = lm2ppdone(lm);
+	else
+		mdp5_crtc->vblank.irqmask = intf2vblank(lm, intf);
 	mdp_irq_update(&mdp5_kms->base);
 
 	mdp5_ctl_set_intf(mdp5_crtc->ctl, intf);
drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c +41 -2

61 lines not on this page · raw message

drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +69 -1

100 lines not on this page · raw message

drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h +26 -2
index 690edfd..f8d5736 100644
@@ -159,10 +159,9 @@ static inline uint32_t intf2err(int intf_num)
 	}
 }
 
+#define GET_PING_PONG_ID(layer_mixer)	((layer_mixer == 5) ? 3 : layer_mixer)
 static inline uint32_t intf2vblank(int lm, struct mdp5_interface *intf)
 {
-#define GET_PING_PONG_ID(layer_mixer)	((layer_mixer == 5) ? 3 : layer_mixer)
-
 	/*
 	 * In case of DSI Command Mode, the Ping Pong's read pointer IRQ
 	 * acts as a Vblank signal. The Ping Pong buffer used is bound to
@@ -185,6 +184,11 @@ static inline uint32_t intf2vblank(int lm, struct mdp5_interface *intf)
 	}
 }
 
+static inline uint32_t lm2ppdone(int lm)
+{
+	return MDP5_IRQ_PING_PONG_0_DONE << GET_PING_PONG_ID(lm);
+}
+
 int mdp5_disable(struct mdp5_kms *mdp5_kms);
 int mdp5_enable(struct mdp5_kms *mdp5_kms);
 
@@ -238,5 +242,25 @@ struct drm_crtc *mdp5_crtc_init(struct drm_device *dev,
 
 struct drm_encoder *mdp5_encoder_init(struct drm_device *dev,
 		struct mdp5_interface *intf);
+int mdp5_encoder_set_split_display(struct drm_encoder *encoder,
+					struct drm_encoder *slave_encoder);
+
+#ifdef CONFIG_DRM_MSM_DSI
+struct drm_encoder *mdp5_cmd_encoder_init(struct drm_device *dev,
+				struct mdp5_interface *intf);
+int mdp5_cmd_encoder_set_split_display(struct drm_encoder *encoder,
+					struct drm_encoder *slave_encoder);
+#else
+static inline struct drm_encoder *mdp5_cmd_encoder_init(
+			struct drm_device *dev, struct mdp5_interface *intf)
+{
+	return ERR_PTR(-EINVAL);
+}
+static inline int mdp5_cmd_encoder_set_split_display(
+	struct drm_encoder *encoder, struct drm_encoder *slave_encoder)
+{
+	return -EINVAL;
+}
+#endif
 
 #endif /* __MDP5_KMS_H__ */
drivers/gpu/drm/msm/msm_drv.c +2 -0
index dfd583f..bc61c34 100644
@@ -1030,6 +1030,7 @@ static struct platform_driver msm_platform_driver = {
 static int __init msm_drm_register(void)
 {
 	DBG("init");
+	msm_dsi_register();
 	msm_edp_register();
 	hdmi_register();
 	adreno_register();
@@ -1043,6 +1044,7 @@ static void __exit msm_drm_unregister(void)
 	hdmi_unregister();
 	adreno_unregister();
 	msm_edp_unregister();
+	msm_dsi_unregister();
 }
 
 module_init(msm_drm_register);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation