diff options
author | Richard Zhu <Richard.Zhu@freescale.com> | 2015-04-17 13:39:11 +0800 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2015-05-08 17:25:02 +0800 |
commit | 1d36ac2afe42441825129f6494d0a691ad8ce2bd (patch) | |
tree | 2cc81863f4bd1e4a93b93cece809ce5236474c1d /drivers | |
parent | 68e6e68e0f22c1adb2ce94aae998a649eb1efb9b (diff) |
MLK-10610-2 gpio: 74x164: add the runtime pm
Since the spi expansion gpio maybe manipulated,
during spi driver is suspend.
Such as the PCIE_RST_B on imx7d sdb board.
Add runtime pm into spi expansion gpio driver
Signed-off-by: Gao Pan <b54642@freescale.com>
Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpio/gpio-74x164.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index 9f26de0c11e7..c35114ec541e 100644 --- a/drivers/gpio/gpio-74x164.c +++ b/drivers/gpio/gpio-74x164.c @@ -16,6 +16,7 @@ #include <linux/of_gpio.h> #include <linux/slab.h> #include <linux/module.h> +#include <linux/pm_runtime.h> #define GEN_74X164_NUMBER_GPIOS 8 @@ -73,9 +74,11 @@ static int gen_74x164_get_value(struct gpio_chip *gc, unsigned offset) u8 pin = offset % 8; int ret; + pm_runtime_get_sync(gc->dev); mutex_lock(&chip->lock); ret = (chip->buffer[bank] >> pin) & 0x1; mutex_unlock(&chip->lock); + pm_runtime_put(gc->dev); return ret; } @@ -87,6 +90,7 @@ static void gen_74x164_set_value(struct gpio_chip *gc, u8 bank = offset / 8; u8 pin = offset % 8; + pm_runtime_get_sync(gc->dev); mutex_lock(&chip->lock); if (val) chip->buffer[bank] |= (1 << pin); @@ -95,6 +99,7 @@ static void gen_74x164_set_value(struct gpio_chip *gc, __gen_74x164_write_config(chip); mutex_unlock(&chip->lock); + pm_runtime_put(gc->dev); } static int gen_74x164_direction_output(struct gpio_chip *gc, @@ -109,6 +114,7 @@ static int gen_74x164_probe(struct spi_device *spi) struct gen_74x164_chip *chip; int ret; + pm_runtime_enable(&spi->dev); /* * bits_per_word cannot be configured in platform data */ @@ -172,6 +178,7 @@ static int gen_74x164_remove(struct spi_device *spi) struct gen_74x164_chip *chip = spi_get_drvdata(spi); int ret; + pm_runtime_disable(&spi->dev); ret = gpiochip_remove(&chip->gpio_chip); if (!ret) mutex_destroy(&chip->lock); |