Merge "NFC: Fix crash due to invalid use of ese gpio"
This commit is contained in:
commit
3225611f1d
1 changed files with 18 additions and 10 deletions
|
@ -325,9 +325,11 @@ static int nqx_ese_pwr(struct nqx_dev *nqx_dev, unsigned long int arg)
|
||||||
} else if (arg == 3) {
|
} else if (arg == 3) {
|
||||||
if (!nqx_dev->nfc_ven_enabled)
|
if (!nqx_dev->nfc_ven_enabled)
|
||||||
r = 0;
|
r = 0;
|
||||||
else
|
else {
|
||||||
|
if (gpio_is_valid(nqx_dev->ese_gpio))
|
||||||
r = gpio_get_value(nqx_dev->ese_gpio);
|
r = gpio_get_value(nqx_dev->ese_gpio);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,12 +377,15 @@ int nfc_ioctl_power_states(struct file *filp, unsigned long arg)
|
||||||
__func__, nqx_dev);
|
__func__, nqx_dev);
|
||||||
if (gpio_is_valid(nqx_dev->firm_gpio))
|
if (gpio_is_valid(nqx_dev->firm_gpio))
|
||||||
gpio_set_value(nqx_dev->firm_gpio, 0);
|
gpio_set_value(nqx_dev->firm_gpio, 0);
|
||||||
|
|
||||||
|
if (gpio_is_valid(nqx_dev->ese_gpio)) {
|
||||||
if (!gpio_get_value(nqx_dev->ese_gpio)) {
|
if (!gpio_get_value(nqx_dev->ese_gpio)) {
|
||||||
dev_dbg(&nqx_dev->client->dev, "disabling en_gpio\n");
|
dev_dbg(&nqx_dev->client->dev, "disabling en_gpio\n");
|
||||||
gpio_set_value(nqx_dev->en_gpio, 0);
|
gpio_set_value(nqx_dev->en_gpio, 0);
|
||||||
} else {
|
} else {
|
||||||
dev_dbg(&nqx_dev->client->dev, "keeping en_gpio high\n");
|
dev_dbg(&nqx_dev->client->dev, "keeping en_gpio high\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
r = nqx_clock_deselect(nqx_dev);
|
r = nqx_clock_deselect(nqx_dev);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
dev_err(&nqx_dev->client->dev, "unable to disable clock\n");
|
dev_err(&nqx_dev->client->dev, "unable to disable clock\n");
|
||||||
|
@ -405,10 +410,12 @@ int nfc_ioctl_power_states(struct file *filp, unsigned long arg)
|
||||||
* We are switching to Dowload Mode, toggle the enable pin
|
* We are switching to Dowload Mode, toggle the enable pin
|
||||||
* in order to set the NFCC in the new mode
|
* in order to set the NFCC in the new mode
|
||||||
*/
|
*/
|
||||||
|
if (gpio_is_valid(nqx_dev->ese_gpio)) {
|
||||||
if (gpio_get_value(nqx_dev->ese_gpio)) {
|
if (gpio_get_value(nqx_dev->ese_gpio)) {
|
||||||
dev_err(&nqx_dev->client->dev, "FW download forbidden while ese is on\n");
|
dev_err(&nqx_dev->client->dev, "FW download forbidden while ese is on\n");
|
||||||
return -EBUSY; /* Device or resource busy */
|
return -EBUSY; /* Device or resource busy */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
gpio_set_value(nqx_dev->en_gpio, 1);
|
gpio_set_value(nqx_dev->en_gpio, 1);
|
||||||
msleep(20);
|
msleep(20);
|
||||||
if (gpio_is_valid(nqx_dev->firm_gpio))
|
if (gpio_is_valid(nqx_dev->firm_gpio))
|
||||||
|
@ -828,6 +835,7 @@ static int nqx_probe(struct i2c_client *client,
|
||||||
nqx_dev->en_gpio = platform_data->en_gpio;
|
nqx_dev->en_gpio = platform_data->en_gpio;
|
||||||
nqx_dev->irq_gpio = platform_data->irq_gpio;
|
nqx_dev->irq_gpio = platform_data->irq_gpio;
|
||||||
nqx_dev->firm_gpio = platform_data->firm_gpio;
|
nqx_dev->firm_gpio = platform_data->firm_gpio;
|
||||||
|
nqx_dev->ese_gpio = platform_data->ese_gpio;
|
||||||
nqx_dev->clkreq_gpio = platform_data->clkreq_gpio;
|
nqx_dev->clkreq_gpio = platform_data->clkreq_gpio;
|
||||||
nqx_dev->pdata = platform_data;
|
nqx_dev->pdata = platform_data;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue