Commit d4578dc0 authored by Matt Ranostay's avatar Matt Ranostay Committed by Jonathan Cameron

iio: chemical: atlas-sensor: allow probe without interrupt line

Sensors don't actually need a interrupt line to give valid readings,
and can triggered with CONFIG_IIO_HRTIMER_TRIGGER as well. Remove
the required check for interrupt, and continue along in the probe
function.
Signed-off-by: default avatarMatt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 74a40e19
...@@ -76,6 +76,7 @@ struct atlas_data { ...@@ -76,6 +76,7 @@ struct atlas_data {
struct atlas_device *chip; struct atlas_device *chip;
struct regmap *regmap; struct regmap *regmap;
struct irq_work work; struct irq_work work;
unsigned int interrupt_enabled;
__be32 buffer[6]; /* 96-bit data + 32-bit pad + 64-bit timestamp */ __be32 buffer[6]; /* 96-bit data + 32-bit pad + 64-bit timestamp */
}; };
...@@ -304,6 +305,9 @@ static int atlas_set_powermode(struct atlas_data *data, int on) ...@@ -304,6 +305,9 @@ static int atlas_set_powermode(struct atlas_data *data, int on)
static int atlas_set_interrupt(struct atlas_data *data, bool state) static int atlas_set_interrupt(struct atlas_data *data, bool state)
{ {
if (!data->interrupt_enabled)
return 0;
return regmap_update_bits(data->regmap, ATLAS_REG_INT_CONTROL, return regmap_update_bits(data->regmap, ATLAS_REG_INT_CONTROL,
ATLAS_REG_INT_CONTROL_EN, ATLAS_REG_INT_CONTROL_EN,
state ? ATLAS_REG_INT_CONTROL_EN : 0); state ? ATLAS_REG_INT_CONTROL_EN : 0);
...@@ -572,11 +576,6 @@ static int atlas_probe(struct i2c_client *client, ...@@ -572,11 +576,6 @@ static int atlas_probe(struct i2c_client *client,
if (ret) if (ret)
return ret; return ret;
if (client->irq <= 0) {
dev_err(&client->dev, "no valid irq defined\n");
return -EINVAL;
}
ret = chip->calibration(data); ret = chip->calibration(data);
if (ret) if (ret)
return ret; return ret;
...@@ -596,16 +595,20 @@ static int atlas_probe(struct i2c_client *client, ...@@ -596,16 +595,20 @@ static int atlas_probe(struct i2c_client *client,
init_irq_work(&data->work, atlas_work_handler); init_irq_work(&data->work, atlas_work_handler);
/* interrupt pin toggles on new conversion */ if (client->irq > 0) {
ret = devm_request_threaded_irq(&client->dev, client->irq, /* interrupt pin toggles on new conversion */
NULL, atlas_interrupt_handler, ret = devm_request_threaded_irq(&client->dev, client->irq,
IRQF_TRIGGER_RISING | NULL, atlas_interrupt_handler,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_RISING |
"atlas_irq", IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
indio_dev); "atlas_irq",
if (ret) { indio_dev);
dev_err(&client->dev, "request irq (%d) failed\n", client->irq);
goto unregister_buffer; if (ret)
dev_warn(&client->dev,
"request irq (%d) failed\n", client->irq);
else
data->interrupt_enabled = 1;
} }
ret = atlas_set_powermode(data, 1); ret = atlas_set_powermode(data, 1);
......
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