]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Input: zforce_ts - stop treating VDD regulator as optional
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 24 Aug 2024 05:50:38 +0000 (22:50 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 6 Sep 2024 05:56:46 +0000 (22:56 -0700)
This regulator is not optional from the controller point of view,
so stop treating it as such. For hard-wired designs that omit the
regulator from their device trees regulator subsystem will create
a dummy instance.

This may introduce unnecessary delay of 100us in case of dummy
regulator, but if it is important the driver should be marked as
using asynchronous probing to avoid even longer delays waiting for
the command completions.

Also use usleep_range() instead of udelay() to avoid spinning.

Tested-by: Andreas Kemnade <andreas@kemnade.info> # Tolino Shine2HD
Link: https://lore.kernel.org/r/20240824055047.1706392-15-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/zforce_ts.c

index 2ae079db88847567443e748d5c83edb084c6f114..c6b506a01b2aeba990bdb24d607847d2dd38a222 100644 (file)
@@ -742,23 +742,21 @@ static int zforce_probe(struct i2c_client *client)
                                             "failed to request reset GPIO\n");
        }
 
-       ts->reg_vdd = devm_regulator_get_optional(&client->dev, "vdd");
+       ts->reg_vdd = devm_regulator_get(&client->dev, "vdd");
        error = PTR_ERR_OR_ZERO(ts->gpio_rst);
-       if (error) {
-               if (error != -ENOENT)
-                       return dev_err_probe(&client->dev, error,
-                                            "failed to request vdd supply\n");
-       } else {
-               error = regulator_enable(ts->reg_vdd);
-               if (error)
-                       return error;
+       if (error)
+               return dev_err_probe(&client->dev, error,
+                                    "failed to request vdd supply\n");
 
-               /*
-                * according to datasheet add 100us grace time after regular
-                * regulator enable delay.
-                */
-               udelay(100);
-       }
+       error = regulator_enable(ts->reg_vdd);
+       if (error)
+               return error;
+
+       /*
+        * According to datasheet add 100us grace time after regular
+        * regulator enable delay.
+        */
+       usleep_range(100, 200);
 
        error = devm_add_action_or_reset(&client->dev, zforce_reset, ts);
        if (error)