]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 15 Sep 2013 21:42:59 +0000 (17:42 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 15 Sep 2013 21:42:59 +0000 (17:42 -0400)
Pull x86 platform updates from Matthew Garrett:
 "Nothing amazing here, almost entirely cleanups and minor bugfixes and
  one bit of hardware enablement in the amilo-rfkill driver"

* 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86:
  platform/x86: panasonic-laptop: reuse module_acpi_driver
  samsung-laptop: fix config build error
  platform: x86: remove unnecessary platform_set_drvdata()
  amilo-rfkill: Enable using amilo-rfkill with the FSC Amilo L1310.
  wmi: parse_wdg() should return kernel error codes
  hp_wmi: Fix unregister order in hp_wmi_rfkill_setup()
  platform: replace strict_strto*() with kstrto*()
  x86: irst: use module_acpi_driver to simplify the code
  x86: smartconnect: use module_acpi_driver to simplify the code
  platform samsung-q10: use ACPI instead of direct EC calls
  thinkpad_acpi: add the ability setting TPACPI_LED_NONE by quirk
  thinkpad_acpi: return -NODEV while operating uninitialized LEDs

1  2 
drivers/platform/x86/samsung-q10.c

index 4430b8c1369d9cd95a5951fe10b0d173e9121b0d,9d6609d0d90abd26902bf52794382993bf7781bd..cae7098e9b0d70adf271eb9c31a1e833919a54b1
  #include <linux/init.h>
  #include <linux/platform_device.h>
  #include <linux/backlight.h>
- #include <linux/i8042.h>
  #include <linux/dmi.h>
+ #include <acpi/acpi_drivers.h>
  
- #define SAMSUNGQ10_BL_MAX_INTENSITY      255
- #define SAMSUNGQ10_BL_DEFAULT_INTENSITY  185
+ #define SAMSUNGQ10_BL_MAX_INTENSITY 7
  
- #define SAMSUNGQ10_BL_8042_CMD           0xbe
- #define SAMSUNGQ10_BL_8042_DATA          { 0x89, 0x91 }
- static int samsungq10_bl_brightness;
+ static acpi_handle ec_handle;
  
  static bool force;
  module_param(force, bool, 0);
@@@ -33,21 -29,26 +29,26 @@@ MODULE_PARM_DESC(force
  static int samsungq10_bl_set_intensity(struct backlight_device *bd)
  {
  
-       int brightness = bd->props.brightness;
-       unsigned char c[3] = SAMSUNGQ10_BL_8042_DATA;
+       acpi_status status;
+       int i;
  
-       c[2] = (unsigned char)brightness;
-       i8042_lock_chip();
-       i8042_command(c, (0x30 << 8) | SAMSUNGQ10_BL_8042_CMD);
-       i8042_unlock_chip();
-       samsungq10_bl_brightness = brightness;
+       for (i = 0; i < SAMSUNGQ10_BL_MAX_INTENSITY; i++) {
+               status = acpi_evaluate_object(ec_handle, "_Q63", NULL, NULL);
+               if (ACPI_FAILURE(status))
+                       return -EIO;
+       }
+       for (i = 0; i < bd->props.brightness; i++) {
+               status = acpi_evaluate_object(ec_handle, "_Q64", NULL, NULL);
+               if (ACPI_FAILURE(status))
+                       return -EIO;
+       }
  
        return 0;
  }
  
  static int samsungq10_bl_get_intensity(struct backlight_device *bd)
  {
-       return samsungq10_bl_brightness;
+       return bd->props.brightness;
  }
  
  static const struct backlight_ops samsungq10_bl_ops = {
        .update_status  = samsungq10_bl_set_intensity,
  };
  
- #ifdef CONFIG_PM_SLEEP
- static int samsungq10_suspend(struct device *dev)
- {
-       return 0;
- }
- static int samsungq10_resume(struct device *dev)
- {
-       struct backlight_device *bd = dev_get_drvdata(dev);
-       samsungq10_bl_set_intensity(bd);
-       return 0;
- }
- #else
- #define samsungq10_suspend NULL
- #define samsungq10_resume  NULL
- #endif
- static SIMPLE_DEV_PM_OPS(samsungq10_pm_ops,
-                         samsungq10_suspend, samsungq10_resume);
  static int samsungq10_probe(struct platform_device *pdev)
  {
  
@@@ -93,9 -72,6 +72,6 @@@
  
        platform_set_drvdata(pdev, bd);
  
-       bd->props.brightness = SAMSUNGQ10_BL_DEFAULT_INTENSITY;
-       samsungq10_bl_set_intensity(bd);
        return 0;
  }
  
@@@ -104,9 -80,6 +80,6 @@@ static int samsungq10_remove(struct pla
  
        struct backlight_device *bd = platform_get_drvdata(pdev);
  
-       bd->props.brightness = SAMSUNGQ10_BL_DEFAULT_INTENSITY;
-       samsungq10_bl_set_intensity(bd);
        backlight_device_unregister(bd);
  
        return 0;
@@@ -116,7 -89,6 +89,6 @@@ static struct platform_driver samsungq1
        .driver         = {
                .name   = KBUILD_MODNAME,
                .owner  = THIS_MODULE,
-               .pm     = &samsungq10_pm_ops,
        },
        .probe          = samsungq10_probe,
        .remove         = samsungq10_remove,
@@@ -172,11 -144,16 +144,16 @@@ static int __init samsungq10_init(void
        if (!force && !dmi_check_system(samsungq10_dmi_table))
                return -ENODEV;
  
+       ec_handle = ec_get_handle();
+       if (!ec_handle)
+               return -ENODEV;
        samsungq10_device = platform_create_bundle(&samsungq10_driver,
                                                   samsungq10_probe,
                                                   NULL, 0, NULL, 0);
  
 -      return PTR_RET(samsungq10_device);
 +      return PTR_ERR_OR_ZERO(samsungq10_device);
  }
  
  static void __exit samsungq10_exit(void)