NFC: trf7970a: Don't de-assert EN2 unless it was asserted
authorMark Greer <mgreer@animalcreek.com>
Tue, 25 Apr 2017 22:43:49 +0000 (15:43 -0700)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 18 Jun 2017 21:57:57 +0000 (23:57 +0200)
When the trf7970a part has the bug related to 'en2-rf-quirk',
the GPIO connected to the EN2 pin will not be asserted by the
driver when powering up so it shouldn't be de-asserted when
powering down.

Signed-off-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/trf7970a.c

index 2d1c8ca6e67907002a05d284316925b951d178de..1a87525a88cd86f697ee8d0e324d179fba39be46 100644 (file)
@@ -1940,8 +1940,10 @@ static int trf7970a_power_down(struct trf7970a *trf)
        }
 
        gpio_set_value(trf->en_gpio, 0);
-       if (gpio_is_valid(trf->en2_gpio))
-               gpio_set_value(trf->en2_gpio, 0);
+
+       if (!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW))
+               if (gpio_is_valid(trf->en2_gpio))
+                       gpio_set_value(trf->en2_gpio, 0);
 
        ret = regulator_disable(trf->regulator);
        if (ret)