Merge branch 'asus' into release
authorLen Brown <len.brown@intel.com>
Wed, 16 Dec 2009 03:34:48 +0000 (22:34 -0500)
committerLen Brown <len.brown@intel.com>
Wed, 16 Dec 2009 03:34:48 +0000 (22:34 -0500)
Conflicts:
Documentation/feature-removal-schedule.txt
drivers/platform/x86/eeepc-laptop.c

Signed-off-by: Len Brown <len.brown@intel.com>
1  2 
Documentation/feature-removal-schedule.txt
drivers/platform/x86/eeepc-laptop.c

@@@ -468,9 -490,22 +468,28 @@@ Who:     Alok N Kataria <akataria@vmware.co
  
  ----------------------------
  
 +What: adt7473 hardware monitoring driver
 +When: February 2010
 +Why:  Obsoleted by the adt7475 driver.
 +Who:  Jean Delvare <khali@linux-fr.org>
 +
 +---------------------------
+ What: Support for lcd_switch and display_get in asus-laptop driver
+ When: March 2010
+ Why:  These two features use non-standard interfaces. There are the
+       only features that really need multiple path to guess what's
+       the right method name on a specific laptop.
+       Removing them will allow to remove a lot of code an significantly
+       clean the drivers.
+       This will affect the backlight code which won't be able to know
+       if the backlight is on or off. The platform display file will also be
+       write only (like the one in eeepc-laptop).
+       This should'nt affect a lot of user because they usually know
+       when their display is on or off.
+ Who:  Corentin Chary <corentin.chary@gmail.com>
+ ----------------------------
@@@ -866,16 -727,172 +727,172 @@@ static int eeepc_new_rfkill(struct eeep
        return 0;
  }
  
+ static void eeepc_rfkill_exit(struct eeepc_laptop *eeepc)
+ {
+       eeepc_unregister_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P5");
+       eeepc_unregister_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P6");
+       eeepc_unregister_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P7");
+       if (eeepc->wlan_rfkill) {
+               rfkill_unregister(eeepc->wlan_rfkill);
+               rfkill_destroy(eeepc->wlan_rfkill);
+               eeepc->wlan_rfkill = NULL;
+       }
+       /*
+        * Refresh pci hotplug in case the rfkill state was changed after
+        * eeepc_unregister_rfkill_notifier()
+        */
+       eeepc_rfkill_hotplug(eeepc);
+       if (eeepc->hotplug_slot)
+               pci_hp_deregister(eeepc->hotplug_slot);
+       if (eeepc->bluetooth_rfkill) {
+               rfkill_unregister(eeepc->bluetooth_rfkill);
+               rfkill_destroy(eeepc->bluetooth_rfkill);
+               eeepc->bluetooth_rfkill = NULL;
+       }
+       if (eeepc->wwan3g_rfkill) {
+               rfkill_unregister(eeepc->wwan3g_rfkill);
+               rfkill_destroy(eeepc->wwan3g_rfkill);
+               eeepc->wwan3g_rfkill = NULL;
+       }
+       if (eeepc->wimax_rfkill) {
+               rfkill_unregister(eeepc->wimax_rfkill);
+               rfkill_destroy(eeepc->wimax_rfkill);
+               eeepc->wimax_rfkill = NULL;
+       }
+ }
+ static int eeepc_rfkill_init(struct eeepc_laptop *eeepc)
+ {
+       int result = 0;
+       mutex_init(&eeepc->hotplug_lock);
+       result = eeepc_new_rfkill(eeepc, &eeepc->wlan_rfkill,
+                                 "eeepc-wlan", RFKILL_TYPE_WLAN,
+                                 CM_ASL_WLAN);
+       if (result && result != -ENODEV)
+               goto exit;
+       result = eeepc_new_rfkill(eeepc, &eeepc->bluetooth_rfkill,
+                                 "eeepc-bluetooth", RFKILL_TYPE_BLUETOOTH,
+                                 CM_ASL_BLUETOOTH);
+       if (result && result != -ENODEV)
+               goto exit;
+       result = eeepc_new_rfkill(eeepc, &eeepc->wwan3g_rfkill,
+                                 "eeepc-wwan3g", RFKILL_TYPE_WWAN,
+                                 CM_ASL_3G);
+       if (result && result != -ENODEV)
+               goto exit;
+       result = eeepc_new_rfkill(eeepc, &eeepc->wimax_rfkill,
+                                 "eeepc-wimax", RFKILL_TYPE_WIMAX,
+                                 CM_ASL_WIMAX);
+       if (result && result != -ENODEV)
+               goto exit;
+       result = eeepc_setup_pci_hotplug(eeepc);
+       /*
+        * If we get -EBUSY then something else is handling the PCI hotplug -
+        * don't fail in this case
+        */
+       if (result == -EBUSY)
+               result = 0;
+       eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P5");
+       eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P6");
+       eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P7");
+       /*
+        * Refresh pci hotplug in case the rfkill state was changed during
+        * setup.
+        */
+       eeepc_rfkill_hotplug(eeepc);
+ exit:
+       if (result && result != -ENODEV)
+               eeepc_rfkill_exit(eeepc);
+       return result;
+ }
  /*
-  * Hwmon
+  * Platform driver - hibernate/resume callbacks
   */
 -static struct dev_pm_ops eeepc_pm_ops = {
+ static int eeepc_hotk_thaw(struct device *device)
+ {
+       struct eeepc_laptop *eeepc = dev_get_drvdata(device);
+       if (eeepc->wlan_rfkill) {
+               bool wlan;
+               /*
+                * Work around bios bug - acpi _PTS turns off the wireless led
+                * during suspend.  Normally it restores it on resume, but
+                * we should kick it ourselves in case hibernation is aborted.
+                */
+               wlan = get_acpi(eeepc, CM_ASL_WLAN);
+               set_acpi(eeepc, CM_ASL_WLAN, wlan);
+       }
+       return 0;
+ }
+ static int eeepc_hotk_restore(struct device *device)
+ {
+       struct eeepc_laptop *eeepc = dev_get_drvdata(device);
+       /* Refresh both wlan rfkill state and pci hotplug */
+       if (eeepc->wlan_rfkill)
+               eeepc_rfkill_hotplug(eeepc);
+       if (eeepc->bluetooth_rfkill)
+               rfkill_set_sw_state(eeepc->bluetooth_rfkill,
+                                   get_acpi(eeepc, CM_ASL_BLUETOOTH) != 1);
+       if (eeepc->wwan3g_rfkill)
+               rfkill_set_sw_state(eeepc->wwan3g_rfkill,
+                                   get_acpi(eeepc, CM_ASL_3G) != 1);
+       if (eeepc->wimax_rfkill)
+               rfkill_set_sw_state(eeepc->wimax_rfkill,
+                                   get_acpi(eeepc, CM_ASL_WIMAX) != 1);
+       return 0;
+ }
++static const struct dev_pm_ops eeepc_pm_ops = {
+       .thaw = eeepc_hotk_thaw,
+       .restore = eeepc_hotk_restore,
+ };
+ static struct platform_driver platform_driver = {
+       .driver = {
+               .name = EEEPC_LAPTOP_FILE,
+               .owner = THIS_MODULE,
+               .pm = &eeepc_pm_ops,
+       }
+ };
+ /*
+  * Hwmon device
+  */
+ #define EEEPC_EC_SC00      0x61
+ #define EEEPC_EC_FAN_PWM   (EEEPC_EC_SC00 + 2) /* Fan PWM duty cycle (%) */
+ #define EEEPC_EC_FAN_HRPM  (EEEPC_EC_SC00 + 5) /* High byte, fan speed (RPM) */
+ #define EEEPC_EC_FAN_LRPM  (EEEPC_EC_SC00 + 6) /* Low byte, fan speed (RPM) */
+ #define EEEPC_EC_SFB0      0xD0
+ #define EEEPC_EC_FAN_CTRL  (EEEPC_EC_SFB0 + 3) /* Byte containing SF25  */
  static int eeepc_get_fan_pwm(void)
  {
-       int value = 0;
+       u8 value = 0;
  
-       read_acpi_int(NULL, EEEPC_EC_FAN_PWM, &value);
-       value = value * 255 / 100;
-       return (value);
+       ec_read(EEEPC_EC_FAN_PWM, &value);
+       return value * 255 / 100;
  }
  
  static void eeepc_set_fan_pwm(int value)