Skip to contentSkip to conversation

Add MIPI rx DPI support

PATCH Superseded Xin Ji 2 participants 11 messages Mar 19, 2021

Subsystems (4)

v5 of 12 Superseded Latest is v12 →

lore
Share & tools
lore

Xin Ji

author
#0 lore raw

v5 cover Add MIPI rx DPI support

Hi all, this patch series implement MIPI rx DPI feature. Please help to review.

This is the v5 version, any mistakes, please let me know, I'll fix it in the next series.

Change history:
v5: Fix Rob Herring, Hsin-Yi, Robert Foss comments
- Rebase code on the branch 'drm-misc-next', refer video-interfaces.yaml
- Seprate HDCP function to a new patch
- Fix driver not correctly get 'bus-type' 'data-lanes'
- Add audio HDMI codec function support

v4: Fix Rob Herring comment
- Rebase code on the branch 'drm-misc-next'
- Change 'analogix,hdcp-support' type to boolean

v3: Fix Rob Herring, Dan Carpenter, Nicolas comment
- Split the patch, fix not correct return data
- Fix several coding format
- Split DP tx swing register setting to two property
- Add HDCP support vender flag
- remove 'analogix,swing-setting' and 'analogix,mipi-dpi-in' property

v2: Fix Rob Herring comment
- Fix yamllint warnings/errors in analogix,anx7625.yaml
- Fix kernel robot compile warning

v1: initial MIPI rx DPI feature support

Xin Ji (5):
dt-bindings:drm/bridge:anx7625:add vendor define flags drm/bridge: anx7625: fix not correct return value drm/bridge: anx7625: add MIPI DPI input feature support drm/bridge: anx7625: add HDCP support drm/bridge: anx7625: add HDMI audio function

 .../bindings/display/bridge/analogix,anx7625.yaml  |  58 +-
 drivers/gpu/drm/bridge/analogix/anx7625.c          | 601 +++++++++++++++++++--
 drivers/gpu/drm/bridge/analogix/anx7625.h          |  59 +-
 3 files changed, 665 insertions(+), 53 deletions(-)
Signature · 6 lines
2.7.4

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

PATCH v5 1/5 dt-bindings:drm/bridge:anx7625:add vendor define flags

Add 'bus-type' and 'data-lanes' define for port0. Define DP tx lane0, lane1 swing register array define, and audio enable flag.

---
 .../bindings/display/bridge/analogix,anx7625.yaml  | 58 +++++++++++++++++++++-
 1 file changed, 57 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml +57 -1
index c789784..3f54d58 100644
@@ -34,6 +34,26 @@ properties:
     description: used for reset chip control, RESET_N pin B7.
     maxItems: 1
 
+  analogix,lane0-swing:
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 20
+    description:
+      an array of swing register setting for DP tx lane0 PHY, please don't
+      add this property, or contact vendor.
+
+  analogix,lane1-swing:
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 20
+    description:
+      an array of swing register setting for DP tx lane1 PHY, please don't
+      add this property, or contact vendor.
+
+  analogix,audio-enable:
+    type: boolean
+    description: let the driver enable audio HDMI codec function or not.
+
   ports:
     $ref: /schemas/graph.yaml#/properties/ports
 
@@ -41,13 +61,43 @@ properties:
       port@0:
         $ref: /schemas/graph.yaml#/properties/port
         description:
-          Video port for MIPI DSI input.
+          MIPI DSI/DPI input.
+
+        properties:
+          endpoint:
+            $ref: /schemas/media/video-interfaces.yaml#
+            type: object
+            additionalProperties: false
+
+            properties:
+              remote-endpoint: true
+              bus-type: true
+              data-lanes: true
+
+            required:
+              - remote-endpoint
+
+        required:
+          - endpoint
+
 
       port@1:
         $ref: /schemas/graph.yaml#/properties/port
         description:
           Video port for panel or connector.
 
+        properties:
+          endpoint:
+            $ref: /schemas/media/video-interfaces.yaml#
+            type: object
+            additionalProperties: false
+
+            properties:
+              remote-endpoint: true
+
+            required:
+              - remote-endpoint
+
     required:
       - port@0
       - port@1
@@ -73,6 +123,10 @@ examples:
             enable-gpios = <&pio 45 GPIO_ACTIVE_HIGH>;
             reset-gpios = <&pio 73 GPIO_ACTIVE_HIGH>;
 
+            analogix,audio-enable;
+            analogix,lane0-swing = <0x14 0x54 0x64 0x74 0x29 0x7b 0x77 0x5b>;
+            analogix,lane1-swing = <0x14 0x54 0x64 0x74 0x29 0x7b 0x77 0x5b>;
+
             ports {
                 #address-cells = <1>;
                 #size-cells = <0>;
@@ -81,6 +135,8 @@ examples:
                     reg = <0>;
                     anx7625_in: endpoint {
                         remote-endpoint = <&mipi_dsi>;
+                        bus-type = <5>;
+                        data-lanes = <0 1 2 3>;
                     };
                 };
 
Signature · 6 lines
2.7.4

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

PATCH v5 2/5 drm/bridge: anx7625: fix not correct return value

In reply to Xin Ji

At some time, the original code may return non zero value, force return 0 if operation finished.

---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -2
index 65cc059..04536cc 100644
@@ -189,10 +189,10 @@ static int wait_aux_op_finish(struct anx7625_data *ctx)
 			       AP_AUX_CTRL_STATUS);
 	if (val < 0 || (val & 0x0F)) {
 		DRM_DEV_ERROR(dev, "aux status %02x\n", val);
-		val = -EIO;
+		return -EIO;
 	}
 
-	return val;
+	return 0;
 }
 
 static int anx7625_video_mute_control(struct anx7625_data *ctx,
Signature · 6 lines
2.7.4

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

PATCH v5 3/5 drm/bridge: anx7625: add MIPI DPI input feature support

In reply to Xin Ji

Add MIPI rx DPI input support.

---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 243 ++++++++++++++++++++++--------
 drivers/gpu/drm/bridge/analogix/anx7625.h |  18 ++-
 2 files changed, 201 insertions(+), 60 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +184 -59
index 04536cc..5c9b801 100644
@@ -150,18 +150,18 @@ static int anx7625_write_and(struct anx7625_data *ctx,
 	return anx7625_reg_write(ctx, client, offset, (val & (mask)));
 }
 
-static int anx7625_write_and_or(struct anx7625_data *ctx,
-				struct i2c_client *client,
-				u8 offset, u8 and_mask, u8 or_mask)
+static int anx7625_config_bit_matrix(struct anx7625_data *ctx)
 {
-	int val;
+	int i, ret;
 
-	val = anx7625_reg_read(ctx, client, offset);
-	if (val < 0)
-		return val;
+	ret = anx7625_write_or(ctx, ctx->i2c.tx_p2_client,
+			       AUDIO_CONTROL_REGISTER, 0x80);
+	for (i = 0; i < 13; i++)
+		ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client,
+					 VIDEO_BIT_MATRIX_12 + i,
+					 0x18 + i);
 
-	return anx7625_reg_write(ctx, client,
-				 offset, (val & and_mask) | (or_mask));
+	return ret;
 }
 
 static int anx7625_read_ctrl_status_p0(struct anx7625_data *ctx)
@@ -219,38 +219,6 @@ static int anx7625_video_mute_control(struct anx7625_data *ctx,
 	return ret;
 }
 
-static int anx7625_config_audio_input(struct anx7625_data *ctx)
-{
-	struct device *dev = &ctx->client->dev;
-	int ret;
-
-	/* Channel num */
-	ret = anx7625_reg_write(ctx, ctx->i2c.tx_p2_client,
-				AUDIO_CHANNEL_STATUS_6, I2S_CH_2 << 5);
-
-	/* FS */
-	ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
-				    AUDIO_CHANNEL_STATUS_4,
-				    0xf0, AUDIO_FS_48K);
-	/* Word length */
-	ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
-				    AUDIO_CHANNEL_STATUS_5,
-				    0xf0, AUDIO_W_LEN_24_24MAX);
-	/* I2S */
-	ret |= anx7625_write_or(ctx, ctx->i2c.tx_p2_client,
-				AUDIO_CHANNEL_STATUS_6, I2S_SLAVE_MODE);
-	ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client,
-				 AUDIO_CONTROL_REGISTER, ~TDM_TIMING_MODE);
-	/* Audio change flag */
-	ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client,
-				AP_AV_STATUS, AP_AUDIO_CHG);
-
-	if (ret < 0)
-		DRM_DEV_ERROR(dev, "fail to config audio.\n");
-
-	return ret;
-}
-
 /* Reduction of fraction a/b */
 static void anx7625_reduction_of_a_fraction(unsigned long *a, unsigned long *b)
 {
@@ -410,7 +378,7 @@ static int anx7625_dsi_video_timing_config(struct anx7625_data *ctx)
 	ret |= anx7625_write_and(ctx, ctx->i2c.rx_p1_client,
 			MIPI_LANE_CTRL_0, 0xfc);
 	ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client,
-				MIPI_LANE_CTRL_0, 3);
+				MIPI_LANE_CTRL_0, ctx->pdata.mipi_lanes - 1);
 
 	/* Htotal */
 	htotal = ctx->dt.hactive.min + ctx->dt.hfront_porch.min +
@@ -595,6 +563,76 @@ static int anx7625_dsi_config(struct anx7625_data *ctx)
 	return ret;
 }
 
+static int anx7625_api_dpi_config(struct anx7625_data *ctx)
+{
+	struct device *dev = &ctx->client->dev;
+	u16 freq = ctx->dt.pixelclock.min / 1000;
+	int ret;
+
+	/* configure pixel clock */
+	ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+				PIXEL_CLOCK_L, freq & 0xFF);
+	ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+				 PIXEL_CLOCK_H, (freq >> 8));
+
+	/* set DPI mode */
+	/* set to DPI PLL module sel */
+	ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client,
+				 MIPI_DIGITAL_PLL_9, 0x20);
+	/* power down MIPI */
+	ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client,
+				 MIPI_LANE_CTRL_10, 0x08);
+	/* enable DPI mode */
+	ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client,
+				 MIPI_DIGITAL_PLL_18, 0x1C);
+	/* set first edge */
+	ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client,
+				 VIDEO_CONTROL_0, 0x06);
+	if (ret < 0)
+		DRM_DEV_ERROR(dev, "IO error : dpi phy set failed.\n");
+
+	return ret;
+}
+
+static int anx7625_dpi_config(struct anx7625_data *ctx)
+{
+	struct device *dev = &ctx->client->dev;
+	int ret;
+
+	DRM_DEV_DEBUG_DRIVER(dev, "config dpi\n");
+
+	/* DSC disable */
+	ret = anx7625_write_and(ctx, ctx->i2c.rx_p0_client,
+				R_DSC_CTRL_0, ~DSC_EN);
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev, "IO error : disable dsc failed.\n");
+		return ret;
+	}
+
+	ret = anx7625_config_bit_matrix(ctx);
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev, "config bit matrix failed.\n");
+		return ret;
+	}
+
+	ret = anx7625_api_dpi_config(ctx);
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev, "mipi phy(dpi) setup failed.\n");
+		return ret;
+	}
+
+	/* set MIPI RX EN */
+	ret = anx7625_write_or(ctx, ctx->i2c.rx_p0_client,
+			       AP_AV_STATUS, AP_MIPI_RX_EN);
+	/* clear mute flag */
+	ret |= anx7625_write_and(ctx, ctx->i2c.rx_p0_client,
+				 AP_AV_STATUS, (u8)~AP_MIPI_MUTE);
+	if (ret < 0)
+		DRM_DEV_ERROR(dev, "IO error : enable mipi rx failed.\n");
+
+	return ret;
+}
+
 static void anx7625_dp_start(struct anx7625_data *ctx)
 {
 	int ret;
@@ -605,9 +643,10 @@ static void anx7625_dp_start(struct anx7625_data *ctx)
 		return;
 	}
 
-	anx7625_config_audio_input(ctx);
-
-	ret = anx7625_dsi_config(ctx);
+	if (ctx->pdata.is_dpi)
+		ret = anx7625_dpi_config(ctx);
+	else
+		ret = anx7625_dsi_config(ctx);
 
 	if (ret < 0)
 		DRM_DEV_ERROR(dev, "MIPI phy setup error.\n");
@@ -1051,6 +1090,7 @@ static void anx7625_start_dp_work(struct anx7625_data *ctx)
 		return;
 	}
 
+	ctx->hpd_status = 1;
 	ctx->hpd_high_cnt++;
 
 	/* Not support HDCP */
@@ -1060,8 +1100,10 @@ static void anx7625_start_dp_work(struct anx7625_data *ctx)
 	ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xec, 0x10);
 	/* Interrupt for DRM */
 	ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xff, 0x01);
-	if (ret < 0)
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev, "fail to setting HDCP/auth\n");
 		return;
+	}
 
 	ret = anx7625_reg_read(ctx, ctx->i2c.rx_p1_client, 0x86);
 	if (ret < 0)
@@ -1080,6 +1122,10 @@ static void anx7625_hpd_polling(struct anx7625_data *ctx)
 	int ret, val;
 	struct device *dev = &ctx->client->dev;
 
+	/* Interrupt mode, no need poll HPD status, just return */
+	if (ctx->pdata.intp_irq)
+		return;
+
 	if (atomic_read(&ctx->power_status) != 1) {
 		DRM_DEV_DEBUG_DRIVER(dev, "No need to poling HPD status.\n");
 		return;
@@ -1130,6 +1176,21 @@ static void anx7625_remove_edid(struct anx7625_data *ctx)
 	ctx->slimport_edid_p.edid_block_num = -1;
 }
 
+static void anx7625_dp_adjust_swing(struct anx7625_data *ctx)
+{
+	int i;
+
+	for (i = 0; i < ctx->pdata.dp_lane0_swing_reg_cnt; i++)
+		anx7625_reg_write(ctx, ctx->i2c.tx_p1_client,
+				  DP_TX_LANE0_SWING_REG0 + i,
+				  ctx->pdata.lane0_reg_data[i] & 0xFF);
+
+	for (i = 0; i < ctx->pdata.dp_lane1_swing_reg_cnt; i++)
+		anx7625_reg_write(ctx, ctx->i2c.tx_p1_client,
+				  DP_TX_LANE1_SWING_REG0 + i,
+				  ctx->pdata.lane1_reg_data[i] & 0xFF);
+}
+
 static void dp_hpd_change_handler(struct anx7625_data *ctx, bool on)
 {
 	struct device *dev = &ctx->client->dev;
@@ -1145,9 +1206,8 @@ static void dp_hpd_change_handler(struct anx7625_data *ctx, bool on)
 	} else {
 		DRM_DEV_DEBUG_DRIVER(dev, " HPD high\n");
 		anx7625_start_dp_work(ctx);
+		anx7625_dp_adjust_swing(ctx);
 	}
-
-	ctx->hpd_status = 1;
 }
 
 static int anx7625_hpd_change_detect(struct anx7625_data *ctx)
@@ -1224,20 +1284,70 @@ static irqreturn_t anx7625_intr_hpd_isr(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
+static int anx7625_get_swing_setting(struct device *dev,
+				     struct anx7625_platform_data *pdata)
+{
+	int num_regs;
+
+	if (of_get_property(dev->of_node,
+			    "analogix,lane0-swing", &num_regs)) {
+		if (num_regs > DP_TX_SWING_REG_CNT)
+			num_regs = DP_TX_SWING_REG_CNT;
+
+		pdata->dp_lane0_swing_reg_cnt = num_regs;
+		of_property_read_u32_array(dev->of_node, "analogix,lane0-swing",
+					   pdata->lane0_reg_data, num_regs);
+	}
+
+	if (of_get_property(dev->of_node,
+			    "analogix,lane1-swing", &num_regs)) {
+		if (num_regs > DP_TX_SWING_REG_CNT)
+			num_regs = DP_TX_SWING_REG_CNT;
+
+		pdata->dp_lane1_swing_reg_cnt = num_regs;
+		of_property_read_u32_array(dev->of_node, "analogix,lane1-swing",
+					   pdata->lane1_reg_data, num_regs);
+	}
+
+	return 0;
+}
+
 static int anx7625_parse_dt(struct device *dev,
 			    struct anx7625_platform_data *pdata)
 {
-	struct device_node *np = dev->of_node;
+	struct device_node *np = dev->of_node, *ep0;
 	struct drm_panel *panel;
 	int ret;
+	int bus_type, mipi_lanes;
 
+	anx7625_get_swing_setting(dev, pdata);
+
+	pdata->is_dpi = 1; /* default dpi mode */
 	pdata->mipi_host_node = of_graph_get_remote_node(np, 0, 0);
 	if (!pdata->mipi_host_node) {
 		DRM_DEV_ERROR(dev, "fail to get internal panel.\n");
 		return -ENODEV;
 	}
 
-	DRM_DEV_DEBUG_DRIVER(dev, "found dsi host node.\n");
+	ep0 = of_graph_get_endpoint_by_regs(np, 0, 0);
+	if (ep0) {
+		if (of_property_read_u32(ep0, "bus-type", &bus_type))
+			bus_type = 0;
+
+		mipi_lanes = of_property_count_u32_elems(ep0, "data-lanes");
+	}
+
+	if (bus_type == 5) /* bus type is Parallel(DSI) */
+		pdata->is_dpi = 0;
+
+	pdata->mipi_lanes = mipi_lanes;
+	if (pdata->mipi_lanes > MAX_LANES_SUPPORT || pdata->mipi_lanes <= 0)
+		pdata->mipi_lanes = MAX_LANES_SUPPORT;
+
+	if (pdata->is_dpi)
+		DRM_DEV_DEBUG_DRIVER(dev, "found MIPI DPI host node.\n");
+	else
+		DRM_DEV_DEBUG_DRIVER(dev, "found MIPI DSI host node.\n");
 
 	ret = drm_of_find_panel_or_bridge(np, 1, 0, &panel, NULL);
 	if (ret < 0) {
@@ -1300,9 +1410,13 @@ static enum drm_connector_status anx7625_sink_detect(struct anx7625_data *ctx)
 {
 	struct device *dev = &ctx->client->dev;
 
-	DRM_DEV_DEBUG_DRIVER(dev, "sink detect, return connected\n");
+	DRM_DEV_DEBUG_DRIVER(dev, "sink detect\n");
+
+	if (ctx->pdata.panel_bridge)
+		return connector_status_connected;
 
-	return connector_status_connected;
+	return ctx->hpd_status ? connector_status_connected :
+				     connector_status_disconnected;
 }
 
 static int anx7625_attach_dsi(struct anx7625_data *ctx)
@@ -1330,7 +1444,7 @@ static int anx7625_attach_dsi(struct anx7625_data *ctx)
 		return -EINVAL;
 	}
 
-	dsi->lanes = 4;
+	dsi->lanes = ctx->pdata.mipi_lanes;
 	dsi->format = MIPI_DSI_FMT_RGB888;
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO	|
 		MIPI_DSI_MODE_VIDEO_SYNC_PULSE	|
@@ -1376,10 +1490,12 @@ static int anx7625_bridge_attach(struct drm_bridge *bridge,
 		return -ENODEV;
 	}
 
-	err = anx7625_attach_dsi(ctx);
-	if (err) {
-		DRM_DEV_ERROR(dev, "Fail to attach to dsi : %d\n", err);
-		return err;
+	if (!ctx->pdata.is_dpi) {
+		err = anx7625_attach_dsi(ctx);
+		if (err) {
+			DRM_DEV_ERROR(dev, "Fail to attach to dsi : %d\n", err);
+			return err;
+		}
 	}
 
 	if (ctx->pdata.panel_bridge) {
@@ -1478,6 +1594,10 @@ static bool anx7625_bridge_mode_fixup(struct drm_bridge *bridge,
 
 	DRM_DEV_DEBUG_DRIVER(dev, "drm mode fixup set\n");
 
+	/* No need fixup for external monitor */
+	if (!ctx->pdata.panel_bridge)
+		return true;
+
 	hsync = mode->hsync_end - mode->hsync_start;
 	hfp = mode->hsync_start - mode->hdisplay;
 	hbp = mode->htotal - mode->hsync_end;
@@ -1786,8 +1906,13 @@ static int anx7625_i2c_probe(struct i2c_client *client,
 
 	platform->bridge.funcs = &anx7625_bridge_funcs;
 	platform->bridge.of_node = client->dev.of_node;
-	platform->bridge.ops = DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD;
-	platform->bridge.type = DRM_MODE_CONNECTOR_eDP;
+	platform->bridge.ops = DRM_BRIDGE_OP_EDID;
+	if (!platform->pdata.panel_bridge)
+		platform->bridge.ops |= DRM_BRIDGE_OP_HPD |
+					DRM_BRIDGE_OP_DETECT;
+	platform->bridge.type = platform->pdata.panel_bridge ?
+				    DRM_MODE_CONNECTOR_eDP :
+				    DRM_MODE_CONNECTOR_DisplayPort;
 	drm_bridge_add(&platform->bridge);
 
 	DRM_DEV_DEBUG_DRIVER(dev, "probe done\n");
drivers/gpu/drm/bridge/analogix/anx7625.h +17 -1
index 193ad86..beee95d 100644
@@ -141,12 +141,20 @@
 #define  HORIZONTAL_BACK_PORCH_H      0x22  /* Bit[7:4] are reserved */
 
 /******** END of I2C Address 0x72 *********/
+
+/***************************************************************/
+/* Register definition of device address 0x7a */
+#define DP_TX_SWING_REG_CNT		0x14
+#define DP_TX_LANE0_SWING_REG0		0x00
+#define DP_TX_LANE1_SWING_REG0		0x14
+/******** END of I2C Address 0x7a *********/
+
 /***************************************************************/
 /* Register definition of device address 0x7e */
 
 #define  I2C_ADDR_7E_FLASH_CONTROLLER  0x7E
 
-#define FLASH_LOAD_STA 0x05
+#define FLASH_LOAD_STA          0x05
 #define FLASH_LOAD_STA_CHK	BIT(7)
 
 #define  XTAL_FRQ_SEL    0x3F
@@ -347,11 +355,19 @@ struct s_edid_data {
 
 /***************** Display End *****************/
 
+#define MAX_LANES_SUPPORT	4
+
 struct anx7625_platform_data {
 	struct gpio_desc *gpio_p_on;
 	struct gpio_desc *gpio_reset;
 	struct drm_bridge *panel_bridge;
 	int intp_irq;
+	int is_dpi;
+	int mipi_lanes;
+	int dp_lane0_swing_reg_cnt;
+	int lane0_reg_data[DP_TX_SWING_REG_CNT];
+	int dp_lane1_swing_reg_cnt;
+	int lane1_reg_data[DP_TX_SWING_REG_CNT];
 	u32 low_power_mode;
 	struct device_node *mipi_host_node;
 };
Signature · 6 lines
2.7.4

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

Re: [PATCH v5 3/5] drm/bridge: anx7625: add MIPI DPI input feature support

Thank you for the patch! Perhaps something to improve:

Hi Xin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linux/master linus/master v5.12-rc3 next-20210318] [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/Xin-Ji/Add-MIPI-rx-DPI-support/20210319-104013
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm-randconfig-r014-20210318 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project fcc1ce00931751ac02498986feb37744e9ace8de)

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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/348257d12d5c847255eaf814081fe996aeab1841
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xin-Ji/Add-MIPI-rx-DPI-support/20210319-104013 git checkout 348257d12d5c847255eaf814081fe996aeab1841
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm

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

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/bridge/analogix/anx7625.c:1333:6: warning: variable 'mipi_lanes' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (ep0) {
               ^~~
   drivers/gpu/drm/bridge/analogix/anx7625.c:1343:22: note: uninitialized use occurs here
           pdata->mipi_lanes = mipi_lanes;
                               ^~~~~~~~~~
   drivers/gpu/drm/bridge/analogix/anx7625.c:1333:2: note: remove the 'if' if its condition is always true
           if (ep0) {
           ^~~~~~~~~
   drivers/gpu/drm/bridge/analogix/anx7625.c:1321:26: note: initialize the variable 'mipi_lanes' to silence this warning
           int bus_type, mipi_lanes;
                                   ^
                                    = 0
>> drivers/gpu/drm/bridge/analogix/anx7625.c:1333:6: warning: variable 'bus_type' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (ep0) {
               ^~~
   drivers/gpu/drm/bridge/analogix/anx7625.c:1340:6: note: uninitialized use occurs here
           if (bus_type == 5) /* bus type is Parallel(DSI) */
               ^~~~~~~~
   drivers/gpu/drm/bridge/analogix/anx7625.c:1333:2: note: remove the 'if' if its condition is always true
           if (ep0) {
           ^~~~~~~~~
   drivers/gpu/drm/bridge/analogix/anx7625.c:1321:14: note: initialize the variable 'bus_type' to silence this warning
           int bus_type, mipi_lanes;
                       ^
                        = 0

2 warnings generated.

vim +1333 drivers/gpu/drm/bridge/analogix/anx7625.c

1314
1315 static int anx7625_parse_dt(struct device *dev,
1316 struct anx7625_platform_data *pdata)
1317 {
1318 struct device_node *np = dev->of_node, *ep0;
1319 struct drm_panel *panel;
1320 int ret;
1321 int bus_type, mipi_lanes;
1322
1323 anx7625_get_swing_setting(dev, pdata);
1324
1325 pdata->is_dpi = 1; /* default dpi mode */
1326 pdata->mipi_host_node = of_graph_get_remote_node(np, 0, 0);
1327 if (!pdata->mipi_host_node) {
1328 DRM_DEV_ERROR(dev, "fail to get internal panel.\n");
1329 return -ENODEV;
1330 }
1331
1332 ep0 = of_graph_get_endpoint_by_regs(np, 0, 0);

> 1333		if (ep0) {

1334 if (of_property_read_u32(ep0, "bus-type", &bus_type))
1335 bus_type = 0;
1336
1337 mipi_lanes = of_property_count_u32_elems(ep0, "data-lanes");
1338 }
1339
1340 if (bus_type == 5) /* bus type is Parallel(DSI) */
1341 pdata->is_dpi = 0;
1342
1343 pdata->mipi_lanes = mipi_lanes;
1344 if (pdata->mipi_lanes > MAX_LANES_SUPPORT || pdata->mipi_lanes <= 0)
1345 pdata->mipi_lanes = MAX_LANES_SUPPORT;
1346
1347 if (pdata->is_dpi)
1348 DRM_DEV_DEBUG_DRIVER(dev, "found MIPI DPI host node.\n");
1349 else
1350 DRM_DEV_DEBUG_DRIVER(dev, "found MIPI DSI host node.\n");
1351
1352 ret = drm_of_find_panel_or_bridge(np, 1, 0, &panel, NULL);
1353 if (ret < 0) {
1354 if (ret == -ENODEV)
1355 return 0;
1356 return ret;
1357 }
1358 if (!panel)
1359 return -ENODEV;
1360
1361 pdata->panel_bridge = devm_drm_panel_bridge_add(dev, panel);
1362 if (IS_ERR(pdata->panel_bridge))
1363 return PTR_ERR(pdata->panel_bridge);
1364 DRM_DEV_DEBUG_DRIVER(dev, "get panel node.\n");
1365
1366 return 0;
1367 }
1368

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

author
#5 lore raw

PATCH v5 4/5 drm/bridge: anx7625: add HDCP support

In reply to Xin Ji

Add HDCP feature, enable HDCP function through chip internal key and downstream's capability.

---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 147 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/bridge/analogix/anx7625.h |  36 ++++++++
 2 files changed, 183 insertions(+)
drivers/gpu/drm/bridge/analogix/anx7625.c +147 -0
index 5c9b801..5e19170 100644
@@ -633,6 +633,150 @@ static int anx7625_dpi_config(struct anx7625_data *ctx)
 	return ret;
 }
 
+static int anx7625_aux_dpcd_read(struct anx7625_data *ctx,
+				 u8 addrh, u8 addrm, u8 addrl,
+				 u8 len, u8 *buf)
+{
+	struct device *dev = &ctx->client->dev;
+	int ret;
+	u8 cmd;
+
+	if (len > MAX_DPCD_BUFFER_SIZE) {
+		DRM_DEV_ERROR(dev, "exceed aux buffer len.\n");
+		return -E2BIG;
+	}
+
+	cmd = ((len - 1) << 4) | 0x09;
+
+	/* Set command and length */
+	ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+				AP_AUX_COMMAND, cmd);
+
+	/* Set aux access address */
+	ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+				 AP_AUX_ADDR_7_0, addrl);
+	ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+				 AP_AUX_ADDR_15_8, addrm);
+	ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+				 AP_AUX_ADDR_19_16, addrh);
+
+	/* Enable aux access */
+	ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client,
+				AP_AUX_CTRL_STATUS, AP_AUX_CTRL_OP_EN);
+
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev, "cannot access aux related register.\n");
+		return -EIO;
+	}
+
+	usleep_range(2000, 2100);
+
+	ret = wait_aux_op_finish(ctx);
+	if (ret) {
+		DRM_DEV_ERROR(dev, "aux IO error: wait aux op finish.\n");
+		return ret;
+	}
+
+	ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client,
+				     AP_AUX_BUFF_START, len, buf);
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev, "read dpcd register failed\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int anx7625_read_flash_status(struct anx7625_data *ctx)
+{
+	return anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, R_RAM_CTRL);
+}
+
+static int anx7625_hdcp_key_probe(struct anx7625_data *ctx)
+{
+	int ret, val;
+	struct device *dev = &ctx->client->dev;
+	u8 ident[32];
+
+	ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+				FLASH_ADDR_HIGH, 0x91);
+	ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+				 FLASH_ADDR_LOW, 0xA0);
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev, "IO error : set key flash address.\n");
+		return ret;
+	}
+
+	ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+				FLASH_LEN_HIGH, (FLASH_BUF_LEN - 1) >> 8);
+	ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+				 FLASH_LEN_LOW, (FLASH_BUF_LEN - 1) & 0xFF);
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev, "IO error : set key flash len.\n");
+		return ret;
+	}
+
+	ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+				R_FLASH_RW_CTRL, FLASH_READ);
+	ret |= readx_poll_timeout(anx7625_read_flash_status,
+				  ctx, val,
+				  ((val & FLASH_DONE) || (val < 0)),
+				  2000,
+				  2000 * 150);
+	if (ret) {
+		DRM_DEV_ERROR(dev, "flash read access fail!\n");
+		return -EIO;
+	}
+
+	ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client,
+				     FLASH_BUF_BASE_ADDR,
+				     FLASH_BUF_LEN, ident);
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev, "read flash data fail!\n");
+		return -EIO;
+	}
+
+	if (ident[29] == 0xFF && ident[30] == 0xFF && ident[31] == 0xFF)
+		return -EINVAL;
+
+	return 0;
+}
+
+static int anx7625_hdcp_setting(struct anx7625_data *ctx)
+{
+	u8 bcap;
+	int ret;
+	struct device *dev = &ctx->client->dev;
+
+	ret = anx7625_hdcp_key_probe(ctx);
+	if (ret) {
+		DRM_DEV_DEBUG_DRIVER(dev, "disable HDCP by config\n");
+		return anx7625_write_and(ctx, ctx->i2c.rx_p1_client,
+					 0xee, 0x9f);
+	}
+
+	anx7625_aux_dpcd_read(ctx, 0x06, 0x80, 0x28, 1, &bcap);
+	if (!(bcap & 0x01)) {
+		DRM_DEV_DEBUG_DRIVER(dev, "bcap(0x%x) not support HDCP 1.4.\n",
+				     bcap);
+		return anx7625_write_and(ctx, ctx->i2c.rx_p1_client,
+					 0xee, 0x9f);
+	}
+
+	DRM_DEV_DEBUG_DRIVER(dev, "enable HDCP 1.4\n");
+
+	ret = anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xee, 0x20);
+
+	/* Try auth flag */
+	ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xec, 0x10);
+	/* Interrupt for DRM */
+	ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xff, 0x01);
+	if (ret < 0)
+		DRM_DEV_ERROR(dev, "fail to enable HDCP\n");
+
+	return ret;
+}
+
 static void anx7625_dp_start(struct anx7625_data *ctx)
 {
 	int ret;
@@ -643,6 +787,9 @@ static void anx7625_dp_start(struct anx7625_data *ctx)
 		return;
 	}
 
+	/* HDCP config */
+	anx7625_hdcp_setting(ctx);
+
 	if (ctx->pdata.is_dpi)
 		ret = anx7625_dpi_config(ctx);
 	else
drivers/gpu/drm/bridge/analogix/anx7625.h +36 -0
index beee95d..c6f93e4 100644
@@ -154,9 +154,45 @@
 
 #define  I2C_ADDR_7E_FLASH_CONTROLLER  0x7E
 
+#define FLASH_SRAM_SEL          0x00
+#define SRAM_ADDR_HIGH          0x01
+#define SRAM_ADDR_LOW           0x02
+#define SRAM_LEN_HIGH           0x03
+#define SRAM_LEN_LOW            0x04
 #define FLASH_LOAD_STA          0x05
 #define FLASH_LOAD_STA_CHK	BIT(7)
 
+#define R_RAM_CTRL              0x05
+/* bit positions */
+#define FLASH_DONE              BIT(7)
+#define BOOT_LOAD_DONE          BIT(6)
+#define CRC_OK                  BIT(5)
+#define LOAD_DONE               BIT(4)
+#define O_RW_DONE               BIT(3)
+#define FUSE_BUSY               BIT(2)
+#define DECRYPT_EN              BIT(1)
+#define LOAD_START              BIT(0)
+
+#define FLASH_ADDR_HIGH         0x0F
+#define FLASH_ADDR_LOW          0x10
+#define FLASH_LEN_HIGH          0x31
+#define FLASH_LEN_LOW           0x32
+
+#define R_FLASH_RW_CTRL         0x33
+/* bit positions */
+#define READ_DELAY_SELECT       BIT(7)
+#define GENERAL_INSTRUCTION_EN  BIT(6)
+#define FLASH_ERASE_EN          BIT(5)
+#define RDID_READ_EN            BIT(4)
+#define REMS_READ_EN            BIT(3)
+#define WRITE_STATUS_EN         BIT(2)
+#define FLASH_READ              BIT(1)
+#define FLASH_WRITE             BIT(0)
+
+#define FLASH_BUF_BASE_ADDR     0x60
+#define FLASH_BUF_LEN           0x20
+#define FLASH_KEY_OFFSET        0x8000
+
 #define  XTAL_FRQ_SEL    0x3F
 /* bit field positions */
 #define  XTAL_FRQ_SEL_POS    5
Signature · 6 lines
2.7.4

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

PATCH v5 5/5 drm/bridge: anx7625: add HDMI audio function

In reply to Xin Ji

Add audio HDMI codec function support, enable it through device true flag "analogix,audio-enable".

---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 227 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/bridge/analogix/anx7625.h |   5 +
 2 files changed, 232 insertions(+)
drivers/gpu/drm/bridge/analogix/anx7625.c +227 -0
index 5e19170..f4653f2 100644
@@ -30,6 +30,8 @@
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
 
+#include <sound/hdmi-codec.h>
+
 #include <video/display_timing.h>
 
 #include "anx7625.h"
@@ -150,6 +152,20 @@ static int anx7625_write_and(struct anx7625_data *ctx,
 	return anx7625_reg_write(ctx, client, offset, (val & (mask)));
 }
 
+static int anx7625_write_and_or(struct anx7625_data *ctx,
+				struct i2c_client *client,
+				u8 offset, u8 and_mask, u8 or_mask)
+{
+	int val;
+
+	val = anx7625_reg_read(ctx, client, offset);
+	if (val < 0)
+		return val;
+
+	return anx7625_reg_write(ctx, client,
+				 offset, (val & and_mask) | (or_mask));
+}
+
 static int anx7625_config_bit_matrix(struct anx7625_data *ctx)
 {
 	int i, ret;
@@ -1496,6 +1512,9 @@ static int anx7625_parse_dt(struct device *dev,
 	else
 		DRM_DEV_DEBUG_DRIVER(dev, "found MIPI DSI host node.\n");
 
+	if (of_property_read_bool(np, "analogix,audio-enable"))
+		pdata->audio_en = 1;
+
 	ret = drm_of_find_panel_or_bridge(np, 1, 0, &panel, NULL);
 	if (ret < 0) {
 		if (ret == -ENODEV)
@@ -1566,6 +1585,208 @@ static enum drm_connector_status anx7625_sink_detect(struct anx7625_data *ctx)
 				     connector_status_disconnected;
 }
 
+int anx7625_audio_hw_params(struct device *dev, void *data,
+			    struct hdmi_codec_daifmt *fmt,
+			    struct hdmi_codec_params *params)
+{
+	struct anx7625_data *ctx = dev_get_drvdata(dev);
+	int wl, ch, rate;
+	int ret = 0;
+
+	if (fmt->fmt != HDMI_DSP_A) {
+		DRM_DEV_ERROR(dev, "only supports DSP_A\n");
+		return -EINVAL;
+	}
+
+	DRM_DEV_DEBUG_DRIVER(dev, "setting %d Hz, %d bit, %d channels\n",
+			     params->sample_rate, params->sample_width,
+			     params->cea.channels);
+
+	ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
+				    AUDIO_CHANNEL_STATUS_6,
+				    ~I2S_SLAVE_MODE,
+				    TDM_SLAVE_MODE);
+
+	/* Word length */
+	switch (params->sample_width) {
+	case 16:
+		wl = AUDIO_W_LEN_16_20MAX;
+		break;
+	case 18:
+		wl = AUDIO_W_LEN_18_20MAX;
+		break;
+	case 20:
+		wl = AUDIO_W_LEN_20_20MAX;
+		break;
+	case 24:
+		wl = AUDIO_W_LEN_24_24MAX;
+		break;
+	default:
+		DRM_DEV_DEBUG_DRIVER(dev, "wordlength: %d bit not support",
+				     params->sample_width);
+		return -EINVAL;
+	}
+	ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
+				    AUDIO_CHANNEL_STATUS_5,
+				    0xf0, wl);
+
+	/* Channel num */
+	switch (params->cea.channels) {
+	case 2:
+		ch = I2S_CH_2;
+		break;
+	case 4:
+		ch = TDM_CH_4;
+		break;
+	case 6:
+		ch = TDM_CH_6;
+		break;
+	case 8:
+		ch = TDM_CH_8;
+		break;
+	default:
+		DRM_DEV_DEBUG_DRIVER(dev, "channel number: %d not support",
+				     params->cea.channels);
+		return -EINVAL;
+	}
+	ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
+			       AUDIO_CHANNEL_STATUS_6, 0x1f, ch << 5);
+	if (ch > I2S_CH_2)
+		ret |= anx7625_write_or(ctx, ctx->i2c.tx_p2_client,
+				AUDIO_CHANNEL_STATUS_6, AUDIO_LAYOUT);
+	else
+		ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client,
+				AUDIO_CHANNEL_STATUS_6, ~AUDIO_LAYOUT);
+
+	/* FS */
+	switch (params->sample_rate) {
+	case 32000:
+		rate = AUDIO_FS_32K;
+		break;
+	case 44100:
+		rate = AUDIO_FS_441K;
+		break;
+	case 48000:
+		rate = AUDIO_FS_48K;
+		break;
+	case 88200:
+		rate = AUDIO_FS_882K;
+		break;
+	case 96000:
+		rate = AUDIO_FS_96K;
+		break;
+	case 176400:
+		rate = AUDIO_FS_1764K;
+		break;
+	case 192000:
+		rate = AUDIO_FS_192K;
+		break;
+	default:
+		DRM_DEV_DEBUG_DRIVER(dev, "sample rate: %d not support",
+				     params->sample_rate);
+		return -EINVAL;
+	}
+	ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
+				    AUDIO_CHANNEL_STATUS_4,
+				    0xf0, rate);
+	ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client,
+				AP_AV_STATUS, AP_AUDIO_CHG);
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev, "IO error : config audio.\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static void anx7625_audio_shutdown(struct device *dev, void *data)
+{
+	DRM_DEV_DEBUG_DRIVER(dev, "stop audio\n");
+}
+
+static int anx7625_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
+				       struct device_node *endpoint)
+{
+	struct of_endpoint of_ep;
+	int ret;
+
+	ret = of_graph_parse_endpoint(endpoint, &of_ep);
+	if (ret < 0)
+		return ret;
+
+	/*
+	 * HDMI sound should be located at external DPI port
+	 * Didn't have good way to check where is internal(DSI)
+	 * or external(DPI) bridge
+	 */
+	return 0;
+}
+
+static void
+anx7625_audio_update_connector_status(struct anx7625_data *ctx,
+				      enum drm_connector_status status)
+{
+	if (ctx->plugged_cb && ctx->codec_dev) {
+		ctx->plugged_cb(ctx->codec_dev,
+				status == connector_status_connected);
+	}
+}
+
+static int anx7625_audio_hook_plugged_cb(struct device *dev, void *data,
+					 hdmi_codec_plugged_cb fn,
+					 struct device *codec_dev)
+{
+	struct anx7625_data *ctx = data;
+
+	ctx->plugged_cb = fn;
+	ctx->codec_dev = codec_dev;
+	anx7625_audio_update_connector_status(ctx, anx7625_sink_detect(ctx));
+
+	return 0;
+}
+
+static const struct hdmi_codec_ops anx7625_codec_ops = {
+	.hw_params	= anx7625_audio_hw_params,
+	.audio_shutdown = anx7625_audio_shutdown,
+	.get_dai_id	= anx7625_hdmi_i2s_get_dai_id,
+	.hook_plugged_cb = anx7625_audio_hook_plugged_cb,
+};
+
+static void anx7625_unregister_audio(struct anx7625_data *ctx)
+{
+	struct device *dev = &ctx->client->dev;
+
+	if (ctx->audio_pdev) {
+		platform_device_unregister(ctx->audio_pdev);
+		ctx->audio_pdev = NULL;
+	}
+
+	DRM_DEV_DEBUG_DRIVER(dev, "unbound to %s", HDMI_CODEC_DRV_NAME);
+}
+
+static int anx7625_register_audio(struct device *dev, struct anx7625_data *ctx)
+{
+	struct hdmi_codec_pdata codec_data = {
+		.ops = &anx7625_codec_ops,
+		.max_i2s_channels = 8,
+		.i2s = 1,
+		.data = ctx,
+	};
+
+	ctx->audio_pdev = platform_device_register_data(dev,
+							HDMI_CODEC_DRV_NAME,
+							PLATFORM_DEVID_AUTO,
+							&codec_data,
+							sizeof(codec_data));
+
+	if (IS_ERR(ctx->audio_pdev))
+		return IS_ERR(ctx->audio_pdev);
+
+	DRM_DEV_DEBUG_DRIVER(dev, "bound to %s", HDMI_CODEC_DRV_NAME);
+
+	return 0;
+}
+
 static int anx7625_attach_dsi(struct anx7625_data *ctx)
 {
 	struct mipi_dsi_device *dsi;
@@ -2062,6 +2283,9 @@ static int anx7625_i2c_probe(struct i2c_client *client,
 				    DRM_MODE_CONNECTOR_DisplayPort;
 	drm_bridge_add(&platform->bridge);
 
+	if (platform->pdata.audio_en)
+		anx7625_register_audio(dev, platform);
+
 	DRM_DEV_DEBUG_DRIVER(dev, "probe done\n");
 
 	return 0;
@@ -2087,6 +2311,9 @@ static int anx7625_i2c_remove(struct i2c_client *client)
 
 	anx7625_unregister_i2c_dummy_clients(platform);
 
+	if (platform->pdata.audio_en)
+		anx7625_unregister_audio(platform);
+
 	kfree(platform);
 	return 0;
 }
drivers/gpu/drm/bridge/analogix/anx7625.h +5 -0
index c6f93e4..d6be2a8 100644
@@ -111,6 +111,7 @@
 #define AUDIO_CHANNEL_STATUS_6 0xd5
 #define TDM_SLAVE_MODE 0x10
 #define I2S_SLAVE_MODE 0x08
+#define AUDIO_LAYOUT   0x01
 
 #define AUDIO_CONTROL_REGISTER 0xe6
 #define TDM_TIMING_MODE 0x08
@@ -400,6 +401,7 @@ struct anx7625_platform_data {
 	int intp_irq;
 	int is_dpi;
 	int mipi_lanes;
+	int audio_en;
 	int dp_lane0_swing_reg_cnt;
 	int lane0_reg_data[DP_TX_SWING_REG_CNT];
 	int dp_lane1_swing_reg_cnt;
@@ -420,6 +422,7 @@ struct anx7625_i2c_client {
 
 struct anx7625_data {
 	struct anx7625_platform_data pdata;
+	struct platform_device *audio_pdev;
 	atomic_t power_status;
 	int hpd_status;
 	int hpd_high_cnt;
@@ -429,6 +432,8 @@ struct anx7625_data {
 	struct anx7625_i2c_client i2c;
 	struct i2c_client *last_client;
 	struct s_edid_data slimport_edid_p;
+	struct device *codec_dev;
+	hdmi_codec_plugged_cb plugged_cb;
 	struct work_struct work;
 	struct workqueue_struct *workqueue;
 	char edid_block;
Signature · 6 lines
2.7.4

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

Re: [PATCH v5 5/5] drm/bridge: anx7625: add HDMI audio function

Thank you for the patch! Perhaps something to improve:

Hi Xin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linux/master linus/master v5.12-rc3 next-20210318] [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/Xin-Ji/Add-MIPI-rx-DPI-support/20210319-104013
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: s390-allyesconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0

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
# https://github.com/0day-ci/linux/commit/ea2fa662ee036a3e1e2e25233653d7227b510b48
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xin-Ji/Add-MIPI-rx-DPI-support/20210319-104013 git checkout ea2fa662ee036a3e1e2e25233653d7227b510b48
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390

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

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/bridge/analogix/anx7625.c:1588:5: warning: no previous prototype for 'anx7625_audio_hw_params' [-Wmissing-prototypes]
    1588 | int anx7625_audio_hw_params(struct device *dev, void *data,
         |     ^~~~~~~~~~~~~~~~~~~~~~~

vim +/anx7625_audio_hw_params +1588 drivers/gpu/drm/bridge/analogix/anx7625.c

1587

> 1588	int anx7625_audio_hw_params(struct device *dev, void *data,
  1589				    struct hdmi_codec_daifmt *fmt,
  1590				    struct hdmi_codec_params *params)
  1591	{
  1592		struct anx7625_data *ctx = dev_get_drvdata(dev);
  1593		int wl, ch, rate;
  1594		int ret = 0;
  1595	
  1596		if (fmt->fmt != HDMI_DSP_A) {
  1597			DRM_DEV_ERROR(dev, "only supports DSP_A\n");
  1598			return -EINVAL;
  1599		}
  1600	
  1601		DRM_DEV_DEBUG_DRIVER(dev, "setting %d Hz, %d bit, %d channels\n",
  1602				     params->sample_rate, params->sample_width,
  1603				     params->cea.channels);
  1604	
  1605		ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
  1606					    AUDIO_CHANNEL_STATUS_6,
  1607					    ~I2S_SLAVE_MODE,
  1608					    TDM_SLAVE_MODE);

1609
1610 /* Word length */
1611 switch (params->sample_width) {
1612 case 16:
1613 wl = AUDIO_W_LEN_16_20MAX;
1614 break;
1615 case 18:
1616 wl = AUDIO_W_LEN_18_20MAX;
1617 break;
1618 case 20:
1619 wl = AUDIO_W_LEN_20_20MAX;
1620 break;
1621 case 24:
1622 wl = AUDIO_W_LEN_24_24MAX;
1623 break;
1624 default:
1625 DRM_DEV_DEBUG_DRIVER(dev, "wordlength: %d bit not support",
1626 params->sample_width);
1627 return -EINVAL;
1628 }
1629 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
1630 AUDIO_CHANNEL_STATUS_5,
1631 0xf0, wl);
1632
1633 /* Channel num */
1634 switch (params->cea.channels) {
1635 case 2:
1636 ch = I2S_CH_2;
1637 break;
1638 case 4:
1639 ch = TDM_CH_4;
1640 break;
1641 case 6:
1642 ch = TDM_CH_6;
1643 break;
1644 case 8:
1645 ch = TDM_CH_8;
1646 break;
1647 default:
1648 DRM_DEV_DEBUG_DRIVER(dev, "channel number: %d not support",
1649 params->cea.channels);
1650 return -EINVAL;
1651 }
1652 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
1653 AUDIO_CHANNEL_STATUS_6, 0x1f, ch << 5);
1654 if (ch > I2S_CH_2)
1655 ret |= anx7625_write_or(ctx, ctx->i2c.tx_p2_client,
1656 AUDIO_CHANNEL_STATUS_6, AUDIO_LAYOUT);
1657 else
1658 ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client,
1659 AUDIO_CHANNEL_STATUS_6, ~AUDIO_LAYOUT);
1660
1661 /* FS */
1662 switch (params->sample_rate) {
1663 case 32000:
1664 rate = AUDIO_FS_32K;
1665 break;
1666 case 44100:
1667 rate = AUDIO_FS_441K;
1668 break;
1669 case 48000:
1670 rate = AUDIO_FS_48K;
1671 break;
1672 case 88200:
1673 rate = AUDIO_FS_882K;
1674 break;
1675 case 96000:
1676 rate = AUDIO_FS_96K;
1677 break;
1678 case 176400:
1679 rate = AUDIO_FS_1764K;
1680 break;
1681 case 192000:
1682 rate = AUDIO_FS_192K;
1683 break;
1684 default:
1685 DRM_DEV_DEBUG_DRIVER(dev, "sample rate: %d not support",
1686 params->sample_rate);
1687 return -EINVAL;
1688 }
1689 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
1690 AUDIO_CHANNEL_STATUS_4,
1691 0xf0, rate);
1692 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client,
1693 AP_AV_STATUS, AP_AUDIO_CHG);
1694 if (ret < 0) {
1695 DRM_DEV_ERROR(dev, "IO error : config audio.\n");
1696 return -EIO;
1697 }
1698
1699 return 0;
1700 }
1701

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

#8 lore raw

Re: [PATCH v5 5/5] drm/bridge: anx7625: add HDMI audio function

In reply to Xin Ji
Thank you for the patch! Perhaps something to improve:

Hi Xin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linux/master linus/master v5.12-rc3 next-20210318] [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/Xin-Ji/Add-MIPI-rx-DPI-support/20210319-104013
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: i386-randconfig-s032-20210318 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-277-gc089cd2d-dirty
        # https://github.com/0day-ci/linux/commit/ea2fa662ee036a3e1e2e25233653d7227b510b48
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Xin-Ji/Add-MIPI-rx-DPI-support/20210319-104013
        git checkout ea2fa662ee036a3e1e2e25233653d7227b510b48
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

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

sparse warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/bridge/analogix/anx7625.c:1588:5: sparse: sparse: symbol 'anx7625_audio_hw_params' was not declared. Should it be static?

Please review and possibly fold the followup patch.

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

#9 lore raw

[RFC PATCH] drm/bridge: anx7625: anx7625_audio_hw_params() can be static

In reply to Xin Ji
Reported-by: kernel test robot <[email protected]>
---
 anx7625.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +3 -3
index f4653f2b58ad4..38bb8a9db216a 100644
@@ -1585,9 +1585,9 @@ static enum drm_connector_status anx7625_sink_detect(struct anx7625_data *ctx)
 				     connector_status_disconnected;
 }
 
-int anx7625_audio_hw_params(struct device *dev, void *data,
-			    struct hdmi_codec_daifmt *fmt,
-			    struct hdmi_codec_params *params)
+static int anx7625_audio_hw_params(struct device *dev, void *data,
+				   struct hdmi_codec_daifmt *fmt,
+				   struct hdmi_codec_params *params)
 {
 	struct anx7625_data *ctx = dev_get_drvdata(dev);
 	int wl, ch, rate;
#10 lore raw

Re: [PATCH v5 5/5] drm/bridge: anx7625: add HDMI audio function

In reply to Xin Ji
Thank you for the patch! Perhaps something to improve:

Hi Xin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linux/master linus/master v5.12-rc3 next-20210318] [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/Xin-Ji/Add-MIPI-rx-DPI-support/20210319-104013
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm-randconfig-r014-20210318 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project fcc1ce00931751ac02498986feb37744e9ace8de)

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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/ea2fa662ee036a3e1e2e25233653d7227b510b48
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xin-Ji/Add-MIPI-rx-DPI-support/20210319-104013 git checkout ea2fa662ee036a3e1e2e25233653d7227b510b48
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm

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

All warnings (new ones prefixed by >>):

drivers/gpu/drm/bridge/analogix/anx7625.c:1496:6: warning: variable 'mipi_lanes' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

           if (ep0) {
               ^~~
   drivers/gpu/drm/bridge/analogix/anx7625.c:1506:22: note: uninitialized use occurs here
           pdata->mipi_lanes = mipi_lanes;
                               ^~~~~~~~~~
   drivers/gpu/drm/bridge/analogix/anx7625.c:1496:2: note: remove the 'if' if its condition is always true
           if (ep0) {
           ^~~~~~~~~
   drivers/gpu/drm/bridge/analogix/anx7625.c:1484:26: note: initialize the variable 'mipi_lanes' to silence this warning
           int bus_type, mipi_lanes;
                                   ^
                                    = 0
   drivers/gpu/drm/bridge/analogix/anx7625.c:1496:6: warning: variable 'bus_type' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (ep0) {
               ^~~
   drivers/gpu/drm/bridge/analogix/anx7625.c:1503:6: note: uninitialized use occurs here
           if (bus_type == 5) /* bus type is Parallel(DSI) */
               ^~~~~~~~
   drivers/gpu/drm/bridge/analogix/anx7625.c:1496:2: note: remove the 'if' if its condition is always true
           if (ep0) {
           ^~~~~~~~~
   drivers/gpu/drm/bridge/analogix/anx7625.c:1484:14: note: initialize the variable 'bus_type' to silence this warning
           int bus_type, mipi_lanes;
                       ^
                        = 0
>> drivers/gpu/drm/bridge/analogix/anx7625.c:1588:5: warning: no previous prototype for function 'anx7625_audio_hw_params' [-Wmissing-prototypes]
   int anx7625_audio_hw_params(struct device *dev, void *data,
       ^

drivers/gpu/drm/bridge/analogix/anx7625.c:1588:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int anx7625_audio_hw_params(struct device *dev, void *data,
^
static
3 warnings generated.

vim +/anx7625_audio_hw_params +1588 drivers/gpu/drm/bridge/analogix/anx7625.c

1477
1478 static int anx7625_parse_dt(struct device *dev,
1479 struct anx7625_platform_data *pdata)
1480 {
1481 struct device_node *np = dev->of_node, *ep0;
1482 struct drm_panel *panel;
1483 int ret;
1484 int bus_type, mipi_lanes;
1485
1486 anx7625_get_swing_setting(dev, pdata);
1487
1488 pdata->is_dpi = 1; /* default dpi mode */
1489 pdata->mipi_host_node = of_graph_get_remote_node(np, 0, 0);
1490 if (!pdata->mipi_host_node) {
1491 DRM_DEV_ERROR(dev, "fail to get internal panel.\n");
1492 return -ENODEV;
1493 }
1494
1495 ep0 = of_graph_get_endpoint_by_regs(np, 0, 0);

> 1496		if (ep0) {
  1497			if (of_property_read_u32(ep0, "bus-type", &bus_type))
  1498				bus_type = 0;
  1499	
  1500			mipi_lanes = of_property_count_u32_elems(ep0, "data-lanes");
  1501		}
  1502	
  1503		if (bus_type == 5) /* bus type is Parallel(DSI) */
  1504			pdata->is_dpi = 0;
  1505	
  1506		pdata->mipi_lanes = mipi_lanes;
  1507		if (pdata->mipi_lanes > MAX_LANES_SUPPORT || pdata->mipi_lanes <= 0)
  1508			pdata->mipi_lanes = MAX_LANES_SUPPORT;
  1509	
  1510		if (pdata->is_dpi)
  1511			DRM_DEV_DEBUG_DRIVER(dev, "found MIPI DPI host node.\n");
  1512		else
  1513			DRM_DEV_DEBUG_DRIVER(dev, "found MIPI DSI host node.\n");
  1514	
  1515		if (of_property_read_bool(np, "analogix,audio-enable"))
  1516			pdata->audio_en = 1;
  1517	
  1518		ret = drm_of_find_panel_or_bridge(np, 1, 0, &panel, NULL);
  1519		if (ret < 0) {
  1520			if (ret == -ENODEV)
  1521				return 0;
  1522			return ret;
  1523		}
  1524		if (!panel)
  1525			return -ENODEV;
  1526	
  1527		pdata->panel_bridge = devm_drm_panel_bridge_add(dev, panel);
  1528		if (IS_ERR(pdata->panel_bridge))
  1529			return PTR_ERR(pdata->panel_bridge);
  1530		DRM_DEV_DEBUG_DRIVER(dev, "get panel node.\n");
  1531	
  1532		return 0;
  1533	}
  1534	
  1535	static inline struct anx7625_data *bridge_to_anx7625(struct drm_bridge *bridge)
  1536	{
  1537		return container_of(bridge, struct anx7625_data, bridge);
  1538	}
  1539	
  1540	static struct edid *anx7625_get_edid(struct anx7625_data *ctx)
  1541	{
  1542		struct device *dev = &ctx->client->dev;
  1543		struct s_edid_data *p_edid = &ctx->slimport_edid_p;
  1544		int edid_num;
  1545		u8 *edid;
  1546	
  1547		edid = kmalloc(FOUR_BLOCK_SIZE, GFP_KERNEL);
  1548		if (!edid) {
  1549			DRM_DEV_ERROR(dev, "Fail to allocate buffer\n");
  1550			return NULL;
  1551		}
  1552	
  1553		if (ctx->slimport_edid_p.edid_block_num > 0) {
  1554			memcpy(edid, ctx->slimport_edid_p.edid_raw_data,
  1555			       FOUR_BLOCK_SIZE);
  1556			return (struct edid *)edid;
  1557		}
  1558	
  1559		anx7625_low_power_mode_check(ctx, 1);
  1560		edid_num = sp_tx_edid_read(ctx, p_edid->edid_raw_data);
  1561		anx7625_low_power_mode_check(ctx, 0);
  1562	
  1563		if (edid_num < 1) {
  1564			DRM_DEV_ERROR(dev, "Fail to read EDID: %d\n", edid_num);
  1565			kfree(edid);
  1566			return NULL;
  1567		}
  1568	
  1569		p_edid->edid_block_num = edid_num;
  1570	
  1571		memcpy(edid, ctx->slimport_edid_p.edid_raw_data, FOUR_BLOCK_SIZE);
  1572		return (struct edid *)edid;
  1573	}
  1574	
  1575	static enum drm_connector_status anx7625_sink_detect(struct anx7625_data *ctx)
  1576	{
  1577		struct device *dev = &ctx->client->dev;
  1578	
  1579		DRM_DEV_DEBUG_DRIVER(dev, "sink detect\n");
  1580	
  1581		if (ctx->pdata.panel_bridge)
  1582			return connector_status_connected;
  1583	
  1584		return ctx->hpd_status ? connector_status_connected :
  1585					     connector_status_disconnected;
  1586	}
  1587	
> 1588	int anx7625_audio_hw_params(struct device *dev, void *data,
  1589				    struct hdmi_codec_daifmt *fmt,
  1590				    struct hdmi_codec_params *params)
  1591	{
  1592		struct anx7625_data *ctx = dev_get_drvdata(dev);
  1593		int wl, ch, rate;
  1594		int ret = 0;
  1595	
  1596		if (fmt->fmt != HDMI_DSP_A) {
  1597			DRM_DEV_ERROR(dev, "only supports DSP_A\n");
  1598			return -EINVAL;
  1599		}
  1600	
  1601		DRM_DEV_DEBUG_DRIVER(dev, "setting %d Hz, %d bit, %d channels\n",
  1602				     params->sample_rate, params->sample_width,
  1603				     params->cea.channels);
  1604	
  1605		ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
  1606					    AUDIO_CHANNEL_STATUS_6,
  1607					    ~I2S_SLAVE_MODE,
  1608					    TDM_SLAVE_MODE);

1609
1610 /* Word length */
1611 switch (params->sample_width) {
1612 case 16:
1613 wl = AUDIO_W_LEN_16_20MAX;
1614 break;
1615 case 18:
1616 wl = AUDIO_W_LEN_18_20MAX;
1617 break;
1618 case 20:
1619 wl = AUDIO_W_LEN_20_20MAX;
1620 break;
1621 case 24:
1622 wl = AUDIO_W_LEN_24_24MAX;
1623 break;
1624 default:
1625 DRM_DEV_DEBUG_DRIVER(dev, "wordlength: %d bit not support",
1626 params->sample_width);
1627 return -EINVAL;
1628 }
1629 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
1630 AUDIO_CHANNEL_STATUS_5,
1631 0xf0, wl);
1632
1633 /* Channel num */
1634 switch (params->cea.channels) {
1635 case 2:
1636 ch = I2S_CH_2;
1637 break;
1638 case 4:
1639 ch = TDM_CH_4;
1640 break;
1641 case 6:
1642 ch = TDM_CH_6;
1643 break;
1644 case 8:
1645 ch = TDM_CH_8;
1646 break;
1647 default:
1648 DRM_DEV_DEBUG_DRIVER(dev, "channel number: %d not support",
1649 params->cea.channels);
1650 return -EINVAL;
1651 }
1652 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
1653 AUDIO_CHANNEL_STATUS_6, 0x1f, ch << 5);
1654 if (ch > I2S_CH_2)
1655 ret |= anx7625_write_or(ctx, ctx->i2c.tx_p2_client,
1656 AUDIO_CHANNEL_STATUS_6, AUDIO_LAYOUT);
1657 else
1658 ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client,
1659 AUDIO_CHANNEL_STATUS_6, ~AUDIO_LAYOUT);
1660
1661 /* FS */
1662 switch (params->sample_rate) {
1663 case 32000:
1664 rate = AUDIO_FS_32K;
1665 break;
1666 case 44100:
1667 rate = AUDIO_FS_441K;
1668 break;
1669 case 48000:
1670 rate = AUDIO_FS_48K;
1671 break;
1672 case 88200:
1673 rate = AUDIO_FS_882K;
1674 break;
1675 case 96000:
1676 rate = AUDIO_FS_96K;
1677 break;
1678 case 176400:
1679 rate = AUDIO_FS_1764K;
1680 break;
1681 case 192000:
1682 rate = AUDIO_FS_192K;
1683 break;
1684 default:
1685 DRM_DEV_DEBUG_DRIVER(dev, "sample rate: %d not support",
1686 params->sample_rate);
1687 return -EINVAL;
1688 }
1689 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
1690 AUDIO_CHANNEL_STATUS_4,
1691 0xf0, rate);
1692 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client,
1693 AP_AV_STATUS, AP_AUDIO_CHG);
1694 if (ret < 0) {
1695 DRM_DEV_ERROR(dev, "IO error : config audio.\n");
1696 return -EIO;
1697 }
1698
1699 return 0;
1700 }
1701

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