1. 04 4月, 2015 1 次提交
    • R
      device property: Make it possible to use secondary firmware nodes · 97badf87
      Rafael J. Wysocki 提交于
      Add a secondary pointer to struct fwnode_handle so as to make it
      possible for a device to have two firmware nodes associated with
      it at the same time, for example, an ACPI node and a node with
      a set of properties provided by platform initialization code.
      
      In the future that will allow device property lookup to fall back
      from the primary firmware node to the secondary one if the given
      property is not present there to make it easier to provide defaults
      for device properties used by device drivers.
      
      Introduce two helper routines, set_primary_fwnode() and
      set_secondary_fwnode() allowing callers to add a primary/secondary
      firmware node to the given device in such a way that
      
       (1) If there's only one firmware node for that device, it will be
           pointed to by the device's firmware node pointer.
       (2) If both the primary and secondary firmware nodes are present,
           the primary one will be pointed to by the device's firmware
           node pointer, while the secondary one will be pointed to by the
           primary node's secondary pointer.
       (3) If one of these nodes is removed (by calling one of the new
           nelpers with NULL as the second argument), the other one will
           be preserved.
      
      Make ACPI use set_primary_fwnode() for attaching its firmware nodes
      to devices.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      97badf87
  2. 26 3月, 2015 2 次提交
  3. 17 3月, 2015 2 次提交
  4. 05 2月, 2015 2 次提交
  5. 04 2月, 2015 3 次提交
  6. 06 1月, 2015 1 次提交
  7. 16 12月, 2014 1 次提交
  8. 04 12月, 2014 1 次提交
  9. 27 11月, 2014 1 次提交
  10. 24 11月, 2014 1 次提交
  11. 06 11月, 2014 1 次提交
  12. 05 11月, 2014 5 次提交
    • R
      ACPI / GPIO: Driver GPIO mappings for ACPI GPIOs · f028d524
      Rafael J. Wysocki 提交于
      Provide a way for device drivers using GPIOs described by ACPI
      GpioIo resources in _CRS to tell the GPIO subsystem what names
      (connection IDs) to associate with specific GPIO pins defined
      in there.
      
      To do that, a driver needs to define a mapping table as a
      NULL-terminated array of struct acpi_gpio_mapping objects
      that each contain a name, a pointer to an array of line data
      (struct acpi_gpio_params) objects and the size of that array.
      
      Each struct acpi_gpio_params object consists of three fields,
      crs_entry_index, line_index, active_low, representing the index of
      the target GpioIo()/GpioInt() resource in _CRS starting from zero,
      the index of the target line in that resource starting from zero,
      and the active-low flag for that line, respectively.
      
      Next, the mapping table needs to be passed as the second
      argument to acpi_dev_add_driver_gpios() that will register it with
      the ACPI device object pointed to by its first argument.  That
      should be done in the driver's .probe() routine.
      
      On removal, the driver should unregister its GPIO mapping table
      by calling acpi_dev_remove_driver_gpios() on the ACPI device
      object where that table was previously registered.
      
      Included are fixes from Mika Westerberg.
      Acked-by: NAlexandre Courbot <acourbot@nvidia.com>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f028d524
    • R
      Driver core: Unified interface for firmware node properties · 8a0662d9
      Rafael J. Wysocki 提交于
      Add new generic routines are provided for retrieving properties from
      device description objects in the platform firmware in case there are
      no struct device objects for them (either those objects have not been
      created yet or they do not exist at all).
      
      The following functions are provided:
      
      fwnode_property_present()
      fwnode_property_read_u8()
      fwnode_property_read_u16()
      fwnode_property_read_u32()
      fwnode_property_read_u64()
      fwnode_property_read_string()
      fwnode_property_read_u8_array()
      fwnode_property_read_u16_array()
      fwnode_property_read_u32_array()
      fwnode_property_read_u64_array()
      fwnode_property_read_string_array()
      
      in analogy with the corresponding functions for struct device added
      previously.  For all of them, the first argument is a pointer to struct
      fwnode_handle (new type) that allows a device description object
      (depending on what platform firmware interface is in use) to be
      obtained.
      
      Add a new macro device_for_each_child_node() for iterating over the
      children of the device description object associated with a given
      device and a new function device_get_child_node_count() returning the
      number of a given device's child nodes.
      
      The interface covers both ACPI and Device Trees.
      Suggested-by: NGrant Likely <grant.likely@linaro.org>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NGrant Likely <grant.likely@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8a0662d9
    • M
      ACPI: Allow drivers to match using Device Tree compatible property · 733e6251
      Mika Westerberg 提交于
      We have lots of existing Device Tree enabled drivers and allocating
      separate _HID for each is not feasible. Instead we allocate special _HID
      "PRP0001" that means that the match should be done using Device Tree
      compatible property using driver's .of_match_table instead if the driver
      is missing .acpi_match_table.
      
      If there is a need to distinguish from where the device is enumerated
      (DT/ACPI) driver can check dev->of_node or ACPI_COMPATION(dev).
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NGrant Likely <grant.likely@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      733e6251
    • R
      Driver core: Unified device properties interface for platform firmware · b31384fa
      Rafael J. Wysocki 提交于
      Add a uniform interface by which device drivers can request device
      properties from the platform firmware by providing a property name
      and the corresponding data type.  The purpose of it is to help to
      write portable code that won't depend on any particular platform
      firmware interface.
      
      The following general helper functions are added:
      
      device_property_present()
      device_property_read_u8()
      device_property_read_u16()
      device_property_read_u32()
      device_property_read_u64()
      device_property_read_string()
      device_property_read_u8_array()
      device_property_read_u16_array()
      device_property_read_u32_array()
      device_property_read_u64_array()
      device_property_read_string_array()
      
      The first one allows the caller to check if the given property is
      present.  The next 5 of them allow single-valued properties of
      various types to be retrieved in a uniform way.  The remaining 5 are
      for reading properties with multiple values (arrays of either numbers
      or strings).
      
      The interface covers both ACPI and Device Trees.
      
      This change set includes material from Mika Westerberg and Aaron Lu.
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NGrant Likely <grant.likely@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b31384fa
    • M
      ACPI: Add support for device specific properties · ffdcd955
      Mika Westerberg 提交于
      Device Tree is used in many embedded systems to describe the system
      configuration to the OS. It supports attaching properties or name-value
      pairs to the devices it describe. With these properties one can pass
      additional information to the drivers that would not be available
      otherwise.
      
      ACPI is another configuration mechanism (among other things) typically
      seen, but not limited to, x86 machines. ACPI allows passing arbitrary
      data from methods but there has not been mechanism equivalent to Device
      Tree until the introduction of _DSD in the recent publication of the
      ACPI 5.1 specification.
      
      In order to facilitate ACPI usage in systems where Device Tree is
      typically used, it would be beneficial to standardize a way to retrieve
      Device Tree style properties from ACPI devices, which is what we do in
      this patch.
      
      If a given device described in ACPI namespace wants to export properties it
      must implement _DSD method (Device Specific Data, introduced with ACPI 5.1)
      that returns the properties in a package of packages. For example:
      
      	Name (_DSD, Package () {
      		ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
      		Package () {
      			Package () {"name1", <VALUE1>},
      			Package () {"name2", <VALUE2>},
      			...
      		}
      	})
      
      The UUID reserved for properties is daffd814-6eba-4d8c-8a91-bc9bbf4aa301
      and is documented in the ACPI 5.1 companion document called "_DSD
      Implementation Guide" [1], [2].
      
      We add several helper functions that can be used to extract these
      properties and convert them to different Linux data types.
      
      The ultimate goal is that we only have one device property API that
      retrieves the requested properties from Device Tree or from ACPI
      transparent to the caller.
      
      [1] http://www.uefi.org/sites/default/files/resources/_DSD-implementation-guide-toplevel.htm
      [2] http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdfReviewed-by: NHanjun Guo <hanjun.guo@linaro.org>
      Reviewed-by: NJosh Triplett <josh@joshtriplett.org>
      Reviewed-by: NGrant Likely <grant.likely@linaro.org>
      Signed-off-by: NDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ffdcd955
  13. 10 10月, 2014 1 次提交
  14. 22 9月, 2014 1 次提交
  15. 23 7月, 2014 1 次提交
  16. 27 6月, 2014 1 次提交
    • L
      I2C/ACPI: Add i2c ACPI operation region support · 5d98e61d
      Lan Tianyu 提交于
      ACPI 5.0 spec(5.5.2.4.5) defines GenericSerialBus(i2c, spi, uart) operation region.
      It allows ACPI aml code able to access such kind of devices to implement
      some ACPI standard method.
      
      ACPI Spec defines some access attribute to associate with i2c protocol.
      AttribQuick 	       	       		Read/Write Quick Protocol
      AttribSendReceive			Send/Receive Byte Protocol
      AttribByte 			 	Read/Write Byte Protocol
      AttribWord				Read/Write Word Protocol
      AttribBlock				Read/Write Block Protocol
      AttribBytes				Read/Write N-Bytes Protocol
      AttribProcessCall			Process Call Protocol
      AttribBlockProcessCall			Write Block-Read Block Process Call Protocol
      AttribRawBytes 				Raw Read/Write N-BytesProtocol
      AttribRawProcessBytes			Raw Process Call Protocol
      
      On the Asus T100TA, Bios use GenericSerialBus operation region to access
      i2c device to get battery info.
      
      Sample code From Asus T100TA
      
          Scope (_SB.I2C1)
          {
              Name (UMPC, ResourceTemplate ()
              {
                  I2cSerialBus (0x0066, ControllerInitiated, 0x00061A80,
                      AddressingMode7Bit, "\\_SB.I2C1",
                      0x00, ResourceConsumer, ,
                      )
              })
      
      	...
      
              OperationRegion (DVUM, GenericSerialBus, Zero, 0x0100)
              Field (DVUM, BufferAcc, NoLock, Preserve)
              {
                  Connection (UMPC),
                  Offset (0x81),
                  AccessAs (BufferAcc, AttribBytes (0x3E)),
                  FGC0,   8
              }
      	...
           }
      
           Device (BATC)
           {
               Name (_HID, EisaId ("PNP0C0A"))  // _HID: Hardware ID
               Name (_UID, One)  // _UID: Unique ID
      	 ...
      
                  Method (_BST, 0, NotSerialized)  // _BST: Battery Status
                  {
                      If (LEqual (AVBL, One))
                      {
                          Store (FGC0, BFFG)
                          If (LNotEqual (STAT, One))
                          {
                              ShiftRight (CHST, 0x04, Local0)
                              And (Local0, 0x03, Local0)
                              If (LOr (LEqual (Local0, One), LEqual (Local0, 0x02)))
                              {
                                  Store (0x02, Local1)
                              }
      	...
      
          }
      
      The i2c operation region is defined under I2C1 scope. _BST method under
      battery device BATC read battery status from the field "FCG0". The request
      would be sent to i2c operation region handler.
      
      This patch is to add i2c ACPI operation region support. Due to there are
      only "Byte" and "Bytes" protocol access on the Asus T100TA, other protocols
      have not been tested.
      
      About RawBytes and RawProcessBytes protocol, they needs specific drivers to interpret
      reference data from AML code according ACPI 5.0 SPEC(5.5.2.4.5.3.9 and 5.5.2.4.5.3.10).
      So far, not found such case and will add when find real case.
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      5d98e61d
  17. 30 5月, 2014 1 次提交
    • Z
      ACPI / PNP: use device ID list for PNPACPI device enumeration · eec15edb
      Zhang Rui 提交于
      ACPI can be used to enumerate PNP devices, but the code does not
      handle this in the right way currently.  Namely, if an ACPI device
      object
       1. Has a _CRS method,
       2. Has an identification of
          "three capital characters followed by four hex digits",
       3. Is not in the excluded IDs list,
      it will be enumerated to PNP bus (that is, a PNP device object will
      be create for it).  This means that, actually, the PNP bus type is
      used as the default bus type for enumerating _HID devices in ACPI.
      
      However, more and more _HID devices need to be enumerated to the
      platform bus instead (that is, platform device objects need to be
      created for them).  As a result, the device ID list in acpi_platform.c
      is used to enforce creating platform device objects rather than PNP
      device objects for matching devices.  That list has been continuously
      growing recently, unfortunately, and it is pretty much guaranteed to
      grow even more in the future.
      
      To address that problem it is better to enumerate _HID devices
      as platform devices by default.  To this end, change the way of
      enumerating PNP devices by adding a PNP ACPI scan handler that
      will use a device ID list to create PNP devices for the ACPI
      device objects whose device IDs are present in that list.
      
      The initial device ID list in the PNP ACPI scan handler contains
      all of the pnp_device_id strings from all the existing PNP drivers,
      so this change should be transparent to the PNP core and all of the
      PNP drivers.  Still, in the future it should be possible to reduce
      its size by converting PNP drivers that need not be PNP for any
      technical reasons into platform drivers.
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      [rjw: Rewrote the changelog, modified the PNP ACPI scan handler code]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      eec15edb
  18. 26 5月, 2014 1 次提交
    • B
      ACPI: add dynamic_debug support · 45fef5b8
      Bjørn Mork 提交于
      Commit 1a699476 ("ACPI / hotplug / PCI: Hotplug notifications
      from acpi_bus_notify()") added debug messages for a few common
      events. These debug messages are unconditionally enabled if
      CONFIG_DYNAMIC_DEBUG is defined, contrary to the documented
      meaning, making the ACPI system spew lots of unwanted noise on
      any kernel with dynamic debugging.
      
      The bug was introduced by commit fbfddae6 ("ACPI: Add
      acpi_handle_<level>() interfaces"), which added the
      CONFIG_DYNAMIC_DEBUG dependency without respecting its meaning.
      
      Fix by adding real support for dynamic_debug.
      
      Fixes: fbfddae6 ("ACPI: Add acpi_handle_<level>() interfaces")
      Signed-off-by: NBjørn Mork <bjorn@mork.no>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      45fef5b8
  19. 20 5月, 2014 1 次提交
  20. 19 2月, 2014 1 次提交
  21. 04 2月, 2014 2 次提交
  22. 17 1月, 2014 1 次提交
    • Z
      ACPI: add module autoloading support for ACPI enumerated devices · 6eb2451f
      Zhang Rui 提交于
      An ACPI enumerated device may have its compatible id strings.
      
      To support the compatible ACPI ids (acpi_device->pnp.ids),
      we introduced acpi_driver_match_device() to match
      the driver->acpi_match_table and acpi_device->pnp.ids.
      
      For those drivers, MODULE_DEVICE_TABLE(acpi, xxx) is used to
      exports the driver module alias in the format of
      "acpi:device_compatible_ids".
      But in the mean time, the current code does not export the
      ACPI compatible strings as part of the module_alias for the
      ACPI enumerated devices, which will break the module autoloading.
      
      Take the following piece of code for example,
      static const struct acpi_device_id xxx_acpi_match[] = {
              { "INTABCD", 0 },
              { }
      };
      MODULE_DEVICE_TABLE(acpi, xxx_acpi_match);
      
      If this piece of code is used in a platform driver for
      an ACPI enumerated platform device, the platform driver module_alias
      is "acpi:INTABCD", but the uevent attribute of its platform device node
      is "platform:INTABCD:00" (PREFIX:platform_device->name).
      If this piece of code is used in an i2c driver for an ACPI enumerated
      i2c device, the i2c driver module_alias is "acpi:INTABCD", but
      the uevent of its i2c device node is "i2c:INTABCD:00" (PREFIX:i2c_client->name).
      If this piece of code is used in an spi driver for an ACPI enumerated
      spi device, the spi driver module_alias is "acpi:INTABCD", but
      the uevent of its spi device node is "spi:INTABCD" (PREFIX:spi_device->modalias).
      
      The reason why the module autoloading is not broken for now is that
      the uevent file of the ACPI device node is "acpi:INTABCD".
      Thus it is the ACPI device node creation that loads the platform/i2c/spi driver.
      
      So this is a problem that will affect us the day when the ACPI bus
      is removed from device model.
      
      This patch introduces two new APIs,
      one for exporting ACPI ids in uevent MODALIAS field,
      and another for exporting ACPI ids in device' modalias sysfs attribute.
      
      For any bus that supports ACPI enumerated devices, it needs to invoke
      these two functions for their uevent and modalias attribute.
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6eb2451f
  23. 06 1月, 2014 1 次提交
  24. 07 12月, 2013 2 次提交
  25. 15 11月, 2013 3 次提交
    • J
      ACPI: Provide acpi_dev_name accessor for struct acpi_device device name · 45c42a7f
      Jarkko Nikula 提交于
      struct acpi_device fields are only available when CONFIG_ACPI is set. We may
      find use for dev_name(&adev->dev) in generic code that is build also without
      CONFIG_ACPI is set but currently this requires #ifdef CONFIG_ACPI churn.
      
      Provide here an accessor that returns dev_name of embedded struct device dev
      in struct acpi_device or NULL depending on CONFIG_ACPI setting.
      Signed-off-by: NJarkko Nikula <jarkko.nikula@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      45c42a7f
    • R
      ACPI: Eliminate the DEVICE_ACPI_HANDLE() macro · 3a83f992
      Rafael J. Wysocki 提交于
      Since DEVICE_ACPI_HANDLE() is now literally identical to
      ACPI_HANDLE(), replace it with the latter everywhere and drop its
      definition from include/acpi.h.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3a83f992
    • R
      ACPI / driver core: Store an ACPI device pointer in struct acpi_dev_node · 7b199811
      Rafael J. Wysocki 提交于
      Modify struct acpi_dev_node to contain a pointer to struct acpi_device
      associated with the given device object (that is, its ACPI companion
      device) instead of an ACPI handle corresponding to it.  Introduce two
      new macros for manipulating that pointer in a CONFIG_ACPI-safe way,
      ACPI_COMPANION() and ACPI_COMPANION_SET(), and rework the
      ACPI_HANDLE() macro to take the above changes into account.
      Drop the ACPI_HANDLE_SET() macro entirely and rework its users to
      use ACPI_COMPANION_SET() instead.  For some of them who used to
      pass the result of acpi_get_child() directly to ACPI_HANDLE_SET()
      introduce a helper routine acpi_preset_companion() doing an
      equivalent thing.
      
      The main motivation for doing this is that there are things
      represented by struct acpi_device objects that don't have valid
      ACPI handles (so called fixed ACPI hardware features, such as
      power and sleep buttons) and we would like to create platform
      device objects for them and "glue" them to their ACPI companions
      in the usual way (which currently is impossible due to the
      lack of valid ACPI handles).  However, there are more reasons
      why it may be useful.
      
      First, struct acpi_device pointers allow of much better type checking
      than void pointers which are ACPI handles, so it should be more
      difficult to write buggy code using modified struct acpi_dev_node
      and the new macros.  Second, the change should help to reduce (over
      time) the number of places in which the result of ACPI_HANDLE() is
      passed to acpi_bus_get_device() in order to obtain a pointer to the
      struct acpi_device associated with the given "physical" device,
      because now that pointer is returned by ACPI_COMPANION() directly.
      Finally, the change should make it easier to write generic code that
      will build both for CONFIG_ACPI set and unset without adding explicit
      compiler directives to it.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> # on Haswell
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: Aaron Lu <aaron.lu@intel.com> # for ATA and SDIO part
      7b199811
  26. 24 10月, 2013 1 次提交
  27. 24 9月, 2013 1 次提交