Skip to contentSkip to conversation

Add initial support for slimport anx7625

PATCH Superseded Xin Ji 2 participants 5 messages Sep 17, 2020 – Sep 18, 2020

Subsystems (4)

v16 of 17 Superseded Latest is v17 →

lore
Share & tools
lore

Xin Ji

author
#0 lore raw

v16 cover Add initial support for slimport anx7625

Hi all,

The following series add support for the Slimport ANX7625 transmitter, a ultra-low power Full-HD 4K MIPI to DP transmitter designed for portable device.

This is the v16 version, any mistakes, please let me know, I will fix it in the next series.

Change history:
v16: Fix compile error
- Fix compiling error of incompitible interface of ".mode_valid()"

v15: Fix comments from Sam and Hsin-Yi Wang
- Remove connector
- Allocate memory for edid at ".get_edid()"

v14: Fix comments from Sam and Nicolas
- Check flags at drm_bridge_attach
- Use panel_bridge instead of drm_panel
- Fix not correct return value

v13: Fix comments from Launrent Pinchart and Rob Herring
- Picked up Rob's Reviewed-By
- Add .detect and .get_edid interface in bridge funcs.

v12: Fix comments from Hsin-Yi Wang
- Rebase the code on kernel 5.7, fix DRM interface not match issue.

v11: Fix comments from Rob Herring
- Update commit message.
- Remove unused label.

v10: Fix comments from Rob Herring, Daniel.
- Fix dt_binding_check warning.
- Update description.

v9: Fix comments from Sam, Nicolas, Daniel
- Remove extcon interface.
- Remove DPI support.
- Fix dt_binding_check complains.
- Code clean up and update description.

v8: Fix comments from Nicolas.
- Fix several coding format.
- Update description.

v7:
- Fix critical timing(eg:odd hfp/hbp) in "mode_fixup" interface, enhance MIPI RX tolerance by setting register MIPI_DIGITAL_ADJ_1 to 0x3D.

Xin Ji (2):
dt-bindings: drm/bridge: anx7625: MIPI to DP transmitter DT schema drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP

 .../bindings/display/bridge/analogix,anx7625.yaml  |   95 +
 drivers/gpu/drm/bridge/analogix/Kconfig            |    9 +
 drivers/gpu/drm/bridge/analogix/Makefile           |    1 +
 drivers/gpu/drm/bridge/analogix/anx7625.c          | 1849 ++++++++++++++++++++
 drivers/gpu/drm/bridge/analogix/anx7625.h          |  390 +++++
 5 files changed, 2344 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
 create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.c
 create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.h
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v16 1/2 dt-bindings: drm/bridge: anx7625: MIPI to DP transmitter DT schema

anx7625: MIPI to DP transmitter DT schema

---
 .../bindings/display/bridge/analogix,anx7625.yaml  | 95 ++++++++++++++++++++++
 1 file changed, 95 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml new file +95 -0
new file mode 100644
index 0000000..60585a4
@@ -0,0 +1,95 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2019 Analogix Semiconductor, Inc.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/display/bridge/analogix,anx7625.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Analogix ANX7625 SlimPort (4K Mobile HD Transmitter)
+
+maintainers:
+  - Xin Ji <[email protected]>
+
+description: |
+  The ANX7625 is an ultra-low power 4K Mobile HD Transmitter
+  designed for portable devices.
+
+properties:
+  compatible:
+    items:
+      - const: analogix,anx7625
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    description: used for interrupt pin B8.
+    maxItems: 1
+
+  enable-gpios:
+    description: used for power on chip control, POWER_EN pin D2.
+    maxItems: 1
+
+  reset-gpios:
+    description: used for reset chip control, RESET_N pin B7.
+    maxItems: 1
+
+  ports:
+    type: object
+
+    properties:
+      port@0:
+        type: object
+        description:
+          Video port for MIPI DSI input.
+
+      port@1:
+        type: object
+        description:
+          Video port for panel or connector.
+
+    required:
+        - port@0
+        - port@1
+
+required:
+  - compatible
+  - reg
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c0 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        encoder@58 {
+            compatible = "analogix,anx7625";
+            reg = <0x58>;
+            enable-gpios = <&pio 45 GPIO_ACTIVE_HIGH>;
+            reset-gpios = <&pio 73 GPIO_ACTIVE_HIGH>;
+
+            ports {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                mipi2dp_bridge_in: port@0 {
+                    reg = <0>;
+                    anx7625_in: endpoint {
+                        remote-endpoint = <&mipi_dsi>;
+                    };
+                };
+
+                mipi2dp_bridge_out: port@1 {
+                    reg = <1>;
+                    anx7625_out: endpoint {
+                        remote-endpoint = <&panel_in>;
+                    };
+                };
+            };
+        };
+    };
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v16 2/2 drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP

In reply to Xin Ji

The ANX7625 is an ultra-low power 4K Mobile HD Transmitter designed for portable device. It converts MIPI DSI/DPI to DisplayPort 1.3 4K.

---
 drivers/gpu/drm/bridge/analogix/Kconfig   |    9 +
 drivers/gpu/drm/bridge/analogix/Makefile  |    1 +
 drivers/gpu/drm/bridge/analogix/anx7625.c | 1849 +++++++++++++++++++++++++++++
 drivers/gpu/drm/bridge/analogix/anx7625.h |  390 ++++++
 4 files changed, 2249 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.c
 create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.h
drivers/gpu/drm/bridge/analogix/Kconfig +9 -0
index e1fa7d8..024ea2a 100644
@@ -25,3 +25,12 @@ config DRM_ANALOGIX_ANX78XX
 config DRM_ANALOGIX_DP
 	tristate
 	depends on DRM
+
+config DRM_ANALOGIX_ANX7625
+	tristate "Analogix Anx7625 MIPI to DP interface support"
+	depends on DRM
+	depends on OF
+	help
+	  ANX7625 is an ultra-low power 4K mobile HD transmitter
+	  designed for portable devices. It converts MIPI/DPI to
+	  DisplayPort1.3 4K.
drivers/gpu/drm/bridge/analogix/Makefile +1 -0
index 97669b3..44da392 100644
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
 obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
+obj-$(CONFIG_DRM_ANALOGIX_ANX7625) += anx7625.o
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
drivers/gpu/drm/bridge/analogix/anx7625.c new file +1849 -0

1,849 lines not on this page · raw message

drivers/gpu/drm/bridge/analogix/anx7625.h new file +390 -0

390 lines not on this page · raw message

Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH v16 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP

Hi Xin,

url:    https://github.com/0day-ci/linux/commits/Xin-Ji/Add-initial-support-for-slimport-anx7625/20200917-163238
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5925fa68fe8244651b3f78a88c4af99190a88f0d
config: mips-randconfig-m031-20200917 (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0

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

smatch warnings:
drivers/gpu/drm/bridge/analogix/anx7625.c:1289 anx7625_get_edid() warn: possible memory leak of 'edid'

# https://github.com/0day-ci/linux/commit/667ee517c70d2bedafe5bfa0dc5f13fc60d5133d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xin-Ji/Add-initial-support-for-slimport-anx7625/20200917-163238 git checkout 667ee517c70d2bedafe5bfa0dc5f13fc60d5133d
vim +/edid +1289 drivers/gpu/drm/bridge/analogix/anx7625.c

667ee517c70d2be Xin Ji 2020-09-17  1264  static struct edid *anx7625_get_edid(struct anx7625_data *ctx)
667ee517c70d2be Xin Ji 2020-09-17  1265  {
667ee517c70d2be Xin Ji 2020-09-17  1266  	struct device *dev = &ctx->client->dev;
667ee517c70d2be Xin Ji 2020-09-17  1267  	struct s_edid_data *p_edid = &ctx->slimport_edid_p;
667ee517c70d2be Xin Ji 2020-09-17  1268  	int edid_num;
667ee517c70d2be Xin Ji 2020-09-17  1269  	u8 *edid;
667ee517c70d2be Xin Ji 2020-09-17  1270  
667ee517c70d2be Xin Ji 2020-09-17  1271  	edid = kmalloc(FOUR_BLOCK_SIZE, GFP_KERNEL);
667ee517c70d2be Xin Ji 2020-09-17  1272  	if (!edid) {
667ee517c70d2be Xin Ji 2020-09-17  1273  		DRM_DEV_ERROR(dev, "Fail to allocate buffer\n");
667ee517c70d2be Xin Ji 2020-09-17  1274  		return NULL;
667ee517c70d2be Xin Ji 2020-09-17  1275  	}
667ee517c70d2be Xin Ji 2020-09-17  1276  
667ee517c70d2be Xin Ji 2020-09-17  1277  	if (ctx->slimport_edid_p.edid_block_num > 0) {
667ee517c70d2be Xin Ji 2020-09-17  1278  		memcpy(edid, ctx->slimport_edid_p.edid_raw_data,
667ee517c70d2be Xin Ji 2020-09-17  1279  		       FOUR_BLOCK_SIZE);
667ee517c70d2be Xin Ji 2020-09-17  1280  		return (struct edid *)edid;
667ee517c70d2be Xin Ji 2020-09-17  1281  	}
667ee517c70d2be Xin Ji 2020-09-17  1282  
667ee517c70d2be Xin Ji 2020-09-17  1283  	anx7625_low_power_mode_check(ctx, 1);
667ee517c70d2be Xin Ji 2020-09-17  1284  	edid_num = sp_tx_edid_read(ctx, p_edid->edid_raw_data);
667ee517c70d2be Xin Ji 2020-09-17  1285  	anx7625_low_power_mode_check(ctx, 0);
667ee517c70d2be Xin Ji 2020-09-17  1286  
667ee517c70d2be Xin Ji 2020-09-17  1287  	if (edid_num < 1) {
667ee517c70d2be Xin Ji 2020-09-17  1288  		DRM_DEV_ERROR(dev, "Fail to read EDID: %d\n", edid_num);

667ee517c70d2be Xin Ji 2020-09-17 @1289 return NULL;

kfree(edid); before returning.

667ee517c70d2be Xin Ji 2020-09-17  1290  	}
667ee517c70d2be Xin Ji 2020-09-17  1291  
667ee517c70d2be Xin Ji 2020-09-17  1292  	p_edid->edid_block_num = edid_num;
667ee517c70d2be Xin Ji 2020-09-17  1293  
667ee517c70d2be Xin Ji 2020-09-17  1294  	memcpy(edid, ctx->slimport_edid_p.edid_raw_data, FOUR_BLOCK_SIZE);
667ee517c70d2be Xin Ji 2020-09-17  1295  	return (struct edid *)edid;
667ee517c70d2be Xin Ji 2020-09-17  1296  }

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

author
#4 lore raw

Re: [PATCH v16 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP

Quoted 10 lines · Dan Carpenter

Hi Xin,

url:    https://github.com/0day-ci/linux/commits/Xin-Ji/Add-initial-support-for-slimport-anx7625/20200917-163238
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5925fa68fe8244651b3f78a88c4af99190a88f0d
config: mips-randconfig-m031-20200917 (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0

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

Hi Dan, OK, I'll fix it right now.
Thanks,
Xin

Quoted 50 lines

smatch warnings:
drivers/gpu/drm/bridge/analogix/anx7625.c:1289 anx7625_get_edid() warn: possible memory leak of 'edid'

# https://github.com/0day-ci/linux/commit/667ee517c70d2bedafe5bfa0dc5f13fc60d5133d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xin-Ji/Add-initial-support-for-slimport-anx7625/20200917-163238 git checkout 667ee517c70d2bedafe5bfa0dc5f13fc60d5133d
vim +/edid +1289 drivers/gpu/drm/bridge/analogix/anx7625.c

667ee517c70d2be Xin Ji 2020-09-17  1264  static struct edid *anx7625_get_edid(struct anx7625_data *ctx)
667ee517c70d2be Xin Ji 2020-09-17  1265  {
667ee517c70d2be Xin Ji 2020-09-17  1266  	struct device *dev = &ctx->client->dev;
667ee517c70d2be Xin Ji 2020-09-17  1267  	struct s_edid_data *p_edid = &ctx->slimport_edid_p;
667ee517c70d2be Xin Ji 2020-09-17  1268  	int edid_num;
667ee517c70d2be Xin Ji 2020-09-17  1269  	u8 *edid;
667ee517c70d2be Xin Ji 2020-09-17  1270  
667ee517c70d2be Xin Ji 2020-09-17  1271  	edid = kmalloc(FOUR_BLOCK_SIZE, GFP_KERNEL);
667ee517c70d2be Xin Ji 2020-09-17  1272  	if (!edid) {
667ee517c70d2be Xin Ji 2020-09-17  1273  		DRM_DEV_ERROR(dev, "Fail to allocate buffer\n");
667ee517c70d2be Xin Ji 2020-09-17  1274  		return NULL;
667ee517c70d2be Xin Ji 2020-09-17  1275  	}
667ee517c70d2be Xin Ji 2020-09-17  1276  
667ee517c70d2be Xin Ji 2020-09-17  1277  	if (ctx->slimport_edid_p.edid_block_num > 0) {
667ee517c70d2be Xin Ji 2020-09-17  1278  		memcpy(edid, ctx->slimport_edid_p.edid_raw_data,
667ee517c70d2be Xin Ji 2020-09-17  1279  		       FOUR_BLOCK_SIZE);
667ee517c70d2be Xin Ji 2020-09-17  1280  		return (struct edid *)edid;
667ee517c70d2be Xin Ji 2020-09-17  1281  	}
667ee517c70d2be Xin Ji 2020-09-17  1282  
667ee517c70d2be Xin Ji 2020-09-17  1283  	anx7625_low_power_mode_check(ctx, 1);
667ee517c70d2be Xin Ji 2020-09-17  1284  	edid_num = sp_tx_edid_read(ctx, p_edid->edid_raw_data);
667ee517c70d2be Xin Ji 2020-09-17  1285  	anx7625_low_power_mode_check(ctx, 0);
667ee517c70d2be Xin Ji 2020-09-17  1286  
667ee517c70d2be Xin Ji 2020-09-17  1287  	if (edid_num < 1) {
667ee517c70d2be Xin Ji 2020-09-17  1288  		DRM_DEV_ERROR(dev, "Fail to read EDID: %d\n", edid_num);

667ee517c70d2be Xin Ji 2020-09-17 @1289 return NULL;

kfree(edid); before returning.

667ee517c70d2be Xin Ji 2020-09-17  1290  	}
667ee517c70d2be Xin Ji 2020-09-17  1291  
667ee517c70d2be Xin Ji 2020-09-17  1292  	p_edid->edid_block_num = edid_num;
667ee517c70d2be Xin Ji 2020-09-17  1293  
667ee517c70d2be Xin Ji 2020-09-17  1294  	memcpy(edid, ctx->slimport_edid_p.edid_raw_data, FOUR_BLOCK_SIZE);
667ee517c70d2be Xin Ji 2020-09-17  1295  	return (struct edid *)edid;
667ee517c70d2be Xin Ji 2020-09-17  1296  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]