Skip to content

Commit 6d416b9

Browse files
linuswandy-shev
authored andcommitted
pinctrl: intel: Add GPIO <-> pin mapping ranges via callback
When IRQ chip is instantiated via GPIO library flow, the few functions, in particular the ACPI event registration mechanism, on some of ACPI based platforms expect that the pin ranges are initialized to that point. Add GPIO <-> pin mapping ranges via callback in the GPIO library flow. Cc: Hans de Goede <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent e2b7441 commit 6d416b9

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,8 +1130,8 @@ static irqreturn_t intel_gpio_irq(int irq, void *data)
11301130
return ret;
11311131
}
11321132

1133-
static int intel_gpio_add_pin_ranges(struct intel_pinctrl *pctrl,
1134-
const struct intel_community *community)
1133+
static int intel_gpio_add_community_ranges(struct intel_pinctrl *pctrl,
1134+
const struct intel_community *community)
11351135
{
11361136
int ret = 0, i;
11371137

@@ -1151,6 +1151,24 @@ static int intel_gpio_add_pin_ranges(struct intel_pinctrl *pctrl,
11511151
return ret;
11521152
}
11531153

1154+
static int intel_gpio_add_pin_ranges(struct gpio_chip *gc)
1155+
{
1156+
struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
1157+
int ret, i;
1158+
1159+
for (i = 0; i < pctrl->ncommunities; i++) {
1160+
struct intel_community *community = &pctrl->communities[i];
1161+
1162+
ret = intel_gpio_add_community_ranges(pctrl, community);
1163+
if (ret) {
1164+
dev_err(pctrl->dev, "failed to add GPIO pin range\n");
1165+
return ret;
1166+
}
1167+
}
1168+
1169+
return 0;
1170+
}
1171+
11541172
static unsigned int intel_gpio_ngpio(const struct intel_pinctrl *pctrl)
11551173
{
11561174
const struct intel_community *community;
@@ -1175,7 +1193,7 @@ static unsigned int intel_gpio_ngpio(const struct intel_pinctrl *pctrl)
11751193

11761194
static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
11771195
{
1178-
int ret, i;
1196+
int ret;
11791197

11801198
pctrl->chip = intel_gpio_chip;
11811199

@@ -1184,6 +1202,7 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
11841202
pctrl->chip.label = dev_name(pctrl->dev);
11851203
pctrl->chip.parent = pctrl->dev;
11861204
pctrl->chip.base = -1;
1205+
pctrl->chip.add_pin_ranges = intel_gpio_add_pin_ranges;
11871206
pctrl->irq = irq;
11881207

11891208
/* Setup IRQ chip */
@@ -1201,16 +1220,6 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
12011220
return ret;
12021221
}
12031222

1204-
for (i = 0; i < pctrl->ncommunities; i++) {
1205-
struct intel_community *community = &pctrl->communities[i];
1206-
1207-
ret = intel_gpio_add_pin_ranges(pctrl, community);
1208-
if (ret) {
1209-
dev_err(pctrl->dev, "failed to add GPIO pin range\n");
1210-
return ret;
1211-
}
1212-
}
1213-
12141223
/*
12151224
* We need to request the interrupt here (instead of providing chip
12161225
* to the irq directly) because on some platforms several GPIO

0 commit comments

Comments
 (0)