Re: [PATCH v5 3/5] drm/bridge: anx7625: add MIPI DPI input feature support
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 Reported-by: kernel test robot 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", _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, , NULL); 1353 if (ret < 0) { 1354 if (ret == -ENODEV) 1355 return 0; 1356
[PATCH v5 3/5] drm/bridge: anx7625: add MIPI DPI input feature support
Add MIPI rx DPI input support. Reported-by: kernel test robot Signed-off-by: Xin Ji --- drivers/gpu/drm/bridge/analogix/anx7625.c | 243 ++ drivers/gpu/drm/bridge/analogix/anx7625.h | 18 ++- 2 files changed, 201 insertions(+), 60 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 04536cc..5c9b801 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -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 = >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 = >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 = >client->dev; +