]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
regulator: Fetch enable gpiods nonexclusive
authorLinus Walleij <linus.walleij@linaro.org>
Mon, 15 Oct 2018 09:02:40 +0000 (11:02 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 15 Oct 2018 09:48:59 +0000 (10:48 +0100)
Since the core regulator code is treating GPIO descriptors as
nonexclusive, i.e. it assumes that the enable GPIO line may be
shared with several regulators, let's add the flag introduced
for fixing this problem on fixed regulators to all drivers
fetching GPIO descriptors to avoid possible regressions.

Reported-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/arizona-ldo1.c
drivers/regulator/da9211-regulator.c
drivers/regulator/lm363x-regulator.c
drivers/regulator/lp8788-ldo.c
drivers/regulator/max8952.c
drivers/regulator/max8973-regulator.c
drivers/regulator/s5m8767.c
drivers/regulator/tps65090-regulator.c

index e976d073f28d6ffa1562d0a7e39f6b979b926a4c..9a72eae4926d5ceabad10d478851bedb604bfef1 100644 (file)
@@ -260,7 +260,7 @@ static int arizona_ldo1_common_init(struct platform_device *pdev,
         * so clean up would happen at the wrong time
         */
        config.ena_gpiod = gpiod_get_optional(parent_dev, "wlf,ldoena",
-                                             GPIOD_OUT_LOW);
+                               GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
        if (IS_ERR(config.ena_gpiod))
                return PTR_ERR(config.ena_gpiod);
 
index 6c122b3df5d03529e5dc8b8046fbd92df31a2c30..8f68c7a05d27968970287c8811f5e1764c1ad859 100644 (file)
@@ -294,11 +294,11 @@ static struct da9211_pdata *da9211_parse_regulators_dt(
                pdata->init_data[n] = da9211_matches[i].init_data;
                pdata->reg_node[n] = da9211_matches[i].of_node;
                pdata->gpiod_ren[n] = devm_gpiod_get_from_of_node(dev,
-                                                                 da9211_matches[i].of_node,
-                                                                 "enable",
-                                                                 0,
-                                                                 GPIOD_OUT_HIGH,
-                                                                 "da9211-enable");
+                                 da9211_matches[i].of_node,
+                                 "enable",
+                                 0,
+                                 GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE,
+                                 "da9211-enable");
                n++;
        }
 
index b615a413ca9f6ff3f2313349be5edd38dabb0855..bbedb08d257b602e884ff1827422215302b0011c 100644 (file)
@@ -227,9 +227,11 @@ static struct gpio_desc *lm363x_regulator_of_get_enable_gpio(struct device *dev,
         */
        switch (id) {
        case LM3632_LDO_POS:
-               return devm_gpiod_get_index_optional(dev, "enable", 0, GPIOD_OUT_LOW);
+               return devm_gpiod_get_index_optional(dev, "enable", 0,
+                               GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
        case LM3632_LDO_NEG:
-               return devm_gpiod_get_index_optional(dev, "enable", 1, GPIOD_OUT_LOW);
+               return devm_gpiod_get_index_optional(dev, "enable", 1,
+                               GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
        default:
                return NULL;
        }
index f2347474a106ecdc4f0f012db0d7acdaf01f4b7a..553b4790050f6650a525155b64ccd4cc3c71a6e9 100644 (file)
@@ -503,9 +503,10 @@ static int lp8788_config_ldo_enable_mode(struct platform_device *pdev,
 
        /* FIXME: check default mode for GPIO here: high or low? */
        ldo->ena_gpiod = devm_gpiod_get_index_optional(&pdev->dev,
-                                                      "enable",
-                                                      enable_id,
-                                                      GPIOD_OUT_HIGH);
+                                              "enable",
+                                              enable_id,
+                                              GPIOD_OUT_HIGH |
+                                              GPIOD_FLAGS_BIT_NONEXCLUSIVE);
        if (IS_ERR(ldo->ena_gpiod))
                return PTR_ERR(ldo->ena_gpiod);
 
index f1e77ed5dfec942d0a711c05c5bf4f59934a9bc6..6c39fff73b8acd61c57cb3fc7fc13c3af7a64bdc 100644 (file)
@@ -230,6 +230,7 @@ static int max8952_pmic_probe(struct i2c_client *client,
                gflags = GPIOD_OUT_HIGH;
        else
                gflags = GPIOD_OUT_LOW;
+       gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE;
        gpiod = devm_gpiod_get_optional(&client->dev,
                                        "max8952,en",
                                        gflags);
index 7cd493ec63157b3007f391ac6acec2540440f254..e7a58b50903203f81b669b5fa2b51031d574a090 100644 (file)
@@ -758,6 +758,7 @@ static int max8973_probe(struct i2c_client *client,
                        gflags = GPIOD_OUT_HIGH;
                else
                        gflags = GPIOD_OUT_LOW;
+               gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE;
                gpiod = devm_gpiod_get_optional(&client->dev,
                                                "maxim,enable",
                                                gflags);
index 09a97a7093e848dbc82f56af41995f32f4dcd581..219b9afda0cb937c6cecd424c7481b339348c4d1 100644 (file)
@@ -571,12 +571,13 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
                        continue;
                }
 
-               rdata->ext_control_gpiod = devm_gpiod_get_from_of_node(&pdev->dev,
-                                                                      reg_np,
-                                                                      "s5m8767,pmic-ext-control-gpios",
-                                                                      0,
-                                                                      GPIOD_OUT_HIGH,
-                                                                      "s5m8767");
+               rdata->ext_control_gpiod = devm_gpiod_get_from_of_node(
+                       &pdev->dev,
+                       reg_np,
+                       "s5m8767,pmic-ext-control-gpios",
+                       0,
+                       GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE,
+                       "s5m8767");
                if (IS_ERR(rdata->ext_control_gpiod))
                        return PTR_ERR(rdata->ext_control_gpiod);
 
index edaef9e4dc74ea7e1994343a2e2eb6a4e7bf02ef..db714d5edafc8846285b2bf500e4eb1a4ab334aa 100644 (file)
@@ -374,6 +374,7 @@ static struct tps65090_platform_data *tps65090_parse_dt_reg_data(
                                gflags = GPIOD_OUT_HIGH;
                        else
                                gflags = GPIOD_OUT_LOW;
+                       gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE;
 
                        rpdata->gpiod = devm_gpiod_get_from_of_node(&pdev->dev,
                                                                    tps65090_matches[idx].of_node,