* [PATCH 1/7] NFC: trf7970a: Don't de-assert EN2 unless it was asserted
From: Mark Greer @ 2016-12-20 18:06 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220180608.29997-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
When the trf7970a part has the 'en2-rf-quirk', EN2 will not be
asserted by the driver so there is no point in de-asserting it
when powering off.
Signed-off-by: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
drivers/nfc/trf7970a.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 26c9dbbccb0c..92f3cf3e012a 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -1914,7 +1914,9 @@ static int trf7970a_power_down(struct trf7970a *trf)
}
gpio_set_value(trf->en_gpio, 0);
- gpio_set_value(trf->en2_gpio, 0);
+
+ if (!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW))
+ gpio_set_value(trf->en2_gpio, 0);
ret = regulator_disable(trf->regulator);
if (ret)
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 2/7] NFC: trf7970a: Don't manage EN2 when not specified in DT
From: Mark Greer @ 2016-12-20 18:06 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220180608.29997-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
Currently, the trf7970a driver assumes that there is a GPIO
connected to the EN2 pin of the trf7970a part; however, that
may not always be the case. Some boards may tie EN2 low and
not connect it to a GPIO. Support these configurations by making
the driver ignore EN2 when the second entry in the 'ti,enable-gpios'
DT property is missing (i.e., the one that specifies the GPIO for
EN2).
Signed-off-by: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
drivers/nfc/trf7970a.c | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 92f3cf3e012a..0c0567adefcb 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -1884,7 +1884,8 @@ static int trf7970a_power_up(struct trf7970a *trf)
usleep_range(5000, 6000);
- if (!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW)) {
+ if (gpio_is_valid(trf->en2_gpio) &&
+ !(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW)) {
gpio_set_value(trf->en2_gpio, 1);
usleep_range(1000, 2000);
}
@@ -1915,7 +1916,8 @@ static int trf7970a_power_down(struct trf7970a *trf)
gpio_set_value(trf->en_gpio, 0);
- if (!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW))
+ if (gpio_is_valid(trf->en2_gpio) &&
+ !(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW))
gpio_set_value(trf->en2_gpio, 0);
ret = regulator_disable(trf->regulator);
@@ -2018,7 +2020,7 @@ static int trf7970a_probe(struct spi_device *spi)
if (of_property_read_bool(np, "irq-status-read-quirk"))
trf->quirks |= TRF7970A_QUIRK_IRQ_STATUS_READ;
- /* There are two enable pins - both must be present */
+ /* There are two enable pins - only EN must be present in DT */
trf->en_gpio = of_get_named_gpio(np, "ti,enable-gpios", 0);
if (!gpio_is_valid(trf->en_gpio)) {
dev_err(trf->dev, "No EN GPIO property\n");
@@ -2033,21 +2035,21 @@ static int trf7970a_probe(struct spi_device *spi)
}
trf->en2_gpio = of_get_named_gpio(np, "ti,enable-gpios", 1);
- if (!gpio_is_valid(trf->en2_gpio)) {
- dev_err(trf->dev, "No EN2 GPIO property\n");
- return trf->en2_gpio;
- }
+ if (gpio_is_valid(trf->en2_gpio)) {
+ ret = devm_gpio_request_one(trf->dev, trf->en2_gpio,
+ GPIOF_DIR_OUT | GPIOF_INIT_LOW,
+ "trf7970a EN2");
+ if (ret) {
+ dev_err(trf->dev, "Can't request EN2 GPIO: %d\n", ret);
+ return ret;
+ }
- ret = devm_gpio_request_one(trf->dev, trf->en2_gpio,
- GPIOF_DIR_OUT | GPIOF_INIT_LOW, "trf7970a EN2");
- if (ret) {
- dev_err(trf->dev, "Can't request EN2 GPIO: %d\n", ret);
- return ret;
+ if (of_property_read_bool(np, "en2-rf-quirk"))
+ trf->quirks |= TRF7970A_QUIRK_EN2_MUST_STAY_LOW;
+ } else {
+ dev_err(trf->dev, "No EN2 GPIO property - ignoring EN2\n");
}
- if (of_property_read_bool(np, "en2-rf-quirk"))
- trf->quirks |= TRF7970A_QUIRK_EN2_MUST_STAY_LOW;
-
ret = devm_request_threaded_irq(trf->dev, spi->irq, NULL,
trf7970a_irq, IRQF_TRIGGER_RISING | IRQF_ONESHOT,
"trf7970a", trf);
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 3/7] NFC: trf7970a: Convert to descriptor based GPIO interface
From: Mark Greer @ 2016-12-20 18:06 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220180608.29997-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
The trf7970a uses the deprecated integer-based GPIO consumer
interface so convert it to use the new descriptor-based GPIO
consumer interface.
Signed-off-by: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
drivers/nfc/Kconfig | 2 +-
drivers/nfc/trf7970a.c | 54 ++++++++++++++++++++------------------------------
2 files changed, 23 insertions(+), 33 deletions(-)
diff --git a/drivers/nfc/Kconfig b/drivers/nfc/Kconfig
index 9d2369269abf..4deacbada74d 100644
--- a/drivers/nfc/Kconfig
+++ b/drivers/nfc/Kconfig
@@ -18,7 +18,7 @@ config NFC_WILINK
config NFC_TRF7970A
tristate "Texas Instruments TRF7970a NFC driver"
- depends on SPI && NFC_DIGITAL
+ depends on SPI && NFC_DIGITAL && GPIOLIB
help
This option enables the NFC driver for Texas Instruments' TRF7970a
device. Such device supports 5 different protocols: ISO14443A,
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 0c0567adefcb..bd3d9a09da0d 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -20,9 +20,8 @@
#include <linux/nfc.h>
#include <linux/skbuff.h>
#include <linux/delay.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/of.h>
-#include <linux/of_gpio.h>
#include <linux/spi/spi.h>
#include <linux/regulator/consumer.h>
@@ -448,8 +447,8 @@ struct trf7970a {
u8 tx_cmd;
bool issue_eof;
bool adjust_resp_len;
- int en2_gpio;
- int en_gpio;
+ struct gpio_desc *en_gpiod;
+ struct gpio_desc *en2_gpiod;
struct mutex lock;
unsigned int timeout;
bool ignore_timeout;
@@ -1884,13 +1883,13 @@ static int trf7970a_power_up(struct trf7970a *trf)
usleep_range(5000, 6000);
- if (gpio_is_valid(trf->en2_gpio) &&
+ if (trf->en2_gpiod &&
!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW)) {
- gpio_set_value(trf->en2_gpio, 1);
+ gpiod_set_value_cansleep(trf->en2_gpiod, 1);
usleep_range(1000, 2000);
}
- gpio_set_value(trf->en_gpio, 1);
+ gpiod_set_value_cansleep(trf->en_gpiod, 1);
usleep_range(20000, 21000);
@@ -1914,11 +1913,11 @@ static int trf7970a_power_down(struct trf7970a *trf)
return -EBUSY;
}
- gpio_set_value(trf->en_gpio, 0);
+ gpiod_set_value_cansleep(trf->en_gpiod, 0);
- if (gpio_is_valid(trf->en2_gpio) &&
+ if (trf->en2_gpiod &&
!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW))
- gpio_set_value(trf->en2_gpio, 0);
+ gpiod_set_value_cansleep(trf->en2_gpiod, 0);
ret = regulator_disable(trf->regulator);
if (ret)
@@ -2021,33 +2020,24 @@ static int trf7970a_probe(struct spi_device *spi)
trf->quirks |= TRF7970A_QUIRK_IRQ_STATUS_READ;
/* There are two enable pins - only EN must be present in DT */
- trf->en_gpio = of_get_named_gpio(np, "ti,enable-gpios", 0);
- if (!gpio_is_valid(trf->en_gpio)) {
+ trf->en_gpiod = devm_gpiod_get_index(trf->dev, "ti,enable", 0,
+ GPIOD_OUT_LOW);
+ if (IS_ERR(trf->en_gpiod)) {
dev_err(trf->dev, "No EN GPIO property\n");
- return trf->en_gpio;
+ return PTR_ERR(trf->en_gpiod);
}
- ret = devm_gpio_request_one(trf->dev, trf->en_gpio,
- GPIOF_DIR_OUT | GPIOF_INIT_LOW, "trf7970a EN");
- if (ret) {
- dev_err(trf->dev, "Can't request EN GPIO: %d\n", ret);
- return ret;
- }
-
- trf->en2_gpio = of_get_named_gpio(np, "ti,enable-gpios", 1);
- if (gpio_is_valid(trf->en2_gpio)) {
- ret = devm_gpio_request_one(trf->dev, trf->en2_gpio,
- GPIOF_DIR_OUT | GPIOF_INIT_LOW,
- "trf7970a EN2");
- if (ret) {
- dev_err(trf->dev, "Can't request EN2 GPIO: %d\n", ret);
- return ret;
- }
-
+ trf->en2_gpiod = devm_gpiod_get_index_optional(trf->dev, "ti,enable", 1,
+ GPIOD_OUT_LOW);
+ if (!trf->en2_gpiod) {
+ dev_err(trf->dev, "No EN2 GPIO property - ignoring EN2\n");
+ } else if (IS_ERR(trf->en2_gpiod)) {
+ dev_err(trf->dev, "Error getting EN2 GPIO property: %ld\n",
+ PTR_ERR(trf->en2_gpiod));
+ return PTR_ERR(trf->en2_gpiod);
+ } else {
if (of_property_read_bool(np, "en2-rf-quirk"))
trf->quirks |= TRF7970A_QUIRK_EN2_MUST_STAY_LOW;
- } else {
- dev_err(trf->dev, "No EN2 GPIO property - ignoring EN2\n");
}
ret = devm_request_threaded_irq(trf->dev, spi->irq, NULL,
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 4/7] NFC: trf7970a: Remove useless comment
From: Mark Greer @ 2016-12-20 18:06 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220180608.29997-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
The last entry in the trf7970a_of_match[] must be an empty entry
to demarcate the end of the table. Currently, there is a comment
indicating this but it is obvious so remove the comment.
Signed-off-by: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
drivers/nfc/trf7970a.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index bd3d9a09da0d..6fd85be49365 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -2211,7 +2211,7 @@ static const struct dev_pm_ops trf7970a_pm_ops = {
static const struct of_device_id trf7970a_of_match[] = {
{ .compatible = "ti,trf7970a", },
- { /* sentinel */ },
+ {},
};
MODULE_DEVICE_TABLE(of, trf7970a_of_match);
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 5/7] NFC: trf7970a: Clean up coding style issues
From: Mark Greer @ 2016-12-20 18:06 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220180608.29997-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
Clean up coding style issues according to scripts/Lindent.
Some scripts/Lindent changes were not made when it appeared
to make the code look less readable or when it made the line
run over 80 characters.
Signed-off-by: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
drivers/nfc/trf7970a.c | 251 +++++++++++++++++++++++++------------------------
1 file changed, 128 insertions(+), 123 deletions(-)
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 6fd85be49365..9c6c45cb3cf4 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -122,7 +122,7 @@
NFC_PROTO_ISO14443_B_MASK | NFC_PROTO_FELICA_MASK | \
NFC_PROTO_ISO15693_MASK | NFC_PROTO_NFC_DEP_MASK)
-#define TRF7970A_AUTOSUSPEND_DELAY 30000 /* 30 seconds */
+#define TRF7970A_AUTOSUSPEND_DELAY 30000 /* 30 seconds */
#define TRF7970A_RX_SKB_ALLOC_SIZE 256
@@ -291,7 +291,7 @@
#define TRF7970A_REG_IO_CTRL_AUTO_REG BIT(7)
/* IRQ Status Register Bits */
-#define TRF7970A_IRQ_STATUS_NORESP BIT(0) /* ISO15693 only */
+#define TRF7970A_IRQ_STATUS_NORESP BIT(0) /* ISO15693 only */
#define TRF7970A_IRQ_STATUS_NFC_COL_ERROR BIT(0)
#define TRF7970A_IRQ_STATUS_COL BIT(1)
#define TRF7970A_IRQ_STATUS_FRAMING_EOF_ERROR BIT(2)
@@ -455,7 +455,6 @@ struct trf7970a {
struct delayed_work timeout_work;
};
-
static int trf7970a_cmd(struct trf7970a *trf, u8 opcode)
{
u8 cmd = TRF7970A_CMD_BIT_CTRL | TRF7970A_CMD_BIT_OPCODE(opcode);
@@ -466,7 +465,7 @@ static int trf7970a_cmd(struct trf7970a *trf, u8 opcode)
ret = spi_write(trf->spi, &cmd, 1);
if (ret)
dev_err(trf->dev, "%s - cmd: 0x%x, ret: %d\n", __func__, cmd,
- ret);
+ ret);
return ret;
}
@@ -478,14 +477,15 @@ static int trf7970a_read(struct trf7970a *trf, u8 reg, u8 *val)
ret = spi_write_then_read(trf->spi, &addr, 1, val, 1);
if (ret)
dev_err(trf->dev, "%s - addr: 0x%x, ret: %d\n", __func__, addr,
- ret);
+ ret);
dev_dbg(trf->dev, "read(0x%x): 0x%x\n", addr, *val);
return ret;
}
-static int trf7970a_read_cont(struct trf7970a *trf, u8 reg, u8 *buf, size_t len)
+static int trf7970a_read_cont(struct trf7970a *trf, u8 reg, u8 *buf,
+ size_t len)
{
u8 addr = reg | TRF7970A_CMD_BIT_RW | TRF7970A_CMD_BIT_CONTINUOUS;
struct spi_transfer t[2];
@@ -509,7 +509,7 @@ static int trf7970a_read_cont(struct trf7970a *trf, u8 reg, u8 *buf, size_t len)
ret = spi_sync(trf->spi, &m);
if (ret)
dev_err(trf->dev, "%s - addr: 0x%x, ret: %d\n", __func__, addr,
- ret);
+ ret);
return ret;
}
@@ -523,7 +523,7 @@ static int trf7970a_write(struct trf7970a *trf, u8 reg, u8 val)
ret = spi_write(trf->spi, buf, 2);
if (ret)
dev_err(trf->dev, "%s - write: 0x%x 0x%x, ret: %d\n", __func__,
- buf[0], buf[1], ret);
+ buf[0], buf[1], ret);
return ret;
}
@@ -545,7 +545,7 @@ static int trf7970a_read_irqstatus(struct trf7970a *trf, u8 *status)
if (ret)
dev_err(trf->dev, "%s - irqstatus: Status read failed: %d\n",
- __func__, ret);
+ __func__, ret);
else
*status = buf[0];
@@ -559,12 +559,12 @@ static int trf7970a_read_target_proto(struct trf7970a *trf, u8 *target_proto)
u8 addr;
addr = TRF79070A_NFC_TARGET_PROTOCOL | TRF7970A_CMD_BIT_RW |
- TRF7970A_CMD_BIT_CONTINUOUS;
+ TRF7970A_CMD_BIT_CONTINUOUS;
ret = spi_write_then_read(trf->spi, &addr, 1, buf, 2);
if (ret)
dev_err(trf->dev, "%s - target_proto: Read failed: %d\n",
- __func__, ret);
+ __func__, ret);
else
*target_proto = buf[0];
@@ -595,7 +595,7 @@ static int trf7970a_mode_detect(struct trf7970a *trf, u8 *rf_tech)
break;
default:
dev_dbg(trf->dev, "%s - mode_detect: target_proto: 0x%x\n",
- __func__, target_proto);
+ __func__, target_proto);
return -EIO;
}
@@ -611,8 +611,8 @@ static void trf7970a_send_upstream(struct trf7970a *trf)
if (trf->rx_skb && !IS_ERR(trf->rx_skb) && !trf->aborting)
print_hex_dump_debug("trf7970a rx data: ", DUMP_PREFIX_NONE,
- 16, 1, trf->rx_skb->data, trf->rx_skb->len,
- false);
+ 16, 1, trf->rx_skb->data,
+ trf->rx_skb->len, false);
trf->state = TRF7970A_ST_IDLE;
@@ -652,15 +652,16 @@ static void trf7970a_send_err_upstream(struct trf7970a *trf, int errno)
}
static int trf7970a_transmit(struct trf7970a *trf, struct sk_buff *skb,
- unsigned int len, u8 *prefix, unsigned int prefix_len)
+ unsigned int len, u8 *prefix,
+ unsigned int prefix_len)
{
struct spi_transfer t[2];
struct spi_message m;
unsigned int timeout;
int ret;
- print_hex_dump_debug("trf7970a tx data: ", DUMP_PREFIX_NONE,
- 16, 1, skb->data, len, false);
+ print_hex_dump_debug("trf7970a tx data: ", DUMP_PREFIX_NONE, 16, 1,
+ skb->data, len, false);
spi_message_init(&m);
@@ -677,7 +678,7 @@ static int trf7970a_transmit(struct trf7970a *trf, struct sk_buff *skb,
ret = spi_sync(trf->spi, &m);
if (ret) {
dev_err(trf->dev, "%s - Can't send tx data: %d\n", __func__,
- ret);
+ ret);
return ret;
}
@@ -701,7 +702,7 @@ static int trf7970a_transmit(struct trf7970a *trf, struct sk_buff *skb,
}
dev_dbg(trf->dev, "Setting timeout for %d ms, state: %d\n", timeout,
- trf->state);
+ trf->state);
schedule_delayed_work(&trf->timeout_work, msecs_to_jiffies(timeout));
@@ -769,9 +770,9 @@ static void trf7970a_drain_fifo(struct trf7970a *trf, u8 status)
if (fifo_bytes > skb_tailroom(skb)) {
skb = skb_copy_expand(skb, skb_headroom(skb),
- max_t(int, fifo_bytes,
- TRF7970A_RX_SKB_ALLOC_SIZE),
- GFP_KERNEL);
+ max_t(int, fifo_bytes,
+ TRF7970A_RX_SKB_ALLOC_SIZE),
+ GFP_KERNEL);
if (!skb) {
trf7970a_send_err_upstream(trf, -ENOMEM);
return;
@@ -782,7 +783,7 @@ static void trf7970a_drain_fifo(struct trf7970a *trf, u8 status)
}
ret = trf7970a_read_cont(trf, TRF7970A_FIFO_IO_REGISTER,
- skb_put(skb, fifo_bytes), fifo_bytes);
+ skb_put(skb, fifo_bytes), fifo_bytes);
if (ret) {
trf7970a_send_err_upstream(trf, ret);
return;
@@ -790,8 +791,7 @@ static void trf7970a_drain_fifo(struct trf7970a *trf, u8 status)
/* If received Type 2 ACK/NACK, shift right 4 bits and pass up */
if ((trf->framing == NFC_DIGITAL_FRAMING_NFCA_T2T) && (skb->len == 1) &&
- (trf->special_fcn_reg1 ==
- TRF7970A_SPECIAL_FCN_REG1_4_BIT_RX)) {
+ (trf->special_fcn_reg1 == TRF7970A_SPECIAL_FCN_REG1_4_BIT_RX)) {
skb->data[0] >>= 4;
status = TRF7970A_IRQ_STATUS_SRX;
} else {
@@ -814,13 +814,13 @@ static void trf7970a_drain_fifo(struct trf7970a *trf, u8 status)
}
no_rx_data:
- if (status == TRF7970A_IRQ_STATUS_SRX) { /* Receive complete */
+ if (status == TRF7970A_IRQ_STATUS_SRX) { /* Receive complete */
trf7970a_send_upstream(trf);
return;
}
dev_dbg(trf->dev, "Setting timeout for %d ms\n",
- TRF7970A_WAIT_FOR_RX_DATA_TIMEOUT);
+ TRF7970A_WAIT_FOR_RX_DATA_TIMEOUT);
schedule_delayed_work(&trf->timeout_work,
msecs_to_jiffies(TRF7970A_WAIT_FOR_RX_DATA_TIMEOUT));
@@ -846,7 +846,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
}
dev_dbg(trf->dev, "IRQ - state: %d, status: 0x%x\n", trf->state,
- status);
+ status);
if (!status) {
mutex_unlock(&trf->lock);
@@ -871,7 +871,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
case TRF7970A_ST_WAIT_FOR_TX_FIFO:
if (status & TRF7970A_IRQ_STATUS_TX) {
trf->ignore_timeout =
- !cancel_delayed_work(&trf->timeout_work);
+ !cancel_delayed_work(&trf->timeout_work);
trf7970a_fill_fifo(trf);
} else {
trf7970a_send_err_upstream(trf, -EIO);
@@ -881,11 +881,11 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
case TRF7970A_ST_WAIT_FOR_RX_DATA_CONT:
if (status & TRF7970A_IRQ_STATUS_SRX) {
trf->ignore_timeout =
- !cancel_delayed_work(&trf->timeout_work);
+ !cancel_delayed_work(&trf->timeout_work);
trf7970a_drain_fifo(trf, status);
} else if (status & TRF7970A_IRQ_STATUS_FIFO) {
ret = trf7970a_read(trf, TRF7970A_FIFO_STATUS,
- &fifo_bytes);
+ &fifo_bytes);
fifo_bytes &= ~TRF7970A_FIFO_STATUS_OVERFLOW;
@@ -894,14 +894,14 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
else if (!fifo_bytes)
trf7970a_cmd(trf, TRF7970A_CMD_FIFO_RESET);
} else if ((status == TRF7970A_IRQ_STATUS_TX) ||
- (!trf->is_initiator &&
- (status == (TRF7970A_IRQ_STATUS_TX |
- TRF7970A_IRQ_STATUS_NFC_RF)))) {
+ (!trf->is_initiator &&
+ (status == (TRF7970A_IRQ_STATUS_TX |
+ TRF7970A_IRQ_STATUS_NFC_RF)))) {
trf7970a_cmd(trf, TRF7970A_CMD_FIFO_RESET);
if (!trf->timeout) {
- trf->ignore_timeout = !cancel_delayed_work(
- &trf->timeout_work);
+ trf->ignore_timeout =
+ !cancel_delayed_work(&trf->timeout_work);
trf->rx_skb = ERR_PTR(0);
trf7970a_send_upstream(trf);
break;
@@ -925,13 +925,13 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
break;
case NFC_DIGITAL_FRAMING_NFCA_ANTICOL_COMPLETE:
ret = trf7970a_write(trf,
- TRF7970A_SPECIAL_FCN_REG1,
- TRF7970A_SPECIAL_FCN_REG1_14_ANTICOLL);
+ TRF7970A_SPECIAL_FCN_REG1,
+ TRF7970A_SPECIAL_FCN_REG1_14_ANTICOLL);
if (ret)
goto err_unlock_exit;
trf->special_fcn_reg1 =
- TRF7970A_SPECIAL_FCN_REG1_14_ANTICOLL;
+ TRF7970A_SPECIAL_FCN_REG1_14_ANTICOLL;
break;
default:
break;
@@ -939,7 +939,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
if (iso_ctrl != trf->iso_ctrl) {
ret = trf7970a_write(trf, TRF7970A_ISO_CTRL,
- iso_ctrl);
+ iso_ctrl);
if (ret)
goto err_unlock_exit;
@@ -956,7 +956,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
case TRF7970A_ST_LISTENING:
if (status & TRF7970A_IRQ_STATUS_SRX) {
trf->ignore_timeout =
- !cancel_delayed_work(&trf->timeout_work);
+ !cancel_delayed_work(&trf->timeout_work);
trf7970a_drain_fifo(trf, status);
} else if (!(status & TRF7970A_IRQ_STATUS_NFC_RF)) {
trf7970a_send_err_upstream(trf, -EIO);
@@ -965,7 +965,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
case TRF7970A_ST_LISTENING_MD:
if (status & TRF7970A_IRQ_STATUS_SRX) {
trf->ignore_timeout =
- !cancel_delayed_work(&trf->timeout_work);
+ !cancel_delayed_work(&trf->timeout_work);
ret = trf7970a_mode_detect(trf, &trf->md_rf_tech);
if (ret) {
@@ -980,7 +980,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
break;
default:
dev_err(trf->dev, "%s - Driver in invalid state: %d\n",
- __func__, trf->state);
+ __func__, trf->state);
}
err_unlock_exit:
@@ -1005,19 +1005,19 @@ static void trf7970a_issue_eof(struct trf7970a *trf)
trf->state = TRF7970A_ST_WAIT_FOR_RX_DATA;
dev_dbg(trf->dev, "Setting timeout for %d ms, state: %d\n",
- trf->timeout, trf->state);
+ trf->timeout, trf->state);
schedule_delayed_work(&trf->timeout_work,
- msecs_to_jiffies(trf->timeout));
+ msecs_to_jiffies(trf->timeout));
}
static void trf7970a_timeout_work_handler(struct work_struct *work)
{
struct trf7970a *trf = container_of(work, struct trf7970a,
- timeout_work.work);
+ timeout_work.work);
dev_dbg(trf->dev, "Timeout - state: %d, ignore_timeout: %d\n",
- trf->state, trf->ignore_timeout);
+ trf->state, trf->ignore_timeout);
mutex_lock(&trf->lock);
@@ -1062,8 +1062,8 @@ static int trf7970a_init(struct trf7970a *trf)
trf->modulator_sys_clk_ctrl = 0;
ret = trf7970a_write(trf, TRF7970A_ADJUTABLE_FIFO_IRQ_LEVELS,
- TRF7970A_ADJUTABLE_FIFO_IRQ_LEVELS_WLH_96 |
- TRF7970A_ADJUTABLE_FIFO_IRQ_LEVELS_WLL_32);
+ TRF7970A_ADJUTABLE_FIFO_IRQ_LEVELS_WLH_96 |
+ TRF7970A_ADJUTABLE_FIFO_IRQ_LEVELS_WLL_32);
if (ret)
goto err_out;
@@ -1084,7 +1084,7 @@ static int trf7970a_init(struct trf7970a *trf)
static void trf7970a_switch_rf_off(struct trf7970a *trf)
{
if ((trf->state == TRF7970A_ST_PWR_OFF) ||
- (trf->state == TRF7970A_ST_RF_OFF))
+ (trf->state == TRF7970A_ST_RF_OFF))
return;
dev_dbg(trf->dev, "Switching rf off\n");
@@ -1108,9 +1108,9 @@ static int trf7970a_switch_rf_on(struct trf7970a *trf)
pm_runtime_get_sync(trf->dev);
- if (trf->state != TRF7970A_ST_RF_OFF) { /* Power on, RF off */
+ if (trf->state != TRF7970A_ST_RF_OFF) { /* Power on, RF off */
dev_err(trf->dev, "%s - Incorrect state: %d\n", __func__,
- trf->state);
+ trf->state);
return -EINVAL;
}
@@ -1145,7 +1145,7 @@ static int trf7970a_switch_rf(struct nfc_digital_dev *ddev, bool on)
break;
default:
dev_err(trf->dev, "%s - Invalid request: %d %d\n",
- __func__, trf->state, on);
+ __func__, trf->state, on);
trf7970a_switch_rf_off(trf);
ret = -EINVAL;
}
@@ -1156,7 +1156,7 @@ static int trf7970a_switch_rf(struct nfc_digital_dev *ddev, bool on)
break;
default:
dev_err(trf->dev, "%s - Invalid request: %d %d\n",
- __func__, trf->state, on);
+ __func__, trf->state, on);
ret = -EINVAL;
/* FALLTHROUGH */
case TRF7970A_ST_IDLE:
@@ -1227,7 +1227,8 @@ static int trf7970a_is_rf_field(struct trf7970a *trf, bool *is_rf_field)
u8 rssi;
ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL,
- trf->chip_status_ctrl | TRF7970A_CHIP_STATUS_REC_ON);
+ trf->chip_status_ctrl |
+ TRF7970A_CHIP_STATUS_REC_ON);
if (ret)
return ret;
@@ -1242,7 +1243,7 @@ static int trf7970a_is_rf_field(struct trf7970a *trf, bool *is_rf_field)
return ret;
ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL,
- trf->chip_status_ctrl);
+ trf->chip_status_ctrl);
if (ret)
return ret;
@@ -1309,15 +1310,15 @@ static int trf7970a_in_config_framing(struct trf7970a *trf, int framing)
trf->iso_ctrl = iso_ctrl;
ret = trf7970a_write(trf, TRF7970A_MODULATOR_SYS_CLK_CTRL,
- trf->modulator_sys_clk_ctrl);
+ trf->modulator_sys_clk_ctrl);
if (ret)
return ret;
}
if (!(trf->chip_status_ctrl & TRF7970A_CHIP_STATUS_RF_ON)) {
ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL,
- trf->chip_status_ctrl |
- TRF7970A_CHIP_STATUS_RF_ON);
+ trf->chip_status_ctrl |
+ TRF7970A_CHIP_STATUS_RF_ON);
if (ret)
return ret;
@@ -1330,7 +1331,7 @@ static int trf7970a_in_config_framing(struct trf7970a *trf, int framing)
}
static int trf7970a_in_configure_hw(struct nfc_digital_dev *ddev, int type,
- int param)
+ int param)
{
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
int ret;
@@ -1342,7 +1343,7 @@ static int trf7970a_in_configure_hw(struct nfc_digital_dev *ddev, int type,
trf->is_initiator = true;
if ((trf->state == TRF7970A_ST_PWR_OFF) ||
- (trf->state == TRF7970A_ST_RF_OFF)) {
+ (trf->state == TRF7970A_ST_RF_OFF)) {
ret = trf7970a_switch_rf_on(trf);
if (ret)
goto err_unlock;
@@ -1400,7 +1401,7 @@ static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb)
* has to send an EOF in order to get a response.
*/
if ((trf->technology == NFC_DIGITAL_RF_TECH_106A) &&
- (trf->framing == NFC_DIGITAL_FRAMING_NFCA_T2T)) {
+ (trf->framing == NFC_DIGITAL_FRAMING_NFCA_T2T)) {
if (req[0] == NFC_T2T_CMD_READ)
special_fcn_reg1 = 0;
else
@@ -1408,7 +1409,7 @@ static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb)
if (special_fcn_reg1 != trf->special_fcn_reg1) {
ret = trf7970a_write(trf, TRF7970A_SPECIAL_FCN_REG1,
- special_fcn_reg1);
+ special_fcn_reg1);
if (ret)
return ret;
@@ -1428,7 +1429,7 @@ static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb)
iso_ctrl |= TRF7970A_ISO_CTRL_15693_SGL_1OF4_2648;
break;
case (ISO15693_REQ_FLAG_SUB_CARRIER |
- ISO15693_REQ_FLAG_DATA_RATE):
+ ISO15693_REQ_FLAG_DATA_RATE):
iso_ctrl |= TRF7970A_ISO_CTRL_15693_DBL_1OF4_2669;
break;
}
@@ -1443,10 +1444,10 @@ static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb)
if (trf->framing == NFC_DIGITAL_FRAMING_ISO15693_T5T) {
if (trf7970a_is_iso15693_write_or_lock(req[1]) &&
- (req[0] & ISO15693_REQ_FLAG_OPTION))
+ (req[0] & ISO15693_REQ_FLAG_OPTION))
trf->issue_eof = true;
else if ((trf->quirks &
- TRF7970A_QUIRK_T5T_RMB_EXTRA_BYTE) &&
+ TRF7970A_QUIRK_T5T_RMB_EXTRA_BYTE) &&
(req[1] == ISO15693_CMD_READ_MULTIPLE_BLOCK))
trf->adjust_resp_len = true;
}
@@ -1456,8 +1457,8 @@ static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb)
}
static int trf7970a_send_cmd(struct nfc_digital_dev *ddev,
- struct sk_buff *skb, u16 timeout,
- nfc_digital_cmd_complete_t cb, void *arg)
+ struct sk_buff *skb, u16 timeout,
+ nfc_digital_cmd_complete_t cb, void *arg)
{
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
u8 prefix[5];
@@ -1466,7 +1467,7 @@ static int trf7970a_send_cmd(struct nfc_digital_dev *ddev,
u8 status;
dev_dbg(trf->dev, "New request - state: %d, timeout: %d ms, len: %d\n",
- trf->state, timeout, skb->len);
+ trf->state, timeout, skb->len);
if (skb->len > TRF7970A_TX_MAX)
return -EINVAL;
@@ -1474,9 +1475,9 @@ static int trf7970a_send_cmd(struct nfc_digital_dev *ddev,
mutex_lock(&trf->lock);
if ((trf->state != TRF7970A_ST_IDLE) &&
- (trf->state != TRF7970A_ST_IDLE_RX_BLOCKED)) {
+ (trf->state != TRF7970A_ST_IDLE_RX_BLOCKED)) {
dev_err(trf->dev, "%s - Bogus state: %d\n", __func__,
- trf->state);
+ trf->state);
ret = -EIO;
goto out_err;
}
@@ -1490,7 +1491,7 @@ static int trf7970a_send_cmd(struct nfc_digital_dev *ddev,
if (timeout) {
trf->rx_skb = nfc_alloc_recv_skb(TRF7970A_RX_SKB_ALLOC_SIZE,
- GFP_KERNEL);
+ GFP_KERNEL);
if (!trf->rx_skb) {
dev_dbg(trf->dev, "Can't alloc rx_skb\n");
ret = -ENOMEM;
@@ -1527,14 +1528,14 @@ static int trf7970a_send_cmd(struct nfc_digital_dev *ddev,
* That totals 5 bytes.
*/
prefix[0] = TRF7970A_CMD_BIT_CTRL |
- TRF7970A_CMD_BIT_OPCODE(TRF7970A_CMD_FIFO_RESET);
+ TRF7970A_CMD_BIT_OPCODE(TRF7970A_CMD_FIFO_RESET);
prefix[1] = TRF7970A_CMD_BIT_CTRL |
- TRF7970A_CMD_BIT_OPCODE(trf->tx_cmd);
+ TRF7970A_CMD_BIT_OPCODE(trf->tx_cmd);
prefix[2] = TRF7970A_CMD_BIT_CONTINUOUS | TRF7970A_TX_LENGTH_BYTE1;
if (trf->framing == NFC_DIGITAL_FRAMING_NFCA_SHORT) {
prefix[3] = 0x00;
- prefix[4] = 0x0f; /* 7 bits */
+ prefix[4] = 0x0f; /* 7 bits */
} else {
prefix[3] = (len & 0xf00) >> 4;
prefix[3] |= ((len & 0xf0) >> 4);
@@ -1568,18 +1569,18 @@ static int trf7970a_tg_config_rf_tech(struct trf7970a *trf, int tech)
switch (tech) {
case NFC_DIGITAL_RF_TECH_106A:
trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_NFC_NFC_CE_MODE |
- TRF7970A_ISO_CTRL_NFC_CE |
- TRF7970A_ISO_CTRL_NFC_CE_14443A;
+ TRF7970A_ISO_CTRL_NFC_CE |
+ TRF7970A_ISO_CTRL_NFC_CE_14443A;
trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_OOK;
break;
case NFC_DIGITAL_RF_TECH_212F:
trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_NFC_NFC_CE_MODE |
- TRF7970A_ISO_CTRL_NFC_NFCF_212;
+ TRF7970A_ISO_CTRL_NFC_NFCF_212;
trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_ASK10;
break;
case NFC_DIGITAL_RF_TECH_424F:
trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_NFC_NFC_CE_MODE |
- TRF7970A_ISO_CTRL_NFC_NFCF_424;
+ TRF7970A_ISO_CTRL_NFC_NFCF_424;
trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_ASK10;
break;
default:
@@ -1597,9 +1598,9 @@ static int trf7970a_tg_config_rf_tech(struct trf7970a *trf, int tech)
* here.
*/
if ((trf->framing == NFC_DIGITAL_FRAMING_NFC_DEP_ACTIVATED) &&
- (trf->iso_ctrl_tech != trf->iso_ctrl)) {
+ (trf->iso_ctrl_tech != trf->iso_ctrl)) {
ret = trf7970a_write(trf, TRF7970A_ISO_CTRL,
- trf->iso_ctrl_tech);
+ trf->iso_ctrl_tech);
trf->iso_ctrl = trf->iso_ctrl_tech;
}
@@ -1654,15 +1655,15 @@ static int trf7970a_tg_config_framing(struct trf7970a *trf, int framing)
trf->iso_ctrl = iso_ctrl;
ret = trf7970a_write(trf, TRF7970A_MODULATOR_SYS_CLK_CTRL,
- trf->modulator_sys_clk_ctrl);
+ trf->modulator_sys_clk_ctrl);
if (ret)
return ret;
}
if (!(trf->chip_status_ctrl & TRF7970A_CHIP_STATUS_RF_ON)) {
ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL,
- trf->chip_status_ctrl |
- TRF7970A_CHIP_STATUS_RF_ON);
+ trf->chip_status_ctrl |
+ TRF7970A_CHIP_STATUS_RF_ON);
if (ret)
return ret;
@@ -1673,7 +1674,7 @@ static int trf7970a_tg_config_framing(struct trf7970a *trf, int framing)
}
static int trf7970a_tg_configure_hw(struct nfc_digital_dev *ddev, int type,
- int param)
+ int param)
{
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
int ret;
@@ -1685,7 +1686,7 @@ static int trf7970a_tg_configure_hw(struct nfc_digital_dev *ddev, int type,
trf->is_initiator = false;
if ((trf->state == TRF7970A_ST_PWR_OFF) ||
- (trf->state == TRF7970A_ST_RF_OFF)) {
+ (trf->state == TRF7970A_ST_RF_OFF)) {
ret = trf7970a_switch_rf_on(trf);
if (ret)
goto err_unlock;
@@ -1709,7 +1710,8 @@ static int trf7970a_tg_configure_hw(struct nfc_digital_dev *ddev, int type,
}
static int _trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
- nfc_digital_cmd_complete_t cb, void *arg, bool mode_detect)
+ nfc_digital_cmd_complete_t cb, void *arg,
+ bool mode_detect)
{
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
int ret;
@@ -1717,9 +1719,9 @@ static int _trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
mutex_lock(&trf->lock);
if ((trf->state != TRF7970A_ST_IDLE) &&
- (trf->state != TRF7970A_ST_IDLE_RX_BLOCKED)) {
+ (trf->state != TRF7970A_ST_IDLE_RX_BLOCKED)) {
dev_err(trf->dev, "%s - Bogus state: %d\n", __func__,
- trf->state);
+ trf->state);
ret = -EIO;
goto out_err;
}
@@ -1732,7 +1734,7 @@ static int _trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
}
trf->rx_skb = nfc_alloc_recv_skb(TRF7970A_RX_SKB_ALLOC_SIZE,
- GFP_KERNEL);
+ GFP_KERNEL);
if (!trf->rx_skb) {
dev_dbg(trf->dev, "Can't alloc rx_skb\n");
ret = -ENOMEM;
@@ -1740,25 +1742,25 @@ static int _trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
}
ret = trf7970a_write(trf, TRF7970A_RX_SPECIAL_SETTINGS,
- TRF7970A_RX_SPECIAL_SETTINGS_HBT |
- TRF7970A_RX_SPECIAL_SETTINGS_M848 |
- TRF7970A_RX_SPECIAL_SETTINGS_C424 |
- TRF7970A_RX_SPECIAL_SETTINGS_C212);
+ TRF7970A_RX_SPECIAL_SETTINGS_HBT |
+ TRF7970A_RX_SPECIAL_SETTINGS_M848 |
+ TRF7970A_RX_SPECIAL_SETTINGS_C424 |
+ TRF7970A_RX_SPECIAL_SETTINGS_C212);
if (ret)
goto out_err;
ret = trf7970a_write(trf, TRF7970A_REG_IO_CTRL,
- TRF7970A_REG_IO_CTRL_VRS(0x1));
+ TRF7970A_REG_IO_CTRL_VRS(0x1));
if (ret)
goto out_err;
ret = trf7970a_write(trf, TRF7970A_NFC_LOW_FIELD_LEVEL,
- TRF7970A_NFC_LOW_FIELD_LEVEL_RFDET(0x3));
+ TRF7970A_NFC_LOW_FIELD_LEVEL_RFDET(0x3));
if (ret)
goto out_err;
ret = trf7970a_write(trf, TRF7970A_NFC_TARGET_LEVEL,
- TRF7970A_NFC_TARGET_LEVEL_RFDET(0x7));
+ TRF7970A_NFC_TARGET_LEVEL_RFDET(0x7));
if (ret)
goto out_err;
@@ -1783,32 +1785,32 @@ static int _trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
}
static int trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
- nfc_digital_cmd_complete_t cb, void *arg)
+ nfc_digital_cmd_complete_t cb, void *arg)
{
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
dev_dbg(trf->dev, "Listen - state: %d, timeout: %d ms\n",
- trf->state, timeout);
+ trf->state, timeout);
return _trf7970a_tg_listen(ddev, timeout, cb, arg, false);
}
-static int trf7970a_tg_listen_md(struct nfc_digital_dev *ddev,
- u16 timeout, nfc_digital_cmd_complete_t cb, void *arg)
+static int trf7970a_tg_listen_md(struct nfc_digital_dev *ddev, u16 timeout,
+ nfc_digital_cmd_complete_t cb, void *arg)
{
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
int ret;
dev_dbg(trf->dev, "Listen MD - state: %d, timeout: %d ms\n",
- trf->state, timeout);
+ trf->state, timeout);
ret = trf7970a_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH,
- NFC_DIGITAL_RF_TECH_106A);
+ NFC_DIGITAL_RF_TECH_106A);
if (ret)
return ret;
ret = trf7970a_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING,
- NFC_DIGITAL_FRAMING_NFCA_NFC_DEP);
+ NFC_DIGITAL_FRAMING_NFCA_NFC_DEP);
if (ret)
return ret;
@@ -1820,7 +1822,7 @@ static int trf7970a_tg_get_rf_tech(struct nfc_digital_dev *ddev, u8 *rf_tech)
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
dev_dbg(trf->dev, "Get RF Tech - state: %d, rf_tech: %d\n",
- trf->state, trf->md_rf_tech);
+ trf->state, trf->md_rf_tech);
*rf_tech = trf->md_rf_tech;
@@ -1909,20 +1911,19 @@ static int trf7970a_power_down(struct trf7970a *trf)
if (trf->state != TRF7970A_ST_RF_OFF) {
dev_dbg(trf->dev, "Can't power down - not RF_OFF state (%d)\n",
- trf->state);
+ trf->state);
return -EBUSY;
}
gpiod_set_value_cansleep(trf->en_gpiod, 0);
- if (trf->en2_gpiod &&
- !(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW))
+ if (trf->en2_gpiod && !(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW))
gpiod_set_value_cansleep(trf->en2_gpiod, 0);
ret = regulator_disable(trf->regulator);
if (ret)
dev_err(trf->dev, "%s - Can't disable VIN: %d\n", __func__,
- ret);
+ ret);
trf->state = TRF7970A_ST_PWR_OFF;
@@ -1980,7 +1981,7 @@ static int trf7970a_get_autosuspend_delay(struct device_node *np)
}
static int trf7970a_get_vin_voltage_override(struct device_node *np,
- u32 *vin_uvolts)
+ u32 *vin_uvolts)
{
return of_property_read_u32(np, "vin-voltage-override", vin_uvolts);
}
@@ -2041,8 +2042,9 @@ static int trf7970a_probe(struct spi_device *spi)
}
ret = devm_request_threaded_irq(trf->dev, spi->irq, NULL,
- trf7970a_irq, IRQF_TRIGGER_RISING | IRQF_ONESHOT,
- "trf7970a", trf);
+ trf7970a_irq,
+ IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+ "trf7970a", trf);
if (ret) {
dev_err(trf->dev, "Can't request IRQ#%d: %d\n", spi->irq, ret);
return ret;
@@ -2072,9 +2074,10 @@ static int trf7970a_probe(struct spi_device *spi)
trf->chip_status_ctrl = TRF7970A_CHIP_STATUS_VRS5_3;
trf->ddev = nfc_digital_allocate_device(&trf7970a_nfc_ops,
- TRF7970A_SUPPORTED_PROTOCOLS,
- NFC_DIGITAL_DRV_CAPS_IN_CRC |
- NFC_DIGITAL_DRV_CAPS_TG_CRC, 0, 0);
+ TRF7970A_SUPPORTED_PROTOCOLS,
+ NFC_DIGITAL_DRV_CAPS_IN_CRC |
+ NFC_DIGITAL_DRV_CAPS_TG_CRC, 0,
+ 0);
if (!trf->ddev) {
dev_err(trf->dev, "Can't allocate NFC digital device\n");
ret = -ENOMEM;
@@ -2097,7 +2100,7 @@ static int trf7970a_probe(struct spi_device *spi)
ret = nfc_digital_register_device(trf->ddev);
if (ret) {
dev_err(trf->dev, "Can't register NFC digital device: %d\n",
- ret);
+ ret);
goto err_shutdown;
}
@@ -2206,19 +2209,21 @@ static int trf7970a_pm_runtime_resume(struct device *dev)
static const struct dev_pm_ops trf7970a_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(trf7970a_suspend, trf7970a_resume)
SET_RUNTIME_PM_OPS(trf7970a_pm_runtime_suspend,
- trf7970a_pm_runtime_resume, NULL)
+ trf7970a_pm_runtime_resume, NULL)
};
static const struct of_device_id trf7970a_of_match[] = {
- { .compatible = "ti,trf7970a", },
+ {.compatible = "ti,trf7970a",},
{},
};
+
MODULE_DEVICE_TABLE(of, trf7970a_of_match);
static const struct spi_device_id trf7970a_id_table[] = {
- { "trf7970a", 0 },
- { }
+ {"trf7970a", 0},
+ {}
};
+
MODULE_DEVICE_TABLE(spi, trf7970a_id_table);
static struct spi_driver trf7970a_spi_driver = {
@@ -2226,9 +2231,9 @@ static struct spi_driver trf7970a_spi_driver = {
.remove = trf7970a_remove,
.id_table = trf7970a_id_table,
.driver = {
- .name = "trf7970a",
- .of_match_table = of_match_ptr(trf7970a_of_match),
- .pm = &trf7970a_pm_ops,
+ .name = "trf7970a",
+ .of_match_table = of_match_ptr(trf7970a_of_match),
+ .pm = &trf7970a_pm_ops,
},
};
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 6/7] NFC: trf7970a: Enable pins are active high not active low
From: Mark Greer @ 2016-12-20 18:06 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220180608.29997-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
The example DTS code for the trf7970a sets the GPIOs for the EN
and EN2 pins to active low when they are really active high so
correct the error.
Signed-off-by: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
Documentation/devicetree/bindings/net/nfc/trf7970a.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/nfc/trf7970a.txt b/Documentation/devicetree/bindings/net/nfc/trf7970a.txt
index 32b35a07abe4..10672649a59e 100644
--- a/Documentation/devicetree/bindings/net/nfc/trf7970a.txt
+++ b/Documentation/devicetree/bindings/net/nfc/trf7970a.txt
@@ -35,8 +35,8 @@ Example (for ARM-based BeagleBone with TRF7970A on SPI1):
spi-max-frequency = <2000000>;
interrupt-parent = <&gpio2>;
interrupts = <14 0>;
- ti,enable-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>,
- <&gpio2 5 GPIO_ACTIVE_LOW>;
+ ti,enable-gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>,
+ <&gpio2 5 GPIO_ACTIVE_HIGH>;
vin-supply = <&ldo3_reg>;
vin-voltage-override = <5000000>;
autosuspend-delay = <30000>;
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 7/7] MAINTAINERS: nfc: trf7970a: Add Mark Greer as maintainer
From: Mark Greer @ 2016-12-20 18:06 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220180608.29997-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
Add Mark Greer as the maintainer of the trf7970a NFC driver.
Signed-off-by: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
MAINTAINERS | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index f6eb97b35e0f..3a9420055bd7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10871,6 +10871,13 @@ F: include/linux/power/bq27xxx_battery.h
F: drivers/power/supply/bq27xxx_battery.c
F: drivers/power/supply/bq27xxx_battery_i2c.c
+TI TRF7970A NFC DRIVER
+M: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
+L: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org (moderated for non-subscribers)
+S: Supported
+F: drivers/nfc/trf7970a.c
+F: Documentation/devicetree/bindings/net/nfc/trf7970a.txt
+
TIMEKEEPING, CLOCKSOURCE CORE, NTP, ALARMTIMER
M: John Stultz <john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
M: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* Re: [PATCH 0/7] NFC: trf7970a: Fixups & convert to desc-based GPIO
From: Mark Greer @ 2016-12-20 18:11 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw
In-Reply-To: <20161220180608.29997-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
Bah. I noticed a couple minor nits. I'll fix and resubmit.
Mark
--
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 1/3] NFC: trf7970a: add device tree option for 27MHz clock
From: Mark Greer @ 2016-12-20 18:11 UTC (permalink / raw)
To: Geoff Lansberry
Cc: linux-wireless, lauro.venancio, aloisio.almeida, sameo, robh+dt,
mark.rutland, netdev, devicetree, linux-kernel, justin
In-Reply-To: <1482250592-4268-1-git-send-email-glansberry@gmail.com>
Hi Geoff.
Please put the version in your subjects when submitting anything but the
initial version of a patch (e.g., [PATCH v2 1/3]).
Which series do you want reviewed?
Mark
--
^ permalink raw reply
* Re: [PATCH 1/3] NFC: trf7970a: add device tree option for 27MHz clock
From: Geoff Lansberry @ 2016-12-20 18:29 UTC (permalink / raw)
To: Mark Greer
Cc: linux-wireless, Lauro Ramos Venancio, Aloisio Almeida Jr,
Samuel Ortiz, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
mark.rutland-5wv7dgnIgG8, netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Justin Bronder
In-Reply-To: <20161220181157.GB30273-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
On Tue, Dec 20, 2016 at 1:11 PM, Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org> wrote:
> Hi Geoff.
>
> Please put the version in your subjects when submitting anything but the
> initial version of a patch (e.g., [PATCH v2 1/3]).
>
> Which series do you want reviewed?
>
> Mark
> --
Sorry about the double posting, I had forgotten to erase the patches I
generated while rebasing and checking, and I'll have to figure out how
to add that v2 line to the automatically generated subject line if I
end up submitting another round.
Please review the three most recent patches, which have the send time
of 17:16.
Best Regards,
Geoff
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH v2 0/7] NFC: trf7970a: Fixups & convert to desc-based GPIO
From: Mark Greer @ 2016-12-20 18:32 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
These trf7970a driver patches do the following things:
- a couple minor fixups
- allow EN2 to not be managed by the driver (e.g., when its tied low by
hardware
- convert the driver to use the descriptor-based GPIO interface
- fix up coding style issues
- change the DTS example to indicate that EN and EN2 are active high GPIOs
- Add Mark Greer as the maintainer of the trf7970a driver
Samuel, these will likely conflict with patches from Geoff Lansberry
so let me know if you want me to rebase on top of his patches.
Based on e93b1cc8a896 (Merge branch 'for_linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs)
v1->v2:
- Commit description fixups only; no functional changes.
Mark Greer (7):
NFC: trf7970a: Don't de-assert EN2 unless it was asserted
NFC: trf7970a: Don't manage EN2 when not specified in DT
NFC: trf7970a: Convert to descriptor based GPIO interface
NFC: trf7970a: Remove useless comment
NFC: trf7970a: Clean up coding style issues
NFC: trf7970a: Enable pins are active high not active low
MAINTAINERS: NFC: trf7970a: Add Mark Greer as maintainer
.../devicetree/bindings/net/nfc/trf7970a.txt | 4 +-
MAINTAINERS | 7 +
drivers/nfc/Kconfig | 2 +-
drivers/nfc/trf7970a.c | 311 ++++++++++-----------
4 files changed, 165 insertions(+), 159 deletions(-)
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH v2 1/7] NFC: trf7970a: Don't de-assert EN2 unless it was asserted
From: Mark Greer @ 2016-12-20 18:32 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220183244.5171-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
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-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
drivers/nfc/trf7970a.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 26c9dbbccb0c..92f3cf3e012a 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -1914,7 +1914,9 @@ static int trf7970a_power_down(struct trf7970a *trf)
}
gpio_set_value(trf->en_gpio, 0);
- gpio_set_value(trf->en2_gpio, 0);
+
+ if (!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW))
+ gpio_set_value(trf->en2_gpio, 0);
ret = regulator_disable(trf->regulator);
if (ret)
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH v2 2/7] NFC: trf7970a: Don't manage EN2 when not specified in DT
From: Mark Greer @ 2016-12-20 18:32 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220183244.5171-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
Currently, the trf7970a driver assumes that there is a GPIO
connected to the EN2 pin of the trf7970a part; however, that
may not always be the case. Some boards may tie EN2 low and
not connect it to a GPIO. Support these configurations by making
the driver ignore EN2 when the second entry in the 'ti,enable-gpios'
DT property is missing (i.e., the one that specifies the GPIO for
EN2).
Signed-off-by: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
drivers/nfc/trf7970a.c | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 92f3cf3e012a..0c0567adefcb 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -1884,7 +1884,8 @@ static int trf7970a_power_up(struct trf7970a *trf)
usleep_range(5000, 6000);
- if (!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW)) {
+ if (gpio_is_valid(trf->en2_gpio) &&
+ !(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW)) {
gpio_set_value(trf->en2_gpio, 1);
usleep_range(1000, 2000);
}
@@ -1915,7 +1916,8 @@ static int trf7970a_power_down(struct trf7970a *trf)
gpio_set_value(trf->en_gpio, 0);
- if (!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW))
+ if (gpio_is_valid(trf->en2_gpio) &&
+ !(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW))
gpio_set_value(trf->en2_gpio, 0);
ret = regulator_disable(trf->regulator);
@@ -2018,7 +2020,7 @@ static int trf7970a_probe(struct spi_device *spi)
if (of_property_read_bool(np, "irq-status-read-quirk"))
trf->quirks |= TRF7970A_QUIRK_IRQ_STATUS_READ;
- /* There are two enable pins - both must be present */
+ /* There are two enable pins - only EN must be present in DT */
trf->en_gpio = of_get_named_gpio(np, "ti,enable-gpios", 0);
if (!gpio_is_valid(trf->en_gpio)) {
dev_err(trf->dev, "No EN GPIO property\n");
@@ -2033,21 +2035,21 @@ static int trf7970a_probe(struct spi_device *spi)
}
trf->en2_gpio = of_get_named_gpio(np, "ti,enable-gpios", 1);
- if (!gpio_is_valid(trf->en2_gpio)) {
- dev_err(trf->dev, "No EN2 GPIO property\n");
- return trf->en2_gpio;
- }
+ if (gpio_is_valid(trf->en2_gpio)) {
+ ret = devm_gpio_request_one(trf->dev, trf->en2_gpio,
+ GPIOF_DIR_OUT | GPIOF_INIT_LOW,
+ "trf7970a EN2");
+ if (ret) {
+ dev_err(trf->dev, "Can't request EN2 GPIO: %d\n", ret);
+ return ret;
+ }
- ret = devm_gpio_request_one(trf->dev, trf->en2_gpio,
- GPIOF_DIR_OUT | GPIOF_INIT_LOW, "trf7970a EN2");
- if (ret) {
- dev_err(trf->dev, "Can't request EN2 GPIO: %d\n", ret);
- return ret;
+ if (of_property_read_bool(np, "en2-rf-quirk"))
+ trf->quirks |= TRF7970A_QUIRK_EN2_MUST_STAY_LOW;
+ } else {
+ dev_err(trf->dev, "No EN2 GPIO property - ignoring EN2\n");
}
- if (of_property_read_bool(np, "en2-rf-quirk"))
- trf->quirks |= TRF7970A_QUIRK_EN2_MUST_STAY_LOW;
-
ret = devm_request_threaded_irq(trf->dev, spi->irq, NULL,
trf7970a_irq, IRQF_TRIGGER_RISING | IRQF_ONESHOT,
"trf7970a", trf);
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH v2 3/7] NFC: trf7970a: Convert to descriptor based GPIO interface
From: Mark Greer @ 2016-12-20 18:32 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220183244.5171-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
The trf7970a driver uses the deprecated integer-based GPIO consumer
interface so convert it to use the new descriptor-based GPIO
consumer interface.
Signed-off-by: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
drivers/nfc/Kconfig | 2 +-
drivers/nfc/trf7970a.c | 54 ++++++++++++++++++++------------------------------
2 files changed, 23 insertions(+), 33 deletions(-)
diff --git a/drivers/nfc/Kconfig b/drivers/nfc/Kconfig
index 9d2369269abf..4deacbada74d 100644
--- a/drivers/nfc/Kconfig
+++ b/drivers/nfc/Kconfig
@@ -18,7 +18,7 @@ config NFC_WILINK
config NFC_TRF7970A
tristate "Texas Instruments TRF7970a NFC driver"
- depends on SPI && NFC_DIGITAL
+ depends on SPI && NFC_DIGITAL && GPIOLIB
help
This option enables the NFC driver for Texas Instruments' TRF7970a
device. Such device supports 5 different protocols: ISO14443A,
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 0c0567adefcb..bd3d9a09da0d 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -20,9 +20,8 @@
#include <linux/nfc.h>
#include <linux/skbuff.h>
#include <linux/delay.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/of.h>
-#include <linux/of_gpio.h>
#include <linux/spi/spi.h>
#include <linux/regulator/consumer.h>
@@ -448,8 +447,8 @@ struct trf7970a {
u8 tx_cmd;
bool issue_eof;
bool adjust_resp_len;
- int en2_gpio;
- int en_gpio;
+ struct gpio_desc *en_gpiod;
+ struct gpio_desc *en2_gpiod;
struct mutex lock;
unsigned int timeout;
bool ignore_timeout;
@@ -1884,13 +1883,13 @@ static int trf7970a_power_up(struct trf7970a *trf)
usleep_range(5000, 6000);
- if (gpio_is_valid(trf->en2_gpio) &&
+ if (trf->en2_gpiod &&
!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW)) {
- gpio_set_value(trf->en2_gpio, 1);
+ gpiod_set_value_cansleep(trf->en2_gpiod, 1);
usleep_range(1000, 2000);
}
- gpio_set_value(trf->en_gpio, 1);
+ gpiod_set_value_cansleep(trf->en_gpiod, 1);
usleep_range(20000, 21000);
@@ -1914,11 +1913,11 @@ static int trf7970a_power_down(struct trf7970a *trf)
return -EBUSY;
}
- gpio_set_value(trf->en_gpio, 0);
+ gpiod_set_value_cansleep(trf->en_gpiod, 0);
- if (gpio_is_valid(trf->en2_gpio) &&
+ if (trf->en2_gpiod &&
!(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW))
- gpio_set_value(trf->en2_gpio, 0);
+ gpiod_set_value_cansleep(trf->en2_gpiod, 0);
ret = regulator_disable(trf->regulator);
if (ret)
@@ -2021,33 +2020,24 @@ static int trf7970a_probe(struct spi_device *spi)
trf->quirks |= TRF7970A_QUIRK_IRQ_STATUS_READ;
/* There are two enable pins - only EN must be present in DT */
- trf->en_gpio = of_get_named_gpio(np, "ti,enable-gpios", 0);
- if (!gpio_is_valid(trf->en_gpio)) {
+ trf->en_gpiod = devm_gpiod_get_index(trf->dev, "ti,enable", 0,
+ GPIOD_OUT_LOW);
+ if (IS_ERR(trf->en_gpiod)) {
dev_err(trf->dev, "No EN GPIO property\n");
- return trf->en_gpio;
+ return PTR_ERR(trf->en_gpiod);
}
- ret = devm_gpio_request_one(trf->dev, trf->en_gpio,
- GPIOF_DIR_OUT | GPIOF_INIT_LOW, "trf7970a EN");
- if (ret) {
- dev_err(trf->dev, "Can't request EN GPIO: %d\n", ret);
- return ret;
- }
-
- trf->en2_gpio = of_get_named_gpio(np, "ti,enable-gpios", 1);
- if (gpio_is_valid(trf->en2_gpio)) {
- ret = devm_gpio_request_one(trf->dev, trf->en2_gpio,
- GPIOF_DIR_OUT | GPIOF_INIT_LOW,
- "trf7970a EN2");
- if (ret) {
- dev_err(trf->dev, "Can't request EN2 GPIO: %d\n", ret);
- return ret;
- }
-
+ trf->en2_gpiod = devm_gpiod_get_index_optional(trf->dev, "ti,enable", 1,
+ GPIOD_OUT_LOW);
+ if (!trf->en2_gpiod) {
+ dev_err(trf->dev, "No EN2 GPIO property - ignoring EN2\n");
+ } else if (IS_ERR(trf->en2_gpiod)) {
+ dev_err(trf->dev, "Error getting EN2 GPIO property: %ld\n",
+ PTR_ERR(trf->en2_gpiod));
+ return PTR_ERR(trf->en2_gpiod);
+ } else {
if (of_property_read_bool(np, "en2-rf-quirk"))
trf->quirks |= TRF7970A_QUIRK_EN2_MUST_STAY_LOW;
- } else {
- dev_err(trf->dev, "No EN2 GPIO property - ignoring EN2\n");
}
ret = devm_request_threaded_irq(trf->dev, spi->irq, NULL,
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH v2 4/7] NFC: trf7970a: Remove useless comment
From: Mark Greer @ 2016-12-20 18:32 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220183244.5171-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
The last entry in the trf7970a_of_match[] table must be an empty
entry to demarcate the end of the table. Currently, there is a
comment indicating this but it is obvious so remove the comment.
Signed-off-by: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
drivers/nfc/trf7970a.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index bd3d9a09da0d..6fd85be49365 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -2211,7 +2211,7 @@ static const struct dev_pm_ops trf7970a_pm_ops = {
static const struct of_device_id trf7970a_of_match[] = {
{ .compatible = "ti,trf7970a", },
- { /* sentinel */ },
+ {},
};
MODULE_DEVICE_TABLE(of, trf7970a_of_match);
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH v2 5/7] NFC: trf7970a: Clean up coding style issues
From: Mark Greer @ 2016-12-20 18:32 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220183244.5171-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
Clean up coding style issues according to scripts/Lindent.
Some scripts/Lindent changes were reverted when it appeared
to make the code less readable or when it made the line run
over 80 characters.
Signed-off-by: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
drivers/nfc/trf7970a.c | 251 +++++++++++++++++++++++++------------------------
1 file changed, 128 insertions(+), 123 deletions(-)
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 6fd85be49365..9c6c45cb3cf4 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -122,7 +122,7 @@
NFC_PROTO_ISO14443_B_MASK | NFC_PROTO_FELICA_MASK | \
NFC_PROTO_ISO15693_MASK | NFC_PROTO_NFC_DEP_MASK)
-#define TRF7970A_AUTOSUSPEND_DELAY 30000 /* 30 seconds */
+#define TRF7970A_AUTOSUSPEND_DELAY 30000 /* 30 seconds */
#define TRF7970A_RX_SKB_ALLOC_SIZE 256
@@ -291,7 +291,7 @@
#define TRF7970A_REG_IO_CTRL_AUTO_REG BIT(7)
/* IRQ Status Register Bits */
-#define TRF7970A_IRQ_STATUS_NORESP BIT(0) /* ISO15693 only */
+#define TRF7970A_IRQ_STATUS_NORESP BIT(0) /* ISO15693 only */
#define TRF7970A_IRQ_STATUS_NFC_COL_ERROR BIT(0)
#define TRF7970A_IRQ_STATUS_COL BIT(1)
#define TRF7970A_IRQ_STATUS_FRAMING_EOF_ERROR BIT(2)
@@ -455,7 +455,6 @@ struct trf7970a {
struct delayed_work timeout_work;
};
-
static int trf7970a_cmd(struct trf7970a *trf, u8 opcode)
{
u8 cmd = TRF7970A_CMD_BIT_CTRL | TRF7970A_CMD_BIT_OPCODE(opcode);
@@ -466,7 +465,7 @@ static int trf7970a_cmd(struct trf7970a *trf, u8 opcode)
ret = spi_write(trf->spi, &cmd, 1);
if (ret)
dev_err(trf->dev, "%s - cmd: 0x%x, ret: %d\n", __func__, cmd,
- ret);
+ ret);
return ret;
}
@@ -478,14 +477,15 @@ static int trf7970a_read(struct trf7970a *trf, u8 reg, u8 *val)
ret = spi_write_then_read(trf->spi, &addr, 1, val, 1);
if (ret)
dev_err(trf->dev, "%s - addr: 0x%x, ret: %d\n", __func__, addr,
- ret);
+ ret);
dev_dbg(trf->dev, "read(0x%x): 0x%x\n", addr, *val);
return ret;
}
-static int trf7970a_read_cont(struct trf7970a *trf, u8 reg, u8 *buf, size_t len)
+static int trf7970a_read_cont(struct trf7970a *trf, u8 reg, u8 *buf,
+ size_t len)
{
u8 addr = reg | TRF7970A_CMD_BIT_RW | TRF7970A_CMD_BIT_CONTINUOUS;
struct spi_transfer t[2];
@@ -509,7 +509,7 @@ static int trf7970a_read_cont(struct trf7970a *trf, u8 reg, u8 *buf, size_t len)
ret = spi_sync(trf->spi, &m);
if (ret)
dev_err(trf->dev, "%s - addr: 0x%x, ret: %d\n", __func__, addr,
- ret);
+ ret);
return ret;
}
@@ -523,7 +523,7 @@ static int trf7970a_write(struct trf7970a *trf, u8 reg, u8 val)
ret = spi_write(trf->spi, buf, 2);
if (ret)
dev_err(trf->dev, "%s - write: 0x%x 0x%x, ret: %d\n", __func__,
- buf[0], buf[1], ret);
+ buf[0], buf[1], ret);
return ret;
}
@@ -545,7 +545,7 @@ static int trf7970a_read_irqstatus(struct trf7970a *trf, u8 *status)
if (ret)
dev_err(trf->dev, "%s - irqstatus: Status read failed: %d\n",
- __func__, ret);
+ __func__, ret);
else
*status = buf[0];
@@ -559,12 +559,12 @@ static int trf7970a_read_target_proto(struct trf7970a *trf, u8 *target_proto)
u8 addr;
addr = TRF79070A_NFC_TARGET_PROTOCOL | TRF7970A_CMD_BIT_RW |
- TRF7970A_CMD_BIT_CONTINUOUS;
+ TRF7970A_CMD_BIT_CONTINUOUS;
ret = spi_write_then_read(trf->spi, &addr, 1, buf, 2);
if (ret)
dev_err(trf->dev, "%s - target_proto: Read failed: %d\n",
- __func__, ret);
+ __func__, ret);
else
*target_proto = buf[0];
@@ -595,7 +595,7 @@ static int trf7970a_mode_detect(struct trf7970a *trf, u8 *rf_tech)
break;
default:
dev_dbg(trf->dev, "%s - mode_detect: target_proto: 0x%x\n",
- __func__, target_proto);
+ __func__, target_proto);
return -EIO;
}
@@ -611,8 +611,8 @@ static void trf7970a_send_upstream(struct trf7970a *trf)
if (trf->rx_skb && !IS_ERR(trf->rx_skb) && !trf->aborting)
print_hex_dump_debug("trf7970a rx data: ", DUMP_PREFIX_NONE,
- 16, 1, trf->rx_skb->data, trf->rx_skb->len,
- false);
+ 16, 1, trf->rx_skb->data,
+ trf->rx_skb->len, false);
trf->state = TRF7970A_ST_IDLE;
@@ -652,15 +652,16 @@ static void trf7970a_send_err_upstream(struct trf7970a *trf, int errno)
}
static int trf7970a_transmit(struct trf7970a *trf, struct sk_buff *skb,
- unsigned int len, u8 *prefix, unsigned int prefix_len)
+ unsigned int len, u8 *prefix,
+ unsigned int prefix_len)
{
struct spi_transfer t[2];
struct spi_message m;
unsigned int timeout;
int ret;
- print_hex_dump_debug("trf7970a tx data: ", DUMP_PREFIX_NONE,
- 16, 1, skb->data, len, false);
+ print_hex_dump_debug("trf7970a tx data: ", DUMP_PREFIX_NONE, 16, 1,
+ skb->data, len, false);
spi_message_init(&m);
@@ -677,7 +678,7 @@ static int trf7970a_transmit(struct trf7970a *trf, struct sk_buff *skb,
ret = spi_sync(trf->spi, &m);
if (ret) {
dev_err(trf->dev, "%s - Can't send tx data: %d\n", __func__,
- ret);
+ ret);
return ret;
}
@@ -701,7 +702,7 @@ static int trf7970a_transmit(struct trf7970a *trf, struct sk_buff *skb,
}
dev_dbg(trf->dev, "Setting timeout for %d ms, state: %d\n", timeout,
- trf->state);
+ trf->state);
schedule_delayed_work(&trf->timeout_work, msecs_to_jiffies(timeout));
@@ -769,9 +770,9 @@ static void trf7970a_drain_fifo(struct trf7970a *trf, u8 status)
if (fifo_bytes > skb_tailroom(skb)) {
skb = skb_copy_expand(skb, skb_headroom(skb),
- max_t(int, fifo_bytes,
- TRF7970A_RX_SKB_ALLOC_SIZE),
- GFP_KERNEL);
+ max_t(int, fifo_bytes,
+ TRF7970A_RX_SKB_ALLOC_SIZE),
+ GFP_KERNEL);
if (!skb) {
trf7970a_send_err_upstream(trf, -ENOMEM);
return;
@@ -782,7 +783,7 @@ static void trf7970a_drain_fifo(struct trf7970a *trf, u8 status)
}
ret = trf7970a_read_cont(trf, TRF7970A_FIFO_IO_REGISTER,
- skb_put(skb, fifo_bytes), fifo_bytes);
+ skb_put(skb, fifo_bytes), fifo_bytes);
if (ret) {
trf7970a_send_err_upstream(trf, ret);
return;
@@ -790,8 +791,7 @@ static void trf7970a_drain_fifo(struct trf7970a *trf, u8 status)
/* If received Type 2 ACK/NACK, shift right 4 bits and pass up */
if ((trf->framing == NFC_DIGITAL_FRAMING_NFCA_T2T) && (skb->len == 1) &&
- (trf->special_fcn_reg1 ==
- TRF7970A_SPECIAL_FCN_REG1_4_BIT_RX)) {
+ (trf->special_fcn_reg1 == TRF7970A_SPECIAL_FCN_REG1_4_BIT_RX)) {
skb->data[0] >>= 4;
status = TRF7970A_IRQ_STATUS_SRX;
} else {
@@ -814,13 +814,13 @@ static void trf7970a_drain_fifo(struct trf7970a *trf, u8 status)
}
no_rx_data:
- if (status == TRF7970A_IRQ_STATUS_SRX) { /* Receive complete */
+ if (status == TRF7970A_IRQ_STATUS_SRX) { /* Receive complete */
trf7970a_send_upstream(trf);
return;
}
dev_dbg(trf->dev, "Setting timeout for %d ms\n",
- TRF7970A_WAIT_FOR_RX_DATA_TIMEOUT);
+ TRF7970A_WAIT_FOR_RX_DATA_TIMEOUT);
schedule_delayed_work(&trf->timeout_work,
msecs_to_jiffies(TRF7970A_WAIT_FOR_RX_DATA_TIMEOUT));
@@ -846,7 +846,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
}
dev_dbg(trf->dev, "IRQ - state: %d, status: 0x%x\n", trf->state,
- status);
+ status);
if (!status) {
mutex_unlock(&trf->lock);
@@ -871,7 +871,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
case TRF7970A_ST_WAIT_FOR_TX_FIFO:
if (status & TRF7970A_IRQ_STATUS_TX) {
trf->ignore_timeout =
- !cancel_delayed_work(&trf->timeout_work);
+ !cancel_delayed_work(&trf->timeout_work);
trf7970a_fill_fifo(trf);
} else {
trf7970a_send_err_upstream(trf, -EIO);
@@ -881,11 +881,11 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
case TRF7970A_ST_WAIT_FOR_RX_DATA_CONT:
if (status & TRF7970A_IRQ_STATUS_SRX) {
trf->ignore_timeout =
- !cancel_delayed_work(&trf->timeout_work);
+ !cancel_delayed_work(&trf->timeout_work);
trf7970a_drain_fifo(trf, status);
} else if (status & TRF7970A_IRQ_STATUS_FIFO) {
ret = trf7970a_read(trf, TRF7970A_FIFO_STATUS,
- &fifo_bytes);
+ &fifo_bytes);
fifo_bytes &= ~TRF7970A_FIFO_STATUS_OVERFLOW;
@@ -894,14 +894,14 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
else if (!fifo_bytes)
trf7970a_cmd(trf, TRF7970A_CMD_FIFO_RESET);
} else if ((status == TRF7970A_IRQ_STATUS_TX) ||
- (!trf->is_initiator &&
- (status == (TRF7970A_IRQ_STATUS_TX |
- TRF7970A_IRQ_STATUS_NFC_RF)))) {
+ (!trf->is_initiator &&
+ (status == (TRF7970A_IRQ_STATUS_TX |
+ TRF7970A_IRQ_STATUS_NFC_RF)))) {
trf7970a_cmd(trf, TRF7970A_CMD_FIFO_RESET);
if (!trf->timeout) {
- trf->ignore_timeout = !cancel_delayed_work(
- &trf->timeout_work);
+ trf->ignore_timeout =
+ !cancel_delayed_work(&trf->timeout_work);
trf->rx_skb = ERR_PTR(0);
trf7970a_send_upstream(trf);
break;
@@ -925,13 +925,13 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
break;
case NFC_DIGITAL_FRAMING_NFCA_ANTICOL_COMPLETE:
ret = trf7970a_write(trf,
- TRF7970A_SPECIAL_FCN_REG1,
- TRF7970A_SPECIAL_FCN_REG1_14_ANTICOLL);
+ TRF7970A_SPECIAL_FCN_REG1,
+ TRF7970A_SPECIAL_FCN_REG1_14_ANTICOLL);
if (ret)
goto err_unlock_exit;
trf->special_fcn_reg1 =
- TRF7970A_SPECIAL_FCN_REG1_14_ANTICOLL;
+ TRF7970A_SPECIAL_FCN_REG1_14_ANTICOLL;
break;
default:
break;
@@ -939,7 +939,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
if (iso_ctrl != trf->iso_ctrl) {
ret = trf7970a_write(trf, TRF7970A_ISO_CTRL,
- iso_ctrl);
+ iso_ctrl);
if (ret)
goto err_unlock_exit;
@@ -956,7 +956,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
case TRF7970A_ST_LISTENING:
if (status & TRF7970A_IRQ_STATUS_SRX) {
trf->ignore_timeout =
- !cancel_delayed_work(&trf->timeout_work);
+ !cancel_delayed_work(&trf->timeout_work);
trf7970a_drain_fifo(trf, status);
} else if (!(status & TRF7970A_IRQ_STATUS_NFC_RF)) {
trf7970a_send_err_upstream(trf, -EIO);
@@ -965,7 +965,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
case TRF7970A_ST_LISTENING_MD:
if (status & TRF7970A_IRQ_STATUS_SRX) {
trf->ignore_timeout =
- !cancel_delayed_work(&trf->timeout_work);
+ !cancel_delayed_work(&trf->timeout_work);
ret = trf7970a_mode_detect(trf, &trf->md_rf_tech);
if (ret) {
@@ -980,7 +980,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
break;
default:
dev_err(trf->dev, "%s - Driver in invalid state: %d\n",
- __func__, trf->state);
+ __func__, trf->state);
}
err_unlock_exit:
@@ -1005,19 +1005,19 @@ static void trf7970a_issue_eof(struct trf7970a *trf)
trf->state = TRF7970A_ST_WAIT_FOR_RX_DATA;
dev_dbg(trf->dev, "Setting timeout for %d ms, state: %d\n",
- trf->timeout, trf->state);
+ trf->timeout, trf->state);
schedule_delayed_work(&trf->timeout_work,
- msecs_to_jiffies(trf->timeout));
+ msecs_to_jiffies(trf->timeout));
}
static void trf7970a_timeout_work_handler(struct work_struct *work)
{
struct trf7970a *trf = container_of(work, struct trf7970a,
- timeout_work.work);
+ timeout_work.work);
dev_dbg(trf->dev, "Timeout - state: %d, ignore_timeout: %d\n",
- trf->state, trf->ignore_timeout);
+ trf->state, trf->ignore_timeout);
mutex_lock(&trf->lock);
@@ -1062,8 +1062,8 @@ static int trf7970a_init(struct trf7970a *trf)
trf->modulator_sys_clk_ctrl = 0;
ret = trf7970a_write(trf, TRF7970A_ADJUTABLE_FIFO_IRQ_LEVELS,
- TRF7970A_ADJUTABLE_FIFO_IRQ_LEVELS_WLH_96 |
- TRF7970A_ADJUTABLE_FIFO_IRQ_LEVELS_WLL_32);
+ TRF7970A_ADJUTABLE_FIFO_IRQ_LEVELS_WLH_96 |
+ TRF7970A_ADJUTABLE_FIFO_IRQ_LEVELS_WLL_32);
if (ret)
goto err_out;
@@ -1084,7 +1084,7 @@ static int trf7970a_init(struct trf7970a *trf)
static void trf7970a_switch_rf_off(struct trf7970a *trf)
{
if ((trf->state == TRF7970A_ST_PWR_OFF) ||
- (trf->state == TRF7970A_ST_RF_OFF))
+ (trf->state == TRF7970A_ST_RF_OFF))
return;
dev_dbg(trf->dev, "Switching rf off\n");
@@ -1108,9 +1108,9 @@ static int trf7970a_switch_rf_on(struct trf7970a *trf)
pm_runtime_get_sync(trf->dev);
- if (trf->state != TRF7970A_ST_RF_OFF) { /* Power on, RF off */
+ if (trf->state != TRF7970A_ST_RF_OFF) { /* Power on, RF off */
dev_err(trf->dev, "%s - Incorrect state: %d\n", __func__,
- trf->state);
+ trf->state);
return -EINVAL;
}
@@ -1145,7 +1145,7 @@ static int trf7970a_switch_rf(struct nfc_digital_dev *ddev, bool on)
break;
default:
dev_err(trf->dev, "%s - Invalid request: %d %d\n",
- __func__, trf->state, on);
+ __func__, trf->state, on);
trf7970a_switch_rf_off(trf);
ret = -EINVAL;
}
@@ -1156,7 +1156,7 @@ static int trf7970a_switch_rf(struct nfc_digital_dev *ddev, bool on)
break;
default:
dev_err(trf->dev, "%s - Invalid request: %d %d\n",
- __func__, trf->state, on);
+ __func__, trf->state, on);
ret = -EINVAL;
/* FALLTHROUGH */
case TRF7970A_ST_IDLE:
@@ -1227,7 +1227,8 @@ static int trf7970a_is_rf_field(struct trf7970a *trf, bool *is_rf_field)
u8 rssi;
ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL,
- trf->chip_status_ctrl | TRF7970A_CHIP_STATUS_REC_ON);
+ trf->chip_status_ctrl |
+ TRF7970A_CHIP_STATUS_REC_ON);
if (ret)
return ret;
@@ -1242,7 +1243,7 @@ static int trf7970a_is_rf_field(struct trf7970a *trf, bool *is_rf_field)
return ret;
ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL,
- trf->chip_status_ctrl);
+ trf->chip_status_ctrl);
if (ret)
return ret;
@@ -1309,15 +1310,15 @@ static int trf7970a_in_config_framing(struct trf7970a *trf, int framing)
trf->iso_ctrl = iso_ctrl;
ret = trf7970a_write(trf, TRF7970A_MODULATOR_SYS_CLK_CTRL,
- trf->modulator_sys_clk_ctrl);
+ trf->modulator_sys_clk_ctrl);
if (ret)
return ret;
}
if (!(trf->chip_status_ctrl & TRF7970A_CHIP_STATUS_RF_ON)) {
ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL,
- trf->chip_status_ctrl |
- TRF7970A_CHIP_STATUS_RF_ON);
+ trf->chip_status_ctrl |
+ TRF7970A_CHIP_STATUS_RF_ON);
if (ret)
return ret;
@@ -1330,7 +1331,7 @@ static int trf7970a_in_config_framing(struct trf7970a *trf, int framing)
}
static int trf7970a_in_configure_hw(struct nfc_digital_dev *ddev, int type,
- int param)
+ int param)
{
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
int ret;
@@ -1342,7 +1343,7 @@ static int trf7970a_in_configure_hw(struct nfc_digital_dev *ddev, int type,
trf->is_initiator = true;
if ((trf->state == TRF7970A_ST_PWR_OFF) ||
- (trf->state == TRF7970A_ST_RF_OFF)) {
+ (trf->state == TRF7970A_ST_RF_OFF)) {
ret = trf7970a_switch_rf_on(trf);
if (ret)
goto err_unlock;
@@ -1400,7 +1401,7 @@ static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb)
* has to send an EOF in order to get a response.
*/
if ((trf->technology == NFC_DIGITAL_RF_TECH_106A) &&
- (trf->framing == NFC_DIGITAL_FRAMING_NFCA_T2T)) {
+ (trf->framing == NFC_DIGITAL_FRAMING_NFCA_T2T)) {
if (req[0] == NFC_T2T_CMD_READ)
special_fcn_reg1 = 0;
else
@@ -1408,7 +1409,7 @@ static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb)
if (special_fcn_reg1 != trf->special_fcn_reg1) {
ret = trf7970a_write(trf, TRF7970A_SPECIAL_FCN_REG1,
- special_fcn_reg1);
+ special_fcn_reg1);
if (ret)
return ret;
@@ -1428,7 +1429,7 @@ static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb)
iso_ctrl |= TRF7970A_ISO_CTRL_15693_SGL_1OF4_2648;
break;
case (ISO15693_REQ_FLAG_SUB_CARRIER |
- ISO15693_REQ_FLAG_DATA_RATE):
+ ISO15693_REQ_FLAG_DATA_RATE):
iso_ctrl |= TRF7970A_ISO_CTRL_15693_DBL_1OF4_2669;
break;
}
@@ -1443,10 +1444,10 @@ static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb)
if (trf->framing == NFC_DIGITAL_FRAMING_ISO15693_T5T) {
if (trf7970a_is_iso15693_write_or_lock(req[1]) &&
- (req[0] & ISO15693_REQ_FLAG_OPTION))
+ (req[0] & ISO15693_REQ_FLAG_OPTION))
trf->issue_eof = true;
else if ((trf->quirks &
- TRF7970A_QUIRK_T5T_RMB_EXTRA_BYTE) &&
+ TRF7970A_QUIRK_T5T_RMB_EXTRA_BYTE) &&
(req[1] == ISO15693_CMD_READ_MULTIPLE_BLOCK))
trf->adjust_resp_len = true;
}
@@ -1456,8 +1457,8 @@ static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb)
}
static int trf7970a_send_cmd(struct nfc_digital_dev *ddev,
- struct sk_buff *skb, u16 timeout,
- nfc_digital_cmd_complete_t cb, void *arg)
+ struct sk_buff *skb, u16 timeout,
+ nfc_digital_cmd_complete_t cb, void *arg)
{
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
u8 prefix[5];
@@ -1466,7 +1467,7 @@ static int trf7970a_send_cmd(struct nfc_digital_dev *ddev,
u8 status;
dev_dbg(trf->dev, "New request - state: %d, timeout: %d ms, len: %d\n",
- trf->state, timeout, skb->len);
+ trf->state, timeout, skb->len);
if (skb->len > TRF7970A_TX_MAX)
return -EINVAL;
@@ -1474,9 +1475,9 @@ static int trf7970a_send_cmd(struct nfc_digital_dev *ddev,
mutex_lock(&trf->lock);
if ((trf->state != TRF7970A_ST_IDLE) &&
- (trf->state != TRF7970A_ST_IDLE_RX_BLOCKED)) {
+ (trf->state != TRF7970A_ST_IDLE_RX_BLOCKED)) {
dev_err(trf->dev, "%s - Bogus state: %d\n", __func__,
- trf->state);
+ trf->state);
ret = -EIO;
goto out_err;
}
@@ -1490,7 +1491,7 @@ static int trf7970a_send_cmd(struct nfc_digital_dev *ddev,
if (timeout) {
trf->rx_skb = nfc_alloc_recv_skb(TRF7970A_RX_SKB_ALLOC_SIZE,
- GFP_KERNEL);
+ GFP_KERNEL);
if (!trf->rx_skb) {
dev_dbg(trf->dev, "Can't alloc rx_skb\n");
ret = -ENOMEM;
@@ -1527,14 +1528,14 @@ static int trf7970a_send_cmd(struct nfc_digital_dev *ddev,
* That totals 5 bytes.
*/
prefix[0] = TRF7970A_CMD_BIT_CTRL |
- TRF7970A_CMD_BIT_OPCODE(TRF7970A_CMD_FIFO_RESET);
+ TRF7970A_CMD_BIT_OPCODE(TRF7970A_CMD_FIFO_RESET);
prefix[1] = TRF7970A_CMD_BIT_CTRL |
- TRF7970A_CMD_BIT_OPCODE(trf->tx_cmd);
+ TRF7970A_CMD_BIT_OPCODE(trf->tx_cmd);
prefix[2] = TRF7970A_CMD_BIT_CONTINUOUS | TRF7970A_TX_LENGTH_BYTE1;
if (trf->framing == NFC_DIGITAL_FRAMING_NFCA_SHORT) {
prefix[3] = 0x00;
- prefix[4] = 0x0f; /* 7 bits */
+ prefix[4] = 0x0f; /* 7 bits */
} else {
prefix[3] = (len & 0xf00) >> 4;
prefix[3] |= ((len & 0xf0) >> 4);
@@ -1568,18 +1569,18 @@ static int trf7970a_tg_config_rf_tech(struct trf7970a *trf, int tech)
switch (tech) {
case NFC_DIGITAL_RF_TECH_106A:
trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_NFC_NFC_CE_MODE |
- TRF7970A_ISO_CTRL_NFC_CE |
- TRF7970A_ISO_CTRL_NFC_CE_14443A;
+ TRF7970A_ISO_CTRL_NFC_CE |
+ TRF7970A_ISO_CTRL_NFC_CE_14443A;
trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_OOK;
break;
case NFC_DIGITAL_RF_TECH_212F:
trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_NFC_NFC_CE_MODE |
- TRF7970A_ISO_CTRL_NFC_NFCF_212;
+ TRF7970A_ISO_CTRL_NFC_NFCF_212;
trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_ASK10;
break;
case NFC_DIGITAL_RF_TECH_424F:
trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_NFC_NFC_CE_MODE |
- TRF7970A_ISO_CTRL_NFC_NFCF_424;
+ TRF7970A_ISO_CTRL_NFC_NFCF_424;
trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_ASK10;
break;
default:
@@ -1597,9 +1598,9 @@ static int trf7970a_tg_config_rf_tech(struct trf7970a *trf, int tech)
* here.
*/
if ((trf->framing == NFC_DIGITAL_FRAMING_NFC_DEP_ACTIVATED) &&
- (trf->iso_ctrl_tech != trf->iso_ctrl)) {
+ (trf->iso_ctrl_tech != trf->iso_ctrl)) {
ret = trf7970a_write(trf, TRF7970A_ISO_CTRL,
- trf->iso_ctrl_tech);
+ trf->iso_ctrl_tech);
trf->iso_ctrl = trf->iso_ctrl_tech;
}
@@ -1654,15 +1655,15 @@ static int trf7970a_tg_config_framing(struct trf7970a *trf, int framing)
trf->iso_ctrl = iso_ctrl;
ret = trf7970a_write(trf, TRF7970A_MODULATOR_SYS_CLK_CTRL,
- trf->modulator_sys_clk_ctrl);
+ trf->modulator_sys_clk_ctrl);
if (ret)
return ret;
}
if (!(trf->chip_status_ctrl & TRF7970A_CHIP_STATUS_RF_ON)) {
ret = trf7970a_write(trf, TRF7970A_CHIP_STATUS_CTRL,
- trf->chip_status_ctrl |
- TRF7970A_CHIP_STATUS_RF_ON);
+ trf->chip_status_ctrl |
+ TRF7970A_CHIP_STATUS_RF_ON);
if (ret)
return ret;
@@ -1673,7 +1674,7 @@ static int trf7970a_tg_config_framing(struct trf7970a *trf, int framing)
}
static int trf7970a_tg_configure_hw(struct nfc_digital_dev *ddev, int type,
- int param)
+ int param)
{
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
int ret;
@@ -1685,7 +1686,7 @@ static int trf7970a_tg_configure_hw(struct nfc_digital_dev *ddev, int type,
trf->is_initiator = false;
if ((trf->state == TRF7970A_ST_PWR_OFF) ||
- (trf->state == TRF7970A_ST_RF_OFF)) {
+ (trf->state == TRF7970A_ST_RF_OFF)) {
ret = trf7970a_switch_rf_on(trf);
if (ret)
goto err_unlock;
@@ -1709,7 +1710,8 @@ static int trf7970a_tg_configure_hw(struct nfc_digital_dev *ddev, int type,
}
static int _trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
- nfc_digital_cmd_complete_t cb, void *arg, bool mode_detect)
+ nfc_digital_cmd_complete_t cb, void *arg,
+ bool mode_detect)
{
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
int ret;
@@ -1717,9 +1719,9 @@ static int _trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
mutex_lock(&trf->lock);
if ((trf->state != TRF7970A_ST_IDLE) &&
- (trf->state != TRF7970A_ST_IDLE_RX_BLOCKED)) {
+ (trf->state != TRF7970A_ST_IDLE_RX_BLOCKED)) {
dev_err(trf->dev, "%s - Bogus state: %d\n", __func__,
- trf->state);
+ trf->state);
ret = -EIO;
goto out_err;
}
@@ -1732,7 +1734,7 @@ static int _trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
}
trf->rx_skb = nfc_alloc_recv_skb(TRF7970A_RX_SKB_ALLOC_SIZE,
- GFP_KERNEL);
+ GFP_KERNEL);
if (!trf->rx_skb) {
dev_dbg(trf->dev, "Can't alloc rx_skb\n");
ret = -ENOMEM;
@@ -1740,25 +1742,25 @@ static int _trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
}
ret = trf7970a_write(trf, TRF7970A_RX_SPECIAL_SETTINGS,
- TRF7970A_RX_SPECIAL_SETTINGS_HBT |
- TRF7970A_RX_SPECIAL_SETTINGS_M848 |
- TRF7970A_RX_SPECIAL_SETTINGS_C424 |
- TRF7970A_RX_SPECIAL_SETTINGS_C212);
+ TRF7970A_RX_SPECIAL_SETTINGS_HBT |
+ TRF7970A_RX_SPECIAL_SETTINGS_M848 |
+ TRF7970A_RX_SPECIAL_SETTINGS_C424 |
+ TRF7970A_RX_SPECIAL_SETTINGS_C212);
if (ret)
goto out_err;
ret = trf7970a_write(trf, TRF7970A_REG_IO_CTRL,
- TRF7970A_REG_IO_CTRL_VRS(0x1));
+ TRF7970A_REG_IO_CTRL_VRS(0x1));
if (ret)
goto out_err;
ret = trf7970a_write(trf, TRF7970A_NFC_LOW_FIELD_LEVEL,
- TRF7970A_NFC_LOW_FIELD_LEVEL_RFDET(0x3));
+ TRF7970A_NFC_LOW_FIELD_LEVEL_RFDET(0x3));
if (ret)
goto out_err;
ret = trf7970a_write(trf, TRF7970A_NFC_TARGET_LEVEL,
- TRF7970A_NFC_TARGET_LEVEL_RFDET(0x7));
+ TRF7970A_NFC_TARGET_LEVEL_RFDET(0x7));
if (ret)
goto out_err;
@@ -1783,32 +1785,32 @@ static int _trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
}
static int trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
- nfc_digital_cmd_complete_t cb, void *arg)
+ nfc_digital_cmd_complete_t cb, void *arg)
{
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
dev_dbg(trf->dev, "Listen - state: %d, timeout: %d ms\n",
- trf->state, timeout);
+ trf->state, timeout);
return _trf7970a_tg_listen(ddev, timeout, cb, arg, false);
}
-static int trf7970a_tg_listen_md(struct nfc_digital_dev *ddev,
- u16 timeout, nfc_digital_cmd_complete_t cb, void *arg)
+static int trf7970a_tg_listen_md(struct nfc_digital_dev *ddev, u16 timeout,
+ nfc_digital_cmd_complete_t cb, void *arg)
{
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
int ret;
dev_dbg(trf->dev, "Listen MD - state: %d, timeout: %d ms\n",
- trf->state, timeout);
+ trf->state, timeout);
ret = trf7970a_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH,
- NFC_DIGITAL_RF_TECH_106A);
+ NFC_DIGITAL_RF_TECH_106A);
if (ret)
return ret;
ret = trf7970a_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING,
- NFC_DIGITAL_FRAMING_NFCA_NFC_DEP);
+ NFC_DIGITAL_FRAMING_NFCA_NFC_DEP);
if (ret)
return ret;
@@ -1820,7 +1822,7 @@ static int trf7970a_tg_get_rf_tech(struct nfc_digital_dev *ddev, u8 *rf_tech)
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
dev_dbg(trf->dev, "Get RF Tech - state: %d, rf_tech: %d\n",
- trf->state, trf->md_rf_tech);
+ trf->state, trf->md_rf_tech);
*rf_tech = trf->md_rf_tech;
@@ -1909,20 +1911,19 @@ static int trf7970a_power_down(struct trf7970a *trf)
if (trf->state != TRF7970A_ST_RF_OFF) {
dev_dbg(trf->dev, "Can't power down - not RF_OFF state (%d)\n",
- trf->state);
+ trf->state);
return -EBUSY;
}
gpiod_set_value_cansleep(trf->en_gpiod, 0);
- if (trf->en2_gpiod &&
- !(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW))
+ if (trf->en2_gpiod && !(trf->quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW))
gpiod_set_value_cansleep(trf->en2_gpiod, 0);
ret = regulator_disable(trf->regulator);
if (ret)
dev_err(trf->dev, "%s - Can't disable VIN: %d\n", __func__,
- ret);
+ ret);
trf->state = TRF7970A_ST_PWR_OFF;
@@ -1980,7 +1981,7 @@ static int trf7970a_get_autosuspend_delay(struct device_node *np)
}
static int trf7970a_get_vin_voltage_override(struct device_node *np,
- u32 *vin_uvolts)
+ u32 *vin_uvolts)
{
return of_property_read_u32(np, "vin-voltage-override", vin_uvolts);
}
@@ -2041,8 +2042,9 @@ static int trf7970a_probe(struct spi_device *spi)
}
ret = devm_request_threaded_irq(trf->dev, spi->irq, NULL,
- trf7970a_irq, IRQF_TRIGGER_RISING | IRQF_ONESHOT,
- "trf7970a", trf);
+ trf7970a_irq,
+ IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+ "trf7970a", trf);
if (ret) {
dev_err(trf->dev, "Can't request IRQ#%d: %d\n", spi->irq, ret);
return ret;
@@ -2072,9 +2074,10 @@ static int trf7970a_probe(struct spi_device *spi)
trf->chip_status_ctrl = TRF7970A_CHIP_STATUS_VRS5_3;
trf->ddev = nfc_digital_allocate_device(&trf7970a_nfc_ops,
- TRF7970A_SUPPORTED_PROTOCOLS,
- NFC_DIGITAL_DRV_CAPS_IN_CRC |
- NFC_DIGITAL_DRV_CAPS_TG_CRC, 0, 0);
+ TRF7970A_SUPPORTED_PROTOCOLS,
+ NFC_DIGITAL_DRV_CAPS_IN_CRC |
+ NFC_DIGITAL_DRV_CAPS_TG_CRC, 0,
+ 0);
if (!trf->ddev) {
dev_err(trf->dev, "Can't allocate NFC digital device\n");
ret = -ENOMEM;
@@ -2097,7 +2100,7 @@ static int trf7970a_probe(struct spi_device *spi)
ret = nfc_digital_register_device(trf->ddev);
if (ret) {
dev_err(trf->dev, "Can't register NFC digital device: %d\n",
- ret);
+ ret);
goto err_shutdown;
}
@@ -2206,19 +2209,21 @@ static int trf7970a_pm_runtime_resume(struct device *dev)
static const struct dev_pm_ops trf7970a_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(trf7970a_suspend, trf7970a_resume)
SET_RUNTIME_PM_OPS(trf7970a_pm_runtime_suspend,
- trf7970a_pm_runtime_resume, NULL)
+ trf7970a_pm_runtime_resume, NULL)
};
static const struct of_device_id trf7970a_of_match[] = {
- { .compatible = "ti,trf7970a", },
+ {.compatible = "ti,trf7970a",},
{},
};
+
MODULE_DEVICE_TABLE(of, trf7970a_of_match);
static const struct spi_device_id trf7970a_id_table[] = {
- { "trf7970a", 0 },
- { }
+ {"trf7970a", 0},
+ {}
};
+
MODULE_DEVICE_TABLE(spi, trf7970a_id_table);
static struct spi_driver trf7970a_spi_driver = {
@@ -2226,9 +2231,9 @@ static struct spi_driver trf7970a_spi_driver = {
.remove = trf7970a_remove,
.id_table = trf7970a_id_table,
.driver = {
- .name = "trf7970a",
- .of_match_table = of_match_ptr(trf7970a_of_match),
- .pm = &trf7970a_pm_ops,
+ .name = "trf7970a",
+ .of_match_table = of_match_ptr(trf7970a_of_match),
+ .pm = &trf7970a_pm_ops,
},
};
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH v2 6/7] NFC: trf7970a: Enable pins are active high not active low
From: Mark Greer @ 2016-12-20 18:32 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220183244.5171-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
The example DTS code for the trf7970a sets the GPIOs for the EN
and EN2 pins to active low when they are really active high so
correct the error.
Signed-off-by: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
Documentation/devicetree/bindings/net/nfc/trf7970a.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/nfc/trf7970a.txt b/Documentation/devicetree/bindings/net/nfc/trf7970a.txt
index 32b35a07abe4..10672649a59e 100644
--- a/Documentation/devicetree/bindings/net/nfc/trf7970a.txt
+++ b/Documentation/devicetree/bindings/net/nfc/trf7970a.txt
@@ -35,8 +35,8 @@ Example (for ARM-based BeagleBone with TRF7970A on SPI1):
spi-max-frequency = <2000000>;
interrupt-parent = <&gpio2>;
interrupts = <14 0>;
- ti,enable-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>,
- <&gpio2 5 GPIO_ACTIVE_LOW>;
+ ti,enable-gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>,
+ <&gpio2 5 GPIO_ACTIVE_HIGH>;
vin-supply = <&ldo3_reg>;
vin-voltage-override = <5000000>;
autosuspend-delay = <30000>;
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH v2 7/7] MAINTAINERS: NFC: trf7970a: Add Mark Greer as maintainer
From: Mark Greer @ 2016-12-20 18:32 UTC (permalink / raw)
To: Samuel Ortiz, Lauro Ramos Venancio, Aloisio Almeida Jr,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw, Mark Greer
In-Reply-To: <20161220183244.5171-1-mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
Add Mark Greer as the maintainer of the trf7970a NFC driver.
Signed-off-by: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
---
MAINTAINERS | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index f6eb97b35e0f..3a9420055bd7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10871,6 +10871,13 @@ F: include/linux/power/bq27xxx_battery.h
F: drivers/power/supply/bq27xxx_battery.c
F: drivers/power/supply/bq27xxx_battery_i2c.c
+TI TRF7970A NFC DRIVER
+M: Mark Greer <mgreer-luAo+O/VEmrlveNOaEYElw@public.gmane.org>
+L: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org (moderated for non-subscribers)
+S: Supported
+F: drivers/nfc/trf7970a.c
+F: Documentation/devicetree/bindings/net/nfc/trf7970a.txt
+
TIMEKEEPING, CLOCKSOURCE CORE, NTP, ALARMTIMER
M: John Stultz <john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
M: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* Re: [PATCH 1/3] NFC: trf7970a: add device tree option for 27MHz clock
From: Mark Greer @ 2016-12-20 18:35 UTC (permalink / raw)
To: Geoff Lansberry
Cc: linux-wireless, Lauro Ramos Venancio, Aloisio Almeida Jr,
Samuel Ortiz, robh+dt, mark.rutland, netdev, devicetree,
linux-kernel, Justin Bronder
In-Reply-To: <CAO7Z3WLYMZ3rRGKpksYnRksbC=A1WNog913UJFiPsAT7ymOnaw@mail.gmail.com>
On Tue, Dec 20, 2016 at 01:29:13PM -0500, Geoff Lansberry wrote:
> On Tue, Dec 20, 2016 at 1:11 PM, Mark Greer <mgreer@animalcreek.com> wrote:
> > Hi Geoff.
> >
> > Please put the version in your subjects when submitting anything but the
> > initial version of a patch (e.g., [PATCH v2 1/3]).
> >
> > Which series do you want reviewed?
> >
> > Mark
> > --
> Sorry about the double posting, I had forgotten to erase the patches I
> generated while rebasing and checking, and I'll have to figure out how
> to add that v2 line to the automatically generated subject line if I
> end up submitting another round.
Hint: -v <n> option of 'git format-patch'
> Please review the three most recent patches, which have the send time
> of 17:16.
Okay, thank.
Mark
^ permalink raw reply
* [PATCH v2 pci/next] PCI: rcar: Add compatible string for r8a7796
From: Yoshihiro Kaneko @ 2016-12-20 18:37 UTC (permalink / raw)
To: linux-pci
Cc: Bjorn Helgaas, Simon Horman, Magnus Damm, Geert Uytterhoeven,
linux-renesas-soc, devicetree
From: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>
This patch adds support for r8a7796.
Signed-off-by: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This patch is based on the next branch of the pci tree.
v2 [Yoshihiro Kaneko]
* As suggested by Geert Uytterhoeven
Dropped the update of the driver.
Documentation/devicetree/bindings/pci/rcar-pci.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/pci/rcar-pci.txt b/Documentation/devicetree/bindings/pci/rcar-pci.txt
index eee518d..34712d6 100644
--- a/Documentation/devicetree/bindings/pci/rcar-pci.txt
+++ b/Documentation/devicetree/bindings/pci/rcar-pci.txt
@@ -6,6 +6,7 @@ compatible: "renesas,pcie-r8a7779" for the R8A7779 SoC;
"renesas,pcie-r8a7791" for the R8A7791 SoC;
"renesas,pcie-r8a7793" for the R8A7793 SoC;
"renesas,pcie-r8a7795" for the R8A7795 SoC;
+ "renesas,pcie-r8a7796" for the R8A7796 SoC;
"renesas,pcie-rcar-gen2" for a generic R-Car Gen2 compatible device.
"renesas,pcie-rcar-gen3" for a generic R-Car Gen3 compatible device.
--
1.9.1
^ permalink raw reply related
* Re: [PATCH net 0/3] Fix integration of eee-broken-modes
From: David Miller @ 2016-12-20 18:51 UTC (permalink / raw)
To: jbrunet
Cc: netdev, devicetree, f.fainelli, carlo, khilman,
martin.blumenstingl, neolynx, andrew, narmstrong, linux-amlogic,
linux-arm-kernel, linux-kernel, julia.lawall, yegorslists,
afaerber
In-Reply-To: <1482159938-13239-1-git-send-email-jbrunet@baylibre.com>
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Mon, 19 Dec 2016 16:05:35 +0100
> The purpose of this series is to fix the integration of the ethernet phy
> property "eee-broken-modes" [0]
>
> The v3 of this series has been merged, missing a fix (error reported by
> kbuild robot) available in the v4 [1]
>
> More importantly, Florian opposed adding a DT property mapping a device
> register this directly [2]. The concern was that the property could be
> abused to implement platform configuration policy. After discussing it,
> I think we agreed that such information about the HW (defect) should appear
> in the platform DT. However, the preferred way is to add a boolean property
> for each EEE broken mode.
>
> [0]: http://lkml.kernel.org/r/1480326409-25419-1-git-send-email-jbrunet@baylibre.com
> [1]: http://lkml.kernel.org/r/1480348229-25672-1-git-send-email-jbrunet@baylibre.com
> [2]: http://lkml.kernel.org/r/e14a3b0c-dc34-be14-48b3-518a0ad0c080@gmail.com
Series applied, thank you.
^ permalink raw reply
* Re: [PATCH v3 2/2] iio: adc: hx711: Add IIO driver for AVIA HX711
From: Lars-Peter Clausen @ 2016-12-20 18:55 UTC (permalink / raw)
To: Andreas Klinger
Cc: devicetree, linux-iio, linux-kernel, robh+dt, pawel.moll,
mark.rutland, ijc+devicetree, galak, jic23, knaack.h, pmeerw
In-Reply-To: <20161220103346.GA1318@imap.1und1.de>
On 12/20/2016 11:33 AM, Andreas Klinger wrote:
>>> +static struct attribute *hx711_attributes[] = {
>>> + &iio_dev_attr_gain.dev_attr.attr,
>>
>> For IIO devices the gain is typically expressed through the scale attribute.
>> Which is kind of the inverse of gain. It would be good if this driver
>> follows this standard notation. The scale is the value of 1LSB in mV. So
>> this includes the resolution of the ADC, the reference voltage and any gain
>> that is applied to the input signal.
>>
>> The possible values can be listed in the scale_available attribute.
>>
>
> The reference voltage is in the hardware.
> Should i use a DT entry for the reference voltage?
> Or is it better to use a buildin scale and make it changeable?
Typically the reference voltage is specified through the devicetree using a
regulator. Have a look at e.g. ad7291.c.
>
>
>>> + NULL,
>>> +};
>>> +
>>> +static struct attribute_group hx711_attribute_group = {
>>> + .attrs = hx711_attributes,
>>> +};
>>> +
>>> +static const struct iio_info hx711_iio_info = {
>>> + .driver_module = THIS_MODULE,
>>> + .read_raw = hx711_read_raw,
>>> + .attrs = &hx711_attribute_group,
>>> +};
>>> +
>>> +static const struct iio_chan_spec hx711_chan_spec[] = {
>>> + { .type = IIO_VOLTAGE,
>>> + .info_mask_separate =
>>> + BIT(IIO_CHAN_INFO_RAW),
>>
>> Given that there are two separate physical input channels this should be
>> expressed here and there should be two IIO channels for the device.
>>
>
> One who is toggling between channel A and B will cause a dummy read
> additional to every normal read.
>
> Should i offer a "toggling mode" which means that after reading
> channel A the channel B is selected for the next read and after
> reading channel B channel A is selected? Simply expecting the channel
> is toggled on every read. If it's not toggled there need to be a dummy
> read, of course. This should be an attribute, right?
I don't think that is necessary. On one hand when doing these kind of single
shot conversions there is often not a predictable pattern on the other hand
such custom device specific attributes are difficult to handle in a generic
framework. We try to establish standard semantics so a generic application
is able to talk to a wide range of devices. When a device implements custom
attributes that becomes more difficult.
And there is also buffered mode. In buffered mode the application can select
the channels which the converter should cycle through and connect a trigger
like a timer to schedule the conversions. If switching between A and B in a
circular way is required I'd recommend to implement this by using buffered mode.
^ permalink raw reply
* Re: [PATCH] ARM: dts: sun8i: add a delay after reset xr819 on Orange Pi Zero
From: Maxime Ripard @ 2016-12-20 18:58 UTC (permalink / raw)
To: Icenowy Zheng
Cc: Hans de Goede, Chen-Yu Tsai, linux-kernel, linux-arm-kernel,
devicetree
In-Reply-To: <20161220055826.30725-1-icenowy@aosc.xyz>
[-- Attachment #1.1: Type: text/plain, Size: 448 bytes --]
On Tue, Dec 20, 2016 at 01:58:26PM +0800, Icenowy Zheng wrote:
> XR819 seems to need a delay after its reset line to be deasserted,
> otherwise it may not respond MMC commands correctly, and fail to
> initialize.
>
> Add a 200ms delay in the mmc-pwrseq.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
Applied, thanks!
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 3/3] nfc: trf7970a: Prevent repeated polling from crashing the kernel
From: Mark Greer @ 2016-12-20 18:59 UTC (permalink / raw)
To: Geoff Lansberry
Cc: linux-wireless, lauro.venancio, aloisio.almeida, sameo, robh+dt,
mark.rutland, netdev, devicetree, linux-kernel, justin,
Jaret Cantu
In-Reply-To: <1482250592-4268-3-git-send-email-glansberry@gmail.com>
On Tue, Dec 20, 2016 at 11:16:32AM -0500, Geoff Lansberry wrote:
> From: Jaret Cantu <jaret.cantu@timesys.com>
>
> Repeated polling attempts cause a NULL dereference error to occur.
> This is because the state of the trf7970a is currently reading but
> another request has been made to send a command before it has finished.
How is this happening? Was trf7970a_abort_cmd() called and it didn't
work right? Was it not called at all and there is a bug in the digital
layer? More details please.
> The solution is to properly kill the waiting reading (workqueue)
> before failing on the send.
If the bug is in the calling code, then that is what should get fixed.
This seems to be a hack to work-around a digital layer bug.
Mark
--
^ permalink raw reply
* [PATCH 0/4 v2] of/overlay: sysfs based ABI for dt overlays
From: Heinrich Schuchardt @ 2016-12-20 19:04 UTC (permalink / raw)
To: Pantelis Antoniou, Rob Herring, Mark Rutland, Frank Rowand
Cc: linux-kernel, devicetree, Heinrich Schuchardt
Currently the kernel only supplies an internal API for creating
and destroying device tree overlays.
For some boards vendor specific kernel modules exist for
managing device tree overlays but they have not been
upstreamed or upstreaming stalled.
https://lkml.org/lkml/2015/6/12/624
https://lkml.org/lkml/2013/1/7/366
This patch series provides a sysfs based ABI for creation and
destruction of dt overlays in /sys/firmware/devicetree/overlays.
The following files are provided:
load: This is a write only file.
A string written to it is interpreted as the path to a
flattened device tree overlay file. It is used to create
and apply the contained overlays.
loaded: This is a read only file.
It provides the count of loaded overlays as a decimal
number.
unload: This is a write only file.
If a positive number n is wrtten to this file the n
most recent overlays are destroyed.
If a negative number is written to this file all
overlays are destroyed.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
version 2:
change sysfs path to
/sys/firmware/devicetree/overlays
Fix errors indicated by kbuild robot:
Add missing inline attribute to of_overlay_count
in patch 1.
Add 'select CONFIG_OF_EARLY_FLATTREE' to Kconfig
in patch 2.
Change unit test cases to check new functions
of_overlay_count and of_overlay_destroy_last.
Heinrich Schuchardt (4):
of/overlay: add API function to count and pop last
of/overlay: sysfs based ABI for dt overlays
of/overlay: documentation for sysfs ABI
of/overlay: test count and destroy_last
.../ABI/testing/sysfs-firmware-devicetree-overlays | 24 +++
Documentation/devicetree/overlay-notes.txt | 7 +-
drivers/of/Kconfig | 15 ++
drivers/of/Makefile | 2 +
drivers/of/base.c | 1 +
drivers/of/ov_sysfs.c | 223 +++++++++++++++++++++
drivers/of/overlay.c | 50 +++++
drivers/of/unittest.c | 15 +-
include/linux/of.h | 12 ++
9 files changed, 346 insertions(+), 3 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-firmware-devicetree-overlays
create mode 100644 drivers/of/ov_sysfs.c
--
2.11.0
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox