Skip to content

Commit 8cefedd

Browse files
committed
Merge branch 'ib-armada-for-v6.16' into devel
Signed-off-by: Linus Walleij <[email protected]>
2 parents 86ea0b8 + 4229c28 commit 8cefedd

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

drivers/pinctrl/mvebu/pinctrl-armada-37xx.c

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,7 @@ static int armada_37xx_pmx_set_by_name(struct pinctrl_dev *pctldev,
358358

359359
val = grp->val[func];
360360

361-
regmap_update_bits(info->regmap, reg, mask, val);
362-
363-
return 0;
361+
return regmap_update_bits(info->regmap, reg, mask, val);
364362
}
365363

366364
static int armada_37xx_pmx_set(struct pinctrl_dev *pctldev,
@@ -402,10 +400,13 @@ static int armada_37xx_gpio_get_direction(struct gpio_chip *chip,
402400
struct armada_37xx_pinctrl *info = gpiochip_get_data(chip);
403401
unsigned int reg = OUTPUT_EN;
404402
unsigned int val, mask;
403+
int ret;
405404

406405
armada_37xx_update_reg(&reg, &offset);
407406
mask = BIT(offset);
408-
regmap_read(info->regmap, reg, &val);
407+
ret = regmap_read(info->regmap, reg, &val);
408+
if (ret)
409+
return ret;
409410

410411
if (val & mask)
411412
return GPIO_LINE_DIRECTION_OUT;
@@ -417,31 +418,37 @@ static int armada_37xx_gpio_direction_output(struct gpio_chip *chip,
417418
unsigned int offset, int value)
418419
{
419420
struct armada_37xx_pinctrl *info = gpiochip_get_data(chip);
420-
unsigned int reg = OUTPUT_EN;
421+
unsigned int en_offset = offset;
422+
unsigned int reg = OUTPUT_VAL;
421423
unsigned int mask, val, ret;
422424

423425
armada_37xx_update_reg(&reg, &offset);
424426
mask = BIT(offset);
427+
val = value ? mask : 0;
425428

426-
ret = regmap_update_bits(info->regmap, reg, mask, mask);
429+
ret = regmap_update_bits(info->regmap, reg, mask, val);
427430
if (ret)
428431
return ret;
429432

430-
reg = OUTPUT_VAL;
431-
val = value ? mask : 0;
432-
return regmap_update_bits(info->regmap, reg, mask, val);
433+
reg = OUTPUT_EN;
434+
armada_37xx_update_reg(&reg, &en_offset);
435+
436+
return regmap_update_bits(info->regmap, reg, mask, mask);
433437
}
434438

435439
static int armada_37xx_gpio_get(struct gpio_chip *chip, unsigned int offset)
436440
{
437441
struct armada_37xx_pinctrl *info = gpiochip_get_data(chip);
438442
unsigned int reg = INPUT_VAL;
439443
unsigned int val, mask;
444+
int ret;
440445

441446
armada_37xx_update_reg(&reg, &offset);
442447
mask = BIT(offset);
443448

444-
regmap_read(info->regmap, reg, &val);
449+
ret = regmap_read(info->regmap, reg, &val);
450+
if (ret)
451+
return ret;
445452

446453
return (val & mask) != 0;
447454
}
@@ -466,16 +473,17 @@ static int armada_37xx_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
466473
{
467474
struct armada_37xx_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
468475
struct gpio_chip *chip = range->gc;
476+
int ret;
469477

470478
dev_dbg(info->dev, "gpio_direction for pin %u as %s-%d to %s\n",
471479
offset, range->name, offset, input ? "input" : "output");
472480

473481
if (input)
474-
armada_37xx_gpio_direction_input(chip, offset);
482+
ret = armada_37xx_gpio_direction_input(chip, offset);
475483
else
476-
armada_37xx_gpio_direction_output(chip, offset, 0);
484+
ret = armada_37xx_gpio_direction_output(chip, offset, 0);
477485

478-
return 0;
486+
return ret;
479487
}
480488

481489
static int armada_37xx_gpio_request_enable(struct pinctrl_dev *pctldev,

0 commit comments

Comments
 (0)