aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/i2c/twl6030-madc.h
blob: 81b946478d8a6891dda19d81802998add1ebe085 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 * twl6030_madc.h - Header for TWL6030 MADC
 *
 * Copyright (C) 2011 Samsung Telecommunications of America
 *
 * Based on twl4030-madc.h
 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
 * J Keerthy <j-keerthy@ti.com>
 *
 * 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.
 *
 * 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 */

#ifndef _TWL6030_MADC_H
#define _TWL6030_MADC_H

#define TWL6030_MADC_MAX_CHANNELS 17
/*
 * twl6030 madc occupies the same offset in the twl6030 map that
 * twl4030 madc does in the twl4030 map.
 * likewise the charger
 */
#define TWL6030_MODULE_MADC          TWL4030_MODULE_MADC
#define TWL6030_MODULE_MAIN_CHARGE   TWL4030_MODULE_MAIN_CHARGE

#define TWL6030_MADC_CTRL		0x00
#define    TWL6030_MADC_TEMP1_EN        (1 << 0)
#define    TWL6030_MADC_TEMP2_EN        (1 << 1)
#define    TWL6030_MADC_SCALER_EN_CH2	(1 << 2)
#define    TWL6030_MADC_VBAT_SCALER_DIV	(1 << 3)
#define    TWL6030_MADC_SCALER_EN_CH11	(1 << 4)
#define    TWL6030_MADC_TMP1_EN_MONITOR	(1 << 5)
#define    TWL6030_MADC_TMP2_EN_MONITOR	(1 << 6)
#define    TWL6030_MADC_ISOURCE_EN	(1 << 7)

#define TWL6030_MADC_RTSELECT_LSB	0x02
#define    TWL6030_MADC_ADCIN0	(1 << 0)
#define    TWL6030_MADC_ADCIN1	(1 << 1)
#define    TWL6030_MADC_ADCIN2	(1 << 2)
#define    TWL6030_MADC_ADCIN3	(1 << 3)
#define    TWL6030_MADC_ADCIN4	(1 << 4)
#define    TWL6030_MADC_ADCIN5	(1 << 5)
#define    TWL6030_MADC_ADCIN6	(1 << 6)
#define    TWL6030_MADC_ADCIN7	(1 << 7)

#define TWL6030_MADC_RTSELECT_ISB	0x03
#define    TWL6030_MADC_ADCIN8		(1 << 0)
#define    TWL6030_MADC_ADCIN9		(1 << 1)
#define    TWL6030_MADC_ADCIN10		(1 << 2)
#define    TWL6030_MADC_ADCIN11		(1 << 3)
#define    TWL6030_MADC_ADCIN12		(1 << 4)
#define    TWL6030_MADC_ADCIN13		(1 << 5)
#define    TWL6030_MADC_ADCIN14		(1 << 6)
#define    TWL6030_MADC_ADCIN15		(1 << 7)

#define TWL6030_MADC_RTSELECT_MSB	0x04
#define    TWL6030_MADC_ADCIN16		(1 << 0)

#define TWL6030_MADC_CTRL_P1		0x05
#define    TWL6030_MADC_BUSY		(1 << 0)
#define    TWL6030_MADC_EOCP1		(1 << 1)
#define    TWL6030_MADC_EOCRT		(1 << 2)
#define    TWL6030_MADC_SP1		(1 << 3)

#define TWL6030_MADC_CTRL_P2		0x06
#define    TWL6030_MADC_BUSYB		(1 << 0)
#define    TWL6030_MADC_EOCP2		(1 << 1)
#define    TWL6030_MADC_SP2		(1 << 2)

#define TWL6030_MADC_RTCH0_LSB		0x07
#define TWL6030_MADC_GPCH0_LSB		0x29

int twl6030_get_madc_conversion(int channel_no);
#endif