Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Jean-Baptiste Maneyrol and committed by
Jonathan Cameron
b1ba4326 6b4079cc

+15 -7
+1 -1
drivers/iio/imu/inv_icm42600/inv_icm42600.h
··· 426 426 int inv_icm42600_debugfs_reg(struct iio_dev *indio_dev, unsigned int reg, 427 427 unsigned int writeval, unsigned int *readval); 428 428 429 - int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq, 429 + int inv_icm42600_core_probe(struct regmap *regmap, int chip, 430 430 inv_icm42600_bus_setup bus_setup); 431 431 432 432 struct iio_dev *inv_icm42600_gyro_init(struct inv_icm42600_state *st);
+12 -2
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
··· 683 683 pm_runtime_disable(dev); 684 684 } 685 685 686 - int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq, 686 + int inv_icm42600_core_probe(struct regmap *regmap, int chip, 687 687 inv_icm42600_bus_setup bus_setup) 688 688 { 689 689 struct device *dev = regmap_get_device(regmap); 690 + struct fwnode_handle *fwnode = dev_fwnode(dev); 690 691 struct inv_icm42600_state *st; 691 - int irq_type; 692 + int irq, irq_type; 692 693 bool open_drain; 693 694 int ret; 694 695 ··· 697 696 dev_err(dev, "invalid chip = %d\n", chip); 698 697 return -ENODEV; 699 698 } 699 + 700 + /* get INT1 only supported interrupt or fallback to first interrupt */ 701 + irq = fwnode_irq_get_byname(fwnode, "INT1"); 702 + if (irq < 0 && irq != -EPROBE_DEFER) { 703 + dev_info(dev, "no INT1 interrupt defined, fallback to first interrupt\n"); 704 + irq = fwnode_irq_get(fwnode, 0); 705 + } 706 + if (irq < 0) 707 + return dev_err_probe(dev, irq, "error missing INT1 interrupt\n"); 700 708 701 709 irq_type = irq_get_trigger_type(irq); 702 710 if (!irq_type)
+1 -2
drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
··· 67 67 if (IS_ERR(regmap)) 68 68 return PTR_ERR(regmap); 69 69 70 - return inv_icm42600_core_probe(regmap, chip, client->irq, 71 - inv_icm42600_i2c_bus_setup); 70 + return inv_icm42600_core_probe(regmap, chip, inv_icm42600_i2c_bus_setup); 72 71 } 73 72 74 73 /*
+1 -2
drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
··· 64 64 if (IS_ERR(regmap)) 65 65 return PTR_ERR(regmap); 66 66 67 - return inv_icm42600_core_probe(regmap, chip, spi->irq, 68 - inv_icm42600_spi_bus_setup); 67 + return inv_icm42600_core_probe(regmap, chip, inv_icm42600_spi_bus_setup); 69 68 } 70 69 71 70 /*