Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
hwmon: (s3c-hwmon) Disable build for S3C64xx
MAINTAINERS: Fix Riku Voipio's address
hwmon: (asus_atk0110) Enable the EC
hwmon: (asus_atk0110) Refactor the code
hwmon: (sht15) Fix spurious section mismatch warning

+304 -70
+1 -1
MAINTAINERS
··· 2065 2065 F: fs/* 2066 2066 2067 2067 FINTEK F75375S HARDWARE MONITOR AND FAN CONTROLLER DRIVER 2068 - M: Riku Voipio <riku.vipio@iki.fi> 2068 + M: Riku Voipio <riku.voipio@iki.fi> 2069 2069 L: lm-sensors@lm-sensors.org 2070 2070 S: Maintained 2071 2071 F: drivers/hwmon/f75375s.c
+1 -1
drivers/hwmon/Kconfig
··· 675 675 676 676 config SENSORS_S3C 677 677 tristate "S3C24XX/S3C64XX Inbuilt ADC" 678 - depends on ARCH_S3C2410 || ARCH_S3C64XX 678 + depends on ARCH_S3C2410 679 679 help 680 680 If you say yes here you get support for the on-board ADCs of 681 681 the Samsung S3C24XX or S3C64XX series of SoC
+296 -67
drivers/hwmon/asus_atk0110.c
··· 35 35 #define METHOD_OLD_ENUM_FAN "FSIF" 36 36 37 37 #define ATK_MUX_HWMON 0x00000006ULL 38 + #define ATK_MUX_MGMT 0x00000011ULL 38 39 39 40 #define ATK_CLASS_MASK 0xff000000ULL 40 41 #define ATK_CLASS_FREQ_CTL 0x03000000ULL 41 42 #define ATK_CLASS_FAN_CTL 0x04000000ULL 42 43 #define ATK_CLASS_HWMON 0x06000000ULL 44 + #define ATK_CLASS_MGMT 0x11000000ULL 43 45 44 46 #define ATK_TYPE_MASK 0x00ff0000ULL 45 47 #define HWMON_TYPE_VOLT 0x00020000ULL 46 48 #define HWMON_TYPE_TEMP 0x00030000ULL 47 49 #define HWMON_TYPE_FAN 0x00040000ULL 48 50 49 - #define HWMON_SENSOR_ID_MASK 0x0000ffffULL 51 + #define ATK_ELEMENT_ID_MASK 0x0000ffffULL 52 + 53 + #define ATK_EC_ID 0x11060004ULL 50 54 51 55 enum atk_pack_member { 52 56 HWMON_PACK_FLAGS, ··· 93 89 /* new inteface */ 94 90 acpi_handle enumerate_handle; 95 91 acpi_handle read_handle; 92 + acpi_handle write_handle; 93 + 94 + bool disable_ec; 96 95 97 96 int voltage_count; 98 97 int temperature_count; ··· 136 129 char const *acpi_name; 137 130 }; 138 131 139 - struct atk_acpi_buffer_u64 { 140 - union acpi_object buf; 141 - u64 value; 132 + /* Return buffer format: 133 + * [0-3] "value" is valid flag 134 + * [4-7] value 135 + * [8- ] unknown stuff on newer mobos 136 + */ 137 + struct atk_acpi_ret_buffer { 138 + u32 flags; 139 + u32 value; 140 + u8 data[]; 141 + }; 142 + 143 + /* Input buffer used for GITM and SITM methods */ 144 + struct atk_acpi_input_buf { 145 + u32 id; 146 + u32 param1; 147 + u32 param2; 142 148 }; 143 149 144 150 static int atk_add(struct acpi_device *device); ··· 459 439 return 0; 460 440 } 461 441 442 + static union acpi_object *atk_ggrp(struct atk_data *data, u16 mux) 443 + { 444 + struct device *dev = &data->acpi_dev->dev; 445 + struct acpi_buffer buf; 446 + acpi_status ret; 447 + struct acpi_object_list params; 448 + union acpi_object id; 449 + union acpi_object *pack; 450 + 451 + id.type = ACPI_TYPE_INTEGER; 452 + id.integer.value = mux; 453 + params.count = 1; 454 + params.pointer = &id; 455 + 456 + buf.length = ACPI_ALLOCATE_BUFFER; 457 + ret = acpi_evaluate_object(data->enumerate_handle, NULL, &params, &buf); 458 + if (ret != AE_OK) { 459 + dev_err(dev, "GGRP[%#x] ACPI exception: %s\n", mux, 460 + acpi_format_exception(ret)); 461 + return ERR_PTR(-EIO); 462 + } 463 + pack = buf.pointer; 464 + if (pack->type != ACPI_TYPE_PACKAGE) { 465 + /* Execution was successful, but the id was not found */ 466 + ACPI_FREE(pack); 467 + return ERR_PTR(-ENOENT); 468 + } 469 + 470 + if (pack->package.count < 1) { 471 + dev_err(dev, "GGRP[%#x] package is too small\n", mux); 472 + ACPI_FREE(pack); 473 + return ERR_PTR(-EIO); 474 + } 475 + return pack; 476 + } 477 + 478 + static union acpi_object *atk_gitm(struct atk_data *data, u64 id) 479 + { 480 + struct device *dev = &data->acpi_dev->dev; 481 + struct atk_acpi_input_buf buf; 482 + union acpi_object tmp; 483 + struct acpi_object_list params; 484 + struct acpi_buffer ret; 485 + union acpi_object *obj; 486 + acpi_status status; 487 + 488 + buf.id = id; 489 + buf.param1 = 0; 490 + buf.param2 = 0; 491 + 492 + tmp.type = ACPI_TYPE_BUFFER; 493 + tmp.buffer.pointer = (u8 *)&buf; 494 + tmp.buffer.length = sizeof(buf); 495 + 496 + params.count = 1; 497 + params.pointer = (void *)&tmp; 498 + 499 + ret.length = ACPI_ALLOCATE_BUFFER; 500 + status = acpi_evaluate_object_typed(data->read_handle, NULL, &params, 501 + &ret, ACPI_TYPE_BUFFER); 502 + if (status != AE_OK) { 503 + dev_warn(dev, "GITM[%#llx] ACPI exception: %s\n", id, 504 + acpi_format_exception(status)); 505 + return ERR_PTR(-EIO); 506 + } 507 + obj = ret.pointer; 508 + 509 + /* Sanity check */ 510 + if (obj->buffer.length < 8) { 511 + dev_warn(dev, "Unexpected ASBF length: %u\n", 512 + obj->buffer.length); 513 + ACPI_FREE(obj); 514 + return ERR_PTR(-EIO); 515 + } 516 + return obj; 517 + } 518 + 519 + static union acpi_object *atk_sitm(struct atk_data *data, 520 + struct atk_acpi_input_buf *buf) 521 + { 522 + struct device *dev = &data->acpi_dev->dev; 523 + struct acpi_object_list params; 524 + union acpi_object tmp; 525 + struct acpi_buffer ret; 526 + union acpi_object *obj; 527 + acpi_status status; 528 + 529 + tmp.type = ACPI_TYPE_BUFFER; 530 + tmp.buffer.pointer = (u8 *)buf; 531 + tmp.buffer.length = sizeof(*buf); 532 + 533 + params.count = 1; 534 + params.pointer = &tmp; 535 + 536 + ret.length = ACPI_ALLOCATE_BUFFER; 537 + status = acpi_evaluate_object_typed(data->write_handle, NULL, &params, 538 + &ret, ACPI_TYPE_BUFFER); 539 + if (status != AE_OK) { 540 + dev_warn(dev, "SITM[%#x] ACPI exception: %s\n", buf->id, 541 + acpi_format_exception(status)); 542 + return ERR_PTR(-EIO); 543 + } 544 + obj = ret.pointer; 545 + 546 + /* Sanity check */ 547 + if (obj->buffer.length < 8) { 548 + dev_warn(dev, "Unexpected ASBF length: %u\n", 549 + obj->buffer.length); 550 + ACPI_FREE(obj); 551 + return ERR_PTR(-EIO); 552 + } 553 + return obj; 554 + } 555 + 462 556 static int atk_read_value_new(struct atk_sensor_data *sensor, u64 *value) 463 557 { 464 558 struct atk_data *data = sensor->data; 465 559 struct device *dev = &data->acpi_dev->dev; 466 - struct acpi_object_list params; 467 - struct acpi_buffer ret; 468 - union acpi_object id; 469 - struct atk_acpi_buffer_u64 tmp; 470 - acpi_status status; 560 + union acpi_object *obj; 561 + struct atk_acpi_ret_buffer *buf; 562 + int err = 0; 471 563 472 - id.type = ACPI_TYPE_INTEGER; 473 - id.integer.value = sensor->id; 564 + obj = atk_gitm(data, sensor->id); 565 + if (IS_ERR(obj)) 566 + return PTR_ERR(obj); 474 567 475 - params.count = 1; 476 - params.pointer = &id; 477 - 478 - tmp.buf.type = ACPI_TYPE_BUFFER; 479 - tmp.buf.buffer.pointer = (u8 *)&tmp.value; 480 - tmp.buf.buffer.length = sizeof(u64); 481 - ret.length = sizeof(tmp); 482 - ret.pointer = &tmp; 483 - 484 - status = acpi_evaluate_object_typed(data->read_handle, NULL, &params, 485 - &ret, ACPI_TYPE_BUFFER); 486 - if (status != AE_OK) { 487 - dev_warn(dev, "%s: ACPI exception: %s\n", __func__, 488 - acpi_format_exception(status)); 489 - return -EIO; 490 - } 491 - 492 - /* Return buffer format: 493 - * [0-3] "value" is valid flag 494 - * [4-7] value 495 - */ 496 - if (!(tmp.value & 0xffffffff)) { 568 + buf = (struct atk_acpi_ret_buffer *)obj->buffer.pointer; 569 + if (buf->flags == 0) { 497 570 /* The reading is not valid, possible causes: 498 571 * - sensor failure 499 572 * - enumeration was FUBAR (and we didn't notice) 500 573 */ 501 - dev_info(dev, "Failure: %#llx\n", tmp.value); 502 - return -EIO; 574 + dev_warn(dev, "Read failed, sensor = %#llx\n", sensor->id); 575 + err = -EIO; 576 + goto out; 503 577 } 504 578 505 - *value = (tmp.value & 0xffffffff00000000ULL) >> 32; 506 - 507 - return 0; 579 + *value = buf->value; 580 + out: 581 + ACPI_FREE(obj); 582 + return err; 508 583 } 509 584 510 585 static int atk_read_value(struct atk_sensor_data *sensor, u64 *value) ··· 828 713 return ret; 829 714 } 830 715 716 + static int atk_ec_present(struct atk_data *data) 717 + { 718 + struct device *dev = &data->acpi_dev->dev; 719 + union acpi_object *pack; 720 + union acpi_object *ec; 721 + int ret; 722 + int i; 723 + 724 + pack = atk_ggrp(data, ATK_MUX_MGMT); 725 + if (IS_ERR(pack)) { 726 + if (PTR_ERR(pack) == -ENOENT) { 727 + /* The MGMT class does not exists - that's ok */ 728 + dev_dbg(dev, "Class %#llx not found\n", ATK_MUX_MGMT); 729 + return 0; 730 + } 731 + return PTR_ERR(pack); 732 + } 733 + 734 + /* Search the EC */ 735 + ec = NULL; 736 + for (i = 0; i < pack->package.count; i++) { 737 + union acpi_object *obj = &pack->package.elements[i]; 738 + union acpi_object *id; 739 + 740 + if (obj->type != ACPI_TYPE_PACKAGE) 741 + continue; 742 + 743 + id = &obj->package.elements[0]; 744 + if (id->type != ACPI_TYPE_INTEGER) 745 + continue; 746 + 747 + if (id->integer.value == ATK_EC_ID) { 748 + ec = obj; 749 + break; 750 + } 751 + } 752 + 753 + ret = (ec != NULL); 754 + if (!ret) 755 + /* The system has no EC */ 756 + dev_dbg(dev, "EC not found\n"); 757 + 758 + ACPI_FREE(pack); 759 + return ret; 760 + } 761 + 762 + static int atk_ec_enabled(struct atk_data *data) 763 + { 764 + struct device *dev = &data->acpi_dev->dev; 765 + union acpi_object *obj; 766 + struct atk_acpi_ret_buffer *buf; 767 + int err; 768 + 769 + obj = atk_gitm(data, ATK_EC_ID); 770 + if (IS_ERR(obj)) { 771 + dev_err(dev, "Unable to query EC status\n"); 772 + return PTR_ERR(obj); 773 + } 774 + buf = (struct atk_acpi_ret_buffer *)obj->buffer.pointer; 775 + 776 + if (buf->flags == 0) { 777 + dev_err(dev, "Unable to query EC status\n"); 778 + err = -EIO; 779 + } else { 780 + err = (buf->value != 0); 781 + dev_dbg(dev, "EC is %sabled\n", 782 + err ? "en" : "dis"); 783 + } 784 + 785 + ACPI_FREE(obj); 786 + return err; 787 + } 788 + 789 + static int atk_ec_ctl(struct atk_data *data, int enable) 790 + { 791 + struct device *dev = &data->acpi_dev->dev; 792 + union acpi_object *obj; 793 + struct atk_acpi_input_buf sitm; 794 + struct atk_acpi_ret_buffer *ec_ret; 795 + int err = 0; 796 + 797 + sitm.id = ATK_EC_ID; 798 + sitm.param1 = enable; 799 + sitm.param2 = 0; 800 + 801 + obj = atk_sitm(data, &sitm); 802 + if (IS_ERR(obj)) { 803 + dev_err(dev, "Failed to %sable the EC\n", 804 + enable ? "en" : "dis"); 805 + return PTR_ERR(obj); 806 + } 807 + ec_ret = (struct atk_acpi_ret_buffer *)obj->buffer.pointer; 808 + if (ec_ret->flags == 0) { 809 + dev_err(dev, "Failed to %sable the EC\n", 810 + enable ? "en" : "dis"); 811 + err = -EIO; 812 + } else { 813 + dev_info(dev, "EC %sabled\n", 814 + enable ? "en" : "dis"); 815 + } 816 + 817 + ACPI_FREE(obj); 818 + return err; 819 + } 820 + 831 821 static int atk_enumerate_new_hwmon(struct atk_data *data) 832 822 { 833 823 struct device *dev = &data->acpi_dev->dev; 834 - struct acpi_buffer buf; 835 - acpi_status ret; 836 - struct acpi_object_list params; 837 - union acpi_object id; 838 824 union acpi_object *pack; 839 825 int err; 840 826 int i; 841 827 828 + err = atk_ec_present(data); 829 + if (err < 0) 830 + return err; 831 + if (err) { 832 + err = atk_ec_enabled(data); 833 + if (err < 0) 834 + return err; 835 + /* If the EC was disabled we will disable it again on unload */ 836 + data->disable_ec = err; 837 + 838 + err = atk_ec_ctl(data, 1); 839 + if (err) { 840 + data->disable_ec = false; 841 + return err; 842 + } 843 + } 844 + 842 845 dev_dbg(dev, "Enumerating hwmon sensors\n"); 843 846 844 - id.type = ACPI_TYPE_INTEGER; 845 - id.integer.value = ATK_MUX_HWMON; 846 - params.count = 1; 847 - params.pointer = &id; 848 - 849 - buf.length = ACPI_ALLOCATE_BUFFER; 850 - ret = acpi_evaluate_object_typed(data->enumerate_handle, NULL, &params, 851 - &buf, ACPI_TYPE_PACKAGE); 852 - if (ret != AE_OK) { 853 - dev_warn(dev, METHOD_ENUMERATE ": ACPI exception: %s\n", 854 - acpi_format_exception(ret)); 855 - return -ENODEV; 856 - } 857 - 858 - /* Result must be a package */ 859 - pack = buf.pointer; 860 - 861 - if (pack->package.count < 1) { 862 - dev_dbg(dev, "%s: hwmon package is too small: %d\n", __func__, 863 - pack->package.count); 864 - err = -EINVAL; 865 - goto out; 866 - } 847 + pack = atk_ggrp(data, ATK_MUX_HWMON); 848 + if (IS_ERR(pack)) 849 + return PTR_ERR(pack); 867 850 868 851 for (i = 0; i < pack->package.count; i++) { 869 852 union acpi_object *obj = &pack->package.elements[i]; ··· 971 758 972 759 err = data->voltage_count + data->temperature_count + data->fan_count; 973 760 974 - out: 975 - ACPI_FREE(buf.pointer); 761 + ACPI_FREE(pack); 976 762 return err; 977 763 } 978 764 ··· 1107 895 } 1108 896 data->read_handle = ret; 1109 897 898 + /* De-multiplexer (write) */ 899 + status = acpi_get_handle(data->atk_handle, METHOD_WRITE, &ret); 900 + if (status != AE_OK) { 901 + dev_dbg(dev, "method " METHOD_READ " not found: %s\n", 902 + acpi_format_exception(status)); 903 + return -ENODEV; 904 + } 905 + data->write_handle = ret; 906 + 1110 907 return 0; 1111 908 } 1112 909 ··· 1136 915 data->acpi_dev = device; 1137 916 data->atk_handle = device->handle; 1138 917 INIT_LIST_HEAD(&data->sensor_list); 918 + data->disable_ec = false; 1139 919 1140 920 buf.length = ACPI_ALLOCATE_BUFFER; 1141 921 ret = acpi_evaluate_object_typed(data->atk_handle, BOARD_ID, NULL, ··· 1195 973 cleanup: 1196 974 atk_free_sensors(data); 1197 975 out: 976 + if (data->disable_ec) 977 + atk_ec_ctl(data, 0); 1198 978 kfree(data); 1199 979 return err; 1200 980 } ··· 1211 987 atk_remove_files(data); 1212 988 atk_free_sensors(data); 1213 989 hwmon_device_unregister(data->hwmon_dev); 990 + 991 + if (data->disable_ec) { 992 + if (atk_ec_ctl(data, 0)) 993 + dev_err(&device->dev, "Failed to disable EC\n"); 994 + } 1214 995 1215 996 kfree(data); 1216 997
+6 -1
drivers/hwmon/sht15.c
··· 623 623 } 624 624 625 625 626 - static struct platform_driver sht_drivers[] = { 626 + /* 627 + * sht_drivers simultaneously refers to __devinit and __devexit function 628 + * which causes spurious section mismatch warning. So use __refdata to 629 + * get rid from this. 630 + */ 631 + static struct platform_driver __refdata sht_drivers[] = { 627 632 { 628 633 .driver = { 629 634 .name = "sht10",