[lkml]   [2017]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[PATCH v5 0/3] Init device ids from ACPI of_compatible
When using devicetree, stuff like or spi_device.modalias
is initialized to the first DT compatible id with the vendor prefix
stripped. Since some drivers rely on this in order to differentiate between
hardware variants, try to replicate it when using ACPI with DT ids.

This also makes it so that the i2c_device_id parameter passed to probe is
non-NULL when matching with ACPI and DT ids.

Tested using ACPI overlays but there is no actual dependency. This series
just extends the PRP0001 feature to be more useful for I2C/SPI.

The patches only touches the ACPI-specific parts of the i2c and spi core.

Here is an example .dsl for an SPI accelerometer connected to minnowboard max:

Device (ACCL)
Name (_ADR, Zero)
Name (_HID, "PRP0001")
Name (_UID, One)

Method (_CRS, 0, Serialized)
Name (RBUF, ResourceTemplate ()
SPISerialBus(1, PolarityLow, FourWireMode, 16,
ControllerInitiated, 1000000, ClockPolarityLow,
ClockPhaseFirst, "\\_SB.SPI1",)
GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
"\\_SB.GPO2", 0x00, ResourceConsumer, , )
{ // Pin list
Return (RBUF)
Name (_DSD, Package ()
Package ()
Package () {"compatible", "st,lis3dh"},

Credit to Leonard Crestez for the original version of this patch set.

Link to v4:
* add acpi_set_modalias wrapper to handle fallback to ACPI ID (Mark Brown)

Link to v3:
* Minor cosmetic/readability improvements (Andy Shevchenko)

Link to v2:
* Use appropriate subject prefix for each subsystem (Mark Brown)
* Use ACPI info as before if getting OF info fails (Mark Brown)
* Minor cosmetic/readability improvements (Rafael J. Wysocki)

Link to v1:
* Rebase on after acpi overlays got it.
* Change acpi_of_modalias outlen param to size_t
* Use {} after else

Dan O'Donovan (3):
ACPI / bus: Export acpi_of_modalias equiv of of_modalias_node
i2c: acpi: Initialize info.type from of_compatible
spi: acpi: Initialize modalias from of_compatible

drivers/acpi/bus.c | 42 ++++++++++++++++++++++++++++++++++++++++++
drivers/i2c/i2c-core.c | 3 ++-
drivers/spi/spi.c | 4 +++-
include/acpi/acpi_bus.h | 2 ++
4 files changed, 49 insertions(+), 2 deletions(-)


 \ /
  Last update: 2017-02-04 09:03    [W:0.105 / U:6.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site