summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/intel/pinctrl-lynxpoint.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/pinctrl/intel/pinctrl-lynxpoint.c b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
index 2a3af998b91c..003d795528e8 100644
--- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c
+++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
@@ -386,6 +386,16 @@ static int lp_pinmux_set_mux(struct pinctrl_dev *pctldev,
return 0;
}
+static void lp_gpio_enable_input(void __iomem *reg)
+{
+ iowrite32(ioread32(reg) & ~GPINDIS_BIT, reg);
+}
+
+static void lp_gpio_disable_input(void __iomem *reg)
+{
+ iowrite32(ioread32(reg) | GPINDIS_BIT, reg);
+}
+
static int lp_gpio_request_enable(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range,
unsigned int pin)
@@ -411,7 +421,7 @@ static int lp_gpio_request_enable(struct pinctrl_dev *pctldev,
}
/* Enable input sensing */
- iowrite32(ioread32(conf2) & ~GPINDIS_BIT, conf2);
+ lp_gpio_enable_input(conf2);
raw_spin_unlock_irqrestore(&lg->lock, flags);
@@ -429,7 +439,7 @@ static void lp_gpio_disable_free(struct pinctrl_dev *pctldev,
raw_spin_lock_irqsave(&lg->lock, flags);
/* Disable input sensing */
- iowrite32(ioread32(conf2) | GPINDIS_BIT, conf2);
+ lp_gpio_disable_input(conf2);
raw_spin_unlock_irqrestore(&lg->lock, flags);
@@ -921,14 +931,11 @@ static int lp_gpio_resume(struct device *dev)
struct intel_pinctrl *lg = dev_get_drvdata(dev);
struct gpio_chip *chip = &lg->chip;
const char *dummy;
- void __iomem *reg;
int i;
/* on some hardware suspend clears input sensing, re-enable it here */
- for_each_requested_gpio(chip, i, dummy) {
- reg = lp_gpio_reg(chip, i, LP_CONFIG2);
- iowrite32(ioread32(reg) & ~GPINDIS_BIT, reg);
- }
+ for_each_requested_gpio(chip, i, dummy)
+ lp_gpio_enable_input(lp_gpio_reg(chip, i, LP_CONFIG2));
return 0;
}