diff options
-rw-r--r-- | drivers/iio/proximity/sx9500.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c index 53c5d653e780..df23dbcc030a 100644 --- a/drivers/iio/proximity/sx9500.c +++ b/drivers/iio/proximity/sx9500.c | |||
@@ -869,6 +869,7 @@ static int sx9500_init_device(struct iio_dev *indio_dev) | |||
869 | static void sx9500_gpio_probe(struct i2c_client *client, | 869 | static void sx9500_gpio_probe(struct i2c_client *client, |
870 | struct sx9500_data *data) | 870 | struct sx9500_data *data) |
871 | { | 871 | { |
872 | struct gpio_desc *gpiod_int; | ||
872 | struct device *dev; | 873 | struct device *dev; |
873 | 874 | ||
874 | if (!client) | 875 | if (!client) |
@@ -876,6 +877,14 @@ static void sx9500_gpio_probe(struct i2c_client *client, | |||
876 | 877 | ||
877 | dev = &client->dev; | 878 | dev = &client->dev; |
878 | 879 | ||
880 | if (client->irq <= 0) { | ||
881 | gpiod_int = devm_gpiod_get(dev, SX9500_GPIO_INT, GPIOD_IN); | ||
882 | if (IS_ERR(gpiod_int)) | ||
883 | dev_err(dev, "gpio get irq failed\n"); | ||
884 | else | ||
885 | client->irq = gpiod_to_irq(gpiod_int); | ||
886 | } | ||
887 | |||
879 | data->gpiod_rst = devm_gpiod_get(dev, SX9500_GPIO_RESET, GPIOD_OUT_HIGH); | 888 | data->gpiod_rst = devm_gpiod_get(dev, SX9500_GPIO_RESET, GPIOD_OUT_HIGH); |
880 | if (IS_ERR(data->gpiod_rst)) { | 889 | if (IS_ERR(data->gpiod_rst)) { |
881 | dev_warn(dev, "gpio get reset pin failed\n"); | 890 | dev_warn(dev, "gpio get reset pin failed\n"); |