aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc/pn533.c
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2013-04-11 05:45:41 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-04-11 10:29:11 -0400
commit60d9edd50b9b9c5b9cb434ebea7892057ae4b889 (patch)
tree29f538e83270277d47b5e822983a1e548f7f1328 /drivers/nfc/pn533.c
parent7757dc8a3e7658abb6e5fc7d825a38b27961d0c8 (diff)
NFC: pn533: Turn radio on and off when bringing the device up and down
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/pn533.c')
-rw-r--r--drivers/nfc/pn533.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 3569b9e621ea..8f6f2baa930d 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -163,9 +163,13 @@ struct pn533_fw_version {
163}; 163};
164 164
165/* PN533_CMD_RF_CONFIGURATION */ 165/* PN533_CMD_RF_CONFIGURATION */
166#define PN533_CFGITEM_TIMING 0x02 166#define PN533_CFGITEM_RF_FIELD 0x01
167#define PN533_CFGITEM_TIMING 0x02
167#define PN533_CFGITEM_MAX_RETRIES 0x05 168#define PN533_CFGITEM_MAX_RETRIES 0x05
168#define PN533_CFGITEM_PASORI 0x82 169#define PN533_CFGITEM_PASORI 0x82
170
171#define PN533_CFGITEM_RF_FIELD_ON 0x1
172#define PN533_CFGITEM_RF_FIELD_OFF 0x0
169 173
170#define PN533_CONFIG_TIMING_102 0xb 174#define PN533_CONFIG_TIMING_102 0xb
171#define PN533_CONFIG_TIMING_204 0xc 175#define PN533_CONFIG_TIMING_204 0xc
@@ -2540,9 +2544,36 @@ static int pn533_acr122_poweron_rdr(struct pn533 *dev)
2540 return arg.rc; 2544 return arg.rc;
2541} 2545}
2542 2546
2547static int pn533_rf_field(struct nfc_dev *nfc_dev, u8 rf)
2548{
2549 struct pn533 *dev = nfc_get_drvdata(nfc_dev);
2550 u8 rf_field = !!rf;
2551 int rc;
2552
2553 rc = pn533_set_configuration(dev, PN533_CFGITEM_RF_FIELD,
2554 (u8 *)&rf_field, 1);
2555 if (rc) {
2556 nfc_dev_err(&dev->interface->dev,
2557 "Error on setting RF field");
2558 return rc;
2559 }
2560
2561 return rc;
2562}
2563
2564int pn533_dev_up(struct nfc_dev *nfc_dev)
2565{
2566 return pn533_rf_field(nfc_dev, 1);
2567}
2568
2569int pn533_dev_down(struct nfc_dev *nfc_dev)
2570{
2571 return pn533_rf_field(nfc_dev, 0);
2572}
2573
2543static struct nfc_ops pn533_nfc_ops = { 2574static struct nfc_ops pn533_nfc_ops = {
2544 .dev_up = NULL, 2575 .dev_up = pn533_dev_up,
2545 .dev_down = NULL, 2576 .dev_down = pn533_dev_down,
2546 .dep_link_up = pn533_dep_link_up, 2577 .dep_link_up = pn533_dep_link_up,
2547 .dep_link_down = pn533_dep_link_down, 2578 .dep_link_down = pn533_dep_link_down,
2548 .start_poll = pn533_start_poll, 2579 .start_poll = pn533_start_poll,