bms: fix warnings

Bug: 164274666
Test: recompile
Signed-off-by: AleX Pelosi <[email protected]>
Change-Id: I2317f1f25a50b633c10090e754c9d37026c3b3e7
diff --git a/Makefile b/Makefile
index af169e2..f6fa80b 100644
--- a/Makefile
+++ b/Makefile
@@ -76,9 +76,19 @@
 # OVP
 obj-$(CONFIG_MAX20339)	+= max20339.o
 
-# prevent warnings on gernated include files
-CFLAGS_max77759_charger.o += -Wno-unused-function
-CFLAGS_max77729_charger.o += -Wno-unused-function
+# prevent warnings
+WENUMS=-Wno-enum-conversion -Wno-switch
+
+CFLAGS_max77759_charger.o += -Wno-unused-function $(WENUMS)
+CFLAGS_max77729_charger.o += -Wno-unused-function $(WENUMS)
+CFLAGS_max1720x_battery.o += $(WENUMS)
+CFLAGS_pca9468_charger.o += $(WENUMS)
+CFLAGS_google_battery.o += $(WENUMS)
+CFLAGS_google_ttf.o += -Wno-format
+CFLAGS_google_charger.o += -Wno-enum-conversion
+CFLAGS_google_bms.o += -Wno-enum-conversion
+CFLAGS_google_cpm.o += $(WENUMS)
+
 
 KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
 M ?= $(shell pwd)
diff --git a/gbms_storage.c b/gbms_storage.c
index 4152c15..86e455c 100644
--- a/gbms_storage.c
+++ b/gbms_storage.c
@@ -1123,7 +1123,7 @@
 			pr_err("gbee %s lookup failed, dummy=%d\n",
 				beed->bee_name, ret);
 		} else {
-			pr_debug("gbee %s retry lookup... (%d)\n",
+			pr_debug("gbee %s retry lookup... (%ld)\n",
 				 beed->bee_name, PTR_ERR(bee_nvram));
 			schedule_delayed_work(&bee_work,
 				msecs_to_jiffies(GBEE_POLL_INTERVAL_MS));
diff --git a/google_battery.c b/google_battery.c
index a6e28c4..d4fe9d7 100644
--- a/google_battery.c
+++ b/google_battery.c
@@ -1246,7 +1246,7 @@
 			(verbose) ? ':' : ',');
 
 		len += scnprintf(&buff[len], size - len,
-			"%d.%d,%d,%d, %d,%d,%d, %d,%ld,%d, %d,%ld,%d, %d,%ld,%d",
+			"%d.%d,%d,%d, %d,%d,%d, %d,%lld,%d, %d,%lld,%d, %d,%lld,%d",
 				soc_in,
 				ce_data->tier_stats[i].soc_in & 0xff,
 				ce_data->tier_stats[i].cc_in,
@@ -1396,6 +1396,7 @@
 	ret = gbms_storage_read(GBMS_TAG_BRES, &data32, sizeof(data32));
 	if (ret < 0)
 		return;
+	resistance = data32;
 
 	if (ssoc_get_real(&batt_drv->ssoc_state) < ssoc_threshold) {
 		rstate->sample_accumulator += resistance / 100;
@@ -2311,7 +2312,7 @@
 
 DEFINE_SIMPLE_ATTRIBUTE(cycle_count_bins_sync_fops,
 				cycle_count_bins_reload,
-				cycle_count_bins_store, "%d\n");
+				cycle_count_bins_store, "%llu\n");
 
 
 static int debug_get_ssoc_gdf(void *data, u64 *val)
@@ -2321,7 +2322,7 @@
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(debug_ssoc_gdf_fops, debug_get_ssoc_gdf, NULL, "%u\n");
+DEFINE_SIMPLE_ATTRIBUTE(debug_ssoc_gdf_fops, debug_get_ssoc_gdf, NULL, "%llu\n");
 
 
 static int debug_get_ssoc_uic(void *data, u64 *val)
@@ -2331,7 +2332,7 @@
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(debug_ssoc_uic_fops, debug_get_ssoc_uic, NULL, "%u\n");
+DEFINE_SIMPLE_ATTRIBUTE(debug_ssoc_uic_fops, debug_get_ssoc_uic, NULL, "%llu\n");
 
 static int debug_get_ssoc_rls(void *data, u64 *val)
 {
@@ -2366,7 +2367,7 @@
 }
 
 DEFINE_SIMPLE_ATTRIBUTE(debug_ssoc_rls_fops,
-				debug_get_ssoc_rls, debug_set_ssoc_rls, "%u\n");
+				debug_get_ssoc_rls, debug_set_ssoc_rls, "%llu\n");
 
 static int debug_force_psy_update(void *data, u64 val)
 {
@@ -2380,7 +2381,7 @@
 }
 
 DEFINE_SIMPLE_ATTRIBUTE(debug_force_psy_update_fops,
-				NULL, debug_force_psy_update, "%u\n");
+				NULL, debug_force_psy_update, "%llu\n");
 
 
 static ssize_t debug_get_ssoc_uicurve(struct file *filp, char __user *buf,
@@ -3044,7 +3045,7 @@
 
 	/* recycled battery */
 	} else if (strncmp(dev_info, dev_info_check, strlen(dev_info_check))) {
-		pr_warn("dev_sn=%*s\n", strlen(dev_sn), dev_sn);
+		pr_warn("dev_sn=%*s\n", (int)strlen(dev_sn), dev_sn);
 		pr_warn("dev_info=%*s\n", GBMS_DINF_LEN, dev_info);
 		pr_warn("Battery paired to a different device\n");
 
diff --git a/google_charger.c b/google_charger.c
index e86f0fd..ee86d61 100644
--- a/google_charger.c
+++ b/google_charger.c
@@ -1381,7 +1381,7 @@
 	rc = vote(chg_drv->msc_interval_votable, USER_VOTER, val, 0);
 	if (rc < 0) {
 		dev_err(chg_drv->device,
-			"Couldn't vote %d to update_interval rc=%d\n",
+			"Couldn't vote %lld to update_interval rc=%d\n",
 			val, rc);
 		return rc;
 	}
@@ -1437,7 +1437,7 @@
 }
 
 DEFINE_SIMPLE_ATTRIBUTE(fv_uv_fops, chg_get_fv_uv,
-				     chg_set_fv_uv, "%d\n");
+				     chg_set_fv_uv, "%llu\n");
 
 static int chg_get_cc_max(void *data, u64 *val)
 {
@@ -1464,7 +1464,7 @@
 }
 
 DEFINE_SIMPLE_ATTRIBUTE(cc_max_fops, chg_get_cc_max,
-				     chg_set_cc_max, "%d\n");
+				     chg_set_cc_max, "%llu\n");
 
 
 static int chg_get_interval(void *data, u64 *val)
@@ -1490,7 +1490,7 @@
 
 DEFINE_SIMPLE_ATTRIBUTE(chg_interval_fops,
 				chg_get_interval,
-				chg_set_interval, "%d\n");
+				chg_set_interval, "%llu\n");
 
 
 static int chg_reschedule_work(void *data, u64 val)
@@ -1502,7 +1502,7 @@
 }
 
 DEFINE_SIMPLE_ATTRIBUTE(chg_reschedule_work_fops,
-					NULL, chg_reschedule_work, "%d\n");
+					NULL, chg_reschedule_work, "%llu\n");
 
 #endif
 
@@ -1524,7 +1524,7 @@
 
 DEFINE_SIMPLE_ATTRIBUTE(debug_pps_cc_tolerance_fops,
 					debug_get_pps_cc_tolerance,
-					debug_set_pps_cc_tolerance, "%u\n");
+					debug_set_pps_cc_tolerance, "%llu\n");
 
 
 
@@ -1985,7 +1985,7 @@
 	tdev->current_level = lvl;
 
 	if (tdev->current_level == tdev->thermal_levels) {
-		pr_info("MSC_THERM_FCC lvl=%d charge disable\n", lvl);
+		pr_info("MSC_THERM_FCC lvl=%ld charge disable\n", lvl);
 		return vote(chg_drv->msc_chg_disable_votable,
 					THERMAL_DAEMON_VOTER, true, 0);
 	}
@@ -2033,7 +2033,7 @@
 				POWER_SUPPLY_PROP_ONLINE, &pval);
 		}
 
-		pr_info("MSC_THERM_DC lvl=%d dc disable\n", lvl);
+		pr_info("MSC_THERM_DC lvl=%ld dc disable\n", lvl);
 
 		return 0;
 	}
@@ -2055,7 +2055,7 @@
 			dc_icl);
 
 	if (ret < 0 || changed)
-		pr_info("MSC_THERM_DC lvl=%d dc_icl=%d (%d)\n",
+		pr_info("MSC_THERM_DC lvl=%ld dc_icl=%d (%d)\n",
 			lvl, dc_icl, ret);
 
 	/* make sure that fcc is reset to max when charging from WLC*/
diff --git a/google_cpm.c b/google_cpm.c
index 5bd8b99..df6bf56 100644
--- a/google_cpm.c
+++ b/google_cpm.c
@@ -338,7 +338,7 @@
 		return ret;
 	}
 
-	pr_info("PPS_DC: dc_ready ok fv_uv=%d cc_max=%d, out_ua=%d\n",
+	pr_info("PPS_DC: dc_ready ok state=%d fv_uv=%d cc_max=%d, out_ua=%d\n",
 		gcpm->dc_state, gcpm->fv_uv, gcpm->cc_max, gcpm->out_ua);
 
 	return 0;
diff --git a/max1720x_battery.c b/max1720x_battery.c
index 16a0319..f08bd66 100644
--- a/max1720x_battery.c
+++ b/max1720x_battery.c
@@ -1948,7 +1948,7 @@
 				err = REGMAP_READ(&chip->regmap, MAX1720X_ALARM,
 						&fg_alarm);
 
-			dev_warn(chip->dev, "sts:%04x, alarm:%04x, cnt:%d err=%d\n",
+			dev_warn(chip->dev, "sts:%04x, alarm:%04x, cnt:%lu err=%d\n",
 				fg_status, fg_alarm, chip->icnt, err);
 		}
 
@@ -2651,11 +2651,11 @@
 
 	mutex_unlock(&chip->model_lock);
 
-	dev_info(chip->dev, "Force model for batt_id=%ull (%d)\n", val, ret);
+	dev_info(chip->dev, "Force model for batt_id=%llu (%d)\n", val, ret);
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(debug_batt_id_fops, NULL, debug_batt_id_set, "%ull\n");
+DEFINE_SIMPLE_ATTRIBUTE(debug_batt_id_fops, NULL, debug_batt_id_set, "%llu\n");
 
 
 #define BATTERY_DEBUG_ATTRIBUTE(name, fn_read, fn_write) \
@@ -3099,7 +3099,7 @@
 
 	if (cycle_count > chip->model_next_update) {
 
-		pr_debug("%s: cycle_count=%d next_update=%d\n", __func__,
+		pr_debug("%s: cycle_count=%d next_update=%ld\n", __func__,
 			 cycle_count, chip->model_next_update);
 
 		/* read new state from Fuel gauge, save to storage */
@@ -4028,8 +4028,8 @@
 			devm_regmap_init_i2c(chip->secondary,
 					     &max1730x_regmap_nvram_cfg);
 		if (IS_ERR(chip->regmap_nvram.regmap)) {
-			dev_err(chip->dev, "Failed to initialize nvram regmap (%d)\n",
-				IS_ERR_VALUE(chip->regmap_nvram.regmap));
+			dev_err(chip->dev, "Failed to initialize nvram regmap (%ld)\n",
+				PTR_ERR(chip->regmap_nvram.regmap));
 			return -EINVAL;
 		}
 
@@ -4040,8 +4040,8 @@
 			devm_regmap_init_i2c(chip->secondary,
 					     &max1720x_regmap_nvram_cfg);
 		if (IS_ERR(chip->regmap_nvram.regmap)) {
-			dev_err(chip->dev, "Failed to initialize nvram regmap (%d)\n",
-				IS_ERR_VALUE(chip->regmap_nvram.regmap));
+			dev_err(chip->dev, "Failed to initialize nvram regmap (%ld)\n",
+				PTR_ERR(chip->regmap_nvram.regmap));
 			return -EINVAL;
 		}
 
diff --git a/max77729_charger.c b/max77729_charger.c
index 121014d..78438f0 100644
--- a/max77729_charger.c
+++ b/max77729_charger.c
@@ -942,7 +942,7 @@
 }
 
 DEFINE_SIMPLE_ATTRIBUTE(max77729_debug_reset_charger_state_fops,
-			NULL, max77729_dbg_reset_charger_state, "%ull\n");
+			NULL, max77729_dbg_reset_charger_state, "%llu\n");
 
 static int dbg_init_fs(struct max77729_chgr_data *data)
 {
diff --git a/max77729_uic.c b/max77729_uic.c
index b320b0b..7c1227f 100644
--- a/max77729_uic.c
+++ b/max77729_uic.c
@@ -127,6 +127,12 @@
 	struct dentry *de;
 };
 
+/* silence warning */
+extern int max77729_disable_water_detection(struct i2c_client *client);
+extern int max77729_gpio_set(struct i2c_client *client, unsigned int gpio,
+		      bool dir_out, bool out_hi);
+
+
 static bool max77729_uic_is_reg(struct device *dev, unsigned int reg)
 {
 	int ret;
@@ -508,7 +514,7 @@
 }
 
 DEFINE_SIMPLE_ATTRIBUTE(max77729_noautoibus_fops, NULL,
-			max77729_dbg_set_noautoibus, "%u\n");
+			max77729_dbg_set_noautoibus, "%llu\n");
 
 static int dbg_init_fs(struct max77729_uic_data *data)
 {
diff --git a/max77759_maxq.c b/max77759_maxq.c
index 2ea56d0..8e4f413 100644
--- a/max77759_maxq.c
+++ b/max77759_maxq.c
@@ -18,6 +18,7 @@
 #include <linux/regmap.h>
 
 #include <misc/logbuffer.h>
+#include "max77759_maxq.h"
 #include "max77759_regs.h"
 
 #define PAYLOAD_REQUEST_LENGTH_BYTES		33
@@ -140,9 +141,9 @@
 	return ret;
 }
 
-int maxq_issue_opcode_command(struct max77759_maxq *maxq, u8 *request,
-			      u8 request_length, u8 *response,
-			      u8 response_length)
+static int maxq_issue_opcode_command(struct max77759_maxq *maxq, u8 *request,
+				     u8 request_length, u8 *response,
+				     u8 response_length)
 {
 	unsigned int current_request;
 	int ret = -ENODEV;
diff --git a/max_m5.c b/max_m5.c
index d05d399..d6eb8aa 100644
--- a/max_m5.c
+++ b/max_m5.c
@@ -711,7 +711,7 @@
 		return -ENODATA;
 
 	if (cnt != sizeof(*cp) / 2) {
-		dev_err(dev, "fg-params: %s has %d elements, need %d\n",
+		dev_err(dev, "fg-params: %s has %d elements, need %ld\n",
 			propname, cnt, sizeof(*cp) / 2);
 		return -ERANGE;
 	}
diff --git a/p9221_charger.c b/p9221_charger.c
index 17c9329..3573b73 100644
--- a/p9221_charger.c
+++ b/p9221_charger.c
@@ -52,6 +52,12 @@
 static void p9221_icl_ramp_reset(struct p9221_charger_data *charger);
 static void p9221_icl_ramp_start(struct p9221_charger_data *charger);
 
+/*
+ * TODO(168282168): Was P9221R5_OVSET_REG, what happened to this?
+ * raw_data &= P9221R5_OVSET_MASK;
+ *		*val = p9221_ov_set_lut[raw_data];
+ * 		break;
+ */
 static const u32 p9221_ov_set_lut[] = {
 	17000000, 20000000, 15000000, 13000000,
 	11000000, 11000000, 11000000, 11000000};
@@ -1040,7 +1046,7 @@
 	if (event != PSY_EVENT_PROP_CHANGED)
 		goto out;
 
-	pr_debug("%s: psy_changed: from=%s evt=%d\n", __func__,
+	pr_debug("%s: psy_changed: from=%s evt=%lu\n", __func__,
 		psy->desc->name, event);
 
 	if (strcmp(psy->desc->name, "dc") == 0) {
diff --git a/pca9468_charger.c b/pca9468_charger.c
index 0356b24..09775bd 100644
--- a/pca9468_charger.c
+++ b/pca9468_charger.c
@@ -490,6 +490,9 @@
  * @last_update_time: last update time after sleep
  * @pps_work: pps work for PPS periodic time
  * @pd: phandle for qualcomm PMI usbpd-phy
+ * @tcpm_psy_name: name of TCPM power supply
+ * @tcpm_phandle: lookup for tcpm power supply
+ * @pps_data: internal data for dc_pps
  * @mains_online: is AC/DC input connected
  * @charging_state: direct charging state
  * @ret_state: return direct charging state after DC_STATE_ADJUST_TAVOL is done
@@ -504,6 +507,8 @@
  * @prev_inc: Previous TA voltage or current increment factor
  * @req_new_iin: Request for new input current limit, true or false
  * @req_new_vfloat: Request for new vfloat, true or false
+ * @fv_uv: requested float voltage
+ * @cc_max: requested charge current max
  * @new_iin: New request input current limit, uA
  * @new_vfloat: New request vfloat, uV
  * @adc_comp_gain: adc gain for compensation
@@ -513,6 +518,7 @@
  * @pdata: pointer to platform data
  * @debug_root: debug entry
  * @debug_address: debug register address
+ * @debug_adc_channel: ADC channel to read
  */
 struct pca9468_charger {
 	struct wakeup_source	*monitor_wake_lock;
@@ -2261,7 +2267,7 @@
 		/* Recover IIN_CC to the original value(iin_cfg) */
 		pca9468->iin_cc = pca9468->pdata->iin_cfg;
 
-		pr_debug("%s: New IIN, ta_max_vol=%u, ta_max_cur=%u, ta_max_pwr=%ul, iin_cc=%u, chg_mode=%u\n",
+		pr_debug("%s: New IIN, ta_max_vol=%u, ta_max_cur=%u, ta_max_pwr=%lu, iin_cc=%u, chg_mode=%u\n",
 			 __func__, pca9468->ta_max_vol, pca9468->ta_max_cur,
 			 pca9468->ta_max_pwr, pca9468->iin_cc,
 			 pca9468->chg_mode);
@@ -2698,7 +2704,7 @@
 			/* Recover IIN_CC to the original (iin_cfg) */
 			pca9468->iin_cc = pca9468->pdata->iin_cfg;
 
-			pr_debug("%s: New VFLOAT, ta_max_vol=%u, ta_max_cur=%u, ta_max_pwr=%u, iin_cc=%u, chg_mode=%u\n",
+			pr_debug("%s: New VFLOAT, ta_max_vol=%u, ta_max_cur=%u, ta_max_pwr=%lu, iin_cc=%u, chg_mode=%u\n",
 				 __func__, pca9468->ta_max_vol,
 				 pca9468->ta_max_cur, pca9468->ta_max_pwr,
 				 pca9468->iin_cc, pca9468->chg_mode);
@@ -3590,7 +3596,7 @@
 		/* Set RX voltage to MIN[RX voltage, RX_MAX_VOL*chg_mode] */
 		pca9468->ta_vol = min(pca9468->ta_vol, pca9468->ta_max_vol);
 
-		pr_debug("%s: Preset DC, rx_max_vol=%u, rx_max_cur=%u, rx_max_pwr=%ul, iin_cc=%u, chg_mode=%u\n",
+		pr_debug("%s: Preset DC, rx_max_vol=%u, rx_max_cur=%u, rx_max_pwr=%lu, iin_cc=%u, chg_mode=%u\n",
 			 __func__, pca9468->ta_max_vol, pca9468->ta_max_cur,
 			 pca9468->ta_max_pwr, pca9468->iin_cc,
 			 pca9468->chg_mode);
@@ -3683,7 +3689,7 @@
 		/* Recover IIN_CC to the original value(iin_cfg) */
 		pca9468->iin_cc = pca9468->pdata->iin_cfg;
 
-		pr_debug("%s: Preset DC, ta_max_vol=%u, ta_max_cur=%u, ta_max_pwr=%ul, iin_cc=%u, chg_mode=%u\n",
+		pr_debug("%s: Preset DC, ta_max_vol=%u, ta_max_cur=%u, ta_max_pwr=%lu, iin_cc=%u, chg_mode=%u\n",
 			__func__, pca9468->ta_max_vol, pca9468->ta_max_cur,
 			pca9468->ta_max_pwr, pca9468->iin_cc,
 			pca9468->chg_mode);
@@ -4083,7 +4089,7 @@
 		pca9468->timer_period = PCA9468_PDMSG_WAIT_T;
 		mutex_unlock(&pca9468->lock);
 
-		pr_debug("%s: charging_state=%u next_time_id => pca9468->timer_id=%d\n",
+		pr_debug("%s: charging_state=%u next_time_id => pca9468->timer_id=%d ret=%d\n",
 			__func__, pca9468->charging_state, pca9468->ta_type,
 			ret);