diff options
Diffstat (limited to 'drivers/nfc/st21nfcb/i2c.c')
-rw-r--r-- | drivers/nfc/st21nfcb/i2c.c | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/drivers/nfc/st21nfcb/i2c.c b/drivers/nfc/st21nfcb/i2c.c index c5d2427a3db2..01ba865863ee 100644 --- a/drivers/nfc/st21nfcb/i2c.c +++ b/drivers/nfc/st21nfcb/i2c.c | |||
@@ -50,7 +50,6 @@ struct st21nfcb_i2c_phy { | |||
50 | struct i2c_client *i2c_dev; | 50 | struct i2c_client *i2c_dev; |
51 | struct llt_ndlc *ndlc; | 51 | struct llt_ndlc *ndlc; |
52 | 52 | ||
53 | unsigned int gpio_irq; | ||
54 | unsigned int gpio_reset; | 53 | unsigned int gpio_reset; |
55 | unsigned int irq_polarity; | 54 | unsigned int irq_polarity; |
56 | 55 | ||
@@ -81,8 +80,6 @@ static void st21nfcb_nci_i2c_disable(void *phy_id) | |||
81 | { | 80 | { |
82 | struct st21nfcb_i2c_phy *phy = phy_id; | 81 | struct st21nfcb_i2c_phy *phy = phy_id; |
83 | 82 | ||
84 | pr_info("\n"); | ||
85 | |||
86 | phy->powered = 0; | 83 | phy->powered = 0; |
87 | /* reset chip in order to flush clf */ | 84 | /* reset chip in order to flush clf */ |
88 | gpio_set_value(phy->gpio_reset, 0); | 85 | gpio_set_value(phy->gpio_reset, 0); |
@@ -258,19 +255,11 @@ static int st21nfcb_nci_i2c_of_request_resources(struct i2c_client *client) | |||
258 | GPIOF_OUT_INIT_HIGH, "clf_reset"); | 255 | GPIOF_OUT_INIT_HIGH, "clf_reset"); |
259 | if (r) { | 256 | if (r) { |
260 | nfc_err(&client->dev, "Failed to request reset pin\n"); | 257 | nfc_err(&client->dev, "Failed to request reset pin\n"); |
261 | return -ENODEV; | ||
262 | } | ||
263 | phy->gpio_reset = gpio; | ||
264 | |||
265 | /* IRQ */ | ||
266 | r = irq_of_parse_and_map(pp, 0); | ||
267 | if (r < 0) { | ||
268 | nfc_err(&client->dev, "Unable to get irq, error: %d\n", r); | ||
269 | return r; | 258 | return r; |
270 | } | 259 | } |
260 | phy->gpio_reset = gpio; | ||
271 | 261 | ||
272 | phy->irq_polarity = irq_get_trigger_type(r); | 262 | phy->irq_polarity = irq_get_trigger_type(client->irq); |
273 | client->irq = r; | ||
274 | 263 | ||
275 | return 0; | 264 | return 0; |
276 | } | 265 | } |
@@ -286,7 +275,6 @@ static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client) | |||
286 | struct st21nfcb_nfc_platform_data *pdata; | 275 | struct st21nfcb_nfc_platform_data *pdata; |
287 | struct st21nfcb_i2c_phy *phy = i2c_get_clientdata(client); | 276 | struct st21nfcb_i2c_phy *phy = i2c_get_clientdata(client); |
288 | int r; | 277 | int r; |
289 | int irq; | ||
290 | 278 | ||
291 | pdata = client->dev.platform_data; | 279 | pdata = client->dev.platform_data; |
292 | if (pdata == NULL) { | 280 | if (pdata == NULL) { |
@@ -295,33 +283,15 @@ static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client) | |||
295 | } | 283 | } |
296 | 284 | ||
297 | /* store for later use */ | 285 | /* store for later use */ |
298 | phy->gpio_irq = pdata->gpio_irq; | ||
299 | phy->gpio_reset = pdata->gpio_reset; | 286 | phy->gpio_reset = pdata->gpio_reset; |
300 | phy->irq_polarity = pdata->irq_polarity; | 287 | phy->irq_polarity = pdata->irq_polarity; |
301 | 288 | ||
302 | r = devm_gpio_request_one(&client->dev, phy->gpio_irq, | ||
303 | GPIOF_IN, "clf_irq"); | ||
304 | if (r) { | ||
305 | pr_err("%s : gpio_request failed\n", __FILE__); | ||
306 | return -ENODEV; | ||
307 | } | ||
308 | |||
309 | r = devm_gpio_request_one(&client->dev, | 289 | r = devm_gpio_request_one(&client->dev, |
310 | phy->gpio_reset, GPIOF_OUT_INIT_HIGH, "clf_reset"); | 290 | phy->gpio_reset, GPIOF_OUT_INIT_HIGH, "clf_reset"); |
311 | if (r) { | 291 | if (r) { |
312 | pr_err("%s : reset gpio_request failed\n", __FILE__); | 292 | pr_err("%s : reset gpio_request failed\n", __FILE__); |
313 | return -ENODEV; | 293 | return r; |
314 | } | ||
315 | |||
316 | /* IRQ */ | ||
317 | irq = gpio_to_irq(phy->gpio_irq); | ||
318 | if (irq < 0) { | ||
319 | nfc_err(&client->dev, | ||
320 | "Unable to get irq number for GPIO %d error %d\n", | ||
321 | phy->gpio_irq, r); | ||
322 | return -ENODEV; | ||
323 | } | 294 | } |
324 | client->irq = irq; | ||
325 | 295 | ||
326 | return 0; | 296 | return 0; |
327 | } | 297 | } |
@@ -401,10 +371,13 @@ static int st21nfcb_nci_i2c_remove(struct i2c_client *client) | |||
401 | return 0; | 371 | return 0; |
402 | } | 372 | } |
403 | 373 | ||
374 | #ifdef CONFIG_OF | ||
404 | static const struct of_device_id of_st21nfcb_i2c_match[] = { | 375 | static const struct of_device_id of_st21nfcb_i2c_match[] = { |
405 | { .compatible = "st,st21nfcb_i2c", }, | 376 | { .compatible = "st,st21nfcb_i2c", }, |
406 | {} | 377 | {} |
407 | }; | 378 | }; |
379 | MODULE_DEVICE_TABLE(of, of_st21nfcb_i2c_match); | ||
380 | #endif | ||
408 | 381 | ||
409 | static struct i2c_driver st21nfcb_nci_i2c_driver = { | 382 | static struct i2c_driver st21nfcb_nci_i2c_driver = { |
410 | .driver = { | 383 | .driver = { |