* [PATCH v3 1/3] drm/bridge:anx7625: Refactoring timing programming
@ 2025-04-14 10:05 Xin Ji
2025-04-14 10:05 ` [PATCH v3 2/3] drm/mipi-dsi: Add compression supported flag in drm_mipi_dsi Xin Ji
2025-04-14 10:05 ` [PATCH v3 3/3] drm/bridge:anx7625: Enable DSC feature Xin Ji
0 siblings, 2 replies; 4+ messages in thread
From: Xin Ji @ 2025-04-14 10:05 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: bliang, qwen, treapking, Xin Ji, dri-devel, linux-kernel
Refactoring timing programming into two functions.
Signed-off-by: Xin Ji <xji@analogixsemi.com>
---
drivers/gpu/drm/bridge/analogix/anx7625.c | 124 ++++++++++++++--------
drivers/gpu/drm/bridge/analogix/anx7625.h | 4 +
2 files changed, 85 insertions(+), 43 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 0b61e77c0398..8928971558d2 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -476,11 +476,85 @@ static int anx7625_set_k_value(struct anx7625_data *ctx)
MIPI_DIGITAL_ADJ_1, 0x3D);
}
+static bool anx7625_dsc_check(struct anx7625_data *ctx)
+{
+ if (ctx->dt.pixelclock.min > DSC_PIXEL_CLOCK)
+ return true;
+
+ return false;
+}
+
+static inline int anx7625_h_timing_reg_write(struct anx7625_data *ctx,
+ struct i2c_client *client,
+ u8 reg_addr, u16 val,
+ bool dsc_check)
+{
+ int ret;
+
+ if (dsc_check && anx7625_dsc_check(ctx))
+ val = dsc_div(val);
+
+ ret = anx7625_reg_write(ctx, client, reg_addr, val);
+ ret |= anx7625_reg_write(ctx, client, reg_addr + 1, val >> 8);
+
+ return ret;
+}
+
+static int anx7625_h_timing_write(struct anx7625_data *ctx,
+ struct i2c_client *client,
+ bool dsc_check)
+{
+ u16 htotal;
+ int ret;
+
+ htotal = ctx->dt.hactive.min + ctx->dt.hfront_porch.min +
+ ctx->dt.hback_porch.min + ctx->dt.hsync_len.min;
+ /* Htotal */
+ ret = anx7625_h_timing_reg_write(ctx, client, HORIZONTAL_TOTAL_PIXELS_L,
+ htotal, dsc_check);
+ /* Hactive */
+ ret |= anx7625_h_timing_reg_write(ctx, client, HORIZONTAL_ACTIVE_PIXELS_L,
+ ctx->dt.hactive.min, dsc_check);
+ /* HFP */
+ ret |= anx7625_h_timing_reg_write(ctx, client, HORIZONTAL_FRONT_PORCH_L,
+ ctx->dt.hfront_porch.min, dsc_check);
+ /* HWS */
+ ret |= anx7625_h_timing_reg_write(ctx, client, HORIZONTAL_SYNC_WIDTH_L,
+ ctx->dt.hsync_len.min, dsc_check);
+ /* HBP */
+ ret |= anx7625_h_timing_reg_write(ctx, client, HORIZONTAL_BACK_PORCH_L,
+ ctx->dt.hback_porch.min, dsc_check);
+
+ return ret;
+}
+
+static int anx7625_v_timing_write(struct anx7625_data *ctx,
+ struct i2c_client *client)
+{
+ int ret;
+
+ /* Vactive */
+ ret = anx7625_reg_write(ctx, client, ACTIVE_LINES_L,
+ ctx->dt.vactive.min);
+ ret |= anx7625_reg_write(ctx, client, ACTIVE_LINES_H,
+ ctx->dt.vactive.min >> 8);
+ /* VFP */
+ ret |= anx7625_reg_write(ctx, client, VERTICAL_FRONT_PORCH,
+ ctx->dt.vfront_porch.min);
+ /* VWS */
+ ret |= anx7625_reg_write(ctx, client, VERTICAL_SYNC_WIDTH,
+ ctx->dt.vsync_len.min);
+ /* VBP */
+ ret |= anx7625_reg_write(ctx, client, VERTICAL_BACK_PORCH,
+ ctx->dt.vback_porch.min);
+
+ return ret;
+}
+
static int anx7625_dsi_video_timing_config(struct anx7625_data *ctx)
{
struct device *dev = ctx->dev;
unsigned long m, n;
- u16 htotal;
int ret;
u8 post_divider = 0;
@@ -506,48 +580,12 @@ static int anx7625_dsi_video_timing_config(struct anx7625_data *ctx)
ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client,
MIPI_LANE_CTRL_0, ctx->pdata.mipi_lanes - 1);
- /* Htotal */
- htotal = ctx->dt.hactive.min + ctx->dt.hfront_porch.min +
- ctx->dt.hback_porch.min + ctx->dt.hsync_len.min;
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client,
- HORIZONTAL_TOTAL_PIXELS_L, htotal & 0xFF);
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client,
- HORIZONTAL_TOTAL_PIXELS_H, htotal >> 8);
- /* Hactive */
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client,
- HORIZONTAL_ACTIVE_PIXELS_L, ctx->dt.hactive.min & 0xFF);
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client,
- HORIZONTAL_ACTIVE_PIXELS_H, ctx->dt.hactive.min >> 8);
- /* HFP */
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client,
- HORIZONTAL_FRONT_PORCH_L, ctx->dt.hfront_porch.min);
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client,
- HORIZONTAL_FRONT_PORCH_H,
- ctx->dt.hfront_porch.min >> 8);
- /* HWS */
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client,
- HORIZONTAL_SYNC_WIDTH_L, ctx->dt.hsync_len.min);
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client,
- HORIZONTAL_SYNC_WIDTH_H, ctx->dt.hsync_len.min >> 8);
- /* HBP */
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client,
- HORIZONTAL_BACK_PORCH_L, ctx->dt.hback_porch.min);
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client,
- HORIZONTAL_BACK_PORCH_H, ctx->dt.hback_porch.min >> 8);
- /* Vactive */
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, ACTIVE_LINES_L,
- ctx->dt.vactive.min);
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, ACTIVE_LINES_H,
- ctx->dt.vactive.min >> 8);
- /* VFP */
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client,
- VERTICAL_FRONT_PORCH, ctx->dt.vfront_porch.min);
- /* VWS */
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client,
- VERTICAL_SYNC_WIDTH, ctx->dt.vsync_len.min);
- /* VBP */
- ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client,
- VERTICAL_BACK_PORCH, ctx->dt.vback_porch.min);
+ /* Video Horizontal timing */
+ ret |= anx7625_h_timing_write(ctx, ctx->i2c.rx_p2_client, true);
+
+ /* Video Vertical timing */
+ ret |= anx7625_v_timing_write(ctx, ctx->i2c.rx_p2_client);
+
/* M value */
ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client,
MIPI_PLL_M_NUM_23_16, (m >> 16) & 0xff);
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.h b/drivers/gpu/drm/bridge/analogix/anx7625.h
index eb5580f1ab2f..df9efecae55a 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.h
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.h
@@ -166,6 +166,10 @@
#define HORIZONTAL_BACK_PORCH_L 0x21
#define HORIZONTAL_BACK_PORCH_H 0x22 /* Bit[7:4] are reserved */
+#define DSC_COMPRESS_RATIO 3
+#define dsc_div(X) ((X) / DSC_COMPRESS_RATIO)
+#define DSC_PIXEL_CLOCK 250000
+
/******** END of I2C Address 0x72 *********/
/***************************************************************/
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 2/3] drm/mipi-dsi: Add compression supported flag in drm_mipi_dsi
2025-04-14 10:05 [PATCH v3 1/3] drm/bridge:anx7625: Refactoring timing programming Xin Ji
@ 2025-04-14 10:05 ` Xin Ji
2025-04-14 10:05 ` [PATCH v3 3/3] drm/bridge:anx7625: Enable DSC feature Xin Ji
1 sibling, 0 replies; 4+ messages in thread
From: Xin Ji @ 2025-04-14 10:05 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter
Cc: bliang, qwen, treapking, Xin Ji, dri-devel, linux-kernel
Add compression_supported flag in struct drm_mipi_dsi to indicate
whether DSI host supported DSC compression feature.
Signed-off-by: Xin Ji <xji@analogixsemi.com>
---
include/drm/drm_mipi_dsi.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index bd40a443385c..c5ffb48182ef 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -99,11 +99,13 @@ struct mipi_dsi_host_ops {
/**
* struct mipi_dsi_host - DSI host device
* @dev: driver model device node for this DSI host
+ * @compression_supported: DSI host support DSC feature
* @ops: DSI host operations
* @list: list management
*/
struct mipi_dsi_host {
struct device *dev;
+ bool compression_supported;
const struct mipi_dsi_host_ops *ops;
struct list_head list;
};
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 3/3] drm/bridge:anx7625: Enable DSC feature
2025-04-14 10:05 [PATCH v3 1/3] drm/bridge:anx7625: Refactoring timing programming Xin Ji
2025-04-14 10:05 ` [PATCH v3 2/3] drm/mipi-dsi: Add compression supported flag in drm_mipi_dsi Xin Ji
@ 2025-04-14 10:05 ` Xin Ji
2025-04-15 14:26 ` kernel test robot
1 sibling, 1 reply; 4+ messages in thread
From: Xin Ji @ 2025-04-14 10:05 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: bliang, qwen, treapking, Xin Ji, dri-devel, linux-kernel
4K30(3840x2160 30Hz) timing pixel clock around 297M, for 24bits RGB
pixel data format, total transport bandwidth need 297M*24(at least
7.2Gbps) more than anx7625 mipi rx lane bandwidth(maximum 6Gbps,
4lanes, each lane 1.5Gbps). Without DSC function, anx7625 cannot
receive 4K30 video timing.
When display pixel clock exceed 250M, driver will enable DSC feature,
and the compression ratio is 3:1, eg: 4K30's pixel clock around 297M,
bandwidth 7.2G will be compressed to 7.2G/3 = 2.4G. Then anx7625
can receive 4K30 video timing and do decompress, then package video
data and send to sink device through DP link.
Anx7625 will check DSI host capability to make sure whether it support
compression feature, if not, anx7625 driver will limit maximum pixel
clock to 250M.
Note:
Anx7625 is bridge IC, sink monitor only receive normal DP signal from
anx7625, sink device didn't know DSC information between SOC and anx7625
v2:
1. Remove dsc_en flag
v3:
1. Split timing refactoring code to a individual patch.
2. Add drm_dsi_host compression_supported flag check. If DSI host not
supported compression, anx7625 bridge driver will limit maximum
pixel clock to 250M.
Signed-off-by: Xin Ji <xji@analogixsemi.com>
---
drivers/gpu/drm/bridge/analogix/anx7625.c | 191 ++++++++++++++++++++--
drivers/gpu/drm/bridge/analogix/anx7625.h | 26 +++
2 files changed, 203 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 8928971558d2..fe8ccd6bad96 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -9,6 +9,7 @@
#include <linux/interrupt.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
+#include <linux/math64.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/pm_runtime.h>
@@ -22,6 +23,7 @@
#include <drm/display/drm_dp_aux_bus.h>
#include <drm/display/drm_dp_helper.h>
+#include <drm/display/drm_dsc_helper.h>
#include <drm/display/drm_hdcp_helper.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
@@ -476,9 +478,14 @@ static int anx7625_set_k_value(struct anx7625_data *ctx)
MIPI_DIGITAL_ADJ_1, 0x3D);
}
-static bool anx7625_dsc_check(struct anx7625_data *ctx)
+static bool anx7625_dsc_check(struct anx7625_data *ctx, int pixelclock)
{
- if (ctx->dt.pixelclock.min > DSC_PIXEL_CLOCK)
+ struct mipi_dsi_host *host = ctx->host;
+
+ if (!host)
+ return false;
+
+ if (host->compression_supported && pixelclock > DSC_PIXEL_CLOCK)
return true;
return false;
@@ -491,7 +498,7 @@ static inline int anx7625_h_timing_reg_write(struct anx7625_data *ctx,
{
int ret;
- if (dsc_check && anx7625_dsc_check(ctx))
+ if (dsc_check && anx7625_dsc_check(ctx, ctx->dt.pixelclock.min))
val = dsc_div(val);
ret = anx7625_reg_write(ctx, client, reg_addr, val);
@@ -551,6 +558,79 @@ static int anx7625_v_timing_write(struct anx7625_data *ctx,
return ret;
}
+static int anx7625_set_dsc_params(struct anx7625_data *ctx)
+{
+ int ret, i;
+ u16 htotal, vtotal;
+
+ /* Video Horizontal timing */
+ ret = anx7625_h_timing_write(ctx, ctx->i2c.tx_p2_client, false);
+
+ /* Video Vertical timing */
+ ret |= anx7625_v_timing_write(ctx, ctx->i2c.tx_p2_client);
+
+ /* Vtotal */
+ vtotal = ctx->dt.vactive.min + ctx->dt.vfront_porch.min +
+ ctx->dt.vback_porch.min + ctx->dt.vsync_len.min;
+ ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, TOTAL_LINES_L,
+ vtotal);
+ ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, TOTAL_LINES_H,
+ vtotal >> 8);
+ /* Htotal */
+ htotal = ctx->dt.hactive.min + ctx->dt.hfront_porch.min +
+ ctx->dt.hback_porch.min + ctx->dt.hsync_len.min;
+ ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, TOTAL_PIXEL_L_7E,
+ htotal);
+ ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, TOTAL_PIXEL_H_7E,
+ htotal >> 8);
+ /* Hactive */
+ ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+ ACTIVE_PIXEL_L_7E, ctx->dt.hactive.min);
+ ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+ ACTIVE_PIXEL_H_7E, ctx->dt.hactive.min >> 8);
+ /* HFP */
+ ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+ HORIZON_FRONT_PORCH_L_7E,
+ ctx->dt.hfront_porch.min);
+ ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+ HORIZON_FRONT_PORCH_H_7E,
+ ctx->dt.hfront_porch.min >> 8);
+ /* HWS */
+ ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+ HORIZON_SYNC_WIDTH_L_7E,
+ ctx->dt.hsync_len.min);
+ ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+ HORIZON_SYNC_WIDTH_H_7E,
+ ctx->dt.hsync_len.min >> 8);
+ /* HBP */
+ ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+ HORIZON_BACK_PORCH_L_7E,
+ ctx->dt.hback_porch.min);
+ ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
+ HORIZON_BACK_PORCH_H_7E,
+ ctx->dt.hback_porch.min >> 8);
+
+ /* Config DSC decoder internal blank timing for decoder to start */
+ ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client,
+ H_BLANK_L,
+ dsc_div(htotal - ctx->dt.hactive.min));
+ ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client,
+ H_BLANK_H,
+ dsc_div(htotal - ctx->dt.hactive.min) >> 8);
+
+ /* Compress ratio RATIO bit[7:6] */
+ ret |= anx7625_write_and(ctx, ctx->i2c.rx_p0_client, R_I2C_1, 0x3F);
+ ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client, R_I2C_1,
+ (5 - DSC_COMPRESS_RATIO) << 6);
+ /*PPS table*/
+ for (i = 0; i < PPS_SIZE; i += PPS_BLOCK_SIZE)
+ ret |= anx7625_reg_block_write(ctx, ctx->i2c.rx_p2_client,
+ R_PPS_REG_0 + i, PPS_BLOCK_SIZE,
+ &ctx->pps_table[i]);
+
+ return ret;
+}
+
static int anx7625_dsi_video_timing_config(struct anx7625_data *ctx)
{
struct device *dev = ctx->dev;
@@ -697,13 +777,20 @@ static int anx7625_api_dsi_config(struct anx7625_data *ctx)
static int anx7625_dsi_config(struct anx7625_data *ctx)
{
struct device *dev = ctx->dev;
- int ret;
+ int ret = 0;
DRM_DEV_DEBUG_DRIVER(dev, "config dsi.\n");
- /* DSC disable */
- ret = anx7625_write_and(ctx, ctx->i2c.rx_p0_client,
- R_DSC_CTRL_0, ~DSC_EN);
+ if (anx7625_dsc_check(ctx, ctx->dt.pixelclock.min)) {
+ ret = anx7625_set_dsc_params(ctx);
+ /* DSC enable */
+ ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client,
+ R_DSC_CTRL_0, DSC_EN);
+ } else {
+ /* DSC disable */
+ ret = anx7625_write_and(ctx, ctx->i2c.rx_p0_client,
+ R_DSC_CTRL_0, ~DSC_EN);
+ }
ret |= anx7625_api_dsi_config(ctx);
@@ -2121,6 +2208,8 @@ static int anx7625_setup_dsi_device(struct anx7625_data *ctx)
MIPI_DSI_MODE_VIDEO_HSE |
MIPI_DSI_HS_PKT_END_ALIGNED;
+ dsi->host = host;
+ dsi->dsc = &ctx->dsc;
ctx->dsi = dsi;
return 0;
@@ -2224,21 +2313,79 @@ anx7625_bridge_mode_valid(struct drm_bridge *bridge,
{
struct anx7625_data *ctx = bridge_to_anx7625(bridge);
struct device *dev = ctx->dev;
+ int maximum_pixelclock = SUPPORT_PIXEL_CLOCK;
DRM_DEV_DEBUG_DRIVER(dev, "drm mode checking\n");
+ if (!ctx->host->compression_supported) {
+ DRM_DEV_DEBUG_DRIVER(dev, "host not support DSC");
+ maximum_pixelclock = DSC_PIXEL_CLOCK;
+ }
- /* Max 1200p at 5.4 Ghz, one lane, pixel clock 300M */
- if (mode->clock > SUPPORT_PIXEL_CLOCK) {
+ if (mode->clock > maximum_pixelclock) {
DRM_DEV_DEBUG_DRIVER(dev,
"drm mode invalid, pixelclock too high.\n");
return MODE_CLOCK_HIGH;
}
+ if (mode->clock < SUPPORT_MIN_PIXEL_CLOCK)
+ return MODE_CLOCK_LOW;
+
+ /*
+ * If hdisplay cannot be divided by DSC compress ratio, then display
+ * will have overlap/shift issue
+ */
+ if (mode->clock > DSC_PIXEL_CLOCK &&
+ (mode->hdisplay % DSC_COMPRESS_RATIO != 0))
+ return MODE_CLOCK_HIGH;
+
DRM_DEV_DEBUG_DRIVER(dev, "drm mode valid.\n");
return MODE_OK;
}
+static void anx7625_dsc_enable(struct anx7625_data *ctx, bool en)
+{
+ int ret;
+ struct device *dev = ctx->dev;
+
+ if (en) {
+ ctx->dsc.dsc_version_major = 1;
+ ctx->dsc.dsc_version_minor = 1;
+ ctx->dsc.slice_height = 8;
+ ctx->dsc.slice_width = ctx->dt.hactive.min / DSC_SLICE_NUM;
+ ctx->dsc.slice_count = DSC_SLICE_NUM;
+ ctx->dsc.bits_per_component = 8;
+ ctx->dsc.bits_per_pixel = 8 << 4; /* 4 fractional bits */
+ ctx->dsc.block_pred_enable = true;
+ ctx->dsc.native_420 = false;
+ ctx->dsc.native_422 = false;
+ ctx->dsc.simple_422 = false;
+ ctx->dsc.vbr_enable = false;
+ ctx->dsc.convert_rgb = 1;
+
+ drm_dsc_set_rc_buf_thresh(&ctx->dsc);
+ drm_dsc_set_const_params(&ctx->dsc);
+
+ ctx->dsc.initial_scale_value = drm_dsc_initial_scale_value(&ctx->dsc);
+ ctx->dsc.line_buf_depth = ctx->dsc.bits_per_component + 1;
+ ret = drm_dsc_setup_rc_params(&ctx->dsc, DRM_DSC_1_2_444);
+ if (ret < 0)
+ dev_warn(dev, "drm_dsc_setup_rc_params ret %d\n", ret);
+
+ ret = drm_dsc_compute_rc_parameters(&ctx->dsc);
+ if (ret)
+ dev_warn(dev, "drm dsc compute rc parameters failed ret %d\n", ret);
+
+ drm_dsc_pps_payload_pack((struct drm_dsc_picture_parameter_set *)&ctx->pps_table,
+ &ctx->dsc);
+ dev_dbg(dev, "anx7625 enable dsc\n");
+ } else {
+ ctx->dsc.dsc_version_major = 0;
+ ctx->dsc.dsc_version_minor = 0;
+ dev_dbg(dev, "anx7625 disable dsc\n");
+ }
+}
+
static void anx7625_bridge_mode_set(struct drm_bridge *bridge,
const struct drm_display_mode *old_mode,
const struct drm_display_mode *mode)
@@ -2283,6 +2430,8 @@ static void anx7625_bridge_mode_set(struct drm_bridge *bridge,
DRM_DEV_DEBUG_DRIVER(dev, "vsync_end(%d),vtotal(%d).\n",
mode->vsync_end,
mode->vtotal);
+
+ anx7625_dsc_enable(ctx, anx7625_dsc_check(ctx, ctx->dt.pixelclock.min));
}
static bool anx7625_bridge_mode_fixup(struct drm_bridge *bridge,
@@ -2297,10 +2446,6 @@ 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;
@@ -2311,12 +2456,24 @@ static bool anx7625_bridge_mode_fixup(struct drm_bridge *bridge,
hsync, hfp, hbp, adj->clock);
DRM_DEV_DEBUG_DRIVER(dev, "hsync_start(%d), hsync_end(%d), htot(%d)\n",
adj->hsync_start, adj->hsync_end, adj->htotal);
-
adj_hfp = hfp;
adj_hsync = hsync;
adj_hbp = hbp;
adj_hblanking = hblanking;
+ if (anx7625_dsc_check(ctx, mode->clock)) {
+ adj_hsync = DSC_HSYNC_LEN;
+ adj_hfp = DSC_HFP_LEN;
+ adj_hbp = DSC_HBP_LEN;
+ vref = (u32)div_u64((u64)adj->clock * 1000 * 1000,
+ adj->htotal * adj->vtotal);
+ goto calculate_timing;
+ }
+
+ /* No need fixup for external monitor */
+ if (!ctx->pdata.panel_bridge)
+ return true;
+
/* HFP needs to be even */
if (hfp & 0x1) {
adj_hfp += 1;
@@ -2388,6 +2545,8 @@ static bool anx7625_bridge_mode_fixup(struct drm_bridge *bridge,
adj_hfp -= delta_adj;
}
+calculate_timing:
+
DRM_DEV_DEBUG_DRIVER(dev, "after mode fixup\n");
DRM_DEV_DEBUG_DRIVER(dev, "hsync(%d), hfp(%d), hbp(%d), clock(%d)\n",
adj_hsync, adj_hfp, adj_hbp, adj->clock);
@@ -2396,6 +2555,10 @@ static bool anx7625_bridge_mode_fixup(struct drm_bridge *bridge,
adj->hsync_start = adj->hdisplay + adj_hfp;
adj->hsync_end = adj->hsync_start + adj_hsync;
adj->htotal = adj->hsync_end + adj_hbp;
+ if (anx7625_dsc_check(ctx, mode->clock))
+ adj->clock = (u32)div_u64((u64)vref * adj->htotal * adj->vtotal,
+ 1000 * 1000);
+
DRM_DEV_DEBUG_DRIVER(dev, "hsync_start(%d), hsync_end(%d), htot(%d)\n",
adj->hsync_start, adj->hsync_end, adj->htotal);
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.h b/drivers/gpu/drm/bridge/analogix/anx7625.h
index df9efecae55a..e0953864062a 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.h
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.h
@@ -149,6 +149,8 @@
#define HFP_HBP_DEF ((HBLANKING_MIN - SYNC_LEN_DEF) / 2)
#define VIDEO_CONTROL_0 0x08
+#define TOTAL_LINES_L 0x12
+#define TOTAL_LINES_H 0x13
#define ACTIVE_LINES_L 0x14
#define ACTIVE_LINES_H 0x15 /* Bit[7:6] are reserved */
#define VERTICAL_FRONT_PORCH 0x16
@@ -168,7 +170,27 @@
#define DSC_COMPRESS_RATIO 3
#define dsc_div(X) ((X) / DSC_COMPRESS_RATIO)
+#define DSC_SLICE_NUM 2
#define DSC_PIXEL_CLOCK 250000
+#define DSC_HSYNC_LEN 90
+#define DSC_HFP_LEN 177
+#define DSC_HBP_LEN 297
+
+#define TOTAL_PIXEL_L_7E 0x50
+#define TOTAL_PIXEL_H_7E 0x51 /* bit[7:6] are reserved */
+#define ACTIVE_PIXEL_L_7E 0x52
+#define ACTIVE_PIXEL_H_7E 0x53 /* bit[7:6] are reserved */
+#define HORIZON_FRONT_PORCH_L_7E 0x54
+#define HORIZON_FRONT_PORCH_H_7E 0x55
+#define HORIZON_SYNC_WIDTH_L_7E 0x56
+#define HORIZON_SYNC_WIDTH_H_7E 0x57
+#define HORIZON_BACK_PORCH_L_7E 0x58
+#define HORIZON_BACK_PORCH_H_7E 0x59
+
+#define PPS_SIZE 128
+#define PPS_BLOCK_SIZE 32
+#define R_PPS_REG_0 0x80
+#define R_I2C_1 0x81
/******** END of I2C Address 0x72 *********/
@@ -419,6 +441,7 @@ enum audio_wd_len {
#define MAX_EDID_BLOCK 3
#define EDID_TRY_CNT 3
#define SUPPORT_PIXEL_CLOCK 300000
+#define SUPPORT_MIN_PIXEL_CLOCK 38000
/***************** Display End *****************/
@@ -482,7 +505,10 @@ struct anx7625_data {
u8 bridge_attached;
struct drm_connector *connector;
struct mipi_dsi_device *dsi;
+ struct mipi_dsi_host *host;
struct drm_dp_aux aux;
+ struct drm_dsc_config dsc;
+ char pps_table[PPS_SIZE];
};
#endif /* __ANX7625_H__ */
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3 3/3] drm/bridge:anx7625: Enable DSC feature
2025-04-14 10:05 ` [PATCH v3 3/3] drm/bridge:anx7625: Enable DSC feature Xin Ji
@ 2025-04-15 14:26 ` kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-04-15 14:26 UTC (permalink / raw)
To: Xin Ji, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter
Cc: oe-kbuild-all, bliang, qwen, treapking, Xin Ji, dri-devel,
linux-kernel
Hi Xin,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.15-rc2 next-20250415]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Xin-Ji/drm-mipi-dsi-Add-compression-supported-flag-in-drm_mipi_dsi/20250414-181005
base: linus/master
patch link: https://lore.kernel.org/r/20250414100502.1604717-3-xji%40analogixsemi.com
patch subject: [PATCH v3 3/3] drm/bridge:anx7625: Enable DSC feature
config: arm64-randconfig-002-20250415 (https://download.01.org/0day-ci/archive/20250415/202504152230.BCIdpiru-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250415/202504152230.BCIdpiru-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504152230.BCIdpiru-lkp@intel.com/
All errors (new ones prefixed by >>):
aarch64-linux-ld: Unexpected GOT/PLT entries detected!
aarch64-linux-ld: Unexpected run-time procedure linkages detected!
aarch64-linux-ld: drivers/gpu/drm/bridge/analogix/anx7625.o: in function `anx7625_bridge_mode_set':
>> anx7625.c:(.text+0x28d4): undefined reference to `drm_dsc_set_rc_buf_thresh'
>> aarch64-linux-ld: anx7625.c:(.text+0x28dc): undefined reference to `drm_dsc_set_const_params'
>> aarch64-linux-ld: anx7625.c:(.text+0x28e4): undefined reference to `drm_dsc_initial_scale_value'
>> aarch64-linux-ld: anx7625.c:(.text+0x2900): undefined reference to `drm_dsc_setup_rc_params'
>> aarch64-linux-ld: anx7625.c:(.text+0x290c): undefined reference to `drm_dsc_compute_rc_parameters'
>> aarch64-linux-ld: anx7625.c:(.text+0x2930): undefined reference to `drm_dsc_pps_payload_pack'
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-15 14:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 10:05 [PATCH v3 1/3] drm/bridge:anx7625: Refactoring timing programming Xin Ji
2025-04-14 10:05 ` [PATCH v3 2/3] drm/mipi-dsi: Add compression supported flag in drm_mipi_dsi Xin Ji
2025-04-14 10:05 ` [PATCH v3 3/3] drm/bridge:anx7625: Enable DSC feature Xin Ji
2025-04-15 14:26 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox