aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlistair John Strachan <alistair@devzero.co.uk>2009-09-15 11:18:10 -0400
committerJean Delvare <khali@linux-fr.org>2009-09-15 11:18:10 -0400
commitbbe5939ab1834f79f177739cb84904bc12d08073 (patch)
treeca90a7d9b19f76602de5821493786b780f1b5793
parent18240904960a39e582ced8ba8ececb10b8c22dd3 (diff)
hwmon: (abituguru3) Support multiple DMI strings per chip ID
Most known Abit motherboards have unique uguru chip IDs. However, some "refresh" boards keep the same chip ID but have a different DMI string. As our DMI board string matching is (necessarily) strict, some boards were failing DMI detection, and as the old probe method was also failing, the driver would not load. The only known boards affected by this problem are the IP35 Pro XE (vs IP35 Pro) and the AB9 Pro (vs AB9). Is it not sufficient to relax the match criteria, as some boards (e.g. the AB9 Quad GT) have different uguru chip IDs. This patch replaces the dmi_name string with a NULL terminated array of strings to be matched per uguru chip ID. It has been compile and runtime tested (thanks Rune). References: https://bugs.launchpad.net/bugs/298798 Signed-off-by: Alistair John Strachan <alistair@devzero.co.uk> Tested-by: Rune Svendsen <runesvend@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r--drivers/hwmon/abituguru3.c77
1 files changed, 40 insertions, 37 deletions
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c
index 7d3f15d32fdf..d45c569770f0 100644
--- a/drivers/hwmon/abituguru3.c
+++ b/drivers/hwmon/abituguru3.c
@@ -117,9 +117,12 @@ struct abituguru3_sensor_info {
117 int offset; 117 int offset;
118}; 118};
119 119
120/* Avoid use of flexible array members */
121#define ABIT_UGURU3_MAX_DMI_NAMES 2
122
120struct abituguru3_motherboard_info { 123struct abituguru3_motherboard_info {
121 u16 id; 124 u16 id;
122 const char *dmi_name; 125 const char *dmi_name[ABIT_UGURU3_MAX_DMI_NAMES + 1];
123 /* + 1 -> end of sensors indicated by a sensor with name == NULL */ 126 /* + 1 -> end of sensors indicated by a sensor with name == NULL */
124 struct abituguru3_sensor_info sensors[ABIT_UGURU3_MAX_NO_SENSORS + 1]; 127 struct abituguru3_sensor_info sensors[ABIT_UGURU3_MAX_NO_SENSORS + 1];
125}; 128};
@@ -164,7 +167,7 @@ struct abituguru3_data {
164 167
165/* Constants */ 168/* Constants */
166static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { 169static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
167 { 0x000C, NULL /* Unknown, need DMI string */, { 170 { 0x000C, { NULL } /* Unknown, need DMI string */, {
168 { "CPU Core", 0, 0, 10, 1, 0 }, 171 { "CPU Core", 0, 0, 10, 1, 0 },
169 { "DDR", 1, 0, 10, 1, 0 }, 172 { "DDR", 1, 0, 10, 1, 0 },
170 { "DDR VTT", 2, 0, 10, 1, 0 }, 173 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -186,7 +189,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
186 { "AUX1 Fan", 35, 2, 60, 1, 0 }, 189 { "AUX1 Fan", 35, 2, 60, 1, 0 },
187 { NULL, 0, 0, 0, 0, 0 } } 190 { NULL, 0, 0, 0, 0, 0 } }
188 }, 191 },
189 { 0x000D, NULL /* Abit AW8, need DMI string */, { 192 { 0x000D, { NULL } /* Abit AW8, need DMI string */, {
190 { "CPU Core", 0, 0, 10, 1, 0 }, 193 { "CPU Core", 0, 0, 10, 1, 0 },
191 { "DDR", 1, 0, 10, 1, 0 }, 194 { "DDR", 1, 0, 10, 1, 0 },
192 { "DDR VTT", 2, 0, 10, 1, 0 }, 195 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -215,7 +218,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
215 { "AUX5 Fan", 39, 2, 60, 1, 0 }, 218 { "AUX5 Fan", 39, 2, 60, 1, 0 },
216 { NULL, 0, 0, 0, 0, 0 } } 219 { NULL, 0, 0, 0, 0, 0 } }
217 }, 220 },
218 { 0x000E, NULL /* AL-8, need DMI string */, { 221 { 0x000E, { NULL } /* AL-8, need DMI string */, {
219 { "CPU Core", 0, 0, 10, 1, 0 }, 222 { "CPU Core", 0, 0, 10, 1, 0 },
220 { "DDR", 1, 0, 10, 1, 0 }, 223 { "DDR", 1, 0, 10, 1, 0 },
221 { "DDR VTT", 2, 0, 10, 1, 0 }, 224 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -236,7 +239,8 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
236 { "SYS Fan", 34, 2, 60, 1, 0 }, 239 { "SYS Fan", 34, 2, 60, 1, 0 },
237 { NULL, 0, 0, 0, 0, 0 } } 240 { NULL, 0, 0, 0, 0, 0 } }
238 }, 241 },
239 { 0x000F, NULL /* Unknown, need DMI string */, { 242 { 0x000F, { NULL } /* Unknown, need DMI string */, {
243
240 { "CPU Core", 0, 0, 10, 1, 0 }, 244 { "CPU Core", 0, 0, 10, 1, 0 },
241 { "DDR", 1, 0, 10, 1, 0 }, 245 { "DDR", 1, 0, 10, 1, 0 },
242 { "DDR VTT", 2, 0, 10, 1, 0 }, 246 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -257,7 +261,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
257 { "SYS Fan", 34, 2, 60, 1, 0 }, 261 { "SYS Fan", 34, 2, 60, 1, 0 },
258 { NULL, 0, 0, 0, 0, 0 } } 262 { NULL, 0, 0, 0, 0, 0 } }
259 }, 263 },
260 { 0x0010, NULL /* Abit NI8 SLI GR, need DMI string */, { 264 { 0x0010, { NULL } /* Abit NI8 SLI GR, need DMI string */, {
261 { "CPU Core", 0, 0, 10, 1, 0 }, 265 { "CPU Core", 0, 0, 10, 1, 0 },
262 { "DDR", 1, 0, 10, 1, 0 }, 266 { "DDR", 1, 0, 10, 1, 0 },
263 { "DDR VTT", 2, 0, 10, 1, 0 }, 267 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -279,7 +283,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
279 { "OTES1 Fan", 36, 2, 60, 1, 0 }, 283 { "OTES1 Fan", 36, 2, 60, 1, 0 },
280 { NULL, 0, 0, 0, 0, 0 } } 284 { NULL, 0, 0, 0, 0, 0 } }
281 }, 285 },
282 { 0x0011, "AT8 32X", { 286 { 0x0011, { "AT8 32X", NULL }, {
283 { "CPU Core", 0, 0, 10, 1, 0 }, 287 { "CPU Core", 0, 0, 10, 1, 0 },
284 { "DDR", 1, 0, 20, 1, 0 }, 288 { "DDR", 1, 0, 20, 1, 0 },
285 { "DDR VTT", 2, 0, 10, 1, 0 }, 289 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -306,7 +310,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
306 { "AUX3 Fan", 37, 2, 60, 1, 0 }, 310 { "AUX3 Fan", 37, 2, 60, 1, 0 },
307 { NULL, 0, 0, 0, 0, 0 } } 311 { NULL, 0, 0, 0, 0, 0 } }
308 }, 312 },
309 { 0x0012, NULL /* Abit AN8 32X, need DMI string */, { 313 { 0x0012, { NULL } /* Abit AN8 32X, need DMI string */, {
310 { "CPU Core", 0, 0, 10, 1, 0 }, 314 { "CPU Core", 0, 0, 10, 1, 0 },
311 { "DDR", 1, 0, 20, 1, 0 }, 315 { "DDR", 1, 0, 20, 1, 0 },
312 { "DDR VTT", 2, 0, 10, 1, 0 }, 316 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -328,7 +332,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
328 { "AUX1 Fan", 36, 2, 60, 1, 0 }, 332 { "AUX1 Fan", 36, 2, 60, 1, 0 },
329 { NULL, 0, 0, 0, 0, 0 } } 333 { NULL, 0, 0, 0, 0, 0 } }
330 }, 334 },
331 { 0x0013, NULL /* Abit AW8D, need DMI string */, { 335 { 0x0013, { NULL } /* Abit AW8D, need DMI string */, {
332 { "CPU Core", 0, 0, 10, 1, 0 }, 336 { "CPU Core", 0, 0, 10, 1, 0 },
333 { "DDR", 1, 0, 10, 1, 0 }, 337 { "DDR", 1, 0, 10, 1, 0 },
334 { "DDR VTT", 2, 0, 10, 1, 0 }, 338 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -357,7 +361,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
357 { "AUX5 Fan", 39, 2, 60, 1, 0 }, 361 { "AUX5 Fan", 39, 2, 60, 1, 0 },
358 { NULL, 0, 0, 0, 0, 0 } } 362 { NULL, 0, 0, 0, 0, 0 } }
359 }, 363 },
360 { 0x0014, "AB9", /* + AB9 Pro */ { 364 { 0x0014, { "AB9", "AB9 Pro", NULL }, {
361 { "CPU Core", 0, 0, 10, 1, 0 }, 365 { "CPU Core", 0, 0, 10, 1, 0 },
362 { "DDR", 1, 0, 10, 1, 0 }, 366 { "DDR", 1, 0, 10, 1, 0 },
363 { "DDR VTT", 2, 0, 10, 1, 0 }, 367 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -378,7 +382,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
378 { "SYS Fan", 34, 2, 60, 1, 0 }, 382 { "SYS Fan", 34, 2, 60, 1, 0 },
379 { NULL, 0, 0, 0, 0, 0 } } 383 { NULL, 0, 0, 0, 0, 0 } }
380 }, 384 },
381 { 0x0015, NULL /* Unknown, need DMI string */, { 385 { 0x0015, { NULL } /* Unknown, need DMI string */, {
382 { "CPU Core", 0, 0, 10, 1, 0 }, 386 { "CPU Core", 0, 0, 10, 1, 0 },
383 { "DDR", 1, 0, 20, 1, 0 }, 387 { "DDR", 1, 0, 20, 1, 0 },
384 { "DDR VTT", 2, 0, 10, 1, 0 }, 388 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -402,7 +406,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
402 { "AUX3 Fan", 36, 2, 60, 1, 0 }, 406 { "AUX3 Fan", 36, 2, 60, 1, 0 },
403 { NULL, 0, 0, 0, 0, 0 } } 407 { NULL, 0, 0, 0, 0, 0 } }
404 }, 408 },
405 { 0x0016, "AW9D-MAX", { 409 { 0x0016, { "AW9D-MAX", NULL }, {
406 { "CPU Core", 0, 0, 10, 1, 0 }, 410 { "CPU Core", 0, 0, 10, 1, 0 },
407 { "DDR2", 1, 0, 20, 1, 0 }, 411 { "DDR2", 1, 0, 20, 1, 0 },
408 { "DDR2 VTT", 2, 0, 10, 1, 0 }, 412 { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -430,7 +434,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
430 { "OTES1 Fan", 38, 2, 60, 1, 0 }, 434 { "OTES1 Fan", 38, 2, 60, 1, 0 },
431 { NULL, 0, 0, 0, 0, 0 } } 435 { NULL, 0, 0, 0, 0, 0 } }
432 }, 436 },
433 { 0x0017, NULL /* Unknown, need DMI string */, { 437 { 0x0017, { NULL } /* Unknown, need DMI string */, {
434 { "CPU Core", 0, 0, 10, 1, 0 }, 438 { "CPU Core", 0, 0, 10, 1, 0 },
435 { "DDR2", 1, 0, 20, 1, 0 }, 439 { "DDR2", 1, 0, 20, 1, 0 },
436 { "DDR2 VTT", 2, 0, 10, 1, 0 }, 440 { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -455,7 +459,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
455 { "AUX3 FAN", 37, 2, 60, 1, 0 }, 459 { "AUX3 FAN", 37, 2, 60, 1, 0 },
456 { NULL, 0, 0, 0, 0, 0 } } 460 { NULL, 0, 0, 0, 0, 0 } }
457 }, 461 },
458 { 0x0018, "AB9 QuadGT", { 462 { 0x0018, { "AB9 QuadGT", NULL }, {
459 { "CPU Core", 0, 0, 10, 1, 0 }, 463 { "CPU Core", 0, 0, 10, 1, 0 },
460 { "DDR2", 1, 0, 20, 1, 0 }, 464 { "DDR2", 1, 0, 20, 1, 0 },
461 { "DDR2 VTT", 2, 0, 10, 1, 0 }, 465 { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -482,7 +486,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
482 { "AUX3 Fan", 36, 2, 60, 1, 0 }, 486 { "AUX3 Fan", 36, 2, 60, 1, 0 },
483 { NULL, 0, 0, 0, 0, 0 } } 487 { NULL, 0, 0, 0, 0, 0 } }
484 }, 488 },
485 { 0x0019, "IN9 32X MAX", { 489 { 0x0019, { "IN9 32X MAX", NULL }, {
486 { "CPU Core", 7, 0, 10, 1, 0 }, 490 { "CPU Core", 7, 0, 10, 1, 0 },
487 { "DDR2", 13, 0, 20, 1, 0 }, 491 { "DDR2", 13, 0, 20, 1, 0 },
488 { "DDR2 VTT", 14, 0, 10, 1, 0 }, 492 { "DDR2 VTT", 14, 0, 10, 1, 0 },
@@ -509,7 +513,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
509 { "AUX3 FAN", 36, 2, 60, 1, 0 }, 513 { "AUX3 FAN", 36, 2, 60, 1, 0 },
510 { NULL, 0, 0, 0, 0, 0 } } 514 { NULL, 0, 0, 0, 0, 0 } }
511 }, 515 },
512 { 0x001A, "IP35 Pro", { 516 { 0x001A, { "IP35 Pro", "IP35 Pro XE", NULL }, {
513 { "CPU Core", 0, 0, 10, 1, 0 }, 517 { "CPU Core", 0, 0, 10, 1, 0 },
514 { "DDR2", 1, 0, 20, 1, 0 }, 518 { "DDR2", 1, 0, 20, 1, 0 },
515 { "DDR2 VTT", 2, 0, 10, 1, 0 }, 519 { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -537,7 +541,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
537 { "AUX4 Fan", 37, 2, 60, 1, 0 }, 541 { "AUX4 Fan", 37, 2, 60, 1, 0 },
538 { NULL, 0, 0, 0, 0, 0 } } 542 { NULL, 0, 0, 0, 0, 0 } }
539 }, 543 },
540 { 0x001B, NULL /* Unknown, need DMI string */, { 544 { 0x001B, { NULL } /* Unknown, need DMI string */, {
541 { "CPU Core", 0, 0, 10, 1, 0 }, 545 { "CPU Core", 0, 0, 10, 1, 0 },
542 { "DDR3", 1, 0, 20, 1, 0 }, 546 { "DDR3", 1, 0, 20, 1, 0 },
543 { "DDR3 VTT", 2, 0, 10, 1, 0 }, 547 { "DDR3 VTT", 2, 0, 10, 1, 0 },
@@ -564,7 +568,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
564 { "AUX3 Fan", 36, 2, 60, 1, 0 }, 568 { "AUX3 Fan", 36, 2, 60, 1, 0 },
565 { NULL, 0, 0, 0, 0, 0 } } 569 { NULL, 0, 0, 0, 0, 0 } }
566 }, 570 },
567 { 0x001C, "IX38 QuadGT", { 571 { 0x001C, { "IX38 QuadGT", NULL }, {
568 { "CPU Core", 0, 0, 10, 1, 0 }, 572 { "CPU Core", 0, 0, 10, 1, 0 },
569 { "DDR2", 1, 0, 20, 1, 0 }, 573 { "DDR2", 1, 0, 20, 1, 0 },
570 { "DDR2 VTT", 2, 0, 10, 1, 0 }, 574 { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -591,7 +595,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
591 { "AUX3 Fan", 36, 2, 60, 1, 0 }, 595 { "AUX3 Fan", 36, 2, 60, 1, 0 },
592 { NULL, 0, 0, 0, 0, 0 } } 596 { NULL, 0, 0, 0, 0, 0 } }
593 }, 597 },
594 { 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } } 598 { 0x0000, { NULL }, { { NULL, 0, 0, 0, 0, 0 } } }
595}; 599};
596 600
597 601
@@ -946,15 +950,6 @@ static int __devinit abituguru3_probe(struct platform_device *pdev)
946 printk(KERN_INFO ABIT_UGURU3_NAME ": found Abit uGuru3, motherboard " 950 printk(KERN_INFO ABIT_UGURU3_NAME ": found Abit uGuru3, motherboard "
947 "ID: %04X\n", (unsigned int)id); 951 "ID: %04X\n", (unsigned int)id);
948 952
949#ifdef CONFIG_DMI
950 if (!abituguru3_motherboards[i].dmi_name) {
951 printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was "
952 "not detected using DMI. Please send the output of "
953 "\"dmidecode\" to the abituguru3 maintainer "
954 "(see MAINTAINERS)\n");
955 }
956#endif
957
958 /* Fill the sysfs attr array */ 953 /* Fill the sysfs attr array */
959 sysfs_attr_i = 0; 954 sysfs_attr_i = 0;
960 sysfs_filename = data->sysfs_names; 955 sysfs_filename = data->sysfs_names;
@@ -1131,6 +1126,7 @@ static int __init abituguru3_dmi_detect(void)
1131{ 1126{
1132 const char *board_vendor, *board_name; 1127 const char *board_vendor, *board_name;
1133 int i, err = (force) ? 1 : -ENODEV; 1128 int i, err = (force) ? 1 : -ENODEV;
1129 const char *const *dmi_name;
1134 size_t sublen; 1130 size_t sublen;
1135 1131
1136 board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); 1132 board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
@@ -1151,17 +1147,17 @@ static int __init abituguru3_dmi_detect(void)
1151 sublen--; 1147 sublen--;
1152 1148
1153 for (i = 0; abituguru3_motherboards[i].id; i++) { 1149 for (i = 0; abituguru3_motherboards[i].id; i++) {
1154 const char *dmi_name = abituguru3_motherboards[i].dmi_name; 1150 dmi_name = abituguru3_motherboards[i].dmi_name;
1155 if (!dmi_name || strlen(dmi_name) != sublen) 1151 for ( ; *dmi_name; dmi_name++) {
1156 continue; 1152 if (strlen(*dmi_name) != sublen)
1157 if (!strncasecmp(board_name, dmi_name, sublen)) 1153 continue;
1158 break; 1154 if (!strncasecmp(board_name, *dmi_name, sublen))
1155 return 0;
1156 }
1159 } 1157 }
1160 1158
1161 if (!abituguru3_motherboards[i].id) 1159 /* No match found */
1162 return 1; 1160 return 1;
1163
1164 return 0;
1165} 1161}
1166 1162
1167#else /* !CONFIG_DMI */ 1163#else /* !CONFIG_DMI */
@@ -1221,6 +1217,13 @@ static int __init abituguru3_init(void)
1221 err = abituguru3_detect(); 1217 err = abituguru3_detect();
1222 if (err) 1218 if (err)
1223 return err; 1219 return err;
1220
1221#ifdef CONFIG_DMI
1222 printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was "
1223 "not detected using DMI. Please send the output of "
1224 "\"dmidecode\" to the abituguru3 maintainer "
1225 "(see MAINTAINERS)\n");
1226#endif
1224 } 1227 }
1225 1228
1226 err = platform_driver_register(&abituguru3_driver); 1229 err = platform_driver_register(&abituguru3_driver);