Skip to content

Commit 42e4327

Browse files
committed
Merge patch series "pinctrl: intel: use new GPIO line value setter callbacks"
Bartosz Golaszewski <[email protected]> says: Commit 98ce1eb ("gpiolib: introduce gpio_chip setters that return values") added new line setter callbacks to struct gpio_chip. They allow to indicate failures to callers. We're in the process of converting all GPIO controllers to using them before removing the old ones. This series converts all GPIO chips in intel pin control drivers. Link: https://lore.kernel.org/r/20250610-gpiochip-set-rv-pinctrl-intel-v1-0-d7a773ff864e@linaro.org Signed-off-by: Andy Shevchenko <[email protected]>
2 parents 19272b3 + 20e6227 commit 42e4327

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

drivers/pinctrl/intel/pinctrl-baytrail.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,15 +1045,15 @@ static int byt_gpio_get(struct gpio_chip *chip, unsigned int offset)
10451045
return !!(val & BYT_LEVEL);
10461046
}
10471047

1048-
static void byt_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
1048+
static int byt_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
10491049
{
10501050
struct intel_pinctrl *vg = gpiochip_get_data(chip);
10511051
void __iomem *reg;
10521052
u32 old_val;
10531053

10541054
reg = byt_gpio_reg(vg, offset, BYT_VAL_REG);
10551055
if (!reg)
1056-
return;
1056+
return -EINVAL;
10571057

10581058
guard(raw_spinlock_irqsave)(&byt_lock);
10591059

@@ -1062,6 +1062,8 @@ static void byt_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
10621062
writel(old_val | BYT_LEVEL, reg);
10631063
else
10641064
writel(old_val & ~BYT_LEVEL, reg);
1065+
1066+
return 0;
10651067
}
10661068

10671069
static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
@@ -1229,7 +1231,7 @@ static const struct gpio_chip byt_gpio_chip = {
12291231
.direction_input = byt_gpio_direction_input,
12301232
.direction_output = byt_gpio_direction_output,
12311233
.get = byt_gpio_get,
1232-
.set = byt_gpio_set,
1234+
.set_rv = byt_gpio_set,
12331235
.set_config = gpiochip_generic_config,
12341236
.dbg_show = byt_gpio_dbg_show,
12351237
};

drivers/pinctrl/intel/pinctrl-cherryview.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ static int chv_gpio_get(struct gpio_chip *chip, unsigned int offset)
11121112
return !!(ctrl0 & CHV_PADCTRL0_GPIORXSTATE);
11131113
}
11141114

1115-
static void chv_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
1115+
static int chv_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
11161116
{
11171117
struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
11181118
u32 ctrl0;
@@ -1127,6 +1127,8 @@ static void chv_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
11271127
ctrl0 &= ~CHV_PADCTRL0_GPIOTXSTATE;
11281128

11291129
chv_writel(pctrl, offset, CHV_PADCTRL0, ctrl0);
1130+
1131+
return 0;
11301132
}
11311133

11321134
static int chv_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
@@ -1166,7 +1168,7 @@ static const struct gpio_chip chv_gpio_chip = {
11661168
.direction_input = chv_gpio_direction_input,
11671169
.direction_output = chv_gpio_direction_output,
11681170
.get = chv_gpio_get,
1169-
.set = chv_gpio_set,
1171+
.set_rv = chv_gpio_set,
11701172
};
11711173

11721174
static void chv_gpio_irq_ack(struct irq_data *d)

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,8 +1033,8 @@ static int intel_gpio_get(struct gpio_chip *chip, unsigned int offset)
10331033
return !!(padcfg0 & PADCFG0_GPIORXSTATE);
10341034
}
10351035

1036-
static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
1037-
int value)
1036+
static int intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
1037+
int value)
10381038
{
10391039
struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
10401040
void __iomem *reg;
@@ -1043,11 +1043,11 @@ static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
10431043

10441044
pin = intel_gpio_to_pin(pctrl, offset, NULL, NULL);
10451045
if (pin < 0)
1046-
return;
1046+
return -EINVAL;
10471047

10481048
reg = intel_get_padcfg(pctrl, pin, PADCFG0);
10491049
if (!reg)
1050-
return;
1050+
return -EINVAL;
10511051

10521052
guard(raw_spinlock_irqsave)(&pctrl->lock);
10531053

@@ -1057,6 +1057,8 @@ static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
10571057
else
10581058
padcfg0 &= ~PADCFG0_GPIOTXSTATE;
10591059
writel(padcfg0, reg);
1060+
1061+
return 0;
10601062
}
10611063

10621064
static int intel_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
@@ -1094,7 +1096,12 @@ static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned int offse
10941096
static int intel_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
10951097
int value)
10961098
{
1097-
intel_gpio_set(chip, offset, value);
1099+
int ret;
1100+
1101+
ret = intel_gpio_set(chip, offset, value);
1102+
if (ret)
1103+
return ret;
1104+
10981105
return pinctrl_gpio_direction_output(chip, offset);
10991106
}
11001107

@@ -1106,7 +1113,7 @@ static const struct gpio_chip intel_gpio_chip = {
11061113
.direction_input = intel_gpio_direction_input,
11071114
.direction_output = intel_gpio_direction_output,
11081115
.get = intel_gpio_get,
1109-
.set = intel_gpio_set,
1116+
.set_rv = intel_gpio_set,
11101117
.set_config = gpiochip_generic_config,
11111118
};
11121119

drivers/pinctrl/intel/pinctrl-lynxpoint.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ static int lp_gpio_get(struct gpio_chip *chip, unsigned int offset)
503503
return !!(ioread32(reg) & IN_LVL_BIT);
504504
}
505505

506-
static void lp_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
506+
static int lp_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
507507
{
508508
struct intel_pinctrl *lg = gpiochip_get_data(chip);
509509
void __iomem *reg = lp_gpio_reg(chip, offset, LP_CONFIG1);
@@ -514,6 +514,8 @@ static void lp_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
514514
iowrite32(ioread32(reg) | OUT_LVL_BIT, reg);
515515
else
516516
iowrite32(ioread32(reg) & ~OUT_LVL_BIT, reg);
517+
518+
return 0;
517519
}
518520

519521
static int lp_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
@@ -775,7 +777,7 @@ static int lp_gpio_probe(struct platform_device *pdev)
775777
gc->direction_input = lp_gpio_direction_input;
776778
gc->direction_output = lp_gpio_direction_output;
777779
gc->get = lp_gpio_get;
778-
gc->set = lp_gpio_set;
780+
gc->set_rv = lp_gpio_set;
779781
gc->set_config = gpiochip_generic_config;
780782
gc->get_direction = lp_gpio_get_direction;
781783
gc->base = -1;

0 commit comments

Comments
 (0)