diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2012-05-15 09:57:06 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-06-04 15:34:29 -0400 |
commit | fe7c580073280c15bb4eb4f82bf20dddc1a68383 (patch) | |
tree | 0b71c488d1b3cdd87dd5e05ccd0224b496fec2f9 /drivers/nfc/pn533.c | |
parent | ab73b751303bc60d7d9fba875c958dedfe14754c (diff) |
NFC: Add target mode protocols to the polling loop startup routine
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/pn533.c')
-rw-r--r-- | drivers/nfc/pn533.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c index 19110f0eb15f..38a523c62132 100644 --- a/drivers/nfc/pn533.c +++ b/drivers/nfc/pn533.c | |||
@@ -1078,27 +1078,23 @@ stop_poll: | |||
1078 | return 0; | 1078 | return 0; |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | static int pn533_start_poll(struct nfc_dev *nfc_dev, u32 protocols) | 1081 | static int pn533_init_target(struct nfc_dev *nfc_dev, u32 protocols) |
1082 | { | ||
1083 | return 0; | ||
1084 | } | ||
1085 | |||
1086 | static int pn533_start_im_poll(struct nfc_dev *nfc_dev, u32 protocols) | ||
1082 | { | 1087 | { |
1083 | struct pn533 *dev = nfc_get_drvdata(nfc_dev); | 1088 | struct pn533 *dev = nfc_get_drvdata(nfc_dev); |
1084 | struct pn533_poll_modulations *start_mod; | 1089 | struct pn533_poll_modulations *start_mod; |
1085 | int rc; | 1090 | int rc; |
1086 | 1091 | ||
1087 | nfc_dev_dbg(&dev->interface->dev, "%s - protocols=0x%x", __func__, | ||
1088 | protocols); | ||
1089 | |||
1090 | if (dev->poll_mod_count) { | 1092 | if (dev->poll_mod_count) { |
1091 | nfc_dev_err(&dev->interface->dev, "Polling operation already" | 1093 | nfc_dev_err(&dev->interface->dev, "Polling operation already" |
1092 | " active"); | 1094 | " active"); |
1093 | return -EBUSY; | 1095 | return -EBUSY; |
1094 | } | 1096 | } |
1095 | 1097 | ||
1096 | if (dev->tgt_active_prot) { | ||
1097 | nfc_dev_err(&dev->interface->dev, "Cannot poll with a target" | ||
1098 | " already activated"); | ||
1099 | return -EBUSY; | ||
1100 | } | ||
1101 | |||
1102 | pn533_poll_create_mod_list(dev, protocols); | 1098 | pn533_poll_create_mod_list(dev, protocols); |
1103 | 1099 | ||
1104 | if (!dev->poll_mod_count) { | 1100 | if (!dev->poll_mod_count) { |
@@ -1135,6 +1131,29 @@ error: | |||
1135 | return rc; | 1131 | return rc; |
1136 | } | 1132 | } |
1137 | 1133 | ||
1134 | static int pn533_start_poll(struct nfc_dev *nfc_dev, | ||
1135 | u32 im_protocols, u32 tm_protocols) | ||
1136 | { | ||
1137 | struct pn533 *dev = nfc_get_drvdata(nfc_dev); | ||
1138 | |||
1139 | nfc_dev_dbg(&dev->interface->dev, | ||
1140 | "%s: im protocols 0x%x tm protocols 0x%x", | ||
1141 | __func__, im_protocols, tm_protocols); | ||
1142 | |||
1143 | if (dev->tgt_active_prot) { | ||
1144 | nfc_dev_err(&dev->interface->dev, | ||
1145 | "Cannot poll with a target already activated"); | ||
1146 | return -EBUSY; | ||
1147 | } | ||
1148 | |||
1149 | if (!tm_protocols) | ||
1150 | return pn533_start_im_poll(nfc_dev, im_protocols); | ||
1151 | else if (!im_protocols) | ||
1152 | return pn533_init_target(nfc_dev, tm_protocols); | ||
1153 | else | ||
1154 | return -EINVAL; | ||
1155 | } | ||
1156 | |||
1138 | static void pn533_stop_poll(struct nfc_dev *nfc_dev) | 1157 | static void pn533_stop_poll(struct nfc_dev *nfc_dev) |
1139 | { | 1158 | { |
1140 | struct pn533 *dev = nfc_get_drvdata(nfc_dev); | 1159 | struct pn533 *dev = nfc_get_drvdata(nfc_dev); |