Re: [PATCH v2 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver

2019-10-15 Thread Dan Carpenter
[  These are automated text from the 0-day bot -dan ]

Hi Xin,

Thank you for the patch! Perhaps something to improve:

url:
https://github.com/0day-ci/linux/commits/Xin-Ji/dt-bindings-drm-bridge-anx7625-MIPI-to-DP-transmitter-binding/20191014-043019

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 
Reported-by: Dan Carpenter 

New smatch warnings:
drivers/gpu/drm/bridge/analogix/anx7625.c:1274 anx7625_start_dp_work() error: 
uninitialized symbol 'sp_tx_lane_count'.

# 
https://github.com/0day-ci/linux/commit/152a82b6747f10d6c13c7a422173947c2f2e1aa2
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 152a82b6747f10d6c13c7a422173947c2f2e1aa2
vim +/sp_tx_lane_count +1274 drivers/gpu/drm/bridge/analogix/anx7625.c

152a82b6747f10 Xin Ji 2019-10-11  1253  static void 
anx7625_start_dp_work(struct anx7625_data *ctx)
152a82b6747f10 Xin Ji 2019-10-11  1254  {
152a82b6747f10 Xin Ji 2019-10-11  1255  int ret;
152a82b6747f10 Xin Ji 2019-10-11  1256  u8 buf[MAX_DPCD_BUFFER_SIZE];
152a82b6747f10 Xin Ji 2019-10-11  1257  u8 hdcp_cap;
152a82b6747f10 Xin Ji 2019-10-11  1258  struct device *dev = 
>client->dev;
152a82b6747f10 Xin Ji 2019-10-11  1259  u8 sp_tx_bw; /* linktraining 
banwidth */
152a82b6747f10 Xin Ji 2019-10-11  1260  u8 sp_tx_lane_count; /* link 
training lane count */
152a82b6747f10 Xin Ji 2019-10-11  1261  
152a82b6747f10 Xin Ji 2019-10-11  1262  if (ctx->hpd_high_cnt >= 2) {
152a82b6747f10 Xin Ji 2019-10-11  1263  
DRM_DEV_DEBUG_DRIVER(dev, "anx7625 filter useless HPD\n");
152a82b6747f10 Xin Ji 2019-10-11  1264  return;
152a82b6747f10 Xin Ji 2019-10-11  1265  }
152a82b6747f10 Xin Ji 2019-10-11  1266  
152a82b6747f10 Xin Ji 2019-10-11  1267  ctx->hpd_high_cnt++;
152a82b6747f10 Xin Ji 2019-10-11  1268  
152a82b6747f10 Xin Ji 2019-10-11  1269  sp_tx_get_rx_bw(ctx, _tx_bw);
152a82b6747f10 Xin Ji 2019-10-11  1270  
152a82b6747f10 Xin Ji 2019-10-11  1271  sp_tx_aux_dpcdread_bytes(ctx, 
0x00, 0x00, DPCD_MAX_LANE_COUNT,
152a82b6747f10 Xin Ji 2019-10-11  1272   1, 
_tx_lane_count);

^
Smatch thinks sp_tx_aux_dpcdread_bytes() can fail and we don't check
for errors.

152a82b6747f10 Xin Ji 2019-10-11  1273  
152a82b6747f10 Xin Ji 2019-10-11 @1274  sp_tx_lane_count = 
sp_tx_lane_count & 0x1f;
152a82b6747f10 Xin Ji 2019-10-11  1275  sp_tx_aux_dpcdread_bytes(ctx, 
0x06, 0x80, 0x28, 1, buf);/* read Bcap */
152a82b6747f10 Xin Ji 2019-10-11  1276  
152a82b6747f10 Xin Ji 2019-10-11  1277  hdcp_cap = buf[0] & 0x01;
152a82b6747f10 Xin Ji 2019-10-11  1278  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver

2019-10-14 Thread kbuild test robot
Hi Xin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[cannot apply to v5.4-rc3 next-20191011]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:
https://github.com/0day-ci/linux/commits/Xin-Ji/dt-bindings-drm-bridge-anx7625-MIPI-to-DP-transmitter-binding/20191014-043019
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-rc1-43-g0ccb3b4-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 


sparse warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/bridge/analogix/anx7625.c:731:10: sparse: sparse: symbol 
>> 'ANX_OUI' was not declared. Should it be static?

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


Re: [PATCH v2 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver

2019-10-10 Thread Xin Ji
Hi Dan Carpenter,

This is a bug, I'll fix it right now.

The coding is much nicer than before, thanks for your comments,
it is very helpful for me.

Thanks,
Xin


On Thu, Oct 10, 2019 at 12:56:17PM +0300, Dan Carpenter wrote:
> On Thu, Oct 10, 2019 at 12:53:15PM +0300, Dan Carpenter wrote:
> > This code is *so* much nicer than before.  I hope you feel good about
> > the changes.  It makes me happy to look at this code now.
> > 
> > On Thu, Oct 10, 2019 at 09:34:19AM +, Xin Ji wrote:
> > > +static int edid_read(struct anx7625_data *ctx,
> > > +  u8 offset, u8 *pblock_buf)
> > > +{
> > > + int ret, cnt;
> > > + struct device *dev = >client->dev;
> > > +
> > > + for (cnt = 0; cnt < EDID_TRY_CNT; cnt++) {
>   ^
> 
> > > + sp_tx_aux_wr(ctx, offset);
> > > + /* set I2C read com 0x01 mot = 0 and read 16 bytes */
> > > + ret = sp_tx_aux_rd(ctx, 0xf1);
> > > +
> > > + if (ret) {
> > > + sp_tx_rst_aux(ctx);
> > > + DRM_DEV_DEBUG_DRIVER(dev, "edid read failed, reset!\n");
> > > + cnt++;
> ^
> 
> I mean that it's incremented twice, yeah?
> 
> regards,
> dan carpenter


Re: [PATCH v2 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver

2019-10-10 Thread Dan Carpenter
On Thu, Oct 10, 2019 at 12:53:15PM +0300, Dan Carpenter wrote:
> This code is *so* much nicer than before.  I hope you feel good about
> the changes.  It makes me happy to look at this code now.
> 
> On Thu, Oct 10, 2019 at 09:34:19AM +, Xin Ji wrote:
> > +static int edid_read(struct anx7625_data *ctx,
> > +u8 offset, u8 *pblock_buf)
> > +{
> > +   int ret, cnt;
> > +   struct device *dev = >client->dev;
> > +
> > +   for (cnt = 0; cnt < EDID_TRY_CNT; cnt++) {
  ^

> > +   sp_tx_aux_wr(ctx, offset);
> > +   /* set I2C read com 0x01 mot = 0 and read 16 bytes */
> > +   ret = sp_tx_aux_rd(ctx, 0xf1);
> > +
> > +   if (ret) {
> > +   sp_tx_rst_aux(ctx);
> > +   DRM_DEV_DEBUG_DRIVER(dev, "edid read failed, reset!\n");
> > +   cnt++;
^

I mean that it's incremented twice, yeah?

regards,
dan carpenter

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver

2019-10-10 Thread Dan Carpenter
This code is *so* much nicer than before.  I hope you feel good about
the changes.  It makes me happy to look at this code now.

On Thu, Oct 10, 2019 at 09:34:19AM +, Xin Ji wrote:
> +static int edid_read(struct anx7625_data *ctx,
> +  u8 offset, u8 *pblock_buf)
> +{
> + int ret, cnt;
> + struct device *dev = >client->dev;
> +
> + for (cnt = 0; cnt < EDID_TRY_CNT; cnt++) {
> + sp_tx_aux_wr(ctx, offset);
> + /* set I2C read com 0x01 mot = 0 and read 16 bytes */
> + ret = sp_tx_aux_rd(ctx, 0xf1);
> +
> + if (ret) {
> + sp_tx_rst_aux(ctx);
> + DRM_DEV_DEBUG_DRIVER(dev, "edid read failed, reset!\n");
> + cnt++;

I don't think you should increment cnt.  It's just a counter.

> + } else {
> + ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client,
> +  AP_AUX_BUFF_START,
> +  MAX_DPCD_BUFFER_SIZE,
> +  pblock_buf);
> + if (!ret)
> + break;
> + }
> + }
> +
> + if (cnt == EDID_TRY_CNT)

And it could mean that "cnt > EDID_TRY_CNT".

> + return -EIO;
> +
> + return 0;
> +}
> +
> +static int segments_edid_read(struct anx7625_data *ctx,
> +   u8 segment, u8 *buf, u8 offset)
> +{
> + u8 cnt;
> + int ret;
> + struct device *dev = >client->dev;
> +
> + /* write address only */
> + ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
> + AP_AUX_ADDR_7_0, 0x30);
> + ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
> +  AP_AUX_COMMAND, 0x04);
> + ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
> +  AP_AUX_CTRL_STATUS,
> +  AP_AUX_CTRL_ADDRONLY | AP_AUX_CTRL_OP_EN);
> +
> + ret |= wait_aux_op_finish(ctx);
> + /* write segment address */
> + ret |= sp_tx_aux_wr(ctx, segment);
> + /* data read */
> + ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
> +  AP_AUX_ADDR_7_0, 0x50);
> + if (ret) {
> + DRM_ERROR("IO error : aux initial failed.\n");
> + return ret;
> + }
> +
> + for (cnt = 0; cnt < EDID_TRY_CNT; cnt++) {
> + sp_tx_aux_wr(ctx, offset);
> + /* set I2C read com 0x01 mot = 0 and read 16 bytes */
> + ret = sp_tx_aux_rd(ctx, 0xf1);
> +
> + if (ret) {
> + ret = sp_tx_rst_aux(ctx);
> + DRM_DEV_ERROR(dev, "segment read failed, reset!\n");
> + cnt++;

Same.

> + } else {
> + ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client,
> +  AP_AUX_BUFF_START,
> +  MAX_DPCD_BUFFER_SIZE, buf);
> + if (!ret)
> + break;
> + }
> + }
> +
> + if (cnt == EDID_TRY_CNT)
> + return -EIO;
> +
> + return 0;
> +}

regards,
dan carpenter
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver

2019-10-09 Thread Xin Ji
Hi Dan Carpenter, sorry for that, I send the wrong patch, I didn't
correctly merge the changed code. Will send the new patch based on your
new comments.

Thanks,
Xin

On Wed, Oct 09, 2019 at 02:30:32PM +0300, Dan Carpenter wrote:
> Are you sure you sent the correct patch?  This has many of the same
> style issues I mentioned in the previous email.  The error handling
> in edid_read() is wrong.  probe() will still crash if allocating the
> work queue fails.
> 
> On Wed, Oct 09, 2019 at 09:28:02AM +, Xin Ji wrote:
> > The ANX7625 is an ultra-low power 4K Mobile HD Transmitter designed
> > for portable device. It converts MIPI DSI/DPI to DisplayPort 1.3 4K.
> > 
> > The ANX7625 can support both USB Type-C PD feature and MIPI DSI/DPI
> > to DP feature. This driver only enabled MIPI DSI/DPI to DP feature.
> > 
> > Signed-off-by: Xin Ji 
> > ---
> >  drivers/gpu/drm/bridge/Makefile   |2 +-
> >  drivers/gpu/drm/bridge/analogix/Kconfig   |6 +
> >  drivers/gpu/drm/bridge/analogix/Makefile  |1 +
> >  drivers/gpu/drm/bridge/analogix/anx7625.c | 2132 
> > +
> >  drivers/gpu/drm/bridge/analogix/anx7625.h |  405 ++
> >  5 files changed, 2545 insertions(+), 1 deletion(-)
> >  create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.c
> >  create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.h
> > 
> > diff --git a/drivers/gpu/drm/bridge/Makefile 
> > b/drivers/gpu/drm/bridge/Makefile
> > index 4934fcf..bcd388a 100644
> > --- a/drivers/gpu/drm/bridge/Makefile
> > +++ b/drivers/gpu/drm/bridge/Makefile
> > @@ -12,8 +12,8 @@ obj-$(CONFIG_DRM_SII9234) += sii9234.o
> >  obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
> >  obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
> >  obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
> > -obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
> >  obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
> >  obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
> >  obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
> > +obj-y += analogix/
> >  obj-y += synopsys/
> > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
> > b/drivers/gpu/drm/bridge/analogix/Kconfig
> > index e930ff9..b2f127e 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> > @@ -2,3 +2,9 @@
> >  config DRM_ANALOGIX_DP
> > tristate
> > depends on DRM
> > +
> > +config ANALOGIX_ANX7625
> > +   tristate "Analogix MIPI to DP interface support"
> > +   help
> > +   ANX7625 is an ultra-low power 4K mobile HD transmitter designed
> > +   for portable devices. It converts MIPI/DPI to DisplayPort1.3 4K.
> > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
> > b/drivers/gpu/drm/bridge/analogix/Makefile
> > index fdbf3fd..8a52867 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Makefile
> > +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> > @@ -1,3 +1,4 @@
> >  # SPDX-License-Identifier: GPL-2.0-only
> > +obj-$(CONFIG_ANALOGIX_ANX7625) += anx7625.o
> >  analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
> >  obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c 
> > b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > new file mode 100644
> > index 000..7bb4e17
> > --- /dev/null
> > +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > @@ -0,0 +1,2132 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * Copyright(c) 2016, Analogix Semiconductor. All rights reserved.
> > + *
> > + */
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +
> > +#include "anx7625.h"
> > +
> > +/*
> > + * there is a sync issue while access I2C register between AP(CPU) and
> > + * internal firmware(OCM), to avoid the race condition, AP should access
> > + * the reserved slave address before slave address occurs changes.
> > + */
> > +static int i2c_access_workaround(struct anx7625_data *ctx,
> > +struct i2c_client *client)
> > +{
> > +   u8 offset;
> > +   struct device *dev = >dev;
> > +   struct i2c_client *last_client = ctx->last_client;
> > +   int ret = 0;
> > +
> > +   if (client != last_client) {
> 
> 
> Please reverse this condition.
> 
>   if (client == ctx->last_client)
>   return 0;
> 
> Get rid of the last_client variable.
> 
> 
> > +   ctx->last_client = client;
> > +
> > +   if (client == ctx->i2c.tcpc_client)
> > +   offset = RSVD_00_ADDR;
> > +   else if (client == ctx->i2c.tx_p0_client)
> > +   offset = RSVD_D1_ADDR;
> > +   else if (client == ctx->i2c.tx_p1_client)
> > +   offset = 

Re: [PATCH v2 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver

2019-10-09 Thread Dan Carpenter
On Wed, Oct 09, 2019 at 02:30:32PM +0300, Dan Carpenter wrote:
> > +   platform = kzalloc(sizeof(*platform), GFP_KERNEL);
> > +   if (!platform) {
> > +   DRM_DEV_ERROR(dev, "failed to allocate driver data\n");
> > +   ret = -ENOMEM;
> > +   goto exit;
> 
> return -ENOMEM;
> 
> > +   }
> > +
> > +   pdata = >pdata;
> > +
> > +   /* device tree parsing function call */
> > +   ret = anx7625_parse_dt(>dev, pdata);
> > +   if (ret != 0)   /* if occurs error */
> > +   goto err0;
> 
> != 0 is double negative.  Choose better label names.  Remove the obvious
> comment.
> 
> if (ret)
>   goto free_platform;
> 
> > +
> > +   anx7625_init_gpio(platform);
> > +
> > +   /* to access global platform data */
> > +   platform->client = client;
> > +   i2c_set_clientdata(client, platform);
> > +
> > +   if (platform->pdata.extcon_supported) {
> > +   /* get extcon device from DTS */
> > +   platform->extcon = extcon_get_edev_by_phandle(>dev, 0);
> > +   if (PTR_ERR(platform->extcon) == -EPROBE_DEFER)
> > +   goto err0;
> 
> Preserve the error code.
> 
> > +   if (IS_ERR(platform->extcon)) {
> > +   DRM_DEV_ERROR(>dev,
> > + "can not get extcon device!");
> > +   goto err0;
> 
> Prerve the error code.
> 
> > +   }
> > +
> > +   ret = anx7625_extcon_notifier_init(platform);
> > +   if (ret < 0)
> > +   goto err0;
> > +   }
> > +
> > +   atomic_set(>power_status, 0);
> > +
> > +   mutex_init(>lock);
> > +
> > +   if (platform->pdata.gpio_intr_hpd) {
> > +   INIT_WORK(>work, anx7625_work_func);
> > +   platform->workqueue = create_workqueue("anx7625_work");
> > +   if (!platform->workqueue) {
> > +   DRM_DEV_ERROR(dev, "failed to create work queue\n");
> > +   ret = -ENOMEM;
> > +   goto err1;
> 
> This goto will crash.  Because you have forgotten what the most recently
> allocated resource was.  It should be "goto free_platform;" still.
> 
> > +   }
> > +
> > +   platform->pdata.hpd_irq =
> > +   gpiod_to_irq(platform->pdata.gpio_intr_hpd);
> > +   if (platform->pdata.hpd_irq < 0) {
> > +   DRM_DEV_ERROR(dev, "failed to get gpio irq\n");
> > +   goto err1;
> 
> goto free_wq;
> 
> > +   }
> > +
> > +   ret = request_threaded_irq(platform->pdata.hpd_irq,
> > +  NULL, anx7625_intr_hpd_isr,
> > +  IRQF_TRIGGER_FALLING |
> > +  IRQF_TRIGGER_RISING |
> > +  IRQF_ONESHOT,
> > +  "anx7625-hpd", platform);
> > +   if (ret < 0) {
> > +   DRM_DEV_ERROR(dev, "failed to request irq\n");
> > +   goto err1;
> > +   }
> > +
> > +   ret = irq_set_irq_wake(platform->pdata.hpd_irq, 1);
> > +   if (ret < 0) {
> > +   DRM_DEV_ERROR(dev, "Request irq for hpd");
> > +   DRM_DEV_ERROR(dev, "interrupt wake set fail\n");
> > +   goto err1;
> > +   }
> > +
> > +   ret = enable_irq_wake(platform->pdata.hpd_irq);
> > +   if (ret < 0) {
> > +   DRM_DEV_ERROR(dev, "Enable irq for HPD");
> > +   DRM_DEV_ERROR(dev, "interrupt wake enable fail\n");
> > +   goto err1;
> > +   }
> > +   }
> > +
> > +   if (anx7625_register_i2c_dummy_clients(platform, client) != 0) {
> 
> Preserve the error code.
> 
>   ret = anx7625_register_i2c_dummy_clients();
>   if (ret)
>   goto free_platform;
> 

I meant goto free_wq here.  That's the most recent allocation.

regards,
dan carpenter

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver

2019-10-09 Thread Dan Carpenter
Are you sure you sent the correct patch?  This has many of the same
style issues I mentioned in the previous email.  The error handling
in edid_read() is wrong.  probe() will still crash if allocating the
work queue fails.

On Wed, Oct 09, 2019 at 09:28:02AM +, Xin Ji wrote:
> The ANX7625 is an ultra-low power 4K Mobile HD Transmitter designed
> for portable device. It converts MIPI DSI/DPI to DisplayPort 1.3 4K.
> 
> The ANX7625 can support both USB Type-C PD feature and MIPI DSI/DPI
> to DP feature. This driver only enabled MIPI DSI/DPI to DP feature.
> 
> Signed-off-by: Xin Ji 
> ---
>  drivers/gpu/drm/bridge/Makefile   |2 +-
>  drivers/gpu/drm/bridge/analogix/Kconfig   |6 +
>  drivers/gpu/drm/bridge/analogix/Makefile  |1 +
>  drivers/gpu/drm/bridge/analogix/anx7625.c | 2132 
> +
>  drivers/gpu/drm/bridge/analogix/anx7625.h |  405 ++
>  5 files changed, 2545 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.c
>  create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.h
> 
> diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
> index 4934fcf..bcd388a 100644
> --- a/drivers/gpu/drm/bridge/Makefile
> +++ b/drivers/gpu/drm/bridge/Makefile
> @@ -12,8 +12,8 @@ obj-$(CONFIG_DRM_SII9234) += sii9234.o
>  obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
>  obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
>  obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
> -obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
>  obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
>  obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
>  obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
> +obj-y += analogix/
>  obj-y += synopsys/
> diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
> b/drivers/gpu/drm/bridge/analogix/Kconfig
> index e930ff9..b2f127e 100644
> --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> @@ -2,3 +2,9 @@
>  config DRM_ANALOGIX_DP
>   tristate
>   depends on DRM
> +
> +config ANALOGIX_ANX7625
> + tristate "Analogix MIPI to DP interface support"
> + help
> + ANX7625 is an ultra-low power 4K mobile HD transmitter designed
> + for portable devices. It converts MIPI/DPI to DisplayPort1.3 4K.
> diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
> b/drivers/gpu/drm/bridge/analogix/Makefile
> index fdbf3fd..8a52867 100644
> --- a/drivers/gpu/drm/bridge/analogix/Makefile
> +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> @@ -1,3 +1,4 @@
>  # SPDX-License-Identifier: GPL-2.0-only
> +obj-$(CONFIG_ANALOGIX_ANX7625) += anx7625.o
>  analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
>  obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c 
> b/drivers/gpu/drm/bridge/analogix/anx7625.c
> new file mode 100644
> index 000..7bb4e17
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> @@ -0,0 +1,2132 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright(c) 2016, Analogix Semiconductor. All rights reserved.
> + *
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include "anx7625.h"
> +
> +/*
> + * there is a sync issue while access I2C register between AP(CPU) and
> + * internal firmware(OCM), to avoid the race condition, AP should access
> + * the reserved slave address before slave address occurs changes.
> + */
> +static int i2c_access_workaround(struct anx7625_data *ctx,
> +  struct i2c_client *client)
> +{
> + u8 offset;
> + struct device *dev = >dev;
> + struct i2c_client *last_client = ctx->last_client;
> + int ret = 0;
> +
> + if (client != last_client) {


Please reverse this condition.

if (client == ctx->last_client)
return 0;

Get rid of the last_client variable.


> + ctx->last_client = client;
> +
> + if (client == ctx->i2c.tcpc_client)
> + offset = RSVD_00_ADDR;
> + else if (client == ctx->i2c.tx_p0_client)
> + offset = RSVD_D1_ADDR;
> + else if (client == ctx->i2c.tx_p1_client)
> + offset = RSVD_60_ADDR;
> + else if (client == ctx->i2c.rx_p0_client)
> + offset = RSVD_39_ADDR;
> + else if (client == ctx->i2c.rx_p1_client)
> + offset = RSVD_7F_ADDR;
> + else
> + offset = RSVD_00_ADDR;
> +
> + ret = i2c_smbus_write_byte_data(client, offset, 0x00);
> + if (ret < 0)
> + DRM_DEV_ERROR(dev,
> +