diff options
Diffstat (limited to 'drivers/iio/common/ssp_sensors/ssp_dev.c')
-rw-r--r-- | drivers/iio/common/ssp_sensors/ssp_dev.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/drivers/iio/common/ssp_sensors/ssp_dev.c b/drivers/iio/common/ssp_sensors/ssp_dev.c index 9c70553994c6..a94dbcf491ce 100644 --- a/drivers/iio/common/ssp_sensors/ssp_dev.c +++ b/drivers/iio/common/ssp_sensors/ssp_dev.c @@ -9,7 +9,6 @@ #include <linux/mfd/core.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_gpio.h> #include <linux/of_platform.h> #include "ssp.h" @@ -61,9 +60,9 @@ static const struct mfd_cell sensorhub_sensor_devs[] = { static void ssp_toggle_mcu_reset_gpio(struct ssp_data *data) { - gpio_set_value(data->mcu_reset_gpio, 0); + gpiod_set_value(data->mcu_reset_gpiod, 0); usleep_range(1000, 1200); - gpio_set_value(data->mcu_reset_gpio, 1); + gpiod_set_value(data->mcu_reset_gpiod, 1); msleep(50); } @@ -441,7 +440,6 @@ MODULE_DEVICE_TABLE(of, ssp_of_match); static struct ssp_data *ssp_parse_dt(struct device *dev) { - int ret; struct ssp_data *data; struct device_node *node = dev->of_node; const struct of_device_id *match; @@ -450,26 +448,17 @@ static struct ssp_data *ssp_parse_dt(struct device *dev) if (!data) return NULL; - data->mcu_ap_gpio = of_get_named_gpio(node, "mcu-ap-gpios", 0); - if (data->mcu_ap_gpio < 0) - return NULL; - - data->ap_mcu_gpio = of_get_named_gpio(node, "ap-mcu-gpios", 0); - if (data->ap_mcu_gpio < 0) - return NULL; - - data->mcu_reset_gpio = of_get_named_gpio(node, "mcu-reset-gpios", 0); - if (data->mcu_reset_gpio < 0) + data->mcu_ap_gpiod = devm_gpiod_get(dev, "mcu-ap", GPIOD_IN); + if (IS_ERR(data->mcu_ap_gpiod)) return NULL; - ret = devm_gpio_request_one(dev, data->ap_mcu_gpio, GPIOF_OUT_INIT_HIGH, - "ap-mcu-gpios"); - if (ret) + data->ap_mcu_gpiod = devm_gpiod_get(dev, "ap-mcu", GPIOD_OUT_HIGH); + if (IS_ERR(data->ap_mcu_gpiod)) return NULL; - ret = devm_gpio_request_one(dev, data->mcu_reset_gpio, - GPIOF_OUT_INIT_HIGH, "mcu-reset-gpios"); - if (ret) + data->mcu_reset_gpiod = devm_gpiod_get(dev, "mcu-reset", + GPIOD_OUT_HIGH); + if (IS_ERR(data->mcu_reset_gpiod)) return NULL; match = of_match_node(ssp_of_match, node); |