OSDN Git Service

net: rfkill: gpio: Add default GPIO driver mappings for ACPI
authorMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 27 Oct 2014 10:15:14 +0000 (12:15 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 4 Nov 2014 20:58:24 +0000 (21:58 +0100)
commit72daceb9a10af4614d4aee304f07904191962f07
tree56369fd293bddb3602a30d68d123da9c68927c30
parentf028d5242d7ecb0a1bfc80e7bd292201c8612641
net: rfkill: gpio: Add default GPIO driver mappings for ACPI

The driver uses devm_gpiod_get_index(..., index) so that the index refers
directly to the GpioIo resource under the ACPI device. The problem with
this is that if the ordering changes we get wrong GPIOs.

With ACPI 5.1 _DSD we can now use names instead to reference GPIOs
analogous to Device Tree. However, we still have systems out there that do
not provide _DSD at all. These systems must be supported as well.

Luckily we now have acpi_dev_add_driver_gpios() that can be used to provide
mappings for systems where _DSD is not provided and still take advantage of
_DSD if it exists.

This patch changes the driver to create default GPIO mappings if we are
running on ACPI system.

While there we can drop the indices completely and use devm_gpiod_get()
with name instead.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: John W. Linville <linville@tuxdriver.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
net/rfkill/rfkill-gpio.c