aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2012-11-21 05:38:13 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-11-21 05:38:13 -0500
commit851462444d421c223965b12b836bef63da61b57f (patch)
tree495baa14e638817941496c36e1443aed7dae0ea0 /drivers/acpi
parent5a6ea4af0907f995dc06df21a9c9ef764c7cd3bc (diff)
parent6924d99fcdf1a688538a3cdebd1f135c22eec191 (diff)
Merge branch 'for-3.7' of git://git.infradead.org/users/dedekind/l2-mtd
Conflicts: drivers/mtd/nand/nand_base.c
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/Makefile5
-rw-r--r--drivers/acpi/ec.c30
-rw-r--r--drivers/acpi/glue.c1
-rw-r--r--drivers/acpi/processor_driver.c1
-rw-r--r--drivers/acpi/processor_idle.c3
-rw-r--r--drivers/acpi/thermal.c93
-rw-r--r--drivers/acpi/video.c11
7 files changed, 111 insertions, 33 deletions
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 47199e2a9130..82422fe90f81 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -47,6 +47,10 @@ acpi-y += video_detect.o
47endif 47endif
48 48
49# These are (potentially) separate modules 49# These are (potentially) separate modules
50
51# IPMI may be used by other drivers, so it has to initialise before them
52obj-$(CONFIG_ACPI_IPMI) += acpi_ipmi.o
53
50obj-$(CONFIG_ACPI_AC) += ac.o 54obj-$(CONFIG_ACPI_AC) += ac.o
51obj-$(CONFIG_ACPI_BUTTON) += button.o 55obj-$(CONFIG_ACPI_BUTTON) += button.o
52obj-$(CONFIG_ACPI_FAN) += fan.o 56obj-$(CONFIG_ACPI_FAN) += fan.o
@@ -70,6 +74,5 @@ processor-y += processor_idle.o processor_thermal.o
70processor-$(CONFIG_CPU_FREQ) += processor_perflib.o 74processor-$(CONFIG_CPU_FREQ) += processor_perflib.o
71 75
72obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o 76obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o
73obj-$(CONFIG_ACPI_IPMI) += acpi_ipmi.o
74 77
75obj-$(CONFIG_ACPI_APEI) += apei/ 78obj-$(CONFIG_ACPI_APEI) += apei/
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 7edaccce6640..a51df9681319 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -71,9 +71,6 @@ enum ec_command {
71#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ 71#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
72#define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */ 72#define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */
73 73
74#define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts
75 per one transaction */
76
77enum { 74enum {
78 EC_FLAGS_QUERY_PENDING, /* Query is pending */ 75 EC_FLAGS_QUERY_PENDING, /* Query is pending */
79 EC_FLAGS_GPE_STORM, /* GPE storm detected */ 76 EC_FLAGS_GPE_STORM, /* GPE storm detected */
@@ -87,6 +84,15 @@ static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY;
87module_param(ec_delay, uint, 0644); 84module_param(ec_delay, uint, 0644);
88MODULE_PARM_DESC(ec_delay, "Timeout(ms) waited until an EC command completes"); 85MODULE_PARM_DESC(ec_delay, "Timeout(ms) waited until an EC command completes");
89 86
87/*
88 * If the number of false interrupts per one transaction exceeds
89 * this threshold, will think there is a GPE storm happened and
90 * will disable the GPE for normal transaction.
91 */
92static unsigned int ec_storm_threshold __read_mostly = 8;
93module_param(ec_storm_threshold, uint, 0644);
94MODULE_PARM_DESC(ec_storm_threshold, "Maxim false GPE numbers not considered as GPE storm");
95
90/* If we find an EC via the ECDT, we need to keep a ptr to its context */ 96/* If we find an EC via the ECDT, we need to keep a ptr to its context */
91/* External interfaces use first EC only, so remember */ 97/* External interfaces use first EC only, so remember */
92typedef int (*acpi_ec_query_func) (void *data); 98typedef int (*acpi_ec_query_func) (void *data);
@@ -319,7 +325,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
319 msleep(1); 325 msleep(1);
320 /* It is safe to enable the GPE outside of the transaction. */ 326 /* It is safe to enable the GPE outside of the transaction. */
321 acpi_enable_gpe(NULL, ec->gpe); 327 acpi_enable_gpe(NULL, ec->gpe);
322 } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { 328 } else if (t->irq_count > ec_storm_threshold) {
323 pr_info(PREFIX "GPE storm detected, " 329 pr_info(PREFIX "GPE storm detected, "
324 "transactions will use polling mode\n"); 330 "transactions will use polling mode\n");
325 set_bit(EC_FLAGS_GPE_STORM, &ec->flags); 331 set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
@@ -924,6 +930,17 @@ static int ec_flag_msi(const struct dmi_system_id *id)
924 return 0; 930 return 0;
925} 931}
926 932
933/*
934 * Clevo M720 notebook actually works ok with IRQ mode, if we lifted
935 * the GPE storm threshold back to 20
936 */
937static int ec_enlarge_storm_threshold(const struct dmi_system_id *id)
938{
939 pr_debug("Setting the EC GPE storm threshold to 20\n");
940 ec_storm_threshold = 20;
941 return 0;
942}
943
927static struct dmi_system_id __initdata ec_dmi_table[] = { 944static struct dmi_system_id __initdata ec_dmi_table[] = {
928 { 945 {
929 ec_skip_dsdt_scan, "Compal JFL92", { 946 ec_skip_dsdt_scan, "Compal JFL92", {
@@ -955,10 +972,13 @@ static struct dmi_system_id __initdata ec_dmi_table[] = {
955 { 972 {
956 ec_validate_ecdt, "ASUS hardware", { 973 ec_validate_ecdt, "ASUS hardware", {
957 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc.") }, NULL}, 974 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc.") }, NULL},
975 {
976 ec_enlarge_storm_threshold, "CLEVO hardware", {
977 DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."),
978 DMI_MATCH(DMI_PRODUCT_NAME, "M720T/M730T"),}, NULL},
958 {}, 979 {},
959}; 980};
960 981
961
962int __init acpi_ec_ecdt_probe(void) 982int __init acpi_ec_ecdt_probe(void)
963{ 983{
964 acpi_status status; 984 acpi_status status;
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index d1a2d74033e9..08373086cd7e 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -159,6 +159,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
159 if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) { 159 if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) {
160 retval = -ENOSPC; 160 retval = -ENOSPC;
161 mutex_unlock(&acpi_dev->physical_node_lock); 161 mutex_unlock(&acpi_dev->physical_node_lock);
162 kfree(physical_node);
162 goto err; 163 goto err;
163 } 164 }
164 165
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index e78c2a52ea46..bd4e5dca3ff7 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -409,6 +409,7 @@ static void acpi_processor_notify(struct acpi_device *device, u32 event)
409 acpi_bus_generate_proc_event(device, event, 0); 409 acpi_bus_generate_proc_event(device, event, 0);
410 acpi_bus_generate_netlink_event(device->pnp.device_class, 410 acpi_bus_generate_netlink_event(device->pnp.device_class,
411 dev_name(&device->dev), event, 0); 411 dev_name(&device->dev), event, 0);
412 break;
412 default: 413 default:
413 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 414 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
414 "Unsupported event [0x%x]\n", event)); 415 "Unsupported event [0x%x]\n", event));
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 3655ab923812..e8086c725305 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1132,7 +1132,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
1132int acpi_processor_hotplug(struct acpi_processor *pr) 1132int acpi_processor_hotplug(struct acpi_processor *pr)
1133{ 1133{
1134 int ret = 0; 1134 int ret = 0;
1135 struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id); 1135 struct cpuidle_device *dev;
1136 1136
1137 if (disabled_by_idle_boot_param()) 1137 if (disabled_by_idle_boot_param())
1138 return 0; 1138 return 0;
@@ -1147,6 +1147,7 @@ int acpi_processor_hotplug(struct acpi_processor *pr)
1147 if (!pr->flags.power_setup_done) 1147 if (!pr->flags.power_setup_done)
1148 return -ENODEV; 1148 return -ENODEV;
1149 1149
1150 dev = per_cpu(acpi_cpuidle_device, pr->id);
1150 cpuidle_pause_and_lock(); 1151 cpuidle_pause_and_lock();
1151 cpuidle_disable_device(dev); 1152 cpuidle_disable_device(dev);
1152 acpi_processor_get_power_info(pr); 1153 acpi_processor_get_power_info(pr);
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index edda74a43406..804204d41999 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -708,6 +708,40 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
708 return -EINVAL; 708 return -EINVAL;
709} 709}
710 710
711static int thermal_get_trend(struct thermal_zone_device *thermal,
712 int trip, enum thermal_trend *trend)
713{
714 struct acpi_thermal *tz = thermal->devdata;
715 enum thermal_trip_type type;
716 int i;
717
718 if (thermal_get_trip_type(thermal, trip, &type))
719 return -EINVAL;
720
721 if (type == THERMAL_TRIP_ACTIVE) {
722 /* aggressive active cooling */
723 *trend = THERMAL_TREND_RAISING;
724 return 0;
725 }
726
727 /*
728 * tz->temperature has already been updated by generic thermal layer,
729 * before this callback being invoked
730 */
731 i = (tz->trips.passive.tc1 * (tz->temperature - tz->last_temperature))
732 + (tz->trips.passive.tc2
733 * (tz->temperature - tz->trips.passive.temperature));
734
735 if (i > 0)
736 *trend = THERMAL_TREND_RAISING;
737 else if (i < 0)
738 *trend = THERMAL_TREND_DROPPING;
739 else
740 *trend = THERMAL_TREND_STABLE;
741 return 0;
742}
743
744
711static int thermal_notify(struct thermal_zone_device *thermal, int trip, 745static int thermal_notify(struct thermal_zone_device *thermal, int trip,
712 enum thermal_trip_type trip_type) 746 enum thermal_trip_type trip_type)
713{ 747{
@@ -731,11 +765,9 @@ static int thermal_notify(struct thermal_zone_device *thermal, int trip,
731 return 0; 765 return 0;
732} 766}
733 767
734typedef int (*cb)(struct thermal_zone_device *, int,
735 struct thermal_cooling_device *);
736static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, 768static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
737 struct thermal_cooling_device *cdev, 769 struct thermal_cooling_device *cdev,
738 cb action) 770 bool bind)
739{ 771{
740 struct acpi_device *device = cdev->devdata; 772 struct acpi_device *device = cdev->devdata;
741 struct acpi_thermal *tz = thermal->devdata; 773 struct acpi_thermal *tz = thermal->devdata;
@@ -759,11 +791,19 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
759 i++) { 791 i++) {
760 handle = tz->trips.passive.devices.handles[i]; 792 handle = tz->trips.passive.devices.handles[i];
761 status = acpi_bus_get_device(handle, &dev); 793 status = acpi_bus_get_device(handle, &dev);
762 if (ACPI_SUCCESS(status) && (dev == device)) { 794 if (ACPI_FAILURE(status) || dev != device)
763 result = action(thermal, trip, cdev); 795 continue;
764 if (result) 796 if (bind)
765 goto failed; 797 result =
766 } 798 thermal_zone_bind_cooling_device
799 (thermal, trip, cdev,
800 THERMAL_NO_LIMIT, THERMAL_NO_LIMIT);
801 else
802 result =
803 thermal_zone_unbind_cooling_device
804 (thermal, trip, cdev);
805 if (result)
806 goto failed;
767 } 807 }
768 } 808 }
769 809
@@ -776,11 +816,17 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
776 j++) { 816 j++) {
777 handle = tz->trips.active[i].devices.handles[j]; 817 handle = tz->trips.active[i].devices.handles[j];
778 status = acpi_bus_get_device(handle, &dev); 818 status = acpi_bus_get_device(handle, &dev);
779 if (ACPI_SUCCESS(status) && (dev == device)) { 819 if (ACPI_FAILURE(status) || dev != device)
780 result = action(thermal, trip, cdev); 820 continue;
781 if (result) 821 if (bind)
782 goto failed; 822 result = thermal_zone_bind_cooling_device
783 } 823 (thermal, trip, cdev,
824 THERMAL_NO_LIMIT, THERMAL_NO_LIMIT);
825 else
826 result = thermal_zone_unbind_cooling_device
827 (thermal, trip, cdev);
828 if (result)
829 goto failed;
784 } 830 }
785 } 831 }
786 832
@@ -788,7 +834,14 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
788 handle = tz->devices.handles[i]; 834 handle = tz->devices.handles[i];
789 status = acpi_bus_get_device(handle, &dev); 835 status = acpi_bus_get_device(handle, &dev);
790 if (ACPI_SUCCESS(status) && (dev == device)) { 836 if (ACPI_SUCCESS(status) && (dev == device)) {
791 result = action(thermal, -1, cdev); 837 if (bind)
838 result = thermal_zone_bind_cooling_device
839 (thermal, -1, cdev,
840 THERMAL_NO_LIMIT,
841 THERMAL_NO_LIMIT);
842 else
843 result = thermal_zone_unbind_cooling_device
844 (thermal, -1, cdev);
792 if (result) 845 if (result)
793 goto failed; 846 goto failed;
794 } 847 }
@@ -802,16 +855,14 @@ static int
802acpi_thermal_bind_cooling_device(struct thermal_zone_device *thermal, 855acpi_thermal_bind_cooling_device(struct thermal_zone_device *thermal,
803 struct thermal_cooling_device *cdev) 856 struct thermal_cooling_device *cdev)
804{ 857{
805 return acpi_thermal_cooling_device_cb(thermal, cdev, 858 return acpi_thermal_cooling_device_cb(thermal, cdev, true);
806 thermal_zone_bind_cooling_device);
807} 859}
808 860
809static int 861static int
810acpi_thermal_unbind_cooling_device(struct thermal_zone_device *thermal, 862acpi_thermal_unbind_cooling_device(struct thermal_zone_device *thermal,
811 struct thermal_cooling_device *cdev) 863 struct thermal_cooling_device *cdev)
812{ 864{
813 return acpi_thermal_cooling_device_cb(thermal, cdev, 865 return acpi_thermal_cooling_device_cb(thermal, cdev, false);
814 thermal_zone_unbind_cooling_device);
815} 866}
816 867
817static const struct thermal_zone_device_ops acpi_thermal_zone_ops = { 868static const struct thermal_zone_device_ops acpi_thermal_zone_ops = {
@@ -823,6 +874,7 @@ static const struct thermal_zone_device_ops acpi_thermal_zone_ops = {
823 .get_trip_type = thermal_get_trip_type, 874 .get_trip_type = thermal_get_trip_type,
824 .get_trip_temp = thermal_get_trip_temp, 875 .get_trip_temp = thermal_get_trip_temp,
825 .get_crit_temp = thermal_get_crit_temp, 876 .get_crit_temp = thermal_get_crit_temp,
877 .get_trend = thermal_get_trend,
826 .notify = thermal_notify, 878 .notify = thermal_notify,
827}; 879};
828 880
@@ -849,15 +901,12 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
849 tz->thermal_zone = 901 tz->thermal_zone =
850 thermal_zone_device_register("acpitz", trips, 0, tz, 902 thermal_zone_device_register("acpitz", trips, 0, tz,
851 &acpi_thermal_zone_ops, 903 &acpi_thermal_zone_ops,
852 tz->trips.passive.tc1,
853 tz->trips.passive.tc2,
854 tz->trips.passive.tsp*100, 904 tz->trips.passive.tsp*100,
855 tz->polling_frequency*100); 905 tz->polling_frequency*100);
856 else 906 else
857 tz->thermal_zone = 907 tz->thermal_zone =
858 thermal_zone_device_register("acpitz", trips, 0, tz, 908 thermal_zone_device_register("acpitz", trips, 0, tz,
859 &acpi_thermal_zone_ops, 909 &acpi_thermal_zone_ops, 0,
860 0, 0, 0,
861 tz->polling_frequency*100); 910 tz->polling_frequency*100);
862 if (IS_ERR(tz->thermal_zone)) 911 if (IS_ERR(tz->thermal_zone))
863 return -ENODEV; 912 return -ENODEV;
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index f94d4c818fc7..0230cb6cbb3a 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1345,12 +1345,15 @@ static int
1345acpi_video_bus_get_devices(struct acpi_video_bus *video, 1345acpi_video_bus_get_devices(struct acpi_video_bus *video,
1346 struct acpi_device *device) 1346 struct acpi_device *device)
1347{ 1347{
1348 int status; 1348 int status = 0;
1349 struct acpi_device *dev; 1349 struct acpi_device *dev;
1350 1350
1351 status = acpi_video_device_enumerate(video); 1351 /*
1352 if (status) 1352 * There are systems where video module known to work fine regardless
1353 return status; 1353 * of broken _DOD and ignoring returned value here doesn't cause
1354 * any issues later.
1355 */
1356 acpi_video_device_enumerate(video);
1354 1357
1355 list_for_each_entry(dev, &device->children, node) { 1358 list_for_each_entry(dev, &device->children, node) {
1356 1359