[PATCH 0/2] Novena laptop panel

2020-05-11 Thread srk
From: Richard Marko 

Contains updated patches I've received from Marek with the following
changes:

- yaml docs migration
- fixed Fabios email
- panel commit split into two according to checkpatch request
- added connector for panel

Last review also requested more details for panel like timings and
bus format but these are marked as TBD (timings) in panel datasheet
and the bridge datasheet is not helpful either.

Tested on a Kosagi Novena laptop with imx6 display controller.

Based on v5.7-rc2, applies to drm-misc-next 5e6ed29d72d2

CC: Marek Vasut 
Cc: Sean Cross 
Cc: Shawn Guo 
Cc: Fabio Estevam 
Cc: Thierry Reding 

Sean Cross (2):
  dt-bindings: n133hse-ea1: Add Innolux N133HSE panel
  drm/panel: simple: Add Innolux N133HSE panel support

 .../bindings/display/panel/panel-simple.yaml  |  2 ++
 drivers/gpu/drm/panel/panel-simple.c  | 27 +++
 2 files changed, 29 insertions(+)

base-commit: ae83d0b416db002fe95601e7f97f64b59514d936
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/2] drm/bridge: Add ITE IT6251 bridge driver

2020-05-11 Thread srk
From: Marek Vasut 

Add driver for the ITE IT6251 LVDS-to-eDP bridge.

Signed-off-by: Marek Vasut 
Signed-off-by: Richard Marko 
Cc: Daniel Vetter 
Cc: Sean Cross 
To: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/bridge/Kconfig  |  12 +
 drivers/gpu/drm/bridge/Makefile |   1 +
 drivers/gpu/drm/bridge/ite-it6251.c | 582 
 3 files changed, 595 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6251.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index aaed2347ace9..934896a4ab2d 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -38,6 +38,18 @@ config DRM_DISPLAY_CONNECTOR
  on ARM-based platforms. Saying Y here when this driver is not needed
  will not cause any issue.
 
+config DRM_ITE_IT6251
+   tristate "ITE IT6251 LVDS/eDP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   select DRM_PANEL
+   select REGMAP_I2C
+   help
+ Driver for ITE IT6251 LVDS-eDP bridge chip driver. This is used
+ in Novena open-hardware laptop with eDP based panel.
+ IT6251 supports LVDS input and DisplayPort 1.1a output,
+ resolution up to 1080P and 10-bit color depth.
+
 config DRM_LVDS_CODEC
tristate "Transparent LVDS encoders and decoders support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 6fb062b5b0f0..4c195dc42fce 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
+obj-$(CONFIG_DRM_ITE_IT6251) += ite-it6251.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6251.c 
b/drivers/gpu/drm/bridge/ite-it6251.c
new file mode 100644
index ..b8534fb62c9d
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6251.c
@@ -0,0 +1,582 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2014 Sean Cross 
+ *
+ * Rework for mainline: Marek Vasut 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct it6251_bridge {
+   struct i2c_client   *client;
+   struct i2c_client   *lvds_client;
+   struct regmap   *regmap;
+   struct regmap   *lvds_regmap;
+   struct regulator*regulator;
+
+   struct drm_connectorconnector;
+   struct drm_bridge   bridge;
+   struct drm_panel*panel;
+};
+
+/* Register definitions */
+#define IT6251_VENDOR_ID_LOW   0x00
+#define IT6251_VENDOR_ID_HIGH  0x01
+#define IT6251_DEVICE_ID_LOW   0x02
+#define IT6251_DEVICE_ID_HIGH  0x03
+#define IT6251_SYSTEM_STATUS   0x0d
+#define IT6251_SYSTEM_STATUS_RINTSTATUSBIT(0)
+#define IT6251_SYSTEM_STATUS_RHPDSTATUSBIT(1)
+#define IT6251_SYSTEM_STATUS_RVIDEOSTABLE  BIT(2)
+#define IT6251_SYSTEM_STATUS_RPLL_IOLOCK   BIT(3)
+#define IT6251_SYSTEM_STATUS_RPLL_XPLOCK   BIT(4)
+#define IT6251_SYSTEM_STATUS_RPLL_SPLOCK   BIT(5)
+#define IT6251_SYSTEM_STATUS_RAUXFREQ_LOCK BIT(6)
+#define IT6251_REF_STATE   0x0e
+#define IT6251_REF_STATE_MAIN_LINK_DISABLEDBIT(0)
+#define IT6251_REF_STATE_AUX_CHANNEL_READ  BIT(1)
+#define IT6251_REF_STATE_CR_PATTERNBIT(2)
+#define IT6251_REF_STATE_EQ_PATTERNBIT(3)
+#define IT6251_REF_STATE_NORMAL_OPERATION  BIT(4)
+#define IT6251_REF_STATE_MUTED BIT(5)
+#define IT6251_RPCLK_CNT_LOW   0x13
+#define IT6251_RPCLK_CNT_HIGH  0x14
+#define IT6251_RPC_REQ 0x2b
+#define IT6251_RPC_REQ_RPC_FIFOFULLBIT(6)
+#define IT6251_RPC_REQ_RPC_FIFOEMPTY   BIT(7)
+#define IT6251_PCLK_CNT_LOW0x57
+#define IT6251_PCLK_CNT_HIGH   0x58
+#define IT6251_DPHDEW_LOW  0xa5
+#define IT6251_DPHDEW_HIGH 0xa6
+#define IT6251_DPVDEW_LOW  0xaf
+#define IT6251_DPVDEW_HIGH 0xb0
+#define IT6251_LVDS_PORT_ADDR  0xfd
+#define IT6251_LVDS_PORT_CTRL  0xfe
+#define IT6251_LVDS_PORT_CTRL_EN   BIT(0)
+
+/*
+ * Register programming sequences.
+ * NOTE: There is a lot of registers here which are completely undocumented
+ *   and/or their meaning is not clear from the little documentation
+ *   that is available for this chip. These values below just seem to
+ *   work well enough.
+ */
+static const struct re

[PATCH 0/2] Novena laptop: LVDS-to-eDP bridge

2020-05-11 Thread srk
From: Richard Marko 

Contains updated patches I've received from Marek with the following
changes:

- yaml docs migration
- extended documentation

Tested on a Kosagi Novena laptop with imx6 display controller.

Based on v5.7-rc2, applies to drm-misc-next 5e6ed29d72d2

CC: Marek Vasut 
Cc: Sean Cross 

Marek Vasut (2):
  dt-bindings: it6251: add bindings for IT6251 LVDS-to-eDP bridge
  drm/bridge: Add ITE IT6251 bridge driver

 .../bindings/display/bridge/ite,it6251.yaml   |  97 +++
 drivers/gpu/drm/bridge/Kconfig|  12 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/ite-it6251.c   | 582 ++
 4 files changed, 692 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6251.yaml
 create mode 100644 drivers/gpu/drm/bridge/ite-it6251.c


base-commit: ae83d0b416db002fe95601e7f97f64b59514d936
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] dt-bindings: n133hse-ea1: Add Innolux N133HSE panel

2020-05-11 Thread srk
From: Sean Cross 

The Innolux N133HSE panel is a 13.3" 1920x1080 panel that contains an
integrated backlight, and connects via eDP.

It is used in the Kosagi Novena.

Signed-off-by: Sean Cross 
Signed-off-by: Richard Marko 
Cc: Shawn Guo 
Cc: Fabio Estevam 
Cc: Thierry Reding 
To: dri-devel@lists.freedesktop.org
---
 .../devicetree/bindings/display/panel/panel-simple.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
index 393ffc6acbba..756bf6a48e8d 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
@@ -139,6 +139,8 @@ properties:
   - innolux,g121i1-l01
 # Innolux Corporation 12.1" G121X1-L03 XGA (1024x768) TFT LCD panel
   - innolux,g121x1-l03
+# Innolux Corporation 13.3" FHD (1920x1080) TFT LCD panel
+  - innolux,n133hse-ea1
 # Innolux Corporation 11.6" WXGA (1366x768) TFT LCD panel
   - innolux,n116bge
 # InnoLux 15.6" WXGA TFT LCD panel
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/2] drm/panel: simple: Add Innolux N133HSE panel support

2020-05-11 Thread srk
From: Sean Cross 

The Innolux N133HSE panel is a 13.3" 1920x1080 panel that contains an
integrated backlight, and connects via eDP.

It is used in the Kosagi Novena.

Signed-off-by: Sean Cross 
Signed-off-by: Richard Marko 
Cc: Shawn Guo 
Cc: Fabio Estevam 
Cc: Thierry Reding 
To: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/panel/panel-simple.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 3ad828eaefe1..c8a93771d398 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1906,6 +1906,30 @@ static const struct panel_desc innolux_n116bge = {
},
 };
 
+static const struct drm_display_mode innolux_n133hse_ea1_mode = {
+   .clock = 138500,
+   .hdisplay = 1920,
+   .hsync_start = 1920 + 46,
+   .hsync_end = 1920 + 46 + 30,
+   .htotal = 1920 + 46 + 30 + 84,
+   .vdisplay = 1080,
+   .vsync_start = 1080 + 2,
+   .vsync_end = 1080 + 2 + 4,
+   .vtotal = 1080 + 2 + 4 + 26,
+   .vrefresh = 60,
+};
+
+static const struct panel_desc innolux_n133hse_ea1 = {
+   .modes = &innolux_n133hse_ea1_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 293,
+   .height = 165,
+   },
+   .connector_type = DRM_MODE_CONNECTOR_eDP,
+};
+
 static const struct drm_display_mode innolux_n156bge_l21_mode = {
.clock = 69300,
.hdisplay = 1366,
@@ -3577,6 +3601,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "innolux,n116bge",
.data = &innolux_n116bge,
+   }, {
+   .compatible = "innolux,n133hse-ea1",
+   .data = &innolux_n133hse_ea1,
}, {
.compatible = "innolux,n156bge-l21",
.data = &innolux_n156bge_l21,
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] dt-bindings: it6251: add bindings for IT6251 LVDS-to-eDP bridge

2020-05-11 Thread srk
From: Marek Vasut 

Add DT bindings for ITE IT6251 LVDS-to-eDP bridge.

Signed-off-by: Marek Vasut 
Signed-off-by: Richard Marko 
Cc: Daniel Vetter 
Cc: Rob Herring 
Cc: Sean Cross 
Cc: devicet...@vger.kernel.org
To: dri-devel@lists.freedesktop.org
---
 .../bindings/display/bridge/ite,it6251.yaml   | 97 +++
 1 file changed, 97 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6251.yaml

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6251.yaml 
b/Documentation/devicetree/bindings/display/bridge/ite,it6251.yaml
new file mode 100644
index ..8daa44a30fa1
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6251.yaml
@@ -0,0 +1,97 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/ite,it6251.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ITE IT6251 LVDS-to-eDP bridge bindings
+
+maintainers:
+  - Marek Vasut 
+  - Richard Marko 
+
+description: |
+  The IT6251 is a high-performance single-chip
+  De-SSC LVDS to DisplayPort converter.
+  Combined with LVDS receiver and DisplayPort Transmitter,
+  the IT6251 supports LVDS input and DisplayPort 1.1a
+  output by conversion function.
+
+properties:
+  compatible:
+const: ite,it6251
+
+  reg:
+items:
+  - description: I2C address of the bridge
+  - description: I2C address of the LVDS part
+
+  reg-names:
+items:
+  - const: bridge
+  - const: lvds
+
+  ports:
+type: object
+
+properties:
+  "#address-cells":
+const: 1
+
+  "#size-cells":
+const: 0
+
+  port@0:
+type: object
+description: |
+ Video port for eDP output (typically panel).
+
+  port@1:
+type: object
+description: |
+  Video port for LVDS input.
+
+required:
+  - port@0
+  - port@1
+
+additionalProperties: false
+
+  power-supply: true
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - power-supply
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+it6251@5c {
+  compatible = "ite,it6251";
+  reg = <0x5c>, <0x5e>;
+  reg-names = "bridge", "lvds";
+  power-supply = <®_display>;
+
+  ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+  reg = <0>;
+  bridge_out_edp0: endpoint {
+remote-endpoint = <&panel_in_edp0>;
+  };
+};
+
+port@1 {
+  reg = <1>;
+  bridge_in_lvds0: endpoint {
+remote-endpoint = <&lvds0_out>;
+  };
+};
+  };
+};
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/1] ARM: dts: novena: Add LVDS-to-eDP bridge bindings

2020-05-11 Thread srk
From: Marek Vasut 

Add bindings for the LVDS-to-eDP bridge chip, IT6251, which is
used to connect the standard 1920x1080 panel on Novena laptop.

Tested on a Kosagi Novena laptop with imx6 display controller.

Based on v5.7-rc2, applies to drm-misc-next 5e6ed29d72d2

Signed-off-by: Marek Vasut 
Signed-off-by: Richard Marko 
Cc: Fabio Estevam 
Cc: Shawn Guo 
---
 arch/arm/boot/dts/imx6q-novena.dts | 57 +-
 1 file changed, 56 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx6q-novena.dts 
b/arch/arm/boot/dts/imx6q-novena.dts
index 69f170ff31c5..803a97e04dc4 100644
--- a/arch/arm/boot/dts/imx6q-novena.dts
+++ b/arch/arm/boot/dts/imx6q-novena.dts
@@ -109,6 +109,12 @@ heartbeat {
panel: panel {
compatible = "innolux,n133hse-ea1";
backlight = <&backlight>;
+
+   port {
+   panel_in_edp0: endpoint {
+   remote-endpoint = <&bridge_out_edp0>;
+   };
+   };
};
 
reg_2p5v: regulator-2p5v {
@@ -146,6 +152,7 @@ reg_display: regulator-display {
startup-delay-us = <20>;
gpio = <&gpio5 28 GPIO_ACTIVE_HIGH>;
enable-active-high;
+   regulator-always-on;
};
 
reg_lvds_lcd: regulator-lvds-lcd {
@@ -155,6 +162,7 @@ reg_lvds_lcd: regulator-lvds-lcd {
regulator-max-microvolt = <330>;
gpio = <&gpio4 15 GPIO_ACTIVE_HIGH>;
enable-active-high;
+   regulator-always-on;
};
 
reg_pcie: regulator-pcie {
@@ -212,6 +220,17 @@ &audmux {
status = "okay";
 };
 
+&clks {
+   assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
+ <&clks IMX6QDL_CLK_LDB_DI1_SEL>,
+ <&clks IMX6QDL_CLK_IPU1_DI0_PRE_SEL>,
+ <&clks IMX6QDL_CLK_IPU2_DI0_PRE_SEL>;
+   assigned-clock-parents = <&clks IMX6QDL_CLK_PLL5_VIDEO_DIV>,
+<&clks IMX6QDL_CLK_PLL5_VIDEO_DIV>,
+<&clks IMX6QDL_CLK_PLL2_PFD2_396M>,
+<&clks IMX6QDL_CLK_PLL2_PFD2_396M>;
+};
+
 &ecspi3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi3_novena>;
@@ -423,6 +442,29 @@ codec: es8328@11 {
 <&clks IMX6QDL_CLK_CKO1_PODF>;
assigned-clock-rates = <0 0 722534400 22579200>;
};
+
+   it6251@5c {
+   compatible = "ite,it6251";
+   reg = <0x5c>, <0x5e>;
+   reg-names = "bridge", "lvds";
+   power-supply = <®_display>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_lvdsbridge_novena>;
+
+   ports {
+   port@0 {
+   bridge_out_edp0: endpoint {
+   remote-endpoint = <&panel_in_edp0>;
+   };
+   };
+
+   port@1 {
+   bridge_in_lvds0: endpoint {
+   remote-endpoint = <&lvds0_out>;
+   };
+   };
+   };
+   };
 };
 
 &kpp {
@@ -443,6 +485,14 @@ lvds-channel@0 {
fsl,data-width = <24>;
fsl,panel = <&panel>;
status = "okay";
+
+   port@4 {
+   reg = <4>;
+
+   lvds0_out: endpoint {
+   remote-endpoint = <&bridge_in_lvds0>;
+   };
+   };
};
 };
 
@@ -529,10 +579,15 @@ MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS   0x130b0
>;
};
 
+   pinctrl_lvdsbridge_novena: lvdsbridgegrp-novena {
+   fsl,pins = <
+   MX6QDL_PAD_CSI0_DAT10__GPIO5_IO28   0x1b0b1
+   >;
+   };
+
pinctrl_backlight_novena: backlightgrp-novena {
fsl,pins = <
MX6QDL_PAD_DISP0_DAT8__PWM1_OUT 0x1b0b0
-   MX6QDL_PAD_CSI0_DAT10__GPIO5_IO28   0x1b0b1
MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x1b0b1
>;
};
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel