diff options
Diffstat (limited to 'drivers/hwmon/applesmc.c')
-rw-r--r-- | drivers/hwmon/applesmc.c | 48 |
1 files changed, 17 insertions, 31 deletions
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index b6598aa557a0..87a5fd51dd5e 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -162,6 +162,10 @@ static const char *temperature_sensors_sets[][41] = { | |||
162 | /* Set 22: MacBook Pro 7,1 */ | 162 | /* Set 22: MacBook Pro 7,1 */ |
163 | { "TB0T", "TB1T", "TB2T", "TC0D", "TC0P", "TN0D", "TN0P", "TN0S", | 163 | { "TB0T", "TB1T", "TB2T", "TC0D", "TC0P", "TN0D", "TN0P", "TN0S", |
164 | "TN1D", "TN1F", "TN1G", "TN1S", "Th1H", "Ts0P", "Ts0S", NULL }, | 164 | "TN1D", "TN1F", "TN1G", "TN1S", "Th1H", "Ts0P", "Ts0S", NULL }, |
165 | /* Set 23: MacBook Air 3,1 */ | ||
166 | { "TB0T", "TB1T", "TB2T", "TC0D", "TC0E", "TC0P", "TC1E", "TCZ3", | ||
167 | "TCZ4", "TCZ5", "TG0E", "TG1E", "TG2E", "TGZ3", "TGZ4", "TGZ5", | ||
168 | "TH0F", "TH0O", "TM0P" }, | ||
165 | }; | 169 | }; |
166 | 170 | ||
167 | /* List of keys used to read/write fan speeds */ | 171 | /* List of keys used to read/write fan speeds */ |
@@ -444,38 +448,22 @@ static int applesmc_read_motion_sensor(int index, s16* value) | |||
444 | } | 448 | } |
445 | 449 | ||
446 | /* | 450 | /* |
447 | * applesmc_device_init - initialize the accelerometer. Returns zero on success | 451 | * applesmc_device_init - initialize the accelerometer. Can sleep. |
448 | * and negative error code on failure. Can sleep. | ||
449 | */ | 452 | */ |
450 | static int applesmc_device_init(void) | 453 | static void applesmc_device_init(void) |
451 | { | 454 | { |
452 | int total, ret = -ENXIO; | 455 | int total; |
453 | u8 buffer[2]; | 456 | u8 buffer[2]; |
454 | 457 | ||
455 | if (!applesmc_accelerometer) | 458 | if (!applesmc_accelerometer) |
456 | return 0; | 459 | return; |
457 | 460 | ||
458 | mutex_lock(&applesmc_lock); | 461 | mutex_lock(&applesmc_lock); |
459 | 462 | ||
460 | for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) { | 463 | for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) { |
461 | if (debug) | ||
462 | printk(KERN_DEBUG "applesmc try %d\n", total); | ||
463 | if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) && | 464 | if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) && |
464 | (buffer[0] != 0x00 || buffer[1] != 0x00)) { | 465 | (buffer[0] != 0x00 || buffer[1] != 0x00)) |
465 | if (total == INIT_TIMEOUT_MSECS) { | ||
466 | printk(KERN_DEBUG "applesmc: device has" | ||
467 | " already been initialized" | ||
468 | " (0x%02x, 0x%02x).\n", | ||
469 | buffer[0], buffer[1]); | ||
470 | } else { | ||
471 | printk(KERN_DEBUG "applesmc: device" | ||
472 | " successfully initialized" | ||
473 | " (0x%02x, 0x%02x).\n", | ||
474 | buffer[0], buffer[1]); | ||
475 | } | ||
476 | ret = 0; | ||
477 | goto out; | 466 | goto out; |
478 | } | ||
479 | buffer[0] = 0xe0; | 467 | buffer[0] = 0xe0; |
480 | buffer[1] = 0x00; | 468 | buffer[1] = 0x00; |
481 | applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2); | 469 | applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2); |
@@ -486,7 +474,6 @@ static int applesmc_device_init(void) | |||
486 | 474 | ||
487 | out: | 475 | out: |
488 | mutex_unlock(&applesmc_lock); | 476 | mutex_unlock(&applesmc_lock); |
489 | return ret; | ||
490 | } | 477 | } |
491 | 478 | ||
492 | /* | 479 | /* |
@@ -512,13 +499,8 @@ static int applesmc_get_fan_count(void) | |||
512 | /* Device model stuff */ | 499 | /* Device model stuff */ |
513 | static int applesmc_probe(struct platform_device *dev) | 500 | static int applesmc_probe(struct platform_device *dev) |
514 | { | 501 | { |
515 | int ret; | 502 | applesmc_device_init(); |
516 | |||
517 | ret = applesmc_device_init(); | ||
518 | if (ret) | ||
519 | return ret; | ||
520 | 503 | ||
521 | printk(KERN_INFO "applesmc: device successfully initialized.\n"); | ||
522 | return 0; | 504 | return 0; |
523 | } | 505 | } |
524 | 506 | ||
@@ -535,9 +517,7 @@ static int applesmc_pm_resume(struct device *dev) | |||
535 | /* Reinitialize device on resume from hibernation */ | 517 | /* Reinitialize device on resume from hibernation */ |
536 | static int applesmc_pm_restore(struct device *dev) | 518 | static int applesmc_pm_restore(struct device *dev) |
537 | { | 519 | { |
538 | int ret = applesmc_device_init(); | 520 | applesmc_device_init(); |
539 | if (ret) | ||
540 | return ret; | ||
541 | return applesmc_pm_resume(dev); | 521 | return applesmc_pm_resume(dev); |
542 | } | 522 | } |
543 | 523 | ||
@@ -1524,11 +1504,17 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = { | |||
1524 | { .accelerometer = 1, .light = 1, .temperature_set = 21 }, | 1504 | { .accelerometer = 1, .light = 1, .temperature_set = 21 }, |
1525 | /* MacBook Pro 7,1: accelerometer, backlight and temperature set 22 */ | 1505 | /* MacBook Pro 7,1: accelerometer, backlight and temperature set 22 */ |
1526 | { .accelerometer = 1, .light = 1, .temperature_set = 22 }, | 1506 | { .accelerometer = 1, .light = 1, .temperature_set = 22 }, |
1507 | /* MacBook Air 3,1: accelerometer, backlight and temperature set 23 */ | ||
1508 | { .accelerometer = 0, .light = 0, .temperature_set = 23 }, | ||
1527 | }; | 1509 | }; |
1528 | 1510 | ||
1529 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". | 1511 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". |
1530 | * So we need to put "Apple MacBook Pro" before "Apple MacBook". */ | 1512 | * So we need to put "Apple MacBook Pro" before "Apple MacBook". */ |
1531 | static __initdata struct dmi_system_id applesmc_whitelist[] = { | 1513 | static __initdata struct dmi_system_id applesmc_whitelist[] = { |
1514 | { applesmc_dmi_match, "Apple MacBook Air 3", { | ||
1515 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), | ||
1516 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir3") }, | ||
1517 | &applesmc_dmi_data[23]}, | ||
1532 | { applesmc_dmi_match, "Apple MacBook Air 2", { | 1518 | { applesmc_dmi_match, "Apple MacBook Air 2", { |
1533 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), | 1519 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), |
1534 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir2") }, | 1520 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir2") }, |