Skip to contentSkip to conversation

Split rockchip mipi driver into common and specific parts.

PATCH New Eric Gao 3 participants 14 messages Jun 21, 2017 – Aug 7, 2017

Subsystems (2)
lore
Share & tools
lore

Eric Gao

author
#0 lore raw

v3 cover Split rockchip mipi driver into common and specific parts.

This patch series split the rockchip mipi dsi driver into common and specific parts to make it possible that different soc share the most common code.

Changes in v2:
-Use dev_read_addr to replace devfdt_get_addr.

Changes in v1:
-Add title.
-Delete the unused variable.

Eric Gao (3):
rockchip: defconfig: Increase max video resolution for mipi panel
rockchip: video: mipi: Split mipi driver into common and specific
parts
rockchop: video: mipi: Makefile: Add soc specfic driver for rk3399
mipi dsi

 configs/evb-rk3399_defconfig         |   8 +-
 drivers/video/rockchip/Makefile      |   3 +-
 drivers/video/rockchip/rk3399_mipi.c | 183 +++++++++++++++++++++++++++++++++++
 drivers/video/rockchip/rk_mipi.c     | 170 ++------------------------------
 drivers/video/rockchip/rk_mipi.h     |  32 ++++++
 5 files changed, 226 insertions(+), 170 deletions(-)
 create mode 100644 drivers/video/rockchip/rk3399_mipi.c
 create mode 100644 drivers/video/rockchip/rk_mipi.h
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v3 1/3 rockchip: defconfig: Increase max video resolution for mipi panel

The mipi panel used on evb-rk3399 has a 1920x1200 resolution. But now the max resolution is 1920x1080. So increase it.

---

Changes in v2: None
Changes in v1:
-Add title.

 configs/evb-rk3399_defconfig | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
configs/evb-rk3399_defconfig +3 -5
index c189e75..1b30f24 100644
@@ -6,6 +6,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x4000
 CONFIG_ROCKCHIP_RK3399=y
 CONFIG_SPL_STACK_R_ADDR=0x80000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-evb"
+CONFIG_DEBUG_UART=y
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
 # CONFIG_DISPLAY_CPUINFO is not set
@@ -23,6 +24,7 @@ CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_SPL_OF_PLATDATA=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_REGMAP=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SYSCON=y
@@ -34,12 +36,8 @@ CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ROCKCHIP=y
-CONFIG_DM_PMIC=y
-CONFIG_PMIC_RK808=y
-CONFIG_REGULATOR_RK808=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_GMAC_ROCKCHIP=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
@@ -53,7 +51,6 @@ CONFIG_PWM_ROCKCHIP=y
 CONFIG_RAM=y
 CONFIG_SPL_RAM=y
 CONFIG_BAUDRATE=1500000
-CONFIG_DEBUG_UART=y
 CONFIG_DEBUG_UART_BASE=0xFF1A0000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART_SHIFT=2
@@ -68,6 +65,7 @@ CONFIG_USB_STORAGE=y
 CONFIG_DM_VIDEO=y
 CONFIG_DISPLAY=y
 CONFIG_VIDEO_ROCKCHIP=y
+CONFIG_VIDEO_ROCKCHIP_MAX_YRES=1200
 CONFIG_DISPLAY_ROCKCHIP_MIPI=y
 CONFIG_USE_TINY_PRINTF=y
 CONFIG_ERRNO_STR=y
Signature · 1 line
1.9.1
#2 lore raw

PATCH v3 1/3 rockchip: defconfig: Increase max video resolution for mipi panel

Quoted 4 lines

The mipi panel used on evb-rk3399 has a 1920x1200 resolution. But now the max resolution is 1920x1080. So increase it.

Quoted 9 lines

---

Changes in v2: None
Changes in v1:
-Add title.

 configs/evb-rk3399_defconfig | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
#3 lore raw

PATCH v3 1/3 rockchip: defconfig: Increase max video resolution for mipi panel

In reply to Eric Gao

Hi Eric,

Quoted 5 lines · On Wed, 21 Jun 2017 11:20:32 +0800 Eric Gao eric.gao at rock-chips.com wrote:

The mipi panel used on evb-rk3399 has a 1920x1200 resolution. But now the max resolution is 1920x1080. So increase it.

Quoted 8 lines

---

Changes in v2: None
Changes in v1:
-Add title.

 configs/evb-rk3399_defconfig | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Applied to u-boot-video/master after dropping already committed hunks.

Thanks!

--
Anatolij

author
#4 lore raw

PATCH v3 2/3 rockchip: video: mipi: Split mipi driver into common and specific parts

In reply to Eric Gao

To compatible with different rockchip soc, we split the mipi dirver into common and soc specific parts, and all the soc share the common functions from common driver part.

---

Changes in v2:
-Use dev_read_addr to replace devfdt_get_addr.

Changes in v1:
-Delete the unused variable.

 drivers/video/rockchip/rk3399_mipi.c | 183 +++++++++++++++++++++++++++++++++++
 drivers/video/rockchip/rk_mipi.c     | 170 ++------------------------------
 drivers/video/rockchip/rk_mipi.h     |  32 ++++++
 3 files changed, 221 insertions(+), 164 deletions(-)
 create mode 100644 drivers/video/rockchip/rk3399_mipi.c
 create mode 100644 drivers/video/rockchip/rk_mipi.h
drivers/video/rockchip/rk3399_mipi.c new file +183 -0
new file mode 100644
index 0000000..c1690bd
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
+ * Author: Eric Gao <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <clk.h>
+#include <display.h>
+#include <dm.h>
+#include <fdtdec.h>
+#include <panel.h>
+#include <regmap.h>
+#include "rk_mipi.h"
+#include <syscon.h>
+#include <asm/gpio.h>
+#include <asm/hardware.h>
+#include <asm/io.h>
+#include <dm/uclass-internal.h>
+#include <linux/kernel.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/cru_rk3399.h>
+#include <asm/arch/grf_rk3399.h>
+#include <asm/arch/rockchip_mipi_dsi.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Select mipi dsi source, big or little vop */
+static int rk_mipi_dsi_source_select(struct udevice *dev)
+{
+	struct rk_mipi_priv *priv = dev_get_priv(dev);
+	struct rk3399_grf_regs *grf = priv->grf;
+	struct display_plat *disp_uc_plat = dev_get_uclass_platdata(dev);
+
+	/* Select the video source */
+	switch (disp_uc_plat->source_id) {
+	case VOP_B:
+		rk_clrsetreg(&grf->soc_con20, GRF_DSI0_VOP_SEL_MASK,
+			     GRF_DSI0_VOP_SEL_B << GRF_DSI0_VOP_SEL_SHIFT);
+		break;
+	case VOP_L:
+		rk_clrsetreg(&grf->soc_con20, GRF_DSI0_VOP_SEL_MASK,
+			     GRF_DSI0_VOP_SEL_L << GRF_DSI0_VOP_SEL_SHIFT);
+		break;
+	default:
+		debug("%s: Invalid VOP id\n", __func__);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+/* Setup mipi dphy working mode */
+static void rk_mipi_dphy_mode_set(struct udevice *dev)
+{
+	struct rk_mipi_priv *priv = dev_get_priv(dev);
+	struct rk3399_grf_regs *grf = priv->grf;
+	int val;
+
+	/* Set Controller as TX mode */
+	val = GRF_DPHY_TX0_RXMODE_DIS << GRF_DPHY_TX0_RXMODE_SHIFT;
+	rk_clrsetreg(&grf->soc_con22, GRF_DPHY_TX0_RXMODE_MASK, val);
+
+	/* Exit tx stop mode */
+	val |= GRF_DPHY_TX0_TXSTOPMODE_DIS << GRF_DPHY_TX0_TXSTOPMODE_SHIFT;
+	rk_clrsetreg(&grf->soc_con22, GRF_DPHY_TX0_TXSTOPMODE_MASK, val);
+
+	/* Disable turnequest */
+	val |= GRF_DPHY_TX0_TURNREQUEST_DIS << GRF_DPHY_TX0_TURNREQUEST_SHIFT;
+	rk_clrsetreg(&grf->soc_con22, GRF_DPHY_TX0_TURNREQUEST_MASK, val);
+}
+
+/*
+ * This function is called by rk_display_init() using rk_mipi_dsi_enable() and
+ * rk_mipi_phy_enable() to initialize mipi controller and dphy. If success,
+ * enable backlight.
+ */
+static int rk_display_enable(struct udevice *dev, int panel_bpp,
+			  const struct display_timing *timing)
+{
+	int ret;
+	struct rk_mipi_priv *priv = dev_get_priv(dev);
+
+	/* Fill the mipi controller parameter */
+	priv->ref_clk = 24 * MHz;
+	priv->sys_clk = priv->ref_clk;
+	priv->pix_clk = timing->pixelclock.typ;
+	priv->phy_clk = priv->pix_clk * 6;
+	priv->txbyte_clk = priv->phy_clk / 8;
+	priv->txesc_clk = 20 * MHz;
+
+	/* Select vop port, big or little */
+	rk_mipi_dsi_source_select(dev);
+
+	/* Set mipi dphy work mode */
+	rk_mipi_dphy_mode_set(dev);
+
+	/* Config  and enable mipi dsi according to timing */
+	ret = rk_mipi_dsi_enable(dev, timing);
+	if (ret) {
+		debug("%s: rk_mipi_dsi_enable() failed (err=%d)\n",
+		      __func__, ret);
+		return ret;
+	}
+
+	/* Config and enable mipi phy */
+	ret = rk_mipi_phy_enable(dev);
+	if (ret) {
+		debug("%s: rk_mipi_phy_enable() failed (err=%d)\n",
+		      __func__, ret);
+		return ret;
+	}
+
+	/* Enable backlight */
+	ret = panel_enable_backlight(priv->panel);
+	if (ret) {
+		debug("%s: panel_enable_backlight() failed (err=%d)\n",
+		      __func__, ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int rk_mipi_ofdata_to_platdata(struct udevice *dev)
+{
+	struct rk_mipi_priv *priv = dev_get_priv(dev);
+
+	priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
+	if (priv->grf <= 0) {
+		debug("%s: Get syscon grf failed (ret=%p)\n",
+		      __func__, priv->grf);
+		return  -ENXIO;
+	}
+	priv->regs = dev_read_addr(dev);
+	if (priv->regs <= 0) {
+		debug("%s: Get MIPI dsi address failed (ret=%lu)\n", __func__,
+		      priv->regs);
+		return  -ENXIO;
+	}
+
+	return 0;
+}
+
+/*
+ * Probe function: check panel existence and readingit's timing. Then config
+ * mipi dsi controller and enable it according to the timing parameter.
+ */
+static int rk_mipi_probe(struct udevice *dev)
+{
+	int ret;
+	struct rk_mipi_priv *priv = dev_get_priv(dev);
+
+	ret = uclass_get_device_by_phandle(UCLASS_PANEL, dev, "rockchip,panel",
+					   &priv->panel);
+	if (ret) {
+		debug("%s: Can not find panel (err=%d)\n", __func__, ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static const struct dm_display_ops rk_mipi_dsi_ops = {
+	.read_timing = rk_mipi_read_timing,
+	.enable = rk_display_enable,
+};
+
+static const struct udevice_id rk_mipi_dsi_ids[] = {
+	{ .compatible = "rockchip,rk3399_mipi_dsi" },
+	{ }
+};
+
+U_BOOT_DRIVER(rk_mipi_dsi) = {
+	.name	= "rk_mipi_dsi",
+	.id	= UCLASS_DISPLAY,
+	.of_match = rk_mipi_dsi_ids,
+	.ofdata_to_platdata = rk_mipi_ofdata_to_platdata,
+	.probe	= rk_mipi_probe,
+	.ops	= &rk_mipi_dsi_ops,
+	.priv_auto_alloc_size   = sizeof(struct rk_mipi_priv),
+};
drivers/video/rockchip/rk_mipi.c +6 -164

210 lines not on this page · raw message

drivers/video/rockchip/rk_mipi.h new file +32 -0
new file mode 100644
index 0000000..906aaaa
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
+ * Author: Eric Gao <[email protected]>
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __RK_MIPI_H
+#define __RK_MIPI_H
+
+struct rk_mipi_priv {
+	void __iomem *regs;
+	void *grf;
+	struct udevice *panel;
+	struct mipi_dsi *dsi;
+	u32 ref_clk;
+	u32 sys_clk;
+	u32 pix_clk;
+	u32 phy_clk;
+	u32 txbyte_clk;
+	u32 txesc_clk;
+};
+
+int rk_mipi_read_timing(struct udevice *dev,
+			       struct display_timing *timing);
+
+int rk_mipi_dsi_enable(struct udevice *dev,
+			      const struct display_timing *timing);
+
+int rk_mipi_phy_enable(struct udevice *dev);
+
+
+#endif
Signature · 1 line
1.9.1
#5 lore raw

PATCH v3 2/3 rockchip: video: mipi: Split mipi driver into common and specific parts

Quoted 13 lines

To compatible with different rockchip soc, we split the mipi dirver into common and soc specific parts, and all the soc share the common functions from common driver part.

---

Changes in v2:
-Use dev_read_addr to replace devfdt_get_addr.

Changes in v1:
-Delete the unused variable.

Quoted 7 lines
 drivers/video/rockchip/rk3399_mipi.c | 183 +++++++++++++++++++++++++++++++++++
 drivers/video/rockchip/rk_mipi.c     | 170 ++------------------------------
 drivers/video/rockchip/rk_mipi.h     |  32 ++++++
 3 files changed, 221 insertions(+), 164 deletions(-)
 create mode 100644 drivers/video/rockchip/rk3399_mipi.c
 create mode 100644 drivers/video/rockchip/rk_mipi.h
#6 lore raw

PATCH v3 2/3 rockchip: video: mipi: Split mipi driver into common and specific parts

In reply to Eric Gao
Quoted 14 lines · On Wed, 21 Jun 2017 11:20:33 +0800 Eric Gao eric.gao at rock-chips.com wrote:

To compatible with different rockchip soc, we split the mipi dirver into common and soc specific parts, and all the soc share the common functions from common driver part.

---

Changes in v2:
-Use dev_read_addr to replace devfdt_get_addr.

Changes in v1:
-Delete the unused variable.

Quoted 6 lines
 drivers/video/rockchip/rk3399_mipi.c | 183 +++++++++++++++++++++++++++++++++++
 drivers/video/rockchip/rk_mipi.c     | 170 ++------------------------------
 drivers/video/rockchip/rk_mipi.h     |  32 ++++++
 3 files changed, 221 insertions(+), 164 deletions(-)
 create mode 100644 drivers/video/rockchip/rk3399_mipi.c
 create mode 100644 drivers/video/rockchip/rk_mipi.h

Applied to u-boot-video/master, thanks!

--
Anatolij

#7 lore raw

PATCH v3 2/3 rockchip: video: mipi: Split mipi driver into common and specific parts

On Mon, 7 Aug 2017 19:40:49 +0200
Anatolij Gustschin agust at denx.de wrote:
...

Quoted 2 lines

Applied to u-boot-video/master, thanks!

this breaks building, dropped.

--
Anatolij

#8 lore raw

PATCH v4 2/3 rockchip: video: mipi: Split mipi driver into common and specific parts

In reply to Eric Gao

From: "[email protected]" <[email protected]>

To compatible with different rockchip soc, we split the mipi dirver into common and soc specific parts, and all the soc share the common functions from common driver part.

[agust: fix build breakage and warnings]
---
 drivers/video/rockchip/rk3399_mipi.c | 182 +++++++++++++++++++++++++++++++++++
 drivers/video/rockchip/rk_mipi.c     | 170 ++------------------------------
 drivers/video/rockchip/rk_mipi.h     |  32 ++++++
 3 files changed, 220 insertions(+), 164 deletions(-)
 create mode 100644 drivers/video/rockchip/rk3399_mipi.c
 create mode 100644 drivers/video/rockchip/rk_mipi.h

Changes in v4:
- fix build warnings:
drivers/video/rockchip/rk_mipi.c: In function ?rk_mipi_dsi_enable?:
drivers/video/rockchip/rk_mipi.c:85:19: warning: initialization makes integer from pointer without a cast [-Wint-conversion] drivers/video/rockchip/rk_mipi.c: In function ?rk_mipi_phy_enable?:
drivers/video/rockchip/rk_mipi.c:202:19: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
...
drivers/video/rockchip/rk3399_mipi.c: In function ‘rk_mipi_ofdata_to_platdata’:
drivers/video/rockchip/rk3399_mipi.c:136:13: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

- fix build breakage in debug();

drivers/video/rockchip/rk3399_mipi.c new file +182 -0
new file mode 100644
index 0000000..9ef202b
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
+ * Author: Eric Gao <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <clk.h>
+#include <display.h>
+#include <dm.h>
+#include <fdtdec.h>
+#include <panel.h>
+#include <regmap.h>
+#include "rk_mipi.h"
+#include <syscon.h>
+#include <asm/gpio.h>
+#include <asm/hardware.h>
+#include <asm/io.h>
+#include <dm/uclass-internal.h>
+#include <linux/kernel.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/cru_rk3399.h>
+#include <asm/arch/grf_rk3399.h>
+#include <asm/arch/rockchip_mipi_dsi.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Select mipi dsi source, big or little vop */
+static int rk_mipi_dsi_source_select(struct udevice *dev)
+{
+	struct rk_mipi_priv *priv = dev_get_priv(dev);
+	struct rk3399_grf_regs *grf = priv->grf;
+	struct display_plat *disp_uc_plat = dev_get_uclass_platdata(dev);
+
+	/* Select the video source */
+	switch (disp_uc_plat->source_id) {
+	case VOP_B:
+		rk_clrsetreg(&grf->soc_con20, GRF_DSI0_VOP_SEL_MASK,
+			     GRF_DSI0_VOP_SEL_B << GRF_DSI0_VOP_SEL_SHIFT);
+		break;
+	case VOP_L:
+		rk_clrsetreg(&grf->soc_con20, GRF_DSI0_VOP_SEL_MASK,
+			     GRF_DSI0_VOP_SEL_L << GRF_DSI0_VOP_SEL_SHIFT);
+		break;
+	default:
+		debug("%s: Invalid VOP id\n", __func__);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+/* Setup mipi dphy working mode */
+static void rk_mipi_dphy_mode_set(struct udevice *dev)
+{
+	struct rk_mipi_priv *priv = dev_get_priv(dev);
+	struct rk3399_grf_regs *grf = priv->grf;
+	int val;
+
+	/* Set Controller as TX mode */
+	val = GRF_DPHY_TX0_RXMODE_DIS << GRF_DPHY_TX0_RXMODE_SHIFT;
+	rk_clrsetreg(&grf->soc_con22, GRF_DPHY_TX0_RXMODE_MASK, val);
+
+	/* Exit tx stop mode */
+	val |= GRF_DPHY_TX0_TXSTOPMODE_DIS << GRF_DPHY_TX0_TXSTOPMODE_SHIFT;
+	rk_clrsetreg(&grf->soc_con22, GRF_DPHY_TX0_TXSTOPMODE_MASK, val);
+
+	/* Disable turnequest */
+	val |= GRF_DPHY_TX0_TURNREQUEST_DIS << GRF_DPHY_TX0_TURNREQUEST_SHIFT;
+	rk_clrsetreg(&grf->soc_con22, GRF_DPHY_TX0_TURNREQUEST_MASK, val);
+}
+
+/*
+ * This function is called by rk_display_init() using rk_mipi_dsi_enable() and
+ * rk_mipi_phy_enable() to initialize mipi controller and dphy. If success,
+ * enable backlight.
+ */
+static int rk_display_enable(struct udevice *dev, int panel_bpp,
+			  const struct display_timing *timing)
+{
+	int ret;
+	struct rk_mipi_priv *priv = dev_get_priv(dev);
+
+	/* Fill the mipi controller parameter */
+	priv->ref_clk = 24 * MHz;
+	priv->sys_clk = priv->ref_clk;
+	priv->pix_clk = timing->pixelclock.typ;
+	priv->phy_clk = priv->pix_clk * 6;
+	priv->txbyte_clk = priv->phy_clk / 8;
+	priv->txesc_clk = 20 * MHz;
+
+	/* Select vop port, big or little */
+	rk_mipi_dsi_source_select(dev);
+
+	/* Set mipi dphy work mode */
+	rk_mipi_dphy_mode_set(dev);
+
+	/* Config  and enable mipi dsi according to timing */
+	ret = rk_mipi_dsi_enable(dev, timing);
+	if (ret) {
+		debug("%s: rk_mipi_dsi_enable() failed (err=%d)\n",
+		      __func__, ret);
+		return ret;
+	}
+
+	/* Config and enable mipi phy */
+	ret = rk_mipi_phy_enable(dev);
+	if (ret) {
+		debug("%s: rk_mipi_phy_enable() failed (err=%d)\n",
+		      __func__, ret);
+		return ret;
+	}
+
+	/* Enable backlight */
+	ret = panel_enable_backlight(priv->panel);
+	if (ret) {
+		debug("%s: panel_enable_backlight() failed (err=%d)\n",
+		      __func__, ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int rk_mipi_ofdata_to_platdata(struct udevice *dev)
+{
+	struct rk_mipi_priv *priv = dev_get_priv(dev);
+
+	priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
+	if (priv->grf <= 0) {
+		debug("%s: Get syscon grf failed (ret=%p)\n",
+		      __func__, priv->grf);
+		return  -ENXIO;
+	}
+	priv->regs = dev_read_addr(dev);
+	if (priv->regs == FDT_ADDR_T_NONE) {
+		debug("%s: Get MIPI dsi address failed\n", __func__);
+		return  -ENXIO;
+	}
+
+	return 0;
+}
+
+/*
+ * Probe function: check panel existence and readingit's timing. Then config
+ * mipi dsi controller and enable it according to the timing parameter.
+ */
+static int rk_mipi_probe(struct udevice *dev)
+{
+	int ret;
+	struct rk_mipi_priv *priv = dev_get_priv(dev);
+
+	ret = uclass_get_device_by_phandle(UCLASS_PANEL, dev, "rockchip,panel",
+					   &priv->panel);
+	if (ret) {
+		debug("%s: Can not find panel (err=%d)\n", __func__, ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static const struct dm_display_ops rk_mipi_dsi_ops = {
+	.read_timing = rk_mipi_read_timing,
+	.enable = rk_display_enable,
+};
+
+static const struct udevice_id rk_mipi_dsi_ids[] = {
+	{ .compatible = "rockchip,rk3399_mipi_dsi" },
+	{ }
+};
+
+U_BOOT_DRIVER(rk_mipi_dsi) = {
+	.name	= "rk_mipi_dsi",
+	.id	= UCLASS_DISPLAY,
+	.of_match = rk_mipi_dsi_ids,
+	.ofdata_to_platdata = rk_mipi_ofdata_to_platdata,
+	.probe	= rk_mipi_probe,
+	.ops	= &rk_mipi_dsi_ops,
+	.priv_auto_alloc_size   = sizeof(struct rk_mipi_priv),
+};
drivers/video/rockchip/rk_mipi.c +6 -164

210 lines not on this page · raw message

drivers/video/rockchip/rk_mipi.h new file +32 -0
new file mode 100644
index 0000000..d8a7b80
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
+ * Author: Eric Gao <[email protected]>
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __RK_MIPI_H
+#define __RK_MIPI_H
+
+struct rk_mipi_priv {
+	ulong regs;
+	void *grf;
+	struct udevice *panel;
+	struct mipi_dsi *dsi;
+	u32 ref_clk;
+	u32 sys_clk;
+	u32 pix_clk;
+	u32 phy_clk;
+	u32 txbyte_clk;
+	u32 txesc_clk;
+};
+
+int rk_mipi_read_timing(struct udevice *dev,
+			       struct display_timing *timing);
+
+int rk_mipi_dsi_enable(struct udevice *dev,
+			      const struct display_timing *timing);
+
+int rk_mipi_phy_enable(struct udevice *dev);
+
+
+#endif
Signature · 1 line
2.7.4
#9 lore raw

PATCH v4 2/3 rockchip: video: mipi: Split mipi driver into common and specific parts

Quoted 10 lines · On Mon, 7 Aug 2017 20:59:26 +0200 Anatolij Gustschin agust at denx.de wrote:

From: "eric.gao at rock-chips.com" <[email protected]>

To compatible with different rockchip soc, we split the mipi dirver into common and soc specific parts, and all the soc share the common functions from common driver part.

[agust: fix build breakage and warnings]
Quoted 7 lines
---
 drivers/video/rockchip/rk3399_mipi.c | 182 +++++++++++++++++++++++++++++++++++
 drivers/video/rockchip/rk_mipi.c     | 170 ++------------------------------
 drivers/video/rockchip/rk_mipi.h     |  32 ++++++
 3 files changed, 220 insertions(+), 164 deletions(-)
 create mode 100644 drivers/video/rockchip/rk3399_mipi.c
 create mode 100644 drivers/video/rockchip/rk_mipi.h

Applied to u-boot-video/master.

--
Anatolij

author
#10 lore raw

PATCH v3 3/3 rockchop: video: mipi: Makefile: Add soc specfic driver for rk3399 mipi dsi

In reply to Eric Gao

Add Makefile item for soc specific driver for rk3399 mipi dsi.

---

Changes in v2: None
Changes in v1: None

 drivers/video/rockchip/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/rockchip/Makefile +2 -1
index 872dc0f..600743c 100644
@@ -14,5 +14,6 @@ obj-$(CONFIG_DISPLAY_ROCKCHIP_LVDS) += rk_lvds.o
 obj-hdmi-$(CONFIG_ROCKCHIP_RK3288) += rk3288_hdmi.o
 obj-hdmi-$(CONFIG_ROCKCHIP_RK3399) += rk3399_hdmi.o
 obj-$(CONFIG_DISPLAY_ROCKCHIP_HDMI) += rk_hdmi.o $(obj-hdmi-y)
-obj-$(CONFIG_DISPLAY_ROCKCHIP_MIPI) += rk_mipi.o
+obj-mipi-$(CONFIG_ROCKCHIP_RK3399) += rk3399_mipi.o
+obj-$(CONFIG_DISPLAY_ROCKCHIP_MIPI) += rk_mipi.o $(obj-mipi-y)
 endif
Signature · 1 line
1.9.1
#12 lore raw

PATCH v3 3/3 rockchop: video: mipi: Makefile: Add soc specfic driver for rk3399 mipi dsi

In reply to Eric Gao
Quoted 4 lines

Add Makefile item for soc specific driver for rk3399 mipi dsi.

Quoted 8 lines

---

Changes in v2: None
Changes in v1: None

 drivers/video/rockchip/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
#13 lore raw

PATCH v3 3/3 rockchop: video: mipi: Makefile: Add soc specfic driver for rk3399 mipi dsi

In reply to Eric Gao
Quoted 10 lines · On Wed, 21 Jun 2017 11:20:34 +0800 Eric Gao eric.gao at rock-chips.com wrote:

Add Makefile item for soc specific driver for rk3399 mipi dsi.

---

Changes in v2: None
Changes in v1: None

 drivers/video/rockchip/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied to u-boot-video/master, thanks!

--
Anatolij