* [lm-sensors] PEC support in i2c/lm_sensors CVS
2005-10-30 17:14 [lm-sensors] PEC support in i2c/lm_sensors CVS Jean Delvare
@ 2005-11-03 5:42 ` Mark M. Hoffman
2005-11-03 11:27 ` Jean Delvare
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Mark M. Hoffman @ 2005-11-03 5:42 UTC (permalink / raw)
To: lm-sensors
Hi Jean:
* Jean Delvare <khali@linux-fr.org> [2005-10-30 17:13:35 +0100]:
(snip)
> So, unless someone comes up with good reasons for not backporting the
> new PEC code to i2c/lm_sensors CVS, I will probably do so. I would
> appreciate if someone could take a look at the new Linux 2.6 code
> (2.6.14-git1 and later) and confirm that I got it right. I don't think
> it got any form of review so far, except for the fact that It Works For
> Me (TM).
I finally reviewed those patches; one suggestion, to apply if you like...
This patch tweaks i2c-i801.c so that the driver always sets the SMBAUXCTL
register (which enables/disables PEC) explicitly before each transaction.
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
--- linux-2.6.14-git5.orig/drivers/i2c/busses/i2c-i801.c
+++ linux-2.6.14-git5/drivers/i2c/busses/i2c-i801.c
@@ -468,8 +468,7 @@ static s32 i801_access(struct i2c_adapte
return -1;
}
- if (hwpec)
- outb_p(1, SMBAUXCTL); /* enable hardware PEC */
+ outb_p(hwpec, SMBAUXCTL); /* enable/disable hardware PEC */
if(block)
ret = i801_block_transaction(data, read_write, size, hwpec);
@@ -478,9 +477,6 @@ static s32 i801_access(struct i2c_adapte
ret = i801_transaction();
}
- if (hwpec)
- outb_p(0, SMBAUXCTL); /* disable hardware PEC */
-
if(block)
return ret;
if(ret)
--
Mark M. Hoffman
mhoffman@lightlink.com
^ permalink raw reply [flat|nested] 5+ messages in thread* [lm-sensors] PEC support in i2c/lm_sensors CVS
2005-10-30 17:14 [lm-sensors] PEC support in i2c/lm_sensors CVS Jean Delvare
2005-11-03 5:42 ` Mark M. Hoffman
@ 2005-11-03 11:27 ` Jean Delvare
2005-11-04 5:28 ` Mark M. Hoffman
2005-11-04 11:26 ` Jean Delvare
3 siblings, 0 replies; 5+ messages in thread
From: Jean Delvare @ 2005-11-03 11:27 UTC (permalink / raw)
To: lm-sensors
Hi Mark,
On 2005-11-03, Mark M. Hoffman wrote:
> I finally reviewed those patches; one suggestion, to apply if you like...
>
> This patch tweaks i2c-i801.c so that the driver always sets the SMBAUXCTL
> register (which enables/disables PEC) explicitly before each transaction.
I agree, I prefer it that way too. I'll apply that patch, and I'll test
it on my ICH3M too. My testing possibilities are limited though, as I
only have EEPROMs on that bus.
I was expecting more comments from your review, about the PEC core code
rewrite itself. Inidivual SMBus drivers can always be tweaked, it isn't
really related to the core rework. Do you have any kind of objection to
the rewrite itself? My implementation is completely different from what
we had before. It also has slightly different expectations from both bus
and chip drivers. Just because I think it is better doesn't mean
everyone has to agree. I might have missed something. I would hate it if
people will come and complain one year from now that this rewrite was a
bad idea, for a reason I failed to think of.
Given that the new implementation is already in Linus' tree for Linux
2.6, it's there to stay unless someone complains. The point about
i2c/lm_sensors CVS is still open though. I will have to interpret the
lack of objection as a green light for me to merge my rewrite in there.
Much like everything else I do anyway, but this time the effects are
much broader.
Thanks,
--
Jean Delvare
^ permalink raw reply [flat|nested] 5+ messages in thread
* [lm-sensors] PEC support in i2c/lm_sensors CVS
2005-10-30 17:14 [lm-sensors] PEC support in i2c/lm_sensors CVS Jean Delvare
2005-11-03 5:42 ` Mark M. Hoffman
2005-11-03 11:27 ` Jean Delvare
@ 2005-11-04 5:28 ` Mark M. Hoffman
2005-11-04 11:26 ` Jean Delvare
3 siblings, 0 replies; 5+ messages in thread
From: Mark M. Hoffman @ 2005-11-04 5:28 UTC (permalink / raw)
To: lm-sensors
Hi Jean:
> On 2005-11-03, Mark M. Hoffman wrote:
> > I finally reviewed those patches; one suggestion, to apply if you like...
> >
> > This patch tweaks i2c-i801.c so that the driver always sets the SMBAUXCTL
> > register (which enables/disables PEC) explicitly before each transaction.
* Jean Delvare <khali@linux-fr.org> [2005-11-03 11:15:20 +0100]:
> I agree, I prefer it that way too. I'll apply that patch, and I'll test
> it on my ICH3M too. My testing possibilities are limited though, as I
> only have EEPROMs on that bus.
>
> I was expecting more comments from your review, about the PEC core code
> rewrite itself. Inidivual SMBus drivers can always be tweaked, it isn't
> really related to the core rework. Do you have any kind of objection to
> the rewrite itself? My implementation is completely different from what
> we had before. It also has slightly different expectations from both bus
> and chip drivers. Just because I think it is better doesn't mean
Since you insist, heh... there was this bit from lm90.c for ADM1032 PEC:
+/* The ADM1032 supports PEC but not on write byte transactions, so we need
+ to explicitely ask for a transaction without PEC. */
+static inline s32 adm1032_write_byte(struct i2c_client *client, u8 value)
+{
+ return i2c_smbus_xfer(client->adapter, client->addr,
+ client->flags & ~I2C_CLIENT_PEC,
+ I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL);
+}
It's a bit of a hack, but in practice I hope it won't be necessary very
often. Although, here we have the very first PEC capable device requiring
that. But I don't have a better idea, so I wasn't going to mention it.
> everyone has to agree. I might have missed something. I would hate it if
> people will come and complain one year from now that this rewrite was a
> bad idea, for a reason I failed to think of.
No worries - I don't see anything glaring. And there's one user for which
it works, right? Not that I think it will, but if it did need to be reworked
again later, so be it.
> Given that the new implementation is already in Linus' tree for Linux
> 2.6, it's there to stay unless someone complains. The point about
> i2c/lm_sensors CVS is still open though. I will have to interpret the
> lack of objection as a green light for me to merge my rewrite in there.
> Much like everything else I do anyway, but this time the effects are
> much broader.
As for backporting this to 2.4: I have no opinion about that anymore.
(Except that, by this time next year, maybe we should deep-freeze the I2C
CVS tree, delete all the kernel 2.4 bits in lm_sensors2, and advance the
version to 3.0.0)
Regards,
--
Mark M. Hoffman
mhoffman@lightlink.com
^ permalink raw reply [flat|nested] 5+ messages in thread* [lm-sensors] PEC support in i2c/lm_sensors CVS
2005-10-30 17:14 [lm-sensors] PEC support in i2c/lm_sensors CVS Jean Delvare
` (2 preceding siblings ...)
2005-11-04 5:28 ` Mark M. Hoffman
@ 2005-11-04 11:26 ` Jean Delvare
3 siblings, 0 replies; 5+ messages in thread
From: Jean Delvare @ 2005-11-04 11:26 UTC (permalink / raw)
To: lm-sensors
Hi Mark,
On 2005-11-04, Mark M. Hoffman wrote:
> Since you insist, heh... there was this bit from lm90.c for ADM1032 PEC:
>
> +/* The ADM1032 supports PEC but not on write byte transactions, so we need
> + to explicitely ask for a transaction without PEC. */
> +static inline s32 adm1032_write_byte(struct i2c_client *client, u8 value)
> +{
> + return i2c_smbus_xfer(client->adapter, client->addr,
> + client->flags & ~I2C_CLIENT_PEC,
> + I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL);
> +}
>
> It's a bit of a hack, but in practice I hope it won't be necessary very
> often. Although, here we have the very first PEC capable device requiring
> that. But I don't have a better idea, so I wasn't going to mention it.
I have to agree it's not exactly elegant, and I totally share your
analysis. I am waiting to see more chips implementing PEC to decide what
to do with this case and similar ones.
I fear that all chips will have the problem with this one transaction
type, because SMBus Send Byte with PEC is the same as SMBus Write Byte
without PEC. I consider this a specification weakness. Due to the fact
that PEC must always be optional as per the same specification, any chip
supporting SMBus Write Byte and SMBus Send Byte with the same
"command" value can obviously not support the latter with PEC.
Anyway, this is a side problem. The old PEC implementation would not have
handled this case better as far as I can see, so this is no regression.
> No worries - I don't see anything glaring. And there's one user for which
> it works, right? Not that I think it will, but if it did need to be
> reworked again later, so be it.
That one user is me, so I'm not sure if it counts ;) I am still waiting
for a "works for me too" type of report.
> (Except that, by this time next year, maybe we should deep-freeze the I2C
> CVS tree, delete all the kernel 2.4 bits in lm_sensors2, and advance the
> version to 3.0.0)
This implies that, by that time, the sysfs interface in Linux 2.6 will
have been fully stabilized and completed in a totally chip-independant
way, and we will have a brand new, essentially chip-independant library
to interface with it. I wish it really happens, but it doesn't sound
too realistic with the little manpower we have available at the moment.
Thanks,
--
Jean Delvare
^ permalink raw reply [flat|nested] 5+ messages in thread