[lm-sensors] [PATCH] hwmon: (pmbus) Fix two issues
B29983 at freescale.com
Mon Nov 14 09:48:38 CET 2011
> -----Original Message-----
> From: Jean Delvare [mailto:khali at linux-fr.org]
> Sent: 2011年11月14日 16:02
> To: Tang Yuantian-B29983
> Cc: lm-sensors at lm-sensors.org; Tang Yuantian-B29983; Huang Changming-
> R66093; Tabi Timur-B04825
> Subject: Re: [lm-sensors] [PATCH] hwmon: (pmbus) Fix two issues
> Hi Tang,
> On Mon, 14 Nov 2011 13:41:06 +0800, Yuantian.Tang at freescale.com wrote:
> > From: Tang Yuantian <B29983 at freescale.com>
> > 1. Not all platforms support i2c_smbus_read_block_data function.
> > Use i2c_smbus_read_i2c_block_data instead.
> You can't do that. These are two different transfer formats, they are not
> interchangeable. If the device wants the SMBus block format, then you
> have to use this in the driver. If the bus driver doesn't support that,
> it has to be fixed. In general it is only a matter of adding support for
> I2C_M_RECV_LEN to the bus driver. You can check in
> i2c-core:i2c_smbus_xfer_emulated() for a reference implementation.
[Yuantian:] almost all platform's i2c driver don't support i2c_smbus_read_block_data.
Why can't we just use i2c_smbus_read_i2c_block_data instead.
Beside, according my test, i2c_smbus_read_block_data can't return correct value,
I think i2c_smbus_read_i2c_block_data is only right choice.
> > 2. Not all zlxx chips's id start with zlxx. zl6100's id starts with
> > 0x10. Take this situation into account.
> No, this is incorrect. 0x10 is the first byte returned because SMBus
> block reads receive the block length as the first byte. 0x10 == 16, which
> is the length of the ID for these chips, this is no coincidence.
> This is a bug introduced by your above change of SMBus block read for I2C
> block read.
> So, nack.
[Yuantian:] I misunderstand the 0x10. But the existing zl6100 driver didn't consider it too.
And still need to be fixed.
> > Signed-off-by: Tang Yuantian <Yuantian.Tang at freescale.com>
> > ---
> > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > branch: master
> > test platform: P1022DS
> > drivers/hwmon/pmbus/zl6100.c | 21 ++++++++++++++-------
> > 1 files changed, 14 insertions(+), 7 deletions(-)
> > diff --git a/drivers/hwmon/pmbus/zl6100.c
> > b/drivers/hwmon/pmbus/zl6100.c index 2bc9800..8e2fd52 100644
> > --- a/drivers/hwmon/pmbus/zl6100.c
> > +++ b/drivers/hwmon/pmbus/zl6100.c
> > @@ -26,6 +26,7 @@
> > #include <linux/i2c.h>
> > #include <linux/ktime.h>
> > #include <linux/delay.h>
> > +#include <linux/ctype.h>
> Jean Delvare
More information about the lm-sensors