mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 17:43:59 +00:00
NFC: Make EN2 pin optional in the TRF7970A driver
Make the EN2 pin optional. This is useful for boards, which have this pin fix wired, for example to ground. Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Guan Ben <ben.guan@cn.bosch.com> Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com> Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
96bd0b5e55
commit
ce69b95ca4
@ -5,8 +5,8 @@ Required properties:
|
|||||||
- spi-max-frequency: Maximum SPI frequency (<= 2000000).
|
- spi-max-frequency: Maximum SPI frequency (<= 2000000).
|
||||||
- interrupt-parent: phandle of parent interrupt handler.
|
- interrupt-parent: phandle of parent interrupt handler.
|
||||||
- interrupts: A single interrupt specifier.
|
- interrupts: A single interrupt specifier.
|
||||||
- ti,enable-gpios: Two GPIO entries used for 'EN' and 'EN2' pins on the
|
- ti,enable-gpios: One or two GPIO entries used for 'EN' and 'EN2' pins on the
|
||||||
TRF7970A.
|
TRF7970A. EN2 is optional.
|
||||||
- vin-supply: Regulator for supply voltage to VIN pin
|
- vin-supply: Regulator for supply voltage to VIN pin
|
||||||
|
|
||||||
Optional SoC Specific Properties:
|
Optional SoC Specific Properties:
|
||||||
|
@ -1885,8 +1885,10 @@ static int trf7970a_power_up(struct trf7970a *trf)
|
|||||||
usleep_range(5000, 6000);
|
usleep_range(5000, 6000);
|
||||||
|
|
||||||
if (!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW)) {
|
if (!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW)) {
|
||||||
gpio_set_value(trf->en2_gpio, 1);
|
if (gpio_is_valid(trf->en2_gpio)) {
|
||||||
usleep_range(1000, 2000);
|
gpio_set_value(trf->en2_gpio, 1);
|
||||||
|
usleep_range(1000, 2000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gpio_set_value(trf->en_gpio, 1);
|
gpio_set_value(trf->en_gpio, 1);
|
||||||
@ -1914,7 +1916,8 @@ static int trf7970a_power_down(struct trf7970a *trf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gpio_set_value(trf->en_gpio, 0);
|
gpio_set_value(trf->en_gpio, 0);
|
||||||
gpio_set_value(trf->en2_gpio, 0);
|
if (gpio_is_valid(trf->en2_gpio))
|
||||||
|
gpio_set_value(trf->en2_gpio, 0);
|
||||||
|
|
||||||
ret = regulator_disable(trf->regulator);
|
ret = regulator_disable(trf->regulator);
|
||||||
if (ret)
|
if (ret)
|
||||||
@ -2032,15 +2035,14 @@ static int trf7970a_probe(struct spi_device *spi)
|
|||||||
|
|
||||||
trf->en2_gpio = of_get_named_gpio(np, "ti,enable-gpios", 1);
|
trf->en2_gpio = of_get_named_gpio(np, "ti,enable-gpios", 1);
|
||||||
if (!gpio_is_valid(trf->en2_gpio)) {
|
if (!gpio_is_valid(trf->en2_gpio)) {
|
||||||
dev_err(trf->dev, "No EN2 GPIO property\n");
|
dev_info(trf->dev, "No EN2 GPIO property\n");
|
||||||
return trf->en2_gpio;
|
} else {
|
||||||
}
|
ret = devm_gpio_request_one(trf->dev, trf->en2_gpio,
|
||||||
|
GPIOF_DIR_OUT | GPIOF_INIT_LOW, "trf7970a EN2");
|
||||||
ret = devm_gpio_request_one(trf->dev, trf->en2_gpio,
|
if (ret) {
|
||||||
GPIOF_DIR_OUT | GPIOF_INIT_LOW, "trf7970a EN2");
|
dev_err(trf->dev, "Can't request EN2 GPIO: %d\n", ret);
|
||||||
if (ret) {
|
return ret;
|
||||||
dev_err(trf->dev, "Can't request EN2 GPIO: %d\n", ret);
|
}
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (of_property_read_bool(np, "en2-rf-quirk"))
|
if (of_property_read_bool(np, "en2-rf-quirk"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user