1. 02 12月, 2014 2 次提交
    • R
      ACPI / sleep: Drain outstanding events after disabling multiple GPEs · c52fa70c
      Rafael J. Wysocki 提交于
      After multiple GPEs have been disabled at the low level in one go,
      like when acpi_disable_all_gpes() is called, we should always drain
      all of the outstanding events from them, or interesting races become
      possible.
      
      For this reason, call acpi_os_wait_events_complete() after
      acpi_enable_all_wakeup_gpes() and acpi_disable_all_gpes() in
      acpi_freeze_prepare() and acpi_power_off_prepare(), respectively.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c52fa70c
    • R
      ACPICA: Save current masks of enabled GPEs after enable register writes · c50f13c6
      Rafael J. Wysocki 提交于
      There is a race condition between acpi_hw_disable_all_gpes() or
      acpi_enable_all_wakeup_gpes() and acpi_ev_asynch_enable_gpe() such
      that if the latter wins the race, it may mistakenly enable a GPE
      disabled by the former.  This may lead to premature system wakeups
      during system suspend and potentially to more serious consequences.
      
      The source of the problem is how acpi_hw_low_set_gpe() works when
      passed ACPI_GPE_CONDITIONAL_ENABLE as the second argument.  In that
      case, the GPE will be enabled if the corresponding bit is set in the
      enable_for_run mask of the GPE enable register containing that bit.
      However, acpi_hw_disable_all_gpes() and acpi_enable_all_wakeup_gpes()
      don't modify the enable_for_run masks of GPE registers when writing
      to them.  In consequence, if acpi_ev_asynch_enable_gpe(), which
      eventually calls acpi_hw_low_set_gpe() with the second argument
      equal to ACPI_GPE_CONDITIONAL_ENABLE, is executed in parallel with
      one of these functions, it may reverse changes made by them.
      
      To fix the problem, introduce a new enable_mask field in struct
      acpi_gpe_register_info in which to store the current mask of
      enabled GPEs and modify acpi_hw_low_set_gpe() to take this
      mask into account instead of enable_for_run when its second
      argument is equal to ACPI_GPE_CONDITIONAL_ENABLE.  Also modify
      the low-level routines called by acpi_hw_disable_all_gpes(),
      acpi_enable_all_wakeup_gpes() and acpi_enable_all_runtime_gpes()
      to update the enable_mask masks of GPE registers after all
      (successful) writes to those registers.
      Acked-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c50f13c6
  2. 28 11月, 2014 5 次提交
  3. 25 11月, 2014 1 次提交
  4. 20 11月, 2014 1 次提交
    • R
      ACPI / PM: Ignore wakeup setting if the ACPI companion can't wake up · 78579b7c
      Rafael J. Wysocki 提交于
      As reported by Dmitry, on some Chromebooks there are devices with
      corresponding ACPI objects and with unusual system wakeup
      configuration.  Namely, they technically are wakeup-capable, but the
      wakeup is handled via a platform-specific out-of-band mechanism and
      the ACPI PM layer has no information on the wakeup capability.  As
      a result, device_may_wakeup(dev) called from acpi_dev_suspend_late()
      returns 'true' for those devices, but the wakeup.flags.valid flag is
      unset for the corresponding ACPI device objects, so acpi_device_wakeup()
      reproducibly fails for them causing acpi_dev_suspend_late() to return
      an error code.  The entire system suspend is then aborted and the
      machines in question cannot suspend at all.
      
      Address the problem by ignoring the device_may_wakeup(dev) return
      value in acpi_dev_suspend_late() if the ACPI companion of the device
      being handled has wakeup.flags.valid unset (in which case it is clear
      that the wakeup is supposed to be handled by other means).
      
      This fixes a regression introduced by commit a76e9bd8 (i2c:
      attach/detach I2C client device to the ACPI power domain) as the
      affected systems could suspend and resume successfully before that
      commit.
      
      Fixes: a76e9bd8 (i2c: attach/detach I2C client device to the ACPI power domain)
      Reported-by: NDmitry Torokhov <dtor@chromium.org>
      Reviewed-by: NDmitry Torokhov <dtor@chromium.org>
      Cc: 3.13+ <stable@vger.kernel.org> # 3.13+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      78579b7c
  5. 30 10月, 2014 1 次提交
  6. 29 10月, 2014 2 次提交
    • L
      ACPI / EC: Fix regression due to conflicting firmware behavior between Samsung and Acer. · 79149001
      Lv Zheng 提交于
      It is reported that Samsung laptops that need to poll events are broken by
      the following commit:
       Commit 3afcf2ec
       Subject: ACPI / EC: Add support to disallow QR_EC to be issued when SCI_EVT isn't set
      
      The behaviors of the 2 vendor firmwares are conflict:
       1. Acer: OSPM shouldn't issue QR_EC unless SCI_EVT is set, firmware
               automatically sets SCI_EVT as long as there is event queued up.
       2. Samsung: OSPM should issue QR_EC whatever SCI_EVT is set, firmware
                  returns 0 when there is no event queued up.
      
      This patch is a quick fix to distinguish the behaviors to make Acer
      behavior only effective for Acer EC firmware so that the breakages on
      Samsung EC firmware can be avoided.
      
      Fixes: 3afcf2ec (ACPI / EC: Add support to disallow QR_EC to be issued ...)
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=44161Reported-and-tested-by: NOrtwin Glück <odi@odi.ch>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Cc: 3.17+ <stable@vger.kernel.org> # 3.17+
      [ rjw : Subject ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      79149001
    • L
      Revert "ACPI / EC: Add support to disallow QR_EC to be issued before completing previous QR_EC" · df9ff918
      Lv Zheng 提交于
      It is reported that the following commit breaks Samsung hardware:
       Commit: 558e4736.
       Subject: ACPI / EC: Add support to disallow QR_EC to be issued before
                completing previous QR_EC
      
      Which means the Samsung behavior conflicts with the Acer behavior.
      
      1. Samsung may behave like:
         [ +event 1 ] SCI_EVT set
         [ +event 2 ] SCI_EVT set
                                    write QR_EC
                                    read event
         [ -event 1 ] SCI_EVT clear
         Without the above commit, Samsung can work:
         [ +event 1 ] SCI_EVT set
         [ +event 2 ] SCI_EVT set
                                    write QR_EC
                                    CAN prepare next QR_EC as SCI_EVT=1
                                    read event
         [ -event 1 ] SCI_EVT clear
                                    write QR_EC
                                    read event
         [ -event 2 ] SCI_EVT clear
         With the above commit, Samsung cannot work:
         [ +event 1 ] SCI_EVT set
         [ +event 2 ] SCI_EVT set
                                    write QR_EC
                                    read event
         [ -event 1 ] SCI_EVT clear
                                    CANNOT prepare next QR_EC as SCI_EVT=0
      2. Acer may behave like:
         [ +event 1 ] SCI_EVT set
         [ +event 2 ]
                                    write QR_EC
                                    read event
         [ -event 1 ] SCI_EVT clear
         [ +event 2 ] SCI_EVT set
         Without the above commit, Acer cannot work when there is only 1 event:
         [ +event 1 ] SCI_EVT set
                                    write QR_EC
                                    can prepared next QR_EC as SCI_EVT=1
                                    read event
         [ -event 1 ] SCI_EVT clear
                                    CANNOT write QR_EC as SCI_EVT=0
         With the above commit, Acer can work:
         [ +event 1 ] SCI_EVT set
         [ +event 2 ]
                                    write QR_EC
                                    read event
         [ -event 1 ] SCI_EVT set
                                    can prepare next QR_EC because SCI_EVT=0
                                    CAN write QR_EC as SCI_EVT=1
      
      Since Acer can also work with only the following commit applied:
       Commit: 3afcf2ec
       Subject: ACPI / EC: Add support to disallow QR_EC to be issued when
                SCI_EVT isn't set
      commit 558e4736 can be reverted.
      
      Fixes: 558e4736 (ACPI / EC: Add support to disallow QR_EC to be issued ...)
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=44161Reported-and-tested-by: NOrtwin Glück <odi@odi.ch>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Cc: 3.17+ <stable@vger.kernel.org> # 3.17+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      df9ff918
  7. 28 10月, 2014 1 次提交
    • M
      ACPI: Use ACPI companion to match only the first physical device · 52870786
      Mika Westerberg 提交于
      Commit 6ab34301 ("mfd: Add ACPI support") made the MFD subdevices
      share the parent MFD ACPI companion if no _HID/_CID is specified for
      the subdevice in mfd_cell description. However, since all the subdevices
      share the ACPI companion, the match and modalias generation logic started
      to use the ACPI companion as well resulting this:
      
        # cat /sys/bus/platform/devices/HID-SENSOR-200041.6.auto/modalias
        acpi:INT33D1:PNP0C50:
      
      instead of the expected one
      
        # cat /sys/bus/platform/devices/HID-SENSOR-200041.6.auto/modalias
        platform:HID-SENSOR-200041
      
      In other words the subdevice modalias is overwritten by the one taken from
      ACPI companion. This causes udev not to load the driver anymore.
      
      It is useful to be able to share the ACPI companion so that MFD subdevices
      (and possibly other devices as well) can access the ACPI resources even if
      they do not have ACPI representation in the namespace themselves.
      
      An example where this is used is Minnowboard LPC driver that creates GPIO
      as a subdevice among other things. Without the ACPI companion gpiolib is
      not able to lookup the corresponding GPIO controller from ACPI GpioIo
      resource.
      
      To fix this, restrict the match and modalias logic to be limited to the
      first (primary) physical device associated with the given ACPI comapnion.
      The secondary devices will still be able to access the ACPI companion,
      but they will be matched in a different way.
      
      Fixes: 6ab34301 (mfd: Add ACPI support)
      Reported-by: NJarkko Nikula <jarkko.nikula@linux.intel.com>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      52870786
  8. 24 10月, 2014 1 次提交
  9. 22 10月, 2014 1 次提交
  10. 21 10月, 2014 12 次提交
  11. 17 10月, 2014 1 次提交
  12. 10 10月, 2014 10 次提交
  13. 07 10月, 2014 1 次提交
  14. 01 10月, 2014 1 次提交
    • R
      ACPI / sleep: Rework the handling of ACPI GPE wakeup from suspend-to-idle · a8d46b9e
      Rafael J. Wysocki 提交于
      The ACPI GPE wakeup from suspend-to-idle is currently based on using
      the IRQF_NO_SUSPEND flag for the ACPI SCI, but that is problematic
      for a couple of reasons.  First, in principle the ACPI SCI may be
      shared and IRQF_NO_SUSPEND does not really work well with shared
      interrupts.  Second, it may require the ACPI subsystem to special-case
      the handling of device notifications depending on whether or not
      they are received during suspend-to-idle in some places which would
      lead to fragile code.  Finally, it's better the handle ACPI wakeup
      interrupts consistently with wakeup interrupts from other sources.
      
      For this reason, remove the IRQF_NO_SUSPEND flag from the ACPI SCI
      and use enable_irq_wake()/disable_irq_wake() with it instead, which
      requires two additional platform hooks to be added to struct
      platform_freeze_ops.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a8d46b9e