Browse Source

touch: goodix: vote avdd power grid to the right voltage

On palawan target, TP avdd was loaded on L22B which limited the voltage
from 2700mv to 3400mv and initialized to 2700mv. From the touch side,
the typical voltage is 2.8v~3.2v, and our existing FW was tuned based on AVDD 3.2V.

Change-Id: I4efe51b26cf8de41d0a03bf29b69e3fd07ddabab
Signed-off-by: Rui Chen <[email protected]>
Rui Chen 1 year ago
parent
commit
6207267c95
1 changed files with 16 additions and 0 deletions
  1. 16 0
      goodix_berlin_driver/goodix_brl_hw.c

+ 16 - 0
goodix_berlin_driver/goodix_brl_hw.c

@@ -206,6 +206,9 @@ static int brl_reset_after(struct goodix_ts_core *cd)
 
 #define REG_SUSPEND_CURRENT 20
 #define REG_RESUME_CURRENT 30000
+#define REG_RESUME_MIN_VOLTAGE 3200000
+#define REG_RESUME_MAX_VOLTAGE 3200000
+
 static int brl_power_on(struct goodix_ts_core *cd, bool on)
 {
 	int ret = 0;
@@ -234,6 +237,19 @@ static int brl_power_on(struct goodix_ts_core *cd, bool on)
 		if (avdd_gpio > 0) {
 			gpio_direction_output(avdd_gpio, 1);
 		} else if (cd->avdd) {
+			if (regulator_count_voltages(cd->avdd) > 0) {
+				ret = regulator_set_load(cd->avdd, REG_RESUME_CURRENT);
+				if (ret) {
+					ts_err("vdd regulator set_load failed ret=%d", ret);
+					return ret;
+				}
+				ret = regulator_set_voltage(cd->avdd, REG_RESUME_MIN_VOLTAGE,
+							REG_RESUME_MAX_VOLTAGE);
+				if (ret) {
+					ts_err("vdd regulator set_vtg failed ret=%d", ret);
+					return ret;
+				}
+			}
 			ret = regulator_enable(cd->avdd);
 			if (ret < 0) {
 				ts_err("Failed to enable avdd:%d", ret);