1. 07 2月, 2019 1 次提交
  2. 26 1月, 2019 1 次提交
    • J
      platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey · e5090418
      João Paulo Rechi Vita 提交于
      [ Upstream commit 78f3ac76d9e5219589718b9e4733bee21627b3f5 ]
      
      In the past, Asus firmwares would change the panel backlight directly
      through the EC when the display off hotkey (Fn+F7) was pressed, and
      only notify the OS of such change, with 0x33 when the LCD was ON and
      0x34 when the LCD was OFF. These are currently mapped to
      KEY_DISPLAYTOGGLE and KEY_DISPLAY_OFF, respectively.
      
      Most recently the EC on Asus most machines lost ability to toggle the
      LCD backlight directly, but unless the OS informs the firmware it is
      going to handle the display toggle hotkey events, the firmware still
      tries change the brightness through the EC, to no effect. The end result
      is a long list (at Endless we counted 11) of Asus laptop models where
      the display toggle hotkey does not perform any action. Our firmware
      engineers contacts at Asus were surprised that there were still machines
      out there with the old behavior.
      
      Calling WMNB(ASUS_WMI_DEVID_BACKLIGHT==0x00050011, 2) on the _WDG device
      tells the firmware that it should let the OS handle the display toggle
      event, in which case it will simply notify the OS of a key press with
      0x35, as shown by the DSDT excerpts bellow.
      
       Scope (_SB)
       {
           (...)
      
           Device (ATKD)
           {
               (...)
      
               Name (_WDG, Buffer (0x28)
               {
                   /* 0000 */  0xD0, 0x5E, 0x84, 0x97, 0x6D, 0x4E, 0xDE, 0x11,
                   /* 0008 */  0x8A, 0x39, 0x08, 0x00, 0x20, 0x0C, 0x9A, 0x66,
                   /* 0010 */  0x4E, 0x42, 0x01, 0x02, 0x35, 0xBB, 0x3C, 0x0B,
                   /* 0018 */  0xC2, 0xE3, 0xED, 0x45, 0x91, 0xC2, 0x4C, 0x5A,
                   /* 0020 */  0x6D, 0x19, 0x5D, 0x1C, 0xFF, 0x00, 0x01, 0x08
               })
               Method (WMNB, 3, Serialized)
               {
                   CreateDWordField (Arg2, Zero, IIA0)
                   CreateDWordField (Arg2, 0x04, IIA1)
                   Local0 = (Arg1 & 0xFFFFFFFF)
      
                   (...)
      
                   If ((Local0 == 0x53564544))
                   {
                       (...)
      
                       If ((IIA0 == 0x00050011))
                       {
                           If ((IIA1 == 0x02))
                           {
                               ^^PCI0.SBRG.EC0.SPIN (0x72, One)
                               ^^PCI0.SBRG.EC0.BLCT = One
                           }
      
                           Return (One)
                       }
                   }
                   (...)
               }
               (...)
           }
           (...)
       }
       (...)
      
       Scope (_SB.PCI0.SBRG.EC0)
       {
           (...)
      
           Name (BLCT, Zero)
      
           (...)
      
           Method (_Q10, 0, NotSerialized)  // _Qxx: EC Query
           {
               If ((BLCT == Zero))
               {
                   Local0 = One
                   Local0 = RPIN (0x72)
                   Local0 ^= One
                   SPIN (0x72, Local0)
                   If (ATKP)
                   {
                       Local0 = (0x34 - Local0)
                       ^^^^ATKD.IANE (Local0)
                   }
               }
               ElseIf ((BLCT == One))
               {
                   If (ATKP)
                   {
                       ^^^^ATKD.IANE (0x35)
                   }
               }
           }
           (...)
       }
      Signed-off-by: NJoão Paulo Rechi Vita <jprvita@endlessm.com>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e5090418
  3. 27 11月, 2018 2 次提交
  4. 11 9月, 2018 2 次提交
  5. 22 8月, 2018 1 次提交
  6. 17 8月, 2018 1 次提交
    • R
      platform/x86: intel_punit_ipc: fix build errors · 340fd4cf
      Randy Dunlap 提交于
      Fix build errors by #including <linux/io.h>.
      
      ../drivers/platform/x86/intel_punit_ipc.c: In function 'ipc_read_status':
      ../drivers/platform/x86/intel_punit_ipc.c:55:2: error: implicit declaration of function 'readl' [-Werror=implicit-function-declaration]
        return readl(ipcdev->base[type][BASE_IFACE]);
      ../drivers/platform/x86/intel_punit_ipc.c: In function 'ipc_write_cmd':
      ../drivers/platform/x86/intel_punit_ipc.c:60:2: error: implicit declaration of function 'writel' [-Werror=implicit-function-declaration]
        writel(cmd, ipcdev->base[type][BASE_IFACE]);
      
      Fixes: 447ae316 ("x86: Don't include linux/irq.h from asm/hardirq.h")
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Cc: Zha Qipeng <qipeng.zha@intel.com>
      Cc: platform-driver-x86@vger.kernel.org
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      340fd4cf
  7. 15 8月, 2018 7 次提交
  8. 09 8月, 2018 1 次提交
    • H
      platform/x86: Add ACPI i2c-multi-instantiate pseudo driver · e64e8498
      Hans de Goede 提交于
      On systems with ACPI instantiated i2c-clients, normally there is 1 fw_node
      per i2c-device and that fw-node contains 1 I2cSerialBus resource for that 1
      i2c-device.
      
      But in some rare cases the manufacturer has decided to describe multiple
      i2c-devices in a single ACPI fwnode with multiple I2cSerialBus resources.
      
      An earlier attempt to fix this in the i2c-core resulted in a lot of extra
      code to support this corner-case.
      
      This commit introduces a new i2c-multi-instantiate driver which fixes this
      in a different way. This new driver can be built as a module which will
      only loaded on affected systems.
      
      This driver will instantiate a new i2c-client per I2cSerialBus resource,
      using the driver_data from the acpi_device_id it is binding to to tell it
      which chip-type (and optional irq-resource) to use when instantiating.
      
      Note this driver depends on a platform device being instantiated for the
      ACPI fwnode, see the i2c_multi_instantiate_ids list of ACPI device-ids in
      drivers/acpi/scan.c: acpi_device_enumeration_by_parent().
      Acked-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: NWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e64e8498
  9. 03 8月, 2018 1 次提交
  10. 02 8月, 2018 5 次提交
  11. 31 7月, 2018 1 次提交
  12. 24 7月, 2018 1 次提交
    • L
      PCI: hotplug: Demidlayer registration with the core · 51bbf9be
      Lukas Wunner 提交于
      When a hotplug driver calls pci_hp_register(), all steps necessary for
      registration are carried out in one go, including creation of a kobject
      and addition to sysfs.  That's a problem for pciehp once it's converted
      to enable/disable the slot exclusively from the IRQ thread:  The thread
      needs to be spawned after creation of the kobject (because it uses the
      kobject's name), but before addition to sysfs (because it will handle
      enable/disable requests submitted via sysfs).
      
      pci_hp_deregister() does offer a ->release callback that's invoked
      after deletion from sysfs and before destruction of the kobject.  But
      because pci_hp_register() doesn't offer a counterpart, hotplug drivers'
      ->probe and ->remove code becomes asymmetric, which is error prone
      as recently discovered use-after-free bugs in pciehp's ->remove hook
      have shown.
      
      In a sense, this appears to be a case of the midlayer antipattern:
      
         "The core thesis of the "midlayer mistake" is that midlayers are
          bad and should not exist.  That common functionality which it is
          so tempting to put in a midlayer should instead be provided as
          library routines which can [be] used, augmented, or ignored by
          each bottom level driver independently.  Thus every subsystem
          that supports multiple implementations (or drivers) should
          provide a very thin top layer which calls directly into the
          bottom layer drivers, and a rich library of support code that
          eases the implementation of those drivers.  This library is
          available to, but not forced upon, those drivers."
              --  Neil Brown (2009), https://lwn.net/Articles/336262/
      
      The presence of midlayer traits in the PCI hotplug core might be ascribed
      to its age:  When it was introduced in February 2002, the blessings of a
      library approach might not have been well known:
      https://git.kernel.org/tglx/history/c/a8a2069f432c
      
      For comparison, the driver core does offer split functions for creating
      a kobject (device_initialize()) and addition to sysfs (device_add()) as
      an alternative to carrying out everything at once (device_register()).
      This was introduced in October 2002:
      https://git.kernel.org/tglx/history/c/8b290eb19962
      
      The odd ->release callback in the PCI hotplug core was added in 2003:
      https://git.kernel.org/tglx/history/c/69f8d663b595
      
      Clearly, a library approach would not force every hotplug driver to
      implement a ->release callback, but rather allow the driver to remove
      the sysfs files, release its data structures and finally destroy the
      kobject.  Alternatively, a driver may choose to remove everything with
      pci_hp_deregister(), then release its data structures.
      
      To this end, offer drivers pci_hp_initialize() and pci_hp_add() as a
      split-up version of pci_hp_register().  Likewise, offer pci_hp_del()
      and pci_hp_destroy() as a split-up version of pci_hp_deregister().
      
      Eliminate the ->release callback and move its code into each driver's
      teardown routine.
      
      Declare pci_hp_deregister() void, in keeping with the usual kernel
      pattern that enablement can fail, but disablement cannot.  It only
      returned an error if the caller passed in a NULL pointer or a slot which
      has never or is no longer registered or is sharing its name with another
      slot.  Those would be bugs, so WARN about them.  Few hotplug drivers
      actually checked the return value and those that did only printed a
      useless error message to dmesg.  Remove that.
      
      For most drivers the conversion was straightforward since it doesn't
      matter whether the code in the ->release callback is executed before or
      after destruction of the kobject.  But in the case of ibmphp, it was
      unclear to me whether setting slot_cur->ctrl and slot_cur->bus_on to
      NULL needs to happen before the kobject is destroyed, so I erred on
      the side of caution and ensured that the order stays the same.  Another
      nontrivial case is pnv_php, I've found the list and kref logic difficult
      to understand, however my impression was that it is safe to delete the
      list element and drop the references until after the kobject is
      destroyed.
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>  # drivers/platform/x86
      Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Scott Murray <scott@spiteful.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
      Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
      Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
      Cc: Corentin Chary <corentin.chary@gmail.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Andy Shevchenko <andy@infradead.org>
      51bbf9be
  13. 22 7月, 2018 1 次提交
  14. 21 7月, 2018 1 次提交
  15. 20 7月, 2018 1 次提交
  16. 18 7月, 2018 3 次提交
  17. 10 7月, 2018 1 次提交
  18. 07 7月, 2018 1 次提交
    • R
      headers: separate linux/mod_devicetable.h from linux/platform_device.h · ac316725
      Randy Dunlap 提交于
      At over 4000 #includes, <linux/platform_device.h> is the 9th most
      #included header file in the Linux kernel.  It does not need
      <linux/mod_devicetable.h>, so drop that header and explicitly add
      <linux/mod_devicetable.h> to source files that need it.
      
         4146 #include <linux/platform_device.h>
      
      After this patch, there are 225 files that use <linux/mod_devicetable.h>,
      for a reduction of around 3900 times that <linux/mod_devicetable.h>
      does not have to be read & parsed.
      
          225 #include <linux/mod_devicetable.h>
      
      This patch was build-tested on 20 different arch-es.
      
      It also makes these drivers SubmitChecklist#1 compliant.
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Reported-by: kbuild test robot <lkp@intel.com> # drivers/media/platform/vimc/
      Reported-by: kbuild test robot <lkp@intel.com> # drivers/pinctrl/pinctrl-u300.c
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac316725
  19. 02 7月, 2018 8 次提交