diff options
Diffstat (limited to 'drivers/platform/x86/acerhdf.c')
-rw-r--r-- | drivers/platform/x86/acerhdf.c | 68 |
1 files changed, 46 insertions, 22 deletions
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 79b15b9d9cf0..7b2384d674d0 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c | |||
@@ -52,7 +52,7 @@ | |||
52 | */ | 52 | */ |
53 | #undef START_IN_KERNEL_MODE | 53 | #undef START_IN_KERNEL_MODE |
54 | 54 | ||
55 | #define DRV_VER "0.5.20" | 55 | #define DRV_VER "0.5.22" |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * According to the Atom N270 datasheet, | 58 | * According to the Atom N270 datasheet, |
@@ -156,19 +156,25 @@ static const struct bios_settings_t bios_tbl[] = { | |||
156 | {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x20, 0x00} }, | 156 | {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x20, 0x00} }, |
157 | /* Acer 1410 */ | 157 | /* Acer 1410 */ |
158 | {"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | 158 | {"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, |
159 | /* special BIOS / other */ | 159 | {"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, |
160 | /* Acer 1810xx */ | ||
161 | {"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | ||
162 | {"Acer", "Aspire 1810T", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | ||
163 | {"Acer", "Aspire 1810T", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | ||
164 | {"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | ||
165 | /* Gateway */ | ||
160 | {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x21, 0x00} }, | 166 | {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x21, 0x00} }, |
161 | {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x20, 0x00} }, | 167 | {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x20, 0x00} }, |
162 | {"Gateway ", "LT31 ", "v1.3103 ", 0x55, 0x58, | 168 | {"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x10, 0x0f, 0x00} }, |
163 | {0x10, 0x0f, 0x00} }, | 169 | {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x10, 0x0f, 0x00} }, |
164 | {"Gateway ", "LT31 ", "v1.3201 ", 0x55, 0x58, | 170 | {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x10, 0x0f, 0x00} }, |
165 | {0x10, 0x0f, 0x00} }, | 171 | /* Packard Bell */ |
166 | {"Gateway ", "LT31 ", "v1.3302 ", 0x55, 0x58, | ||
167 | {0x10, 0x0f, 0x00} }, | ||
168 | {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x21, 0x00} }, | 172 | {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x21, 0x00} }, |
169 | {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} }, | 173 | {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} }, |
170 | {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x21, 0x00} }, | 174 | {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x21, 0x00} }, |
171 | {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} }, | 175 | {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} }, |
176 | {"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | ||
177 | {"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | ||
172 | /* pewpew-terminator */ | 178 | /* pewpew-terminator */ |
173 | {"", "", "", 0, 0, {0, 0, 0} } | 179 | {"", "", "", 0, 0, {0, 0, 0} } |
174 | }; | 180 | }; |
@@ -486,13 +492,26 @@ static struct platform_driver acerhdf_driver = { | |||
486 | .remove = acerhdf_remove, | 492 | .remove = acerhdf_remove, |
487 | }; | 493 | }; |
488 | 494 | ||
495 | /* checks if str begins with start */ | ||
496 | static int str_starts_with(const char *str, const char *start) | ||
497 | { | ||
498 | unsigned long str_len = 0, start_len = 0; | ||
499 | |||
500 | str_len = strlen(str); | ||
501 | start_len = strlen(start); | ||
502 | |||
503 | if (str_len >= start_len && | ||
504 | !strncmp(str, start, start_len)) | ||
505 | return 1; | ||
506 | |||
507 | return 0; | ||
508 | } | ||
489 | 509 | ||
490 | /* check hardware */ | 510 | /* check hardware */ |
491 | static int acerhdf_check_hardware(void) | 511 | static int acerhdf_check_hardware(void) |
492 | { | 512 | { |
493 | char const *vendor, *version, *product; | 513 | char const *vendor, *version, *product; |
494 | int i; | 514 | const struct bios_settings_t *bt = NULL; |
495 | unsigned long prod_len = 0; | ||
496 | 515 | ||
497 | /* get BIOS data */ | 516 | /* get BIOS data */ |
498 | vendor = dmi_get_system_info(DMI_SYS_VENDOR); | 517 | vendor = dmi_get_system_info(DMI_SYS_VENDOR); |
@@ -514,20 +533,20 @@ static int acerhdf_check_hardware(void) | |||
514 | kernelmode = 0; | 533 | kernelmode = 0; |
515 | } | 534 | } |
516 | 535 | ||
517 | prod_len = strlen(product); | ||
518 | |||
519 | if (verbose) | 536 | if (verbose) |
520 | pr_info("BIOS info: %s %s, product: %s\n", | 537 | pr_info("BIOS info: %s %s, product: %s\n", |
521 | vendor, version, product); | 538 | vendor, version, product); |
522 | 539 | ||
523 | /* search BIOS version and vendor in BIOS settings table */ | 540 | /* search BIOS version and vendor in BIOS settings table */ |
524 | for (i = 0; bios_tbl[i].version[0]; i++) { | 541 | for (bt = bios_tbl; bt->vendor[0]; bt++) { |
525 | if (strlen(bios_tbl[i].product) >= prod_len && | 542 | /* |
526 | !strncmp(bios_tbl[i].product, product, | 543 | * check if actual hardware BIOS vendor, product and version |
527 | strlen(bios_tbl[i].product)) && | 544 | * IDs start with the strings of BIOS table entry |
528 | !strcmp(bios_tbl[i].vendor, vendor) && | 545 | */ |
529 | !strcmp(bios_tbl[i].version, version)) { | 546 | if (str_starts_with(vendor, bt->vendor) && |
530 | bios_cfg = &bios_tbl[i]; | 547 | str_starts_with(product, bt->product) && |
548 | str_starts_with(version, bt->version)) { | ||
549 | bios_cfg = bt; | ||
531 | break; | 550 | break; |
532 | } | 551 | } |
533 | } | 552 | } |
@@ -640,9 +659,14 @@ static void __exit acerhdf_exit(void) | |||
640 | MODULE_LICENSE("GPL"); | 659 | MODULE_LICENSE("GPL"); |
641 | MODULE_AUTHOR("Peter Feuerer"); | 660 | MODULE_AUTHOR("Peter Feuerer"); |
642 | MODULE_DESCRIPTION("Aspire One temperature and fan driver"); | 661 | MODULE_DESCRIPTION("Aspire One temperature and fan driver"); |
643 | MODULE_ALIAS("dmi:*:*Acer*:*:"); | 662 | MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:"); |
644 | MODULE_ALIAS("dmi:*:*Gateway*:*:"); | 663 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire 1410*:"); |
645 | MODULE_ALIAS("dmi:*:*Packard Bell*:*:"); | 664 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire 1810*:"); |
665 | MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:"); | ||
666 | MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:"); | ||
667 | MODULE_ALIAS("dmi:*:*Packard Bell*:pnAOA*:"); | ||
668 | MODULE_ALIAS("dmi:*:*Packard Bell*:pnDOA*:"); | ||
669 | MODULE_ALIAS("dmi:*:*Packard Bell*:pnDOTMU*:"); | ||
646 | 670 | ||
647 | module_init(acerhdf_init); | 671 | module_init(acerhdf_init); |
648 | module_exit(acerhdf_exit); | 672 | module_exit(acerhdf_exit); |