max1619
Hi Jean
I made thiese driver in new module. What is next to do? It's testet with
kernel 2.4.26 and didn't added laetes CVS. I'm redy to support thise driver and gona try to write savage driver (actualy i dont iven know why i need thees).
Senky wery match.
And whan more quastion ... do yuo speek english only?
PS sensors-detect testet
Quoted 4 lines
I made thiese driver in new module. What is next to do? It's testet
with kernel 2.4.26 and didn't added laetes CVS. I'm redy to support thise driver and gona try to write savage driver (actualy i dont iven know why i need thees).
Well, please provide a patch against Linux 2.6.6-mm4. I'll review it and if it's correct, we'll send it to Greg.
After that you'll need to provide user-space support and if possible some docs. If you want to provide a 2.4 driver as well, this is welcome.
Quoted 1 line
And whan more quastion ... do yuo speek english only?
No, I speak French too, and can read German (but I can't pretend to write it fluently).
Quoted 1 line
PS sensors-detect testet
Great :)
Thanks.
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/
Quoted 2 lines
I alredy made an user-space. am i need to send you all changet files or am i need to have acsess to CVS ?
You would need to send a patch against CVS.
Quoted 2 lines
About patch. Ok i do it but i dont know haw to do patch, im jast beginner. Your help are needet by me.
OK...
Basically you need to have two trees on your system, one with the original files, one with the original files + your changes. Once you have that and have ensured that your changes are correct, move to the upper directory and use "diff -ruN" to generate the patch.
Complete example:
Say that you want to submit a patch against Linux 2.6.6-mm4. First get the Linux 2.6.6 tree and untar it somewhere. In this example, I'll suppose that you will untar it in ~/work.
So you have ~/work/linux-2.6.6.
Now, get the 2.6.6-mm4.bz2 patch and apply it:
cd ~/work/linux-2.6.6
bzcat /path/to/2.6.6-mm4.bz2 | patch -p1
At this point, I suggest you rename the directory:
cd ~/work
mv linux-2.6.6 linux-2.6.6-mm4
Now, duplicate the tree:
cd ~/work
cp -a linux-2.6.6-mm4 linux-2.6.6-mm4-max1619
After that, you can do all the changes you need in linux-2.6.6-mm4-max1619. Test that it works as intended. Then you can generate a patch and send it to us:
cd ~/work
diff -ruN linux-2.6.6-mm4 linux-2.6.6-mm4-max1619 > linux-2.6.6-mm4-max1619.diff
Same for the CVS repository. Check it out, duplicate the tree, do your changes, generate a patch, and send it to us.
Thanks.
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/
Hi Jean,
I alredy made an user-space. am i need to send you all changet files or am i need to have acsess to CVS ? About patch. Ok i do it but i dont know haw to do patch, im jast beginner.
Your help are needet by me.
Alexey mailto:[email protected]
Hi Jean
this is CVS only. I'm not redy with kernel.
Do you hawe some think about C++ and about kernel?
I jast won to anderstend what i do.
Sanky
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lm_sensors2-max1619.diff
Type: text/x-diff
Size: 25570 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040522/fd52b013/lm_sensors2-max1619.bin
Quoted 2 lines
Hi Jean
this is CVS only. I'm not redy with kernel.
OK. My comments below.
Quoted 2 lines
Do you hawe some think about C++ and about kernel?
I jast won to anderstend what i do.
Not sure I get what you mean. At any rate, the Linux kernel is written in C and no C++ code is allowed. Just start from an existing driver, and it shouldn't be too hard to adapt the code for your MAX1619 chip.
doc/chips/max1619 +2 -0
@@ -0,0 +1,73 @@ +Kernel driver `lm90.o' +===========
You forgot to edit the header line!
+Supported chips:
+ * Maxim max1619
+ Prefix: `max1619'
+ Addresses scanned: I2C 0x4d
The MAX1619 supports 9 different addresses (same as the MAX1617).
+The different chipsets of the family are not strictly identical, although +very similar. This driver doesn't handle any specific feature for now, +but could if there ever was a need for it. For reference, here comes a +non-exhaustive list of specific features:
This paragraph is irrelevant here, since your driver handles a single chip.
+Additionally, there is a relative hysteresis value common to critical +value. Remote hysteresis can be set from user-space.
The hysteresis value isn't common to anything, it's dedicated to the remote temperature. Same goes for the critical limit.
All limits can be set (for all drivers) from user-space so mentioning it here isn't particularly interesting.
+Chips 'max1619'
+
+LABEL LABEL CLASS COMPUTE CLASS MODE MAGN
+l_temp - - R- 0 +r_temp - - R- 0 +r_high r_temp r_temp RW 0 +r_low r_temp r-temp RW 0 +r_max r_temp r_temp RW 0 +r_hyst r_temp r_temp RW 0 +alarms - - R- 0
No, please use standard symbol names. temp1, temp2, temp2_max, temp2_min, temp2_hyst, temp2_crit.
etc/sensors.conf.eg +8 -0
@@ -1718,6 +1718,26 @@ # should be higher than each of the high limits above # set tcrit 85 +chip "max1619-*" + + label l_temp "M/B Temp" + label r_temp "CPU Temp" + label r_low "CPU Low:" + label r_high "CPU High:" + label r_max "CPU Max:(Fan ON)" + label r_hyst "CPU Hyst:(Fan OFF)"
Labels for limits are never display, so I wouldn't bother setting them.
kernel/chips/max1619.c +4 -0
@@ -0,0 +1,561 @@ +/* +* max1619.c - Part of lm_sensors, Linux kernel modules for hardware +* monitoring +* Copyright (C) 2003-2004 Aleey Fisher <[email protected]>
You should mention the fact that you started from the lm90 driver.
+#ifndef I2C_DRIVERID_MAX1619
+#define I2C_DRIVERID_MAX1619 1049
+#endif
You don't really need an ID.
+static unsigned short normal_i2c[] = { 0x4d, SENSORS_I2C_END }; +static unsigned short normal_i2c_range[] = { SENSORS_I2C_END };
As said earlier, please support all address. You'll find the list in adm1021.c.
+#define MAX1619_REG_R_MAN_ID 0xFE
+#define MAX1619_REG_R_CHIP_ID 0xFF
Please align constants using tabs, not white spaces.
+#define TEMP_FROM_REG(val) (val & 0x80 ? val-0x100 : val)
+#define TEMP_TO_REG(val) (val < 0 ? val+0x100 : val)
Your macros aren't safe. It's better to surround any use of the parameters with parenthesis:
#define TEMP_FROM_REG(val) ((val) & 0x80 ? (val)-0x100 : (val))
#define TEMP_TO_REG(val) ((val) < 0 ? (val)+0x100 : (val))
+static struct i2c_driver max1619_driver = {
+ .owner = THIS_MODULE, + .name = "MAX1619 sensor driver", + .id = I2C_DRIVERID_MAX1619, + .flags = I2C_DF_NOTIFY,
+ .attach_adapter = max1619_attach_adapter,
+ .detach_client = max1619_detach_client
+};
Don't mention .id here, it's OK.
+/*
+ * Proc entries
+ * These files are created for each detected LM90.
+ */
Edit that comment!
+#define MAX1619_SYSCTL_LOCAL_TEMP 1200 +#define MAX1619_SYSCTL_REMOTE_TEMP 1201 +#define MAX1619_SYSCTL_REMOTE_CRYT 1205 +#define MAX1619_SYSCTL_REMOTE_TMAX 1207 +#define MAX1619_SYSCTL_REMOTE_THYST 1208 +#define MAX1619_SYSCTL_ALARMS 1210
You don't need all these. You need one SYSCTL value per file, not symbol. You need one for temp1, one for temp2/min/max, one for temp2_crit/hyst, and one for alarms.
+static ctl_table max1619_dir_table_template[] +{
+ {MAX1619_SYSCTL_LOCAL_TEMP, "l_temp", NULL, 0, 0644, NULL,
+ &i2c_proc_real, &i2c_sysctl_real, NULL, &max1619_local_temp},
This one can be read-only (444), since it doesn't have any limit.
+ {MAX1619_SYSCTL_ALARMS, "alarms", NULL, 0, 0644, NULL,
+ &i2c_proc_real, &i2c_sysctl_real, NULL, &max1619_alarms},
This one should be read-only as well.
+ if (kind < 0)
+ {
+ u8 reg_config, reg_convrate;
+ reg_config = i2c_smbus_read_byte_data(new_client,
+ MAX1619_REG_R_CONFIG);
+ reg_convrate = i2c_smbus_read_byte_data(new_client,
+ MAX1619_REG_R_CONVRATE);
+
+ if ((reg_config & 0x03) != 0x00 )
+ {
+#ifdef DEBUG
+ printk(KERN_DEBUG "max1619.o: Detection failed at 0x%02x.\n",
+ address);
+#endif
+ goto ERROR1;
+ }
+ }
You forgot to cgecj trhe conversion rate register . It has to be <0x07. You could use the status register as well, for which reg & 0x61 should be 0.
+ if (kind <= 0)
+ {
+ u8 man_id, chip_id;
+
+ man_id = i2c_smbus_read_byte_data(new_client,
+ MAX1619_REG_R_MAN_ID);
+ chip_id = i2c_smbus_read_byte_data(new_client,
+ MAX1619_REG_R_CHIP_ID);
+ if ((man_id & 0x4D) && (chip_id & 0x04))
+ {
+
+ kind = max1619;
+
+ }
+
+ }
You check is not correct. It should be (man_id = 0x4D) && (chip_id = 0x04).
+static void max1619_init_client(struct i2c_client *client) +{
+ u8 config;
+
+ /*
+ * Start the conversions.
+ */
+
+ i2c_smbus_write_byte_data(client, MAX1619_REG_W_CONVRATE,
+ 5); /* 2 Hz */
+ config = i2c_smbus_read_byte_data(client, MAX1619_REG_R_CONFIG);
+ if (config & 0x40)
+ i2c_smbus_write_byte_data(client, MAX1619_REG_W_CONFIG,
+ config & 0x0C); /* run */
+}
This doesn't preserve configuration bits. You should write back config & 0xBF.
+static void max1619_remote_temp(struct i2c_client *client, int operation,
+ int ctl_name, int *nrels_mag, long *results)
+{
+ struct max1619_data *data = client->data;
+
+ if (operation = SENSORS_PROC_REAL_INFO)
+ *nrels_mag = 0; /* magnitude */
+ else if (operation = SENSORS_PROC_REAL_READ)
+ {
+ max1619_update_client(client); + results[0] = TEMP_FROM_REG(data->remote_temp); + *nrels_mag = 1;
+ }
+
+}
+
+static void max1619_remote_cryt(struct i2c_client *client, int operation,
+ int ctl_name, int *nrels_mag, long *results)
+{
+ struct max1619_data *data = client->data;
+
+ if (operation = SENSORS_PROC_REAL_INFO)
+ *nrels_mag = 0; /* magnitude */
+ else if (operation = SENSORS_PROC_REAL_READ)
+ {
+ max1619_update_client(client);
+ results[0] = TEMP_FROM_REG(data->remote_thigh);
+ results[1] = TEMP_FROM_REG(data->remote_tlow);
+ *nrels_mag = 2;
+ }
+ else if (operation = SENSORS_PROC_REAL_WRITE)
+ {
+ if (*nrels_mag >= 1)
+ {
+ data->remote_thigh = TEMP_TO_REG(results[0]);
+ i2c_smbus_write_byte_data(client,
+ MAX1619_REG_W_REMOTE_THIGH, data->remote_thigh);
+ }
+ if (*nrels_mag >= 2)
+ {
+ data->remote_tlow = TEMP_TO_REG(results[1]);
+ i2c_smbus_write_byte_data(client,
+ MAX1619_REG_W_REMOTE_TLOW,data->remote_tlow);
+
+ }
+ }
+}
Merge these two into a single one. The same file will return, in order, high limit, low limit and current reading.
+static void max1619_remote_tmax(struct i2c_client *client, int operation,
+ int ctl_name, int *nrels_mag, long *results)
+{
+ struct max1619_data *data = client->data;
+
+ if (operation = SENSORS_PROC_REAL_INFO)
+ *nrels_mag = 0; /* magnitude */
+ else if (operation = SENSORS_PROC_REAL_READ)
+ {
+ max1619_update_client(client);
+ results[0] = TEMP_FROM_REG(data->remote_max);
+ *nrels_mag = 1;
+ }
+ else if (operation = SENSORS_PROC_REAL_WRITE)
+ {
+ if (*nrels_mag >= 1)
+ {
+ data->remote_max = TEMP_TO_REG(results[0]);
+ i2c_smbus_write_byte_data(client,
+ MAX1619_REG_W_REMOTE_TMAX,data->remote_max);
+ }
+ }
+}
+
+static void max1619_remote_thyst(struct i2c_client *client, int operation,
+ int ctl_name, int *nrels_mag, long *results)
+{
+ struct max1619_data *data = client->data;
+
+ if (operation = SENSORS_PROC_REAL_INFO)
+ *nrels_mag = 0; /* magnitude */
+ else if (operation = SENSORS_PROC_REAL_READ)
+ {
+ max1619_update_client(client);
+ results[0] = TEMP_FROM_REG(data->remote_hyst);
+ *nrels_mag = 1;
+ }
+ else if (operation = SENSORS_PROC_REAL_WRITE)
+ {
+ if (*nrels_mag >= 1 )
+ {
+ data->remote_hyst = TEMP_TO_REG(results[0]);
+ i2c_smbus_write_byte_data(client,
+ MAX1619_REG_W_REMOTE_THYST, data->remote_hyst);
+ }
+ }
+}
Merge these two ones as well. A single file should contain, in order, the critical limit and the hysteresis value.
lib/chips.h +1 -0
@@ -1855,6 +1855,18 @@#define SENSORS_XEONTEMP_REMOTE_TEMP_OVER 56/* RW */ #define SENSORS_XEONTEMP_ALARMS 81/* R */ +/* MAX1619 chipp */
"chip", not "chipp".
prog/sensors/chips.c +0 -0
(...)
+ if (!sensors_get_label_and_valid(*name, SENSORS_MAX1619_REMOTE_TEMP,
+ &label, &valid)
+ && !sensors_get_feature(*name, SENSORS_MAX1619_REMOTE_TEMP, &cur) + && !sensors_get_feature(*name, SENSORS_MAX1619_REMOTE_LOW, &low) + && !sensors_get_feature(*name, SENSORS_MAX1619_REMOTE_HIGH, &high))
+ {
+ if (valid) {
+ print_label(label, 10);
+ print_temp_info(cur, low, high, MINMAX, 1, 1);
Magnitude is 0 for these as well.
+ printf(" %s\n",
+ alarms&MAX1619_ALARM_REMOTE_OPEN?"DISCONNECT":
+ alarms&MAX1619_ALARM_REMOTE_OVERT?"FAN OFF":
OVERT belongs to the second set of limits (max/hyst) below.
OK, this is a really good job you did here :) Please correct everything I mentioned and submit a new patch. I'll apply it to our CVS repository.
Thanks.
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/
Hi Jean
Quoted 3 lines
Not sure I get what you mean. At any rate, the Linux kernel is written in C and no C++ code is allowed. Just start from an existing driver, and it shouldn't be too hard to adapt the code for your MAX1619 chip.
I mean, i don't know C at all, i jas wont to lern it and it will be greate if you have and can send me some DOC about C.
Quoted 10 lines
(quoted diff) +10
-0+ if (kind < 0) + { + u8 reg_config, reg_convrate; + reg_config = i2c_smbus_read_byte_data(new_client, + MAX1619_REG_R_CONFIG); + reg_convrate = i2c_smbus_read_byte_data(new_client, + MAX1619_REG_R_CONVRATE); + + if ((reg_config & 0x03) != 0x00 ) + {
Quoted 2 lines
You forgot to cgecj trhe conversion rate register . It has to be <>
0x07. You could use the status register as well, for which reg &0x61should be 0.
Hear i'm not sure what you mean
if ((reg_config & 0x2A) != 0x00 || reg_convrate <= 0x07 || (reg_status & 0x61) != 0x00)
is it corect ?
Quoted 10 lines
(quoted diff) +7
-0+ i2c_smbus_write_byte_data(client, MAX1619_REG_W_CONVRATE, + 5); /* 2 Hz */ + config = i2c_smbus_read_byte_data(client, MAX1619_REG_R_CONFIG); + if (config & 0x40) + i2c_smbus_write_byte_data(client, MAX1619_REG_W_CONFIG, + config & 0x0C); /* run */ +}This doesn't preserve configuration bits. You should write back config &
0xBF.
I can't yus 0xbf wile it bringing up OVERT output, it's mean HYST and CRIT
can't do any think. For max1619 0x9f , this preserve and doesn't have OVERT
bit.
Hi Alexey,
Quoted 2 lines
I mean, i don't know C at all, i jas wont to lern it and it will be greate if you have and can send me some DOC about C.
Sorry, I don't have such docs. I leant C partly in high school, but mostly by reading existing code and discussing with people.
Frankly, if you never did C before and were already able to adapt driver code to write your own driver, it's impressive. Keep it this way :)
Quoted 4 lines
Quoted 2 lines
You forgot to cgecj trhe conversion rate register . It has to be <> >
0x07. You could use the status register as well, for which reg &0x61should be 0.Hear i'm not sure what you mean
Maybe because I completely mispelled my first sentence and didn't even notice it? ;)
Quoted 4 lines
if ((
reg_config&0x2A) !=0x00||reg_convrate<=0x07|| (reg_status&0x61) !=0x00)is it corect ?
Note quite. I'd say:
if ((reg_config & 0x03) != 0x00 || reg_convrate > 0x07
|| (reg_status & 0x61) != 0x00)
Quoted 6 lines
Quoted 6 lines
(quoted diff) +5
-0+ config = i2c_smbus_read_byte_data(client, MAX1619_REG_R_CONFIG); + if (config & 0x40) + i2c_smbus_write_byte_data(client, MAX1619_REG_W_CONFIG, + config & 0x0C); /* run */ +}
Quoted 6 lines
Quoted 2 lines
This doesn't preserve configuration bits. You should write back config &
0xBF.I can't yus
0xbfwile it bringing up OVERT output, it's mean HYST and
CRIT can't do any think. For max16190x9f, this preserve and
doesn't have OVERT bit.
Negative. Masking with 0xBF will *not* set bit 5 (POL). It will keep it exactly the way it was. So, if the BIOS has changed that bit to match the hardware setup, it won't be dropped.
Thanks.
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/
Hi Jean
new diff is ready
some more quastions:
" || " mean "and"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lm_sensors2-max1619.diff
Type: text/x-diff
Size: 23840 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040523/10b48692/lm_sensors2-max1619.bin
Quoted 2 lines
Hi Jean
new diff is ready
I'll review it.
Quoted 2 lines
some more quastions:
" || " mean "and"
No. || means "or". && means "and".
doc/chips/max1619 +0 -0
+Module Parameters
+-----------------
Please insert the module parameters there. Just do "modinfo max1619" and copy the parameter information here.
+LABEL FEATURE SYMBOL SYSCTL FILE:N
+temp1 SENSORS_MAX1619_LOCAL_TEMP temp1:3
N is 1 for this one.
+temp2 SENSORS_MAX1619_REMOTE_TEMP temp2:3 +temp2_max SENSORS_MAX1619_REMOTE_HIGH temp2_max_min:2 +temp2_min SENSORS_MAX1619_REMOTE_LOW temp2_max_min:1
temp2_max and temp2_min are in file temp2.
+temp2_crit SENSORS_MAX1619_REMOTE_HYST temp2_hyst_crit:1 +temp2_hyst SENSORS_MAX1619_REMOTE_MAX temp2_hyst_crit:1
N is 2 for temp2_hyst.
Please rename file temp2_hyst_crit to temp2_crit.
kernel/chips/max1619.c +5 -0
@@ -0,0 +1,525 @@ +/* +* max1619.c - Part of lm_sensors, Linux kernel modules for hardware +* monitoring +* Copyright (C) 2003-2004 Jean Delvare <[email protected]> +* Alexey Fisher <[email protected]>
Hey, put your name first! You are the main author.
+/*
+ * Addresses to scan
+ */
+
+static unsigned short normal_i2c[] = { 0x18, 0x1a, 0x29, 0x2b,
+ 0x4c, 0x4e,0x4d, SENSORS_I2C_END };
+static unsigned short normal_i2c_range[] = { SENSORS_I2C_END };
This is not correct. The addresses are ranges for this driver, i.e not only "0x18 and 0x1a" but "from 0x18 to 0x1a", which also includes 0x19. Just use normal_i2c_range instead of normal_i2c, just as the adm1021 driver does.
+#define MAX1619_SYSCTL_REMOTE_CRIT_HYST 1202
Rename to MAX1619_SYSCTL_REMOTE_CRIT.
+static void max1619_remote_temp(struct i2c_client *client, int operation,
+ int ctl_name, int *nrels_mag, long *results)
+{
+ struct max1619_data *data = client->data;
+
+ if (operation = SENSORS_PROC_REAL_INFO)
+ *nrels_mag = 0; /* magnitude */
+ else if (operation = SENSORS_PROC_REAL_READ)
+ {
+ max1619_update_client(client);
+ results[0] = TEMP_FROM_REG(data->remote_temp);
+ results[1] = TEMP_FROM_REG(data->remote_low);
+ results[2] = TEMP_FROM_REG(data->remote_high);
+ *nrels_mag = 3;
+ }
Order is not correct. Must be high, low and current temperature, in that order.
+ else if (operation = SENSORS_PROC_REAL_WRITE)
+ {
+ if (*nrels_mag >= 1)
+ {
+ data->remote_low = TEMP_TO_REG(results[1]);
+ i2c_smbus_write_byte_data(client,
+ MAX1619_REG_W_REMOTE_TLOW, data->remote_low);
+ }
+ if (*nrels_mag >= 2)
+ {
+ data->remote_high = TEMP_TO_REG(results[2]);
+ i2c_smbus_write_byte_data(client,
+ MAX1619_REG_W_REMOTE_THIGH,data->remote_high);
+
+ }
+ }
So same here: high first, low then.
And this is results[0] and results[1], not [1] and [2].
+MODULE_AUTHOR("Jean Delvare <[email protected]>
+ Alexey Fisher <[email protected]>");
Same as above, put your name first.
+MODULE_DESCRIPTION("MAX1619 sensor driver");
+MODULE_LICENSE("GPL");
--- lm_sensors2/lib/chips.c 2004-05-17 20:36:31.000000000 +0200
+++ lm_sensors/lib/chips.c 2004-05-23 19:56:17.000000000 +0200
+ { SENSORS_MAX1619_REMOTE_TEMP, "temp2",
+ NOMAP, NOMAP,
+ R, MAX1619_SYSCTL_REMOTE_TEMP, VALUE(1), 0 },
+ { SENSORS_MAX1619_REMOTE_HIGH, "temp2_min",
+ NOMAP,NOMAP,
+ RW, MAX1619_SYSCTL_REMOTE_TEMP, VALUE(2), 0 },
+ { SENSORS_MAX1619_REMOTE_LOW, "temp2_max",
+ NOMAP, NOMAP,
+ RW, MAX1619_SYSCTL_REMOTE_TEMP, VALUE(3), 0 },
VALUE(N) are not correct, same change as in the driver is needed: max first, min second, current reading last.
Everything else is just fine :) Congratulations.
I guess that your next patch should be OK and I'll be able to apply it.
Thanks!
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/
Hi Jean
I houp it's last one diff
if avery think is OK I begin with 2.6.6-mm4. Or i supou beginn with 2.6.6-mm5?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lm_sensors2-max1619.diff
Type: text/x-diff
Size: 23781 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040524/099cbc06/lm_sensors2-max1619.bin
Quoted 1 line
I houp it's last one diff
I commited your work, with a few unimportant fixes (indentation and the like). Thanks!
If you ever want to do any change to the driver, just send a patch based on latest CVS.
Quoted 2 lines
if avery think is OK I begin with 2.6.6-mm4. Or i supou beginn with 2.6.6-mm5?
Yes, 2.6.6-mm5 is fine.
It shouldn't be more difficult than for the 2.4 driver. By the way, did you test your 2.4 driver?
Thanks.
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/
Hi Jean
Quoted 2 lines
By the way, did
you test your 2.4 driver?
yes i did and i tested new CVS
linux 2.6.6-mm5 is testet too.
here is two patches for linux kernel and for CVS
Thank you : - )
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linux-2.6.6-mm5-max1619.diff
Type: text/x-diff
Size: 12917 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040525/43054f65/linux-2.6.6-mm5-max1619.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lm_sensors2-max1619-prog.diff
Type: text/x-diff
Size: 1187 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040525/43054f65/lm_sensors2-max1619-prog.bin
Jean, you may kill me, but i don't have an max6650.
Fan On or Off - it show the same speed.
and when i made "i2cset 0 0x1f 0x01 0x01" it went down to sleep...
?????? Jean,
Quoted 5 lines · you
Quoted 5 lines
i have chip H8/3437
http://crio.mib.infn.it/wig/electronics/Componenti/Hitachi/Microcontrollori/h33to006d1.pdfthis one is with two registers for i2c
i did try other chips and didn't finde any think.
JD> It doesn't even look like an i2c chip to me. Searching the datasheet for JD> "i2c", "Philips" or "smbus" didn't return anything. Why do you think it JD> is an i2c chip?
this chip wich i wrot to you is not an i2c chip. this one to handle powersuplay and many other staf. About how its look like I don't anderstend enythink, realy, i don't have eny expiriens.
But any whay thanky for your halp.
Signature · 2 lines
Best regards, Alexey mailto:[email protected]
Quoted 1 line
Jean, you may kill me, but i don't have an max6650.
Definitely not a good reason to kill someone ;) (if there can be good reasons...)
Quoted 2 lines
Fan On or Off - it show the same speed.
and when i made "i2cset 00x1f0x010x01" it went down to sleep...
I have to agree. Taking a look at the dump you sent [1], it definitely doesn't look like a MAX6650/1 chip. Your chip has 2 or 4 registers, obviously no more, while even the MAX6650 has more than that.
Your best chance is to open your computer case and physically search for your MAX1619. The other chip might be connected directly to it.
If not, just look for any small chip made by Maxim or any other typical manufacturer (Dallas, National Semiconductor, Analog Devices...)
From just the dump it's nearly impossible to find out what it is, it doesn't carry enough information.
I've slighly improved the MAX6650/1 detection in sensors-detect, but I doubt it will be enough to defeat your chip, whatever it is.
Good luck.
John, can you confirm that the change makes sense and that sensors-detect still sees your chip? It it's OK, I'd like you to do the same in the driver itself.
It would also be great if you could compare Alexey's mysterious chip dump (at 0x1f) with yours and find a way to prevent the later from being misdetected as the former.
Thanks.
[1] http://archives.andrew.net.au/lm-sensors/msg07974.html
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/
Quoted 1 line
here is two patches for linux kernel and for CVS
I've applied the CVS patch. I changed "temp2_hyst" to "temp2_crit_hyst" though. In 2.6, hysteresis files have to reflect what they are an hysteresis for.
About the linux kernel patch now:
drivers/i2c/chips/Kconfig +0 -0
+config SENSORS_MAX1619
+ tristate "Maxim MAX1619 sensor chip"
+ depends on I2C
depends on I2C && EXPERIMENTAL
drivers/i2c/chips/max1619.c +0 -0
+ * max1619.c - Part of lm_sensors, Linux kernel modules for hardware
+ * monitoring
+ * Copyright (C) 2003-2004 Alexey Fisher <[email protected]>
+ * Jean Delvare <[email protected]>
Please align "monitoring" on "Part" and "Jean" on "Alexey", using spaces.
+ * Based on the lm90 driver. The MAX1619 is a sensor chip made by Maxim .
+ * It reports up to two temperatures (its own plus up to
+ * one external one) . Complete datasheet can be
+ * obtained from Maxim's website at:
+ * http://pdfserv.maxim-ic.com/en/ds/MAX1619.pdf
No white spaces before dots please.
+#define show_temp(value, converter) \
+static ssize_t show_##value(struct device *dev, char *buf) \
+{ \
+ struct max1619_data *data = max1619_update_device(dev); \
+ return sprintf(buf, "%d\n", converter(data->value)); \
+}
+show_temp(temp_input1, TEMP_FROM_REG); +show_temp(temp_input2, TEMP_FROM_REG); +show_temp(temp_low2, TEMP_FROM_REG); +show_temp(temp_high2, TEMP_FROM_REG); +show_temp(temp_crit2, TEMP_FROM_REG); +show_temp(temp_hyst2, TEMP_FROM_REG);
TEMP_FROM_REG doesn't have to be passed by parameter, since it's always the same.
+static DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp_crit2,
+ set_temp_crit2);
+static DEVICE_ATTR(temp2_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2,
+ set_temp_hyst2);
File has to be named temp2_crit_hyst instead of temp2_hyst.
+static int max1619_detect(struct i2c_adapter *adapter, int address, int kind) +{
+ struct i2c_client *new_client;
+ struct max1619_data *data;
+ int err = 0;
+ const char *name = "";
Broken indentation, you have 8 spaces instead of one tabulation.
+ /* The common I2C client data is placed right before the
+ LM90-specific data. */
You forgot to update that comment.
+ if (kind <= 0) { /* identification */
+
+ man_id = i2c_smbus_read_byte_data(new_client,
+ MAX1619_REG_R_MAN_ID);
+ chip_id = i2c_smbus_read_byte_data(new_client,
+ MAX1619_REG_R_CHIP_ID);
+
+ if ((man_id = 0x4D) && (chip_id = 0x04))
+ {
+ kind = max1619;
+ }
+
+ }
Discard these extra empty lines. Move the opening { at the end of the "if..." line.
+ if (kind = max1619)
+ {
+ name = "max1619";
+ }
Same here, opening curly brace is misplaced.
+ device_create_file(&new_client->dev, &dev_attr_temp2_crit);
+ device_create_file(&new_client->dev, &dev_attr_temp2_hyst);
Rename here too.
+MODULE_AUTHOR("Alexey Fisher <[email protected]>" \
+ "Jean Delvare <[email protected]>");
No \ here. You can just split the string over lines and the compiler will join them for you:
MODULE_AUTHOR("Alexey Fisher <[email protected]> and "
"Jean Delvare <[email protected]>");
In any case, *you* are the author, I don't deserve to have my name here ;)
Rest is just fine. I told you you could do it! Very impressive :)
Once you have fixed everything, and have tested the new version with lm_sensors CVS, you should be able to submit your new driver to Greg KH for inclusion into the main 2.6 tree. Briefly explain what the driver is for and how you wrote it (including the fact that I reviewed it). Don't forget to CC: the lm_sensors mailing list. Note that you have to send the patch *inline* (as opposed to in attachement) when sending patches to Greg. Make sure that your e-mail client won't break it (various e-mail clients would break long lines or replace tabs with spaces...).
Thanks, and congratulations again :)
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/
Hi Jean
About this misterious chip, yesterday i did open my computer and found many
chips ;-) . Some i identifide and some not.
W48C111-16H - Fregency generator
SST 28SF040A - EEPROM
HIN 211CAS - ???
LTC 1736 CG - Step Down
W40S11-02W - SDRAM buff
H043 FDS - ???
4431 AWGT 118 - ???
AD373 - ???
H8 3434 - PROM
LM 358 - ??? somthing for powersuplay
4463 AH(A or D) T12A - ???
724661-001 - ???
P12AB FST3383 - ???
PCA3356 TK41111 - ???
LM4880M - amplfire
OCDC42K MC4303 - ???
PU 2211 OCK - ???
EP7209-CV-D - mp3 (whau i have a mp3 :-o )
maybe you can halp me to recognise some of them :-)
i tested sensors-detect
Next adapter: SMBus PIIX4 adapter at 2180 (Non-I2C SMBus adapter) Do you want to scan it? (YES/no/selectively):
Client found at address 0x1f
Probing for `Maxim MAX6650/MAX6651'... Success!
(confidence 4, driver `max6650')
Client found at address 0x30
Client at address 0x4d can not be probed - unload all client drivers first! Client found at address 0x50
Probing for `SPD EEPROM'... Success!
(confidence 8, driver `eeprom')
Probing for `DDC monitor'... Failed!
Probing for `Maxim MAX6900'... Failed!
Client found at address 0x69
Quoted 22 lines
About this misterious chip, yesterday i did open my computer and found
many chips ;-) . Some i identifide and some not.W48C111-16H - Fregency generator
SST 28SF040A - EEPROM
HIN 211CAS - ???
LTC 1736 CG - Step Down
W40S11-02W - SDRAM buff
H043 FDS - ???
4431 AWGT 118 - ???
AD373 - ???
H8 3434 - PROM
LM 358 - ??? somthing for powersuplay
4463 AH(A or D) T12A - ???
724661-001 - ???
P12AB FST3383 - ???
PCA3356 TK41111 - ???
LM4880M - amplfire
OCDC42K MC4303 - ???
PU 2211 OCK - ???
EP7209-CV-D - mp3 (whau i have a mp3 :-o )
Quoted 1 line
maybe you can halp me to recognise some of them :-)
Not really. I hardly know any of these.
Your best chance is to ask Google about them. You are looking for a chip that is I2C or SMBus compatible, with 0x1f being a possible address (some docs could refer to is as 0x3e, which is more or less the "read address" for i2c address 0x1f).
Remember that you are probably after a really small chip, since it has very few registers.
Good luck.
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/
Quoted 10 lines
(quoted diff) +6
-0+show_temp(temp_input1, TEMP_FROM_REG); +show_temp(temp_input2, TEMP_FROM_REG); +show_temp(temp_low2, TEMP_FROM_REG); +show_temp(temp_high2, TEMP_FROM_REG); +show_temp(temp_crit2, TEMP_FROM_REG); +show_temp(temp_hyst2, TEMP_FROM_REG);
TEMP_FROM_REGdoesn't have to be passed by parameter, since it's always the same.
Jaen, I'm not sure what you mean. If you about "temp_hyst2", in these driverer hyst is chenchebl, not always the same.
Quoted 8 lines
Once you have fixed everything, and have tested the new version with
lm_sensorsCVS, you should be able to submit your new driver to Greg KH for inclusion into the main 2.6 tree. Briefly explain what the driver is for and how you wrote it (including the fact that I reviewed it). Don't forget to CC: thelm_sensorsmailing list. Note that you have to send the patch *inline* (as opposed to in attachement) when sending patches to Greg. Make sure that your e-mail client won't break it (various e-mail clients would break long lines or replace tabs with spaces...).
Actioly i dont know who is Greg. Am i can finde his Email in documentation ?
Quoted 1 line
Thanks, and congratulations again :)
Thank you, without your halp i newer did it :-)
i have chip H8/3437
http://crio.mib.infn.it/wig/electronics/Componenti/Hitachi/Microcontrollori/h33to006d1.pdf
this one is with two registers for i2c
i did try other chips and didn't finde any think.
Quoted 7 lines
Quoted 7 lines
(quoted diff) +6
-0+show_temp(temp_input1, TEMP_FROM_REG); +show_temp(temp_input2, TEMP_FROM_REG); +show_temp(temp_low2, TEMP_FROM_REG); +show_temp(temp_high2, TEMP_FROM_REG); +show_temp(temp_crit2, TEMP_FROM_REG); +show_temp(temp_hyst2, TEMP_FROM_REG);
Quoted 5 lines
Quoted 2 lines
TEMP_FROM_REGdoesn't have to be passed by parameter, since it's always the same.Jaen, I'm not sure what you mean. If you about "
temp_hyst2", in these driverer hyst is chenchebl, not always the same.
What I mean is that you could avoid passing the converter as a parameter:
+#define show_temp(value) \
+static ssize_t show_##value(struct device *dev, char *buf) \
+{ \
+ struct max1619_data *data = max1619_update_device(dev); \
+ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \
+}
+show_temp(temp_input1);
+show_temp(temp_input2);
+show_temp(temp_low2);
+show_temp(temp_high2);
+show_temp(temp_crit2);
+show_temp(temp_hyst2);
Because all the files use the same converter (TEMP_FROM_REG).
Quoted 2 lines
Actioly i dont know who is Greg. Am i can finde his Email in documentation ?
Greg Kroah-Hartman (aka Greg KH) is the person responsible (among several over things) of the I2C subsystem in Linux 2.6. He was in CC: in my previous post. And yes, you will find his contact information several times in both CREDITS and MAINTAINERS files.
Thanks.
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/
Quoted 5 lines
i have chip H8/3437
http://crio.mib.infn.it/wig/electronics/Componenti/Hitachi/Microcontrollori/h33to006d1.pdfthis one is with two registers for i2c
i did try other chips and didn't finde any think.
It doesn't even look like an i2c chip to me. Searching the datasheet for "i2c", "Philips" or "smbus" didn't return anything. Why do you think it is an i2c chip?
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/
Hi Greg.
This is a driver for "Remote/Local Temperature Sensor with Dual-Alarm Outputs and SMBus Serial Interface" MAX1619. I found this chip an my Laptop SAMSUNG NV5000. Daryng I use Linux cooling didn't worked at all, naw with this driwer it's working. I hope this will be usefool for ather too.
I didn't hade any expiriens with programming, but i didn't wont to wait wann some body make it vor me. Jean halped me correrct any mysteiks wich i made. Thanks Jaen :)
drivers/i2c/chips/Kconfig +10 -0
@@ -145,6 +145,16 @@ This driver can also be built as a module. If so, the module will be called lm90. +config SENSORS_MAX1619 + tristate "Maxim MAX1619 sensor chip" + depends on I2C && EXPERIMENTAL + select I2C_SENSOR + help + If you say yes here you get support for MAX1619 sensor chip. + + This driver can also be built as a module. If so, the module + will be called max1619. + config SENSORS_VIA686A tristate "VIA686A" depends on I2C && EXPERIMENTAL
drivers/i2c/chips/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_SENSORS_LM83) += lm83.o obj-$(CONFIG_SENSORS_LM85) += lm85.o obj-$(CONFIG_SENSORS_LM90) += lm90.o +obj-$(CONFIG_SENSORS_MAX1619) += max1619.o obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o obj-$(CONFIG_SENSORS_RTC8564) += rtc8564.o
drivers/i2c/chips/max1619.c +378 -0
378 lines not on this page · raw message
Greg KH
AppliedQuoted 9 lines · Alexey Fisher
Hi Greg.
This is a driver for "Remote/Local Temperature Sensor with Dual-Alarm Outputs and SMBus Serial Interface" MAX1619. I found this chip an my Laptop SAMSUNG NV5000. Daryng I use Linux cooling didn't worked at all, naw with this driwer it's working. I hope this will be usefool for ather too.I didn't hade any expiriens with programming, but i didn't wont to wait wann some body make it vor me. Jean halped me correrct any mysteiks wich i made. Thanks Jaen :)
Applied to my trees, and I'll send it off to Linus in a bit.
thanks,
greg k-h