diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-07-29 16:35:05 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-29 18:56:26 +0300 |
commit | 099d03f02dbffe1575d86063b2bf416502faa5e9 (patch) | |
tree | 7b1b755e59974803cef831f3be0b4c1a988119e7 /drivers/nfc | |
parent | 43201767b44cbd873c60dbd2acd370147588cb18 (diff) | |
download | linux-099d03f02dbffe1575d86063b2bf416502faa5e9.tar.xz |
NFC: nxp-nci: Add GPIO ACPI mapping table
In order to unify GPIO resource request prepare gpiod_get_index()
to behave correctly when there is no mapping provided by firmware.
Here we add explicit mapping between _CRS GpioIo() resources and
their names used in the driver.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/nxp-nci/i2c.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c index 713c267acf88..7344405feddf 100644 --- a/drivers/nfc/nxp-nci/i2c.c +++ b/drivers/nfc/nxp-nci/i2c.c @@ -247,6 +247,15 @@ exit_irq_none: return IRQ_NONE; } +static const struct acpi_gpio_params firmware_gpios = { 1, 0, false }; +static const struct acpi_gpio_params enable_gpios = { 2, 0, false }; + +static const struct acpi_gpio_mapping acpi_nxp_nci_gpios[] = { + { "enable-gpios", &enable_gpios, 1 }, + { "firmware-gpios", &firmware_gpios, 1 }, + { } +}; + static int nxp_nci_i2c_parse_devtree(struct i2c_client *client) { struct nxp_nci_i2c_phy *phy = i2c_get_clientdata(client); @@ -269,9 +278,14 @@ static int nxp_nci_i2c_parse_devtree(struct i2c_client *client) static int nxp_nci_i2c_acpi_config(struct nxp_nci_i2c_phy *phy) { struct i2c_client *client = phy->i2c_dev; + int r; - phy->gpiod_en = devm_gpiod_get_index(&client->dev, NULL, 2, GPIOD_OUT_LOW); - phy->gpiod_fw = devm_gpiod_get_index(&client->dev, NULL, 1, GPIOD_OUT_LOW); + r = devm_acpi_dev_add_driver_gpios(&client->dev, acpi_nxp_nci_gpios); + if (r) + return r; + + phy->gpiod_en = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_LOW); + phy->gpiod_fw = devm_gpiod_get(&client->dev, "firmware", GPIOD_OUT_LOW); if (IS_ERR(phy->gpiod_en) || IS_ERR(phy->gpiod_fw)) { nfc_err(&client->dev, "No GPIOs\n"); |