Skip to content

Commit 228fc01

Browse files
lynxeye-devbrgl
authored andcommitted
gpio: of: don't warn if ignored GPIO flag matches the behavior
Some devicetrees specify the ACTIVE_LOW flag in the fixed regulator GPIO handle. While this has always been ignored, it's consistent with the behavior of the regulator binding in the absence of the "enable-active-high" DT property. It doesn't make much sense to print a user visible warning for a configuration which is consistent, so only print the warning if the GPIO flag contradicts the behavior dictated by by the enable-active-high property. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> [Bartosz: coding style tweak] Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
1 parent ac4062a commit 228fc01

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎drivers/gpio/gpiolib-of.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,20 @@ static void of_gpio_flags_quirks(struct device_node *np,
134134
(!(strcmp(propname, "enable-gpio") &&
135135
strcmp(propname, "enable-gpios")) &&
136136
of_device_is_compatible(np, "regulator-gpio")))) {
137+
bool active_low = !of_property_read_bool(np,
138+
"enable-active-high");
137139
/*
138140
* The regulator GPIO handles are specified such that the
139141
* presence or absence of "enable-active-high" solely controls
140142
* the polarity of the GPIO line. Any phandle flags must
141143
* be actively ignored.
142144
*/
143-
if (*flags & OF_GPIO_ACTIVE_LOW) {
145+
if ((*flags & OF_GPIO_ACTIVE_LOW) && !active_low) {
144146
pr_warn("%s GPIO handle specifies active low - ignored\n",
145147
of_node_full_name(np));
146148
*flags &= ~OF_GPIO_ACTIVE_LOW;
147149
}
148-
if (!of_property_read_bool(np, "enable-active-high"))
150+
if (active_low)
149151
*flags |= OF_GPIO_ACTIVE_LOW;
150152
}
151153
/*

0 commit comments

Comments
 (0)