[PATCH] media: atomisp: Remove redundant NULL check

2020-12-25 Thread Xu Wang
./drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c:390:2-8:
 WARNING: NULL check before some freeing functions is not needed.

Signed-off-by: Xu Wang 
---
 .../atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 
a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c
 
b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c
index 3e72dabe7ef6..13caa55fd51a 100644
--- 
a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c
+++ 
b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c
@@ -386,8 +386,7 @@ ia_css_isp_dvs_statistics_map_allocate(
 
return me;
 err:
-   if (me)
-   kvfree(me);
+   kvfree(me);
return NULL;
 }
 
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] media: atomisp: Remove redundant NULL check

2020-12-25 Thread Xu Wang
Fix warnings reported by coccicheck:
./drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c:159:4-10: 
WARNING: NULL check before some freeing functions is not needed.

Signed-off-by: Xu Wang 
---
 .../media/atomisp/pci/runtime/isp_param/src/isp_param.c| 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 
a/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c 
b/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c
index e861777385a0..823ec54b6281 100644
--- a/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c
+++ b/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c
@@ -155,8 +155,7 @@ ia_css_isp_param_destroy_isp_parameters(
 
for (mem = 0; mem < IA_CSS_NUM_MEMORIES; mem++) {
for (pclass = 0; pclass < IA_CSS_NUM_PARAM_CLASSES; pclass++) {
-   if (mem_params->params[pclass][mem].address)
-   kvfree(mem_params->params[pclass][mem].address);
+   kvfree(mem_params->params[pclass][mem].address);
if (css_params->params[pclass][mem].address)

hmm_free(css_params->params[pclass][mem].address);
mem_params->params[pclass][mem].address = NULL;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: board: description for CONFIG_STAGING_BOARD

2020-12-25 Thread Song Chen
A paragraph to describe what CONFIG_STAGING_BOARD is for,
to help developers have better understanding.

Signed-off-by: Song Chen 
---
 drivers/staging/board/Kconfig | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/board/Kconfig b/drivers/staging/board/Kconfig
index d0c6e42..64c7797 100644
--- a/drivers/staging/board/Kconfig
+++ b/drivers/staging/board/Kconfig
@@ -3,7 +3,10 @@ config STAGING_BOARD
bool "Staging Board Support"
depends on OF_ADDRESS && OF_IRQ && CLKDEV_LOOKUP
help
- Select to enable per-board staging support code.
-
- If in doubt, say N here.
+ Staging board base is to support continuous upstream
+ in-tree development and integration of platform devices.
 
+ Helps developers integrate devices as platform devices for
+ device drivers that only provide platform device bindings.
+ This in turn allows for incremental development of both
+ hardware feature support and DT binding work in parallel.
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: board: Remove macro board_staging

2020-12-25 Thread Song Chen
Macro is not supposed to have flow control in it's
statement, remove.

Signed-off-by: Song Chen 
---
 drivers/staging/board/armadillo800eva.c | 10 ++
 drivers/staging/board/board.h   | 11 ---
 drivers/staging/board/kzm9d.c   | 18 ++
 3 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/board/armadillo800eva.c 
b/drivers/staging/board/armadillo800eva.c
index 0225234..a7e8487 100644
--- a/drivers/staging/board/armadillo800eva.c
+++ b/drivers/staging/board/armadillo800eva.c
@@ -80,9 +80,11 @@ static const struct board_staging_dev 
armadillo800eva_devices[] __initconst = {
 
 static void __init armadillo800eva_init(void)
 {
-   board_staging_gic_setup_xlate("arm,pl390", 32);
-   board_staging_register_devices(armadillo800eva_devices,
-  ARRAY_SIZE(armadillo800eva_devices));
+   if (of_machine_is_compatible("renesas,armadillo800eva")) {
+   board_staging_gic_setup_xlate("arm,pl390", 32);
+   board_staging_register_devices(armadillo800eva_devices,
+  
ARRAY_SIZE(armadillo800eva_devices));
+   }
 }
 
-board_staging("renesas,armadillo800eva", armadillo800eva_init);
+device_initcall(armadillo800eva_init);
diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h
index 5609daf..f1c233e 100644
--- a/drivers/staging/board/board.h
+++ b/drivers/staging/board/board.h
@@ -32,15 +32,4 @@ int board_staging_register_device(const struct 
board_staging_dev *dev);
 void board_staging_register_devices(const struct board_staging_dev *devs,
unsigned int ndevs);
 
-#define board_staging(str, fn) \
-static int __init runtime_board_check(void)\
-{  \
-   if (of_machine_is_compatible(str))  \
-   fn();   \
-   \
-   return 0;   \
-}  \
-   \
-device_initcall(runtime_board_check)
-
 #endif /* __BOARD_H__ */
diff --git a/drivers/staging/board/kzm9d.c b/drivers/staging/board/kzm9d.c
index d449a83..72b1ad45 100644
--- a/drivers/staging/board/kzm9d.c
+++ b/drivers/staging/board/kzm9d.c
@@ -12,15 +12,17 @@ static struct resource usbs1_res[] __initdata = {
 
 static void __init kzm9d_init(void)
 {
-   board_staging_gic_setup_xlate("arm,pl390", 32);
+   if (of_machine_is_compatible("renesas,kzm9d")) {
+   board_staging_gic_setup_xlate("arm,pl390", 32);
 
-   if (!board_staging_dt_node_available(usbs1_res,
-ARRAY_SIZE(usbs1_res))) {
-   board_staging_gic_fixup_resources(usbs1_res,
- ARRAY_SIZE(usbs1_res));
-   platform_device_register_simple("emxx_udc", -1, usbs1_res,
-   ARRAY_SIZE(usbs1_res));
+   if (!board_staging_dt_node_available(usbs1_res,
+ARRAY_SIZE(usbs1_res))) {
+   board_staging_gic_fixup_resources(usbs1_res,
+ 
ARRAY_SIZE(usbs1_res));
+   platform_device_register_simple("emxx_udc", -1, 
usbs1_res,
+   ARRAY_SIZE(usbs1_res));
+   }
}
 }
 
-board_staging("renesas,kzm9d", kzm9d_init);
+device_initcall(kzm9d_init);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v1 2/2] drm/bridge: anx7625: add MIPI DPI input feature support

2020-12-25 Thread Xin Ji
Add MIPI rx DPI input support

Signed-off-by: Xin Ji 
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 352 --
 drivers/gpu/drm/bridge/analogix/anx7625.h |  24 +-
 2 files changed, 356 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c 
b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 65cc059..0bb2adc 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -164,6 +164,20 @@ static int anx7625_write_and_or(struct anx7625_data *ctx,
 offset, (val & and_mask) | (or_mask));
 }
 
+static int anx7625_config_bit_matrix(struct anx7625_data *ctx)
+{
+   int i, ret;
+
+   ret = anx7625_reg_write(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 ret;
+}
+
 static int anx7625_read_ctrl_status_p0(struct anx7625_data *ctx)
 {
return anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, AP_AUX_CTRL_STATUS);
@@ -189,10 +203,64 @@ 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 0;
+}
+
+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_write_and(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 val;
+   return 0;
 }
 
 static int anx7625_video_mute_control(struct anx7625_data *ctx,
@@ -595,6 +663,101 @@ 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_wr

[PATCH v1 0/2] Add MIPI rx DPI support

2020-12-25 Thread Xin Ji
Hi all, this patch series implement MIPI rx DPI feature. Please help to review.

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

Change history:
v1: initial MIPI rx DPI feature support

Xin Ji (2):
  dt-bindings: drm/bridge: anx7625: add DPI flag and swing setting
  drm/bridge: anx7625: add MIPI DPI input feature support

 .../bindings/display/bridge/analogix,anx7625.yaml  |  19 ++
 drivers/gpu/drm/bridge/analogix/anx7625.c  | 352 +++--
 drivers/gpu/drm/bridge/analogix/anx7625.h  |  24 +-
 3 files changed, 375 insertions(+), 20 deletions(-)

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel