Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | * Qualcomm XOADC Driver header file |
| 13 | */ |
| 14 | |
| 15 | #ifndef _XOADC_H |
| 16 | #define _XOADC_H_ |
| 17 | |
| 18 | #include <linux/kernel.h> |
| 19 | #include <linux/list.h> |
| 20 | #include <linux/workqueue.h> |
| 21 | |
| 22 | struct xoadc_conv_state { |
| 23 | struct adc_conv_slot *context; |
| 24 | struct list_head slots; |
| 25 | struct mutex list_lock; |
| 26 | }; |
| 27 | |
| 28 | #define CHANNEL_VCOIN 0 |
| 29 | #define CHANNEL_VBAT 1 |
| 30 | #define CHANNEL_VCHG 2 |
| 31 | #define CHANNEL_CHG_MONITOR 3 |
| 32 | #define CHANNEL_VPH_PWR 4 |
| 33 | #define CHANNEL_MPP5 5 |
| 34 | #define CHANNEL_MPP6 6 |
| 35 | #define CHANNEL_MPP7 7 |
| 36 | #define CHANNEL_MPP8 8 |
| 37 | #define CHANNEL_MPP9 9 |
| 38 | #define CHANNEL_USB_VBUS 0Xa |
| 39 | #define CHANNEL_DIE_TEMP 0Xb |
| 40 | #define CHANNEL_INTERNAL 0xc |
| 41 | #define CHANNEL_125V 0xd |
| 42 | #define CHANNEL_INTERNAL_2 0Xe |
| 43 | #define CHANNEL_MUXOFF 0xf |
| 44 | |
| 45 | #define XOADC_MPP_3 0x2 |
| 46 | #define XOADC_MPP_4 0X3 |
| 47 | #define XOADC_MPP_5 0x4 |
| 48 | #define XOADC_MPP_7 0x6 |
| 49 | #define XOADC_MPP_8 0x7 |
| 50 | #define XOADC_MPP_10 0X9 |
| 51 | |
| 52 | #define XOADC_PMIC_0 0x0 |
| 53 | |
| 54 | #define CHANNEL_ADC_625_MV 625 |
| 55 | |
| 56 | struct xoadc_platform_data { |
| 57 | struct adc_properties *xoadc_prop; |
| 58 | u32 (*xoadc_setup) (void); |
| 59 | void (*xoadc_shutdown) (void); |
| 60 | void (*xoadc_mpp_config) (void); |
| 61 | int (*xoadc_vreg_set) (int); |
| 62 | int (*xoadc_vreg_setup) (void); |
| 63 | void (*xoadc_vreg_shutdown) (void); |
| 64 | u32 xoadc_num; |
| 65 | u32 xoadc_wakeup; |
| 66 | }; |
| 67 | |
| 68 | int32_t pm8058_xoadc_read_adc_code(uint32_t , int32_t *data); |
| 69 | |
| 70 | int32_t pm8058_xoadc_select_chan_and_start_conv(uint32_t, |
| 71 | struct adc_conv_slot *); |
| 72 | |
| 73 | void pm8058_xoadc_slot_request(uint32_t, struct adc_conv_slot **slot); |
| 74 | |
| 75 | void pm8058_xoadc_restore_slot(uint32_t, struct adc_conv_slot *slot); |
| 76 | |
| 77 | struct adc_properties *pm8058_xoadc_get_properties(uint32_t); |
| 78 | |
| 79 | int32_t pm8058_xoadc_calibrate(uint32_t, struct adc_conv_slot *, int *); |
| 80 | |
| 81 | int32_t pm8058_xoadc_registered(void); |
| 82 | |
| 83 | int32_t pm8058_xoadc_calib_device(uint32_t adc_instance); |
| 84 | #endif |