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

Re: ibook2.2's thermal control dilemma



According to Benjamin Herrenschmidt, on Wed, 19 Jan 2005 11:47:12 +1100, 
>On Sun, 2005-01-16 at 22:49 +0100, Luca Bigliardi - shammash wrote:
>
>> Ben does not like this patch. He also has explained why but i didn't
>> understood (the problem is my little tech skill :) ).
>
>If Cedric who wrote the former driver feels that the lmsensor one is
>good enough with appropriate threshold values etc... then he can fix it
>to properly probe on the iBook.
>
>This whole "put a flag on the bus that holds the sensors" thing is
>totally bogus in the first place. Probably some more x86 moronity trying
>to become the de-facto way of doing things ...
>
>Ben.
>

 --- i2c-keywest.c.orig 2004-07-24 22:39:04.000000000 +0200
 +++ i2c-keywest.c      2004-08-17 21:03:23.000000000 +0200
 @@ -618,6 +618,8 @@
                 chan->iface = iface;
                 chan->chan_no = i;
                 chan->adapter.id = I2C_ALGO_SMBUS;
 +               if (i==1)
 +                       chan->adapter.class = I2C_CLASS_HWMON;
                 chan->adapter.algo = &keywest_algorithm;
                 chan->adapter.algo_data = NULL;
                 chan->adapter.client_register = NULL;


Hi,

I finally had time to have a look to this question. As fas as I can see, the adapter class
is nearly never read in the i2c tree, and that's only to check that it's value is
I2C_CLASS_HWMON. 
Moreover, except for the voodoo3 adapter all the bus have the class
equals to I2C_CLASS_HWMON. 

So I don't see the point in setting this flag only when i==1. What I understand is that
this flag says what can be found on the bus, and that I2C_CLASS_HWMON is something like
the default value that every bus sets.
According to the documentation, this flags only meaning is that you can "attach" a driver
to the bus, whatever this mean.

I would suggest to change this patch by : 

--- i2c-keywest.c.orig 2004-07-24 22:39:04.000000000 +0200
+++ i2c-keywest.c      2004-08-17 21:03:23.000000000 +0200
@@ -618,6 +618,8 @@
                 chan->iface = iface;
                 chan->chan_no = i;
                 chan->adapter.id = I2C_ALGO_SMBUS;
+                chan->adapter.class = I2C_CLASS_HWMON;
                 chan->adapter.algo = &keywest_algorithm;
                 chan->adapter.algo_data = NULL;
                 chan->adapter.client_register = NULL;


If Ben really don't want to specify what is on the bus, then we can say that there can be
everything on the bus:
--- i2c-keywest.c.orig 2004-07-24 22:39:04.000000000 +0200
+++ i2c-keywest.c      2004-08-17 21:03:23.000000000 +0200
@@ -618,6 +618,8 @@
                 chan->iface = iface;
                 chan->chan_no = i;
                 chan->adapter.id = I2C_ALGO_SMBUS;
+                chan->adapter.class = I2C_CLASS_ALL;
                 chan->adapter.algo = &keywest_algorithm;
                 chan->adapter.algo_data = NULL;
                 chan->adapter.client_register = NULL;

Anyway, we cannot expect the i2c people to change their design,  so I think putting the
I2C_CLASS_HWMON would be harmless, and finally make lm-sensors work on ibook. 

Any comments ?

--
Cedric



Reply to: