/*
 * Driver for the NXP PCA9468 battery charger.
 *
 * Copyright (C) 2018 NXP Semiconductor.
 * Copyright 2020 Google, LLC
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <linux/err.h>
#include <linux/version.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/of_irq.h>
#include <linux/of_device.h>
#include <linux/gpio.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/rtc.h>

#include "pca9468_regs.h"
#include "pca9468_charger.h"

#if defined (CONFIG_OF)
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#endif /* CONFIG_OF */

/* adc_gain bit[7:4] of reg 0x31 - 2's complement */
static int adc_gain[16] = { 0,  1,  2,  3,  4,  5,  6,  7,
			   -8, -7, -6, -5, -4, -3, -2, -1};

/* Timer definition */
#define PCA9468_VBATMIN_CHECK_T	1000	/* 1000ms */
#define PCA9468_CCMODE_CHECK1_T	5000	/* 10000ms -> 500ms */
#define PCA9468_CCMODE_CHECK2_T	5000	/* 5000ms */
#define PCA9468_CVMODE_CHECK_T 	10000	/* 10000ms */
#define PCA9468_ENABLE_DELAY_T	150	/* 150ms */
#define PCA9468_CVMODE_CHECK2_T	1000	/* 1000ms */
#define PCA9468_ENABLE_WLC_DELAY_T	300	/* 300ms */

/* Battery Threshold */
#define PCA9468_DC_VBAT_MIN		3400000 /* uV */
/* Input Current Limit default value */
#define PCA9468_IIN_CFG_DFT		2500000 /* uA*/
/* Charging Float Voltage default value */
#define PCA9468_VFLOAT_DFT		4350000	/* uV */
/* Charging Sub Float Voltage default value */
#define PCA9468_VFLOAT_SUB_DFT		5000000	/* 5000000uV */
/* Charging Float Voltage max voltage for comp */
#define PCA9468_COMP_VFLOAT_MAX		4450000	/* uV */

/* Sense Resistance default value */
#define PCA9468_SENSE_R_DFT		1	/* 10mOhm */
/* Switching Frequency default value */
#define PCA9468_FSW_CFG_DFT		3	/* 980KHz */
/* NTC threshold voltage default value */
#define PCA9468_NTC_TH_DFT		0	/* uV*/

/* Charging Done Condition */
#define PCA9468_IIN_DONE_DFT	500000		/* uA */
/* parallel charging done conditoin */
#define PCA9468_IIN_P_DONE	1000000		/* uA */
/* Parallel charging default threshold */
#define PCA9468_IIN_P_TH_DFT	4000000		/* uA */
/* Single charging default threshold */
#define PCA9468_IIN_S_TH_DFT	10000000	/* uA */

/* Maximum TA voltage threshold */
#define PCA9468_TA_MAX_VOL		9800000 /* uV */
/* Maximum TA current threshold, set to max(cc_max) / 2 */
#define PCA9468_TA_MAX_CUR		2600000	 /* uA */
/* Minimum TA current threshold */
#define PCA9468_TA_MIN_CUR		1000000	/* uA - PPS minimum current */

/* Minimum TA voltage threshold in Preset mode */
#define PCA9468_TA_MIN_VOL_PRESET	8000000	/* uV */
/* TA voltage threshold starting Adjust CC mode */
#define PCA9468_TA_MIN_VOL_CCADJ	8500000	/* 8000000uV --> 8500000uV */

#define PCA9468_TA_VOL_PRE_OFFSET	500000	 /* uV */
/* Adjust CC mode TA voltage step */
#define PCA9468_TA_VOL_STEP_ADJ_CC	40000	/* uV */
/* Pre CV mode TA voltage step */
#define PCA9468_TA_VOL_STEP_PRE_CV	20000	/* uV */

/* IIN_CC adc offset for accuracy */
#define PCA9468_IIN_ADC_OFFSET		20000	/* uA */
/* IIN_CC compensation offset */
#define PCA9468_IIN_CC_COMP_OFFSET	50000	/* uA */
/* IIN_CC compensation offset in Power Limit Mode(Constant Power) TA */
#define PCA9468_IIN_CC_COMP_OFFSET_CP	20000	/* uA */
/* TA maximum voltage that can support CC in Constant Power Mode */
#define PCA9468_TA_MAX_VOL_CP		9800000	/* 9760000uV --> 9800000uV */
/* Offset for cc_max / 2 */
#define PCA9468_IIN_MAX_OFFSET		0


/* maximum retry counter for restarting charging */
#define PCA9468_MAX_RETRY_CNT		3	/* retries */
/* TA IIN tolerance */
#define PCA9468_TA_IIN_OFFSET		100000	/* uA */
/* IIN_CC upper protection offset in Power Limit Mode TA */
#define PCA9468_IIN_CC_UPPER_OFFSET	50000	/* 50mA */

/* PD Message Voltage and Current Step */
#define PD_MSG_TA_VOL_STEP		20000	/* uV */
#define PD_MSG_TA_CUR_STEP		50000	/* uA */

/* Maximum WCRX voltage threshold */
#define PCA9468_WCRX_MAX_VOL		9750000 /* uV */
/* WCRX voltage Step */
#define WCRX_VOL_STEP			100000	/* uV */

#define PCA9468_OTV_MARGIN		12000	/* uV */

/* irdrop default limit */
#define PCA9468_IRDROP_LIMIT_CNT	3	/* tiers */
#define PCA9468_IRDROP_LIMIT_TIER1	105000	/* uV */
#define PCA9468_IRDROP_LIMIT_TIER2	75000	/* uV */
#define PCA9468_IRDROP_LIMIT_TIER3	0	/* uV */

/* Spread Spectrum default settings */
#define PCA9468_SC_CLK_DITHER_RATE_DEF	0	/* 25kHz */
#define PCA9468_SC_CLK_DITHER_LIMIT_DEF	0xF	/* 10% */

/* INT1 Register Buffer */
enum {
	REG_INT1,
	REG_INT1_MSK,
	REG_INT1_STS,
	REG_INT1_MAX
};

/* STS Register Buffer */
enum {
	REG_STS_A,
	REG_STS_B,
	REG_STS_C,
	REG_STS_D,
	REG_STS_MAX
};

/* Status */
enum {
	STS_MODE_CHG_LOOP,	/* TODO: There is no such thing */
	STS_MODE_VFLT_LOOP,
	STS_MODE_IIN_LOOP,
	STS_MODE_LOOP_INACTIVE,
	STS_MODE_CHG_DONE,
	STS_MODE_VIN_UVLO,
};

/* Timer ID */
enum {
	TIMER_ID_NONE,
	TIMER_VBATMIN_CHECK,
	TIMER_PRESET_DC,
	TIMER_PRESET_CONFIG,
	TIMER_CHECK_ACTIVE,
	TIMER_ADJUST_CCMODE,
	TIMER_CHECK_CCMODE,
	TIMER_ENTER_CVMODE,
	TIMER_CHECK_CVMODE, /* 8 */
	TIMER_PDMSG_SEND,   /* 9 */
	TIMER_ADJUST_TAVOL,
	TIMER_ADJUST_TACUR,
};


/* TA increment Type */
enum {
	INC_NONE,	/* No increment */
	INC_TA_VOL,	/* TA voltage increment */
	INC_TA_CUR,	/* TA current increment */
};

/* BATT info Type */
enum {
	BATT_CURRENT,
	BATT_VOLTAGE,
};

/* IIN offset as the switching frequency in uA*/
static int iin_fsw_cfg[16] = { 9990, 10540, 11010, 11520, 12000, 12520, 12990,
			      13470, 5460, 6050, 6580, 7150, 7670, 8230, 8720,
			      9260};


/* ------------------------------------------------------------------------ */

/* ADC Read function, return uV or uA */
int pca9468_read_adc(struct pca9468_charger *pca9468, u8 adc_ch)
{
	u8 reg_data[2];
	u16 raw_adc = 0;
	int conv_adc = -1;
	int ret;

	switch (adc_ch) {
	case ADCCH_VOUT:
		/* ~PCA9468_BIT_CH1_EN, PCA9468_REG_ADC_CFG, udelay(120) us */

		ret = regmap_bulk_read(pca9468->regmap, PCA9468_REG_STS_ADC_4,
				       reg_data, 2);
		if (ret < 0) {
			conv_adc = ret;
			goto error;
		}

		raw_adc = ((reg_data[1] & PCA9468_BIT_ADC_VOUT9_2) << 2) |
			  ((reg_data[0] & PCA9468_BIT_ADC_VOUT1_0) >> 6);
		conv_adc = raw_adc * VOUT_STEP;	/* unit - uV */
		break;

	case ADCCH_VIN:
		/* ~PCA9468_BIT_CH2_EN, PCA9468_REG_ADC_CFG, udelay(120) us */

		ret = regmap_bulk_read(pca9468->regmap, PCA9468_REG_STS_ADC_3,
				       reg_data, 2);
		if (ret < 0) {
			conv_adc = ret;
			goto error;
		}

		raw_adc = ((reg_data[1] & PCA9468_BIT_ADC_VIN9_4) << 4) |
			  ((reg_data[0] & PCA9468_BIT_ADC_VIN3_0) >> 4);
		conv_adc = raw_adc * VIN_STEP;	/* unit - uV */
		break;

	case ADCCH_VBAT:
		/* ~PCA9468_BIT_CH3_EN, PCA9468_REG_ADC_CFG, udelay(120) us */

		ret = regmap_bulk_read(pca9468->regmap, PCA9468_REG_STS_ADC_6,
				       reg_data, 2);
		if (ret < 0) {
			conv_adc = ret;
			goto error;
		}

		raw_adc = ((reg_data[1] & PCA9468_BIT_ADC_VBAT9_8) << 8) |
			  ((reg_data[0] & PCA9468_BIT_ADC_VBAT7_0) >> 0);
		conv_adc = raw_adc * VBAT_STEP; /* unit - uV */
		break;

	case ADCCH_IIN:
		/* ~PCA9468_BIT_CH5_EN, PCA9468_REG_ADC_CFG, udelay(120) us */

		ret = regmap_bulk_read(pca9468->regmap, PCA9468_REG_STS_ADC_1,
				       reg_data, 2);
		if (ret < 0) {
			conv_adc = ret;
			goto error;
		}

		raw_adc = ((reg_data[1] & PCA9468_BIT_ADC_IIN9_8) << 8) |
			  ((reg_data[0] & PCA9468_BIT_ADC_IIN7_0) >> 0);

		/*
		 * iin = rawadc*4.89 + (rawadc*4.89 - 900) *
		 * 	 adc_comp_gain/100
		 */
		conv_adc = raw_adc * IIN_STEP + (raw_adc * IIN_STEP -
			   ADC_IIN_OFFSET) * pca9468->adc_comp_gain /
			   100; /* unit - uA */
		/*
		 * If ADC raw value is 0, convert value will be minus value
		 * because of compensation gain, so in this case conv_adc
		 * is 0
		 */
		if (conv_adc < 0)
			conv_adc = 0;
		break;

	case ADCCH_DIETEMP:
		/* ~PCA9468_BIT_CH6_EN, PCA9468_REG_ADC_CFG, udelay(120) us */

		ret = regmap_bulk_read(pca9468->regmap, PCA9468_REG_STS_ADC_7,
				       reg_data, 2);
		if (ret < 0) {
			conv_adc = ret;
			goto error;
		}

		raw_adc = ((reg_data[1] & PCA9468_BIT_ADC_DIETEMP9_6) << 6) |
			  ((reg_data[0] & PCA9468_BIT_ADC_DIETEMP5_0) >> 2);

		/* Temp = (935-rawadc)*0.435, unit - C */
		conv_adc = (935 - raw_adc) * DIETEMP_STEP / DIETEMP_DENOM;
		if (conv_adc > DIETEMP_MAX)
			conv_adc = DIETEMP_MAX;
		else if (conv_adc < DIETEMP_MIN)
			conv_adc = DIETEMP_MIN;
		break;

	case ADCCH_NTC:
		/* ~PCA9468_BIT_CH7_EN, PCA9468_REG_ADC_CFG, udelay(120) us */

		ret = regmap_bulk_read(pca9468->regmap, PCA9468_REG_STS_ADC_8,
				       reg_data, 2);
		if (ret < 0) {
			conv_adc = ret;
			goto error;
		}

		raw_adc = ((reg_data[1] & PCA9468_BIT_ADC_NTCV9_4) << 4) |
			  ((reg_data[0] & PCA9468_BIT_ADC_NTCV3_0) >> 4);

		/* Temp = (rawadc < 185)? (960-rawadc/4) : (730-rawadc/8) */
		/* unit: 0.1 degree C */
		if (raw_adc < NTC_CURVE_THRESHOLD)
			conv_adc = NTC_CURVE_1_BASE - ((raw_adc * 10) >> NTC_CURVE_1_SHIFT);
		else
			conv_adc = NTC_CURVE_2_BASE - ((raw_adc * 10) >> NTC_CURVE_2_SHIFT);
		break;

	default:
		conv_adc = -EINVAL;
		break;
	}

error:
	/* if disabled a channel, re-enable it in -> PCA9468_REG_ADC_CFG */

	pr_debug("%s: adc_ch=%u, raw_adc=%x convert_val=%d\n", __func__,
		 adc_ch, raw_adc, conv_adc);

	return conv_adc;
}

/* v float voltage (5 mV) resolution */
static int pca9468_set_vfloat(struct pca9468_charger *pca9468,
			      unsigned int v_float)
{
	const int val = PCA9468_V_FLOAT(v_float);
	int ret;

	ret = regmap_write(pca9468->regmap, PCA9468_REG_V_FLOAT, val);

	dev_info(pca9468->dev, "%s: v_float=%u (%d)\n", __func__, v_float, ret);

	return ret;
}

static int pca9468_set_input_current(struct pca9468_charger *pca9468,
				     unsigned int iin)
{
	int ret, val;

	/* round-up and increase one step */
	iin = iin + PD_MSG_TA_CUR_STEP;
	val = PCA9468_IIN_CFG(iin);

	/* Set IIN_CFG to one step higher */
	val = val + 1;
	if (val > 0x32)
		val = 0x32; /* maximum value is 5A */

	ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_IIN_CTRL,
				 PCA9468_BIT_IIN_CFG, val);

	dev_info(pca9468->dev, "%s: iin=%d real iin_cfg=%d (%d)\n", __func__,
		 iin, val * PCA9468_IIN_CFG_STEP, ret);

	return ret;
}

/* Returns the enable or disable value. into 1 or 0. */
static int pca9468_get_charging_enabled(struct pca9468_charger *pca9468)
{
	int ret, intval;
	unsigned int val;

	ret = regmap_read(pca9468->regmap, PCA9468_REG_START_CTRL, &val);
	if (ret < 0)
		return ret;

	intval = (val & PCA9468_BIT_STANDBY_EN) ? 0 : 1;

	return intval;
}


/* b/194346461 ramp down IIN */
static int pca9468_wlc_ramp_down_iin(struct pca9468_charger *pca9468,
				     struct power_supply *wlc_psy)
{
	const int ramp_down_step = PCA9468_IIN_CFG_STEP;
	int ret = 0, iin;

	if (!pca9468->wlc_ramp_out_iin)
		return 0;

	iin = pca9468_input_current_limit(pca9468);
	for ( ; iin >= PCA9468_IIN_CFG_MIN; iin -= ramp_down_step) {
		int iin_adc, wlc_iout = -1;

		iin_adc = pca9468_read_adc(pca9468, ADCCH_IIN);
		if (wlc_psy) {
			union power_supply_propval pro_val;

			ret = power_supply_get_property(wlc_psy,
					POWER_SUPPLY_PROP_ONLINE,
					&pro_val);
			if (ret < 0 || pro_val.intval != PPS_PSY_PROG_ONLINE)
				break;

			ret = power_supply_get_property(wlc_psy,
					POWER_SUPPLY_PROP_CURRENT_NOW,
					&pro_val);
			if (ret == 0)
				wlc_iout = pro_val.intval;
		}

		ret = pca9468_set_input_current(pca9468, iin);
		if (ret < 0) {
			pr_err("%s: ramp down iin=%d (%d)\n", __func__,
				iin, ret);
			break;
		}

		pr_debug("%s: iin_adc=%d, wlc_iout-%d ramp down iin=%d\n",
				__func__, iin_adc, wlc_iout, iin);
		msleep(pca9468->wlc_ramp_out_delay);
	}

	return ret;
}

/* b/194346461 ramp down VOUT */
#define WLC_VOUT_CFG_STEP	40000

/* the caller will set to vbatt * 4 */
static int pca9468_wlc_ramp_down_vout(struct pca9468_charger *pca9468,
				      struct power_supply *wlc_psy)
{
	const int ramp_down_step = WLC_VOUT_CFG_STEP;
	union power_supply_propval pro_val;
	int vout = 0, vout_target = pca9468->wlc_ramp_out_vout_target;
	int ret, vbatt;

	while (true) {
		vbatt = pca9468_read_adc(pca9468, ADCCH_VBAT);
		if (vbatt <= 0) {
			pr_err("%s: invalid vbatt %d\n", __func__, vbatt);
			break;
		}

		ret = power_supply_get_property(wlc_psy, POWER_SUPPLY_PROP_VOLTAGE_NOW,
					        &pro_val);
		if (ret < 0) {
			pr_err("%s: invalid vout %d\n", __func__, ret);
			break;
		}

		if (!pca9468->wlc_ramp_out_vout_target)
			vout_target = vbatt * 4;

		if (!vout)
			vout = pro_val.intval;
		if (vout < vout_target) {
			pr_debug("%s: underflow vout=%d, vbatt=%d (target=%d)\n", __func__,
			         vout, vbatt, vout_target);
			return 0;
		}

		pro_val.intval = vout - ramp_down_step;

		pr_debug("%s: vbatt=%d, wlc_vout=%d->%d\n", __func__, vbatt,
			 vout, pro_val.intval);

		ret = power_supply_set_property(wlc_psy, POWER_SUPPLY_PROP_VOLTAGE_NOW,
						&pro_val);
		if (ret < 0) {
			pr_err("%s: cannot set vout %d\n", __func__, ret);
			break;
		}

		msleep(pca9468->wlc_ramp_out_delay);
		vout = pro_val.intval;
	}

	return -EIO;
}

/* call holding mutex_lock(&pca9468->lock); */
static int pca9468_set_charging(struct pca9468_charger *pca9468, bool enable)
{
	const int ntc_protection_en = 0; /* TODO: DT option? */
	int ret, val;

	pr_debug("%s: enable=%d ta_type=%d\n", __func__,  enable, pca9468->ta_type);

	if (enable && pca9468_get_charging_enabled(pca9468) == enable) {
		pr_debug("%s: no op, already enabled\n", __func__);
		return 0;
	}

	/* might needs to disable NTC_PROTECTION_EN in all cases */

	if (enable) {
		/* Improve adc */
		val = 0x5B;
		ret = regmap_write(pca9468->regmap, PCA9468_REG_ADC_ACCESS, val);
		if (ret < 0)
			goto error;
		ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_ADC_IMPROVE,
					 PCA9468_BIT_ADC_IIN_IMP, 0);
		if (ret < 0)
			goto error;

		/* For fixing input current error */
		/* Overwrite 0x00 in 0x41 register */
		val = 0x00;
		ret = regmap_write(pca9468->regmap, 0x41, val);
		if (ret < 0)
			goto error;
		/* Overwrite 0x01 in 0x43 register */
		val = 0x01;
		ret = regmap_write(pca9468->regmap, 0x43, val);
		if (ret < 0)
			goto error;
		/* Overwrite 0x00 in 0x4B register */
		val = 0x00;
		ret = regmap_write(pca9468->regmap, 0x4B, val);
		if (ret < 0)
			goto error;
		/* End for fixing input current error */

	} else {
		/* Disable NTC_PROTECTION_EN */
		ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_TEMP_CTRL,
					 PCA9468_BIT_NTC_PROTECTION_EN, 0);
	}

	if (enable) {
		/* ENABLE PCA9468 */
		ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_START_CTRL,
					 PCA9468_BIT_STANDBY_EN,
					 PCA9468_STANDBY_DONOT);
		if (ret < 0)
			goto error;


		/* Wait 50ms, first to keep the start-up sequence */
		mdelay(50);
		/* Wait 150ms */
		msleep(150);

		/* Improve ADC */
		ret = regmap_update_bits(pca9468->regmap,
					 PCA9468_REG_ADC_IMPROVE,
					 PCA9468_BIT_ADC_IIN_IMP,
					 PCA9468_BIT_ADC_IIN_IMP);
		if (ret  < 0)
			goto error;

		val = 0x00;
		ret = regmap_write(pca9468->regmap, PCA9468_REG_ADC_ACCESS,
				   val);

		/* Restore NTC_PROTECTION_EN */
		ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_TEMP_CTRL,
					 PCA9468_BIT_NTC_PROTECTION_EN,
					 ntc_protection_en);
	} else {

		if (pca9468->ta_type == TA_TYPE_WIRELESS) {
			struct power_supply *wlc_psy;
			int ret;

			wlc_psy = pca9468_get_rx_psy(pca9468);
			if (wlc_psy) {
				ret = pca9468_wlc_ramp_down_iin(pca9468, wlc_psy);
				if (ret < 0)
					dev_err(pca9468->dev, "cannot ramp out iin (%d)\n", ret);

				ret = pca9468_wlc_ramp_down_vout(pca9468, wlc_psy);
				if (ret < 0)
					dev_err(pca9468->dev, "cannot ramp out vout (%d)\n", ret);
			}
		}

		/* turn off the PCA */
		ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_START_CTRL,
					 PCA9468_BIT_STANDBY_EN,
					 PCA9468_STANDBY_FORCED);
		if (ret < 0)
			goto error;

		/* Wait 5ms to keep the shutdown sequence */
		mdelay(5);
	}

error:
	pr_debug("%s: End, ret=%d\n", __func__, ret);
	return ret;
}

static int pca9468_check_state(u8 val[8], struct pca9468_charger *pca9468, int loglevel)
{
	int ret;

	/* Dump register */
	ret = regmap_bulk_read(pca9468->regmap, PCA9468_REG_INT1,
			       &val[PCA9468_REG_INT1], 7);
	if (ret < 0)
		return ret;

	logbuffer_prlog(pca9468, loglevel,
			"%s: Error reg[1]=%#x,[2]=%#x,[3]=%#x,[4]=%#x,[5]=%#x,[6]=%#x,[7]=%#x",
			__func__, val[1], val[2], val[3], val[4], val[5], val[6], val[7]);

	return 0;
}

static void pca9468_dump_test_debug(const struct pca9468_charger *pca9468,
				    int loglevel)
{
	u8 test_val[16];
	int ret;

	/* Read test register for debugging */
	ret = regmap_bulk_read(pca9468->regmap, 0x40, test_val, 16);
	if (ret < 0) {
		logbuffer_prlog(pca9468, LOGLEVEL_ERR,
				"%s: cannot read test registers (%d)\n",
				__func__, ret);
	} else {
		logbuffer_prlog(pca9468, loglevel,
				"%s: Error reg[0x40]=%#x,[0x41]=%#x,[0x42]=%#x,[0x43]=%#x,[0x44]=%#x,[0x45]=%#x,[0x46]=%#x,[0x47]=%#x",
				__func__, test_val[0], test_val[1], test_val[2], test_val[3],
				test_val[4], test_val[5], test_val[6], test_val[7]);
		logbuffer_prlog(pca9468, loglevel,
				"%s: Error reg[0x48]=%#x,[0x49]=%#x,[0x4A]=%#x,[0x4B]=%#x,[0x4C]=%#x,[0x4D]=%#x,[0x4E]=%#x,[0x4F]=%#x",
				__func__, test_val[8], test_val[9], test_val[10], test_val[11],
				test_val[12], test_val[13], test_val[14], test_val[15]);
	}
}

static void pca9468_dump_config(const struct pca9468_charger *pca9468,
				int loglevel)
{
	u8 val[10];
	int ret;

	ret = regmap_bulk_read(pca9468->regmap, PCA9468_REG_IIN_CTRL,
			       val, sizeof(val));
	if (ret < 0) {
		logbuffer_prlog(pca9468, LOGLEVEL_ERR,
				"%s: cannot read config (%d)\n", __func__, ret);
	} else {
		logbuffer_prlog(pca9468, loglevel,
				"%s: Config reg[0x21]=%#x,[0x22]=%#x,[0x23]=%#x,[0x24]=%#x,[0x25]=%#x,[0x26]=%#x,[0x27]=%#x,[0x28]=%#x,[0x29]=%#x,[0x2A]=%#x",
				__func__, val[0], val[1], val[2], val[3], val[4],
				val[5], val[6], val[7], val[8], val[9]);
	}
}

/* PCA9468 is not active state  - standby or shutdown */
/* Stop charging in timer_work */
/* return 0 when no error is detected */
static int pca9468_check_not_active(struct pca9468_charger *pca9468)
{
	u8 val[8];
	int ret;

	ret = pca9468_check_state(val, pca9468, LOGLEVEL_WARNING);
	if (ret < 0) {
		pr_err("%s: cannot read state\n", __func__);
		return ret;
	}

	pca9468_dump_test_debug(pca9468, LOGLEVEL_ERR);

	/* Check INT1_STS first */
	if ((val[PCA9468_REG_INT1_STS] & PCA9468_BIT_V_OK_STS) != PCA9468_BIT_V_OK_STS) {
		/* VBUS is invalid */
		logbuffer_prlog(pca9468, LOGLEVEL_ERR,
				"%s: VOK is invalid", __func__);

		/* Check STS_A. NOTE: V_OV_TRACKING is with VIN OV */
		if (val[PCA9468_REG_STS_A] & PCA9468_BIT_CFLY_SHORT_STS)
			logbuffer_prlog(pca9468, LOGLEVEL_ERR,
					"%s: Flying Cap is shorted to GND", __func__);
		else if (val[PCA9468_REG_STS_A] & PCA9468_BIT_VOUT_UV_STS)
			logbuffer_prlog(pca9468, LOGLEVEL_ERR,
					"%s: VOUT UV", __func__); /* VOUT < VOUT_OK */
		else if (val[PCA9468_REG_STS_A] & PCA9468_BIT_VBAT_OV_STS)
			logbuffer_prlog(pca9468, LOGLEVEL_ERR,
					"%s: VBAT OV", __func__); /* VBAT > VBAT_OV */
		else if (val[PCA9468_REG_STS_A] & PCA9468_BIT_VIN_OV_STS)
			logbuffer_prlog(pca9468, LOGLEVEL_ERR,
					"%s: VIN OV", __func__); /* VIN > V_OV_FIXED */
		else if (val[PCA9468_REG_STS_A] & PCA9468_BIT_VIN_UV_STS)
			logbuffer_prlog(pca9468, LOGLEVEL_ERR,
					"%s: VIN UV", __func__); /* VIN < V_UVTH */
		else
			logbuffer_prlog(pca9468, LOGLEVEL_ERR,
					"%s: Invalid VIN or VOUT", __func__);

		return  -EINVAL;
	}

	if (val[PCA9468_REG_INT1_STS] & PCA9468_BIT_NTC_TEMP_STS) {
		int ntc_adc, ntc_th; /* NTC protection */
		u8 reg_data[2]; /* NTC threshold */

		ret = regmap_bulk_read(pca9468->regmap, PCA9468_REG_NTC_TH_1,
				       reg_data, sizeof(reg_data));
		if (ret < 0)
			return -EIO;

		ntc_th = ((reg_data[1] & PCA9468_BIT_NTC_THRESHOLD9_8) << 8) |
			 reg_data[0];	/* uV unit */

		/* Read NTC ADC */
		ntc_adc = pca9468_read_adc(pca9468, ADCCH_NTC);	/* uV unit */
		logbuffer_prlog(pca9468, LOGLEVEL_ERR,
				"%s: NTC Protection, NTC_TH=%d(uV), NTC_ADC=%d(uV)",
				__func__, ntc_th, ntc_adc);

		return -EINVAL;
	}

	if (val[PCA9468_REG_INT1_STS] & PCA9468_BIT_CTRL_LIMIT_STS) {
		/* OCP event happens */

		if (val[PCA9468_REG_STS_B] & PCA9468_BIT_OCP_FAST_STS)
			logbuffer_prlog(pca9468, LOGLEVEL_ERR,
					"%s: IIN is over OCP_FAST", __func__);
		else if (val[PCA9468_REG_STS_B] & PCA9468_BIT_OCP_AVG_STS)
			logbuffer_prlog(pca9468, LOGLEVEL_ERR,
					"%s: IIN is over OCP_AVG", __func__);
		else
			logbuffer_prlog(pca9468, LOGLEVEL_ERR,
					"%s: No Loop active", __func__);

		return -EINVAL;
	}

	if (val[PCA9468_REG_INT1_STS] & PCA9468_BIT_TEMP_REG_STS) {
		/* Over temperature protection */
		logbuffer_prlog(pca9468, LOGLEVEL_ERR,
				"%s: Device is in temperature regulation", __func__);
		return -EINVAL;
	}

	if (val[PCA9468_REG_INT1_STS] & PCA9468_BIT_TIMER_STS) {
		const u8 sts_b = val[PCA9468_REG_STS_B];

		if (sts_b & PCA9468_BIT_CHARGE_TIMER_STS)
			logbuffer_prlog(pca9468, LOGLEVEL_ERR,
					"%s: Charger timer is expired", __func__);
		else if (sts_b & PCA9468_BIT_WATCHDOG_TIMER_STS)
			logbuffer_prlog(pca9468, LOGLEVEL_ERR,
				"%s: Watchdog timer is expired", __func__);
		else
			logbuffer_prlog(pca9468, LOGLEVEL_ERR,
					"%s: Timer INT, but no timer STS", __func__);

		return -EINVAL;
	}

	if (val[PCA9468_REG_STS_A] & PCA9468_BIT_CFLY_SHORT_STS) {
		logbuffer_prlog(pca9468, LOGLEVEL_ERR,
				"%s: Flying Cap is shorted to GND", __func__);
		return -EINVAL;
	}

	return 0;
}

/* Keep the current charging state, check STS_B again */
/* return 0 if VIN is still present, -EAGAIN if needs to retry, -EINVAL oth */
static int pca9468_check_standby(struct pca9468_charger *pca9468)
{
	unsigned int reg_val;
	int ret;
	u8 val[8];

	/* re-read the state register */
	ret = regmap_read(pca9468->regmap, PCA9468_REG_STS_B, &reg_val);
	if (ret < 0)
		return -EIO;

	pr_debug("%s: RCP check, STS_B=%#x\n",	__func__, reg_val);

	/* RCP condition, but VIN is valid and the PCA is active */
	if (reg_val & PCA9468_BIT_ACTIVE_STATE_STS) {
		const int charging_state = pca9468->charging_state;

		/*
		 * Try again when called from pca9468_check_active_state().
		 * If VIN is increased, input current will increase over
		 * IIN_LOW level.
		 */
		logbuffer_prlog(pca9468, charging_state == DC_STATE_CHECK_ACTIVE ?
				LOGLEVEL_WARNING : LOGLEVEL_ERR,
				"%s: RCP triggered but VIN is valid, state=%d",
				__func__, charging_state);

		pca9468->chg_data.rcp_count++;
		return -EAGAIN;
	}

	/* re-read and dump state, debug registers */
	pca9468_check_state(val, pca9468, LOGLEVEL_INFO);
	ret = regmap_bulk_read(pca9468->regmap, 0x48, val, 3);
	logbuffer_prlog(pca9468, LOGLEVEL_ERR,
			"%s: Error reg[0x48]=%#x,[0x49]=%#x,[0x4a]=%#x",
			__func__, val[0], val[1], val[2]);
	pca9468_dump_config(pca9468, LOGLEVEL_INFO);

	/* Not in RCP state, retry only when DC is starting */
	if (reg_val & PCA9468_BIT_STANDBY_STATE_STS) {
		logbuffer_prlog(pca9468, LOGLEVEL_WARNING, "%s: device in standby", __func__);
		pca9468->chg_data.stby_count++;
		ret = -EAGAIN;
	}  else {
		logbuffer_prlog(pca9468, LOGLEVEL_ERR, "%s: device in shutdown", __func__);
		p9468_chg_stats_update_flags(&pca9468->chg_data, P9468_CHGS_F_SHDN);
		ret = -EINVAL;
	}

	return ret;
}

/*
 * Check Active status, 0 is active (or in RCP), <0 indicates a problem.
 * The function is called from different contexts/functions, errors are fatal
 * (i.e. stop charging) from all contexts except when this is called from
 * pca9468_check_active_state().
 *
 * Other contexts:
 * . pca9468_charge_adjust_ccmode
 * . pca9468_charge_ccmode
 * . pca9468_charge_start_cvmode
 * . pca9468_charge_cvmode
 *
 * call holding mutex_lock(&pca9468->lock)
 */
static int pca9468_check_error(struct pca9468_charger *pca9468)
{
	unsigned int reg_val;
	int ret;

	ret = regmap_read(pca9468->regmap, PCA9468_REG_STS_B, &reg_val);
	if (ret < 0)
		goto error;

	/* PCA9468 is active state */
	if (reg_val & PCA9468_BIT_ACTIVE_STATE_STS) {
		int vbatt;

		/* PCA9468 is charging */

		/* Check whether the battery voltage is over the minimum */
		vbatt = pca9468_read_adc(pca9468, ADCCH_VBAT);
		if (vbatt > PCA9468_DC_VBAT_MIN) {
			/* Normal charging battery level */
			/* Check temperature regulation loop */
			/* Read INT1_STS register */
			ret = regmap_read(pca9468->regmap, PCA9468_REG_INT1_STS,
					  &reg_val);
			if (ret < 0) {
				pr_err("%s: cannot read status (%d)\n", __func__, ret);
			} else if (reg_val & PCA9468_BIT_TEMP_REG_STS) {
				/* Over temperature protection */
				pr_err("%s: Device is in temperature regulation\n",
					__func__);
				ret = -EINVAL;
			}
		} else {
			/* Abnormal battery level */
			pr_err("%s: Error abnormal battery voltage=%d\n",
				__func__, vbatt);
			ret = -EINVAL;
		}

		pr_debug("%s: Active Status ok=%d (ret=%d)\n", __func__,
			 ret == 0, ret);
		return ret;
	}

	/* not in error but in standby or shutdown */

	ret = pca9468_check_not_active(pca9468);
	if (ret < 0) {
		/* There was an error, done... */
	} else if ((reg_val & PCA9468_BIT_STANDBY_STATE_STS) == 0) {
		/* PCA9468 is in shutdown state */
		pr_err("%s: PCA9468 is in shutdown\n", __func__);
		ret = -EINVAL;
	} else if (pca9468->charging_state == DC_STATE_NO_CHARGING) {
		/*
		 * Sometimes battery driver might call set_property function
		 * to stop charging during msleep. At this case, charging
		 * state would change DC_STATE_NO_CHARGING. PCA9468 should
		 * stop checking RCP condition and exit timer_work
		 */
		pr_err("%s: other driver forced stop\n", __func__);
		ret = -EINVAL;
	} else {

		/* Check the RCP condition, T_REVI_DET is 300ms */
		msleep(200);

		/*
		 * return 0 if VIN is still present, -EAGAIN if needs to retry,
		 * -EINVAL on error.
		 */
		ret = pca9468_check_standby(pca9468);
	}

error:
	pr_debug("%s: Not Active Status=%d\n", __func__, ret);
	return ret;
}

static int pca9468_get_iin(struct pca9468_charger *pca9468, int *iin)
{
	const int offset = iin_fsw_cfg[pca9468->pdata->fsw_cfg];
	int temp;

	temp = pca9468_read_adc(pca9468, ADCCH_IIN);
	if (temp < 0)
		return temp;

	if (temp < offset)
		temp = offset;

	*iin = (temp - offset) * 2;
	return 0;
}

/* only needed for irdrop compensation ane maybe not even that... */
static int pca9468_get_batt_info(struct pca9468_charger *pca9468, int info_type, int *info)
{
	union power_supply_propval val;
	enum power_supply_property psp;
	int ret;

	if (!pca9468->batt_psy)
		pca9468->batt_psy = power_supply_get_by_name("battery");
	if (!pca9468->batt_psy)
		return -EINVAL;

	if (info_type == BATT_CURRENT)
		psp = POWER_SUPPLY_PROP_CURRENT_NOW;
	else
		psp = POWER_SUPPLY_PROP_VOLTAGE_NOW;

	ret = power_supply_get_property(pca9468->batt_psy, psp, &val);
	if (ret == 0)
		*info = val.intval;

	return ret;
}

/* only needed for irdrop compensation ane maybe not even that... */
static int pca9468_get_ibatt(struct pca9468_charger *pca9468, int *info)
{
	return pca9468_get_batt_info(pca9468, BATT_CURRENT, info);
}

static void pca9468_prlog_state(struct pca9468_charger *pca9468, const char *fn)
{
	int rc, ibat, icn = -EINVAL, iin = -EINVAL;
	bool ovc_flag;

	rc = pca9468_get_ibatt(pca9468, &ibat);
	if (rc == 0)
		rc = pca9468_get_iin(pca9468, &icn);
	if (rc == 0)
		iin = pca9468_read_adc(pca9468, ADCCH_IIN);
	ovc_flag = ibat > pca9468->cc_max;
	if (ovc_flag)
		p9468_chg_stats_inc_ovcf(&pca9468->chg_data, ibat, pca9468->cc_max);;

	logbuffer_prlog(pca9468, ovc_flag ? LOGLEVEL_WARNING : LOGLEVEL_DEBUG,
			"%s: iin=%d, iin_cc=%d, icn=%d ibat=%d, cc_max=%d rc=%d",
			fn, iin, pca9468->iin_cc, icn, ibat, pca9468->cc_max, rc);
}

static int pca9468_read_status(struct pca9468_charger *pca9468)
{
	unsigned int reg_val;
	int ret;

	/* Read STS_A */
	ret = regmap_read(pca9468->regmap, PCA9468_REG_STS_A, &reg_val);
	if (ret < 0)
		return ret;

	if (reg_val & PCA9468_BIT_VIN_UV_STS) {
		ret = STS_MODE_VIN_UVLO;
	} else if (reg_val & PCA9468_BIT_IIN_LOOP_STS) {
		ret = STS_MODE_IIN_LOOP;
	} else if (reg_val & PCA9468_BIT_CHG_LOOP_STS) {
		ret = STS_MODE_CHG_LOOP; /* never */
	} else if (reg_val & PCA9468_BIT_VFLT_LOOP_STS) {
		ret = STS_MODE_VFLT_LOOP;
	} else {
		ret = STS_MODE_LOOP_INACTIVE; /* lower IIN or TA to enter CC? */
	}

	return ret;
}

/*
 * TODO: add formula and/or use device tree entries to configure. Can use
 * delta = PCA9468_COMP_VFLOAT_MAX to reduce the limit as float voltage
 * increases.
 * NOTE: how does this change with temperature, battery age?
 */
static int pca9468_irdrop_limit(struct pca9468_charger *pca9468, int fv_uv)
{
	int delta = pca9468->pdata->irdrop_limits[1];

	if (fv_uv < 4300000)
		delta = pca9468->pdata->irdrop_limits[0];
	if (fv_uv >= PCA9468_COMP_VFLOAT_MAX)
		delta = pca9468->pdata->irdrop_limits[2];

	return delta;
}

/* use max limit,  */
static int pca9468_apply_irdrop(struct pca9468_charger *pca9468, int fv_uv)
{
	const int delta_limit = pca9468_irdrop_limit(pca9468, fv_uv);
	int ret, vbat, pca_vbat = 0, delta = 0;
	const bool adaptive = false;

	/* use classic irdrop */
	if (!pca9468->pdata->pca_irdrop)
		goto error_done;

	ret = pca9468_get_batt_info(pca9468, BATT_VOLTAGE, &vbat);
	if (ret < 0)
		goto error_done;

	pca_vbat = pca9468_read_adc(pca9468, ADCCH_VBAT);
	if (pca_vbat < 0 || pca_vbat < vbat)
		goto error_done;

	if (adaptive) {
		delta = pca_vbat - vbat;
		if (delta > delta_limit)
			delta = delta_limit;
	} else {
		delta = delta_limit;
	}

	if (fv_uv + delta > PCA9468_COMP_VFLOAT_MAX)
		delta = PCA9468_COMP_VFLOAT_MAX - fv_uv;

error_done:
	pr_debug("%s: fv_uv=%d->%d pca_vbat=%d, vbat=%d delta_v=%d\n",
		 __func__, fv_uv, fv_uv + delta, pca_vbat,
		 ret < 0 ? ret : vbat, delta);

	if (fv_uv + delta < pca_vbat) {
		pr_err("%s: fv_uv=%d, comp_fv_uv=%d is lower than VBAT=%d\n",
		       __func__, fv_uv, fv_uv + delta, pca_vbat);
		return -EINVAL;
	}

	return fv_uv + delta;
}

static int pca9468_const_charge_voltage(struct pca9468_charger *pca9468);

/* irdrop compensation for the pca9468 V_FLOAT, will only raise it */
static int pca9468_comp_irdrop(struct pca9468_charger *pca9468)
{
	int ret = 0, v_float, fv_uv;

	v_float = pca9468_const_charge_voltage(pca9468);
	if (v_float < 0)
		return -EIO;

	fv_uv = pca9468_apply_irdrop(pca9468, pca9468->fv_uv);
	if (fv_uv < 0)
		return -EIO;

	/* do not back down */
	if (fv_uv > v_float) {
		ret = pca9468_set_vfloat(pca9468, fv_uv);
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"%s: v_float=%u->%u (%d)", __func__,
				v_float, fv_uv, ret);
	}

	return ret;
}

static int pca9468_check_status(struct pca9468_charger *pca9468)
{
	int icn = -EINVAL, ibat = -EINVAL, vbat = -EINVAL;
	int rc, status;

	status = pca9468_read_status(pca9468);
	if (status < 0)
		goto error;

	rc = pca9468_get_iin(pca9468, &icn);
	if (rc == 0)
		rc = pca9468_get_batt_info(pca9468, BATT_CURRENT, &ibat);
	if (rc == 0)
		rc = pca9468_get_batt_info(pca9468, BATT_VOLTAGE, &vbat);

error:
	pr_debug("%s: status=%d icn:%d ibat:%d delta_c=%d, vbat:%d, fv:%d, cc_max:%d\n",
		 __func__, status, icn, ibat, icn - ibat, vbat,
		 pca9468->fv_uv, pca9468->cc_max);

	return status;
}

/* hold mutex_lock(&pca9468->lock); */
static int pca9468_recover_ta(struct pca9468_charger *pca9468)
{
	int ret;

	if (pca9468->ta_type == TA_TYPE_WIRELESS) {
		pca9468->ta_vol = 0; /* set to a value to change rx vol */
		ret = pca9468_send_rx_voltage(pca9468, MSG_REQUEST_FIXED_PDO);
	} else {
		/* TODO: recover TA to value before handoff, or use DT */
		pca9468->ta_vol = 9000000;
		pca9468->ta_cur = 2200000;
		pca9468->ta_objpos = 1; /* PDO1 - fixed 5V */
		ret = pca9468_send_pd_message(pca9468, MSG_REQUEST_FIXED_PDO);
	}

	/* will not be able to recover if TA is offline */
	if (ret < 0)
		pr_debug("%s: cannot recover TA (%d)\n", __func__, ret);

	return 0;
}

/* Stop Charging */
static int pca9468_stop_charging(struct pca9468_charger *pca9468)
{
	int ret = 0;

	/* mark the end with \n in logbuffer */
	logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
			"%s: pca9468->charging_state=%d ret=%d\n",
			__func__, pca9468->charging_state, ret);

	mutex_lock(&pca9468->lock);

	/* Check the current state */
	if (pca9468->charging_state == DC_STATE_NO_CHARGING)
		goto done;

	/* Stop Direct charging  */
	cancel_delayed_work(&pca9468->timer_work);
	cancel_delayed_work(&pca9468->pps_work);
	pca9468->timer_id = TIMER_ID_NONE;
	pca9468->timer_period = 0;

	/* Clear parameter */
	pca9468->charging_state = DC_STATE_NO_CHARGING;
	pca9468->ret_state = DC_STATE_NO_CHARGING;
	pca9468->prev_iin = 0;
	pca9468->prev_inc = INC_NONE;
	pca9468->chg_mode = CHG_NO_DC_MODE;

	/* restore to config */
	pca9468->pdata->iin_cfg = pca9468->pdata->iin_cfg_max;
	pca9468->pdata->v_float = pca9468->pdata->v_float_dt;

	/*
	 * Clear charging configuration
	 * TODO: use defaults when these are negative or zero at startup
	 * NOTE: cc_max is twice of IIN + headroom
	 */
	pca9468->cc_max = -1;
	pca9468->fv_uv = -1;

	/* Clear requests for new Vfloat and new IIN */
	pca9468->new_vfloat = 0;
	pca9468->new_iin = 0;

	/* used to start DC and during errors */
	pca9468->retry_cnt = 0;

	/* close stats */
	p9468_chg_stats_done(&pca9468->chg_data, pca9468);
	p9468_chg_stats_dump(pca9468);

	/* TODO: something here to prep TA for the switch */

	ret = pca9468_set_charging(pca9468, false);
	if (ret < 0) {
		pr_err("%s: Error-set_charging(main)\n", __func__);
		goto error;
	}

	/* stop charging and recover TA voltage */
	if (pca9468->mains_online == true)
		pca9468_recover_ta(pca9468);

	power_supply_changed(pca9468->mains);

done:
error:
	mutex_unlock(&pca9468->lock);
	__pm_relax(pca9468->monitor_wake_lock);
	pr_debug("%s: END, ret=%d\n", __func__, ret);
	return ret;
}

#define FCC_TOLERANCE_RATIO		99
#define FCC_POWER_INCREASE_THRESHOLD	99

/*
 * Compensate TA current for the target input current called from
 * pca9468_charge_ccmode() when loop becomes not active.
 *
 * pca9468_charge_ccmode() ->
 * 	-> pca9468_set_rx_voltage_comp()
 * 	-> pca9468_set_ta_voltage_comp()
 * 	-> pca9468_set_ta_current_comp2()
 *
 * NOTE: call holding mutex_lock(&pca9468->lock);
 */
static int pca9468_set_ta_current_comp(struct pca9468_charger *pca9468)
{
	const int iin_high = pca9468->iin_cc + pca9468->pdata->iin_cc_comp_offset;
	const int iin_low = pca9468->iin_cc - pca9468->pdata->iin_cc_comp_offset;
	int rc, ibat, icn = -EINVAL, iin = -EINVAL;
	bool ovc_flag;

	/* IIN = IBAT+SYSLOAD */
	rc = pca9468_get_ibatt(pca9468, &ibat);
	if (rc == 0)
		rc = pca9468_get_iin(pca9468, &icn);
	if (rc == 0)
		iin = pca9468_read_adc(pca9468, ADCCH_IIN);

	ovc_flag = ibat > pca9468->cc_max;
	if (ovc_flag)
		p9468_chg_stats_inc_ovcf(&pca9468->chg_data, ibat, pca9468->cc_max);

	logbuffer_prlog(pca9468, ovc_flag ? LOGLEVEL_WARNING : LOGLEVEL_DEBUG,
			"%s: iin=%d, iin_cc=[%d,%d,%d], icn=%d ibat=%d, cc_max=%d rc=%d prev_iin=%d",
			__func__, iin, iin_low, pca9468->iin_cc, iin_high,
			icn, ibat, pca9468->cc_max, rc,
			pca9468->prev_iin);
	if (iin < 0)
		return iin;

	/* Compare IIN ADC with target input current */
	if (iin > iin_high) {

		/* TA current is higher than the target input current */
		if (pca9468->ta_cur > pca9468->iin_cc) {
			/* TA current is over than IIN_CC */
			/* Decrease TA current (50mA) */
			pca9468->ta_cur = pca9468->ta_cur - PD_MSG_TA_CUR_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont1: ta_cur=%u",
					pca9468->ta_cur);

		/* TA current is already less than IIN_CC */
		/* Compara IIN_ADC with the previous IIN_ADC */
		} else if (iin < (pca9468->prev_iin - PCA9468_IIN_ADC_OFFSET)) {
			/* Assume that TA operation mode is CV mode */
			/* Decrease TA voltage (20mV) */
			pca9468->ta_vol = pca9468->ta_vol - PD_MSG_TA_VOL_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont2-1: ta_vol=%u",
					pca9468->ta_vol);
		} else {
			/* Assume TA operation mode is CL mode */
			/* Decrease TA current (50mA) */
			pca9468->ta_cur = pca9468->ta_cur - PD_MSG_TA_CUR_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont2-2: ta_cur=%u",
					pca9468->ta_cur);
		}

		/* Send PD Message */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;

	} else if (iin < iin_low) {

		/* compare IIN ADC with previous IIN ADC + 20mA */
		if (iin > (pca9468->prev_iin + PCA9468_IIN_ADC_OFFSET)) {
			/*
			 * TA voltage is not enough to supply the operating
			 * current of RDO: increase TA voltage
			 */

			/* Compare TA max voltage */
			if (pca9468->ta_vol == pca9468->ta_max_vol) {
				/* TA voltage is already the maximum voltage */
				/* Compare TA max current */
				if (pca9468->ta_cur == pca9468->ta_max_cur) {
					/* TA voltage and current are at max */
					logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
							"End1: ta_vol=%u, ta_cur=%u",
							pca9468->ta_vol, pca9468->ta_cur);

					/* Set timer */
					pca9468->timer_id = TIMER_CHECK_CCMODE;
					pca9468->timer_period = PCA9468_CCMODE_CHECK1_T;
				} else {
					/* Increase TA current (50mA) */
					pca9468->ta_cur = pca9468->ta_cur + PD_MSG_TA_CUR_STEP;

					logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
							"Cont3: ta_cur=%u",
							pca9468->ta_cur);

					/* Send PD Message */
					pca9468->timer_id = TIMER_PDMSG_SEND;
					pca9468->timer_period = 0;

					/* Set TA increment flag */
					pca9468->prev_inc = INC_TA_CUR;
				}
			} else {
				/* Increase TA voltage (20mV) */
				pca9468->ta_vol = pca9468->ta_vol + PD_MSG_TA_VOL_STEP;
				logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
						"Cont4: ta_vol=%u", pca9468->ta_vol);

				/* Send PD Message */
				pca9468->timer_id = TIMER_PDMSG_SEND;
				pca9468->timer_period = 0;

				/* Set TA increment flag */
				pca9468->prev_inc = INC_TA_VOL;
			}

		/* TA current is lower than the target input current */
		/* Check the previous TA increment */
		} else if (pca9468->prev_inc == INC_TA_VOL) {
			/*
			 * The previous increment is TA voltage, but
			 * input current does not increase.
			 */

			/* Try to increase TA current */
			/* Compare TA max current */
			if (pca9468->ta_cur == pca9468->ta_max_cur) {

				/* TA current is already the maximum current */
				/* Compare TA max voltage */
				if (pca9468->ta_vol == pca9468->ta_max_vol) {
					/*
					 * TA voltage and current are already
					 * the maximum values
					 */
					logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
							"End2: ta_vol=%u, ta_cur=%u",
							pca9468->ta_vol, pca9468->ta_cur);

					pca9468->timer_id = TIMER_CHECK_CCMODE;
					pca9468->timer_period = PCA9468_CCMODE_CHECK1_T;
				} else {
					/* Increase TA voltage (20mV) */
					pca9468->ta_vol = pca9468->ta_vol + PD_MSG_TA_VOL_STEP;
					logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
							"Cont5: ta_vol=%u",
							pca9468->ta_vol);

					/* Send PD Message */
					pca9468->timer_id = TIMER_PDMSG_SEND;
					pca9468->timer_period = 0;

					/* Set TA increment flag */
					pca9468->prev_inc = INC_TA_VOL;
				}
			} else {
				const unsigned int ta_cur = pca9468->ta_cur +
							    PD_MSG_TA_CUR_STEP;

				/* Increase TA current (50mA) */
				logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
						"Cont6: ta_cur=%u->%u",
						pca9468->ta_cur, ta_cur);

				pca9468->ta_cur = pca9468->ta_cur + PD_MSG_TA_CUR_STEP;
				pca9468->timer_id = TIMER_PDMSG_SEND;
				pca9468->timer_period = 0;

				pca9468->prev_inc = INC_TA_CUR;
			}

		/*
		 * The previous increment was TA current, but input current
		 * did not increase. Try to increase TA voltage.
		 */
		} else if (pca9468->ta_vol == pca9468->ta_max_vol) {
			/* TA voltage is already the maximum voltage */

			/* Compare TA maximum current */
			if (pca9468->ta_cur == pca9468->ta_max_cur) {
				/*
				* TA voltage and current are already at the
				 * maximum values
				 */
				logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
						"End3: ta_vol=%u, ta_cur=%u",
						 pca9468->ta_vol, pca9468->ta_cur);

				pca9468->timer_id = TIMER_CHECK_CCMODE;
				pca9468->timer_period = PCA9468_CCMODE_CHECK1_T;
			} else {
				/* Increase TA current (50mA) */
				pca9468->ta_cur = pca9468->ta_cur + PD_MSG_TA_CUR_STEP;
				logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
						"Cont7: ta_cur=%u", pca9468->ta_cur);

				/* Send PD Message */
				pca9468->timer_id = TIMER_PDMSG_SEND;
				pca9468->timer_period = 0;

				/* Set TA increment flag */
				pca9468->prev_inc = INC_TA_CUR;
			}
		} else {
			/* Increase TA voltage (20mV) */
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"Comp. Cont8: ta_vol=%u->%u",
					pca9468->ta_vol, pca9468->ta_vol + PD_MSG_TA_VOL_STEP);

			pca9468->ta_vol += PD_MSG_TA_VOL_STEP;

			/* Send PD Message */
			pca9468->timer_id = TIMER_PDMSG_SEND;
			pca9468->timer_period = 0;

			/* Set TA increment flag */
			pca9468->prev_inc = INC_TA_VOL;
		}

	} else {
		/* IIN ADC is in valid range */
		/* IIN_CC - 50mA < IIN ADC < IIN_CC + 50mA  */
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"Comp. End4(valid): ta_vol=%u, ta_cur=%u",
				pca9468->ta_vol, pca9468->ta_cur);
		/* Set timer */
		pca9468->timer_id = TIMER_CHECK_CCMODE;
		pca9468->timer_period = PCA9468_CCMODE_CHECK1_T;

		/* b/186969924: reset increment state on valid */
		pca9468->prev_inc = INC_NONE;
	}

	/* Save previous iin adc */
	pca9468->prev_iin = iin;
	return 0;
}

/*
 * max iin for 2:1 mode given cc_max and iin_cfg.
 * TODO: maybe use pdata->iin_cfg if cc_max is zero or negative.
 */
static int pca9468_get_iin_max(const struct pca9468_charger *pca9468, int cc_max)
{
	const int cc_limit = pca9468->pdata->iin_max_offset + cc_max / 2;
	int iin_max;

	iin_max = min(pca9468->pdata->iin_cfg_max, (unsigned int)cc_limit);

	pr_debug("%s: iin_max=%d iin_cfg=%u iin_cfg_max=%d cc_max=%d cc_limit=%d\n",
		 __func__, iin_max, pca9468->pdata->iin_cfg,
		 pca9468->pdata->iin_cfg_max, cc_max, cc_limit);

	return iin_max;
}

/* Compensate TA current for constant power mode */
/* hold mutex_lock(&pca9468->lock), schedule on return 0 */
static int pca9468_set_ta_current_comp2(struct pca9468_charger *pca9468)
{
	int rc, ibat, icn = -EINVAL, iin = -EINVAL;
	bool ovc_flag;

	/* IIN = IBAT+SYSLOAD */
	rc = pca9468_get_ibatt(pca9468, &ibat);
	if (rc == 0)
		rc = pca9468_get_iin(pca9468, &icn);
	if (rc == 0)
		iin = pca9468_read_adc(pca9468, ADCCH_IIN);

	ovc_flag = ibat > pca9468->cc_max;
	if (ovc_flag)
		p9468_chg_stats_inc_ovcf(&pca9468->chg_data, ibat, pca9468->cc_max);;

	logbuffer_prlog(pca9468, ovc_flag ? LOGLEVEL_WARNING : LOGLEVEL_DEBUG,
			"%s: iin=%d, iin_cc=[%d,%d,%d], iin_cfg=%d icn=%d ibat=%d, cc_max=%d rc=%d",
			__func__, iin,
			pca9468->iin_cc - PCA9468_IIN_CC_COMP_OFFSET_CP,
			pca9468->iin_cc,
			pca9468->iin_cc + PCA9468_IIN_CC_COMP_OFFSET_CP,
			pca9468->pdata->iin_cfg,
			icn, ibat, pca9468->cc_max, rc);
	if (iin < 0)
		return iin;

	/* Compare IIN ADC with target input current */
	if (iin > (pca9468->pdata->iin_cfg + pca9468->pdata->iin_cc_comp_offset)) {
		/* TA current is higher than the target input current limit */
		pca9468->ta_cur = pca9468->ta_cur - PD_MSG_TA_CUR_STEP;

		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;
	} else if (iin < (pca9468->iin_cc - PCA9468_IIN_CC_COMP_OFFSET_CP)) {

		/* TA current is lower than the target input current */
		/* IIN_ADC < IIN_CC -20mA */
		if (pca9468->ta_vol == pca9468->ta_max_vol) {
			const int iin_cc_lb = pca9468->iin_cc -
				      pca9468->pdata->iin_cc_comp_offset;

			/* Check IIN_ADC < IIN_CC - 50mA */
			if (iin < iin_cc_lb) {
				const unsigned int ta_max_vol =
				    pca9468->pdata->ta_max_vol * pca9468->chg_mode;
				unsigned int iin_apdo;
				unsigned int val;

				/* Set new IIN_CC to IIN_CC - 50mA */
				pca9468->iin_cc = pca9468->iin_cc -
					  pca9468->pdata->iin_cc_comp_offset;

				/* Set new TA_MAX_VOL to TA_MAX_PWR/IIN_CC */
				/* Adjust new IIN_CC with APDO resolution */
				iin_apdo = pca9468->iin_cc / PD_MSG_TA_CUR_STEP;
				iin_apdo = iin_apdo * PD_MSG_TA_CUR_STEP;
				/* in mV */
				val = pca9468->ta_max_pwr / (iin_apdo / pca9468->chg_mode / 1000);
				/* Adjust values with APDO resolution(20mV) */
				val = val * 1000 / PD_MSG_TA_VOL_STEP;
				val = val * PD_MSG_TA_VOL_STEP; /* uV */

				/* Set new TA_MAX_VOL */
				pca9468->ta_max_vol = min(val, ta_max_vol);

				/* Increase TA voltage(40mV) */
				pca9468->ta_vol = pca9468->ta_vol + PD_MSG_TA_VOL_STEP * 2;

				logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
						"Cont1: ta_vol=%u",
						pca9468->ta_vol);

				/* Send PD Message */
				pca9468->timer_id = TIMER_PDMSG_SEND;
				pca9468->timer_period = 0;
			} else {
				/* Wait for next current step compensation */
				/* IIN_CC - 50mA < IIN ADC < IIN_CC - 20mA */
				logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
						"Comp.(wait): ta_vol=%u",
						pca9468->ta_vol);

				/* Set timer */
				pca9468->timer_id = TIMER_CHECK_CCMODE;
				pca9468->timer_period = PCA9468_CCMODE_CHECK2_T;
			}
		} else {
			/* Increase TA voltage(40mV) */
			pca9468->ta_vol = pca9468->ta_vol + PD_MSG_TA_VOL_STEP * 2;
			if (pca9468->ta_vol > pca9468->ta_max_vol)
				pca9468->ta_vol = pca9468->ta_max_vol;

			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont2: ta_vol=%u",
					pca9468->ta_vol);

			/* Send PD Message */
			pca9468->timer_id = TIMER_PDMSG_SEND;
			pca9468->timer_period = 0;
		}
	} else {
		/* IIN ADC is in valid range */
		/* IIN_CC - 50mA < IIN ADC < IIN_CFG + 50mA */
		pr_debug("End(valid): ta_vol=%u\n", pca9468->ta_vol);

		pca9468->timer_id = TIMER_CHECK_CCMODE;
		pca9468->timer_period = PCA9468_CCMODE_CHECK2_T;

		/* b/186969924: reset increment state on valid */
		pca9468->prev_inc = INC_NONE;
	}

	/* Save previous iin adc */
	pca9468->prev_iin = iin;
	return 0;
}

/* Compensate TA voltage for the target input current */
/* hold mutex_lock(&pca9468->lock), schedule on return 0 */
static int pca9468_set_ta_voltage_comp(struct pca9468_charger *pca9468)
{
	const int iin_high = pca9468->iin_cc + pca9468->pdata->iin_cc_comp_offset;
	const int iin_low = pca9468->iin_cc - pca9468->pdata->iin_cc_comp_offset;
	const int ibat_limit = (pca9468->cc_max * FCC_POWER_INCREASE_THRESHOLD) / 100;
	int rc, ibat, icn = -EINVAL, iin = -EINVAL;
	bool ovc_flag;

	pr_debug("%s: ======START=======\n", __func__);
	pr_debug("%s: = charging_state=%u == \n", __func__,
		 pca9468->charging_state);

	/* IIN = IBAT+SYSLOAD */
	rc = pca9468_get_ibatt(pca9468, &ibat);
	if (rc == 0)
		rc = pca9468_get_iin(pca9468, &icn);
	if (rc == 0)
		iin = pca9468_read_adc(pca9468, ADCCH_IIN);

	ovc_flag = ibat > pca9468->cc_max;
	if (ovc_flag)
		p9468_chg_stats_inc_ovcf(&pca9468->chg_data, ibat, pca9468->cc_max);;

	logbuffer_prlog(pca9468, ovc_flag ? LOGLEVEL_WARNING : LOGLEVEL_DEBUG,
			"%s: iin=%d, iin_cc=[%d,%d,%d], icn=%d ibat=%d, cc_max=%d rc=%d",
			__func__, iin, iin_low, pca9468->iin_cc, iin_high,
			icn, ibat, pca9468->cc_max, rc);

	if (iin < 0)
		return iin;

	/* Compare IIN ADC with target input current */
	if (iin > iin_high) {
		/* TA current is higher than the target input current */
		/* Decrease TA voltage (20mV) */
		pca9468->ta_vol = pca9468->ta_vol - PD_MSG_TA_VOL_STEP;
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont1: ta_vol=%u",
				pca9468->ta_vol);

		/* Send PD Message */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;

	} else if (iin < pca9468->iin_cc - pca9468->pdata->iin_cc_comp_offset) {

		/* TA current is lower than the target input current */
		/* Compare TA max voltage */
		if (pca9468->ta_vol == pca9468->ta_max_vol) {
			/* TA is already at maximum voltage */
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,"End1(max TA vol): ta_vol=%u",
					pca9468->ta_vol);

			/* Set timer */
			/* Check the current charging state */
			if (pca9468->charging_state == DC_STATE_CC_MODE) {
				/* CC mode */
				pca9468->timer_id = TIMER_CHECK_CCMODE;
				pca9468->timer_period = PCA9468_CCMODE_CHECK1_T;
			} else {
				/* CV mode */
				pca9468->timer_id = TIMER_CHECK_CVMODE;
				pca9468->timer_period = PCA9468_CVMODE_CHECK_T;
			}
		} else {
			const unsigned ta_vol = pca9468->ta_vol;

			/* Increase TA voltage (20mV) */
			pca9468->ta_vol = pca9468->ta_vol + PD_MSG_TA_VOL_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont2: ta_vol:%u->%u",
					ta_vol, pca9468->ta_vol);

			/* Send PD Message */
			pca9468->timer_id = TIMER_PDMSG_SEND;
			pca9468->timer_period = 0;
		}
	} else {
		/* IIN ADC is in valid range */
		/* IIN_CC - 50mA < IIN ADC < IIN_CC + 50mA  */
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"End(valid): ta_vol=%u low_ibat=%d\n",
				pca9468->ta_vol, ibat < ibat_limit);

		/* Check the current charging state */
		if (pca9468->charging_state == DC_STATE_CC_MODE) {
			pca9468->timer_id = TIMER_CHECK_CCMODE;
			pca9468->timer_period = PCA9468_CCMODE_CHECK1_T;
		} else {
			pca9468->timer_id = TIMER_CHECK_CVMODE;
			pca9468->timer_period = PCA9468_CVMODE_CHECK_T;
		}
	}

	return 0;
}

/* hold mutex_lock(&pca9468->lock), schedule on return 0 */
static int pca9468_set_rx_voltage_comp(struct pca9468_charger *pca9468)
{
	int rc, ibat, icn = -EINVAL, iin = -EINVAL;
	bool ovc_flag;

	pr_debug("%s: ======START=======\n", __func__);

	rc = pca9468_get_ibatt(pca9468, &ibat);
	if (rc == 0)
		rc = pca9468_get_iin(pca9468, &icn);
	if (rc == 0)
		iin = pca9468_read_adc(pca9468, ADCCH_IIN);

	ovc_flag = ibat > pca9468->cc_max;
	if (ovc_flag)
		p9468_chg_stats_inc_ovcf(&pca9468->chg_data, ibat, pca9468->cc_max);;

	logbuffer_prlog(pca9468, ovc_flag ? LOGLEVEL_WARNING : LOGLEVEL_DEBUG,
			"%s: iin=%d, iin_cc=[%d,%d,%d], icn=%d ibat=%d, cc_max=%d rc=%d",
			__func__, iin,
			pca9468->iin_cc - pca9468->pdata->iin_cc_comp_offset,
			pca9468->iin_cc,
			pca9468->iin_cc + pca9468->pdata->iin_cc_comp_offset,
			icn, ibat, pca9468->cc_max, rc);
	if (iin < 0)
		return iin;

	/* Compare IIN ADC with target input current */
	if (iin > (pca9468->iin_cc + pca9468->pdata->iin_cc_comp_offset)) {

		/* RX current is higher than the target input current */
		pca9468->ta_vol = pca9468->ta_vol - WCRX_VOL_STEP;
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont1: rx_vol=%u",
				pca9468->ta_vol);

		/* Set RX Voltage */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;

	} else if (iin < (pca9468->iin_cc - pca9468->pdata->iin_cc_comp_offset)) {

		/* RX current is lower than the target input current */
		/* Compare RX max voltage */
		if (pca9468->ta_vol == pca9468->ta_max_vol) {

			/* TA current is already the maximum voltage */
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"End1(max RX vol): rx_vol=%u",
					pca9468->ta_vol);

			/* Check the current charging state */
			if (pca9468->charging_state == DC_STATE_CC_MODE) {
				/* CC mode */
				pca9468->timer_id = TIMER_CHECK_CCMODE;
				pca9468->timer_period = PCA9468_CCMODE_CHECK1_T;
			} else {
				/* CV mode */
				pca9468->timer_id = TIMER_CHECK_CVMODE;
				pca9468->timer_period = PCA9468_CVMODE_CHECK_T;
			}
		} else {
			/* Increase RX voltage (100mV) */
			pca9468->ta_vol = pca9468->ta_vol + WCRX_VOL_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont2: rx_vol=%u",
					pca9468->ta_vol);

			/* Set RX Voltage */
			pca9468->timer_id = TIMER_PDMSG_SEND;
			pca9468->timer_period = 0;
		}
	} else {
		/* IIN ADC is in valid range */
		/* IIN_CC - 50mA < IIN ADC < IIN_CC + 50mA  */
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "End(valid): rx_vol=%u",
				pca9468->ta_vol);

		if (pca9468->charging_state == DC_STATE_CC_MODE) {
			pca9468->timer_id = TIMER_CHECK_CCMODE;
			pca9468->timer_period = PCA9468_CCMODE_CHECK1_T;
		} else {
			pca9468->timer_id = TIMER_CHECK_CVMODE;
			pca9468->timer_period = PCA9468_CVMODE_CHECK_T;
		}
	}

	return 0;
}

/*
 * iin limit for 2:1 for the adapter and chg_mode
 * Minimum between the confguration, cc_max (scaled with offset) and the
 * adapter capabilities.
 */
static int pca9468_get_iin_limit(const struct pca9468_charger *pca9468)
{
	int iin_cc;

	iin_cc = pca9468_get_iin_max(pca9468, pca9468->cc_max);
	if (pca9468->ta_max_cur * pca9468->chg_mode < iin_cc)
		iin_cc = pca9468->ta_max_cur * pca9468->chg_mode;

	pr_debug("%s: iin_cc=%d ta_max_cur=%u, chg_mode=%d\n", __func__,
		 iin_cc, pca9468->ta_max_cur, pca9468->chg_mode);

	return iin_cc;
}

/* recalculate ->ta_vol looking at demand (cc_max) */
static int pca9468_set_wireless_dc(struct pca9468_charger *pca9468, int vbat)
{
	unsigned long val;

	pca9468->iin_cc = pca9468_get_iin_limit(pca9468);

	/* RX_vol = MAX[(2*VBAT_ADC*CHG_mode + 500mV), 8.0V*CHG_mode] */
	pca9468->ta_vol = max(PCA9468_TA_MIN_VOL_PRESET * pca9468->chg_mode,
				(2 * vbat *  pca9468->chg_mode +
				PCA9468_TA_VOL_PRE_OFFSET));

	/* RX voltage resolution is 100mV */
	val = pca9468->ta_vol / WCRX_VOL_STEP;
	pca9468->ta_vol = val * WCRX_VOL_STEP;
	/* Set RX voltage to MIN[RX voltage, RX_MAX_VOL*chg_mode] */
	pca9468->ta_vol = min(pca9468->ta_vol, pca9468->ta_max_vol);

	/* ta_cur is ignored */
	logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
			"%s: iin_cc=%d, ta_vol=%d ta_max_vol=%d", __func__,
			pca9468->iin_cc, pca9468->ta_vol, pca9468->ta_max_vol);

	return 0;
}

/* recalculate ->ta_vol and ->ta_cur looking at demand (cc_max) */
static int pca9468_set_wired_dc(struct pca9468_charger *pca9468, int vbat)
{
	const unsigned long ta_max_vol = pca9468->pdata->ta_max_vol * pca9468->chg_mode;
	unsigned long val;
	int iin_cc;

	pca9468->iin_cc = pca9468_get_iin_limit(pca9468);

	/* Calculate new TA max voltage, current */
	val = pca9468->iin_cc / PD_MSG_TA_CUR_STEP;
	iin_cc = val * PD_MSG_TA_CUR_STEP;

	val = pca9468->ta_max_pwr / (iin_cc / pca9468->chg_mode  / 1000); /* mV */

	/* Adjust values with APDO resolution(20mV) */
	val = val * 1000 / PD_MSG_TA_VOL_STEP;
	val = val * PD_MSG_TA_VOL_STEP; /* uV */
	pca9468->ta_max_vol = min(val, ta_max_vol);

	/* MAX[8000mV * chg_mode, 2 * VBAT_ADC * chg_mode + 500 mV] */
	pca9468->ta_vol = max(PCA9468_TA_MIN_VOL_PRESET * pca9468->chg_mode,
			      2 * vbat * pca9468->chg_mode + PCA9468_TA_VOL_PRE_OFFSET);

	/* PPS voltage resolution is 20mV */
	val = pca9468->ta_vol / PD_MSG_TA_VOL_STEP;
	pca9468->ta_vol = val * PD_MSG_TA_VOL_STEP;
	pca9468->ta_vol = min(pca9468->ta_vol, pca9468->ta_max_vol);
	/* Set TA current to IIN_CC */
	pca9468->ta_cur = iin_cc / pca9468->chg_mode;

	logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
			"%s: iin_cc=%d, ta_vol=%d ta_cur=%d ta_max_vol=%d",
			__func__, pca9468->iin_cc, pca9468->ta_vol, pca9468->ta_cur,
			pca9468->ta_max_vol);

	return 0;
}

/*
 * like pca9468_preset_dcmode() but will not query the TA.
 * Called from timer:
 * [pca9468_charge_ccmode | pca9468_charge_cvmode] ->
 * 	pca9468_apply_new_iin() ->
 * 		pca9468_adjust_ta_current() ->
 * 			pca9468_reset_dcmode()
 * 	pca9468_apply_new_vfloat() ->
 * 		pca9468_reset_dcmode()
 *
 * NOTE: caller holds mutex_lock(&pca9468->lock);
 */
static int pca9468_reset_dcmode(struct pca9468_charger *pca9468)
{
	int ret = -EINVAL, vbat;

	pr_debug("%s: ======START=======\n", __func__);
	pr_debug("%s: = charging_state=%u == \n", __func__,
		 pca9468->charging_state);

	if (pca9468->cc_max < 0) {
		pr_err("%s: invalid cc_max=%d\n", __func__, pca9468->cc_max);
		goto error;
	}

	/*
	 * VBAT is over threshold but it might be "bouncy" due to transitory
	 * used to determine ta_vout.
	 */
	vbat = pca9468_read_adc(pca9468, ADCCH_VBAT);
	if (vbat < 0)
		return vbat;

	/* Check the TA type and set the charging mode */
	if (pca9468->ta_type == TA_TYPE_WIRELESS) {
		ret = pca9468_set_wireless_dc(pca9468, vbat);
	} else {
		ret = pca9468_set_wired_dc(pca9468, vbat);
	}

	/* Clear previous IIN ADC, TA increment flag */
	pca9468->prev_inc = INC_NONE;
	pca9468->prev_iin = 0;
error:
	pr_debug("%s: End, ret=%d\n", __func__, ret);
	return ret;
}

/*
 * The caller was triggered from pca9468_apply_new_iin(), return to the
 * calling CC or CV loop.
 * call holding mutex_unlock(&pca9468->lock);
 */
static void pca9468_return_to_loop(struct pca9468_charger *pca9468)
{
	switch (pca9468->ret_state) {
	case DC_STATE_CC_MODE:
		pca9468->timer_id = TIMER_CHECK_CCMODE;
		break;
	case DC_STATE_CV_MODE:
		pca9468->timer_id = TIMER_CHECK_CVMODE;
		break;
	default:
		dev_err(pca9468->dev, "%s: invalid ret_state=%u\n",
			__func__, pca9468->ret_state);
		return;
	}

	dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
		 pca9468->charging_state, pca9468->ret_state);

	pca9468->charging_state = pca9468->ret_state;
	pca9468->timer_period = 1000;
	pca9468->ret_state = 0;
	pca9468->new_iin = 0;
}

/*
 * Kicked from pca9468_apply_new_iin() when pca9468->new_iin!=0 and completed
 * off the timer. Never called on WLC_DC.
 * NOTE: Will return to the calling loop in ->ret_state
 */
static int pca9468_adjust_ta_current(struct pca9468_charger *pca9468)
{
	const int ta_limit = pca9468->iin_cc / pca9468->chg_mode;
	int rc, ibat, icn = -EINVAL, iin = -EINVAL;
	bool ovc_flag;
	int ret = 0;

	rc = pca9468_get_ibatt(pca9468, &ibat);
	if (rc == 0)
		rc = pca9468_get_iin(pca9468, &icn);
	if (rc == 0)
		iin = pca9468_read_adc(pca9468, ADCCH_IIN);

	ovc_flag = ibat > pca9468->cc_max;
	if (ovc_flag)
		p9468_chg_stats_inc_ovcf(&pca9468->chg_data, ibat, pca9468->cc_max);;

	logbuffer_prlog(pca9468, ovc_flag ? LOGLEVEL_WARNING : LOGLEVEL_DEBUG,
			"%s: iin=%d, iin_cc=%d ta_limit=%d, iin_cfg=%d icn=%d ibat=%d, cc_max=%d rc=%d",
			__func__, iin, pca9468->iin_cc, ta_limit, pca9468->pdata->iin_cfg,
			icn, ibat, pca9468->cc_max, rc);

	if (pca9468->charging_state != DC_STATE_ADJUST_TACUR)
		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_ADJUST_TACUR);

	pca9468->charging_state = DC_STATE_ADJUST_TACUR;

	if (pca9468->ta_cur == ta_limit) {

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"adj. End, ta_cur=%u, ta_vol=%u, iin_cc=%u, chg_mode=%u",
				pca9468->ta_cur, pca9468->ta_vol,
				pca9468->iin_cc, pca9468->chg_mode);

		/* "Recover" IIN_CC to the original value (new_iin) */
		pca9468->iin_cc = pca9468->new_iin;
		pca9468_return_to_loop(pca9468);

	} else if (pca9468->iin_cc > pca9468->pdata->iin_cfg) {
		const int old_iin_cfg = pca9468->pdata->iin_cfg;

		/* Raise iin_cfg to the new iin_cc value (why??!?!?) */
		pca9468->pdata->iin_cfg = pca9468->iin_cc;

		ret = pca9468_set_input_current(pca9468, pca9468->iin_cc);
		if (ret == 0)
			ret = pca9468_reset_dcmode(pca9468);
		if (ret < 0)
			goto error;

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"New IIN, ta_max_vol=%u, ta_max_cur=%u, ta_max_pwr=%lu, iin_cc=%u, iin_cfg=%d->%d chg_mode=%u",
				pca9468->ta_max_vol, pca9468->ta_max_cur,
				pca9468->ta_max_pwr, pca9468->iin_cc,
				old_iin_cfg, pca9468->iin_cc,
				pca9468->chg_mode);

		pca9468->new_iin = 0;

		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_ADJUST_CC);

		/* Send PD Message and go to Adjust CC mode */
		pca9468->charging_state = DC_STATE_ADJUST_CC;
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;
	} else {
		unsigned int val;

		/*
		 * Adjust IIN_CC with APDO resolution(50mA)
		 * pca9468->iin_cc will be reset to pca9468->new_iin when
		 * ->ta_cur reaches the ta_limit at the beginning of the
		 * function
		 */
		val = pca9468->iin_cc / PD_MSG_TA_CUR_STEP;
		pca9468->iin_cc = val * PD_MSG_TA_CUR_STEP;
		pca9468->ta_cur = pca9468->iin_cc / pca9468->chg_mode;

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "adjust iin=%u ta_cur=%d chg_mode=%d",
				pca9468->iin_cc, pca9468->ta_cur, pca9468->chg_mode);

		/* Send PD Message */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;
	}

	/* reschedule on ret == 0 */
error:
	return ret;
}

/* Kicked from apply_new_iin() then run off the timer
 * call holding mutex_lock(&pca9468->lock);
 */
static int pca9468_adjust_ta_voltage(struct pca9468_charger *pca9468)
{
	int rc, ibat, icn = -EINVAL, iin = -EINVAL;
	bool ovc_flag;

	if (pca9468->charging_state != DC_STATE_ADJUST_TAVOL)
		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_ADJUST_TAVOL);

	pca9468->charging_state = DC_STATE_ADJUST_TAVOL;

	rc = pca9468_get_ibatt(pca9468, &ibat);
	if (rc == 0)
		rc = pca9468_get_iin(pca9468, &icn);
	if (rc == 0)
		iin = pca9468_read_adc(pca9468, ADCCH_IIN);

	ovc_flag = ibat > pca9468->cc_max;
	if (ovc_flag)
		p9468_chg_stats_inc_ovcf(&pca9468->chg_data, ibat, pca9468->cc_max);;

	logbuffer_prlog(pca9468, ovc_flag ? LOGLEVEL_WARNING : LOGLEVEL_DEBUG,
			"%s: iin=%d, iin_cc=[%d,%d,%d], icn=%d ibat=%d, cc_max=%d rc=%d",
			__func__, iin, pca9468->iin_cc - PD_MSG_TA_CUR_STEP,
			pca9468->iin_cc, pca9468->iin_cc + PD_MSG_TA_CUR_STEP,
			icn, ibat, pca9468->cc_max, rc);

	if (iin < 0)
		return iin;


	/* Compare IIN ADC with targer input current */
	if (iin > (pca9468->iin_cc + PD_MSG_TA_CUR_STEP)) {
		/* TA current is higher than the target input current */
		/* Decrease TA voltage (20mV) */
		pca9468->ta_vol = pca9468->ta_vol - PD_MSG_TA_VOL_STEP;

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont1, ta_vol=%u",
				pca9468->ta_vol);

		/* Send PD Message */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;
	} else if (iin < (pca9468->iin_cc - PD_MSG_TA_CUR_STEP)) {
		/* TA current is lower than the target input current */

		if (pca9468_check_status(pca9468) == STS_MODE_VFLT_LOOP) {
			/* IIN current may not able to increase in CV */

			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"End1-1, skip adjust for cv, ta_cur=%u, ta_vol=%u, iin_cc=%u, chg_mode=%u",
					pca9468->ta_cur, pca9468->ta_vol,
					pca9468->iin_cc, pca9468->chg_mode);

			pca9468_return_to_loop(pca9468);
		} else if (pca9468->ta_vol == pca9468->ta_max_vol) {
			/* TA TA voltage is already at the maximum voltage */

			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"End1, ta_cur=%u, ta_vol=%u, iin_cc=%u, chg_mode=%u",
					pca9468->ta_cur, pca9468->ta_vol,
					pca9468->iin_cc, pca9468->chg_mode);

			pca9468_return_to_loop(pca9468);
		} else {
			/* Increase TA voltage (20mV) */
			pca9468->ta_vol = pca9468->ta_vol + PD_MSG_TA_VOL_STEP;

			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont2, ta_vol=%u",
					pca9468->ta_vol);

			/* Send PD Message */
			pca9468->timer_id = TIMER_PDMSG_SEND;
			pca9468->timer_period = 0;
		}
	} else {
		/* IIN ADC is in valid range */
		/* IIN_CC - 50mA < IIN ADC < IIN_CC + 50mA  */

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"End2, ta_cur=%u, ta_vol=%u, iin_cc=%u, chg_mode=%u",
				pca9468->ta_cur, pca9468->ta_vol,
			pca9468->iin_cc, pca9468->chg_mode);

		pca9468_return_to_loop(pca9468);
	}

	return 0;
}

/*
 * Kicked from apply_new_iin() then run off the timer
 * * NOTE: caller must hold mutex_lock(&pca9468->lock)
 */
static int pca9468_adjust_rx_voltage(struct pca9468_charger *pca9468)
{
	const int iin_high = pca9468->iin_cc + pca9468->pdata->iin_cc_comp_offset;
	const int iin_low = pca9468->iin_cc - pca9468->pdata->iin_cc_comp_offset;
	int rc, ibat, icn = -EINVAL, iin = -EINVAL;
	bool ovc_flag;

	if (pca9468->charging_state != DC_STATE_ADJUST_TAVOL)
		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_ADJUST_TAVOL);

	pca9468->charging_state = DC_STATE_ADJUST_TAVOL;

	rc = pca9468_get_ibatt(pca9468, &ibat);
	if (rc == 0)
		rc = pca9468_get_iin(pca9468, &icn);
	if (rc == 0)
		iin = pca9468_read_adc(pca9468, ADCCH_IIN);

	ovc_flag = ibat > pca9468->cc_max;
	if (ovc_flag)
		p9468_chg_stats_inc_ovcf(&pca9468->chg_data, ibat, pca9468->cc_max);;

	logbuffer_prlog(pca9468, ovc_flag ? LOGLEVEL_WARNING : LOGLEVEL_DEBUG,
			"%s: iin=%d, iin_cc=[%d,%d,%d], icn=%d ibat=%d, cc_max=%d rc=%d",
			__func__, iin, iin_low, pca9468->iin_cc, iin_high,
			icn, ibat, pca9468->cc_max, rc);

	if (iin < 0)
		return iin;

	/* Compare IIN ADC with targer input current */
	if (iin > iin_high) {
		/* RX current is higher than the target input current */

		/* Decrease RX voltage (100mV) */
		pca9468->ta_vol = pca9468->ta_vol - WCRX_VOL_STEP;

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont1, rx_vol=%u",
				pca9468->ta_vol);

		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;
	} else if (iin < iin_low) {
		/* RX current is lower than the target input current */

		if (pca9468_check_status(pca9468) == STS_MODE_VFLT_LOOP) {
			/* RX current may not able to increase in CV */
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"End1-1, skip adjust for cv, rx_vol=%u, iin_cc=%u",
					pca9468->ta_vol, pca9468->iin_cc);

			pca9468_return_to_loop(pca9468);
		} else if (pca9468->ta_vol == pca9468->ta_max_vol) {
			/* RX current is already the maximum voltage */
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"End1, rx_vol=%u, iin_cc=%u, chg_mode=%u",
					pca9468->ta_vol, pca9468->iin_cc,
					pca9468->chg_mode);

			/* Return charging state to the previous state */
			pca9468_return_to_loop(pca9468);
		} else {
			/* Increase RX voltage (100mV) */
			pca9468->ta_vol = pca9468->ta_vol + WCRX_VOL_STEP;

			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont2, rx_vol=%u",
					pca9468->ta_vol);

			/* Set RX voltage */
			pca9468->timer_id = TIMER_PDMSG_SEND;
			pca9468->timer_period = 0;
		}
	} else {
		/* IIN ADC is in valid range */

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"End2, rx_vol=%u, iin_cc=%u, chg_mode=%u",
				pca9468->ta_vol, pca9468->iin_cc,
				pca9468->chg_mode);

		/* Return charging state to the previous state */
		pca9468_return_to_loop(pca9468);
	}

	return 0;
}

/*
 * Called from CC and CV loops to set a new IIN (i.e. a new cc_max charging
 * current). Should also change the iin_cfg to avoid overcurrents.
 * NOTE: caller must hold mutex_lock(&pca9468->lock)
 */
static int pca9468_apply_new_iin(struct pca9468_charger *pca9468)
{
	int ret;

	logbuffer_prlog(pca9468, LOGLEVEL_INFO,
			"new_iin=%d (cc_max=%d), ta_type=%d charging_state=%d",
			pca9468->new_iin, pca9468->cc_max,
			pca9468->ta_type, pca9468->charging_state);

	/* iin_cfg is adjusted UP in pca9468_set_input_current() */
	ret = pca9468_set_input_current(pca9468, pca9468->new_iin);
	if (ret < 0)
		return ret;
	pca9468->pdata->iin_cfg = pca9468->new_iin;

	 /*
	  * ->ret_state is used to go back to the loop (CC or CV) that called
	  * this function.
	  */
	pca9468->ret_state = pca9468->charging_state;

	/*
	 * new_iin is used to trigger the process which might span one or more
	 * timer ticks the new_iin . The flag will be cleared once the target
	 * is reached.
	 */
	pca9468->iin_cc = pca9468->new_iin;
	if (pca9468->ta_type == TA_TYPE_WIRELESS) {
		ret = pca9468_adjust_rx_voltage(pca9468);
	} else if (pca9468->iin_cc < (PCA9468_TA_MIN_CUR * pca9468->chg_mode)) {
		/* TA current = PCA9468_TA_MIN_CUR(1.0A) */
		pca9468->ta_cur = PCA9468_TA_MIN_CUR;
		ret = pca9468_adjust_ta_voltage(pca9468);
	} else {
		ret = pca9468_adjust_ta_current(pca9468);
	}

	/* need reschedule on ret != 0 */

	pr_debug("%s: ret=%d\n", __func__, ret);
	return ret;
}

/*
 * also called from pca9468_set_new_cc_max()
 * call holding mutex_unlock(&pca9468->lock);
 */
static int pca9468_set_new_iin(struct pca9468_charger *pca9468, int iin)
{
	int ret = 0;

	if (iin < 0) {
		pr_debug("%s: ignore negative iin=%d\n", __func__, iin);
		return 0;
	}

	/* same as previous request nevermind */
	if (iin == pca9468->new_iin)
		return 0;

	pr_debug("%s: new_iin=%d->%d state=%d\n", __func__,
		 pca9468->new_iin, iin, pca9468->charging_state);

	/* apply iin_cc in pca9468_preset_config() at start */
	if (pca9468->charging_state == DC_STATE_NO_CHARGING ||
	    pca9468->charging_state == DC_STATE_CHECK_VBAT) {

		/* used on start vs the ->iin_cfg one */
		pca9468->pdata->iin_cfg = iin;
		pca9468->iin_cc = iin;
	} else if (pca9468->ret_state == 0) {
		/*
		 * pca9468_apply_new_iin() has not picked out the value yet
		 * and the value can be changed safely.
		 */
		pca9468->new_iin = iin;

		/* might want to tickle the loop now */
	} else {
		/* the caller must retry */
		ret = -EAGAIN;
	}

	pr_debug("%s: ret=%d\n", __func__, ret);
	return ret;
}

/*
 * The is no CC loop in this part: current must be controlled on TA side
 * adjusting output power. cc_max (the charging current) is scaled to iin
 *
 */
static int pca9468_set_new_cc_max(struct pca9468_charger *pca9468, int cc_max)
{
	const int prev_cc_max = pca9468->cc_max;
	int iin_max, ret = 0;

	if (cc_max < 0) {
		pr_debug("%s: ignore negative cc_max=%d\n", __func__, cc_max);
		return 0;
	}

	mutex_lock(&pca9468->lock);

	/* same as previous request nevermind */
	if (cc_max == pca9468->cc_max)
		goto done;

	/* iin will be capped by the adapter capabilities in reset_dcmode() */
	iin_max = pca9468_get_iin_max(pca9468, cc_max);
	if (iin_max <= 0) {
		pr_debug("%s: ignore negative iin_max=%d\n", __func__, iin_max);
		goto done;
	}

	ret = pca9468_set_new_iin(pca9468, iin_max);
	if (ret == 0)
		pca9468->cc_max = cc_max;

	logbuffer_prlog(pca9468, LOGLEVEL_INFO,
			"%s: charging_state=%d cc_max=%d->%d iin_max=%d, ret=%d",
			__func__, pca9468->charging_state, prev_cc_max,
			cc_max, iin_max, ret);

done:
	pr_debug("%s: ret=%d\n", __func__, ret);
	mutex_unlock(&pca9468->lock);
	return ret;
}

/*
 * Apply pca9468->new_vfloat to the charging voltage.
 * Called from CC and CV loops, needs mutex_lock(&pca9468->lock)
 */
static int pca9468_apply_new_vfloat(struct pca9468_charger *pca9468)
{
	int fv_uv, ret = 0;

	/* compensated float voltage, -EINVAL if under pca_vbat */
	fv_uv = pca9468_apply_irdrop(pca9468, pca9468->new_vfloat);
	if (fv_uv < 0)
		return fv_uv;

	if (pca9468->fv_uv == fv_uv)
		goto error_done;

	/* actually change the hardware */
	ret = pca9468_set_vfloat(pca9468, fv_uv);
	if (ret < 0)
		goto error_done;

	pca9468->fv_uv = fv_uv;

error_done:
	logbuffer_prlog(pca9468, LOGLEVEL_INFO,
			"%s: new_vfloat=%d, fv_uv=%d ret=%d", __func__,
			pca9468->new_vfloat, fv_uv, ret);

	if (ret == 0)
		pca9468->new_vfloat = 0;

	return ret;
}

static int pca9468_set_new_vfloat(struct pca9468_charger *pca9468, int vfloat)
{
	int ret = 0;

	if (vfloat < 0) {
		pr_debug("%s: ignore negative vfloat %d\n", __func__, vfloat);
		return 0;
	}

	mutex_lock(&pca9468->lock);
	if (pca9468->new_vfloat == vfloat)
		goto done;

	/* use fv_uv at start in pca9468_preset_config() */
	if (pca9468->charging_state == DC_STATE_NO_CHARGING ||
	    pca9468->charging_state == DC_STATE_CHECK_VBAT) {
		pca9468->fv_uv = vfloat;
	} else {
		/* applied in pca9468_apply_new_vfloat() from CC or in CV loop */
		pca9468->new_vfloat = vfloat;
		pr_debug("%s: new_vfloat=%d\n", __func__, pca9468->new_vfloat);

		/* might want to tickle the cycle */
	}

done:
	mutex_unlock(&pca9468->lock);
	return ret;
}

/* called on loop inactive */
static int pca9468_ajdust_ccmode_wireless(struct pca9468_charger *pca9468, int iin)
{
	/* IIN_ADC > IIN_CC -20mA ? */
	if (iin > (pca9468->iin_cc - PCA9468_IIN_ADC_OFFSET)) {
		/* Input current is already over IIN_CC */
		/* End RX voltage adjustment */

		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_CC_MODE);

		/* change charging state to CC mode */
		pca9468->charging_state = DC_STATE_CC_MODE;

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "End1: IIN_ADC=%d, rx_vol=%u",
				iin, pca9468->ta_vol);

		/* Clear TA increment flag */
		pca9468->prev_inc = INC_NONE;
		/* Go to CC mode */
		pca9468->timer_id = TIMER_CHECK_CCMODE;
		pca9468->timer_period = 0;

	/* Check RX voltage */
	} else if (pca9468->ta_vol == pca9468->ta_max_vol) {
		/* RX voltage is already max value */
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,"End2: MAX value, rx_vol=%u max=%d",
				pca9468->ta_vol, pca9468->ta_max_vol);

		/* Clear TA increment flag */
		pca9468->prev_inc = INC_NONE;
		/* Go to CC mode */
		pca9468->timer_id = TIMER_CHECK_CCMODE;
		pca9468->timer_period = 0;
	} else {
		/* Try to increase RX voltage(100mV) */
		pca9468->ta_vol = pca9468->ta_vol + WCRX_VOL_STEP;
		if (pca9468->ta_vol > pca9468->ta_max_vol)
			pca9468->ta_vol = pca9468->ta_max_vol;

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont: rx_vol=%u",
				pca9468->ta_vol);
		/* Set RX voltage */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;
	}

	return 0;
}

/* called on loop inactive */
static int pca9468_ajdust_ccmode_wired(struct pca9468_charger *pca9468, int iin)
{

	/* USBPD TA is connected */
	if (iin > (pca9468->iin_cc - PCA9468_IIN_ADC_OFFSET)) {
		/* IIN_ADC > IIN_CC -20mA ? */
		/* Input current is already over IIN_CC */
		/* End TA voltage and current adjustment */

		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_CC_MODE);

		/* change charging state to CC mode */
		pca9468->charging_state = DC_STATE_CC_MODE;

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"End1: IIN_ADC=%d, ta_vol=%u, ta_cur=%u",
				iin, pca9468->ta_vol, pca9468->ta_cur);

		/* Clear TA increment flag */
		pca9468->prev_inc = INC_NONE;
		/* Go to CC mode */
		pca9468->timer_id = TIMER_CHECK_CCMODE;
		pca9468->timer_period = 0;

	/* Check TA voltage */
	} else if (pca9468->ta_vol == pca9468->ta_max_vol) {
		/* TA voltage is already max value */
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"End2: MAX value, ta_vol=%u, ta_cur=%u",
				pca9468->ta_vol, pca9468->ta_cur);

		/* Clear TA increment flag */
		pca9468->prev_inc = INC_NONE;
		/* Go to CC mode */
		pca9468->timer_id = TIMER_CHECK_CCMODE;
		pca9468->timer_period = 0;

		/* Check TA tolerance
		 * The current input current compares the final input
		 * current(IIN_CC) with 100mA offset PPS current tolerance
		 * has +/-150mA, so offset defined 100mA(tolerance +50mA)
		 */
	} else if (iin < (pca9468->iin_cc - PCA9468_TA_IIN_OFFSET)) {
		/*
		 * TA voltage too low to enter TA CC mode, so we
		 * should increase TA voltage
		 */
		pca9468->ta_vol = pca9468->ta_vol + PCA9468_TA_VOL_STEP_ADJ_CC *
					pca9468->chg_mode;

		if (pca9468->ta_vol > pca9468->ta_max_vol)
			pca9468->ta_vol = pca9468->ta_max_vol;

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont1: ta_vol=%u",
				pca9468->ta_vol);

		/* Set TA increment flag */
		pca9468->prev_inc = INC_TA_VOL;
		/* Send PD Message */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;

	/* compare IIN ADC with previous IIN ADC + 20mA */
	} else if (iin > (pca9468->prev_iin + PCA9468_IIN_ADC_OFFSET)) {
		/* TA can supply more current if TA voltage is high */
		/* TA voltage too low for TA CC mode: increase it */
		pca9468->ta_vol = pca9468->ta_vol +
					PCA9468_TA_VOL_STEP_ADJ_CC *
					pca9468->chg_mode;
		if (pca9468->ta_vol > pca9468->ta_max_vol)
			pca9468->ta_vol = pca9468->ta_max_vol;

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont2: ta_vol=%u",
				pca9468->ta_vol);
		/* Set TA increment flag */
		pca9468->prev_inc = INC_TA_VOL;

		/* Send PD Message */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;

	/* Check the previous increment */
	} else if (pca9468->prev_inc == INC_TA_CUR) {
		/*
		 * The previous increment is TA current, but input
		 * current does not increase. Try with voltage.
		 */

		pca9468->ta_vol = pca9468->ta_vol +
					PCA9468_TA_VOL_STEP_ADJ_CC *
					pca9468->chg_mode;
		if (pca9468->ta_vol > pca9468->ta_max_vol)
			pca9468->ta_vol = pca9468->ta_max_vol;

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont3: ta_vol=%u",
				pca9468->ta_vol);

		pca9468->prev_inc = INC_TA_VOL;
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;

		/*
		 * The previous increment is TA voltage, but input
		 * current does not increase
		 */

		/* Try to increase TA current */
		/* Check APDO max current */
	} else if (pca9468->ta_cur == pca9468->ta_max_cur) {
		/* TA current is maximum current */

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"End(MAX_CUR): IIN_ADC=%d, ta_vol=%u, ta_cur=%u",
				iin, pca9468->ta_vol, pca9468->ta_cur);

		pca9468->prev_inc = INC_NONE;

		/* Go to CC mode */
		pca9468->timer_id = TIMER_CHECK_CCMODE;
		pca9468->timer_period = 0;
	} else {
		/* TA has tolerance and compensate it as real current */
		/* Increase TA current(50mA) */
		pca9468->ta_cur = pca9468->ta_cur + PD_MSG_TA_CUR_STEP;
		if (pca9468->ta_cur > pca9468->ta_max_cur)
			pca9468->ta_cur = pca9468->ta_max_cur;

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "Cont4: ta_cur=%u",
				pca9468->ta_cur);

		pca9468->prev_inc = INC_TA_CUR;
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;
	}

	return 0;
}


/* 2:1 Direct Charging Adjust CC MODE control
 * called at the beginnig of CC mode charging. Will be followed by
 * pca9468_charge_ccmode with wich share some of the adjustments.
 */
static int pca9468_charge_adjust_ccmode(struct pca9468_charger *pca9468)
{
	int  iin, ccmode, vbatt, vin_vol;
	bool apply_ircomp = false;
	int ret = 0;

	mutex_lock(&pca9468->lock);

	pr_debug("%s: ======START=======\n", __func__);
	pca9468_prlog_state(pca9468, __func__);

	if (pca9468->charging_state != DC_STATE_ADJUST_CC)
		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_ADJUST_CC);

	pca9468->charging_state = DC_STATE_ADJUST_CC;

	ret = pca9468_check_error(pca9468);
	if (ret != 0)
		goto error; // This is not active mode.

	ccmode = pca9468_check_status(pca9468);
	if (ccmode < 0) {
		ret = ccmode;
		goto error;
	}

	switch(ccmode) {
	case STS_MODE_IIN_LOOP:
		pca9468->chg_data.iin_loop_count++;
	case STS_MODE_CHG_LOOP:	/* CHG_LOOP does't exist */
		apply_ircomp = true;

		if (pca9468->ta_type == TA_TYPE_WIRELESS) {
			/* Decrease RX voltage (100mV) */
			pca9468->ta_vol = pca9468->ta_vol - WCRX_VOL_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "End1: rx_vol=%u",
					 pca9468->ta_vol);
		} else if (pca9468->ta_cur > PCA9468_TA_MIN_CUR) {
			/* TA current is higher than 1.0A */
			/* Decrease TA current (50mA) */
			pca9468->ta_cur = pca9468->ta_cur - PD_MSG_TA_CUR_STEP;

			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "End2: ta_cur=%u, ta_vol=%u",
					pca9468->ta_cur, pca9468->ta_vol);
		} else {
			/* Decrease TA voltage (20mV) */
			pca9468->ta_vol = pca9468->ta_vol - PD_MSG_TA_VOL_STEP;

			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "End3: ta_cur=%u, ta_vol=%u",
					pca9468->ta_cur, pca9468->ta_vol);
		}

		pca9468->prev_inc = INC_NONE;

		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_CC_MODE);

		/* Send PD Message and then go to CC mode */
		pca9468->charging_state = DC_STATE_CC_MODE;
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;
		break;

	case STS_MODE_VFLT_LOOP:
		vbatt = pca9468_read_adc(pca9468, ADCCH_VBAT);

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "End4: vbatt=%d, ta_vol=%u",
				vbatt, pca9468->ta_vol);

		/* Clear TA increment flag */
		pca9468->prev_inc = INC_NONE;
		/* Go to Pre-CV mode */
		pca9468->timer_id = TIMER_ENTER_CVMODE;
		pca9468->timer_period = 0;
		break;

	case STS_MODE_LOOP_INACTIVE:

		iin = pca9468_read_adc(pca9468, ADCCH_IIN);
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"Inactive: iin=%d, iin_cc=%d, cc_max=%d",
				iin, pca9468->iin_cc, pca9468->cc_max);
		if (iin < 0)
			break;

		if (pca9468->ta_type == TA_TYPE_WIRELESS) {
			ret = pca9468_ajdust_ccmode_wireless(pca9468, iin);
		} else {
			ret = pca9468_ajdust_ccmode_wired(pca9468, iin);
		}

		if (ret < 0) {
			pr_err("%s: %d", __func__, ret);
		} else {
			pca9468->prev_iin = iin;
			apply_ircomp = true;
		}

		break;

	case STS_MODE_VIN_UVLO:
		/* VIN UVLO - just notification , it works by hardware */
		vin_vol = pca9468_read_adc(pca9468, ADCCH_VIN);

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "VIN_UVLO: ta_vol=%u, vin_vol=%d",
				pca9468->ta_cur, vin_vol);

		/* Check VIN after 1sec */
		pca9468->timer_id = TIMER_ADJUST_CCMODE;
		pca9468->timer_period = 1000;
		break;

	default:
		goto error;
	}

	if (pca9468->pdata->pca_irdrop && apply_ircomp) {
		int rc;

		rc = pca9468_comp_irdrop(pca9468);
		if (rc < 0)
			pr_err("%s: cannot apply ircomp (%d)\n",
			       __func__, rc);
	}

	mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
			 msecs_to_jiffies(pca9468->timer_period));
error:
	mutex_unlock(&pca9468->lock);
	pr_debug("%s: End, ret=%d\n", __func__, ret);
	return ret;
}

/* <0 error, 0 no new limits, >0 new limits */
static int pca9468_apply_new_limits(struct pca9468_charger *pca9468)
{
	int ret = 0;

	if (pca9468->new_iin && pca9468->new_iin < pca9468->iin_cc) {
		ret = pca9468_apply_new_iin(pca9468);
		if (ret == 0)
			ret = 1;
	} else if (pca9468->new_vfloat) {
		ret = pca9468_apply_new_vfloat(pca9468);
		if (ret == 0)
			ret = 1;
	} else if (pca9468->new_iin) {
		ret = pca9468_apply_new_iin(pca9468);
		if (ret == 0)
			ret = 1;
	} else {
		return 0;
	}

	return ret;
}

/* 2:1 Direct Charging CC MODE control */
static int pca9468_charge_ccmode(struct pca9468_charger *pca9468)
{
	int ccmode, vin_vol, iin, ret = 0;
	bool apply_ircomp = false;

	pr_debug("%s: ======START======= \n", __func__);

	mutex_lock(&pca9468->lock);

	if (pca9468->charging_state != DC_STATE_CC_MODE)
		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_CC_MODE);

	pca9468->charging_state = DC_STATE_CC_MODE;

	pca9468_prlog_state(pca9468, __func__);

	ret = pca9468_check_error(pca9468);
	if (ret != 0)
		goto error_exit;

	/*
	 * A change in VFLOAT here means that we have busted the tier, a
	 * change in iin means that the thermal engine had changed cc_max.
	 * pca9468_apply_new_limits() changes pca9468->charging_state to
	 * DC_STATE_ADJUST_TAVOL or DC_STATE_ADJUST_TACUR when new limits
	 * need to be applied.
	 */
	ret = pca9468_apply_new_limits(pca9468);
	if (ret < 0)
		goto error_exit;
	if (ret > 0)
		goto done;

	ccmode = pca9468_check_status(pca9468);
	if (ccmode < 0) {
		ret = ccmode;
		goto error_exit;
	}

	switch(ccmode) {
	case STS_MODE_LOOP_INACTIVE:

		/* Set input current compensation */
		if (pca9468->ta_type == TA_TYPE_WIRELESS) {
			/* Need RX voltage compensation */
			ret = pca9468_set_rx_voltage_comp(pca9468);

			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "INACTIVE1: rx_vol=%u",
					pca9468->ta_vol);
		} else {
			const int ta_max_vol = pca9468->ta_max_vol;

			/* Check TA current with TA_MIN_CUR */
			if (pca9468->ta_cur <= PCA9468_TA_MIN_CUR) {
				pca9468->ta_cur = PCA9468_TA_MIN_CUR;

				ret = pca9468_set_ta_voltage_comp(pca9468);
			} else if (ta_max_vol >= pca9468->pdata->ta_max_vol_cp) {
				ret = pca9468_set_ta_current_comp(pca9468);
			} else {
				/* constant power mode */
				ret = pca9468_set_ta_current_comp2(pca9468);
			}

			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"INACTIVE2: ta_cur=%u, ta_vol=%u",
					pca9468->ta_cur,
					pca9468->ta_vol);
		}

		if (ret == 0)
			apply_ircomp = true;
		break;

	case STS_MODE_VFLT_LOOP:
		/* TODO: adjust fv_uv here based on real vbatt */

		iin = pca9468_read_adc(pca9468, ADCCH_IIN);
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG, "CC VFLOAT: iin=%d", iin);

		/* go to Pre-CV mode */
		pca9468->timer_id = TIMER_ENTER_CVMODE;
		pca9468->timer_period = 0;
		break;

	case STS_MODE_IIN_LOOP:
		pca9468->chg_data.iin_loop_count++;
	case STS_MODE_CHG_LOOP:
		iin = pca9468_read_adc(pca9468, ADCCH_IIN);
		if (iin < 0)
			break;

		if (pca9468->ta_type == TA_TYPE_WIRELESS) {
			/* Decrease RX voltage (100mV) */
			pca9468->ta_vol = pca9468->ta_vol - WCRX_VOL_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"IIN_LOOP1: iin=%d, next_rx_vol=%u",
					iin, pca9468->ta_vol);
		} else if (pca9468->ta_cur <= PCA9468_TA_MIN_CUR) {
			/* Decrease TA voltage (20mV) */
			pca9468->ta_vol = pca9468->ta_vol - PD_MSG_TA_VOL_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"IIN_LOOP2: iin=%d, next_ta_vol=%u",
					iin, pca9468->ta_vol);
		} else {
			/* Decrease TA current (50mA) */
			pca9468->ta_cur = pca9468->ta_cur - PD_MSG_TA_CUR_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"IIN_LOOP3: iin=%d, next_ta_cur=%u",
					iin, pca9468->ta_cur);
		}

		/* Send PD Message */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;
		break;

	case STS_MODE_VIN_UVLO:
		/* VIN UVLO - just notification, it works by hardware */
		vin_vol = pca9468_read_adc(pca9468, ADCCH_VIN);

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"VIN_UVLO: ta_cur=%u ta_vol=%u, vin_vol=%d",
				pca9468->ta_cur, pca9468->ta_vol, vin_vol);

		/* Check VIN after 1sec */
		pca9468->timer_id = TIMER_CHECK_CCMODE;
		pca9468->timer_period = 1000;
		break;

	default:
		break;
	}

	if (pca9468->pdata->pca_irdrop && apply_ircomp) {
		int rc;

		rc = pca9468_comp_irdrop(pca9468);
		if (rc < 0)
			pr_err("%s: cannot apply ircomp (%d)\n",
			       __func__, rc);
	}

done:
	mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
			 msecs_to_jiffies(pca9468->timer_period));

error_exit:
	mutex_unlock(&pca9468->lock);
	pr_debug("%s: End, ccmode=%d timer_id=%d, timer_period=%lu ret=%d\n",
		 __func__, ccmode, pca9468->timer_id, pca9468->timer_period,
		 ret);
	return ret;
}


/* 2:1 Direct Charging Start CV MODE control - Pre CV MODE */
static int pca9468_charge_start_cvmode(struct pca9468_charger *pca9468)
{
	int ret = 0;
	int cvmode;
	int vin_vol;

	pr_debug("%s: ======START=======\n", __func__);

	mutex_lock(&pca9468->lock);

	if (pca9468->charging_state != DC_STATE_START_CV)
		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_START_CV);

	pca9468->charging_state = DC_STATE_START_CV;

	/* Check the charging type */
	ret = pca9468_check_error(pca9468);
	if (ret != 0)
		goto error_exit;

	/* Check the status */
	cvmode = pca9468_check_status(pca9468);
	if (cvmode < 0) {
		ret = cvmode;
		goto error_exit;
	}

	switch(cvmode) {
	case STS_MODE_IIN_LOOP:
		pca9468->chg_data.iin_loop_count++;
	case STS_MODE_CHG_LOOP:

		if (pca9468->ta_type == TA_TYPE_WIRELESS) {
			/* Decrease RX voltage (100mV) */
			pca9468->ta_vol = pca9468->ta_vol - WCRX_VOL_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"%s: PreCV IIN_LOOP: rx_vol=%u",
				 __func__, pca9468->ta_vol);
		} else {
			/* Check TA current */
			if (pca9468->ta_cur > PCA9468_TA_MIN_CUR) {
				/* TA current is higher than 1.0A */

				/* Decrease TA current (50mA) */
				pca9468->ta_cur = pca9468->ta_cur - PD_MSG_TA_CUR_STEP;
				logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
						"%s: PreCV IIN_LOOP: ta_cur=%u",
						__func__, pca9468->ta_cur);
			} else {
				/* TA current is less than 1.0A */
				/* Decrease TA voltage (20mV) */
				pca9468->ta_vol = pca9468->ta_vol - PD_MSG_TA_VOL_STEP;
				logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
						"%s: PreCV IIN_LOOP: ta_vol=%u",
						__func__, pca9468->ta_vol);
			}
		}

		/* Send PD Message */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;
		break;

	case STS_MODE_VFLT_LOOP:
		/* Check the TA type */
		if (pca9468->ta_type == TA_TYPE_WIRELESS) {
			/* Decrease RX voltage (100mV) */
			pca9468->ta_vol = pca9468->ta_vol - WCRX_VOL_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"%s: PreCV VF Cont: rx_vol=%u",
					__func__, pca9468->ta_vol);
		} else {
			/* Decrease TA voltage (20mV) */
			pca9468->ta_vol = pca9468->ta_vol -
					  PCA9468_TA_VOL_STEP_PRE_CV *
					  pca9468->chg_mode;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"%s: PreCV VF Cont: ta_vol=%u",
					__func__, pca9468->ta_vol);
		}

		/* Send PD Message */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;
		break;

	case STS_MODE_LOOP_INACTIVE:
		/* Exit Pre CV mode */
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"%s: PreCV End: ta_vol=%u, ta_cur=%u",
				__func__, pca9468->ta_vol, pca9468->ta_cur);

		/* Need to implement notification to other driver */
		/* To do here */

		/* Go to CV mode */
		pca9468->timer_id = TIMER_CHECK_CVMODE;
		pca9468->timer_period = 0;
		break;

	case STS_MODE_VIN_UVLO:
		/* VIN UVLO - just notification , it works by hardware */
		vin_vol = pca9468_read_adc(pca9468, ADCCH_VIN);

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"%s: PreCV VIN_UVLO: ta_vol=%u, vin_vol=%u",
				__func__, pca9468->ta_cur, vin_vol);

		/* Check VIN after 1sec */
		pca9468->timer_id = TIMER_ENTER_CVMODE;
		pca9468->timer_period = 1000;
		break;

	default:
		break;
	}

	mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
			 msecs_to_jiffies(pca9468->timer_period));
error_exit:
	mutex_unlock(&pca9468->lock);
	pr_debug("%s: End, ret=%d\n", __func__, ret);
	return ret;
}

static int pca9468_check_eoc(struct pca9468_charger *pca9468)
{
	const int eoc_tolerance = 25000; /* 25mV under max float voltage */
	const int vlimit = PCA9468_COMP_VFLOAT_MAX - eoc_tolerance;
	int iin, vbat;

	iin = pca9468_read_adc(pca9468, ADCCH_IIN);
	if (iin < 0) {
		pr_err("%s: iin=%d\n", __func__, iin);
		return iin;
	}

	vbat = pca9468_read_adc(pca9468, ADCCH_VBAT);
	if (vbat < 0) {
		pr_err("%s: vbat=%d\n", __func__, vbat);
		return vbat;
	}

	pr_debug("%s: iin=%d, topoff=%u, vbat=%d vlimit=%d\n", __func__,
		 iin, pca9468->pdata->iin_topoff,
		 vbat, vlimit);

	return iin < pca9468->pdata->iin_topoff && vbat >= vlimit;
}

/* 2:1 Direct Charging CV MODE control */
static int pca9468_charge_cvmode(struct pca9468_charger *pca9468)
{
	int ret = 0;
	int cvmode;
	int vin_vol;

	pr_debug("%s: ======START=======\n", __func__);

	mutex_lock(&pca9468->lock);

	if (pca9468->charging_state != DC_STATE_CV_MODE)
		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_CV_MODE);

	pca9468->charging_state = DC_STATE_CV_MODE;

	ret = pca9468_check_error(pca9468);
	if (ret != 0)
		goto error_exit;

	/*
	 * A change in vfloat and cc_max here is a normal tier transition, a
	 * change in iin  means that the thermal engine has changed cc_max.
	 */
	ret = pca9468_apply_new_limits(pca9468);
	if (ret < 0)
		goto error_exit;
	if (ret > 0)
		goto done;

	cvmode = pca9468_check_status(pca9468);
	if (cvmode < 0) {
		ret = cvmode;
		goto error_exit;
	}

	if (cvmode == STS_MODE_LOOP_INACTIVE) {
		ret = pca9468_check_eoc(pca9468);
		if (ret < 0)
			goto error_exit;
		if (ret)
			cvmode = STS_MODE_CHG_DONE;
	}

	switch(cvmode) {
	case STS_MODE_CHG_DONE: {
		const bool done_already = pca9468->charging_state ==
					  DC_STATE_CHARGING_DONE;

		if (!done_already)
			dev_info(pca9468->dev, "%s: charging_state=%u->%u\n",
				 __func__, pca9468->charging_state,
				 DC_STATE_CHARGING_DONE);


		/* Keep CV mode until driver send stop charging */
		pca9468->charging_state = DC_STATE_CHARGING_DONE;
		power_supply_changed(pca9468->mains);

		/* _cpm already came in */
		if (pca9468->charging_state == DC_STATE_NO_CHARGING) {
			pr_debug("%s: Already stop DC\n", __func__);
			break;
		}

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"%s: done_already=%d charge Done\n", __func__,
				done_already);

		pca9468->timer_id = TIMER_CHECK_CVMODE;
		pca9468->timer_period = PCA9468_CVMODE_CHECK_T;
	} break;

	case STS_MODE_IIN_LOOP:
		pca9468->chg_data.iin_loop_count++;
	case STS_MODE_CHG_LOOP:
		/* Check the TA type */
		if (pca9468->ta_type == TA_TYPE_WIRELESS) {
			/* Decrease RX Voltage (100mV) */
			pca9468->ta_vol = pca9468->ta_vol -
						WCRX_VOL_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"%s: CV LOOP, Cont: rx_vol=%u",
					__func__, pca9468->ta_vol);

		/* Check TA current */
		} else if (pca9468->ta_cur > PCA9468_TA_MIN_CUR) {
			/* TA current is higher than (1.0A*chg_mode) */
			/* Decrease TA current (50mA) */
			pca9468->ta_cur = pca9468->ta_cur -
						PD_MSG_TA_CUR_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"%s: CV LOOP, Cont: ta_cur=%u",
					__func__, pca9468->ta_cur);
		} else {
			/* TA current is less than (1.0A*chg_mode) */
			/* Decrease TA Voltage (20mV) */
			pca9468->ta_vol = pca9468->ta_vol -
						PD_MSG_TA_VOL_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"%s: CV LOOP, Cont: ta_vol=%u",
					__func__, pca9468->ta_vol);
		}

		/* Send PD Message */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;
		break;

	case STS_MODE_VFLT_LOOP:
		/* Check the TA type */
		if (pca9468->ta_type == TA_TYPE_WIRELESS) {
			/* Decrease RX voltage */
			pca9468->ta_vol = pca9468->ta_vol -
						WCRX_VOL_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"%s: CV VFLOAT, Cont: rx_vol=%u",
					__func__, pca9468->ta_vol);
		} else {
			/* Decrease TA voltage */
			pca9468->ta_vol = pca9468->ta_vol -
						PD_MSG_TA_VOL_STEP;
			logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
					"%s: CV VFLOAT, Cont: ta_vol=%u",
					__func__, pca9468->ta_vol);
		}

		/* Send PD Message */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;
		break;

	case STS_MODE_LOOP_INACTIVE:
		pca9468->timer_id = TIMER_CHECK_CVMODE;
		pca9468->timer_period = PCA9468_CVMODE_CHECK_T;
		break;

	case STS_MODE_VIN_UVLO:
		/* VIN UVLO - just notification, it works by hardware */
		vin_vol = pca9468_read_adc(pca9468, ADCCH_VIN);
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"%s: CC VIN_UVLO: ta_cur=%u ta_vol=%u, vin_vol=%d",
				__func__, pca9468->ta_cur, pca9468->ta_vol,
				vin_vol);

		/* Check VIN after 1sec */
		pca9468->timer_id = TIMER_CHECK_CVMODE;
		pca9468->timer_period = 1000;
		break;

	default:
		break;
	}

done:
	pr_debug("%s: reschedule next id=%d period=%ld chg_state=%d\n",
		 __func__, pca9468->timer_id, pca9468->timer_period,
		pca9468->charging_state);

	mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
			 msecs_to_jiffies(pca9468->timer_period));
error_exit:
	mutex_unlock(&pca9468->lock);
	pr_debug("%s: End, ret=%d next\n", __func__, ret);
	return ret;
}

/*
 * Preset TA voltage and current for Direct Charging Mode using
 * the configured cc_max and fv_uv limits. Used only on start
 */
static int pca9468_preset_dcmode(struct pca9468_charger *pca9468)
{
	int vbat;
	int ret = 0;

	pr_debug("%s: ======START=======\n", __func__);
	pr_debug("%s: = charging_state=%u == \n", __func__,
		 pca9468->charging_state);

	/* gcpm set ->cc_max and ->fv_uv before starting */
	if (pca9468->cc_max < 0 || pca9468->fv_uv < 0) {
		pr_err("%s: cc_max=%d fv_uv=%d invalid\n", __func__,
		       pca9468->cc_max, pca9468->fv_uv);
		return -EINVAL;
	}

	if (pca9468->charging_state != DC_STATE_PRESET_DC)
		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_PRESET_DC);

	pca9468->charging_state = DC_STATE_PRESET_DC;

	/* VBAT is over threshold but it might be "bouncy" due to transitory */
	vbat = pca9468_read_adc(pca9468, ADCCH_VBAT);
	if (vbat < 0) {
		ret = vbat;
		goto error;
	}

	/* v_float is set on start from GCPM */
	if (vbat > pca9468->fv_uv) {
		pr_err("%s: vbat adc=%d is higher than VFLOAT=%d\n", __func__,
			vbat, pca9468->fv_uv);
		ret = -EINVAL;
		goto error;
	}

	/* determined by ->cfg_iin and cc_max */
	pca9468->ta_max_cur = pca9468_get_iin_max(pca9468, pca9468->cc_max);
	pr_debug("%s: ta_max_cur=%u, iin_cfg=%u, pca9468->ta_type=%d\n",
		 __func__, pca9468->ta_max_cur, pca9468->pdata->iin_cfg,
		 pca9468->ta_type);

	/* Check the TA type and set the charging mode */
	if (pca9468->ta_type == TA_TYPE_WIRELESS) {
		/*
		 * Set the RX max voltage to enough high value to find RX
		 * maximum voltage initially
		 */
		pca9468->ta_max_vol = PCA9468_WCRX_MAX_VOL * pca9468->chg_mode;

		/* Get the RX max current/voltage(RX_MAX_CUR/VOL) */
		ret = pca9468_get_rx_max_power(pca9468);
		if (ret < 0) {
			pr_err("%s: no RX voltage to support 4:1 (%d)\n", __func__, ret);
			pca9468->chg_mode = CHG_NO_DC_MODE;
			goto error;
		}

		ret = pca9468_set_wireless_dc(pca9468, vbat);
		if (ret < 0) {
			pr_err("%s: set wired failed (%d)\n", __func__, ret);
			pca9468->chg_mode = CHG_NO_DC_MODE;
			goto error;
		}

		logbuffer_prlog(pca9468, LOGLEVEL_INFO,
				"Preset DC, rx_max_vol=%u, rx_max_cur=%u, rx_max_pwr=%lu, iin_cc=%u, chg_mode=%u",
				pca9468->ta_max_vol, pca9468->ta_max_cur, pca9468->ta_max_pwr,
				pca9468->iin_cc, pca9468->chg_mode);
	} else {
		const unsigned int ta_max_vol = pca9468->pdata->ta_max_vol * pca9468->chg_mode;

		/*
		 * Get the APDO max for 2:1 mode.
		 * Returns ->ta_max_vol, ->ta_max_cur, ->ta_max_pwr and
		 * ->ta_objpos for the given ta_max_vol and ta_max_cur.
		 */
		ret = pca9468_get_apdo_max_power(pca9468, ta_max_vol, PCA9468_TA_MAX_CUR);
		if (ret < 0) {
			pr_warn("%s: No APDO to support 2:1 for %d\n", __func__,
				PCA9468_TA_MAX_CUR);
			ret = pca9468_get_apdo_max_power(pca9468, ta_max_vol, 0);
		}

		if (ret < 0) {
			int ret1;

			pr_err("%s: No APDO to support 2:1\n", __func__);
			pca9468->chg_mode = CHG_NO_DC_MODE;

			if (!pca9468->dc_avail)
				pca9468->dc_avail =
					gvotable_election_get_handle(VOTABLE_DC_CHG_AVAIL);

			if (pca9468->dc_avail) {
				ret1 = gvotable_cast_int_vote(pca9468->dc_avail,
							      REASON_DC_DRV, 0, 1);
				if (ret1 < 0)
					dev_err(pca9468->dev,
						"Unable to cast vote for DC Chg avail (%d)\n",
						ret1);
			}
			goto error;
		}

		/*
		 * ->ta_max_cur is too high for startup, needs to target
		 * CC before hitting max current AND work to ta_max_cur
		 * from there.
		 */
		ret = pca9468_set_wired_dc(pca9468, vbat);
		if (ret < 0) {
			pr_err("%s: set wired failed (%d)\n", __func__, ret);
			pca9468->chg_mode = CHG_NO_DC_MODE;
			goto error;
		}

		logbuffer_prlog(pca9468, LOGLEVEL_INFO,
				"Preset DC, objpos=%d ta_max_vol=%u, ta_max_cur=%u, ta_max_pwr=%lu, iin_cc=%u, chg_mode=%u",
				pca9468->ta_objpos, pca9468->ta_max_vol, pca9468->ta_max_cur,
				pca9468->ta_max_pwr, pca9468->iin_cc, pca9468->chg_mode);

	}

error:
	pr_debug("%s: End, ret=%d\n", __func__, ret);
	return ret;
}

/* Preset direct charging configuration and start charging */
static int pca9468_preset_config(struct pca9468_charger *pca9468)
{
	int ret = 0;

	pr_debug("%s: ======START=======\n", __func__);

	mutex_lock(&pca9468->lock);

	dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			pca9468->charging_state, DC_STATE_PRESET_DC);

	pca9468->charging_state = DC_STATE_PRESET_DC;

	/* ->iin_cc and ->fv_uv are configured externally */
	ret = pca9468_set_input_current(pca9468, pca9468->pdata->iin_cfg);
	if (ret < 0)
		goto error;

	ret = pca9468_set_vfloat(pca9468, pca9468->fv_uv);
	if (ret < 0)
		goto error;

	/* Enable PCA9468 unless aready enabled */
	ret = pca9468_set_charging(pca9468, true);
	if (ret < 0)
		goto error;

	/* Clear previous iin adc */
	pca9468->prev_iin = 0;
	pca9468->prev_inc = INC_NONE;

	/* Go to CHECK_ACTIVE state after 150ms, 300ms for wireless */
	pca9468->timer_id = TIMER_CHECK_ACTIVE;
	if (pca9468->ta_type == TA_TYPE_WIRELESS)
		pca9468->timer_period = PCA9468_ENABLE_WLC_DELAY_T;
	else
		pca9468->timer_period = PCA9468_ENABLE_DELAY_T;
	mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
			   msecs_to_jiffies(pca9468->timer_period));
error:
	mutex_unlock(&pca9468->lock);
	pr_debug("%s: End, ret=%d\n", __func__, ret);
	return ret;
}

/*
 * Check the charging status at start before entering the adjust cc mode or
 * from pca9468_send_message() after a failure.
 */
static int pca9468_check_active_state(struct pca9468_charger *pca9468)
{
	int ret = 0;

	pr_debug("%s: ======START=======\n", __func__);
	pr_debug("%s: = charging_state=%u == \n", __func__,
		 pca9468->charging_state);

	mutex_lock(&pca9468->lock);

	if (pca9468->charging_state != DC_STATE_CHECK_ACTIVE)
		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_CHECK_ACTIVE);

	pca9468->charging_state = DC_STATE_CHECK_ACTIVE;

	ret = pca9468_check_error(pca9468);
	if (ret == 0) {
		/* PCA9468 is active state */
		pca9468->retry_cnt = 0;
		pca9468->timer_id = TIMER_ADJUST_CCMODE;
		pca9468->timer_period = 0;
	} else if (ret == -EAGAIN) {

		/* try restarting only */
		if (pca9468->retry_cnt >= PCA9468_MAX_RETRY_CNT) {
			pr_err("%s: retry failed\n", __func__);
			ret = -EINVAL;
			goto exit_done;
		}

		/*
		 * Disable charging to retry enabling it later, return 0 here
		 * and the timer loop will figure out that there is something
		 * wrong and will retry.
		 */
		ret = pca9468_set_charging(pca9468, false);
		pr_err("%s: retry cnt=%d, (%d)\n", __func__,
		       pca9468->retry_cnt, ret);
		if (ret == 0) {
			pca9468->timer_id = TIMER_PRESET_DC;
			pca9468->timer_period = 0;
			pca9468->retry_cnt++;
		}
	}

exit_done:

	/* Implement error handler function if it is needed */
	if (ret < 0) {
		logbuffer_prlog(pca9468, LOGLEVEL_ERR,
				"%s: charging_state=%d, not active or error (%d)",
				__func__, pca9468->charging_state, ret);
		pca9468->timer_id = TIMER_ID_NONE;
		pca9468->timer_period = 0;
	}

	mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
			 msecs_to_jiffies(pca9468->timer_period));
	mutex_unlock(&pca9468->lock);
	return ret;
}

/* Enter direct charging algorithm */
static int pca9468_start_direct_charging(struct pca9468_charger *pca9468)
{
	struct p9468_chg_stats *chg_data = &pca9468->chg_data;
	unsigned int val;
	int ret;

	pr_debug("%s: =========START=========\n", __func__);
	mutex_lock(&pca9468->lock);

	/* Set OV_DELTA to 40% */
	val = OV_DELTA_40P << MASK2SHIFT(PCA9468_BIT_OV_DELTA);
	ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_SAFETY_CTRL,
				 PCA9468_BIT_OV_DELTA, val);
	if (ret < 0)
		goto error_done;

	/* Set Switching Frequency */
	val = pca9468->pdata->fsw_cfg;
	ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_START_CTRL,
				 PCA9468_BIT_FSW_CFG, val);
	if (ret < 0)
		goto error_done;

	/* Set NTC voltage threshold */
	val = pca9468->pdata->ntc_th / PCA9468_NTC_TH_STEP;
	ret = regmap_write(pca9468->regmap, PCA9468_REG_NTC_TH_1, (val & 0xFF));
	if (ret < 0)
		goto error_done;
	ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_NTC_TH_2,
				 PCA9468_BIT_NTC_THRESHOLD9_8, (val >> 8));
	if (ret < 0)
		goto error_done;

	/* configure DC charging type for the requested index */
	ret = pca9468_set_ta_type(pca9468, pca9468->pps_index);
	pr_info("%s: Current ta_type=%d, chg_mode=%d\n", __func__,
		pca9468->ta_type, pca9468->chg_mode);
	if (ret < 0)
		goto error_done;

	/* wake lock */
	__pm_stay_awake(pca9468->monitor_wake_lock);

	/* Preset charging configuration and TA condition */
	ret = pca9468_preset_dcmode(pca9468);
	if (ret == 0) {
		/* Configure the TA  and start charging */
		pca9468->timer_id = TIMER_PDMSG_SEND;
		pca9468->timer_period = 0;

		mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
				 msecs_to_jiffies(pca9468->timer_period));
	}

error_done:
	pr_debug("%s: End, ret=%d\n", __func__, ret);

	p9468_chg_stats_update(chg_data, pca9468);
	mutex_unlock(&pca9468->lock);
	return ret;
}

/* Check Vbat minimum level to start direct charging */
static int pca9468_check_vbatmin(struct pca9468_charger *pca9468)
{
	int ret = 0, vbat;

	pr_debug("%s: =========START=========\n", __func__);

	mutex_lock(&pca9468->lock);

	if (pca9468->charging_state != DC_STATE_CHECK_VBAT)
		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_CHECK_VBAT);

	pca9468->charging_state = DC_STATE_CHECK_VBAT;

	vbat = pca9468_read_adc(pca9468, ADCCH_VBAT);
	if (vbat < 0) {
		ret = vbat;
		goto error;
	}

	/* wait for CPM to send in the params */
	if (pca9468->cc_max < 0 || pca9468->fv_uv < 0) {
		pr_debug("%s: not yet fv_uv=%d, cc_max=%d vbat=%d\n", __func__,
			pca9468->fv_uv, pca9468->cc_max, vbat);

		/* retry again after 1sec */
		pca9468->timer_id = TIMER_VBATMIN_CHECK;
		pca9468->timer_period = PCA9468_VBATMIN_CHECK_T;
		pca9468->retry_cnt += 1;
	} else {
		logbuffer_prlog(pca9468, LOGLEVEL_INFO,
				"%s: starts at fv_uv=%d, cc_max=%d vbat=%d (min=%d)",
				__func__, pca9468->fv_uv, pca9468->cc_max, vbat,
				PCA9468_DC_VBAT_MIN);

		pca9468->timer_id = TIMER_PRESET_DC;
		pca9468->timer_period = 0;
		pca9468->retry_cnt = 0; /* start charging */
	}

	/* timeout for VBATMIN or charging parameters */
	if (pca9468->retry_cnt > PCA9468_MAX_RETRY_CNT) {
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"%s: TIMEOUT fv_uv=%d, cc_max=%d vbat=%d limit=%d",
				__func__, pca9468->fv_uv, pca9468->cc_max, vbat,
				PCA9468_DC_VBAT_MIN);
		ret = -ETIMEDOUT;
	} else {
		mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
				 msecs_to_jiffies(pca9468->timer_period));
	}


error:
	mutex_unlock(&pca9468->lock);
	pr_debug("%s: End, ret=%d\n", __func__, ret);
	return ret;
}

static int pca9468_send_message(struct pca9468_charger *pca9468)
{
	int val, ret;
	const int timer_id = pca9468->timer_id;

	/* Go to the next state */
	mutex_lock(&pca9468->lock);

	pr_debug("%s: ====== START ======= \n", __func__);

	/* Adjust TA current and voltage step */
	if (pca9468->ta_type == TA_TYPE_WIRELESS) {
		/* RX voltage resolution is 100mV */
		val = pca9468->ta_vol / WCRX_VOL_STEP;
		pca9468->ta_vol = val * WCRX_VOL_STEP;

		/* Set RX voltage */
		pr_debug("%s: ta_type=%d, ta_vol=%d\n", __func__,
			 pca9468->ta_type, pca9468->ta_vol);
		ret = pca9468_send_rx_voltage(pca9468, WCRX_REQUEST_VOLTAGE);
	} else {
		/* PPS voltage resolution is 20mV */
		val = pca9468->ta_vol / PD_MSG_TA_VOL_STEP;
		pca9468->ta_vol = val * PD_MSG_TA_VOL_STEP;
		/* PPS current resolution is 50mA */
		val = pca9468->ta_cur / PD_MSG_TA_CUR_STEP;
		pca9468->ta_cur = val * PD_MSG_TA_CUR_STEP;
		/* PPS minimum current is 1000mA */
		if (pca9468->ta_cur < PCA9468_TA_MIN_CUR)
			pca9468->ta_cur = PCA9468_TA_MIN_CUR;

		pr_debug("%s: ta_type=%d, ta_vol=%d ta_cur=%d\n", __func__,
			 pca9468->ta_type, pca9468->ta_vol, pca9468->ta_cur);

		/* Send PD Message */
		ret = pca9468_send_pd_message(pca9468, PD_MSG_REQUEST_APDO);
	}

	switch (pca9468->charging_state) {
	case DC_STATE_PRESET_DC:
		pca9468->timer_id = TIMER_PRESET_CONFIG;
		break;
	case DC_STATE_ADJUST_CC:
		pca9468->timer_id = TIMER_ADJUST_CCMODE;
		break;
	case DC_STATE_CC_MODE:
		pca9468->timer_id = TIMER_CHECK_CCMODE;
		break;
	case DC_STATE_START_CV:
		pca9468->timer_id = TIMER_ENTER_CVMODE;
		break;
	case DC_STATE_CV_MODE:
		pca9468->timer_id = TIMER_CHECK_CVMODE;
		break;
	case DC_STATE_ADJUST_TAVOL:
		pca9468->timer_id = TIMER_ADJUST_TAVOL;
		break;
	case DC_STATE_ADJUST_TACUR:
		pca9468->timer_id = TIMER_ADJUST_TACUR;
		break;
	default:
		ret = -EINVAL;
		break;
	}

	if (ret < 0) {
		pr_err("%s: Error-send_pd_message to %d (%d)\n",
			__func__, pca9468->ta_type, ret);
		pca9468->timer_id = TIMER_CHECK_ACTIVE;
	}

	if (pca9468->ta_type == TA_TYPE_WIRELESS)
		pca9468->timer_period = PCA9468_PDMSG_WLC_WAIT_T;
	else
		pca9468->timer_period = PCA9468_PDMSG_WAIT_T;

	logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
			"%s: charging_state=%u timer_id:%d->%d ret=%d",
			__func__, pca9468->charging_state,
			timer_id, pca9468->timer_id, ret);

	mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
			 msecs_to_jiffies(pca9468->timer_period));

	pr_debug("%s: End: timer_id=%d timer_period=%lu\n", __func__,
		 pca9468->timer_id, pca9468->timer_period);

	mutex_unlock(&pca9468->lock);
	return ret;
}

/* delayed work function for charging timer */
static void pca9468_timer_work(struct work_struct *work)
{
	struct pca9468_charger *pca9468 =
		container_of(work, struct pca9468_charger, timer_work.work);
	unsigned int charging_state;
	int timer_id;
	int ret = 0;

	pr_debug("%s: ========= START =========\n", __func__);

	/* TODO: remove locks from the calls and run all of this locked */
	mutex_lock(&pca9468->lock);

	p9468_chg_stats_update(&pca9468->chg_data, pca9468);
	charging_state = pca9468->charging_state;
	timer_id = pca9468->timer_id;

	pr_debug("%s: timer id=%d, charging_state=%u\n", __func__,
		 pca9468->timer_id, charging_state);

	mutex_unlock(&pca9468->lock);

	switch (timer_id) {

	/* charging_state <- DC_STATE_CHECK_VBAT */
	case TIMER_VBATMIN_CHECK:
		ret = pca9468_check_vbatmin(pca9468);
		if (ret < 0)
			goto error;
		break;

	/* charging_state <- DC_STATE_PRESET_DC */
	case TIMER_PRESET_DC:
		ret = pca9468_start_direct_charging(pca9468);
		if (ret < 0)
			goto error;
		break;

	/*
	 * charging_state <- DC_STATE_PRESET_DC
	 *	preset configuration, start charging
	 */
	case TIMER_PRESET_CONFIG:
		ret = pca9468_preset_config(pca9468);
		if (ret < 0)
			goto error;
		break;

	/*
	 * charging_state <- DC_STATE_PRESET_DC
	 *	150 ms after preset_config
	 */
	case TIMER_CHECK_ACTIVE:
		ret = pca9468_check_active_state(pca9468);
		if (ret < 0)
			goto error;
		break;

	case TIMER_ADJUST_CCMODE:
		ret = pca9468_charge_adjust_ccmode(pca9468);
		if (ret < 0)
			goto error;
		break;

	case TIMER_CHECK_CCMODE:
		ret = pca9468_charge_ccmode(pca9468);
		if (ret < 0)
			goto error;
		break;

	case TIMER_ENTER_CVMODE:
		/* Enter Pre-CV mode */
		ret = pca9468_charge_start_cvmode(pca9468);
		if (ret < 0)
			goto error;
		break;

	case TIMER_CHECK_CVMODE:
		ret = pca9468_charge_cvmode(pca9468);
		if (ret < 0)
			goto error;
		break;

	case TIMER_PDMSG_SEND:
		ret = pca9468_send_message(pca9468);
		if (ret < 0)
			goto error;
		break;

	/* called from 2 contexts */
	case TIMER_ADJUST_TAVOL:
		mutex_lock(&pca9468->lock);

		if (pca9468->ta_type == TA_TYPE_WIRELESS)
			ret = pca9468_adjust_rx_voltage(pca9468);
		else
			ret = pca9468_adjust_ta_voltage(pca9468);
		if (ret < 0) {
			mutex_unlock(&pca9468->lock);
			goto error;
		}

		mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
				 msecs_to_jiffies(pca9468->timer_period));
		mutex_unlock(&pca9468->lock);
		break;

	/* called from 2 contexts */
	case TIMER_ADJUST_TACUR:
		mutex_lock(&pca9468->lock);
		ret = pca9468_adjust_ta_current(pca9468);
		if (ret < 0) {
			mutex_unlock(&pca9468->lock);
			goto error;
		}

		mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
				 msecs_to_jiffies(pca9468->timer_period));
		mutex_unlock(&pca9468->lock);
		break;

	case TIMER_ID_NONE:
		ret = pca9468_stop_charging(pca9468);
		if (ret < 0)
			goto error;
		break;

	default:
		break;
	}

	/* Check the charging state again */
	if (pca9468->charging_state == DC_STATE_NO_CHARGING) {
		cancel_delayed_work(&pca9468->timer_work);
		cancel_delayed_work(&pca9468->pps_work);
	}

	pr_debug("%s: timer_id=%d->%d, charging_state=%u->%u, period=%ld\n",
		 __func__, timer_id, pca9468->timer_id, charging_state,
		 pca9468->charging_state, pca9468->timer_period);

	return;

error:
	pr_debug("%s: ========= ERROR =========\n", __func__);
	logbuffer_prlog(pca9468, LOGLEVEL_ERR,
			"%s: timer_id=%d->%d, charging_state=%u->%u, period=%ld ret=%d",
			__func__, timer_id, pca9468->timer_id, charging_state,
			pca9468->charging_state, pca9468->timer_period, ret);

	pca9468_stop_charging(pca9468);
}

/* delayed work function for pps periodic timer */
static void pca9468_pps_request_work(struct work_struct *work)
{
	struct pca9468_charger *pca9468 = container_of(work,
					struct pca9468_charger, pps_work.work);
	int ret;

	pr_debug("%s: =========START=========\n", __func__);
	pr_debug("%s: = charging_state=%u == \n", __func__,
		 pca9468->charging_state);

	ret = pca9468_send_pd_message(pca9468, PD_MSG_REQUEST_APDO);
	if (ret < 0)
		pr_err("%s: Error-send_pd_message\n", __func__);

	/* TODO: do other background stuff */

	pr_debug("%s: ret=%d\n", __func__, ret);
}

static int pca9468_hw_ping(struct pca9468_charger *pca9468)
{
	unsigned int val = 0;
	int ret;

	/* Read Device info register to check the incomplete I2C operation */
	ret = regmap_read(pca9468->regmap, PCA9468_REG_DEVICE_INFO, &val);
	if ((ret < 0) || (val != PCA9468_DEVICE_ID))
		ret = regmap_read(pca9468->regmap, PCA9468_REG_DEVICE_INFO, &val);
	if ((ret < 0) || (val != PCA9468_DEVICE_ID)) {
		dev_err(pca9468->dev, "reading DEVICE_INFO failed, val=%#x ret=%d\n",
			val, ret);
		return -EINVAL;
	}

	return 0;
}

/* one and done in probe */
static int pca9468_hw_init(struct pca9468_charger *pca9468)
{
	unsigned int val;
	int ret;

	/* Set OV_DELTA to 40% */
	val = OV_DELTA_40P << MASK2SHIFT(PCA9468_BIT_OV_DELTA);
	ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_SAFETY_CTRL,
				 PCA9468_BIT_OV_DELTA, val);
	if (ret < 0)
		return ret;

	/* Set Switching Frequency */
	val = pca9468->pdata->fsw_cfg << MASK2SHIFT(PCA9468_BIT_FSW_CFG);
	ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_START_CTRL,
				 PCA9468_BIT_FSW_CFG, val);
	if (ret < 0)
		return ret;

	/* Enable Reverse Current Detection, Active mode High, Force standby */
	val = PCA9468_BIT_REV_IIN_DET | PCA9468_EN_ACTIVE_H |
	      PCA9468_STANDBY_FORCED;
	ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_START_CTRL,
				 (PCA9468_BIT_REV_IIN_DET |
				  PCA9468_BIT_EN_CFG |
				  PCA9468_BIT_STANDBY_EN),
				 val);
	if (ret < 0)
		return ret;

	/* clear LIMIT_INCREMENT_EN */
	val = 0;
	ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_IIN_CTRL,
				 PCA9468_BIT_LIMIT_INCREMENT_EN, val);
	if (ret < 0)
		return ret;

	/* Set the ADC channels, NTC is invalid if Bias is not enabled */
	val = PCA9468_BIT_CH6_EN |	/* DIETEMP ADC */
	      PCA9468_BIT_CH5_EN |	/* IIN ADC */
	      PCA9468_BIT_CH3_EN |	/* VBAT ADC */
	      PCA9468_BIT_CH2_EN |	/* VIN ADC */
	      PCA9468_BIT_CH1_EN;	/* VOUT ADC */

	ret = regmap_write(pca9468->regmap, PCA9468_REG_ADC_CFG, val);
	if (ret < 0)
		return ret;

	/* ADC Mode change */
	val = 0x5B;
	ret = regmap_write(pca9468->regmap, PCA9468_REG_ADC_ACCESS, val);
	if (ret < 0)
		return ret;
	val = 0x10;
	ret = regmap_write(pca9468->regmap, PCA9468_REG_ADC_MODE, val);
	if (ret < 0)
		return ret;
	val = 0x00;
	ret = regmap_write(pca9468->regmap, PCA9468_REG_ADC_ACCESS, val);
	if (ret < 0)
		return ret;

	/* Read ADC compensation gain */
	ret = regmap_read(pca9468->regmap, PCA9468_REG_ADC_ADJUST, &val);
	if (ret < 0)
		return ret;
	pca9468->adc_comp_gain = adc_gain[val >> MASK2SHIFT(PCA9468_BIT_ADC_GAIN)];

	/* input current - uA*/
	ret = pca9468_set_input_current(pca9468, pca9468->pdata->iin_cfg);
	if (ret < 0)
		return ret;

	/* v float voltage */
	ret = pca9468_set_vfloat(pca9468, pca9468->pdata->v_float);
	if (ret < 0)
		return ret;

	/* Spread Spectrum settings */
	ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_ADC_CTRL,
				 PCA9468_BIT_SC_CLK_DITHER_RATE,
				 pca9468->pdata->sc_clk_dither_rate);
	if (ret < 0)
		return ret;
	ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_NTC_TH_2,
				 PCA9468_SC_CLK_DITHER_LIMIT,
				 pca9468->pdata->sc_clk_dither_limit << 4);
	if (ret < 0)
		return ret;
	val = pca9468->pdata->sc_clk_dither_en ? PCA9468_BIT_SC_CLK_DITHER_EN : 0;
	ret = regmap_update_bits(pca9468->regmap, PCA9468_REG_TEMP_CTRL,
				 PCA9468_BIT_SC_CLK_DITHER_EN, val);
	if (ret < 0)
		return ret;

	return ret;
}

static irqreturn_t pca9468_interrupt_handler(int irq, void *data)
{
	struct pca9468_charger *pca9468 = data;
	/* INT1, INT1_MSK, INT1_STS, STS_A, B, C, D */
	u8 int1[REG_INT1_MAX], sts[REG_STS_MAX];
	u8 masked_int;	/* masked int */
	bool handled = false;
	int ret;

	/* Read INT1, INT1_MSK, INT1_STS */
	ret = regmap_bulk_read(pca9468->regmap, PCA9468_REG_INT1, int1, 3);
	if (ret < 0) {
		dev_warn(pca9468->dev, "reading INT1_X failed\n");
		return IRQ_NONE;
	}

	/* Read STS_A, B, C, D */
	ret = regmap_bulk_read(pca9468->regmap, PCA9468_REG_STS_A, sts, 4);
	if (ret < 0) {
		dev_warn(pca9468->dev, "reading STS_X failed\n");
		return IRQ_NONE;
	}

	pr_debug("%s: int1=0x%2x, int1_sts=0x%2x, sts_a=0x%2x\n", __func__,
			int1[REG_INT1], int1[REG_INT1_STS], sts[REG_STS_A]);

	/* Check Interrupt */
	masked_int = int1[REG_INT1] & !int1[REG_INT1_MSK];
	if (masked_int & PCA9468_BIT_V_OK_INT) {
		/* V_OK interrupt happened */
		mutex_lock(&pca9468->lock);
		pca9468->mains_online = !!(int1[REG_INT1_STS] &
					PCA9468_BIT_V_OK_STS);

		/* TODO: alex perform a clean shutdown */
		mutex_unlock(&pca9468->lock);
		power_supply_changed(pca9468->mains);
		handled = true;
	}

	if (masked_int & PCA9468_BIT_NTC_TEMP_INT) {
		/* NTC_TEMP interrupt happened */
		if (int1[REG_INT1_STS] & PCA9468_BIT_NTC_TEMP_STS) {
			/* above NTC_THRESHOLD */
			dev_err(pca9468->dev, "charging stopped due to NTC threshold voltage\n");
		}
		handled = true;
	}

	if (masked_int & PCA9468_BIT_CHG_PHASE_INT) {
		/* CHG_PHASE interrupt happened */
		if (int1[REG_INT1_STS] & PCA9468_BIT_CHG_PHASE_STS) {
			/* Any of loops is active*/
			if (sts[REG_STS_A] & PCA9468_BIT_VFLT_LOOP_STS)	{
				/* V_FLOAT loop is in regulation */
				pr_debug("%s: V_FLOAT loop interrupt\n",
					__func__);
				/* Disable CHG_PHASE_M */
				ret = regmap_update_bits(pca9468->regmap,
						PCA9468_REG_INT1_MSK,
						PCA9468_BIT_CHG_PHASE_M,
						PCA9468_BIT_CHG_PHASE_M);
				if (ret < 0) {
					handled = false;
					return handled;
				}

				/* Go to Pre CV Mode */
				pca9468->timer_id = TIMER_ENTER_CVMODE;
				pca9468->timer_period = 10;
				mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
					msecs_to_jiffies(pca9468->timer_period));

			} else if (sts[REG_STS_A] & PCA9468_BIT_IIN_LOOP_STS) {
				/* IIN loop or ICHG loop is in regulation */
				pr_debug("%s: IIN loop interrupt\n", __func__);
			} else if (sts[REG_STS_A] & PCA9468_BIT_CHG_LOOP_STS) {
				/* ICHG loop is in regulation */
				pr_debug("%s: ICHG loop interrupt\n", __func__);
			}
		}
		handled = true;
	}

	if (masked_int & PCA9468_BIT_CTRL_LIMIT_INT) {
		/* CTRL_LIMIT interrupt happened */
		if (int1[REG_INT1_STS] & PCA9468_BIT_CTRL_LIMIT_STS) {
			/* No Loop is active or OCP */
			if (sts[REG_STS_B] & PCA9468_BIT_OCP_FAST_STS) {
				/* Input fast over current */
				dev_err(pca9468->dev, "IIN > 50A instantaneously\n");
			}
			if (sts[REG_STS_B] & PCA9468_BIT_OCP_AVG_STS) {
				/* Input average over current */
				dev_err(pca9468->dev, "IIN > IIN_CFG*150percent\n");
			}
		}
		handled = true;
	}

	if (masked_int & PCA9468_BIT_TEMP_REG_INT) {
		/* TEMP_REG interrupt happened */
		if (int1[REG_INT1_STS] & PCA9468_BIT_TEMP_REG_STS) {
			/* Device is in temperature regulation */
			dev_err(pca9468->dev, "Device is in temperature regulation\n");
		}
		handled = true;
	}

	if (masked_int & PCA9468_BIT_ADC_DONE_INT) {
		/* ADC complete interrupt happened */
		dev_dbg(pca9468->dev, "ADC has been completed\n");
		handled = true;
	}

	if (masked_int & PCA9468_BIT_TIMER_INT) {
		/* Timer falut interrupt happened */
		if (int1[REG_INT1_STS] & PCA9468_BIT_TIMER_STS) {
			if (sts[REG_STS_B] & PCA9468_BIT_CHARGE_TIMER_STS) {
				/* Charger timer is expired */
				dev_err(pca9468->dev, "Charger timer is expired\n");
			}
			if (sts[REG_STS_B] & PCA9468_BIT_WATCHDOG_TIMER_STS) {
				/* Watchdog timer is expired */
				dev_err(pca9468->dev, "Watchdog timer is expired\n");
			}
		}
		handled = true;
	}

	return handled ? IRQ_HANDLED : IRQ_NONE;
}

static int pca9468_irq_init(struct pca9468_charger *pca9468,
			    struct i2c_client *client)
{
	const struct pca9468_platform_data *pdata = pca9468->pdata;
	int ret, msk, irq;

	irq = gpio_to_irq(pdata->irq_gpio);

	ret = gpio_request_one(pdata->irq_gpio, GPIOF_IN, client->name);
	if (ret < 0)
		goto fail;

	ret = request_threaded_irq(irq, NULL, pca9468_interrupt_handler,
				   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
				   client->name, pca9468);
	if (ret < 0)
		goto fail_gpio;

	/* disable all interrupts by default. */
	msk = PCA9468_BIT_V_OK_M |
	      PCA9468_BIT_NTC_TEMP_M |
	      PCA9468_BIT_CHG_PHASE_M |
	      PCA9468_BIT_RESERVED_M |
	      PCA9468_BIT_CTRL_LIMIT_M |
	      PCA9468_BIT_TEMP_REG_M |
	      PCA9468_BIT_ADC_DONE_M |
	      PCA9468_BIT_TIMER_M;
	ret = regmap_write(pca9468->regmap, PCA9468_REG_INT1_MSK, msk);
	if (ret < 0)
		goto fail_write;

	client->irq = irq;
	return 0;

fail_write:
	free_irq(irq, pca9468);
fail_gpio:
	gpio_free(pdata->irq_gpio);
fail:
	client->irq = 0;
	return ret;
}

/* Returns the input current limit programmed into the charger in uA. */
int pca9468_input_current_limit(struct pca9468_charger *pca9468)
{
	int ret, intval;
	unsigned int val;

	if (!pca9468->mains_online)
		return -ENODATA;

	ret = regmap_read(pca9468->regmap, PCA9468_REG_IIN_CTRL, &val);
	if (ret < 0)
		return ret;

	intval = (val & PCA9468_BIT_IIN_CFG) * 100000;

	if (intval < 500000)
		intval = 500000;

	return intval;
}

/* Returns the constant charge current requested from GCPM */
static int get_const_charge_current(struct pca9468_charger *pca9468)
{
	/* Charging current cannot be controlled directly */
	return pca9468->cc_max;
}

/* Return the constant charge voltage programmed into the charger in uV. */
static int pca9468_const_charge_voltage(struct pca9468_charger *pca9468)
{
	unsigned int val;
	int ret;

	if (!pca9468->mains_online)
		return -ENODATA;

	ret = regmap_read(pca9468->regmap, PCA9468_REG_V_FLOAT, &val);
	if (ret < 0)
		return ret;

	return (val * 5 + 3725) * 1000;
}

#define get_boot_sec() div_u64(ktime_to_ns(ktime_get_boottime()), NSEC_PER_SEC)

/* index is the PPS source to use */
static int pca9468_set_charging_enabled(struct pca9468_charger *pca9468, int index)
{
	if (index < 0 || index >= PPS_INDEX_MAX)
		return -EINVAL;

	mutex_lock(&pca9468->lock);

	/* Done is detected in CV when iin goes UNDER topoff. */
	if (pca9468->charging_state == DC_STATE_CHARGING_DONE)
		index = 0;

	if (index == 0) {

		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"%s: stop pps_idx=%d->%d charging_state=%d timer_id=%d",
				__func__, pca9468->pps_index, index,
				pca9468->charging_state,
				pca9468->timer_id);

		/* this is the same as stop charging */
		pca9468->pps_index = 0;

		cancel_delayed_work(&pca9468->timer_work);
		cancel_delayed_work(&pca9468->pps_work);

		/* will call pca9468_stop_charging() in timer_work() */
		pca9468->timer_id = TIMER_ID_NONE;
		pca9468->timer_period = 0;
		mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
				 msecs_to_jiffies(pca9468->timer_period));
	} else if (pca9468->charging_state == DC_STATE_NO_CHARGING) {
		logbuffer_prlog(pca9468, LOGLEVEL_DEBUG,
				"%s: start pps_idx=%d->%d charging_state=%d timer_id=%d",
				__func__, pca9468->pps_index, index,
				pca9468->charging_state,
				pca9468->timer_id);

		/* Start Direct Charging on Index */
		pca9468->dc_start_time = get_boot_sec();
		p9468_chg_stats_init(&pca9468->chg_data);
		pca9468->pps_index = index;

		dev_info(pca9468->dev, "%s: charging_state=%u->%u\n", __func__,
			 pca9468->charging_state, DC_STATE_CHECK_VBAT);

		/* PD is already in PE_SNK_STATE */
		pca9468->charging_state = DC_STATE_CHECK_VBAT;
		pca9468->timer_id = TIMER_VBATMIN_CHECK;
		pca9468->timer_period = 0;
		mod_delayed_work(pca9468->dc_wq, &pca9468->timer_work,
				 msecs_to_jiffies(pca9468->timer_period));

		/* Set the initial charging step */
		power_supply_changed(pca9468->mains);
	}

	mutex_unlock(&pca9468->lock);

	return 0;
}

static int pca9468_mains_set_property(struct power_supply *psy,
				      enum power_supply_property prop,
				      const union power_supply_propval *val)
{
	struct pca9468_charger *pca9468 = power_supply_get_drvdata(psy);
	int ret = 0;

	pr_debug("%s: =========START=========\n", __func__);
	pr_debug("%s: prop=%d, val=%d\n", __func__, prop, val->intval);
	if (!pca9468->init_done)
		return -EAGAIN;

	switch (prop) {

	case POWER_SUPPLY_PROP_ONLINE:
		if (val->intval == 0) {
			ret = pca9468_stop_charging(pca9468);
			if (ret < 0)
				pr_err("%s: cannot stop charging (%d)\n",
				       __func__, ret);

			pca9468->mains_online = false;

			/* Reset DC Chg un-avail on disconnect */
			if (!pca9468->dc_avail)
				pca9468->dc_avail =
				gvotable_election_get_handle(VOTABLE_DC_CHG_AVAIL);

			if (pca9468->dc_avail) {
				ret = gvotable_cast_int_vote(pca9468->dc_avail,
							     REASON_DC_DRV, 1, 1);
				if (ret < 0)
					dev_err(pca9468->dev,
						"Unable to cast vote for DC Chg avail (%d)\n",
						ret);
			}
		} else if (pca9468->mains_online == false) {
			pca9468->mains_online = true;
		}

		break;

	/* TODO: locking is wrong */
	case GBMS_PROP_CHARGING_ENABLED:
		ret = pca9468_set_charging_enabled(pca9468, val->intval);
		break;

	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
		ret = pca9468_set_new_vfloat(pca9468, val->intval);
		break;

	/*
	 * pcaA9468 cannot control charging current directly so need to control
	 * current on TA side resolving cc_max for TA_VOL*TA_CUT on vbat.
	 * NOTE: iin should be equivalent to iin = cc_max /2
	 */
	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
		ret = pca9468_set_new_cc_max(pca9468, val->intval);
		break;

	/* CURRENT MAX, same as IIN is really only set by the algo */
	case POWER_SUPPLY_PROP_CURRENT_MAX:
		pr_debug("%s: set iin %d, ignore\n", __func__, val->intval);
		break;

	/* allow direct setting, not used */
	case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
		mutex_lock(&pca9468->lock);
		ret = pca9468_set_new_iin(pca9468, val->intval);
		mutex_unlock(&pca9468->lock);
		break;

	case GBMS_PROP_CHARGE_DISABLE:
		break;

	default:
		ret = -EINVAL;
		break;
	}

	pr_debug("%s: End, ret=%d\n", __func__, ret);
	return ret;
}

static int pca9468_mains_get_property(struct power_supply *psy,
				     enum power_supply_property prop,
				     union power_supply_propval *val)
{
	struct pca9468_charger *pca9468 = power_supply_get_drvdata(psy);
	union gbms_charger_state chg_state;
	int intval, rc, ret = 0;

	if (!pca9468->init_done)
		return -EAGAIN;

	switch (prop) {
	case POWER_SUPPLY_PROP_ONLINE:
		val->intval = pca9468->mains_online;
		break;
	case POWER_SUPPLY_PROP_PRESENT:
		val->intval = pca9468_is_present(pca9468);
		if (val->intval < 0)
			val->intval = 0;
		break;

	case GBMS_PROP_CHARGE_DISABLE:
		ret = pca9468_get_charging_enabled(pca9468);
		if (ret < 0)
			return ret;
		val->intval = !ret;
		break;

	case GBMS_PROP_CHARGING_ENABLED:
		ret = pca9468_get_charging_enabled(pca9468);
		if (ret < 0)
			return ret;
		val->intval = ret;
		break;

	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
		ret = pca9468_const_charge_voltage(pca9468);
		if (ret < 0)
			return ret;
		val->intval = ret;
		break;

	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
		ret = get_const_charge_current(pca9468);
		if (ret < 0)
			return ret;
		val->intval = ret;
		break;

	case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
		ret = pca9468_input_current_limit(pca9468);
		if (ret < 0)
			return ret;
		val->intval = ret;
		break;

	case POWER_SUPPLY_PROP_CURRENT_NOW:
		/* return the output current - uA unit */
		rc = pca9468_get_iin(pca9468, &val->intval);
		if (rc < 0)
			dev_err(pca9468->dev, "Invalid IIN ADC (%d)\n", rc);
		break;

	case GBMS_PROP_CHARGE_CHARGER_STATE:
		ret = pca9468_get_chg_chgr_state(pca9468, &chg_state);
		if (ret < 0)
			return ret;
		gbms_propval_int64val(val) = chg_state.v;
		break;

	case POWER_SUPPLY_PROP_VOLTAGE_MAX:
		intval = pca9468_read_adc(pca9468, ADCCH_VOUT);
		if (intval < 0)
			return intval;
		val->intval = intval;
		break;

	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
		intval = pca9468_read_adc(pca9468, ADCCH_VBAT);
		if (intval < 0)
			return intval;
		val->intval = intval;
		break;

	/* TODO: read NTC temperature? */
	case POWER_SUPPLY_PROP_TEMP:
		val->intval = pca9468_read_adc(pca9468, ADCCH_DIETEMP);
		break;

	case POWER_SUPPLY_PROP_CHARGE_TYPE:
		val->intval = pca9468_get_charge_type(pca9468);
		break;

	case POWER_SUPPLY_PROP_STATUS:
		val->intval = pca9468_get_status(pca9468);
		break;

	case POWER_SUPPLY_PROP_CURRENT_MAX:
		ret = pca9468_input_current_limit(pca9468);
		if (ret < 0)
			return ret;
		val->intval = ret;
		break;

	default:
		return -EINVAL;
	}

	return 0;
}

/*
 * GBMS not visible
 * POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
 * POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
 * POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
 * POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
 */
static enum power_supply_property pca9468_mains_properties[] = {
	POWER_SUPPLY_PROP_PRESENT,
	POWER_SUPPLY_PROP_ONLINE,
	POWER_SUPPLY_PROP_CHARGE_TYPE,
	POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
	POWER_SUPPLY_PROP_TEMP,
	/* same as POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT */
	POWER_SUPPLY_PROP_CURRENT_MAX,
	POWER_SUPPLY_PROP_CURRENT_NOW,
	POWER_SUPPLY_PROP_VOLTAGE_MAX,
	POWER_SUPPLY_PROP_VOLTAGE_NOW,
	POWER_SUPPLY_PROP_STATUS,
};

static int pca9468_mains_is_writeable(struct power_supply *psy,
				      enum power_supply_property psp)
{
	switch (psp) {
	case POWER_SUPPLY_PROP_ONLINE:
	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
	case POWER_SUPPLY_PROP_CURRENT_MAX:
	case GBMS_PROP_CHARGE_DISABLE:
		return 1;
	default:
		break;
	}

	return 0;
}

static bool pca9468_is_reg(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case PCA9468_REG_DEVICE_INFO ... PCA9468_REG_STS_ADC_9:
	case PCA9468_REG_IIN_CTRL ... PCA9468_REG_NTC_TH_2:
	case PCA9468_REG_ADC_ACCESS:
	case PCA9468_REG_ADC_ADJUST:
	case PCA9468_REG_ADC_IMPROVE:
	case PCA9468_REG_ADC_MODE:
	case 0x40 ... 0x4f: /* debug */
		return true;
	default:
		break;
	}

	return false;
}

static struct regmap_config pca9468_regmap = {
	.name		= "dc-mains",
	.reg_bits	= 8,
	.val_bits	= 8,
	.max_register	= PCA9468_MAX_REGISTER,
	.readable_reg = pca9468_is_reg,
	.volatile_reg = pca9468_is_reg,
};

static struct power_supply_desc pca9468_mains_desc = {
	.name		= "pca9468-mains",
	/* b/179246019 will not look online to Android */
	.type		= POWER_SUPPLY_TYPE_UNKNOWN,
	.get_property	= pca9468_mains_get_property,
	.set_property 	= pca9468_mains_set_property,
	.properties	= pca9468_mains_properties,
	.property_is_writeable = pca9468_mains_is_writeable,
	.num_properties	= ARRAY_SIZE(pca9468_mains_properties),
};

#if defined(CONFIG_OF)
static int of_pca9468_dt(struct device *dev,
			 struct pca9468_platform_data *pdata)
{
	struct device_node *np_pca9468 = dev->of_node;
	int ret;
	if(!np_pca9468)
		return -EINVAL;

	/* irq gpio */
	pdata->irq_gpio = of_get_named_gpio(np_pca9468, "pca9468,irq-gpio", 0);
	pr_info("%s: irq-gpio: %d \n", __func__, pdata->irq_gpio);

	/* input current limit */
	ret = of_property_read_u32(np_pca9468, "pca9468,input-current-limit",
				   &pdata->iin_cfg_max);
	if (ret) {
		pr_warn("%s: pca9468,input-current-limit is Empty\n", __func__);
		pdata->iin_cfg_max = PCA9468_IIN_CFG_DFT;
	}
	pdata->iin_cfg = pdata->iin_cfg_max;
	pr_info("%s: pca9468,iin_cfg is %u\n", __func__, pdata->iin_cfg);

	/* TA max voltage limit */
	ret = of_property_read_u32(np_pca9468, "pca9468,ta-max-vol",
				   &pdata->ta_max_vol);
	if (ret) {
		pr_warn("%s: pca9468,ta-max-vol is Empty\n", __func__);
		pdata->ta_max_vol = PCA9468_TA_MAX_VOL;
	}
	ret = of_property_read_u32(np_pca9468, "pca9468,ta-max-vol-cp",
				   &pdata->ta_max_vol_cp);
	if (ret) {
		pr_warn("%s: pca9468,ta-max-vol-cp is Empty\n", __func__);
		pdata->ta_max_vol_cp = pdata->ta_max_vol;
	}

	/* charging float voltage */
	ret = of_property_read_u32(np_pca9468, "pca9468,float-voltage",
				   &pdata->v_float_dt);
	if (ret) {
		pr_warn("%s: pca9468,float-voltage is Empty\n", __func__);
		pdata->v_float_dt = PCA9468_VFLOAT_DFT;
	}
	pdata->v_float = pdata->v_float_dt;
	pr_info("%s: pca9468,v_float is %u\n", __func__, pdata->v_float);

	/* input topoff current */
	ret = of_property_read_u32(np_pca9468, "pca9468,input-itopoff",
				   &pdata->iin_topoff);
	if (ret) {
		pr_warn("%s: pca9468,input-itopoff is Empty\n", __func__);
		pdata->iin_topoff = PCA9468_IIN_DONE_DFT;
	}
	pr_info("%s: pca9468,iin_topoff is %u\n", __func__, pdata->iin_topoff);

	/* switching frequency */
	ret = of_property_read_u32(np_pca9468, "pca9468,switching-frequency",
				   &pdata->fsw_cfg);
	if (ret) {
		pr_warn("%s: pca9468,switching frequency is Empty\n", __func__);
		pdata->fsw_cfg = PCA9468_FSW_CFG_DFT;
	}
	pr_info("%s: pca9468,fsw_cfg is %u\n", __func__, pdata->fsw_cfg);

	/* NTC threshold voltage */
	ret = of_property_read_u32(np_pca9468, "pca9468,ntc-threshold",
				   &pdata->ntc_th);
	if (ret) {
		pr_warn("%s: pca9468,ntc threshold voltage is Empty\n",
			__func__);
		pdata->ntc_th = PCA9468_NTC_TH_DFT;
	}
	pr_info("%s: pca9468,ntc_th is %u\n", __func__, pdata->ntc_th);

	/* iin offsets */
	ret = of_property_read_u32(np_pca9468, "pca9468,iin-max-offset",
				   &pdata->iin_max_offset);
	if (ret)
		pdata->iin_max_offset = PCA9468_IIN_MAX_OFFSET;
	pr_info("%s: pca9468,iin_max_offset is %u\n", __func__, pdata->iin_max_offset);

	ret = of_property_read_u32(np_pca9468, "pca9468,iin-cc_comp-offset",
				   &pdata->iin_cc_comp_offset);
	if (ret)
		pdata->iin_cc_comp_offset = PCA9468_IIN_CC_COMP_OFFSET;
	pr_info("%s: pca9468,iin_cc_comp_offset is %u\n", __func__, pdata->iin_cc_comp_offset);

	/* irdrop limits */
	pdata->irdrop_limit_cnt =
	    of_property_count_elems_of_size(np_pca9468, "google,irdrop-limits", sizeof(u32));
	if (pdata->irdrop_limit_cnt < PCA9468_IRDROP_LIMIT_CNT) {
		pr_info("%s: google,irdrop-limits size get failed, use default irdrop limits %d\n",
			__func__, pdata->irdrop_limit_cnt);
		ret = -EINVAL;
	} else {
		ret = of_property_read_u32_array(np_pca9468, "google,irdrop-limits",
						 (u32 *)pdata->irdrop_limits,
						 PCA9468_IRDROP_LIMIT_CNT);
		if (ret)
			pr_info("%s: google,irdrop-limits get failed, use default irdrop limits",
				__func__);
	}
	if (ret) {
		pdata->irdrop_limits[0] = PCA9468_IRDROP_LIMIT_TIER1;
		pdata->irdrop_limits[1] = PCA9468_IRDROP_LIMIT_TIER2;
		pdata->irdrop_limits[2] = PCA9468_IRDROP_LIMIT_TIER3;
	}
	pdata->pca_irdrop = of_property_read_bool(np_pca9468, "google,pca-irdrop");
	if (pdata->pca_irdrop)
		pr_info("%s: google,pca-irdrop is set, run irdrop in pca\n", __func__);

	/* Spread Spectrum settings */
	ret = of_property_read_u32(np_pca9468, "pca9468,sc-clk-dither-rate",
				   &pdata->sc_clk_dither_rate);
	if (ret)
		pdata->sc_clk_dither_rate = PCA9468_SC_CLK_DITHER_RATE_DEF;
	else
		pr_info("%s: pca9468,sc-clk-dither-rate is %u\n", __func__,
			pdata->sc_clk_dither_rate);
	ret = of_property_read_u32(np_pca9468, "pca9468,sc-clk-dither-limit",
				   &pdata->sc_clk_dither_limit);
	if (ret)
		pdata->sc_clk_dither_limit = PCA9468_SC_CLK_DITHER_LIMIT_DEF;
	else
		pr_info("%s: pca9468,sc-clk-dither-limit is %u\n", __func__,
			pdata->sc_clk_dither_limit);
	pdata->sc_clk_dither_en = of_property_read_bool(np_pca9468, "pca9468,spread-spectrum");
	pr_info("%s: pca9468,spread-spectrum is %u\n", __func__, pdata->sc_clk_dither_en);

#ifdef CONFIG_THERMAL
	/* USBC thermal zone */
	ret = of_property_read_string(np_pca9468, "google,usb-port-tz-name",
				      &pdata->usb_tz_name);
	if (ret) {
		pr_info("%s: google,usb-port-tz-name is Empty\n", __func__);
		pdata->usb_tz_name = NULL;
	} else {
		pr_info("%s: google,usb-port-tz-name is %s\n", __func__,
			pdata->usb_tz_name);
	}
#endif

	return 0;
}
#else
static int of_pca9468_dt(struct device *dev,
			 struct pca9468_platform_data *pdata)
{
	return 0;
}
#endif /* CONFIG_OF */

#ifdef CONFIG_THERMAL
static int pca9468_usb_tz_read_temp(struct thermal_zone_device *tzd, int *temp)
{
	struct pca9468_charger *pca9468 = tzd->devdata;

	if (!pca9468)
		return -ENODEV;
	*temp = pca9468_read_adc(pca9468, ADCCH_NTC);

	return 0;
}

static struct thermal_zone_device_ops pca9468_usb_tzd_ops = {
	.get_temp = pca9468_usb_tz_read_temp,
};
#endif

static int read_reg(void *data, u64 *val)
{
	struct pca9468_charger *chip = data;
	int rc;
	unsigned int temp;

	rc = regmap_read(chip->regmap, chip->debug_address, &temp);
	if (rc) {
		pr_err("Couldn't read reg %x rc = %d\n",
			chip->debug_address, rc);
		return -EAGAIN;
	}
	*val = temp;
	return 0;
}

static int write_reg(void *data, u64 val)
{
	struct pca9468_charger *chip = data;
	int rc;
	u8 temp;

	temp = (u8) val;
	rc = regmap_write(chip->regmap, chip->debug_address, temp);
	if (rc) {
		pr_err("Couldn't write 0x%02x to 0x%02x rc = %d\n",
			temp, chip->debug_address, rc);
		return -EAGAIN;
	}
	return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(register_debug_ops, read_reg, write_reg, "0x%02llx\n");

static int debug_apply_offsets(void *data, u64 val)
{
	struct pca9468_charger *chip = data;
	int ret;

	ret = pca9468_set_new_cc_max(chip, chip->cc_max);
	pr_info("Apply offsets iin_max_o=%d iin_cc_comp_o=%d ret=%d\n",
		chip->pdata->iin_max_offset, chip->pdata->iin_cc_comp_offset,
		ret);

	return ret;
}
DEFINE_SIMPLE_ATTRIBUTE(apply_offsets_debug_ops, NULL, debug_apply_offsets, "0x%02llx\n");


static int debug_adc_chan_get(void *data, u64 *val)
{
	struct pca9468_charger *pca9468 = data;

	*val = pca9468_read_adc(data, pca9468->debug_adc_channel);
	return 0;
}

static int debug_adc_chan_set(void *data, u64 val)
{
	struct pca9468_charger *pca9468 = data;

	if (val < ADCCH_VOUT || val >= ADCCH_MAX)
		return -EINVAL;
	pca9468->debug_adc_channel = val;
	return 0;
}

DEFINE_SIMPLE_ATTRIBUTE(debug_adc_chan_ops, debug_adc_chan_get,
			debug_adc_chan_set, "%llu\n");


static int debug_pps_index_get(void *data, u64 *val)
{
	struct pca9468_charger *pca9468 = data;

	*val = pca9468->pps_index;
	return 0;
}

static int debug_pps_index_set(void *data, u64 val)
{
	struct pca9468_charger *pca9468 = data;

	return pca9468_set_charging_enabled(pca9468, (int)val);
}

DEFINE_SIMPLE_ATTRIBUTE(debug_pps_index_ops, debug_pps_index_get,
			debug_pps_index_set, "%llu\n");

static ssize_t show_sts_ab(struct device *dev, struct device_attribute *attr, char *buf)
{
	struct pca9468_charger *pca9468 = dev_get_drvdata(dev);
	u8 tmp[2];
	int ret;

	ret = regmap_bulk_read(pca9468->regmap, PCA9468_REG_STS_A, &tmp, sizeof(tmp));
	if (ret < 0)
		return ret;

	return scnprintf(buf, PAGE_SIZE, "%02x%02x\n", tmp[0], tmp[1]);
}

static DEVICE_ATTR(sts_ab, 0444, show_sts_ab, NULL);


static ssize_t p9468_show_chg_stats(struct device *dev, struct device_attribute *attr,
				    char *buff)
{
	struct i2c_client *client = to_i2c_client(dev);
	struct pca9468_charger *pca9468 = i2c_get_clientdata(client);
	struct p9468_chg_stats *chg_data = &pca9468->chg_data;
	const int max_size = PAGE_SIZE;
	int len = -ENODATA;

	mutex_lock(&pca9468->lock);

	if (!p9468_chg_stats_valid(chg_data))
		goto exit_done;

	len = scnprintf(buff, max_size,
			"D:%#x,%#x %#x,%#x,%#x,%#x,%#x\n",
			chg_data->adapter_capabilities[0],
			chg_data->adapter_capabilities[1],
			chg_data->receiver_state[0],
			chg_data->receiver_state[1],
			chg_data->receiver_state[2],
			chg_data->receiver_state[3],
			chg_data->receiver_state[4]);
	len += scnprintf(&buff[len], max_size - len,
			"N: ovc=%d,ovc_ibatt=%d,ovc_delta=%d rcp=%d,stby=%d, iin_loop=%d\n",
			chg_data->ovc_count, chg_data->ovc_max_ibatt, chg_data->ovc_max_delta,
			chg_data->rcp_count,
			chg_data->stby_count,
			chg_data->iin_loop_count);
	len += scnprintf(&buff[len], max_size - len,
			"C: nc=%d,pre=%d,ca=%d,cc=%d,cv=%d,adj=%d\n",
			chg_data->nc_count,
			chg_data->pre_count,
			chg_data->ca_count,
			chg_data->cc_count,
			chg_data->cv_count,
			chg_data->adj_count);

exit_done:
	mutex_unlock(&pca9468->lock);
	return len;
}

static ssize_t p9468_set_chg_stats(struct device *dev, struct device_attribute *attr,
				   const char *buf, size_t count)
{
	struct i2c_client *client = to_i2c_client(dev);
	struct pca9468_charger *pca9468 = i2c_get_clientdata(client);

	mutex_lock(&pca9468->lock);
	p9468_chg_stats_init(&pca9468->chg_data);
	mutex_unlock(&pca9468->lock);

	return count;
}

static DEVICE_ATTR(chg_stats, 0644, p9468_show_chg_stats, p9468_set_chg_stats);

static ssize_t show_dump_reg(struct device *dev, struct device_attribute *attr,
			     char *buf)
{
	struct pca9468_charger *pca9468 = dev_get_drvdata(dev);
	u8 tmp[PCA9468_MAX_REGISTER + 1];
	int ret, i;
	int len = 0;

	ret = regmap_bulk_read(pca9468->regmap, PCA9468_REG_DEVICE_INFO, &tmp,
			       PCA9468_MAX_REGISTER + 1);
	if (ret < 0)
		return ret;

	for (i = 0; i <= PCA9468_MAX_REGISTER; i++)
		len += scnprintf(&buf[len], PAGE_SIZE - len, "%02x: %02x\n", i, tmp[i]);

	return len;
}

static DEVICE_ATTR(registers_dump, 0444, show_dump_reg, NULL);

static int pca9468_create_fs_entries(struct pca9468_charger *chip)
{

	device_create_file(chip->dev, &dev_attr_sts_ab);
	device_create_file(chip->dev, &dev_attr_chg_stats);
	device_create_file(chip->dev, &dev_attr_registers_dump);

	chip->debug_root = debugfs_create_dir("charger-pca9468", NULL);
	if (IS_ERR_OR_NULL(chip->debug_root)) {
		dev_err(chip->dev, "Couldn't create debug dir\n");
		return -ENOENT;
	}

	debugfs_create_bool("wlc_rampout_iin", 0644, chip->debug_root,
			     &chip->wlc_ramp_out_iin);
	debugfs_create_u32("wlc_rampout_delay", 0644, chip->debug_root,
			   &chip->wlc_ramp_out_delay);
	debugfs_create_u32("wlc_rampout_vout_target", 0644, chip->debug_root,
			   &chip->wlc_ramp_out_vout_target);


	debugfs_create_u32("debug_level", 0644, chip->debug_root,
			   &debug_printk_prlog);
	debugfs_create_u32("no_logbuffer", 0644, chip->debug_root,
			   &debug_no_logbuffer);

	debugfs_create_file("data", 0644, chip->debug_root, chip, &register_debug_ops);
	debugfs_create_x32("address", 0644, chip->debug_root, &chip->debug_address);

	debugfs_create_u32("iin_max_offset", 0644, chip->debug_root,
			   &chip->pdata->iin_max_offset);
	debugfs_create_u32("iin_cc_comp_offset", 0644, chip->debug_root,
			   &chip->pdata->iin_cc_comp_offset);
	debugfs_create_file("apply_offsets", 0644, chip->debug_root, chip,
			    &apply_offsets_debug_ops);

	chip->debug_adc_channel = ADCCH_VOUT;
	debugfs_create_file("adc_chan", 0644, chip->debug_root, chip,
			    &debug_adc_chan_ops);
	debugfs_create_file("pps_index", 0644, chip->debug_root, chip,
			    &debug_pps_index_ops);

	return 0;
}


static int pca9468_probe(struct i2c_client *client,
			 const struct i2c_device_id *id)
{
	static char *battery[] = { "pca9468-battery" };
	struct power_supply_config mains_cfg = {};
	struct pca9468_platform_data *pdata;
	struct pca9468_charger *pca9468_chg;
	struct device *dev = &client->dev;
	const char *psy_name = NULL;
	int ret;

	pr_debug("%s: =========START=========\n", __func__);

	pca9468_chg = devm_kzalloc(dev, sizeof(*pca9468_chg), GFP_KERNEL);
	if (!pca9468_chg)
		return -ENOMEM;

#if defined(CONFIG_OF)
	if (client->dev.of_node) {
		pdata = devm_kzalloc(&client->dev,
				     sizeof(struct pca9468_platform_data),
				     GFP_KERNEL);
		if (!pdata) {
			dev_err(&client->dev, "Failed to allocate memory \n");
			return -ENOMEM;
		}

		ret = of_pca9468_dt(&client->dev, pdata);
		if (ret < 0){
			dev_err(&client->dev, "Failed to get device of_node \n");
			return -ENOMEM;
		}

		client->dev.platform_data = pdata;
	} else {
		pdata = client->dev.platform_data;
	}
#else
	pdata = dev->platform_data;
#endif
	if (!pdata)
		return -EINVAL;

	i2c_set_clientdata(client, pca9468_chg);

	mutex_init(&pca9468_chg->lock);
	pca9468_chg->dev = &client->dev;
	pca9468_chg->pdata = pdata;
	pca9468_chg->charging_state = DC_STATE_NO_CHARGING;
	pca9468_chg->wlc_ramp_out_iin = true;
	pca9468_chg->wlc_ramp_out_vout_target = 0; /* use Vbatt*4 as default */
	pca9468_chg->wlc_ramp_out_delay = 250; /* 250 ms default */

	/* Create a work queue for the direct charger */
	pca9468_chg->dc_wq = alloc_ordered_workqueue("pca9468_dc_wq", WQ_MEM_RECLAIM);
	if (pca9468_chg->dc_wq == NULL) {
		dev_err(pca9468_chg->dev, "failed to create work queue\n");
		return -ENOMEM;
	}

	pca9468_chg->monitor_wake_lock =
		wakeup_source_register(NULL, "pca9468-charger-monitor");
	if (!pca9468_chg->monitor_wake_lock) {
		pr_err("Failed to register wakeup source\n");
		return -ENODEV;
	}

	/* initialize work */
	INIT_DELAYED_WORK(&pca9468_chg->timer_work, pca9468_timer_work);
	pca9468_chg->timer_id = TIMER_ID_NONE;
	pca9468_chg->timer_period = 0;

	INIT_DELAYED_WORK(&pca9468_chg->pps_work, pca9468_pps_request_work);

	ret = of_property_read_string(dev->of_node,
				      "pca9468,psy_name", &psy_name);
	if ((ret == 0) && (strlen(psy_name) > 0))
		pca9468_regmap.name = pca9468_mains_desc.name =
		    devm_kstrdup(dev, psy_name, GFP_KERNEL);

	pca9468_chg->regmap = devm_regmap_init_i2c(client, &pca9468_regmap);
	if (IS_ERR(pca9468_chg->regmap)) {
		ret = -EINVAL;
		goto error;
	}

	ret = pca9468_probe_pps(pca9468_chg);
	if (ret < 0) {
		pr_warn("pca9468: PPS not available (%d)\n", ret);
	} else {
		const char *logname = "pca9468";

		pca9468_chg->log = logbuffer_register(logname);
		if (IS_ERR(pca9468_chg->log)) {
			pr_err("%s: no logbuffer (%ld)\n", __func__,
			       PTR_ERR(pca9468_chg->log));
			pca9468_chg->log = NULL;
		}
	}

	ret = pca9468_hw_ping(pca9468_chg);
	if (ret < 0)
		goto error;

	/* TODO: only enable ADC if usb_tz_name is defined */
	ret = pca9468_hw_init(pca9468_chg);
	if (ret < 0)
		goto error;

	mains_cfg.supplied_to = battery;
	mains_cfg.num_supplicants = ARRAY_SIZE(battery);
	mains_cfg.drv_data = pca9468_chg;
	pca9468_chg->mains = devm_power_supply_register(dev,
							&pca9468_mains_desc,
							&mains_cfg);
	if (IS_ERR(pca9468_chg->mains)) {
		ret = -ENODEV;
		goto error;
	}

	/* Interrupt pin is optional. */
	if (pdata->irq_gpio >= 0) {
		ret = pca9468_irq_init(pca9468_chg, client);
		if (ret < 0) {
			dev_warn(dev, "failed to initialize IRQ: %d\n", ret);
			dev_warn(dev, "disabling IRQ support\n");
		}

		/* disable interrupt */
		disable_irq(client->irq);
	}

	ret = pca9468_create_fs_entries(pca9468_chg);
	if (ret < 0)
		dev_err(dev, "error while registering debugfs %d\n", ret);

#ifdef CONFIG_THERMAL
	if (pdata->usb_tz_name) {
		pca9468_chg->usb_tzd =
			thermal_zone_device_register(pdata->usb_tz_name, 0, 0,
						     pca9468_chg,
						     &pca9468_usb_tzd_ops,
						     NULL, 0, 0);
		if (IS_ERR(pca9468_chg->usb_tzd)) {
			pca9468_chg->usb_tzd = NULL;
			ret = PTR_ERR(pca9468_chg->usb_tzd);
			dev_err(dev, "Couldn't register usb connector thermal zone ret=%d\n",
				ret);
		}
	}
#endif

	pca9468_chg->dc_avail = NULL;

	pca9468_chg->init_done = true;
	pr_info("pca9468: probe_done\n");
	pr_debug("%s: =========END=========\n", __func__);
	return 0;

error:
	destroy_workqueue(pca9468_chg->dc_wq);
	mutex_destroy(&pca9468_chg->lock);
	wakeup_source_unregister(pca9468_chg->monitor_wake_lock);
	return ret;
}

static int pca9468_remove(struct i2c_client *client)
{
	struct pca9468_charger *pca9468_chg = i2c_get_clientdata(client);

	/* stop charging if it is active */
	pca9468_stop_charging(pca9468_chg);

	if (client->irq) {
		free_irq(client->irq, pca9468_chg);
		gpio_free(pca9468_chg->pdata->irq_gpio);
	}

	destroy_workqueue(pca9468_chg->dc_wq);

	wakeup_source_unregister(pca9468_chg->monitor_wake_lock);

#ifdef CONFIG_THERMAL
	if (pca9468_chg->usb_tzd)
		thermal_zone_device_unregister(pca9468_chg->usb_tzd);
#endif
	if (pca9468_chg->log)
		logbuffer_unregister(pca9468_chg->log);
	pps_free(&pca9468_chg->pps_data);

	return 0;
}

static const struct i2c_device_id pca9468_id[] = {
	{ "pca9468", 0 },
	{ }
};
MODULE_DEVICE_TABLE(i2c, pca9468_id);

#if defined(CONFIG_OF)
static struct of_device_id pca9468_i2c_dt_ids[] = {
	{ .compatible = "nxp,pca9468" },
	{ },
};
MODULE_DEVICE_TABLE(of, pca9468_i2c_dt_ids);
#endif /* CONFIG_OF */

#if defined(CONFIG_PM)
#ifdef CONFIG_RTC_HCTOSYS
static int get_current_time(unsigned long *now_tm_sec)
{
	struct rtc_time tm;
	struct rtc_device *rtc;
	int rc;

	rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
	if (rtc == NULL) {
		pr_err("%s: unable to open rtc device (%s)\n",
			__FILE__, CONFIG_RTC_HCTOSYS_DEVICE);
		return -EINVAL;
	}

	rc = rtc_read_time(rtc, &tm);
	if (rc) {
		pr_err("Error reading rtc device (%s) : %d\n",
			CONFIG_RTC_HCTOSYS_DEVICE, rc);
		goto close_time;
	}

	rc = rtc_valid_tm(&tm);
	if (rc) {
		pr_err("Invalid RTC time (%s): %d\n",
			CONFIG_RTC_HCTOSYS_DEVICE, rc);
		goto close_time;
	}

	*now_tm_sec = rtc_tm_to_time64(&tm);

close_time:
	rtc_class_close(rtc);
	return rc;
}

static void
pca9468_check_and_update_charging_timer(struct pca9468_charger *pca9468)
{
	unsigned long current_time = 0, next_update_time, time_left;

	get_current_time(&current_time);

	if (pca9468->timer_id != TIMER_ID_NONE)	{
		next_update_time = pca9468->last_update_time +
				(pca9468->timer_period / 1000); /* seconds */

		pr_debug("%s: current_time=%ld, next_update_time=%ld\n",
			__func__, current_time, next_update_time);

		if (next_update_time > current_time)
			time_left = next_update_time - current_time;
		else
			time_left = 0;

		mutex_lock(&pca9468->lock);
		pca9468->timer_period = time_left * 1000; /* ms unit */
		mutex_unlock(&pca9468->lock);
		schedule_delayed_work(&pca9468->timer_work,
				msecs_to_jiffies(pca9468->timer_period));

		pr_debug("%s: timer_id=%d, time_period=%ld\n", __func__,
			 pca9468->timer_id, pca9468->timer_period);
	}
	pca9468->last_update_time = current_time;
}
#endif

static int pca9468_suspend(struct device *dev)
{
	struct pca9468_charger *pca9468 = dev_get_drvdata(dev);

	pr_debug("%s: cancel delayed work\n", __func__);

	/* cancel delayed_work */
	cancel_delayed_work(&pca9468->timer_work);
	return 0;
}

static int pca9468_resume(struct device *dev)
{
	struct pca9468_charger *pca9468 = dev_get_drvdata(dev);

	pr_debug("%s: update_timer\n", __func__);

	/* Update the current timer */
#ifdef CONFIG_RTC_HCTOSYS
	pca9468_check_and_update_charging_timer(pca9468);
#else
	if (pca9468->timer_id != TIMER_ID_NONE) {
		mutex_lock(&pca9468->lock);
		pca9468->timer_period = 0;	/* ms unit */
		mutex_unlock(&pca9468->lock);
		schedule_delayed_work(&pca9468->timer_work,
				      msecs_to_jiffies(pca9468->timer_period));
	}
#endif
	return 0;
}
#else
#define pca9468_suspend		NULL
#define pca9468_resume		NULL
#endif

const struct dev_pm_ops pca9468_pm_ops = {
	.suspend = pca9468_suspend,
	.resume = pca9468_resume,
};

static struct i2c_driver pca9468_driver = {
	.driver = {
		.name = "pca9468",
#if defined(CONFIG_OF)
		.of_match_table = pca9468_i2c_dt_ids,
#endif /* CONFIG_OF */
#if defined(CONFIG_PM)
		.pm = &pca9468_pm_ops,
#endif
	},
	.probe        = pca9468_probe,
	.remove       = pca9468_remove,
	.id_table     = pca9468_id,
};

module_i2c_driver(pca9468_driver);

MODULE_AUTHOR("Clark Kim <clark.kim@nxp.com>");
MODULE_AUTHOR("AleX Pelosi <apelosi@google.com>");
MODULE_AUTHOR("Wasb Liu <wasbliu@google.com>");
MODULE_DESCRIPTION("PCA9468 gcharger driver");
MODULE_LICENSE("GPL");
MODULE_VERSION("3.7.0");
