1 From c7412fa6dec1460ac0d1895f16421732e5174406 Mon Sep 17 00:00:00 2001
2 From: Steve Sakoman <steve@sakoman.com>
3 Date: Thu, 17 Dec 2009 15:54:58 -0800
4 Subject: [PATCH 13/16] ARM: OMAP: Add missing twl4030 madc header file
7 include/linux/i2c/twl4030-madc.h | 130 ++++++++++++++++++++++++++++++++++++++
8 1 files changed, 130 insertions(+), 0 deletions(-)
9 create mode 100644 include/linux/i2c/twl4030-madc.h
11 diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
13 index 0000000..341a665
15 +++ b/include/linux/i2c/twl4030-madc.h
18 + * include/linux/i2c/twl4030-madc.h
20 + * TWL4030 MADC module driver header
22 + * Copyright (C) 2008 Nokia Corporation
23 + * Mikko Ylinen <mikko.k.ylinen@nokia.com>
25 + * This program is free software; you can redistribute it and/or
26 + * modify it under the terms of the GNU General Public License
27 + * version 2 as published by the Free Software Foundation.
29 + * This program is distributed in the hope that it will be useful, but
30 + * WITHOUT ANY WARRANTY; without even the implied warranty of
31 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32 + * General Public License for more details.
34 + * You should have received a copy of the GNU General Public License
35 + * along with this program; if not, write to the Free Software
36 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
41 +#ifndef _TWL4030_MADC_H
42 +#define _TWL4030_MADC_H
44 +struct twl4030_madc_conversion_method {
51 +#define TWL4030_MADC_MAX_CHANNELS 16
53 +struct twl4030_madc_request {
60 + int rbuf[TWL4030_MADC_MAX_CHANNELS];
61 + void (*func_cb)(int len, int channels, int *buf);
64 +enum conversion_methods {
68 + TWL4030_MADC_NUM_METHODS
73 + TWL4030_MADC_IRQ_ONESHOT,
74 + TWL4030_MADC_IRQ_REARM
77 +#define TWL4030_MADC_CTRL1 0x00
78 +#define TWL4030_MADC_CTRL2 0x01
80 +#define TWL4030_MADC_RTSELECT_LSB 0x02
81 +#define TWL4030_MADC_SW1SELECT_LSB 0x06
82 +#define TWL4030_MADC_SW2SELECT_LSB 0x0A
84 +#define TWL4030_MADC_RTAVERAGE_LSB 0x04
85 +#define TWL4030_MADC_SW1AVERAGE_LSB 0x08
86 +#define TWL4030_MADC_SW2AVERAGE_LSB 0x0C
88 +#define TWL4030_MADC_CTRL_SW1 0x12
89 +#define TWL4030_MADC_CTRL_SW2 0x13
91 +#define TWL4030_MADC_RTCH0_LSB 0x17
92 +#define TWL4030_MADC_GPCH0_LSB 0x37
94 +#define TWL4030_MADC_MADCON (1<<0) /* MADC power on */
95 +#define TWL4030_MADC_BUSY (1<<0) /* MADC busy */
96 +#define TWL4030_MADC_EOC_SW (1<<1) /* MADC conversion completion */
97 +#define TWL4030_MADC_SW_START (1<<5) /* MADC SWx start conversion */
99 +#define TWL4030_MADC_ADCIN0 (1<<0)
100 +#define TWL4030_MADC_ADCIN1 (1<<1)
101 +#define TWL4030_MADC_ADCIN2 (1<<2)
102 +#define TWL4030_MADC_ADCIN3 (1<<3)
103 +#define TWL4030_MADC_ADCIN4 (1<<4)
104 +#define TWL4030_MADC_ADCIN5 (1<<5)
105 +#define TWL4030_MADC_ADCIN6 (1<<6)
106 +#define TWL4030_MADC_ADCIN7 (1<<7)
107 +#define TWL4030_MADC_ADCIN8 (1<<8)
108 +#define TWL4030_MADC_ADCIN9 (1<<9)
109 +#define TWL4030_MADC_ADCIN10 (1<<10)
110 +#define TWL4030_MADC_ADCIN11 (1<<11)
111 +#define TWL4030_MADC_ADCIN12 (1<<12)
112 +#define TWL4030_MADC_ADCIN13 (1<<13)
113 +#define TWL4030_MADC_ADCIN14 (1<<14)
114 +#define TWL4030_MADC_ADCIN15 (1<<15)
116 +/* Fixed channels */
117 +#define TWL4030_MADC_BTEMP TWL4030_MADC_ADCIN1
118 +#define TWL4030_MADC_VBUS TWL4030_MADC_ADCIN8
119 +#define TWL4030_MADC_VBKB TWL4030_MADC_ADCIN9
120 +#define TWL4030_MADC_ICHG TWL4030_MADC_ADCIN10
121 +#define TWL4030_MADC_VCHG TWL4030_MADC_ADCIN11
122 +#define TWL4030_MADC_VBAT TWL4030_MADC_ADCIN12
124 +/* BCI related - XXX To be moved elsewhere */
125 +#define TWL4030_BCI_BCICTL1 0x23
126 +#define TWL4030_BCI_MESBAT (1<<1)
127 +#define TWL4030_BCI_TYPEN (1<<4)
128 +#define TWL4030_BCI_ITHEN (1<<3)
130 +/* USB related - XXX To be moved elsewhere */
131 +#define TWL4030_USB_CARKIT_ANA_CTRL 0xBB
132 +#define TWL4030_USB_SEL_MADC_MCPC (1<<3)
134 +#define TWL4030_MADC_IOC_MAGIC '`'
135 +#define TWL4030_MADC_IOCX_ADC_RAW_READ _IO(TWL4030_MADC_IOC_MAGIC, 0)
137 +struct twl4030_madc_user_parms {
144 +int twl4030_madc_conversion(struct twl4030_madc_request *conv);