]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/thermal/intel_soc_dts_thermal.c
Merge tag 'cramfs_fixes' of git://git.linaro.org/people/nicolas.pitre/linux
[linux.git] / drivers / thermal / intel_soc_dts_thermal.c
index c27868b2c6afc5f438754f370961fee1c3eaac8e..d748527d7a38a98737a1f3e4d70e1cbda048a921 100644 (file)
@@ -15,6 +15,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/acpi.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <asm/cpu_device_id.h>
@@ -31,6 +32,7 @@ MODULE_PARM_DESC(crit_offset,
 /* IRQ 86 is a fixed APIC interrupt for BYT DTS Aux threshold notifications */
 #define BYT_SOC_DTS_APIC_IRQ   86
 
+static int soc_dts_thres_gsi;
 static int soc_dts_thres_irq;
 static struct intel_soc_dts_sensors *soc_dts;
 
@@ -43,7 +45,7 @@ static irqreturn_t soc_irq_thread_fn(int irq, void *dev_data)
 }
 
 static const struct x86_cpu_id soc_thermal_ids[] = {
-       { X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_SILVERMONT1, 0,
+       { X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_SILVERMONT, 0,
                BYT_SOC_DTS_APIC_IRQ},
        {}
 };
@@ -65,7 +67,21 @@ static int __init intel_soc_thermal_init(void)
                return err;
        }
 
-       soc_dts_thres_irq = (int)match_cpu->driver_data;
+       soc_dts_thres_gsi = (int)match_cpu->driver_data;
+       if (soc_dts_thres_gsi) {
+               /*
+                * Note the flags here MUST match the firmware defaults, rather
+                * then the request_irq flags, otherwise we get an EBUSY error.
+                */
+               soc_dts_thres_irq = acpi_register_gsi(NULL, soc_dts_thres_gsi,
+                                                     ACPI_LEVEL_SENSITIVE,
+                                                     ACPI_ACTIVE_LOW);
+               if (soc_dts_thres_irq < 0) {
+                       pr_warn("intel_soc_dts: Could not get IRQ for GSI %d, err %d\n",
+                               soc_dts_thres_gsi, soc_dts_thres_irq);
+                       soc_dts_thres_irq = 0;
+               }
+       }
 
        if (soc_dts_thres_irq) {
                err = request_threaded_irq(soc_dts_thres_irq, NULL,
@@ -90,8 +106,10 @@ static int __init intel_soc_thermal_init(void)
        return 0;
 
 error_trips:
-       if (soc_dts_thres_irq)
+       if (soc_dts_thres_irq) {
                free_irq(soc_dts_thres_irq, soc_dts);
+               acpi_unregister_gsi(soc_dts_thres_gsi);
+       }
        intel_soc_dts_iosf_exit(soc_dts);
 
        return err;
@@ -99,8 +117,10 @@ static int __init intel_soc_thermal_init(void)
 
 static void __exit intel_soc_thermal_exit(void)
 {
-       if (soc_dts_thres_irq)
+       if (soc_dts_thres_irq) {
                free_irq(soc_dts_thres_irq, soc_dts);
+               acpi_unregister_gsi(soc_dts_thres_gsi);
+       }
        intel_soc_dts_iosf_exit(soc_dts);
 }