blob: 8a5820f27ae0c1eda0b6825018a4bc8d755d20db [file] [log] [blame]
/* Copyright (c) 2010-2011, 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 XOADC Driver header file
*/
#ifndef _XOADC_H
#define _XOADC_H_
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/workqueue.h>
struct xoadc_conv_state {
struct adc_conv_slot *context;
struct list_head slots;
struct mutex list_lock;
};
#define CHANNEL_VCOIN 0
#define CHANNEL_VBAT 1
#define CHANNEL_VCHG 2
#define CHANNEL_CHG_MONITOR 3
#define CHANNEL_VPH_PWR 4
#define CHANNEL_MPP5 5
#define CHANNEL_MPP6 6
#define CHANNEL_MPP7 7
#define CHANNEL_MPP8 8
#define CHANNEL_MPP9 9
#define CHANNEL_USB_VBUS 0Xa
#define CHANNEL_DIE_TEMP 0Xb
#define CHANNEL_INTERNAL 0xc
#define CHANNEL_125V 0xd
#define CHANNEL_INTERNAL_2 0Xe
#define CHANNEL_MUXOFF 0xf
#define XOADC_MPP_3 0x2
#define XOADC_MPP_4 0X3
#define XOADC_MPP_5 0x4
#define XOADC_MPP_7 0x6
#define XOADC_MPP_8 0x7
#define XOADC_MPP_10 0X9
#define XOADC_PMIC_0 0x0
#define CHANNEL_ADC_625_MV 625
struct xoadc_platform_data {
struct adc_properties *xoadc_prop;
u32 (*xoadc_setup) (void);
void (*xoadc_shutdown) (void);
void (*xoadc_mpp_config) (void);
int (*xoadc_vreg_set) (int);
int (*xoadc_vreg_setup) (void);
void (*xoadc_vreg_shutdown) (void);
u32 xoadc_num;
u32 xoadc_wakeup;
};
int32_t pm8058_xoadc_read_adc_code(uint32_t , int32_t *data);
int32_t pm8058_xoadc_select_chan_and_start_conv(uint32_t,
struct adc_conv_slot *);
void pm8058_xoadc_slot_request(uint32_t, struct adc_conv_slot **slot);
void pm8058_xoadc_restore_slot(uint32_t, struct adc_conv_slot *slot);
struct adc_properties *pm8058_xoadc_get_properties(uint32_t);
int32_t pm8058_xoadc_calibrate(uint32_t, struct adc_conv_slot *, int *);
int32_t pm8058_xoadc_registered(void);
int32_t pm8058_xoadc_calib_device(uint32_t adc_instance);
#endif