hwmon: w83792d fix unused fan pins
PATCH 1/1 hwmon: w83792d fix unused fan pins
Hi, Jean,
This is the patch we have discussed, please check, thank you all :)
1.This patch add check for fan4,5,6,7 and do not create device file if their
Pins are not configured as fan.
2.Fix the issue that can not set fan divisor to 128.
3.Fix the index out of bounds bug in w83792d_detect function.
Best Regards
Yuan Mu
==============================================The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Winbond is strictly prohibited; and any information in this email irrelevant to the official business of Winbond shall be deemed as neither given nor endorsed by Winbond. ==============================================If your computer is unable to decode Chinese font, please ignore the following message.It essentially repeats the statement in English given above.本信件內所含華邦電子的財產性機密性資訊, 僅授權原發信人指定之收信人取閱\之用. 假使您並非被指定之收信人或因任何原因在未經授權的情形之下收到本信件, 請您告知原發信人並立即將信件從電腦與網路伺服器中予以消除. 對於您的合作, 我們先此致謝. 特此提醒, 任何未經授權擅自使用華邦電子的機密資訊的行為是被嚴格禁止的. 信件與華邦電子營業無關之內容,不得視為華邦電子之立場或意見.
Hi Yuan,
Quoted 6 lines · Yuan Mu
This is the patch we have discussed, please check, thank you all :)
1. This patch add check for fan4,5,6,7 and do not create device file if their pins are not configured as fan.
2. Fix the issue that can not set fan divisor to 128.
3. Fix the index out of bounds bug inw83792d_detectfunction.
Looks good, I'll apply that. Thanks!
Please note that the list didn't receive your patch, because you did not use the proper attachement type. You used application/octet-stream (binary) while the list only accepts text types (text/plain, text/x-patch, text/x-diff). Please use the proper type next time. Your e-mail client may pick the correct type for you if the file name includes an extension (e.g. fix_fan_pins_divs_w83792d.patch instead of patch_fix_fan_pins_divs_w83792d). Or you may even have to add ".txt" to the name (like I just did for my previous post, because by braindead webmail client doesn't recognize .patch and .diff as text extensions.)
--
Jean Delvare
PATCH 1/1 hwmon: w83792d fix unused fan pins
In reply to [email protected]Hi Greg,
I know I'm a bit late but this one patch should preferably be merged in before 2.6.15 is released.
Thanks.
* * * * *
Content-Disposition: inline; filename=hwmon-w83792d-fan-pins-fixes.patch
1. This patch add check for fan4,5,6,7 and do not create device file if their pins are not configured as fan.
2. Fix the issue that can not set fan divisor to 128.
3. Fix the index out of bounds bug in w83792d_detect function.
--- drivers/hwmon/w83792d.c | 25 ++++++++++++++++++------- 1 files changed, 18 insertions(+), 7 deletions(-)
drivers/hwmon/w83792d.c +18 -7
@@ -193,6 +193,7 @@ 0xE2 } /* (bit3-0) SmartFanII: Fan3 Level 3 */ }; +#define W83792D_REG_GPIO_EN 0x1A#define W83792D_REG_CONFIG 0x40#define W83792D_REG_VID_FANDIV 0x47#define W83792D_REG_CHIPID 0x49
@@ -257,7 +258,7 @@ {int i; val =SENSORS_LIMIT (val,1 ,128 ) >>1 ; -for (i =0 ; i <6 ; i++) { +for (i =0 ; i <7 ; i++) {if (val =0 )break ; val >>=1 ;
@@ -1282,8 +1283,8 @@w83792d_init_client (new_client);/* A few vars need to be filled upon startup */ -for (i =1 ; i <=7 ; i++) { - data->fan_min[i -1 ] =w83792d_read_value (new_client, +for (i =0 ; i <7 ; i++) { + data->fan_min[i] =w83792d_read_value (new_client,W83792D_REG_FAN_MIN [i]); }
@@ -1306,10 +1307,20 @@device_create_file_fan (new_client,1 );device_create_file_fan (new_client,2 );device_create_file_fan (new_client,3 ); -device_create_file_fan (new_client,4 ); -device_create_file_fan (new_client,5 ); -device_create_file_fan (new_client,6 ); -device_create_file_fan (new_client,7 ); + +/* Read GPIO enable register to check if pins for fan 4,5 are used as +GPIO */ + val1 =w83792d_read_value (new_client,W83792D_REG_GPIO_EN ); +if (!(val1 &0x40 )) +device_create_file_fan (new_client,4 ); +if (!(val1 &0x20 )) +device_create_file_fan (new_client,5 ); + + val1 =w83792d_read_value (new_client,W83792D_REG_PIN ); +if (val1 &0x40 ) +device_create_file_fan (new_client,6 ); +if (val1 &0x04 ) +device_create_file_fan (new_client,7 );device_create_file_temp1 (new_client);/* Temp1 */ device_create_file_temp_add (new_client,2 );/* Temp2 */
Signature · 1 line
Jean Delvare