# supplies-something-maybe-works-might-get-yelled-at-by-linus.patch -rw-r--r-- 3.0 KiB View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
index 870b8c5cce9b..4b3e54733bc8 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
@@ -35,6 +35,8 @@ Optional properties:
  - pinctrl-0:   a phandle pointing to the pin settings for the
                 control gpios
 
+ - vdd-supply:  The controller supply
+
  - threshold:   allows setting the "click"-threshold in the range
                 from 0 to 80.
 
@@ -65,6 +67,7 @@ Example:
 	polytouch: edt-ft5x06@38 {
 		compatible = "edt,edt-ft5406", "edt,edt-ft5x06";
 		reg = <0x38>;
+		vdd-supply = <&reg_ldo_io0>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&edt_ft5x06_pins>;
 		interrupt-parent = <&gpio2>;
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-dontbeevil.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-dontbeevil.dts
index fbfd747bd083..24c32821572f 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-dontbeevil.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-dontbeevil.dts
@@ -125,11 +125,6 @@
 	};
 };
 
-&reg_ldo_io0 {
-	status = "enabled";
-	regulator-always-on;
-};
-
 &ac_power_supply {
 	status = "okay";
 };
@@ -252,6 +247,8 @@
 		interrupts = <7 4 IRQ_TYPE_EDGE_FALLING>;
 		irq-gpios = <&pio 7 4 GPIO_ACTIVE_LOW>;
 
+		vdd-supply = <&reg_ldo_io0>;
+
 		touchscreen-size-x = <720>;
 		touchscreen-size-y = <1440>;
 
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 702bfda7ee77..50ae55667e89 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -29,6 +29,7 @@
 #include <linux/ratelimit.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
+#include <linux/regulator/consumer.h>
 #include <linux/input.h>
 #include <linux/i2c.h>
 #include <linux/kernel.h>
@@ -103,6 +104,7 @@ struct edt_ft5x06_ts_data {
 
 	struct gpio_desc *reset_gpio;
 	struct gpio_desc *wake_gpio;
+	struct regulator *vdd;
 
 #if defined(CONFIG_DEBUG_FS)
 	struct dentry *debug_dir;
@@ -1092,6 +1094,22 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 		return error;
 	}
 
+	tsdata->vdd = devm_regulator_get(&client->dev, "vdd");
+	if (IS_ERR(ts->vdd)) {
+		error = PTR_ERR(tsdata->vdd);
+		if (error != -EPROBE_DEFER)
+			dev_err(&client->dev,
+				"Failed to get vdd regulator: %d\n", error);
+		return error;
+	}
+
+	/* power the controller */
+	error = regulator_enable(tsdata->vdd);
+	if (error) {
+		dev_err(&client->dev, "Controller fail to enable vdd\n");
+		return error;
+	}
+
 	tsdata->wake_gpio = devm_gpiod_get_optional(&client->dev,
 						    "wake", GPIOD_OUT_LOW);
 	if (IS_ERR(tsdata->wake_gpio)) {
@@ -1204,6 +1222,7 @@ static int edt_ft5x06_ts_remove(struct i2c_client *client)
 {
 	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
 
+	regulator_disable(tsdata->vdd);
 	edt_ft5x06_ts_teardown_debugfs(tsdata);
 
 	return 0;