aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc/pn533.c
diff options
context:
space:
mode:
authorWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>2013-04-03 02:02:12 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-04-11 10:29:06 -0400
commit58520373d8aff974f4b3f1bd9eb84c1ff3d6bd8b (patch)
treeee1657b3025e42f9b25ee401b0b508a43367f114 /drivers/nfc/pn533.c
parentf87bc9fb62780970ff437e9d556b143cbe9f6528 (diff)
NFC: pn533: Add protocol type for frame ops
As not all devices require ACK confirmation of every request sent to the controller, differentiate two protocol types. First one, request-ack-response and the second one request-response type. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/pn533.c')
-rw-r--r--drivers/nfc/pn533.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index edee0d55d8f4..2fd8029f377d 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -310,11 +310,17 @@ struct pn533_cmd_jump_dep_response {
310#define PN533_INIT_TARGET_RESP_ACTIVE 0x1 310#define PN533_INIT_TARGET_RESP_ACTIVE 0x1
311#define PN533_INIT_TARGET_RESP_DEP 0x4 311#define PN533_INIT_TARGET_RESP_DEP 0x4
312 312
313enum pn533_protocol_type {
314 PN533_PROTO_REQ_ACK_RESP = 0,
315 PN533_PROTO_REQ_RESP
316};
317
313struct pn533 { 318struct pn533 {
314 struct usb_device *udev; 319 struct usb_device *udev;
315 struct usb_interface *interface; 320 struct usb_interface *interface;
316 struct nfc_dev *nfc_dev; 321 struct nfc_dev *nfc_dev;
317 u32 device_type; 322 u32 device_type;
323 enum pn533_protocol_type protocol_type;
318 324
319 struct urb *out_urb; 325 struct urb *out_urb;
320 struct urb *in_urb; 326 struct urb *in_urb;
@@ -646,9 +652,17 @@ static int __pn533_send_frame_async(struct pn533 *dev,
646 if (rc) 652 if (rc)
647 return rc; 653 return rc;
648 654
649 rc = pn533_submit_urb_for_ack(dev, GFP_KERNEL); 655 if (dev->protocol_type == PN533_PROTO_REQ_RESP) {
650 if (rc) 656 /* request for response for sent packet directly */
651 goto error; 657 rc = pn533_submit_urb_for_response(dev, GFP_ATOMIC);
658 if (rc)
659 goto error;
660 } else if (dev->protocol_type == PN533_PROTO_REQ_ACK_RESP) {
661 /* request for ACK if that's the case */
662 rc = pn533_submit_urb_for_ack(dev, GFP_KERNEL);
663 if (rc)
664 goto error;
665 }
652 666
653 return 0; 667 return 0;
654 668
@@ -2485,6 +2499,7 @@ static int pn533_probe(struct usb_interface *interface,
2485 2499
2486 dev->ops = &pn533_std_frame_ops; 2500 dev->ops = &pn533_std_frame_ops;
2487 2501
2502 dev->protocol_type = PN533_PROTO_REQ_ACK_RESP;
2488 dev->device_type = id->driver_info; 2503 dev->device_type = id->driver_info;
2489 switch (dev->device_type) { 2504 switch (dev->device_type) {
2490 case PN533_DEVICE_STD: 2505 case PN533_DEVICE_STD: