1
0
Fork 0

A few overdue GPIO patches for the v4.12 kernel:

- Fix debounce logic on the Aspeed platform.
 
 - Fix the "virtual gpio" things on the Intel Crystal Cove.
 
 - Fix the blink counter selection on the MVEBU platform.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJZPV5LAAoJEEEQszewGV1zGp4P/3j51eWRAa0WFJkfYvVRyaEK
 7ONoZIapHMOGG4NUX8dSYkhl1FdbAj+b2rcI3EXFU4ViYGAxwbiyKoHFLNT7iFmy
 dg1slDeQdmjtC7TAL8+SWm9txzWtXvH5VTEjumXyRDy1Flbu8ax62HbuIjGrrPAz
 urcn+ieh6oB7a1TCnKVQ/a9B5vo5bVFgyLq9Q3lfwdPxfQT3jr8tK10/H/83TAkQ
 UqCKWDSEv2UCHsfZQ+4X1P8H1UPFBs6kZHU4IKslmpfew8uPT9WTBth0BmlbgnDJ
 8pIPBR6/n0LoP9Mu44wDldmYs6oew7kDhJmEuY3xcfcoL/A52E9YiIE8h8iDf6dv
 dT/wZmAa+R+enzPFCYPW9Rh4IJ/nBWwgk3yJIoV3Qb/6lL3A3NqPp08ogk9SJtBs
 +bL3QMUsPbCqfl8lsn8IW81KSBVsZlh0PNSzqrsjNIffVlrF02WA4SMrmcNj0A//
 ZqtvFI6DDPBlfUtNv3JuPgdygVjlpukcMaRQkTzqRPEGavMmBuK/5dBMIgZ2S4/3
 eOMc76qUhlKqGoTQB5ZMinbZKS2fJRF/QzFGR8Jjnccq4B89J7AymxoNVu6lf+q/
 ysOLmzq4ZWxq5ZTzr17oCRSA2OM9LbOssJtCvu4xcWr7Tl81lBfmvQ6pbue4fven
 shOl8CINr8XsgI9aE/RU
 =m9bD
 -----END PGP SIGNATURE-----

Merge tag 'gpio-v4.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO fixes from Linus Walleij:
 "A few overdue GPIO patches for the v4.12 kernel.

   - Fix debounce logic on the Aspeed platform.

   - Fix the "virtual gpio" things on the Intel Crystal Cove.

   - Fix the blink counter selection on the MVEBU platform"

* tag 'gpio-v4.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
  gpio: mvebu: fix gpio bank registration when pwm is used
  gpio: mvebu: fix blink counter register selection
  MAINTAINERS: remove self from GPIO maintainers
  gpio: crystalcove: Do not write regular gpio registers for virtual GPIOs
  gpio: aspeed: Don't attempt to debounce if disabled
zero-colors
Linus Torvalds 2017-06-11 11:34:27 -07:00
commit f986e31bb4
4 changed files with 47 additions and 20 deletions

View File

@ -5667,7 +5667,6 @@ F: tools/testing/selftests/gpio/
GPIO SUBSYSTEM
M: Linus Walleij <linus.walleij@linaro.org>
M: Alexandre Courbot <gnurou@gmail.com>
L: linux-gpio@vger.kernel.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git
S: Maintained

View File

@ -646,6 +646,9 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset,
int rc;
int i;
if (!gpio->clk)
return -EINVAL;
rc = usecs_to_cycles(gpio, usecs, &requested_cycles);
if (rc < 0) {
dev_warn(chip->parent, "Failed to convert %luus to cycles at %luHz: %d\n",

View File

@ -90,8 +90,18 @@ static inline int to_reg(int gpio, enum ctrl_register reg_type)
{
int reg;
if (gpio == 94)
return GPIOPANELCTL;
if (gpio >= CRYSTALCOVE_GPIO_NUM) {
/*
* Virtual GPIO called from ACPI, for now we only support
* the panel ctl.
*/
switch (gpio) {
case 0x5e:
return GPIOPANELCTL;
default:
return -EOPNOTSUPP;
}
}
if (reg_type == CTRL_IN) {
if (gpio < 8)
@ -130,36 +140,36 @@ static void crystalcove_update_irq_ctrl(struct crystalcove_gpio *cg, int gpio)
static int crystalcove_gpio_dir_in(struct gpio_chip *chip, unsigned gpio)
{
struct crystalcove_gpio *cg = gpiochip_get_data(chip);
int reg = to_reg(gpio, CTRL_OUT);
if (gpio > CRYSTALCOVE_VGPIO_NUM)
if (reg < 0)
return 0;
return regmap_write(cg->regmap, to_reg(gpio, CTRL_OUT),
CTLO_INPUT_SET);
return regmap_write(cg->regmap, reg, CTLO_INPUT_SET);
}
static int crystalcove_gpio_dir_out(struct gpio_chip *chip, unsigned gpio,
int value)
{
struct crystalcove_gpio *cg = gpiochip_get_data(chip);
int reg = to_reg(gpio, CTRL_OUT);
if (gpio > CRYSTALCOVE_VGPIO_NUM)
if (reg < 0)
return 0;
return regmap_write(cg->regmap, to_reg(gpio, CTRL_OUT),
CTLO_OUTPUT_SET | value);
return regmap_write(cg->regmap, reg, CTLO_OUTPUT_SET | value);
}
static int crystalcove_gpio_get(struct gpio_chip *chip, unsigned gpio)
{
struct crystalcove_gpio *cg = gpiochip_get_data(chip);
int ret;
unsigned int val;
int ret, reg = to_reg(gpio, CTRL_IN);
if (gpio > CRYSTALCOVE_VGPIO_NUM)
if (reg < 0)
return 0;
ret = regmap_read(cg->regmap, to_reg(gpio, CTRL_IN), &val);
ret = regmap_read(cg->regmap, reg, &val);
if (ret)
return ret;
@ -170,14 +180,15 @@ static void crystalcove_gpio_set(struct gpio_chip *chip,
unsigned gpio, int value)
{
struct crystalcove_gpio *cg = gpiochip_get_data(chip);
int reg = to_reg(gpio, CTRL_OUT);
if (gpio > CRYSTALCOVE_VGPIO_NUM)
if (reg < 0)
return;
if (value)
regmap_update_bits(cg->regmap, to_reg(gpio, CTRL_OUT), 1, 1);
regmap_update_bits(cg->regmap, reg, 1, 1);
else
regmap_update_bits(cg->regmap, to_reg(gpio, CTRL_OUT), 1, 0);
regmap_update_bits(cg->regmap, reg, 1, 0);
}
static int crystalcove_irq_type(struct irq_data *data, unsigned type)
@ -185,6 +196,9 @@ static int crystalcove_irq_type(struct irq_data *data, unsigned type)
struct crystalcove_gpio *cg =
gpiochip_get_data(irq_data_get_irq_chip_data(data));
if (data->hwirq >= CRYSTALCOVE_GPIO_NUM)
return 0;
switch (type) {
case IRQ_TYPE_NONE:
cg->intcnt_value = CTLI_INTCNT_DIS;
@ -235,8 +249,10 @@ static void crystalcove_irq_unmask(struct irq_data *data)
struct crystalcove_gpio *cg =
gpiochip_get_data(irq_data_get_irq_chip_data(data));
cg->set_irq_mask = false;
cg->update |= UPDATE_IRQ_MASK;
if (data->hwirq < CRYSTALCOVE_GPIO_NUM) {
cg->set_irq_mask = false;
cg->update |= UPDATE_IRQ_MASK;
}
}
static void crystalcove_irq_mask(struct irq_data *data)
@ -244,8 +260,10 @@ static void crystalcove_irq_mask(struct irq_data *data)
struct crystalcove_gpio *cg =
gpiochip_get_data(irq_data_get_irq_chip_data(data));
cg->set_irq_mask = true;
cg->update |= UPDATE_IRQ_MASK;
if (data->hwirq < CRYSTALCOVE_GPIO_NUM) {
cg->set_irq_mask = true;
cg->update |= UPDATE_IRQ_MASK;
}
}
static struct irq_chip crystalcove_irqchip = {

View File

@ -747,7 +747,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
set = U32_MAX;
else
return -EINVAL;
writel_relaxed(0, mvebu_gpioreg_blink_counter_select(mvchip));
writel_relaxed(set, mvebu_gpioreg_blink_counter_select(mvchip));
mvpwm = devm_kzalloc(dev, sizeof(struct mvebu_pwm), GFP_KERNEL);
if (!mvpwm)
@ -768,6 +768,13 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
mvpwm->chip.dev = dev;
mvpwm->chip.ops = &mvebu_pwm_ops;
mvpwm->chip.npwm = mvchip->chip.ngpio;
/*
* There may already be some PWM allocated, so we can't force
* mvpwm->chip.base to a fixed point like mvchip->chip.base.
* So, we let pwmchip_add() do the numbering and take the next free
* region.
*/
mvpwm->chip.base = -1;
spin_lock_init(&mvpwm->lock);