Re: [PATCH 09/11] zl10353: tm6000: bugfix reading problems with tm6000 i2c host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



stefan.ringel@xxxxxxxx wrote:
> From: Stefan Ringel <stefan.ringel@xxxxxxxx>
> 
> Signed-off-by: Stefan Ringel <stefan.ringel@xxxxxxxx>
> 
> diff --git a/drivers/media/dvb/frontends/zl10353.c b/drivers/media/dvb/frontends/zl10353.c
> index 8c61271..9716d7e 100644
> --- a/drivers/media/dvb/frontends/zl10353.c
> +++ b/drivers/media/dvb/frontends/zl10353.c
> @@ -74,7 +74,7 @@ static int zl10353_write(struct dvb_frontend *fe, u8 *ibuf, int ilen)
>  	return 0;
>  }
>  
> -static int zl10353_read_register(struct zl10353_state *state, u8 reg)
> +static int zl10353_read1_register(struct zl10353_state *state, u8 reg)
>  {
>  	int ret;
>  	u8 b0[1] = { reg };
> @@ -97,6 +97,41 @@ static int zl10353_read_register(struct zl10353_state *state, u8 reg)
>  	return b1[0];
>  }
>  
> +static int zl10353_read2_register(struct zl10353_state *state, u8 reg)
> +{
> +	int ret;
> +	u8 b0[1] = { reg - 1 };
> +	u8 b1[1] = { 0 };
> +	struct i2c_msg msg[2] = { { .addr = state->config.demod_address,
> +				    .flags = 0,
> +				    .buf = b0, .len = 1 },
> +				  { .addr = state->config.demod_address,
> +				    .flags = I2C_M_RD,
> +				    .buf = b1, .len = 2 } };
> +
> +	ret = i2c_transfer(state->i2c, msg, 2);
> +
> +	if (ret != 2) {
> +		printk("%s: readreg error (reg=%d, ret==%i)\n",
> +		       __func__, reg, ret);
> +		return ret;
> +	}
> +
> +	return b1[1];
> +}

This patch doesn't look correct to me. The size of the zl10353 read register doesn't 
change when it is used with tm6000. The solution should be at tm6000-i2c, basically
using the same REQ for 2 bytes when only 1 byte is being read.

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux