aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/nfc/st21nfca/i2c.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c
index 5d20ccf2e589..d7a2c7636e26 100644
--- a/drivers/nfc/st21nfca/i2c.c
+++ b/drivers/nfc/st21nfca/i2c.c
@@ -525,17 +525,13 @@ static int st21nfca_hci_i2c_of_request_resources(struct i2c_client *client)
525 } 525 }
526 526
527 /* GPIO request and configuration */ 527 /* GPIO request and configuration */
528 r = devm_gpio_request(&client->dev, gpio, "clf_enable"); 528 r = devm_gpio_request_one(&client->dev, gpio, GPIOF_OUT_INIT_HIGH,
529 "clf_enable");
529 if (r) { 530 if (r) {
530 nfc_err(&client->dev, "Failed to request enable pin\n"); 531 nfc_err(&client->dev, "Failed to request enable pin\n");
531 return -ENODEV; 532 return -ENODEV;
532 } 533 }
533 534
534 r = gpio_direction_output(gpio, 1);
535 if (r) {
536 nfc_err(&client->dev, "Failed to set enable pin direction as output\n");
537 return -ENODEV;
538 }
539 phy->gpio_ena = gpio; 535 phy->gpio_ena = gpio;
540 536
541 /* IRQ */ 537 /* IRQ */
@@ -576,32 +572,20 @@ static int st21nfca_hci_i2c_request_resources(struct i2c_client *client)
576 phy->gpio_ena = pdata->gpio_ena; 572 phy->gpio_ena = pdata->gpio_ena;
577 phy->irq_polarity = pdata->irq_polarity; 573 phy->irq_polarity = pdata->irq_polarity;
578 574
579 r = devm_gpio_request(&client->dev, phy->gpio_irq, "wake_up"); 575 r = devm_gpio_request_one(&client->dev, phy->gpio_irq, GPIOF_IN,
576 "wake_up");
580 if (r) { 577 if (r) {
581 pr_err("%s : gpio_request failed\n", __FILE__); 578 pr_err("%s : gpio_request failed\n", __FILE__);
582 return -ENODEV; 579 return -ENODEV;
583 } 580 }
584 581
585 r = gpio_direction_input(phy->gpio_irq);
586 if (r) {
587 pr_err("%s : gpio_direction_input failed\n", __FILE__);
588 return -ENODEV;
589 }
590
591 if (phy->gpio_ena > 0) { 582 if (phy->gpio_ena > 0) {
592 r = devm_gpio_request(&client->dev, 583 r = devm_gpio_request_one(&client->dev, phy->gpio_ena,
593 phy->gpio_ena, "clf_enable"); 584 GPIOF_OUT_INIT_HIGH, "clf_enable");
594 if (r) { 585 if (r) {
595 pr_err("%s : ena gpio_request failed\n", __FILE__); 586 pr_err("%s : ena gpio_request failed\n", __FILE__);
596 return -ENODEV; 587 return -ENODEV;
597 } 588 }
598 r = gpio_direction_output(phy->gpio_ena, 1);
599
600 if (r) {
601 pr_err("%s : ena gpio_direction_output failed\n",
602 __FILE__);
603 return -ENODEV;
604 }
605 } 589 }
606 590
607 /* IRQ */ 591 /* IRQ */