Skip to contentSkip to conversation

Add support of Lontium lt8912 MIPI to HDMI bridge

PATCH Superseded Adrien Grassein 2 participants 4 messages Feb 27, 2021

Subsystems (5)

v5 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v5 cover Add support of Lontium lt8912 MIPI to HDMI bridge

Hi,
this patch set adds the support of the Lontium lt8912 MIPI to HDMI bridge in the kernel.

It's only support the video part, not the audio part yet since I don't have the datasheet of this component. I get the current i2c configuration from Digi and Boundary drivers.
Developed using the DB_DSIHD board from BoundaryDevices.

Update in v2
- Use standard data-lanes instead of a custom prop;
- Use hdmi-connector node.

Update in v3
- Fix indentation;
- Implement missing bridge functions;
- Add some comments.

Update in v4
- Fix bridge ops;
- Fix i2c error detection.

Update in v5
- Fix lt8912 name (lt8912b instead of lt8912);
- Implement HPD via a workaround. In fact I don't have the datasheet of this component yet so I can't say if the configuration of the
registers is correct or if I have an HW issue on my board. So, I choose to implement a fake version of HPD using a workqueue and polling the status regularly.

Thanks,

Adrien Grassein (2):
dt-bindings: display: bridge: Add documentation for LT8912B drm/bridge: Introduce LT8912B DSI to HDMI bridge

 .../display/bridge/lontium,lt8912b.yaml       | 102 +++
 MAINTAINERS                                   |   6 +
 drivers/gpu/drm/bridge/Kconfig                |  14 +
 drivers/gpu/drm/bridge/Makefile               |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912b.c      | 817 ++++++++++++++++++
 5 files changed, 940 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912b.c
Signature · 6 lines
2.25.1

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

PATCH v5 1/2 dt-bindings: display: bridge: Add documentation for LT8912B

Lontium LT8912B is a DSI to HDMI bridge.

---
 .../display/bridge/lontium,lt8912b.yaml       | 102 ++++++++++++++++++
 MAINTAINERS                                   |   5 +
 2 files changed, 107 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml new file +102 -0
new file mode 100644
index 000000000000..735d0233a7d6
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/lontium,lt8912b.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lontium LT8912B MIPI to HDMI Bridge
+
+maintainers:
+  - Adrien Grassein <[email protected]>
+
+description: |
+  The LT8912B is a bridge device which convert DSI to HDMI
+
+properties:
+  compatible:
+    enum:
+      - lontium,lt8912b
+
+  reg:
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+    description: GPIO connected to active high RESET pin.
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description:
+          Primary MIPI port for MIPI input
+
+        properties:
+          endpoint:
+            $ref: /schemas/media/video-interfaces.yaml#
+            unevaluatedProperties: false
+
+            properties:
+              data-lanes: true
+
+            required:
+              - data-lanes
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: |
+          HDMI port, should be connected to a node compatible with the
+          hdmi-connector binding.
+
+    required:
+      - port@0
+      - port@1
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c4 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      hdmi-bridge@48 {
+        compatible = "lontium,lt8912b";
+        reg = <0x48>;
+        reset-gpios = <&max7323 0 GPIO_ACTIVE_LOW>;
+
+        ports {
+          #address-cells = <1>;
+          #size-cells = <0>;
+
+          port@0 {
+            reg = <0>;
+
+            hdmi_out_in: endpoint {
+              data-lanes = <0 1 2 3>;
+              remote-endpoint = <&mipi_dsi_out>;
+            };
+          };
+
+          port@1 {
+              reg = <1>;
+
+              endpoint {
+                  remote-endpoint = <&hdmi_in>;
+              };
+          };
+        };
+      };
+    };
+
+...
MAINTAINERS +5 -0
index 16ada1a4b751..6366b8eac3f6 100644
@@ -10460,6 +10460,11 @@ S:	Maintained
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
 F:	drivers/hid/hid-lg-g15.c
 
+LONTIUM LT8912B MIPI TO HDMI BRIDGE
+M:	Adrien Grassein <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
+
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M:	Sathya Prakash <[email protected]>
 M:	Sreekanth Reddy <[email protected]>
Signature · 6 lines
2.25.1

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

PATCH v5 2/2 drm/bridge: Introduce LT8912B DSI to HDMI bridge

In reply to Adrien Grassein

Lontium LT8912B is a DSI to HDMI bridge.

---
 MAINTAINERS                              |   1 +
 drivers/gpu/drm/bridge/Kconfig           |  14 +
 drivers/gpu/drm/bridge/Makefile          |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912b.c | 817 +++++++++++++++++++++++
 4 files changed, 833 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912b.c
MAINTAINERS +1 -0
index 6366b8eac3f6..e075a74f57dd 100644
@@ -10464,6 +10464,7 @@ LONTIUM LT8912B MIPI TO HDMI BRIDGE
 M:	Adrien Grassein <[email protected]>
 S:	Maintained
 F:	Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
+F:	drivers/gpu/drm/bridge/lontium-lt8912b.c
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M:	Sathya Prakash <[email protected]>
drivers/gpu/drm/bridge/Kconfig +14 -0
index e4110d6ca7b3..f2c5ec75d2f5 100644
@@ -48,6 +48,20 @@ config DRM_DISPLAY_CONNECTOR
 	  on ARM-based platforms. Saying Y here when this driver is not needed
 	  will not cause any issue.
 
+config DRM_LONTIUM_LT8912B
+	tristate "Lontium LT8912B DSI/HDMI bridge"
+	depends on OF
+	select DRM_PANEL_BRIDGE
+	select DRM_KMS_HELPER
+	select REGMAP_I2C
+	help
+	  Driver for Lontium LT8912B DSI to HDMI bridge
+	  chip driver.
+	  Please say Y if you have such hardware.
+
+	  Say M here if you want to support this hardware as a module.
+	  The module will be named "lontium-lt8912b".
+
 config DRM_LONTIUM_LT9611
 	tristate "Lontium LT9611 DSI/HDMI bridge"
 	select SND_SOC_HDMI_CODEC if SND_SOC
drivers/gpu/drm/bridge/Makefile +1 -0
index 86e7acc76f8d..756ce401aad3 100644
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
+obj-$(CONFIG_DRM_LONTIUM_LT8912B) += lontium-lt8912b.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
drivers/gpu/drm/bridge/lontium-lt8912b.c new file +817 -0

817 lines not on this page · raw message

Signature · 6 lines
2.25.1

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

Re: [PATCH v5 2/2] drm/bridge: Introduce LT8912B DSI to HDMI bridge

I love your patch! Perhaps something to improve:

Hi Adrien,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.11 next-20210226]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Adrien-Grassein/Add-support-of-Lontium-lt8912-MIPI-to-HDMI-bridge/20210228-001438
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3fb6d0e00efc958d01c2f109c8453033a2d96796
config: arm64-randconfig-r025-20210228 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 83bc7815c4235786111aa2abf7193292e4a602f5)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/2d98eba25528e00389795ddc110f56ac6adfde4c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Adrien-Grassein/Add-support-of-Lontium-lt8912-MIPI-to-HDMI-bridge/20210228-001438 git checkout 2d98eba25528e00389795ddc110f56ac6adfde4c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/bridge/lontium-lt8912b.c:461:10: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
                   return ret;
                          ^~~
   drivers/gpu/drm/bridge/lontium-lt8912b.c:452:9: note: initialize the variable 'ret' to silence this warning
           int ret, num = 0;
                  ^
                   = 0

1 warning generated.

vim +/ret +461 drivers/gpu/drm/bridge/lontium-lt8912b.c

448
449 static int lt8912_connector_get_modes(struct drm_connector *connector)
450 {
451 struct edid *edid;
452 int ret, num = 0;
453 struct lt8912 *lt = connector_to_lt8912(connector);
454 u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
455
456 edid = drm_bridge_get_edid(lt->hdmi_port, connector);
457 if (edid) {
458 drm_connector_update_edid_property(connector, edid);
459 num = drm_add_edid_modes(connector, edid);
460 } else

 > 461			return ret;

462
463 ret = drm_display_info_set_bus_formats(&connector->display_info,
464 &bus_format, 1);
465 if (ret)
466 num = ret;
467
468 kfree(edid);
469 return num;
470 }
471

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org