[PATCH] x86/hyper-v: Fix indent in hv_do_fast_hypercall16()

2018-10-29 Thread Yi Wang
Remove the surplus TAB in hv_do_fast_hypercall16().

Signed-off-by: Yi Wang 
---
 arch/x86/include/asm/mshyperv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 0d6271c..1d0a777 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -232,7 +232,7 @@ static inline u64 hv_do_fast_hypercall16(u16 code, u64 
input1, u64 input2)
  : "cc");
}
 #endif
-   return hv_status;
+   return hv_status;
 }
 
 /*
-- 
1.8.3.1

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


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

2021-02-24 Thread Hsin-Yi Wang
On Thu, Jan 28, 2021 at 11:10 AM Xin Ji  wrote:
>
> Add MIPI rx DPI input support
>
> Reported-by: kernel test robot 
> Signed-off-by: Xin Ji 
> ---
>  drivers/gpu/drm/bridge/analogix/anx7625.c | 326 
> --
>  drivers/gpu/drm/bridge/analogix/anx7625.h |  20 +-
>  2 files changed, 285 insertions(+), 61 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c 
> b/drivers/gpu/drm/bridge/analogix/anx7625.c
> index 04536cc..628ae43 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)
> @@ -195,6 +195,60 @@ static int wait_aux_op_finish(struct anx7625_data *ctx)
> 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 -EINVAL;
> +   }
> +
> +   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 0;
> +}
> +
>  static int anx7625_video_mute_control(struct anx7625_data *ctx,
>   u8 status)
>  {
> @@ -219,38 +273,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_

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

2021-02-24 Thread Hsin-Yi Wang
On Wed, Feb 24, 2021 at 5:55 PM Hsin-Yi Wang  wrote:
>
> On Thu, Jan 28, 2021 at 11:10 AM Xin Ji  wrote:
> >
> > Add MIPI rx DPI input support
> >
> > Reported-by: kernel test robot 
> > Signed-off-by: Xin Ji 
> > ---
> >  drivers/gpu/drm/bridge/analogix/anx7625.c | 326 
> > --
> >  drivers/gpu/drm/bridge/analogix/anx7625.h |  20 +-
> >  2 files changed, 285 insertions(+), 61 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c 
> > b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > index 04536cc..628ae43 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)
> > @@ -195,6 +195,60 @@ static int wait_aux_op_finish(struct anx7625_data *ctx)
> > 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 -EINVAL;
> > +   }
> > +
> > +   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 0;
> > +}
> > +
> >  static int anx7625_video_mute_control(struct anx7625_data *ctx,
> >   u8 status)
> >  {
> > @@ -219,38 +273,6 @@ static int anx7625_video_mute_control(struct 
> > anx7625_

Re: [PATCH v3 1/1] drm/bridge: anx7625: send DPCD command to downstream

2022-01-17 Thread Hsin-Yi Wang
On Tue, Jan 11, 2022 at 5:06 PM Xin Ji  wrote:
>
> Send DPCD command to downstream before anx7625 power down,
> let downstream monitor enter into standby mode.
>
> Signed-off-by: Xin Ji 
> ---
>  drivers/gpu/drm/bridge/analogix/anx7625.c | 42 +++
>  1 file changed, 35 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c 
> b/drivers/gpu/drm/bridge/analogix/anx7625.c
> index 33383f83255d..0b858c78abe8 100644
> --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> @@ -129,6 +129,23 @@ static int anx7625_reg_write(struct anx7625_data *ctx,
> return ret;
>  }
>
> +static int anx7625_reg_block_write(struct anx7625_data *ctx,
> +  struct i2c_client *client,
> +  u8 reg_addr, u8 len, u8 *buf)
> +{
> +   int ret;
> +   struct device *dev = &client->dev;
> +
> +   i2c_access_workaround(ctx, client);
> +
> +   ret = i2c_smbus_write_i2c_block_data(client, reg_addr, len, buf);
> +   if (ret < 0)
> +   dev_err(dev, "write i2c block failed id=%x\n:%x",
> +   client->addr, reg_addr);
> +
> +   return ret;
> +}
> +
>  static int anx7625_write_or(struct anx7625_data *ctx,
> struct i2c_client *client,
> u8 offset, u8 mask)
> @@ -214,8 +231,8 @@ static int wait_aux_op_finish(struct anx7625_data *ctx)
> return 0;
>  }
>
> -static int anx7625_aux_dpcd_read(struct anx7625_data *ctx,
> -u32 address, u8 len, u8 *buf)
> +static int anx7625_aux_dpcd_trans(struct anx7625_data *ctx, u8 op,
> + u32 address, u8 len, u8 *buf)
>  {
> struct device *dev = &ctx->client->dev;
> int ret;
> @@ -231,8 +248,7 @@ static int anx7625_aux_dpcd_read(struct anx7625_data *ctx,
> addrm = (address >> 8) & 0xFF;
> addrh = (address >> 16) & 0xFF;
>
> -   cmd = DPCD_CMD(len, DPCD_READ);
> -   cmd = ((len - 1) << 4) | 0x09;
> +   cmd = DPCD_CMD(len, op);
>
> /* Set command and length */
> ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
> @@ -246,6 +262,9 @@ static int anx7625_aux_dpcd_read(struct anx7625_data *ctx,
> ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client,
>  AP_AUX_ADDR_19_16, addrh);
>
> +   if (op == DPCD_WRITE)
> +   ret |= anx7625_reg_block_write(ctx, ctx->i2c.rx_p0_client,
> +  AP_AUX_BUFF_START, len, buf);
> /* Enable aux access */
> ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client,
> AP_AUX_CTRL_STATUS, AP_AUX_CTRL_OP_EN);
> @@ -255,14 +274,17 @@ static int anx7625_aux_dpcd_read(struct anx7625_data 
> *ctx,
> return -EIO;
> }
>
> -   usleep_range(2000, 2100);
> -
> ret = wait_aux_op_finish(ctx);
> if (ret) {
> dev_err(dev, "aux IO error: wait aux op finish.\n");
> return ret;
> }
>
> +   /* Write done */
> +   if (op == DPCD_WRITE)
> +   return 0;
> +
> +   /* Read done, read out dpcd data */
> ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client,
>  AP_AUX_BUFF_START, len, buf);
> if (ret < 0) {
> @@ -845,7 +867,7 @@ static int anx7625_hdcp_enable(struct anx7625_data *ctx)
> }
>
> /* Read downstream capability */
> -   anx7625_aux_dpcd_read(ctx, 0x68028, 1, &bcap);
> +   anx7625_aux_dpcd_trans(ctx, DPCD_READ, 0x68028, 1, &bcap);
> if (!(bcap & 0x01)) {
> pr_warn("downstream not support HDCP 1.4, cap(%x).\n", bcap);
> return 0;
> @@ -918,6 +940,7 @@ static void anx7625_dp_stop(struct anx7625_data *ctx)
>  {
> struct device *dev = &ctx->client->dev;
> int ret;
> +   u8 data;
>
> DRM_DEV_DEBUG_DRIVER(dev, "stop dp output\n");
>
> @@ -929,6 +952,11 @@ static void anx7625_dp_stop(struct anx7625_data *ctx)
> ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client, 0x08, 0x7f);
>
> ret |= anx7625_video_mute_control(ctx, 1);
> +
> +   dev_dbg(dev, "notify downstream enter into standby\n");
> +   /* Downstream monitor enter into standby mode */
> +   data = 2;
> +   ret |= anx7625_aux_dpcd_trans(ctx, DPCD_WRITE, 0x000600, 1, &data);

Is DPCD_READ/WRITE used for the same purpose as
DP_AUX_NATIVE_WRITE/READ? If so, maybe you can just use
DP_AUX_NATIVE_WRITE/READ and we don't need to define these values
again in the driver?

> if (ret < 0)
> DRM_DEV_ERROR(dev, "IO error : mute video fail\n");
>
> --
> 2.25.1
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

2020-05-31 Thread Hsin-Yi Wang
On Fri, May 15, 2020 at 2:53 PM Xin Ji  wrote:

> +
> +static int anx7625_bridge_attach(struct drm_bridge *bridge)

Latest drm_bridge api:

int (*attach)(struct drm_bridge *bridge,
 enum drm_bridge_attach_flags flags);

https://elixir.bootlin.com/linux/v5.7-rc7/source/include/drm/drm_bridge.h#L70

> +{
> +   struct anx7625_data *ctx = bridge_to_anx7625(bridge);
> +   int err;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel