/*
 * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * Qualcomm's PM8921/PM8018 ADC Arbiter driver
 */
#define pr_fmt(fmt) "%s: " fmt, __func__

#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/hwmon.h>
#include <linux/module.h>
#include <linux/debugfs.h>
#include <linux/wakelock.h>
#include <linux/interrupt.h>
#include <linux/completion.h>
#include <linux/hwmon-sysfs.h>
#include <linux/mfd/pm8xxx/mpp.h>
#include <linux/platform_device.h>
#include <linux/mfd/pm8xxx/core.h>
#include <linux/regulator/consumer.h>
#include <linux/mfd/pm8xxx/pm8xxx-adc.h>

/* User Bank register set */
#define PM8XXX_ADC_ARB_USRP_CNTRL1			0x197
#define PM8XXX_ADC_ARB_USRP_CNTRL1_EN_ARB		BIT(0)
#define PM8XXX_ADC_ARB_USRP_CNTRL1_RSV1			BIT(1)
#define PM8XXX_ADC_ARB_USRP_CNTRL1_RSV2			BIT(2)
#define PM8XXX_ADC_ARB_USRP_CNTRL1_RSV3			BIT(3)
#define PM8XXX_ADC_ARB_USRP_CNTRL1_RSV4			BIT(4)
#define PM8XXX_ADC_ARB_USRP_CNTRL1_RSV5			BIT(5)
#define PM8XXX_ADC_ARB_USRP_CNTRL1_EOC			BIT(6)
#define PM8XXX_ADC_ARB_USRP_CNTRL1_REQ			BIT(7)

#define PM8XXX_ADC_ARB_USRP_AMUX_CNTRL			0x198
#define PM8XXX_ADC_ARB_USRP_AMUX_CNTRL_RSV0		BIT(0)
#define PM8XXX_ADC_ARB_USRP_AMUX_CNTRL_RSV1		BIT(1)
#define PM8XXX_ADC_ARB_USRP_AMUX_CNTRL_PREMUX0		BIT(2)
#define PM8XXX_ADC_ARB_USRP_AMUX_CNTRL_PREMUX1		BIT(3)
#define PM8XXX_ADC_ARB_USRP_AMUX_CNTRL_SEL0		BIT(4)
#define PM8XXX_ADC_ARB_USRP_AMUX_CNTRL_SEL1		BIT(5)
#define PM8XXX_ADC_ARB_USRP_AMUX_CNTRL_SEL2		BIT(6)
#define PM8XXX_ADC_ARB_USRP_AMUX_CNTRL_SEL3		BIT(7)

#define PM8XXX_ADC_ARB_USRP_ANA_PARAM			0x199
#define PM8XXX_ADC_ARB_USRP_DIG_PARAM			0x19A
#define PM8XXX_ADC_ARB_USRP_DIG_PARAM_SEL_SHIFT0	BIT(0)
#define PM8XXX_ADC_ARB_USRP_DIG_PARAM_SEL_SHIFT1	BIT(1)
#define PM8XXX_ADC_ARB_USRP_DIG_PARAM_CLK_RATE0		BIT(2)
#define PM8XXX_ADC_ARB_USRP_DIG_PARAM_CLK_RATE1		BIT(3)
#define PM8XXX_ADC_ARB_USRP_DIG_PARAM_EOC		BIT(4)
#define PM8XXX_ADC_ARB_USRP_DIG_PARAM_DEC_RATE0		BIT(5)
#define PM8XXX_ADC_ARB_USRP_DIG_PARAM_DEC_RATE1		BIT(6)
#define PM8XXX_ADC_ARB_USRP_DIG_PARAM_EN		BIT(7)

#define PM8XXX_ADC_ARB_USRP_RSV				0x19B
#define PM8XXX_ADC_ARB_USRP_RSV_RST			BIT(0)
#define PM8XXX_ADC_ARB_USRP_RSV_DTEST0			BIT(1)
#define PM8XXX_ADC_ARB_USRP_RSV_DTEST1			BIT(2)
#define PM8XXX_ADC_ARB_USRP_RSV_OP			BIT(3)
#define PM8XXX_ADC_ARB_USRP_RSV_IP_SEL0			BIT(4)
#define PM8XXX_ADC_ARB_USRP_RSV_IP_SEL1			BIT(5)
#define PM8XXX_ADC_ARB_USRP_RSV_IP_SEL2			BIT(6)
#define PM8XXX_ADC_ARB_USRP_RSV_TRM			BIT(7)

#define PM8XXX_ADC_ARB_USRP_DATA0			0x19D
#define PM8XXX_ADC_ARB_USRP_DATA1			0x19C

#define PM8XXX_ADC_ARB_BTM_CNTRL1			0x17e
#define PM8XXX_ADC_ARB_BTM_CNTRL1_EN_BTM		BIT(0)
#define PM8XXX_ADC_ARB_BTM_CNTRL1_SEL_OP_MODE		BIT(1)
#define PM8XXX_ADC_ARB_BTM_CNTRL1_MEAS_INTERVAL1	BIT(2)
#define PM8XXX_ADC_ARB_BTM_CNTRL1_MEAS_INTERVAL2	BIT(3)
#define PM8XXX_ADC_ARB_BTM_CNTRL1_MEAS_INTERVAL3	BIT(4)
#define PM8XXX_ADC_ARB_BTM_CNTRL1_MEAS_INTERVAL4	BIT(5)
#define PM8XXX_ADC_ARB_BTM_CNTRL1_EOC			BIT(6)
#define PM8XXX_ADC_ARB_BTM_CNTRL1_REQ			BIT(7)

#define PM8XXX_ADC_ARB_BTM_CNTRL2			0x18c
#define PM8XXX_ADC_ARB_BTM_AMUX_CNTRL			0x17f
#define PM8XXX_ADC_ARB_BTM_ANA_PARAM			0x180
#define PM8XXX_ADC_ARB_BTM_DIG_PARAM			0x181
#define PM8XXX_ADC_ARB_BTM_RSV				0x182
#define PM8XXX_ADC_ARB_BTM_DATA1			0x183
#define PM8XXX_ADC_ARB_BTM_DATA0			0x184
#define PM8XXX_ADC_ARB_BTM_BAT_COOL_THR1		0x185
#define PM8XXX_ADC_ARB_BTM_BAT_COOL_THR0		0x186
#define PM8XXX_ADC_ARB_BTM_BAT_WARM_THR1		0x187
#define PM8XXX_ADC_ARB_BTM_BAT_WARM_THR0		0x188

#define PM8XXX_ADC_ARB_ANA_DIG				0xa0
#define PM8XXX_ADC_BTM_RSV				0x10
#define PM8XXX_ADC_AMUX_MPP_SEL				2
#define PM8XXX_ADC_AMUX_SEL				4
#define PM8XXX_ADC_RSV_IP_SEL				4
#define PM8XXX_ADC_BTM_CHANNEL_SEL			4
#define PM8XXX_MAX_CHANNEL_PROPERTIES			2
#define PM8XXX_ADC_IRQ_0				0
#define PM8XXX_ADC_IRQ_1				1
#define PM8XXX_ADC_IRQ_2				2
#define PM8XXX_ADC_BTM_INTERVAL_SEL_MASK		0xF
#define PM8XXX_ADC_BTM_INTERVAL_SEL_SHIFT		2
#define PM8XXX_ADC_BTM_DECIMATION_SEL			5
#define PM8XXX_ADC_MUL					10
#define PM8XXX_ADC_CONV_TIME_MIN			2000
#define PM8XXX_ADC_CONV_TIME_MAX			2100
#define PM8XXX_ADC_MPP_SETTLE_TIME_MIN			200
#define PM8XXX_ADC_MPP_SETTLE_TIME_MAX			200
#define PM8XXX_ADC_PA_THERM_VREG_UV_MIN			1800000
#define PM8XXX_ADC_PA_THERM_VREG_UV_MAX			1800000
#define PM8XXX_ADC_PA_THERM_VREG_UA_LOAD		100000
#define PM8XXX_ADC_HWMON_NAME_LENGTH			32
#define PM8XXX_ADC_BTM_INTERVAL_MAX			0x14

struct pm8xxx_adc {
	struct device				*dev;
	struct pm8xxx_adc_properties		*adc_prop;
	int					adc_irq;
	struct mutex				adc_lock;
	struct mutex				mpp_adc_lock;
	spinlock_t				btm_lock;
	uint32_t				adc_num_board_channel;
	struct completion			adc_rslt_completion;
	struct pm8xxx_adc_amux			*adc_channel;
	int					btm_warm_irq;
	int					btm_cool_irq;
	struct dentry				*dent;
	struct work_struct			warm_work;
	struct work_struct			cool_work;
	uint32_t				mpp_base;
	struct device				*hwmon;
	struct wake_lock			adc_wakelock;
	int					msm_suspend_check;
	struct pm8xxx_adc_amux_properties	*conv;
	struct pm8xxx_adc_arb_btm_param		batt;
	struct sensor_device_attribute		sens_attr[0];
};

struct pm8xxx_adc_amux_properties {
	uint32_t				amux_channel;
	uint32_t				decimation;
	uint32_t				amux_ip_rsv;
	uint32_t				amux_mpp_channel;
	struct pm8xxx_adc_chan_properties	chan_prop[0];
};

static const struct pm8xxx_adc_scaling_ratio pm8xxx_amux_scaling_ratio[] = {
	{1, 1},
	{1, 3},
	{1, 4},
	{1, 6}
};

static struct pm8xxx_adc *pmic_adc;
static struct regulator *pa_therm;

static struct pm8xxx_adc_scale_fn adc_scale_fn[] = {
	[ADC_SCALE_DEFAULT] = {pm8xxx_adc_scale_default},
	[ADC_SCALE_BATT_THERM] = {pm8xxx_adc_scale_batt_therm},
	[ADC_SCALE_PA_THERM] = {pm8xxx_adc_scale_pa_therm},
	[ADC_SCALE_PMIC_THERM] = {pm8xxx_adc_scale_pmic_therm},
	[ADC_SCALE_XOTHERM] = {pm8xxx_adc_tdkntcg_therm},
};

/* On PM8921 ADC the MPP needs to first be configured
as an analog input to the AMUX pre-mux channel before
issuing a read request. PM8921 MPP 8 is mapped to AMUX8
and is common between remote processor's.
On PM8018 ADC the MPP is directly connected to the AMUX
pre-mux. Therefore clients of the PM8018 MPP do not need
to configure the MPP as an analog input to the pre-mux.
Clients can directly issue request on the pre-mux AMUX
channel to read the ADC on the MPP */
static struct pm8xxx_mpp_config_data pm8xxx_adc_mpp_config = {
	.type		= PM8XXX_MPP_TYPE_A_INPUT,
	/* AMUX6 is dedicated to be used for apps processor */
	.level		= PM8XXX_MPP_AIN_AMUX_CH6,
	.control	= PM8XXX_MPP_AOUT_CTRL_DISABLE,
};

/* MPP Configuration for default settings */
static struct pm8xxx_mpp_config_data pm8xxx_adc_mpp_unconfig = {
	.type		= PM8XXX_MPP_TYPE_SINK,
	.level		= PM8XXX_MPP_AIN_AMUX_CH5,
	.control	= PM8XXX_MPP_AOUT_CTRL_DISABLE,
};

static bool pm8xxx_adc_calib_first_adc;
static bool pm8xxx_adc_initialized, pm8xxx_adc_calib_device_init;

static int32_t pm8xxx_adc_check_channel_valid(uint32_t channel)
{
	if (channel < CHANNEL_VCOIN ||
	(channel > CHANNEL_MUXOFF && channel < ADC_MPP_1_ATEST_8) ||
	(channel > ADC_MPP_1_ATEST_7 && channel < ADC_MPP_2_ATEST_8)
	|| (channel >= ADC_CHANNEL_MAX_NUM))
		return -EBADF;
	else
		return 0;
}

static int32_t pm8xxx_adc_arb_cntrl(uint32_t arb_cntrl,
					uint32_t channel)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;
	int i, rc;
	u8 data_arb_cntrl = 0;

	if (arb_cntrl) {
		if (adc_pmic->msm_suspend_check)
			pr_err("PM8xxx ADC request made after suspend_noirq "
					"with channel: %d\n", channel);
		data_arb_cntrl |= PM8XXX_ADC_ARB_USRP_CNTRL1_EN_ARB;
		wake_lock(&adc_pmic->adc_wakelock);
	}

	/* Write twice to the CNTRL register for the arbiter settings
	   to take into effect */
	for (i = 0; i < 2; i++) {
		rc = pm8xxx_writeb(adc_pmic->dev->parent,
				PM8XXX_ADC_ARB_USRP_CNTRL1, data_arb_cntrl);
		if (rc < 0) {
			pr_err("PM8xxx arb cntrl write failed with %d\n", rc);
			return rc;
		}
	}

	if (arb_cntrl) {
		data_arb_cntrl |= PM8XXX_ADC_ARB_USRP_CNTRL1_REQ;
		INIT_COMPLETION(adc_pmic->adc_rslt_completion);
		rc = pm8xxx_writeb(adc_pmic->dev->parent,
			PM8XXX_ADC_ARB_USRP_CNTRL1, data_arb_cntrl);
	} else
		wake_unlock(&adc_pmic->adc_wakelock);

	return 0;
}

static int32_t pm8xxx_adc_patherm_power(bool on)
{
	int rc = 0;

	if (!pa_therm) {
		pr_err("pm8xxx adc pa_therm not valid\n");
		return -EINVAL;
	}

	if (on) {
		rc = regulator_set_voltage(pa_therm,
				PM8XXX_ADC_PA_THERM_VREG_UV_MIN,
				PM8XXX_ADC_PA_THERM_VREG_UV_MAX);
		if (rc < 0) {
			pr_err("failed to set the voltage for "
					"pa_therm with error %d\n", rc);
			return rc;
		}

		rc = regulator_set_optimum_mode(pa_therm,
				PM8XXX_ADC_PA_THERM_VREG_UA_LOAD);
		if (rc < 0) {
			pr_err("failed to set optimum mode for "
					"pa_therm with error %d\n", rc);
			return rc;
		}

		rc = regulator_enable(pa_therm);
		if (rc < 0) {
			pr_err("failed to enable pa_therm vreg "
					"with error %d\n", rc);
			return rc;
		}
	} else {
		rc = regulator_disable(pa_therm);
		if (rc < 0) {
			pr_err("failed to disable pa_therm vreg "
					"with error %d\n", rc);
			return rc;
		}
	}

	return rc;
}

static int32_t pm8xxx_adc_channel_power_enable(uint32_t channel,
							bool power_cntrl)
{
	int rc = 0;

	switch (channel)
	case ADC_MPP_1_AMUX8:
		rc = pm8xxx_adc_patherm_power(power_cntrl);

	return rc;
}


static uint32_t pm8xxx_adc_read_reg(uint32_t reg, u8 *data)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;
	int rc;

	rc = pm8xxx_readb(adc_pmic->dev->parent, reg, data);
	if (rc < 0) {
		pr_err("PM8xxx adc read reg %d failed with %d\n", reg, rc);
		return rc;
	}

	return 0;
}

static uint32_t pm8xxx_adc_write_reg(uint32_t reg, u8 data)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;
	int rc;

	rc = pm8xxx_writeb(adc_pmic->dev->parent, reg, data);
	if (rc < 0) {
		pr_err("PM8xxx adc write reg %d failed with %d\n", reg, rc);
		return rc;
	}

	return 0;
}

static int32_t pm8xxx_adc_configure(
				struct pm8xxx_adc_amux_properties *chan_prop)
{
	u8 data_amux_chan = 0, data_arb_rsv = 0, data_dig_param = 0;
	int rc;

	data_amux_chan |= chan_prop->amux_channel << PM8XXX_ADC_AMUX_SEL;

	if (chan_prop->amux_mpp_channel)
		data_amux_chan |= chan_prop->amux_mpp_channel <<
					PM8XXX_ADC_AMUX_MPP_SEL;

	rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_USRP_AMUX_CNTRL,
							data_amux_chan);
	if (rc < 0)
		return rc;

	rc = pm8xxx_adc_read_reg(PM8XXX_ADC_ARB_USRP_RSV, &data_arb_rsv);
	if (rc < 0)
		return rc;

	data_arb_rsv &= (PM8XXX_ADC_ARB_USRP_RSV_RST |
		PM8XXX_ADC_ARB_USRP_RSV_DTEST0 |
		PM8XXX_ADC_ARB_USRP_RSV_DTEST1 |
		PM8XXX_ADC_ARB_USRP_RSV_OP);
	data_arb_rsv |= (chan_prop->amux_ip_rsv << PM8XXX_ADC_RSV_IP_SEL |
				PM8XXX_ADC_ARB_USRP_RSV_TRM);

	rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_USRP_RSV, data_arb_rsv);
	if (rc < 0)
		return rc;

	rc = pm8xxx_adc_read_reg(PM8XXX_ADC_ARB_USRP_DIG_PARAM,
							&data_dig_param);
	if (rc < 0)
		return rc;

	/* Default 2.4Mhz clock rate */
	/* Client chooses the decimation */
	switch (chan_prop->decimation) {
	case ADC_DECIMATION_TYPE1:
		data_dig_param |= PM8XXX_ADC_ARB_USRP_DIG_PARAM_DEC_RATE0;
		break;
	case ADC_DECIMATION_TYPE2:
		data_dig_param |= (PM8XXX_ADC_ARB_USRP_DIG_PARAM_DEC_RATE0
				| PM8XXX_ADC_ARB_USRP_DIG_PARAM_DEC_RATE1);
		break;
	default:
		data_dig_param |= PM8XXX_ADC_ARB_USRP_DIG_PARAM_DEC_RATE0;
		break;
	}
	rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_USRP_DIG_PARAM,
						PM8XXX_ADC_ARB_ANA_DIG);
	if (rc < 0)
		return rc;

	rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_USRP_ANA_PARAM,
						PM8XXX_ADC_ARB_ANA_DIG);
	if (rc < 0)
		return rc;

	rc = pm8xxx_adc_arb_cntrl(1, data_amux_chan);
	if (rc < 0) {
		pr_err("Configuring ADC Arbiter"
				"enable failed with %d\n", rc);
		return rc;
	}

	return 0;
}

static uint32_t pm8xxx_adc_read_adc_code(int32_t *data)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;
	uint8_t rslt_lsb, rslt_msb;
	int32_t rc, max_ideal_adc_code = 1 << adc_pmic->adc_prop->bitresolution;

	rc = pm8xxx_readb(adc_pmic->dev->parent,
				PM8XXX_ADC_ARB_USRP_DATA0, &rslt_lsb);
	if (rc < 0) {
		pr_err("PM8xxx adc result read failed with %d\n", rc);
		return rc;
	}

	rc = pm8xxx_readb(adc_pmic->dev->parent,
				PM8XXX_ADC_ARB_USRP_DATA1, &rslt_msb);
	if (rc < 0) {
		pr_err("PM8xxx adc result read failed with %d\n", rc);
		return rc;
	}

	*data = (rslt_msb << 8) | rslt_lsb;

	/* Use the midpoint to determine underflow or overflow */
	if (*data > max_ideal_adc_code + (max_ideal_adc_code >> 1))
		*data |= ((1 << (8 * sizeof(*data) -
			adc_pmic->adc_prop->bitresolution)) - 1) <<
			adc_pmic->adc_prop->bitresolution;

	/* Default value for switching off the arbiter after reading
	   the ADC value. Bit 0 set to 0. */
	rc = pm8xxx_adc_arb_cntrl(0, CHANNEL_NONE);
	if (rc < 0) {
		pr_err("%s: Configuring ADC Arbiter disable"
					"failed\n", __func__);
		return rc;
	}

	return 0;
}

static void pm8xxx_adc_btm_warm_scheduler_fn(struct work_struct *work)
{
	struct pm8xxx_adc *adc_pmic = container_of(work, struct pm8xxx_adc,
					warm_work);
	unsigned long flags = 0;
	bool warm_status;

	spin_lock_irqsave(&adc_pmic->btm_lock, flags);
	warm_status = irq_read_line(adc_pmic->btm_warm_irq);
	if (adc_pmic->batt.btm_warm_fn != NULL)
		adc_pmic->batt.btm_warm_fn(warm_status);
	spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);
}

static void pm8xxx_adc_btm_cool_scheduler_fn(struct work_struct *work)
{
	struct pm8xxx_adc *adc_pmic = container_of(work, struct pm8xxx_adc,
					cool_work);
	unsigned long flags = 0;
	bool cool_status;

	spin_lock_irqsave(&adc_pmic->btm_lock, flags);
	cool_status = irq_read_line(adc_pmic->btm_cool_irq);
	if (adc_pmic->batt.btm_cool_fn != NULL)
		adc_pmic->batt.btm_cool_fn(cool_status);
	spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);
}

void trigger_completion(struct work_struct *work)
{
	struct pm8xxx_adc *adc_8xxx = pmic_adc;

	complete(&adc_8xxx->adc_rslt_completion);
}
DECLARE_WORK(trigger_completion_work, trigger_completion);

static irqreturn_t pm8xxx_adc_isr(int irq, void *dev_id)
{

	if (pm8xxx_adc_calib_first_adc)
		return IRQ_HANDLED;

	schedule_work(&trigger_completion_work);

	return IRQ_HANDLED;
}

static irqreturn_t pm8xxx_btm_warm_isr(int irq, void *dev_id)
{
	struct pm8xxx_adc *btm_8xxx = dev_id;

	schedule_work(&btm_8xxx->warm_work);

	return IRQ_HANDLED;
}

static irqreturn_t pm8xxx_btm_cool_isr(int irq, void *dev_id)
{
	struct pm8xxx_adc *btm_8xxx = dev_id;

	schedule_work(&btm_8xxx->cool_work);

	return IRQ_HANDLED;
}

static uint32_t pm8xxx_adc_calib_device(void)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;
	struct pm8xxx_adc_amux_properties conv;
	int rc, calib_read_1, calib_read_2;
	u8 data_arb_usrp_cntrl1 = 0;

	conv.amux_channel = CHANNEL_125V;
	conv.decimation = ADC_DECIMATION_TYPE2;
	conv.amux_ip_rsv = AMUX_RSV1;
	conv.amux_mpp_channel = PREMUX_MPP_SCALE_0;
	pm8xxx_adc_calib_first_adc = true;
	rc = pm8xxx_adc_configure(&conv);
	if (rc) {
		pr_err("pm8xxx_adc configure failed with %d\n", rc);
		goto calib_fail;
	}

	while (data_arb_usrp_cntrl1 != (PM8XXX_ADC_ARB_USRP_CNTRL1_EOC |
					PM8XXX_ADC_ARB_USRP_CNTRL1_EN_ARB)) {
		rc = pm8xxx_adc_read_reg(PM8XXX_ADC_ARB_USRP_CNTRL1,
					&data_arb_usrp_cntrl1);
		if (rc < 0)
			return rc;
		usleep_range(PM8XXX_ADC_CONV_TIME_MIN,
					PM8XXX_ADC_CONV_TIME_MAX);
	}
	data_arb_usrp_cntrl1 = 0;

	rc = pm8xxx_adc_read_adc_code(&calib_read_1);
	if (rc) {
		pr_err("pm8xxx_adc read adc failed with %d\n", rc);
		pm8xxx_adc_calib_first_adc = false;
		goto calib_fail;
	}
	pm8xxx_adc_calib_first_adc = false;

	conv.amux_channel = CHANNEL_625MV;
	conv.decimation = ADC_DECIMATION_TYPE2;
	conv.amux_ip_rsv = AMUX_RSV1;
	conv.amux_mpp_channel = PREMUX_MPP_SCALE_0;
	pm8xxx_adc_calib_first_adc = true;
	rc = pm8xxx_adc_configure(&conv);
	if (rc) {
		pr_err("pm8xxx_adc configure failed with %d\n", rc);
		goto calib_fail;
	}

	while (data_arb_usrp_cntrl1 != (PM8XXX_ADC_ARB_USRP_CNTRL1_EOC |
					PM8XXX_ADC_ARB_USRP_CNTRL1_EN_ARB)) {
		rc = pm8xxx_adc_read_reg(PM8XXX_ADC_ARB_USRP_CNTRL1,
					&data_arb_usrp_cntrl1);
		if (rc < 0)
			return rc;
		usleep_range(PM8XXX_ADC_CONV_TIME_MIN,
					PM8XXX_ADC_CONV_TIME_MAX);
	}
	data_arb_usrp_cntrl1 = 0;

	rc = pm8xxx_adc_read_adc_code(&calib_read_2);
	if (rc) {
		pr_err("pm8xxx_adc read adc failed with %d\n", rc);
		pm8xxx_adc_calib_first_adc = false;
		goto calib_fail;
	}
	pm8xxx_adc_calib_first_adc = false;

	adc_pmic->conv->chan_prop->adc_graph[ADC_CALIB_ABSOLUTE].dy =
					(calib_read_1 - calib_read_2);
	adc_pmic->conv->chan_prop->adc_graph[ADC_CALIB_ABSOLUTE].dx
						= PM8XXX_CHANNEL_ADC_625_UV;
	adc_pmic->conv->chan_prop->adc_graph[ADC_CALIB_ABSOLUTE].adc_vref =
					calib_read_1;
	adc_pmic->conv->chan_prop->adc_graph[ADC_CALIB_ABSOLUTE].adc_gnd =
					calib_read_2;
	rc = pm8xxx_adc_arb_cntrl(0, CHANNEL_NONE);
	if (rc < 0) {
		pr_err("%s: Configuring ADC Arbiter disable"
					"failed\n", __func__);
		return rc;
	}
	/* Ratiometric Calibration */
	conv.amux_channel = CHANNEL_MUXOFF;
	conv.decimation = ADC_DECIMATION_TYPE2;
	conv.amux_ip_rsv = AMUX_RSV5;
	conv.amux_mpp_channel = PREMUX_MPP_SCALE_0;
	pm8xxx_adc_calib_first_adc = true;
	rc = pm8xxx_adc_configure(&conv);
	if (rc) {
		pr_err("pm8xxx_adc configure failed with %d\n", rc);
		goto calib_fail;
	}

	while (data_arb_usrp_cntrl1 != (PM8XXX_ADC_ARB_USRP_CNTRL1_EOC |
					PM8XXX_ADC_ARB_USRP_CNTRL1_EN_ARB)) {
		rc = pm8xxx_adc_read_reg(PM8XXX_ADC_ARB_USRP_CNTRL1,
					&data_arb_usrp_cntrl1);
		if (rc < 0)
			return rc;
		usleep_range(PM8XXX_ADC_CONV_TIME_MIN,
					PM8XXX_ADC_CONV_TIME_MAX);
	}
	data_arb_usrp_cntrl1 = 0;

	rc = pm8xxx_adc_read_adc_code(&calib_read_1);
	if (rc) {
		pr_err("pm8xxx_adc read adc failed with %d\n", rc);
		pm8xxx_adc_calib_first_adc = false;
		goto calib_fail;
	}
	pm8xxx_adc_calib_first_adc = false;

	conv.amux_channel = CHANNEL_MUXOFF;
	conv.decimation = ADC_DECIMATION_TYPE2;
	conv.amux_ip_rsv = AMUX_RSV4;
	conv.amux_mpp_channel = PREMUX_MPP_SCALE_0;
	pm8xxx_adc_calib_first_adc = true;
	rc = pm8xxx_adc_configure(&conv);
	if (rc) {
		pr_err("pm8xxx_adc configure failed with %d\n", rc);
		goto calib_fail;
	}

	while (data_arb_usrp_cntrl1 != (PM8XXX_ADC_ARB_USRP_CNTRL1_EOC |
					PM8XXX_ADC_ARB_USRP_CNTRL1_EN_ARB)) {
		rc = pm8xxx_adc_read_reg(PM8XXX_ADC_ARB_USRP_CNTRL1,
					&data_arb_usrp_cntrl1);
		if (rc < 0)
			return rc;
		usleep_range(PM8XXX_ADC_CONV_TIME_MIN,
					PM8XXX_ADC_CONV_TIME_MAX);
	}
	data_arb_usrp_cntrl1 = 0;

	rc = pm8xxx_adc_read_adc_code(&calib_read_2);
	if (rc) {
		pr_err("pm8xxx_adc read adc failed with %d\n", rc);
		pm8xxx_adc_calib_first_adc = false;
		goto calib_fail;
	}
	pm8xxx_adc_calib_first_adc = false;

	adc_pmic->conv->chan_prop->adc_graph[ADC_CALIB_RATIOMETRIC].dy =
					(calib_read_1 - calib_read_2);
	adc_pmic->conv->chan_prop->adc_graph[ADC_CALIB_RATIOMETRIC].dx =
					adc_pmic->adc_prop->adc_vdd_reference;
	adc_pmic->conv->chan_prop->adc_graph[ADC_CALIB_RATIOMETRIC].adc_vref =
					calib_read_1;
	adc_pmic->conv->chan_prop->adc_graph[ADC_CALIB_RATIOMETRIC].adc_gnd =
					calib_read_2;
calib_fail:
	rc = pm8xxx_adc_arb_cntrl(0, CHANNEL_NONE);
	if (rc < 0) {
		pr_err("%s: Configuring ADC Arbiter disable"
					"failed\n", __func__);
	}

	return rc;
}

uint32_t pm8xxx_adc_read(enum pm8xxx_adc_channels channel,
				struct pm8xxx_adc_chan_result *result)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;
	int i = 0, rc = 0, rc_fail, amux_prescaling, scale_type;
	enum pm8xxx_adc_premux_mpp_scale_type mpp_scale;

	if (!pm8xxx_adc_initialized)
		return -ENODEV;

	if (!pm8xxx_adc_calib_device_init) {
		if (pm8xxx_adc_calib_device() == 0)
			pm8xxx_adc_calib_device_init = true;
	}

	mutex_lock(&adc_pmic->adc_lock);

	for (i = 0; i < adc_pmic->adc_num_board_channel; i++) {
		if (channel == adc_pmic->adc_channel[i].channel_name)
			break;
	}

	if (i == adc_pmic->adc_num_board_channel ||
		(pm8xxx_adc_check_channel_valid(channel) != 0)) {
		rc = -EBADF;
		goto fail_unlock;
	}

	if (channel < PM8XXX_CHANNEL_MPP_SCALE1_IDX) {
		mpp_scale = PREMUX_MPP_SCALE_0;
		adc_pmic->conv->amux_channel = channel;
	} else if (channel >= PM8XXX_CHANNEL_MPP_SCALE1_IDX &&
			channel < PM8XXX_CHANNEL_MPP_SCALE3_IDX) {
		mpp_scale = PREMUX_MPP_SCALE_1;
		adc_pmic->conv->amux_channel = channel %
				PM8XXX_CHANNEL_MPP_SCALE1_IDX;
	} else {
		mpp_scale = PREMUX_MPP_SCALE_1_DIV3;
		adc_pmic->conv->amux_channel = channel %
				PM8XXX_CHANNEL_MPP_SCALE3_IDX;
	}

	adc_pmic->conv->amux_mpp_channel = mpp_scale;
	adc_pmic->conv->amux_ip_rsv = adc_pmic->adc_channel[i].adc_rsv;
	adc_pmic->conv->decimation = adc_pmic->adc_channel[i].adc_decimation;
	amux_prescaling = adc_pmic->adc_channel[i].chan_path_prescaling;

	adc_pmic->conv->chan_prop->offset_gain_numerator =
		pm8xxx_amux_scaling_ratio[amux_prescaling].num;
	adc_pmic->conv->chan_prop->offset_gain_denominator =
		 pm8xxx_amux_scaling_ratio[amux_prescaling].den;

	rc = pm8xxx_adc_channel_power_enable(channel, true);
	if (rc) {
		rc = -EINVAL;
		goto fail_unlock;
	}

	rc = pm8xxx_adc_configure(adc_pmic->conv);
	if (rc) {
		rc = -EINVAL;
		goto fail;
	}

	wait_for_completion(&adc_pmic->adc_rslt_completion);

	rc = pm8xxx_adc_read_adc_code(&result->adc_code);
	if (rc) {
		rc = -EINVAL;
		goto fail;
	}

	scale_type = adc_pmic->adc_channel[i].adc_scale_fn;
	if (scale_type >= ADC_SCALE_NONE) {
		rc = -EBADF;
		goto fail;
	}

	adc_scale_fn[scale_type].chan(result->adc_code,
			adc_pmic->adc_prop, adc_pmic->conv->chan_prop, result);

	rc = pm8xxx_adc_channel_power_enable(channel, false);
	if (rc) {
		rc = -EINVAL;
		goto fail_unlock;
	}

	mutex_unlock(&adc_pmic->adc_lock);

	return 0;
fail:
	rc_fail = pm8xxx_adc_channel_power_enable(channel, false);
	if (rc_fail)
		pr_err("pm8xxx adc power disable failed\n");
fail_unlock:
	mutex_unlock(&adc_pmic->adc_lock);
	pr_err("pm8xxx adc error with %d\n", rc);
	return rc;
}
EXPORT_SYMBOL_GPL(pm8xxx_adc_read);

uint32_t pm8xxx_adc_mpp_config_read(uint32_t mpp_num,
			enum pm8xxx_adc_channels channel,
			struct pm8xxx_adc_chan_result *result)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;
	int rc = 0;

	if (!pm8xxx_adc_initialized)
		return -ENODEV;

	if (!adc_pmic->mpp_base) {
		rc = -EINVAL;
		pr_info("PM8xxx MPP base invalid with error %d\n", rc);
		return rc;
	}

	if (mpp_num == PM8XXX_AMUX_MPP_8) {
		rc = -EINVAL;
		pr_info("PM8xxx MPP8 is already configured "
			"to AMUX8. Use pm8xxx_adc_read() instead.\n");
		return rc;
	}

	mutex_lock(&adc_pmic->mpp_adc_lock);

	rc = pm8xxx_mpp_config(((mpp_num - 1) + adc_pmic->mpp_base),
					&pm8xxx_adc_mpp_config);
	if (rc < 0) {
		pr_err("pm8xxx adc mpp config error with %d\n", rc);
		goto fail;
	}

	usleep_range(PM8XXX_ADC_MPP_SETTLE_TIME_MIN,
					PM8XXX_ADC_MPP_SETTLE_TIME_MAX);

	rc = pm8xxx_adc_read(channel, result);
	if (rc < 0)
		pr_err("pm8xxx adc read error with %d\n", rc);

	rc = pm8xxx_mpp_config(((mpp_num - 1) + adc_pmic->mpp_base),
					&pm8xxx_adc_mpp_unconfig);
	if (rc < 0)
		pr_err("pm8xxx adc mpp config error with %d\n", rc);
fail:
	mutex_unlock(&adc_pmic->mpp_adc_lock);

	return rc;
}
EXPORT_SYMBOL_GPL(pm8xxx_adc_mpp_config_read);

uint32_t pm8xxx_adc_btm_configure(struct pm8xxx_adc_arb_btm_param *btm_param)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;
	u8 data_btm_cool_thr0, data_btm_cool_thr1;
	u8 data_btm_warm_thr0, data_btm_warm_thr1;
	u8 arb_btm_cntrl1;
	unsigned long flags = 0;
	int rc;

	if (adc_pmic == NULL) {
		pr_err("PMIC ADC not valid\n");
		return -EINVAL;
	}

	if ((btm_param->btm_cool_fn == NULL) &&
		(btm_param->btm_warm_fn == NULL)) {
		pr_err("No BTM warm/cool notification??\n");
		return -EINVAL;
	}

	rc = pm8xxx_adc_batt_scaler(btm_param, adc_pmic->adc_prop,
					adc_pmic->conv->chan_prop);
	if (rc < 0) {
		pr_err("Failed to lookup the BTM thresholds\n");
		return rc;
	}

	if (btm_param->interval > PM8XXX_ADC_BTM_INTERVAL_MAX) {
		pr_info("Bug in PMIC BTM interval time and cannot set"
		" a value greater than 0x14 %x\n", btm_param->interval);
		btm_param->interval = PM8XXX_ADC_BTM_INTERVAL_MAX;
	}

	spin_lock_irqsave(&adc_pmic->btm_lock, flags);

	data_btm_cool_thr0 = ((btm_param->low_thr_voltage << 24) >> 24);
	data_btm_cool_thr1 = ((btm_param->low_thr_voltage << 16) >> 24);
	data_btm_warm_thr0 = ((btm_param->high_thr_voltage << 24) >> 24);
	data_btm_warm_thr1 = ((btm_param->high_thr_voltage << 16) >> 24);

	if (btm_param->btm_cool_fn != NULL) {
		rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_BTM_BAT_COOL_THR0,
							data_btm_cool_thr0);
		if (rc < 0)
			goto write_err;

		rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_BTM_BAT_COOL_THR1,
							data_btm_cool_thr1);
		if (rc < 0)
			goto write_err;

		adc_pmic->batt.btm_cool_fn = btm_param->btm_cool_fn;
	}

	if (btm_param->btm_warm_fn != NULL) {
		rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_BTM_BAT_WARM_THR0,
							data_btm_warm_thr0);
		if (rc < 0)
			goto write_err;

		rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_BTM_BAT_WARM_THR1,
							data_btm_warm_thr1);
		if (rc < 0)
			goto write_err;

		adc_pmic->batt.btm_warm_fn = btm_param->btm_warm_fn;
	}

	rc = pm8xxx_adc_read_reg(PM8XXX_ADC_ARB_BTM_CNTRL1, &arb_btm_cntrl1);
	if (rc < 0)
		goto bail_out;

	btm_param->interval &= PM8XXX_ADC_BTM_INTERVAL_SEL_MASK;
	arb_btm_cntrl1 |=
		btm_param->interval << PM8XXX_ADC_BTM_INTERVAL_SEL_SHIFT;

	rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_BTM_CNTRL1, arb_btm_cntrl1);
	if (rc < 0)
		goto write_err;

	spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);

	return rc;
bail_out:
write_err:
	spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);
	pr_debug("%s: with error code %d\n", __func__, rc);
	return rc;
}
EXPORT_SYMBOL_GPL(pm8xxx_adc_btm_configure);

static uint32_t pm8xxx_adc_btm_read(uint32_t channel)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;
	int rc, i;
	u8 arb_btm_dig_param, arb_btm_ana_param, arb_btm_rsv;
	u8 arb_btm_amux_cntrl, data_arb_btm_cntrl = 0;
	unsigned long flags;

	arb_btm_amux_cntrl = channel << PM8XXX_ADC_BTM_CHANNEL_SEL;
	arb_btm_rsv = adc_pmic->adc_channel[channel].adc_rsv;
	arb_btm_dig_param = arb_btm_ana_param = PM8XXX_ADC_ARB_ANA_DIG;

	spin_lock_irqsave(&adc_pmic->btm_lock, flags);

	rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_BTM_AMUX_CNTRL,
						arb_btm_amux_cntrl);
	if (rc < 0)
		goto write_err;

	arb_btm_rsv = PM8XXX_ADC_BTM_RSV;

	rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_BTM_RSV, arb_btm_rsv);
	if (rc < 0)
		goto write_err;

	rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_BTM_DIG_PARAM,
						arb_btm_dig_param);
	if (rc < 0)
		goto write_err;

	rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_BTM_ANA_PARAM,
						arb_btm_ana_param);
	if (rc < 0)
		goto write_err;

	data_arb_btm_cntrl |= PM8XXX_ADC_ARB_BTM_CNTRL1_EN_BTM;

	for (i = 0; i < 2; i++) {
		rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_BTM_CNTRL1,
						data_arb_btm_cntrl);
		if (rc < 0)
			goto write_err;
	}

	data_arb_btm_cntrl |= PM8XXX_ADC_ARB_BTM_CNTRL1_REQ
				| PM8XXX_ADC_ARB_BTM_CNTRL1_SEL_OP_MODE;

	rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_BTM_CNTRL1,
					data_arb_btm_cntrl);
	if (rc < 0)
		goto write_err;

	if (pmic_adc->batt.btm_warm_fn != NULL)
		enable_irq(adc_pmic->btm_warm_irq);

	if (pmic_adc->batt.btm_cool_fn != NULL)
		enable_irq(adc_pmic->btm_cool_irq);

write_err:
	spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);
	return rc;
}

uint32_t pm8xxx_adc_btm_start(void)
{
	return pm8xxx_adc_btm_read(CHANNEL_BATT_THERM);
}
EXPORT_SYMBOL_GPL(pm8xxx_adc_btm_start);

uint32_t pm8xxx_adc_btm_end(void)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;
	int i, rc;
	u8 data_arb_btm_cntrl = 0;
	unsigned long flags;

	disable_irq_nosync(adc_pmic->btm_warm_irq);
	disable_irq_nosync(adc_pmic->btm_cool_irq);

	spin_lock_irqsave(&adc_pmic->btm_lock, flags);

	/* Write twice to the CNTRL register for the arbiter settings
	   to take into effect */
	for (i = 0; i < 2; i++) {
		rc = pm8xxx_adc_write_reg(PM8XXX_ADC_ARB_BTM_CNTRL1,
							data_arb_btm_cntrl);
		if (rc < 0) {
			spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);
			return rc;
		}
	}

	spin_unlock_irqrestore(&adc_pmic->btm_lock, flags);

	return rc;
}
EXPORT_SYMBOL_GPL(pm8xxx_adc_btm_end);

static ssize_t pm8xxx_adc_show(struct device *dev,
			struct device_attribute *devattr, char *buf)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct pm8xxx_adc_chan_result result;
	int rc = -1;

	rc = pm8xxx_adc_read(attr->index, &result);

	if (rc)
		return 0;

	return snprintf(buf, PM8XXX_ADC_HWMON_NAME_LENGTH,
		"Result:%lld Raw:%d\n", result.physical, result.adc_code);
}

static int get_adc(void *data, u64 *val)
{
	struct pm8xxx_adc_chan_result result;
	int i = (int)data;
	int rc;

	rc = pm8xxx_adc_read(i, &result);
	if (!rc)
		pr_info("ADC value raw:%x physical:%lld\n",
			result.adc_code, result.physical);
	*val = result.physical;

	return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(reg_fops, get_adc, NULL, "%llu\n");

static int get_mpp_adc(void *data, u64 *val)
{
	struct pm8xxx_adc_chan_result result;
	int i = (int)data;
	int rc;

	rc = pm8xxx_adc_mpp_config_read(i,
		ADC_MPP_1_AMUX6, &result);
	if (!rc)
		pr_info("ADC MPP value raw:%x physical:%lld\n",
			result.adc_code, result.physical);
	*val = result.physical;

	return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(reg_mpp_fops, get_mpp_adc, NULL, "%llu\n");

#ifdef CONFIG_DEBUG_FS
static void create_debugfs_entries(void)
{
	int i = 0;
	pmic_adc->dent = debugfs_create_dir("pm8xxx_adc", NULL);

	if (IS_ERR(pmic_adc->dent)) {
		pr_err("pmic adc debugfs dir not created\n");
		return;
	}

	for (i = 0; i < pmic_adc->adc_num_board_channel; i++)
		debugfs_create_file(pmic_adc->adc_channel[i].name,
			0644, pmic_adc->dent,
			(void *)pmic_adc->adc_channel[i].channel_name,
			&reg_fops);
}
#else
static inline void create_debugfs_entries(void)
{
}
#endif
static struct sensor_device_attribute pm8xxx_adc_attr =
	SENSOR_ATTR(NULL, S_IRUGO, pm8xxx_adc_show, NULL, 0);

static int32_t pm8xxx_adc_init_hwmon(struct platform_device *pdev)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;
	int rc = 0, i, channel;

	for (i = 0; i < pmic_adc->adc_num_board_channel; i++) {
		channel = adc_pmic->adc_channel[i].channel_name;
		if (pm8xxx_adc_check_channel_valid(channel)) {
			pr_err("Invalid ADC init HWMON channel: %d\n", channel);
			continue;
		}
		pm8xxx_adc_attr.index = adc_pmic->adc_channel[i].channel_name;
		pm8xxx_adc_attr.dev_attr.attr.name =
						adc_pmic->adc_channel[i].name;
		memcpy(&adc_pmic->sens_attr[i], &pm8xxx_adc_attr,
						sizeof(pm8xxx_adc_attr));
		rc = device_create_file(&pdev->dev,
				&adc_pmic->sens_attr[i].dev_attr);
		if (rc) {
			dev_err(&pdev->dev, "device_create_file failed for "
					    "dev %s\n",
					    adc_pmic->adc_channel[i].name);
			goto hwmon_err_sens;
		}
	}

	return 0;
hwmon_err_sens:
	pr_info("Init HWMON failed for pm8xxx_adc with %d\n", rc);
	return rc;
}

#ifdef CONFIG_PM
static int pm8xxx_adc_suspend_noirq(struct device *dev)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;

	adc_pmic->msm_suspend_check = 1;

	return 0;
}

static int pm8xxx_adc_resume_noirq(struct device *dev)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;

	adc_pmic->msm_suspend_check = 0;

	return 0;
}

static const struct dev_pm_ops pm8xxx_adc_dev_pm_ops = {
	.suspend_noirq = pm8xxx_adc_suspend_noirq,
	.resume_noirq = pm8xxx_adc_resume_noirq,
};

#define PM8XXX_ADC_DEV_PM_OPS	(&pm8xxx_adc_dev_pm_ops)
#else
#define PM8XXX_ADC_DEV_PM_OPS NULL
#endif

static int __devexit pm8xxx_adc_teardown(struct platform_device *pdev)
{
	struct pm8xxx_adc *adc_pmic = pmic_adc;
	int i;

	wake_lock_destroy(&adc_pmic->adc_wakelock);
	platform_set_drvdata(pdev, NULL);
	pmic_adc = NULL;
	if (!pa_therm) {
		regulator_put(pa_therm);
		pa_therm = NULL;
	}
	for (i = 0; i < adc_pmic->adc_num_board_channel; i++)
		device_remove_file(adc_pmic->dev,
				&adc_pmic->sens_attr[i].dev_attr);
	pm8xxx_adc_initialized = false;

	return 0;
}

static int __devinit pm8xxx_adc_probe(struct platform_device *pdev)
{
	const struct pm8xxx_adc_platform_data *pdata = pdev->dev.platform_data;
	struct pm8xxx_adc *adc_pmic;
	struct pm8xxx_adc_amux_properties *adc_amux_prop;
	int rc = 0;

	if (!pdata) {
		dev_err(&pdev->dev, "no platform data?\n");
		return -EINVAL;
	}

	adc_pmic = devm_kzalloc(&pdev->dev, sizeof(struct pm8xxx_adc) +
			(sizeof(struct sensor_device_attribute) *
			pdata->adc_num_board_channel), GFP_KERNEL);
	if (!adc_pmic) {
		dev_err(&pdev->dev, "Unable to allocate memory\n");
		return -ENOMEM;
	}

	adc_amux_prop = devm_kzalloc(&pdev->dev,
				sizeof(struct pm8xxx_adc_amux_properties) +
				sizeof(struct pm8xxx_adc_chan_properties)
				, GFP_KERNEL);
	if (!adc_amux_prop) {
		dev_err(&pdev->dev, "Unable to allocate memory\n");
		return -ENOMEM;
	}

	adc_pmic->dev = &pdev->dev;
	adc_pmic->adc_prop = pdata->adc_prop;
	adc_pmic->conv = adc_amux_prop;
	init_completion(&adc_pmic->adc_rslt_completion);
	adc_pmic->adc_channel = pdata->adc_channel;
	adc_pmic->adc_num_board_channel = pdata->adc_num_board_channel;
	adc_pmic->mpp_base = pdata->adc_mpp_base;

	mutex_init(&adc_pmic->adc_lock);
	mutex_init(&adc_pmic->mpp_adc_lock);
	spin_lock_init(&adc_pmic->btm_lock);

	adc_pmic->adc_irq = platform_get_irq(pdev, PM8XXX_ADC_IRQ_0);
	if (adc_pmic->adc_irq < 0)
		return adc_pmic->adc_irq;

	rc = devm_request_irq(&pdev->dev, adc_pmic->adc_irq,
				pm8xxx_adc_isr,
		IRQF_TRIGGER_RISING, "pm8xxx_adc_interrupt", adc_pmic);
	if (rc) {
		dev_err(&pdev->dev, "failed to request adc irq "
						"with error %d\n", rc);
	} else {
		enable_irq_wake(adc_pmic->adc_irq);
	}

	adc_pmic->btm_warm_irq = platform_get_irq(pdev, PM8XXX_ADC_IRQ_1);
	if (adc_pmic->btm_warm_irq < 0)
		return adc_pmic->btm_warm_irq;

	rc = devm_request_irq(&pdev->dev, adc_pmic->btm_warm_irq,
				pm8xxx_btm_warm_isr,
		IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
			"pm8xxx_btm_warm_interrupt", adc_pmic);
	if (rc) {
		pr_err("btm warm irq failed %d with interrupt number %d\n",
						rc, adc_pmic->btm_warm_irq);
		dev_err(&pdev->dev, "failed to request btm irq\n");
	}

	disable_irq_nosync(adc_pmic->btm_warm_irq);

	adc_pmic->btm_cool_irq = platform_get_irq(pdev, PM8XXX_ADC_IRQ_2);
	if (adc_pmic->btm_cool_irq < 0)
		return adc_pmic->btm_cool_irq;

	rc = devm_request_irq(&pdev->dev, adc_pmic->btm_cool_irq,
				pm8xxx_btm_cool_isr,
		IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
			"pm8xxx_btm_cool_interrupt", adc_pmic);
	if (rc) {
		pr_err("btm cool irq failed with return %d and number %d\n",
						rc, adc_pmic->btm_cool_irq);
		dev_err(&pdev->dev, "failed to request btm irq\n");
	}

	disable_irq_nosync(adc_pmic->btm_cool_irq);
	platform_set_drvdata(pdev, adc_pmic);
	wake_lock_init(&adc_pmic->adc_wakelock, WAKE_LOCK_SUSPEND,
					"pm8xxx_adc_wakelock");
	adc_pmic->msm_suspend_check = 0;
	pmic_adc = adc_pmic;

	INIT_WORK(&adc_pmic->warm_work, pm8xxx_adc_btm_warm_scheduler_fn);
	INIT_WORK(&adc_pmic->cool_work, pm8xxx_adc_btm_cool_scheduler_fn);
	create_debugfs_entries();
	pm8xxx_adc_calib_first_adc = false;
	pm8xxx_adc_calib_device_init = false;
	pm8xxx_adc_initialized = true;

	rc = pm8xxx_adc_init_hwmon(pdev);
	if (rc) {
		pr_err("pm8xxx adc init hwmon failed with %d\n", rc);
		dev_err(&pdev->dev, "failed to initialize pm8xxx hwmon adc\n");
	}
	adc_pmic->hwmon = hwmon_device_register(adc_pmic->dev);

	pa_therm = regulator_get(adc_pmic->dev, "pa_therm");
	if (IS_ERR(pa_therm)) {
		rc = PTR_ERR(pa_therm);
		pr_err("failed to request pa_therm vreg with error %d\n", rc);
		pa_therm = NULL;
	}
	return 0;
}

static struct platform_driver pm8xxx_adc_driver = {
	.probe	= pm8xxx_adc_probe,
	.remove	= __devexit_p(pm8xxx_adc_teardown),
	.driver	= {
		.name	= PM8XXX_ADC_DEV_NAME,
		.owner	= THIS_MODULE,
		.pm	= PM8XXX_ADC_DEV_PM_OPS,
	},
};

static int __init pm8xxx_adc_init(void)
{
	return platform_driver_register(&pm8xxx_adc_driver);
}
module_init(pm8xxx_adc_init);

static void __exit pm8xxx_adc_exit(void)
{
	platform_driver_unregister(&pm8xxx_adc_driver);
}
module_exit(pm8xxx_adc_exit);

MODULE_ALIAS("platform:" PM8XXX_ADC_DEV_NAME);
MODULE_DESCRIPTION("PMIC8921/8018 ADC driver");
MODULE_LICENSE("GPL v2");
