Skip to content

Commit 099d03f

Browse files
andy-shevdavem330
authored andcommitted
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 <[email protected]> Tested-by: Sedat Dilek <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4320176 commit 099d03f

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

drivers/nfc/nxp-nci/i2c.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,15 @@ static irqreturn_t nxp_nci_i2c_irq_thread_fn(int irq, void *phy_id)
247247
return IRQ_NONE;
248248
}
249249

250+
static const struct acpi_gpio_params firmware_gpios = { 1, 0, false };
251+
static const struct acpi_gpio_params enable_gpios = { 2, 0, false };
252+
253+
static const struct acpi_gpio_mapping acpi_nxp_nci_gpios[] = {
254+
{ "enable-gpios", &enable_gpios, 1 },
255+
{ "firmware-gpios", &firmware_gpios, 1 },
256+
{ }
257+
};
258+
250259
static int nxp_nci_i2c_parse_devtree(struct i2c_client *client)
251260
{
252261
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)
269278
static int nxp_nci_i2c_acpi_config(struct nxp_nci_i2c_phy *phy)
270279
{
271280
struct i2c_client *client = phy->i2c_dev;
281+
int r;
272282

273-
phy->gpiod_en = devm_gpiod_get_index(&client->dev, NULL, 2, GPIOD_OUT_LOW);
274-
phy->gpiod_fw = devm_gpiod_get_index(&client->dev, NULL, 1, GPIOD_OUT_LOW);
283+
r = devm_acpi_dev_add_driver_gpios(&client->dev, acpi_nxp_nci_gpios);
284+
if (r)
285+
return r;
286+
287+
phy->gpiod_en = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_LOW);
288+
phy->gpiod_fw = devm_gpiod_get(&client->dev, "firmware", GPIOD_OUT_LOW);
275289

276290
if (IS_ERR(phy->gpiod_en) || IS_ERR(phy->gpiod_fw)) {
277291
nfc_err(&client->dev, "No GPIOs\n");

0 commit comments

Comments
 (0)