1. 23 7月, 2018 4 次提交
  2. 12 2月, 2018 2 次提交
  3. 13 12月, 2017 1 次提交
  4. 12 10月, 2017 2 次提交
  5. 20 9月, 2017 2 次提交
    • S
      ACPI: properties: Return _DSD hierarchical extension (data) sub-nodes correctly · 0c0bceb7
      Sakari Ailus 提交于
      The recently merged patch "ACPI: Prepare for constifying
      acpi_get_next_subnode() fwnode argument" was part of a patchset
      constifying the fwnode arguments across the fwnode property API. The
      purpose of the patch was to allow returning non-const fwnodes from a data
      structure the root of which is const.
      
      Unfortunately the patch introduced the functionality, in particular when
      starting parsed from an ACPI device node, the hierarchical data extension
      nodes would not be enumerated.
      
      Restore the old behaviour while still retaining constness properties of
      the patch.
      
      Fixes: 01c1da28 "ACPI: Prepare for constifying acpi_get_next_subnode() fwnode argument"
      Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0c0bceb7
    • J
      ACPI / bus: Make ACPI_HANDLE() work for non-GPL code again · 9e987b70
      John Hubbard 提交于
      Due to commit db3e50f3 (device property: Get rid of struct
      fwnode_handle type field), ACPI_HANDLE() inadvertently became
      a GPL-only call. The call path that led to that was:
      
      ACPI_HANDLE()
          ACPI_COMPANION()
              to_acpi_device_node()
                  is_acpi_device_node()
                      acpi_device_fwnode_ops
                          DECLARE_ACPI_FWNODE_OPS(acpi_device_fwnode_ops);
      
      ...and the new DECLARE_ACPI_FWNODE_OPS() includes
      EXPORT_SYMBOL_GPL, whereas previously it was a static struct.
      
      In order to avoid changing any of that, let's instead provide ever
      so slightly better encapsulation of those struct fwnode_operations
      instances. Those do not really need to be directly used in
      inline function calls in header files. Simply moving two small
      functions (is_acpi_device_node and is_acpi_data_node) out of
      acpi_bus.h, and into a .c file, does that.
      
      That leaves the internals of struct fwnode_operations as GPL-only
      (which I think was the intent all along), but un-breaks any driver
      code out there that relies on the ACPI subsystem's being (historically)
      an EXPORT_SYMBOL-usable system. By that, I mean, ACPI_HANDLE() and
      other basic ACPI calls were non-GPL-protected.
      
      Also, while I'm there, remove a tiny bit of redundancy that was missed
      in the earlier commit, by having is_acpi_node() use the other two
      routines, instead of checking fwnode directly.
      
      Fixes: db3e50f3 (device property: Get rid of struct fwnode_handle type field)
      Signed-off-by: NJohn Hubbard <jhubbard@nvidia.com>
      Acked-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      9e987b70
  6. 23 8月, 2017 1 次提交
  7. 04 8月, 2017 2 次提交
    • L
      ACPI / property: Support Apple _DSM properties · 899596e0
      Lukas Wunner 提交于
      While the rest of the world has standardized on _DSD as the way to store
      device properties in AML (introduced with ACPI 5.1 in 2014), Apple has
      been using a custom _DSM to achieve the same for much longer (ever since
      they switched from DeviceTree-based PowerPC to Intel in 2005, verified
      with MacOS X 10.4.11).
      
      The theory of operation on macOS is as follows:  AppleACPIPlatform.kext
      invokes mergeEFIproperties() and mergeDSMproperties() for each device to
      merge properties conveyed by EFI drivers as well as properties stored in
      AML into the I/O Kit registry from which they can be retrieved by
      drivers.  We've been supporting EFI properties since commit 58c5475a
      ("x86/efi: Retrieve and assign Apple device properties").  The present
      commit adds support for _DSM properties, thereby completing our support
      for Apple device properties.  The _DSM properties are made available
      under the primary fwnode, the EFI properties under the secondary fwnode.
      So for devices which possess both property types, they can all be
      elegantly accessed with the uniform API in <linux/property.h>.
      
      Until recently we had no need to support _DSM properties, they contained
      only uninteresting garbage.  The situation has changed with MacBooks and
      MacBook Pros introduced since 2015:  Their keyboard is attached with SPI
      instead of USB and the _CRS data which is necessary to initialize the
      spi driver only contains valid information if OSPM responds "false" to
      _OSI("Darwin").  If OSPM responds "true", _CRS is empty and the spi
      driver fails to initialize.  The rationale is very simple, Apple only
      cares about macOS and Windows:  On Windows, _CRS contains valid data,
      whereas on macOS it is empty.  Instead, macOS gleans the necessary data
      from the _DSM properties.
      
      Since Linux deliberately defaults to responding "true" to _OSI("Darwin"),
      we need to emulate macOS' behaviour by initializing the spi driver with
      data returned by the _DSM.
      
      An out-of-tree driver for the SPI keyboard exists which currently binds
      to the ACPI device, invokes the _DSM, parses the returned package and
      instantiates an SPI device with the data gleaned from the _DSM:
      https://github.com/cb22/macbook12-spi-driver/commit/9a416d699ef4
      https://github.com/cb22/macbook12-spi-driver/commit/0c34936ed9a1
      
      By adding support for Apple's _DSM properties in generic ACPI code, the
      out-of-tree driver will be able to register as a regular SPI driver,
      significantly reducing its amount of code and improving its chances to
      be mainlined.
      
      The SPI keyboard will not be the only user of this commit:  E.g. on the
      MacBook8,1, the UART-attached Bluetooth device likewise returns empty
      _CRS data if OSPM returns "true" to _OSI("Darwin").
      
      The _DSM returns a Package whose format unfortunately deviates slightly
      from the _DSD spec:  The properties are marshalled up in a single Package
      as alternating key/value elements, unlike _DSD which stores them as a
      Package of 2-element Packages.  The present commit therefore converts
      the Package to _DSD format and the ACPI core can then treat the data as
      if Apple would follow the standard.
      
      Well, except for one small annoyance:  The properties returned by the
      _DSM only ever have one of two types, Integer or Buffer.  The former is
      retrievable as usual with device_property_read_u64(), but the latter is
      not part of the _DSD spec and it is not possible to retrieve Buffer
      properties with the device_property_read_*() functions due to the type
      checking performed in drivers/acpi/property.c.  It is however possible
      to retrieve them with acpi_dev_get_property().  Apple is using the
      Buffer type somewhat sloppily to store null-terminated strings but also
      integers.  The real data type is not distinguishable by the ACPI core
      and the onus is on the caller to use the contents of the Buffer in an
      appropriate way.
      
      In case Apple moves to _DSD in the future, this commit first checks for
      _DSD and falls back to _DSM only if _DSD is not found.
      Tested-by: NRonald Tschalär <ronald@innovation.ch>
      Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      899596e0
    • L
      ACPI / property: Don't evaluate objects for devices w/o handle · 75fc70e0
      Lukas Wunner 提交于
      Fabricated devices such as LNXPWRBN lack a handle, causing evaluation
      of _CCA and _DSD to always fail with AE_BAD_PARAMETER.  While that is
      merely a (negligible) waste of processing power, evaluating a _DSM for
      them (such as Apple's device properties _DSM which we're about to add)
      results in an ugly error:
      
          ACPI: \: failed to evaluate _DSM (0x1001)
      
      Avoid by not evaluating _DSD and the upcoming _DSM for devices without
      handle.
      Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      75fc70e0
  8. 26 7月, 2017 1 次提交
  9. 22 7月, 2017 5 次提交
  10. 22 6月, 2017 3 次提交
  11. 29 3月, 2017 4 次提交
  12. 24 11月, 2016 1 次提交
  13. 12 10月, 2016 1 次提交
    • M
      ACPI / property: Allow holes in reference properties · b60e4ea4
      Mika Westerberg 提交于
      DT allows holes or empty phandles for references. This is used for example
      in SPI subsystem where some chip selects are native and others are regular
      GPIOs. In ACPI _DSD we currently do not support this but instead the
      preceding reference consumes all following integer arguments.
      
      For example we would like to support something like the below ASL fragment
      for SPI:
      
        Package () {
            "cs-gpios",
            Package () {
                ^GPIO, 19, 0, 0, // GPIO CS0
                0,               // Native CS
                ^GPIO, 20, 0, 0, // GPIO CS1
            }
        }
      
      The zero in the middle means "no entry" or NULL reference. To support this
      we change acpi_data_get_property_reference() to take firmware node and
      num_args as argument and rename it to __acpi_node_get_property_reference().
      The function returns -ENOENT if the given index resolves to "no entry"
      reference and -ENODATA when there are no more entries in the property.
      
      We then add static inline wrapper acpi_node_get_property_reference() that
      passes MAX_ACPI_REFERENCE_ARGS as num_args to support the existing
      behaviour which some drivers have been relying on.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b60e4ea4
  14. 17 3月, 2016 1 次提交
  15. 07 12月, 2015 1 次提交
  16. 22 10月, 2015 1 次提交
  17. 15 9月, 2015 5 次提交
    • R
      ACPI / property: Extend device_get_next_child_node() to data-only nodes · 504a3374
      Rafael J. Wysocki 提交于
      Make device_get_next_child_node() work with ACPI data-only subnodes
      introduced previously.
      
      Namely, replace acpi_get_next_child() with acpi_get_next_subnode()
      that can handle (and return) child device objects as well as child
      data-only subnodes of the given device and modify the ACPI part
      of the GPIO subsystem to handle data-only subnodes returned by it.
      
      To that end, introduce acpi_node_get_gpiod() taking a struct
      fwnode_handle pointer as the first argument.  That argument may
      point to an ACPI device object as well as to a data-only subnode
      and the function should do the right thing (ie. look for the matching
      GPIO descriptor correctly) in either case.
      
      Next, modify fwnode_get_named_gpiod() to use acpi_node_get_gpiod()
      instead of acpi_get_gpiod_by_index() which automatically causes
      devm_get_gpiod_from_child() to work with ACPI data-only subnodes
      that may be returned by device_get_next_child_node() which in turn
      is required by the users of that function (the gpio_keys_polled
      and gpio-leds drivers).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      504a3374
    • R
      ACPI / property: Extend fwnode_property_* to data-only subnodes · 3a7a2ab8
      Rafael J. Wysocki 提交于
      Modify is_acpi_node() to return "true" for ACPI data-only subnodes as
      well as for ACPI device objects and change the name of to_acpi_node()
      to to_acpi_device_node() so it is clear that it covers ACPI device
      objects only.  Accordingly, introduce to_acpi_data_node() to cover
      data-only subnodes in an analogous way.
      
      With that, make the fwnode_property_* family of functions work with
      ACPI data-only subnodes introduced previously.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      3a7a2ab8
    • R
      ACPI / property: Expose data-only subnodes via sysfs · 263b4c1a
      Rafael J. Wysocki 提交于
      Add infrastructure needed to expose data-only subnodes of ACPI
      device objects introduced previously via sysfs.
      
      Each data-only subnode is represented as a sysfs directory under
      the directory corresponding to its parent object (a device or a
      data-only subnode).  Each of them has a "path" attribute (containing
      the full ACPI namespace path to the object the subnode data come from)
      at this time.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      263b4c1a
    • R
      ACPI / property: Add support for data-only subnodes · 445b0eb0
      Rafael J. Wysocki 提交于
      In some cases, the information expressed via device properties is
      hierarchical by nature.  For example, the properties of a composite
      device consisting of multiple semi-dependent components may need
      to be represented in the form of a tree of property data sets
      corresponding to specific components of the device.
      
      Unfortunately, using ACPI device objects for this purpose turns out
      to be problematic, mostly due to the assumption made by some operating
      systems (that platform firmware generally needs to work with) that
      each device object in the ACPI namespace represents a device requiring
      a separate driver.  That assumption leads to complications which
      reportedly are impractically difficult to overcome and a different
      approach is needed for the sake of interoperability.
      
      The approach implemented here is based on extending _DSD via pointers
      (links) to additional ACPI objects returning data packages formatted
      in accordance with the _DSD formatting rules defined by Section 6.2.5
      of ACPI 6.  Those additional objects are referred to as data-only
      subnodes of the device object containing the _DSD pointing to them.
      
      The links to them need to be located in a separate section of the
      _DSD data package following UUID dbb8e3e6-5886-4ba6-8795-1319f52a966b
      referred to as the Hierarchical Data Extension UUID as defined in [1].
      Each of them is represented by a package of two strings.  The first
      string in that package (the key) is regarded as the name of the
      data-only subnode pointed to by the link.  The second string in it
      (the target) is expected to hold the ACPI namespace path (possibly
      utilizing the usual ACPI namespace search rules) of an ACPI object
      evaluating to a data package extending the _DSD.
      
      The device properties initialization code follows those links,
      creates a struct acpi_data_node object for each of them to store
      the data returned by the ACPI object pointed to by it and processes
      those data recursively (which may lead to the creation of more
      struct acpi_data_node objects if the returned data package contains
      the Hierarchical Data Extension UUID section with more links in it).
      
      All of the struct acpi_data_node objects are present until the the
      ACPI device object containing the _DSD with links to them is deleted
      and they are deleted along with that object.
      
      [1]: http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.pdfSigned-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      445b0eb0
    • R
      ACPI / property: Add routine for extraction of _DSD properties · bd8191cc
      Rafael J. Wysocki 提交于
      Move the extraction of _DSD properties from acpi_init_properties()
      to a separate routine called acpi_extract_properties() to make the
      subsequent changes more straightforward.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      bd8191cc
  18. 26 8月, 2015 1 次提交
  19. 23 5月, 2015 1 次提交
  20. 05 5月, 2015 1 次提交
    • R
      ACPI / property: Refine consistency check for PRP0001 · 5c53b262
      Rafael J. Wysocki 提交于
      Refine the check for the presence of the "compatible" property
      if the PRP0001 device ID is present in the device's list of
      ACPI/PNP IDs to also print the message if _DSD is missing
      entirely or the format of it is incorrect.
      
      One special case to take into accout is that the "compatible"
      property need not be provided for devices having the PRP0001
      device ID in their lists of ACPI/PNP IDs if they are ancestors
      of PRP0001 devices with the "compatible" property present.
      This is to cover heriarchies of device objects where the kernel
      is only supposed to use a struct device representation for the
      topmost one and the others represent, for example, functional
      blocks of a composite device.
      
      While at it, reduce the log level of the message to "info"
      and reduce the log level of the "broken _DSD" message to
      "debug" (noise reduction).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      5c53b262