mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 05:39:42 -04:00
iio: imu: inv_icm42600: switch to use generic name irq get
Use generic fwnode_irq_get_byname() for getting interrupt pin using interrupt name. Only INT1 is supported by the driver currently. If not found fallback to first defined interrupt to keep compatibility. Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Link: https://patch.msgid.link/20250410-iio-imu-inv-icm42600-rework-interrupt-using-names-v4-2-19e4e2f8f7eb@tdk.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
6b4079ccbf
commit
b1ba43263e
@@ -426,7 +426,7 @@ int inv_icm42600_set_temp_conf(struct inv_icm42600_state *st, bool enable,
|
||||
int inv_icm42600_debugfs_reg(struct iio_dev *indio_dev, unsigned int reg,
|
||||
unsigned int writeval, unsigned int *readval);
|
||||
|
||||
int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
|
||||
int inv_icm42600_core_probe(struct regmap *regmap, int chip,
|
||||
inv_icm42600_bus_setup bus_setup);
|
||||
|
||||
struct iio_dev *inv_icm42600_gyro_init(struct inv_icm42600_state *st);
|
||||
|
||||
@@ -683,12 +683,13 @@ static void inv_icm42600_disable_pm(void *_data)
|
||||
pm_runtime_disable(dev);
|
||||
}
|
||||
|
||||
int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
|
||||
int inv_icm42600_core_probe(struct regmap *regmap, int chip,
|
||||
inv_icm42600_bus_setup bus_setup)
|
||||
{
|
||||
struct device *dev = regmap_get_device(regmap);
|
||||
struct fwnode_handle *fwnode = dev_fwnode(dev);
|
||||
struct inv_icm42600_state *st;
|
||||
int irq_type;
|
||||
int irq, irq_type;
|
||||
bool open_drain;
|
||||
int ret;
|
||||
|
||||
@@ -697,6 +698,15 @@ int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* get INT1 only supported interrupt or fallback to first interrupt */
|
||||
irq = fwnode_irq_get_byname(fwnode, "INT1");
|
||||
if (irq < 0 && irq != -EPROBE_DEFER) {
|
||||
dev_info(dev, "no INT1 interrupt defined, fallback to first interrupt\n");
|
||||
irq = fwnode_irq_get(fwnode, 0);
|
||||
}
|
||||
if (irq < 0)
|
||||
return dev_err_probe(dev, irq, "error missing INT1 interrupt\n");
|
||||
|
||||
irq_type = irq_get_trigger_type(irq);
|
||||
if (!irq_type)
|
||||
irq_type = IRQF_TRIGGER_FALLING;
|
||||
|
||||
@@ -67,8 +67,7 @@ static int inv_icm42600_probe(struct i2c_client *client)
|
||||
if (IS_ERR(regmap))
|
||||
return PTR_ERR(regmap);
|
||||
|
||||
return inv_icm42600_core_probe(regmap, chip, client->irq,
|
||||
inv_icm42600_i2c_bus_setup);
|
||||
return inv_icm42600_core_probe(regmap, chip, inv_icm42600_i2c_bus_setup);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -64,8 +64,7 @@ static int inv_icm42600_probe(struct spi_device *spi)
|
||||
if (IS_ERR(regmap))
|
||||
return PTR_ERR(regmap);
|
||||
|
||||
return inv_icm42600_core_probe(regmap, chip, spi->irq,
|
||||
inv_icm42600_spi_bus_setup);
|
||||
return inv_icm42600_core_probe(regmap, chip, inv_icm42600_spi_bus_setup);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user