Add initial support for slimport anx7625
Subsystems (4)
v2 cover Add initial support for slimport anx7625
Hi all,
The following series add initial support for the Slimport ANX7625 transmitter, a ultra-low power Full-HD 4K MIPI to DP transmitter designed for portable device.
This is the initial version, any mistakes, please let me know, I will fix it in the next series.
Thanks,
Xin
Xin Ji (2):
dt-bindings: drm/bridge: anx7625: MIPI to DP transmitter binding drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver
.../bindings/display/bridge/anx7625.yaml | 96 + drivers/gpu/drm/bridge/Makefile | 2 +- drivers/gpu/drm/bridge/analogix/Kconfig | 6 + drivers/gpu/drm/bridge/analogix/Makefile | 1 + drivers/gpu/drm/bridge/analogix/anx7625.c | 2155 ++++++++++++++++++++ drivers/gpu/drm/bridge/analogix/anx7625.h | 406 ++++ 6 files changed, 2665 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/display/bridge/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
PATCH v2 1/2 dt-bindings: drm/bridge: anx7625: MIPI to DP transmitter binding
The ANX7625 is an ultra-low power 4K Mobile HD Transmitter designed for portable device. It converts MIPI to DisplayPort 1.3 4K.
You can add support to your board with binding.
Example:
anx7625_bridge: encoder@58 {
compatible = "analogix,anx7625";
reg = <0x58>;
status = "okay";
panel-flags = <1>;
enable-gpios = <&pio 45 GPIO_ACTIVE_HIGH>;
reset-gpios = <&pio 73 GPIO_ACTIVE_HIGH>;
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
anx_1_in: endpoint {
remote-endpoint = <&mipi_dsi>;
};
};
port@3 {
reg = <3>;
anx_1_out: endpoint {
remote-endpoint = <&panel_in>;
};
};
};--- .../bindings/display/bridge/anx7625.yaml | 96 ++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/anx7625.yaml
Documentation/devicetree/bindings/display/bridge/anx7625.yaml new file +96 -0
@@ -0,0 +1,96 @@ +# 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/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: + "#address-cells": true + "#size-cells": true + + compatible: + items: + - const: analogix,anx7625 + + reg: + maxItems: 1 + + panel-flags: + description: indicate the panel is internal or external + maxItems: 1 + + interrupts: + 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 + + port@0: + type: object + description: + A port node pointing to MIPI DSI host port node. + + port@1: + type: object + description: + A port node pointing to MIPI DPI host port node. + + port@2: + type: object + description: + A port node pointing to external connector port node. + + port@3: + type: object + description: + A port node pointing to eDP port node. + +required: + - "#address-cells" + - "#size-cells" + - compatible + - reg + - port@0 + - port@3 + +example: + - | + anx7625_bridge: encoder@58 { + compatible = "analogix,anx7625"; + reg = <0x58>; + status = "okay"; + panel-flags = <1>; + enable-gpios = <&pio 45 GPIO_ACTIVE_HIGH>; + reset-gpios = <&pio 73 GPIO_ACTIVE_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + anx_1_in: endpoint { + remote-endpoint = <&mipi_dsi>; + }; + }; + + port@3 { + reg = <3>; + anx_1_out: endpoint { + remote-endpoint = <&panel_in>; + }; + }; + };
Signature · 1 line
2.7.4
PATCH v2 2/2 drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver
In reply to Xin JiThe ANX7625 is an ultra-low power 4K Mobile HD Transmitter designed for portable device. It converts MIPI DSI/DPI to DisplayPort 1.3 4K.
The ANX7625 can support both USB Type-C PD feature and MIPI DSI/DPI to DP feature. This driver only enabled MIPI DSI/DPI to DP feature.
--- drivers/gpu/drm/bridge/Makefile | 2 +- drivers/gpu/drm/bridge/analogix/Kconfig | 6 + drivers/gpu/drm/bridge/analogix/Makefile | 1 + drivers/gpu/drm/bridge/analogix/anx7625.c | 2155 +++++++++++++++++++++++++++++ drivers/gpu/drm/bridge/analogix/anx7625.h | 406 ++++++ 5 files changed, 2569 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.c create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.h
drivers/gpu/drm/bridge/Makefile +1 -1
@@ -12,8 +12,8 @@ obj-$(CONFIG_DRM_SII9234) += sii9234.o obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o -obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/ obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/ obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o +obj-y += analogix/ obj-y += synopsys/
drivers/gpu/drm/bridge/analogix/Kconfig +6 -0
@@ -2,3 +2,9 @@ config DRM_ANALOGIX_DP tristate depends on DRM + +config ANALOGIX_ANX7625 + tristate "Analogix MIPI to DP interface support" + 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
@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_ANALOGIX_ANX7625) += anx7625.o analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
drivers/gpu/drm/bridge/analogix/anx7625.c new file +2155 -0
2,155 lines not on this page · raw message
drivers/gpu/drm/bridge/analogix/anx7625.h new file +406 -0
406 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v2 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver
This code is *so* much nicer than before. I hope you feel good about the changes. It makes me happy to look at this code now.
Quoted 5 lines · Xin Ji
drivers/gpu/drm/bridge/analogix/anx7625.c new file +5
-0+static int edid_read (struct anx7625_data *ctx, +u8 offset,u8 *pblock_buf) +{ +int ret, cnt; +struct device *dev = &ctx->client->dev;
drivers/gpu/drm/bridge/analogix/anx7625.c line 883
Quoted 10 lines
drivers/gpu/drm/bridge/analogix/anx7625.c new file +10
-0+ +for (cnt =0 ; cnt <EDID_TRY_CNT ; cnt++) { +sp_tx_aux_wr (ctx, offset); +/* set I2C read com 0x01 mot = 0 and read 16 bytes */ + ret =sp_tx_aux_rd (ctx,0xf1 ); + +if (ret) { +sp_tx_rst_aux (ctx); +DRM_DEV_DEBUG_DRIVER (dev,"edid read failed, reset!\n" ); + cnt++;
I don't think you should increment cnt. It's just a counter.
drivers/gpu/drm/bridge/analogix/anx7625.c line 894
Quoted 11 lines
drivers/gpu/drm/bridge/analogix/anx7625.c new file +11
-0+ }else { + ret =anx7625_reg_block_read (ctx, ctx->i2c.rx_p0_client, +AP_AUX_BUFF_START , +MAX_DPCD_BUFFER_SIZE , + pblock_buf); +if (!ret) +break ; + } + } + +if (cnt ==EDID_TRY_CNT )
And it could mean that "cnt > EDID_TRY_CNT".
Quoted 31 lines
drivers/gpu/drm/bridge/analogix/anx7625.c new file +31
-0+return -EIO ; + +return 0 ; +} + +static int segments_edid_read (struct anx7625_data *ctx, +u8 segment,u8 *buf,u8 offset) +{ +u8 cnt; +int ret; +struct device *dev = &ctx->client->dev; + +/* write address only */ + ret =anx7625_reg_write (ctx, ctx->i2c.rx_p0_client, +AP_AUX_ADDR_7_0 ,0x30 ); + ret |=anx7625_reg_write (ctx, ctx->i2c.rx_p0_client, +AP_AUX_COMMAND ,0x04 ); + ret |=anx7625_reg_write (ctx, ctx->i2c.rx_p0_client, +AP_AUX_CTRL_STATUS , +AP_AUX_CTRL_ADDRONLY |AP_AUX_CTRL_OP_EN ); + + ret |=wait_aux_op_finish (ctx); +/* write segment address */ + ret |=sp_tx_aux_wr (ctx, segment); +/* data read */ + ret |=anx7625_reg_write (ctx, ctx->i2c.rx_p0_client, +AP_AUX_ADDR_7_0 ,0x50 ); +if (ret) { +DRM_ERROR ("IO error : aux initial failed.\n" ); +return ret; + }
drivers/gpu/drm/bridge/analogix/anx7625.c line 935
Quoted 10 lines
drivers/gpu/drm/bridge/analogix/anx7625.c new file +10
-0+ +for (cnt =0 ; cnt <EDID_TRY_CNT ; cnt++) { +sp_tx_aux_wr (ctx, offset); +/* set I2C read com 0x01 mot = 0 and read 16 bytes */ + ret =sp_tx_aux_rd (ctx,0xf1 ); + +if (ret) { + ret =sp_tx_rst_aux (ctx); +DRM_DEV_ERROR (dev,"segment read failed, reset!\n" ); + cnt++;
Same.
Quoted 4 lines
drivers/gpu/drm/bridge/analogix/anx7625.c new file +4
-0+ }else { + ret =anx7625_reg_block_read (ctx, ctx->i2c.rx_p0_client, +AP_AUX_BUFF_START , +MAX_DPCD_BUFFER_SIZE , buf);
drivers/gpu/drm/bridge/analogix/anx7625.c line 949
Quoted 10 lines
drivers/gpu/drm/bridge/analogix/anx7625.c new file +10
-0+if (!ret) +break ; + } + } + +if (cnt ==EDID_TRY_CNT ) +return -EIO ; + +return 0 ; +}
regards,
dan carpenter
Re: [PATCH v2 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver
Quoted 11 lines · Dan Carpenter
This code is *so* much nicer than before. I hope you feel good about the changes. It makes me happy to look at this code now.
drivers/gpu/drm/bridge/analogix/anx7625.c line 875
Quoted 7 lines · Xin Ji
drivers/gpu/drm/bridge/analogix/anx7625.c new file +7
-0+static int edid_read (struct anx7625_data *ctx, +u8 offset,u8 *pblock_buf) +{ +int ret, cnt; +struct device *dev = &ctx->client->dev; + +for (cnt =0 ; cnt <EDID_TRY_CNT ; cnt++) {
^^^^^
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c line 883
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c new file +8
-0+sp_tx_aux_wr (ctx, offset); +/* set I2C read com 0x01 mot = 0 and read 16 bytes */ + ret =sp_tx_aux_rd (ctx,0xf1 ); + +if (ret) { +sp_tx_rst_aux (ctx); +DRM_DEV_DEBUG_DRIVER (dev,"edid read failed, reset!\n" ); + cnt++;
^^^^^
I mean that it's incremented twice, yeah?
regards,
dan carpenter
Re: [PATCH v2 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver
Hi Dan Carpenter,
This is a bug, I'll fix it right now.
The coding is much nicer than before, thanks for your comments, it is very helpful for me.
Thanks,
Xin
Quoted 28 lines · Dan Carpenter
Quoted 11 lines · Dan Carpenter
This code is *so* much nicer than before. I hope you feel good about the changes. It makes me happy to look at this code now.
drivers/gpu/drm/bridge/analogix/anx7625.c line 875
Quoted 7 lines · Xin Ji
drivers/gpu/drm/bridge/analogix/anx7625.c new file +7
-0+static int edid_read (struct anx7625_data *ctx, +u8 offset,u8 *pblock_buf) +{ +int ret, cnt; +struct device *dev = &ctx->client->dev; + +for (cnt =0 ; cnt <EDID_TRY_CNT ; cnt++) {^^^^^Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c line 883
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c new file +8
-0+sp_tx_aux_wr (ctx, offset); +/* set I2C read com 0x01 mot = 0 and read 16 bytes */ + ret =sp_tx_aux_rd (ctx,0xf1 ); + +if (ret) { +sp_tx_rst_aux (ctx); +DRM_DEV_DEBUG_DRIVER (dev,"edid read failed, reset!\n" ); + cnt++;^^^^^I mean that it's incremented twice, yeah?
regards,
dan carpenter