Commit c11f02ed authored by Michael Hennerich's avatar Michael Hennerich Committed by Greg Kroah-Hartman

staging:iio:adc:ad7291: reset device and setup irq before it is enabled

Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 06420c2d
...@@ -586,8 +586,10 @@ static int __devinit ad7291_probe(struct i2c_client *client, ...@@ -586,8 +586,10 @@ static int __devinit ad7291_probe(struct i2c_client *client,
i2c_set_clientdata(client, indio_dev); i2c_set_clientdata(client, indio_dev);
chip->client = client; chip->client = client;
/* Tsense always enabled */
chip->command = AD7291_NOISE_DELAY | AD7291_T_SENSE_MASK; chip->command = AD7291_NOISE_DELAY |
AD7291_T_SENSE_MASK | /* Tsense always enabled */
AD7291_ALERT_POLARITY; /* set irq polarity low level */
if (voltage_uv) { if (voltage_uv) {
chip->int_vref_mv = voltage_uv / 1000; chip->int_vref_mv = voltage_uv / 1000;
...@@ -604,6 +606,18 @@ static int __devinit ad7291_probe(struct i2c_client *client, ...@@ -604,6 +606,18 @@ static int __devinit ad7291_probe(struct i2c_client *client,
indio_dev->info = &ad7291_info; indio_dev->info = &ad7291_info;
indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->modes = INDIO_DIRECT_MODE;
ret = ad7291_i2c_write(chip, AD7291_COMMAND, AD7291_RESET);
if (ret) {
ret = -EIO;
goto error_disable_reg;
}
ret = ad7291_i2c_write(chip, AD7291_COMMAND, chip->command);
if (ret) {
ret = -EIO;
goto error_disable_reg;
}
if (client->irq > 0) { if (client->irq > 0) {
ret = request_threaded_irq(client->irq, ret = request_threaded_irq(client->irq,
NULL, NULL,
...@@ -613,15 +627,6 @@ static int __devinit ad7291_probe(struct i2c_client *client, ...@@ -613,15 +627,6 @@ static int __devinit ad7291_probe(struct i2c_client *client,
indio_dev); indio_dev);
if (ret) if (ret)
goto error_disable_reg; goto error_disable_reg;
/* set irq polarity low level */
chip->command |= AD7291_ALERT_POLARITY;
}
ret = ad7291_i2c_write(chip, AD7291_COMMAND, chip->command);
if (ret) {
ret = -EIO;
goto error_unreg_irq;
} }
ret = iio_device_register(indio_dev); ret = iio_device_register(indio_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment