Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f638f902 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-qg: Replace ktime_get with ktime_get_boottime"

parents eed4482d 05b2f9c7
Loading
Loading
Loading
Loading
+17 −8
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <linux/power_supply.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/timekeeping.h>
#include <linux/uaccess.h>
#include <linux/pmic-voter.h>
#include <linux/iio/consumer.h>
@@ -378,7 +379,7 @@ static int qg_config_s2_state(struct qpnp_qg *chip,
done:
	qg_master_hold(chip, false);
	/* FIFO restarted */
	chip->last_fifo_update_time = ktime_get();
	chip->last_fifo_update_time = ktime_get_boottime();
	return rc;
}

@@ -566,7 +567,7 @@ static int qg_process_rt_fifo(struct qpnp_qg *chip)
static int process_rt_fifo_data(struct qpnp_qg *chip, bool update_smb)
{
	int rc = 0;
	ktime_t now = ktime_get();
	ktime_t now = ktime_get_boottime();
	s64 time_delta;

	/*
@@ -611,7 +612,7 @@ static int process_rt_fifo_data(struct qpnp_qg *chip, bool update_smb)
			goto done;
		}
		/* FIFOs restarted */
		chip->last_fifo_update_time = ktime_get();
		chip->last_fifo_update_time = ktime_get_boottime();

		/* signal the read thread */
		chip->data_ready = true;
@@ -1099,7 +1100,7 @@ static int qg_esr_estimate(struct qpnp_qg *chip)
		goto done;
	}
	/* FIFOs restarted */
	chip->last_fifo_update_time = ktime_get();
	chip->last_fifo_update_time = ktime_get_boottime();

	if (chip->esr_avg) {
		chip->kdata.param[QG_ESR].data = chip->esr_avg;
@@ -1186,7 +1187,7 @@ static void process_udata_work(struct work_struct *work)
#define MAX_FIFO_DELTA_PERCENT		10
static irqreturn_t qg_fifo_update_done_handler(int irq, void *data)
{
	ktime_t now = ktime_get();
	ktime_t now = ktime_get_boottime();
	int rc, hw_delta_ms = 0, margin_ms = 0;
	u32 fifo_length = 0;
	s64 time_delta_ms = 0;
@@ -1961,6 +1962,9 @@ static int qg_psy_get_property(struct power_supply *psy,
	case POWER_SUPPLY_PROP_CAPACITY:
		rc = qg_get_battery_capacity(chip, &pval->intval);
		break;
	case POWER_SUPPLY_PROP_CAPACITY_RAW:
		pval->intval = chip->sys_soc;
		break;
	case POWER_SUPPLY_PROP_REAL_CAPACITY:
		rc = qg_get_battery_capacity_real(chip, &pval->intval);
		break;
@@ -2090,6 +2094,7 @@ static int qg_property_is_writeable(struct power_supply *psy,

static enum power_supply_property qg_psy_props[] = {
	POWER_SUPPLY_PROP_CAPACITY,
	POWER_SUPPLY_PROP_CAPACITY_RAW,
	POWER_SUPPLY_PROP_REAL_CAPACITY,
	POWER_SUPPLY_PROP_TEMP,
	POWER_SUPPLY_PROP_VOLTAGE_NOW,
@@ -2920,7 +2925,7 @@ static int qg_determine_pon_soc(struct qpnp_qg *chip)
	bool use_pon_ocv = true;
	unsigned long rtc_sec = 0;
	u32 ocv_uv = 0, soc = 0, pon_soc = 0, full_soc = 0, cutoff_soc = 0;
	u32 shutdown[SDAM_MAX] = {0};
	u32 shutdown[SDAM_MAX] = {0}, soc_raw = 0;
	char ocv_type[20] = "NONE";

	if (!chip->profile_loaded) {
@@ -2999,6 +3004,7 @@ static int qg_determine_pon_soc(struct qpnp_qg *chip)
	use_pon_ocv = false;
	ocv_uv = shutdown[SDAM_OCV_UV];
	soc = shutdown[SDAM_SOC];
	soc_raw = shutdown[SDAM_SOC] * 100;
	strlcpy(ocv_type, "SHUTDOWN_SOC", 20);
	qg_dbg(chip, QG_DEBUG_PON, "Using SHUTDOWN_SOC @ PON\n");

@@ -3066,7 +3072,9 @@ static int qg_determine_pon_soc(struct qpnp_qg *chip)
			soc = DIV_ROUND_UP(((pon_soc - cutoff_soc) * 100),
						(full_soc - cutoff_soc));
			soc = CAP(0, 100, soc);
			soc_raw = soc * 100;
		} else {
			soc_raw = pon_soc * 100;
			soc = pon_soc;
		}

@@ -3080,6 +3088,7 @@ static int qg_determine_pon_soc(struct qpnp_qg *chip)
		return rc;
	}

	chip->cc_soc = chip->sys_soc = soc_raw;
	chip->last_adj_ssoc = chip->catch_up_soc = chip->msoc = soc;
	chip->kdata.param[QG_PON_OCV_UV].data = ocv_uv;
	chip->kdata.param[QG_PON_OCV_UV].valid = true;
@@ -3205,7 +3214,7 @@ static int qg_hw_init(struct qpnp_qg *chip)
		pr_err("Failed to release master, rc=%d\n", rc);
		return rc;
	}
	chip->last_fifo_update_time = ktime_get();
	chip->last_fifo_update_time = ktime_get_boottime();

	if (chip->dt.ocv_timer_expiry_min != -EINVAL) {
		if (chip->dt.ocv_timer_expiry_min < 2)
@@ -4001,7 +4010,7 @@ static int process_suspend(struct qpnp_qg *chip)
			return rc;
		}
		/* FIFOs restarted */
		chip->last_fifo_update_time = ktime_get();
		chip->last_fifo_update_time = ktime_get_boottime();

		chip->suspend_data = true;
	}