Skip to content

Commit 2ddf6cd

Browse files
systec-dkLinus Walleij
authored andcommitted
pch_gpio: set value before enabling output direction
This ensures that the output signal does not toggle if set to high. Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent fc86035 commit 2ddf6cd

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎drivers/gpio/gpio-pch.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,18 @@ static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr,
138138
unsigned long flags;
139139

140140
spin_lock_irqsave(&chip->spinlock, flags);
141-
pm = ioread32(&chip->reg->pm) & ((1 << gpio_pins[chip->ioh]) - 1);
142-
pm |= (1 << nr);
143-
iowrite32(pm, &chip->reg->pm);
144141

145142
reg_val = ioread32(&chip->reg->po);
146143
if (val)
147144
reg_val |= (1 << nr);
148145
else
149146
reg_val &= ~(1 << nr);
150147
iowrite32(reg_val, &chip->reg->po);
148+
149+
pm = ioread32(&chip->reg->pm) & ((1 << gpio_pins[chip->ioh]) - 1);
150+
pm |= (1 << nr);
151+
iowrite32(pm, &chip->reg->pm);
152+
151153
spin_unlock_irqrestore(&chip->spinlock, flags);
152154

153155
return 0;

0 commit comments

Comments
 (0)