mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
iio: imu: inv_icm42670: use gpiod_to_irq to get interrupts instead
Change-Id: I968b7f0186d0ad3bbe926a47dbed2f173d6538ce Signed-off-by: LiuDiMing Lin <fenrir.lin@rock-chips.com>
This commit is contained in:
@@ -520,7 +520,7 @@ struct icm42670_data {
|
||||
struct regmap *regmap;
|
||||
struct iio_trigger *trig;
|
||||
struct device_node *node;
|
||||
int int1_gpio;
|
||||
struct gpio_desc *int1_gpiod;
|
||||
struct regulator *vdd_supply;
|
||||
struct regulator *vddio_supply;
|
||||
u16 accel_frequency;
|
||||
|
||||
@@ -1092,10 +1092,6 @@ static int icm42670_chip_init(struct icm42670_data *data, icm42670_bus_setup bus
|
||||
dev_err(dev, "reset done status bit missing (%0x)\n", regval);
|
||||
return -ENODEV;
|
||||
}
|
||||
// Configure the INT1 GPIO as input
|
||||
ret = gpio_direction_input(data->int1_gpio);
|
||||
if (ret < 0)
|
||||
dev_err(dev, "gpio_direction_input failed!\r\n");
|
||||
|
||||
/* set chip bus configuration */
|
||||
ret = bus_setup(data);
|
||||
@@ -1224,11 +1220,16 @@ int icm42670_core_probe(struct regmap *regmap,
|
||||
if (data->node == NULL)
|
||||
dev_err(dev, "ic2 node not find!\n");
|
||||
|
||||
data->int1_gpio = of_get_named_gpio(data->node, "int1-gpio", 0);
|
||||
if (data->int1_gpio < 0) {
|
||||
dev_err(dev, "Could not get int1_gpio!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
data->int1_gpiod = devm_gpiod_get(dev, "int1", GPIOD_IN);
|
||||
if (IS_ERR(data->int1_gpiod))
|
||||
return dev_err_probe(dev, PTR_ERR(data->int1_gpiod), "Could not get int1 gpio\n");
|
||||
|
||||
/* Get the same result through gpiod_to_irq to ensure that
|
||||
* the affinity can be restored after CPU off/on
|
||||
*/
|
||||
irq = gpiod_to_irq(data->int1_gpiod);
|
||||
if (irq < 0)
|
||||
return dev_err_probe(dev, irq, "Could not get IRQ from GPIO\n");
|
||||
|
||||
data->enable_fifo = of_property_read_bool(data->node, "enable-fifo");
|
||||
if (true != data->enable_fifo)
|
||||
|
||||
Reference in New Issue
Block a user