gpio: of: Apply regulator-gpio quirk only to enable-gpios
PATCH 1/1 gpio: of: Apply regulator-gpio quirk only to enable-gpios
From: Marek Vasut <[email protected]>
Since commit d6cd33ad7102 ("regulator: gpio: Convert to use descriptors") the GPIO regulator had inverted the polarity of the control GPIO. This problem manifested itself on systems with DT containing the following description (snippet from salvator-common.dtsi):
gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; gpios-states = <1>; states = <3300000 1 1800000 0>;
Prior to the aforementioned commit, the gpio-regulator code used gpio_request_array() to claim the GPIO(s) specified in the "gpios" DT node, while the commit changed that to devm_gpiod_get_index().
The legacy gpio_request_array() calls gpio_request_one() and then gpiod_request(), which parses the DT flags of the "gpios" node and populates the GPIO descriptor flags field accordingly.
The new devm_gpiod_get_index() calls gpiod_get_index(), then of_find_gpio(), of_get_named_gpiod_flags() with flags != NULL, and then of_gpio_flags_quirks(). Since commit a603a2b8d86e ("gpio: of: Add special quirk to parse regulator flags"), of_gpio_flags_quirks() contains a quirk for regulator-gpio which was never triggered by the legacy gpio_request_array() code path, but is triggered by devm_gpiod_get_index() code path.
This quirk checks whether a GPIO is associated with a fixed or gpio-regulator and if so, checks two additional conditions. First, whether such GPIO is active-low, and if so, ignores the active-low flag. Second, whether the regulator DT node does have an "enable-active-high" property and if the property is NOT present, sets the GPIO flags as active-low.
The second check triggers a problem, since it is applied to all GPIOs associated with a gpio-regulator, rather than only on the "enable" GPIOs, as the old code did. This changes the way the gpio-regulator interprets the DT description of the control GPIOs.
The old code using gpio_request_array() explicitly parsed the "enable-active-high" DT property and only applied it to the GPIOs described in the "enable-gpios" DT node, and only if those were present.
This patch fixes the quirk code by only applying the quirk to "enable-gpios", thus restoring the old behavior.
--- drivers/gpio/gpiolib-of.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpiolib-of.c +1 -0
@@ -84,6 +84,7 @@ static void of_gpio_flags_quirks(struct device_node *np,* Note that active low is the default. */ if (IS_ENABLED (CONFIG_REGULATOR ) && + !strcmp (propname,"enable-gpio" ) && (of_device_is_compatible (np,"regulator-fixed" ) ||of_device_is_compatible (np,"reg-fixed-voltage" ) ||of_device_is_compatible (np,"regulator-gpio" ))) {
Signature · 1 line
2.19.2
drivers/gpio/gpiolib-of.c static void of_gpio_flags_quirks(struct device_node *np, · line 87
Quoted 2 lines
drivers/gpio/gpiolib-of.c +1
-0+ !strcmp(propname, "enable-gpio") &&
I haven't looked at the actual issue, but one minor nit I usually have:
I think 'strcmp() == 0' is easier to read since the above is too easy to be mistaken as "if not equal". I have just been bitten again by this after a long day, although I should know better... :/
Quoted 8 lines · Wolfram Sang
drivers/gpio/gpiolib-of.c static void of_gpio_flags_quirks(struct device_node *np, · line 87
Quoted 2 lines
drivers/gpio/gpiolib-of.c +1
-0+ !strcmp(propname, "enable-gpio") &&I haven't looked at the actual issue, but one minor nit I usually have:
I think '
strcmp()== 0' is easier to read since the above is too easy to be mistaken as "if not equal". I have just been bitten again by this after a long day, although I should know better... :/
Note that I just followed the coding style in the rest of the function, if we want to update the coding style the gpiolib, that's for separate patch.
Signature · 2 lines
Best regards, Marek Vasut
Quoted 6 lines · Marek Vasut
Quoted 5 lines · Wolfram Sang
drivers/gpio/gpiolib-of.c static void of_gpio_flags_quirks(struct device_node *np, · line 87
Quoted 2 lines
drivers/gpio/gpiolib-of.c +1
-0+ !strcmp(propname, "enable-gpio") &&I haven't looked at the actual issue, but one minor nit I usually have:
Quoted 7 lines
Quoted 3 lines
I think '
strcmp()== 0' is easier to read since the above is too easy to be mistaken as "if not equal". I have just been bitten again by this after a long day, although I should know better... :/Note that I just followed the coding style in the rest of the function, if we want to update the coding style the gpiolib, that's for separate patch.
Fair enough.
Quoted 11 lines · Wolfram Sang
Quoted 10 lines · Marek Vasut
Quoted 8 lines · Wolfram Sang
drivers/gpio/gpiolib-of.c static void of_gpio_flags_quirks(struct device_node *np, · line 87
Quoted 2 lines
drivers/gpio/gpiolib-of.c +1
-0+ !strcmp(propname, "enable-gpio") &&I haven't looked at the actual issue, but one minor nit I usually have:
I think '
strcmp()== 0' is easier to read since the above is too easy to be mistaken as "if not equal". I have just been bitten again by this after a long day, although I should know better... :/
Quoted 6 lines
Quoted 3 lines
Note that I just followed the coding style in the rest of the function, if we want to update the coding style the gpiolib, that's for separate patch.
Fair enough.
Could be something Gustavo can look at, since he seems to be doing a lot of automated cleanups ?
Signature · 2 lines
Best regards, Marek Vasut
Quoted 50 lines · On Sat, Feb 16, 2019 at 2:46 PM <[email protected]> wrote:
From: Marek Vasut <[email protected]>
Since commit
d6cd33ad7102("regulator: gpio: Convert to use descriptors") the GPIO regulator had inverted the polarity of the control GPIO. This problem manifested itself on systems with DT containing the following description (snippet fromsalvator-common.dtsi):gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; gpios-states = <1>; states = <3300000 1 1800000 0>;Prior to the aforementioned commit, the gpio-regulator code used
gpio_request_array()to claim the GPIO(s) specified in the "gpios" DT node, while the commit changed that todevm_gpiod_get_index().The legacy
gpio_request_array()callsgpio_request_one()and thengpiod_request(), which parses the DT flags of the "gpios" node and populates the GPIO descriptor flags field accordingly.The new
devm_gpiod_get_index()callsgpiod_get_index(), thenof_find_gpio(),of_get_named_gpiod_flags()with flags != NULL, and thenof_gpio_flags_quirks(). Since commita603a2b8d86e("gpio: of: Add special quirk to parse regulator flags"),of_gpio_flags_quirks()contains a quirk for regulator-gpio which was never triggered by the legacygpio_request_array()code path, but is triggered bydevm_gpiod_get_index()code path.This quirk checks whether a GPIO is associated with a fixed or gpio-regulator and if so, checks two additional conditions. First, whether such GPIO is active-low, and if so, ignores the active-low flag. Second, whether the regulator DT node does have an "enable-active-high" property and if the property is NOT present, sets the GPIO flags as active-low.
The second check triggers a problem, since it is applied to all GPIOs associated with a gpio-regulator, rather than only on the "enable" GPIOs, as the old code did. This changes the way the gpio-regulator interprets the DT description of the control GPIOs.
The old code using
gpio_request_array()explicitly parsed the "enable-active-high" DT property and only applied it to the GPIOs described in the "enable-gpios" DT node, and only if those were present.This patch fixes the quirk code by only applying the quirk to "enable-gpios", thus restoring the old behavior.
Quoted 8 lines
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Jan Kotas <[email protected]>Cc Linus Walleij <[email protected]>Cc Mark Brown <[email protected]>Cc Wolfram Sang <[email protected]>
Patch applied for v5.1, the regulator and GPIO changes should work fine together in -next and merge nicely in the merge window.
Bonus for a long and descriptive commit message and keeping me company over the Facebook chat while fixing it up! :D
Yours,
Linus Walleij
Quoted 61 lines · Linus Walleij
Quoted 50 lines · On Sat, Feb 16, 2019 at 2:46 PM <[email protected]> wrote:
From: Marek Vasut <[email protected]>
Since commit
d6cd33ad7102("regulator: gpio: Convert to use descriptors") the GPIO regulator had inverted the polarity of the control GPIO. This problem manifested itself on systems with DT containing the following description (snippet fromsalvator-common.dtsi):gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; gpios-states = <1>; states = <3300000 1 1800000 0>;Prior to the aforementioned commit, the gpio-regulator code used
gpio_request_array()to claim the GPIO(s) specified in the "gpios" DT node, while the commit changed that todevm_gpiod_get_index().The legacy
gpio_request_array()callsgpio_request_one()and thengpiod_request(), which parses the DT flags of the "gpios" node and populates the GPIO descriptor flags field accordingly.The new
devm_gpiod_get_index()callsgpiod_get_index(), thenof_find_gpio(),of_get_named_gpiod_flags()with flags != NULL, and thenof_gpio_flags_quirks(). Since commita603a2b8d86e("gpio: of: Add special quirk to parse regulator flags"),of_gpio_flags_quirks()contains a quirk for regulator-gpio which was never triggered by the legacygpio_request_array()code path, but is triggered bydevm_gpiod_get_index()code path.This quirk checks whether a GPIO is associated with a fixed or gpio-regulator and if so, checks two additional conditions. First, whether such GPIO is active-low, and if so, ignores the active-low flag. Second, whether the regulator DT node does have an "enable-active-high" property and if the property is NOT present, sets the GPIO flags as active-low.
The second check triggers a problem, since it is applied to all GPIOs associated with a gpio-regulator, rather than only on the "enable" GPIOs, as the old code did. This changes the way the gpio-regulator interprets the DT description of the control GPIOs.
The old code using
gpio_request_array()explicitly parsed the "enable-active-high" DT property and only applied it to the GPIOs described in the "enable-gpios" DT node, and only if those were present.This patch fixes the quirk code by only applying the quirk to "enable-gpios", thus restoring the old behavior.
Quoted 8 lines
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Jan Kotas <[email protected]>Cc Linus Walleij <[email protected]>Cc Mark Brown <[email protected]>Cc Wolfram Sang <[email protected]>
Quoted 5 lines
Patch applied for v5.1, the regulator and GPIO changes should work fine together in -next and merge nicely in the merge window.
Bonus for a long and descriptive commit message and keeping me company over the Facebook chat while fixing it up! :D
:-))
Signature · 2 lines
Best regards, Marek Vasut
Quoted 57 lines · On Sat, Feb 16, 2019 at 02:46:27PM +0100, [email protected] wrote:
From: Marek Vasut <[email protected]>
Since commit
d6cd33ad7102("regulator: gpio: Convert to use descriptors") the GPIO regulator had inverted the polarity of the control GPIO. This problem manifested itself on systems with DT containing the following description (snippet fromsalvator-common.dtsi):gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; gpios-states = <1>; states = <3300000 1 1800000 0>;Prior to the aforementioned commit, the gpio-regulator code used
gpio_request_array()to claim the GPIO(s) specified in the "gpios" DT node, while the commit changed that todevm_gpiod_get_index().The legacy
gpio_request_array()callsgpio_request_one()and thengpiod_request(), which parses the DT flags of the "gpios" node and populates the GPIO descriptor flags field accordingly.The new
devm_gpiod_get_index()callsgpiod_get_index(), thenof_find_gpio(),of_get_named_gpiod_flags()with flags != NULL, and thenof_gpio_flags_quirks(). Since commita603a2b8d86e("gpio: of: Add special quirk to parse regulator flags"),of_gpio_flags_quirks()contains a quirk for regulator-gpio which was never triggered by the legacygpio_request_array()code path, but is triggered bydevm_gpiod_get_index()code path.This quirk checks whether a GPIO is associated with a fixed or gpio-regulator and if so, checks two additional conditions. First, whether such GPIO is active-low, and if so, ignores the active-low flag. Second, whether the regulator DT node does have an "enable-active-high" property and if the property is NOT present, sets the GPIO flags as active-low.
The second check triggers a problem, since it is applied to all GPIOs associated with a gpio-regulator, rather than only on the "enable" GPIOs, as the old code did. This changes the way the gpio-regulator interprets the DT description of the control GPIOs.
The old code using
gpio_request_array()explicitly parsed the "enable-active-high" DT property and only applied it to the GPIOs described in the "enable-gpios" DT node, and only if those were present.This patch fixes the quirk code by only applying the quirk to "enable-gpios", thus restoring the old behavior.
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Jan Kotas <[email protected]>Cc Linus Walleij <[email protected]>Cc Mark Brown <[email protected]>Cc Wolfram Sang <[email protected]>
Quoted 4 lines
--- drivers/gpio/gpiolib-of.c | 1 + 1 file changed, 1 insertion(+)
This causes a runtime regression on Jetson TX1. The symptoms are that HDMI monitors are no longer reliably detected as plugged in. The reason is because the GPIO polarity for the HDMI +5V regulator is now reversed and therefore the HPD signal, which is usually fed by the +5V signal, does not reflect the correct value.
Now it's somewhat confusing to me why this wasn't broken before. We have this in device tree:
vdd_hdmi: regulator@10 {
compatible = "regulator-fixed";
reg = <10>;
regulator-name = "VDD_HDMI_5V0";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&exp1 12 GPIO_ACTIVE_LOW>;
enable-active-high;
vin-supply = <&vdd_5v0_sys>;
};This is from arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi. The above is obviously wrong because it specifies GPIO_ACTIVE_LOW and I do see the warning from the GPIO library about how this is being ignored. However, the above works fine on today's linux-next with this commit reverted because the quirks will cause the GPIO_ACTIVE_LOW flag to be ignored.
However, with this commit applied, the quirk will be skipped for the regulator and cause the GPIO_ACTIVE_LOW flag to be used to invert the GPIO during enable and disable operations.
Now, this is clearly a bug in the DT and I'm going to send out a patch to fix that up, but I think we need to revert this patch for now because there may be other cases out there that are broken. The whole point of these quirks is also to make sure that existing device trees continue to work.
Also, checking for only the enable-gpio property is wrong in this case. enable-gpio is only specified for regulator-gpio. The standard GPIO for regulator-fixed is "gpio", so the quirks must be applied to that property in order to ensure backwards-compatibility.
drivers/gpio/gpiolib-of.c static void of_gpio_flags_quirks(struct device_node *np, · line 90
Quoted 12 lines
drivers/gpio/gpiolib-of.c +1
-0@@ -84,6 +84,7 @@ static void of_gpio_flags_quirks(struct device_node *np,* Note that active low is the default. */ if (IS_ENABLED (CONFIG_REGULATOR ) && + !strcmp (propname,"enable-gpio" ) && (of_device_is_compatible (np,"regulator-fixed" ) ||of_device_is_compatible (np,"reg-fixed-voltage" ) ||of_device_is_compatible (np,"regulator-gpio" ))) {
I think this would need to be something like the below to reflect what you were trying to achieve, while keeping backwards compatibility:
--- >8 ---
drivers/gpio/gpiolib-of.c +2 -2
@@ -84,10 +84,10 @@ static void of_gpio_flags_quirks(struct device_node *np,* Note that active low is the default. */ if (IS_ENABLED (CONFIG_REGULATOR ) && - !strcmp (propname,"enable-gpio" ) && (of_device_is_compatible (np,"regulator-fixed" ) ||of_device_is_compatible (np,"reg-fixed-voltage" ) || -of_device_is_compatible (np,"regulator-gpio" ))) { + (of_device_is_compatible (np,"regulator-gpio" ) && +strcmp (propname,"enable-gpio" ) ==0 ))) {/* * The regulator GPIO handles are specified such that the * presence or absence of "enable-active-high" solely controls
--- >8 ---
That applied on top of today's linux-next fixes the regression for me without a need to modify the device tree. Feel free to integrate that into your patch.
Thierry
Quoted 89 lines · Thierry Reding
Quoted 57 lines · On Sat, Feb 16, 2019 at 02:46:27PM +0100, [email protected] wrote:
From: Marek Vasut <[email protected]>
Since commit
d6cd33ad7102("regulator: gpio: Convert to use descriptors") the GPIO regulator had inverted the polarity of the control GPIO. This problem manifested itself on systems with DT containing the following description (snippet fromsalvator-common.dtsi):gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; gpios-states = <1>; states = <3300000 1 1800000 0>;Prior to the aforementioned commit, the gpio-regulator code used
gpio_request_array()to claim the GPIO(s) specified in the "gpios" DT node, while the commit changed that todevm_gpiod_get_index().The legacy
gpio_request_array()callsgpio_request_one()and thengpiod_request(), which parses the DT flags of the "gpios" node and populates the GPIO descriptor flags field accordingly.The new
devm_gpiod_get_index()callsgpiod_get_index(), thenof_find_gpio(),of_get_named_gpiod_flags()with flags != NULL, and thenof_gpio_flags_quirks(). Since commita603a2b8d86e("gpio: of: Add special quirk to parse regulator flags"),of_gpio_flags_quirks()contains a quirk for regulator-gpio which was never triggered by the legacygpio_request_array()code path, but is triggered bydevm_gpiod_get_index()code path.This quirk checks whether a GPIO is associated with a fixed or gpio-regulator and if so, checks two additional conditions. First, whether such GPIO is active-low, and if so, ignores the active-low flag. Second, whether the regulator DT node does have an "enable-active-high" property and if the property is NOT present, sets the GPIO flags as active-low.
The second check triggers a problem, since it is applied to all GPIOs associated with a gpio-regulator, rather than only on the "enable" GPIOs, as the old code did. This changes the way the gpio-regulator interprets the DT description of the control GPIOs.
The old code using
gpio_request_array()explicitly parsed the "enable-active-high" DT property and only applied it to the GPIOs described in the "enable-gpios" DT node, and only if those were present.This patch fixes the quirk code by only applying the quirk to "enable-gpios", thus restoring the old behavior.
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Jan Kotas <[email protected]>Cc Linus Walleij <[email protected]>Cc Mark Brown <[email protected]>Cc Wolfram Sang <[email protected]>Quoted 4 lines
--- drivers/gpio/gpiolib-of.c | 1 + 1 file changed, 1 insertion(+)This causes a runtime regression on Jetson TX1. The symptoms are that HDMI monitors are no longer reliably detected as plugged in. The reason is because the GPIO polarity for the HDMI +5V regulator is now reversed and therefore the HPD signal, which is usually fed by the +5V signal, does not reflect the correct value.
Now it's somewhat confusing to me why this wasn't broken before. We have this in device tree:
vdd_hdmi: regulator@10 { compatible = "regulator-fixed"; reg = <10>; regulator-name = "VDD_HDMI_5V0"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; gpio = <&exp1 12 GPIO_ACTIVE_LOW>; enable-active-high; vin-supply = <&vdd_5v0_sys>; };This is from
arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi. The above is obviously wrong because it specifiesGPIO_ACTIVE_LOWand I do see the warning from the GPIO library about how this is being ignored. However, the above works fine on today's linux-next with this commit reverted because the quirks will cause theGPIO_ACTIVE_LOWflag to be ignored.
Quoted 7 lines
However, with this commit applied, the quirk will be skipped for the regulator and cause the
GPIO_ACTIVE_LOWflag to be used to invert the GPIO during enable and disable operations.Now, this is clearly a bug in the DT and I'm going to send out a patch to fix that up, but I think we need to revert this patch for now because there may be other cases out there that are broken.
This patch fixes a breakage on R-Car Gen3 platforms, so reverting this patch will break those platforms. However, those platforms do not have a buggy DT, unlike the Jetson.
Quoted 45 lines
The whole point of
these quirks is also to make sure that existing device trees continue to work.Also, checking for only the enable-gpio property is wrong in this case. enable-gpio is only specified for regulator-gpio. The standard GPIO for regulator-fixed is "gpio", so the quirks must be applied to that property in order to ensure backwards-compatibility.
drivers/gpio/gpiolib-of.c static void of_gpio_flags_quirks(struct device_node *np, · line 90
Quoted 12 lines
drivers/gpio/gpiolib-of.c +1
-0@@ -84,6 +84,7 @@ static void of_gpio_flags_quirks(struct device_node *np,* Note that active low is the default. */ if (IS_ENABLED (CONFIG_REGULATOR ) && + !strcmp (propname,"enable-gpio" ) && (of_device_is_compatible (np,"regulator-fixed" ) ||of_device_is_compatible (np,"reg-fixed-voltage" ) ||of_device_is_compatible (np,"regulator-gpio" ))) {I think this would need to be something like the below to reflect what you were trying to achieve, while keeping backwards compatibility:
--- >8 ---
drivers/gpio/gpiolib-of.c +2
-3@@ -84,10 +84,10 @@ static void of_gpio_flags_quirks(struct device_node *np,* Note that active low is the default. */ if (IS_ENABLED (CONFIG_REGULATOR ) && - !strcmp (propname,"enable-gpio" ) && (of_device_is_compatible (np,"regulator-fixed" ) ||of_device_is_compatible (np,"reg-fixed-voltage" ) || -of_device_is_compatible (np,"regulator-gpio" ))) { + (of_device_is_compatible (np,"regulator-gpio" ) && +strcmp (propname,"enable-gpio" ) ==0 ))) {/* * The regulator GPIO handles are specified such that the * presence or absence of "enable-active-high" solely controls --- >8 ---
Quoted 3 lines
That applied on top of today's linux-next fixes the regression for me without a need to modify the device tree. Feel free to integrate that into your patch.
This one works on R-Car Gen3 too, so if we can add that on top of this patch, fine by me . Can you send a formal patch ?
Signature · 2 lines
Best regards, Marek Vasut
Quoted 94 lines · Marek Vasut
Quoted 93 lines · Thierry Reding
Quoted 57 lines · On Sat, Feb 16, 2019 at 02:46:27PM +0100, [email protected] wrote:
From: Marek Vasut <[email protected]>
Since commit
d6cd33ad7102("regulator: gpio: Convert to use descriptors") the GPIO regulator had inverted the polarity of the control GPIO. This problem manifested itself on systems with DT containing the following description (snippet fromsalvator-common.dtsi):gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; gpios-states = <1>; states = <3300000 1 1800000 0>;Prior to the aforementioned commit, the gpio-regulator code used
gpio_request_array()to claim the GPIO(s) specified in the "gpios" DT node, while the commit changed that todevm_gpiod_get_index().The legacy
gpio_request_array()callsgpio_request_one()and thengpiod_request(), which parses the DT flags of the "gpios" node and populates the GPIO descriptor flags field accordingly.The new
devm_gpiod_get_index()callsgpiod_get_index(), thenof_find_gpio(),of_get_named_gpiod_flags()with flags != NULL, and thenof_gpio_flags_quirks(). Since commita603a2b8d86e("gpio: of: Add special quirk to parse regulator flags"),of_gpio_flags_quirks()contains a quirk for regulator-gpio which was never triggered by the legacygpio_request_array()code path, but is triggered bydevm_gpiod_get_index()code path.This quirk checks whether a GPIO is associated with a fixed or gpio-regulator and if so, checks two additional conditions. First, whether such GPIO is active-low, and if so, ignores the active-low flag. Second, whether the regulator DT node does have an "enable-active-high" property and if the property is NOT present, sets the GPIO flags as active-low.
The second check triggers a problem, since it is applied to all GPIOs associated with a gpio-regulator, rather than only on the "enable" GPIOs, as the old code did. This changes the way the gpio-regulator interprets the DT description of the control GPIOs.
The old code using
gpio_request_array()explicitly parsed the "enable-active-high" DT property and only applied it to the GPIOs described in the "enable-gpios" DT node, and only if those were present.This patch fixes the quirk code by only applying the quirk to "enable-gpios", thus restoring the old behavior.
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Jan Kotas <[email protected]>Cc Linus Walleij <[email protected]>Cc Mark Brown <[email protected]>Cc Wolfram Sang <[email protected]>Quoted 4 lines
--- drivers/gpio/gpiolib-of.c | 1 + 1 file changed, 1 insertion(+)This causes a runtime regression on Jetson TX1. The symptoms are that HDMI monitors are no longer reliably detected as plugged in. The reason is because the GPIO polarity for the HDMI +5V regulator is now reversed and therefore the HPD signal, which is usually fed by the +5V signal, does not reflect the correct value.
Now it's somewhat confusing to me why this wasn't broken before. We have this in device tree:
vdd_hdmi: regulator@10 { compatible = "regulator-fixed"; reg = <10>; regulator-name = "VDD_HDMI_5V0"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; gpio = <&exp1 12 GPIO_ACTIVE_LOW>; enable-active-high; vin-supply = <&vdd_5v0_sys>; };This is from
arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi. The above is obviously wrong because it specifiesGPIO_ACTIVE_LOWand I do see the warning from the GPIO library about how this is being ignored. However, the above works fine on today's linux-next with this commit reverted because the quirks will cause theGPIO_ACTIVE_LOWflag to be ignored.However, with this commit applied, the quirk will be skipped for the regulator and cause the
GPIO_ACTIVE_LOWflag to be used to invert the GPIO during enable and disable operations.
Quoted 7 lines
Quoted 3 lines
Now, this is clearly a bug in the DT and I'm going to send out a patch to fix that up, but I think we need to revert this patch for now because there may be other cases out there that are broken.
This patch fixes a breakage on R-Car Gen3 platforms, so reverting this patch will break those platforms. However, those platforms do not have a buggy DT, unlike the Jetson.
Erm... that's not how we do things. You can't break one platform just to make another work. By all means let's fix breakage on R-Car Gen3 platforms, but let's do it in a way that keeps everyone else happy as well.
Quoted 45 lines
Quoted 45 lines
The whole point of
these quirks is also to make sure that existing device trees continue to work.Also, checking for only the enable-gpio property is wrong in this case. enable-gpio is only specified for regulator-gpio. The standard GPIO for regulator-fixed is "gpio", so the quirks must be applied to that property in order to ensure backwards-compatibility.
drivers/gpio/gpiolib-of.c static void of_gpio_flags_quirks(struct device_node *np, · line 90
Quoted 12 lines
drivers/gpio/gpiolib-of.c +1
-0@@ -84,6 +84,7 @@ static void of_gpio_flags_quirks(struct device_node *np,* Note that active low is the default. */ if (IS_ENABLED (CONFIG_REGULATOR ) && + !strcmp (propname,"enable-gpio" ) && (of_device_is_compatible (np,"regulator-fixed" ) ||of_device_is_compatible (np,"reg-fixed-voltage" ) ||of_device_is_compatible (np,"regulator-gpio" ))) {I think this would need to be something like the below to reflect what you were trying to achieve, while keeping backwards compatibility:
--- >8 ---
drivers/gpio/gpiolib-of.c +2
-3@@ -84,10 +84,10 @@ static void of_gpio_flags_quirks(struct device_node *np,* Note that active low is the default. */ if (IS_ENABLED (CONFIG_REGULATOR ) && - !strcmp (propname,"enable-gpio" ) && (of_device_is_compatible (np,"regulator-fixed" ) ||of_device_is_compatible (np,"reg-fixed-voltage" ) || -of_device_is_compatible (np,"regulator-gpio" ))) { + (of_device_is_compatible (np,"regulator-gpio" ) && +strcmp (propname,"enable-gpio" ) ==0 ))) {/* * The regulator GPIO handles are specified such that the * presence or absence of "enable-active-high" solely controls --- >8 ---
Quoted 6 lines
Quoted 3 lines
That applied on top of today's linux-next fixes the regression for me without a need to modify the device tree. Feel free to integrate that into your patch.
This one works on R-Car Gen3 too, so if we can add that on top of this patch, fine by me . Can you send a formal patch ?
Linus,
can you squash this into Marek's original commit? I'd rather not make that two patches because that would potentially cause bisectability issues.
Thierry
Quoted 99 lines · Thierry Reding
Quoted 98 lines · Marek Vasut
Quoted 96 lines · Thierry Reding
Quoted 57 lines · On Sat, Feb 16, 2019 at 02:46:27PM +0100, [email protected] wrote:
From: Marek Vasut <[email protected]>
Since commit
d6cd33ad7102("regulator: gpio: Convert to use descriptors") the GPIO regulator had inverted the polarity of the control GPIO. This problem manifested itself on systems with DT containing the following description (snippet fromsalvator-common.dtsi):gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; gpios-states = <1>; states = <3300000 1 1800000 0>;Prior to the aforementioned commit, the gpio-regulator code used
gpio_request_array()to claim the GPIO(s) specified in the "gpios" DT node, while the commit changed that todevm_gpiod_get_index().The legacy
gpio_request_array()callsgpio_request_one()and thengpiod_request(), which parses the DT flags of the "gpios" node and populates the GPIO descriptor flags field accordingly.The new
devm_gpiod_get_index()callsgpiod_get_index(), thenof_find_gpio(),of_get_named_gpiod_flags()with flags != NULL, and thenof_gpio_flags_quirks(). Since commita603a2b8d86e("gpio: of: Add special quirk to parse regulator flags"),of_gpio_flags_quirks()contains a quirk for regulator-gpio which was never triggered by the legacygpio_request_array()code path, but is triggered bydevm_gpiod_get_index()code path.This quirk checks whether a GPIO is associated with a fixed or gpio-regulator and if so, checks two additional conditions. First, whether such GPIO is active-low, and if so, ignores the active-low flag. Second, whether the regulator DT node does have an "enable-active-high" property and if the property is NOT present, sets the GPIO flags as active-low.
The second check triggers a problem, since it is applied to all GPIOs associated with a gpio-regulator, rather than only on the "enable" GPIOs, as the old code did. This changes the way the gpio-regulator interprets the DT description of the control GPIOs.
The old code using
gpio_request_array()explicitly parsed the "enable-active-high" DT property and only applied it to the GPIOs described in the "enable-gpios" DT node, and only if those were present.This patch fixes the quirk code by only applying the quirk to "enable-gpios", thus restoring the old behavior.
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Jan Kotas <[email protected]>Cc Linus Walleij <[email protected]>Cc Mark Brown <[email protected]>Cc Wolfram Sang <[email protected]>Quoted 4 lines
--- drivers/gpio/gpiolib-of.c | 1 + 1 file changed, 1 insertion(+)This causes a runtime regression on Jetson TX1. The symptoms are that HDMI monitors are no longer reliably detected as plugged in. The reason is because the GPIO polarity for the HDMI +5V regulator is now reversed and therefore the HPD signal, which is usually fed by the +5V signal, does not reflect the correct value.
Now it's somewhat confusing to me why this wasn't broken before. We have this in device tree:
vdd_hdmi: regulator@10 { compatible = "regulator-fixed"; reg = <10>; regulator-name = "VDD_HDMI_5V0"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; gpio = <&exp1 12 GPIO_ACTIVE_LOW>; enable-active-high; vin-supply = <&vdd_5v0_sys>; };This is from
arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi. The above is obviously wrong because it specifiesGPIO_ACTIVE_LOWand I do see the warning from the GPIO library about how this is being ignored. However, the above works fine on today's linux-next with this commit reverted because the quirks will cause theGPIO_ACTIVE_LOWflag to be ignored.However, with this commit applied, the quirk will be skipped for the regulator and cause the
GPIO_ACTIVE_LOWflag to be used to invert the GPIO during enable and disable operations.Now, this is clearly a bug in the DT and I'm going to send out a patch to fix that up, but I think we need to revert this patch for now because there may be other cases out there that are broken.
Quoted 8 lines
Quoted 3 lines
This patch fixes a breakage on R-Car Gen3 platforms, so reverting this patch will break those platforms. However, those platforms do not have a buggy DT, unlike the Jetson.
Erm... that's not how we do things. You can't break one platform just to make another work. By all means let's fix breakage on R-Car Gen3 platforms, but let's do it in a way that keeps everyone else happy as well.
Erm... that's not what I suggested. It's just that this regulator rework ( d6cd33ad7102 ) changed the behavior of the gpio-regulator because there are a lot of obscure, inobvious and undocumented edge-cases in the gpio-regulator code.
If we were to revert this patch, we'd have to revert the d6cd33ad7102 too to fix the Gen3. But since d6cd33ad7102 is a nice cleanup and it makes sense, I'd rather if we fixed the situation, restored the DT handling to the way it was before and moved forward.
Handling broken DTs only adds to the complexity, but I think this cannot be helped, since those DTs can be stored in some ROM.
btw if you can, also look at
[PATCH] regulator: gpio: Reword the binding document the binding document could use a once-over.
Quoted 52 lines
Quoted 45 lines
Quoted 45 lines
The whole point of
these quirks is also to make sure that existing device trees continue to work.Also, checking for only the enable-gpio property is wrong in this case. enable-gpio is only specified for regulator-gpio. The standard GPIO for regulator-fixed is "gpio", so the quirks must be applied to that property in order to ensure backwards-compatibility.
drivers/gpio/gpiolib-of.c static void of_gpio_flags_quirks(struct device_node *np, · line 90
Quoted 12 lines
drivers/gpio/gpiolib-of.c +1
-0@@ -84,6 +84,7 @@ static void of_gpio_flags_quirks(struct device_node *np,* Note that active low is the default. */ if (IS_ENABLED (CONFIG_REGULATOR ) && + !strcmp (propname,"enable-gpio" ) && (of_device_is_compatible (np,"regulator-fixed" ) ||of_device_is_compatible (np,"reg-fixed-voltage" ) ||of_device_is_compatible (np,"regulator-gpio" ))) {I think this would need to be something like the below to reflect what you were trying to achieve, while keeping backwards compatibility:
--- >8 ---
drivers/gpio/gpiolib-of.c +2
-3@@ -84,10 +84,10 @@ static void of_gpio_flags_quirks(struct device_node *np,* Note that active low is the default. */ if (IS_ENABLED (CONFIG_REGULATOR ) && - !strcmp (propname,"enable-gpio" ) && (of_device_is_compatible (np,"regulator-fixed" ) ||of_device_is_compatible (np,"reg-fixed-voltage" ) || -of_device_is_compatible (np,"regulator-gpio" ))) { + (of_device_is_compatible (np,"regulator-gpio" ) && +strcmp (propname,"enable-gpio" ) ==0 ))) {/* * The regulator GPIO handles are specified such that the * presence or absence of "enable-active-high" solely controls --- >8 --- Quoted 6 lines
Quoted 3 lines
That applied on top of today's linux-next fixes the regression for me without a need to modify the device tree. Feel free to integrate that into your patch.
This one works on R-Car Gen3 too, so if we can add that on top of this patch, fine by me . Can you send a formal patch ?
Quoted 5 lines
Linus,
can you squash this into Marek's original commit? I'd rather not make that two patches because that would potentially cause bisectability issues.
I am happy with this solution too, sure.
Signature · 2 lines
Best regards, Marek Vasut
Quoted 109 lines · Marek Vasut
Quoted 99 lines · Thierry Reding
Quoted 98 lines · Marek Vasut
Quoted 96 lines · Thierry Reding
Quoted 57 lines · On Sat, Feb 16, 2019 at 02:46:27PM +0100, [email protected] wrote:
From: Marek Vasut <[email protected]>
Since commit
d6cd33ad7102("regulator: gpio: Convert to use descriptors") the GPIO regulator had inverted the polarity of the control GPIO. This problem manifested itself on systems with DT containing the following description (snippet fromsalvator-common.dtsi):gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; gpios-states = <1>; states = <3300000 1 1800000 0>;Prior to the aforementioned commit, the gpio-regulator code used
gpio_request_array()to claim the GPIO(s) specified in the "gpios" DT node, while the commit changed that todevm_gpiod_get_index().The legacy
gpio_request_array()callsgpio_request_one()and thengpiod_request(), which parses the DT flags of the "gpios" node and populates the GPIO descriptor flags field accordingly.The new
devm_gpiod_get_index()callsgpiod_get_index(), thenof_find_gpio(),of_get_named_gpiod_flags()with flags != NULL, and thenof_gpio_flags_quirks(). Since commita603a2b8d86e("gpio: of: Add special quirk to parse regulator flags"),of_gpio_flags_quirks()contains a quirk for regulator-gpio which was never triggered by the legacygpio_request_array()code path, but is triggered bydevm_gpiod_get_index()code path.This quirk checks whether a GPIO is associated with a fixed or gpio-regulator and if so, checks two additional conditions. First, whether such GPIO is active-low, and if so, ignores the active-low flag. Second, whether the regulator DT node does have an "enable-active-high" property and if the property is NOT present, sets the GPIO flags as active-low.
The second check triggers a problem, since it is applied to all GPIOs associated with a gpio-regulator, rather than only on the "enable" GPIOs, as the old code did. This changes the way the gpio-regulator interprets the DT description of the control GPIOs.
The old code using
gpio_request_array()explicitly parsed the "enable-active-high" DT property and only applied it to the GPIOs described in the "enable-gpios" DT node, and only if those were present.This patch fixes the quirk code by only applying the quirk to "enable-gpios", thus restoring the old behavior.
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Jan Kotas <[email protected]>Cc Linus Walleij <[email protected]>Cc Mark Brown <[email protected]>Cc Wolfram Sang <[email protected]>Quoted 4 lines
--- drivers/gpio/gpiolib-of.c | 1 + 1 file changed, 1 insertion(+)This causes a runtime regression on Jetson TX1. The symptoms are that HDMI monitors are no longer reliably detected as plugged in. The reason is because the GPIO polarity for the HDMI +5V regulator is now reversed and therefore the HPD signal, which is usually fed by the +5V signal, does not reflect the correct value.
Now it's somewhat confusing to me why this wasn't broken before. We have this in device tree:
vdd_hdmi: regulator@10 { compatible = "regulator-fixed"; reg = <10>; regulator-name = "VDD_HDMI_5V0"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; gpio = <&exp1 12 GPIO_ACTIVE_LOW>; enable-active-high; vin-supply = <&vdd_5v0_sys>; };This is from
arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi. The above is obviously wrong because it specifiesGPIO_ACTIVE_LOWand I do see the warning from the GPIO library about how this is being ignored. However, the above works fine on today's linux-next with this commit reverted because the quirks will cause theGPIO_ACTIVE_LOWflag to be ignored.However, with this commit applied, the quirk will be skipped for the regulator and cause the
GPIO_ACTIVE_LOWflag to be used to invert the GPIO during enable and disable operations.Now, this is clearly a bug in the DT and I'm going to send out a patch to fix that up, but I think we need to revert this patch for now because there may be other cases out there that are broken.
Quoted 8 lines
Quoted 3 lines
This patch fixes a breakage on R-Car Gen3 platforms, so reverting this patch will break those platforms. However, those platforms do not have a buggy DT, unlike the Jetson.
Erm... that's not how we do things. You can't break one platform just to make another work. By all means let's fix breakage on R-Car Gen3 platforms, but let's do it in a way that keeps everyone else happy as well.
Quoted 4 lines
Erm... that's not what I suggested. It's just that this regulator rework (
d6cd33ad7102) changed the behavior of the gpio-regulator because there are a lot of obscure, inobvious and undocumented edge-cases in the gpio-regulator code.
Sorry if I misinterpreted what you were saying.
Quoted 4 lines
If we were to revert this patch, we'd have to revert the
d6cd33ad7102too to fix the Gen3. But sinced6cd33ad7102is a nice cleanup and it makes sense, I'd rather if we fixed the situation, restored the DT handling to the way it was before and moved forward.
Okay, sounds like we have the same goal, and from what you said earlier the proposed fixup on top of your patch should fix this for everyone. Let's hope there aren't any more nasty corner cases.
Quoted 2 lines
Handling broken DTs only adds to the complexity, but I think this cannot be helped, since those DTs can be stored in some ROM.
FWIW, the Jetson TX1 DT isn't technically broken because it used to work fine. It's just that it relied on the quirks for correctness. So we are in the lucky situation that the DT is not in a ROM and we can easily update it, but I agree, others may be in a different situation, so let's fix this so that things are back to normal for everyone. That doesn't mean that we shouldn't fix DTs when we can, so I'll still send out that DT patch for Jetson TX1.
Quoted 3 lines
btw if you can, also look at
[PATCH] regulator: gpio: Reword the binding document the binding document could use a once-over.
Okay, I'll take a look.
Thierry
Quoted 110 lines · Thierry Reding
Quoted 109 lines · Marek Vasut
Quoted 107 lines · Thierry Reding
Quoted 94 lines · Marek Vasut
Quoted 93 lines · Thierry Reding
Quoted 57 lines · On Sat, Feb 16, 2019 at 02:46:27PM +0100, [email protected] wrote:
From: Marek Vasut <[email protected]>
Since commit
d6cd33ad7102("regulator: gpio: Convert to use descriptors") the GPIO regulator had inverted the polarity of the control GPIO. This problem manifested itself on systems with DT containing the following description (snippet fromsalvator-common.dtsi):gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; gpios-states = <1>; states = <3300000 1 1800000 0>;Prior to the aforementioned commit, the gpio-regulator code used
gpio_request_array()to claim the GPIO(s) specified in the "gpios" DT node, while the commit changed that todevm_gpiod_get_index().The legacy
gpio_request_array()callsgpio_request_one()and thengpiod_request(), which parses the DT flags of the "gpios" node and populates the GPIO descriptor flags field accordingly.The new
devm_gpiod_get_index()callsgpiod_get_index(), thenof_find_gpio(),of_get_named_gpiod_flags()with flags != NULL, and thenof_gpio_flags_quirks(). Since commita603a2b8d86e("gpio: of: Add special quirk to parse regulator flags"),of_gpio_flags_quirks()contains a quirk for regulator-gpio which was never triggered by the legacygpio_request_array()code path, but is triggered bydevm_gpiod_get_index()code path.This quirk checks whether a GPIO is associated with a fixed or gpio-regulator and if so, checks two additional conditions. First, whether such GPIO is active-low, and if so, ignores the active-low flag. Second, whether the regulator DT node does have an "enable-active-high" property and if the property is NOT present, sets the GPIO flags as active-low.
The second check triggers a problem, since it is applied to all GPIOs associated with a gpio-regulator, rather than only on the "enable" GPIOs, as the old code did. This changes the way the gpio-regulator interprets the DT description of the control GPIOs.
The old code using
gpio_request_array()explicitly parsed the "enable-active-high" DT property and only applied it to the GPIOs described in the "enable-gpios" DT node, and only if those were present.This patch fixes the quirk code by only applying the quirk to "enable-gpios", thus restoring the old behavior.
Signed-off-by Marek Vasut <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Jan Kotas <[email protected]>Cc Linus Walleij <[email protected]>Cc Mark Brown <[email protected]>Cc Wolfram Sang <[email protected]>Quoted 4 lines
--- drivers/gpio/gpiolib-of.c | 1 + 1 file changed, 1 insertion(+)This causes a runtime regression on Jetson TX1. The symptoms are that HDMI monitors are no longer reliably detected as plugged in. The reason is because the GPIO polarity for the HDMI +5V regulator is now reversed and therefore the HPD signal, which is usually fed by the +5V signal, does not reflect the correct value.
Now it's somewhat confusing to me why this wasn't broken before. We have this in device tree:
vdd_hdmi: regulator@10 { compatible = "regulator-fixed"; reg = <10>; regulator-name = "VDD_HDMI_5V0"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; gpio = <&exp1 12 GPIO_ACTIVE_LOW>; enable-active-high; vin-supply = <&vdd_5v0_sys>; };This is from
arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi. The above is obviously wrong because it specifiesGPIO_ACTIVE_LOWand I do see the warning from the GPIO library about how this is being ignored. However, the above works fine on today's linux-next with this commit reverted because the quirks will cause theGPIO_ACTIVE_LOWflag to be ignored.However, with this commit applied, the quirk will be skipped for the regulator and cause the
GPIO_ACTIVE_LOWflag to be used to invert the GPIO during enable and disable operations.Quoted 7 lines
Quoted 3 lines
Now, this is clearly a bug in the DT and I'm going to send out a patch to fix that up, but I think we need to revert this patch for now because there may be other cases out there that are broken.
This patch fixes a breakage on R-Car Gen3 platforms, so reverting this patch will break those platforms. However, those platforms do not have a buggy DT, unlike the Jetson.
Erm... that's not how we do things. You can't break one platform just to make another work. By all means let's fix breakage on R-Car Gen3 platforms, but let's do it in a way that keeps everyone else happy as well.
Quoted 6 lines
Quoted 4 lines
Erm... that's not what I suggested. It's just that this regulator rework (
d6cd33ad7102) changed the behavior of the gpio-regulator because there are a lot of obscure, inobvious and undocumented edge-cases in the gpio-regulator code.Sorry if I misinterpreted what you were saying.
Sorry, my English just sucks ;-/
Quoted 8 lines
Quoted 4 lines
If we were to revert this patch, we'd have to revert the
d6cd33ad7102too to fix the Gen3. But sinced6cd33ad7102is a nice cleanup and it makes sense, I'd rather if we fixed the situation, restored the DT handling to the way it was before and moved forward.Okay, sounds like we have the same goal, and from what you said earlier the proposed fixup on top of your patch should fix this for everyone. Let's hope there aren't any more nasty corner cases.
Sounds good!
Quoted 10 lines
Quoted 2 lines
Handling broken DTs only adds to the complexity, but I think this cannot be helped, since those DTs can be stored in some ROM.
FWIW, the Jetson TX1 DT isn't technically broken because it used to work fine. It's just that it relied on the quirks for correctness. So we are in the lucky situation that the DT is not in a ROM and we can easily update it, but I agree, others may be in a different situation, so let's fix this so that things are back to normal for everyone. That doesn't mean that we shouldn't fix DTs when we can, so I'll still send out that DT patch for Jetson TX1.
Thanks!
Quoted 5 lines
Quoted 3 lines
btw if you can, also look at
[PATCH] regulator: gpio: Reword the binding document the binding document could use a once-over.Okay, I'll take a look.
:)
Signature · 2 lines
Best regards, Marek Vasut
Quoted 2 lines · Marek Vasut
Handling broken DTs only adds to the complexity, but I think this cannot be helped, since those DTs can be stored in some ROM.
I agree, but if the broken DT needs to be supported going forward I would like it to be quite explicit, so that the code down in gpiolib-of.c does this:
/*
* Comment about this machine
*/
if (of_machine_is_compatible("nvidia,problematic-board") {
/* Quirk for this specific DT for this machine*/
}
This makes the standard behavior clear and avoids the risk of applying hairy machine-specific quirks to any other machine, but even more importantly it makes it easy for people reading the code to see what is going on and why.
Yours,
Linus Walleij
Quoted 5 lines · Thierry Reding
Linus,
can you squash this into Marek's original commit? I'd rather not make that two patches because that would potentially cause bisectability issues.
Sadly no, new development is merged on top.
Bisection breaks sometimes, it's just how it is.
(OK if you tell me off very sternly about how this destroys everything for you then I will have to revert all development and re-pull pull requests etc but I'd rather not.)
Could you send a patch fixing the patch, preferably along the lines of
if (of_machine_is_compatible("nvidia,problematic-board")) as I outlined?
Yours,
Linus Walleij
Quoted 12 lines · Linus Walleij
Quoted 2 lines · Marek Vasut
Handling broken DTs only adds to the complexity, but I think this cannot be helped, since those DTs can be stored in some ROM.
I agree, but if the broken DT needs to be supported going forward I would like it to be quite explicit, so that the code down in
gpiolib-of.cdoes this:/*
* Comment about this machine
*/
Quoted 8 lines
if (of_machine_is_compatible("nvidia,problematic-board") { /* Quirk for this specific DT for this machine*/ }This makes the standard behavior clear and avoids the risk of applying hairy machine-specific quirks to any other machine, but even more importantly it makes it easy for people reading the code to see what is going on and why.
At the risk of repeating myself: the device tree bindings for regulator- fixed are very clear: any flags in the specifier are ignored and the polarity of the GPIO is determined exclusively by the enable-active-high property.
This means that, contrary to what I said earlier, the Jetson TX1 device tree is not actually buggy. Is it confusing and inconsistent? Yes it is. But it was never wrong according to the bindings.
The commit that you merged broke the ABI set forth in the bindings by not applying the quirks necessary to adhere to the bindings for these fixed regulators. It was supposed to only avoid the quirks for GPIO regulators, which are an entirely different thing.
Given the above, I don't think adding the quirk for a specific machine is acceptable. There could be any number of device trees that rely on the literal interpretation of the device tree bindings and they would all remain broken if we added a quirk only for Jetson TX1.
Thierry