summaryrefslogtreecommitdiffstats
path: root/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0020-ARM-OMAP-Add-missing-twl4030-madc-header-file.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0020-ARM-OMAP-Add-missing-twl4030-madc-header-file.patch')
-rw-r--r--extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0020-ARM-OMAP-Add-missing-twl4030-madc-header-file.patch149
1 files changed, 149 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0020-ARM-OMAP-Add-missing-twl4030-madc-header-file.patch b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0020-ARM-OMAP-Add-missing-twl4030-madc-header-file.patch
new file mode 100644
index 00000000..0e1bdaf7
--- /dev/null
+++ b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0020-ARM-OMAP-Add-missing-twl4030-madc-header-file.patch
@@ -0,0 +1,149 @@
1From b13ea241d699a10e3f5347a90bc3d31329f3601d Mon Sep 17 00:00:00 2001
2From: Steve Sakoman <steve@sakoman.com>
3Date: Thu, 17 Dec 2009 15:54:58 -0800
4Subject: [PATCH 20/45] ARM: OMAP: Add missing twl4030 madc header file
5
6---
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
10
11diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
12new file mode 100644
13index 0000000..341a665
14--- /dev/null
15+++ b/include/linux/i2c/twl4030-madc.h
16@@ -0,0 +1,130 @@
17+/*
18+ * include/linux/i2c/twl4030-madc.h
19+ *
20+ * TWL4030 MADC module driver header
21+ *
22+ * Copyright (C) 2008 Nokia Corporation
23+ * Mikko Ylinen <mikko.k.ylinen@nokia.com>
24+ *
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.
28+ *
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.
33+ *
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
37+ * 02110-1301 USA
38+ *
39+ */
40+
41+#ifndef _TWL4030_MADC_H
42+#define _TWL4030_MADC_H
43+
44+struct twl4030_madc_conversion_method {
45+ u8 sel;
46+ u8 avg;
47+ u8 rbase;
48+ u8 ctrl;
49+};
50+
51+#define TWL4030_MADC_MAX_CHANNELS 16
52+
53+struct twl4030_madc_request {
54+ u16 channels;
55+ u16 do_avg;
56+ u16 method;
57+ u16 type;
58+ int active;
59+ int result_pending;
60+ int rbuf[TWL4030_MADC_MAX_CHANNELS];
61+ void (*func_cb)(int len, int channels, int *buf);
62+};
63+
64+enum conversion_methods {
65+ TWL4030_MADC_RT,
66+ TWL4030_MADC_SW1,
67+ TWL4030_MADC_SW2,
68+ TWL4030_MADC_NUM_METHODS
69+};
70+
71+enum sample_type {
72+ TWL4030_MADC_WAIT,
73+ TWL4030_MADC_IRQ_ONESHOT,
74+ TWL4030_MADC_IRQ_REARM
75+};
76+
77+#define TWL4030_MADC_CTRL1 0x00
78+#define TWL4030_MADC_CTRL2 0x01
79+
80+#define TWL4030_MADC_RTSELECT_LSB 0x02
81+#define TWL4030_MADC_SW1SELECT_LSB 0x06
82+#define TWL4030_MADC_SW2SELECT_LSB 0x0A
83+
84+#define TWL4030_MADC_RTAVERAGE_LSB 0x04
85+#define TWL4030_MADC_SW1AVERAGE_LSB 0x08
86+#define TWL4030_MADC_SW2AVERAGE_LSB 0x0C
87+
88+#define TWL4030_MADC_CTRL_SW1 0x12
89+#define TWL4030_MADC_CTRL_SW2 0x13
90+
91+#define TWL4030_MADC_RTCH0_LSB 0x17
92+#define TWL4030_MADC_GPCH0_LSB 0x37
93+
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 */
98+
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)
115+
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
123+
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)
129+
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)
133+
134+#define TWL4030_MADC_IOC_MAGIC '`'
135+#define TWL4030_MADC_IOCX_ADC_RAW_READ _IO(TWL4030_MADC_IOC_MAGIC, 0)
136+
137+struct twl4030_madc_user_parms {
138+ int channel;
139+ int average;
140+ int status;
141+ u16 result;
142+};
143+
144+int twl4030_madc_conversion(struct twl4030_madc_request *conv);
145+
146+#endif
147--
1481.6.6.1
149