Thierry Escande | 59ee236 | 2013-09-19 17:55:26 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * NFC Digital Protocol stack |
| 3 | * Copyright (c) 2013, Intel Corporation. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms and conditions of the GNU General Public License, |
| 7 | * version 2, as published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #include "digital.h" |
| 17 | |
| 18 | #define DIGITAL_CMD_SENS_REQ 0x26 |
| 19 | #define DIGITAL_CMD_ALL_REQ 0x52 |
| 20 | #define DIGITAL_CMD_SEL_REQ_CL1 0x93 |
| 21 | #define DIGITAL_CMD_SEL_REQ_CL2 0x95 |
| 22 | #define DIGITAL_CMD_SEL_REQ_CL3 0x97 |
| 23 | |
| 24 | #define DIGITAL_SDD_REQ_SEL_PAR 0x20 |
| 25 | |
| 26 | #define DIGITAL_SDD_RES_CT 0x88 |
| 27 | #define DIGITAL_SDD_RES_LEN 5 |
| 28 | |
| 29 | static void digital_in_recv_sens_res(struct nfc_digital_dev *ddev, void *arg, |
| 30 | struct sk_buff *resp) |
| 31 | { |
| 32 | if (!IS_ERR(resp)) |
| 33 | dev_kfree_skb(resp); |
| 34 | |
| 35 | digital_poll_next_tech(ddev); |
| 36 | } |
| 37 | |
| 38 | int digital_in_send_sens_req(struct nfc_digital_dev *ddev, u8 rf_tech) |
| 39 | { |
| 40 | struct sk_buff *skb; |
| 41 | int rc; |
| 42 | |
| 43 | rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH, |
| 44 | NFC_DIGITAL_RF_TECH_106A); |
| 45 | if (rc) |
| 46 | return rc; |
| 47 | |
| 48 | rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING, |
| 49 | NFC_DIGITAL_FRAMING_NFCA_SHORT); |
| 50 | if (rc) |
| 51 | return rc; |
| 52 | |
| 53 | skb = digital_skb_alloc(ddev, 1); |
| 54 | if (!skb) |
| 55 | return -ENOMEM; |
| 56 | |
| 57 | *skb_put(skb, sizeof(u8)) = DIGITAL_CMD_SENS_REQ; |
| 58 | |
| 59 | rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sens_res, NULL); |
| 60 | if (rc) |
| 61 | kfree_skb(skb); |
| 62 | |
| 63 | return rc; |
| 64 | } |