pinctrl: lynxpoint: Introduce helpers to enable or disable input
Introduce couple of helpers to enable or disable input. i.e. lp_gpio_enable_input() and lp_gpio_disable_input(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
parent
f3e7d28122
commit
0472567ba8
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue