aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2009-09-24 16:22:33 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-09-24 16:22:33 -0400
commitbaea7b946f00a291b166ccae7fcfed6c01530cc6 (patch)
tree4aa275fbdbec9c7b9b4629e8bee2bbecd3c6a6af /include/linux
parentae19ffbadc1b2100285a5b5b3d0a4e0a11390904 (diff)
parent94e0fb086fc5663c38bbc0fe86d698be8314f82f (diff)
Merge branch 'origin' into for-linus
Conflicts: MAINTAINERS
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h15
-rw-r--r--include/linux/aio.h2
-rw-r--r--include/linux/anon_inodes.h3
-rw-r--r--include/linux/async_tx.h129
-rw-r--r--include/linux/binfmts.h2
-rw-r--r--include/linux/bootmem.h5
-rw-r--r--include/linux/capability.h2
-rw-r--r--include/linux/cgroup.h53
-rw-r--r--include/linux/clocksource.h122
-rw-r--r--include/linux/cn_proc.h10
-rw-r--r--include/linux/configfs.h4
-rw-r--r--include/linux/cpufreq.h10
-rw-r--r--include/linux/cpumask.h721
-rw-r--r--include/linux/cred.h18
-rw-r--r--include/linux/cyclades.h11
-rw-r--r--include/linux/dca.h11
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/delayacct.h1
-rw-r--r--include/linux/device.h7
-rw-r--r--include/linux/dmaengine.h179
-rw-r--r--include/linux/dvb/frontend.h46
-rw-r--r--include/linux/dvb/version.h2
-rw-r--r--include/linux/eventfd.h6
-rw-r--r--include/linux/firewire.h14
-rw-r--r--include/linux/flex_array.h32
-rw-r--r--include/linux/fs.h19
-rw-r--r--include/linux/ftrace.h5
-rw-r--r--include/linux/ftrace_event.h10
-rw-r--r--include/linux/fuse.h29
-rw-r--r--include/linux/futex.h10
-rw-r--r--include/linux/genhd.h4
-rw-r--r--include/linux/gfp.h15
-rw-r--r--include/linux/gpio.h11
-rw-r--r--include/linux/hayesesp.h1
-rw-r--r--include/linux/hid.h3
-rw-r--r--include/linux/hrtimer.h2
-rw-r--r--include/linux/hugetlb.h32
-rw-r--r--include/linux/i2c-id.h11
-rw-r--r--include/linux/i2c.h2
-rw-r--r--include/linux/i2c/adp5588.h92
-rw-r--r--include/linux/i2c/mcs5000_ts.h24
-rw-r--r--include/linux/i2c/twl4030.h94
-rw-r--r--include/linux/i8042.h30
-rw-r--r--include/linux/init_task.h14
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/intel-iommu.h2
-rw-r--r--include/linux/interrupt.h2
-rw-r--r--include/linux/ioport.h4
-rw-r--r--include/linux/iova.h1
-rw-r--r--include/linux/jbd.h28
-rw-r--r--include/linux/jbd2.h2
-rw-r--r--include/linux/kernel.h16
-rw-r--r--include/linux/kfifo.h4
-rw-r--r--include/linux/kmemcheck.h11
-rw-r--r--include/linux/ksm.h79
-rw-r--r--include/linux/kvm_host.h1
-rw-r--r--include/linux/libps2.h2
-rw-r--r--include/linux/linkage.h2
-rw-r--r--include/linux/lis3lv02d.h11
-rw-r--r--include/linux/lockd/lockd.h45
-rw-r--r--include/linux/mISDNif.h2
-rw-r--r--include/linux/magic.h6
-rw-r--r--include/linux/marker.h221
-rw-r--r--include/linux/memcontrol.h10
-rw-r--r--include/linux/memory_hotplug.h8
-rw-r--r--include/linux/mempool.h10
-rw-r--r--include/linux/mfd/ab3100.h37
-rw-r--r--include/linux/mfd/core.h1
-rw-r--r--include/linux/mfd/da903x.h4
-rw-r--r--include/linux/mfd/ezx-pcap.h7
-rw-r--r--include/linux/mfd/mc13783-private.h396
-rw-r--r--include/linux/mfd/mc13783.h84
-rw-r--r--include/linux/mfd/pcf50633/adc.h3
-rw-r--r--include/linux/mfd/pcf50633/core.h1
-rw-r--r--include/linux/mfd/wm831x/auxadc.h216
-rw-r--r--include/linux/mfd/wm831x/core.h289
-rw-r--r--include/linux/mfd/wm831x/gpio.h55
-rw-r--r--include/linux/mfd/wm831x/irq.h764
-rw-r--r--include/linux/mfd/wm831x/otp.h162
-rw-r--r--include/linux/mfd/wm831x/pdata.h113
-rw-r--r--include/linux/mfd/wm831x/pmu.h189
-rw-r--r--include/linux/mfd/wm831x/regulator.h1218
-rw-r--r--include/linux/mfd/wm831x/watchdog.h52
-rw-r--r--include/linux/mfd/wm8350/core.h7
-rw-r--r--include/linux/miscdevice.h3
-rw-r--r--include/linux/mm.h49
-rw-r--r--include/linux/mm_inline.h31
-rw-r--r--include/linux/mm_types.h7
-rw-r--r--include/linux/mmc/card.h12
-rw-r--r--include/linux/mmc/core.h1
-rw-r--r--include/linux/mmc/host.h58
-rw-r--r--include/linux/mmc/mmc.h3
-rw-r--r--include/linux/mmc/sdio_func.h3
-rw-r--r--include/linux/mmu_context.h9
-rw-r--r--include/linux/mmu_notifier.h34
-rw-r--r--include/linux/mmzone.h30
-rw-r--r--include/linux/mod_devicetable.h11
-rw-r--r--include/linux/module.h28
-rw-r--r--include/linux/mtd/nand.h5
-rw-r--r--include/linux/mtd/nand_ecc.h6
-rw-r--r--include/linux/mtd/onenand.h8
-rw-r--r--include/linux/mtd/onenand_regs.h3
-rw-r--r--include/linux/namei.h2
-rw-r--r--include/linux/nfs4.h2
-rw-r--r--include/linux/nfsd/nfsd.h9
-rw-r--r--include/linux/nfsd/state.h77
-rw-r--r--include/linux/nfsd/xdr4.h19
-rw-r--r--include/linux/oom.h11
-rw-r--r--include/linux/page-flags.h42
-rw-r--r--include/linux/page_cgroup.h17
-rw-r--r--include/linux/pci_ids.h11
-rw-r--r--include/linux/perf_counter.h462
-rw-r--r--include/linux/perf_event.h858
-rw-r--r--include/linux/pnp.h1
-rw-r--r--include/linux/poison.h3
-rw-r--r--include/linux/power_supply.h21
-rw-r--r--include/linux/prctl.h6
-rw-r--r--include/linux/proc_fs.h16
-rw-r--r--include/linux/quotaops.h4
-rw-r--r--include/linux/rculist_nulls.h2
-rw-r--r--include/linux/rcupdate.h29
-rw-r--r--include/linux/rcutree.h6
-rw-r--r--include/linux/regulator/consumer.h4
-rw-r--r--include/linux/regulator/driver.h7
-rw-r--r--include/linux/regulator/fixed.h24
-rw-r--r--include/linux/regulator/machine.h26
-rw-r--r--include/linux/regulator/max1586.h4
-rw-r--r--include/linux/relay.h2
-rw-r--r--include/linux/res_counter.h64
-rw-r--r--include/linux/rmap.h27
-rw-r--r--include/linux/sched.h80
-rw-r--r--include/linux/security.h2
-rw-r--r--include/linux/seq_file.h38
-rw-r--r--include/linux/serial.h2
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/serial_core.h97
-rw-r--r--include/linux/sfi.h206
-rw-r--r--include/linux/sfi_acpi.h93
-rw-r--r--include/linux/sh_intc.h1
-rw-r--r--include/linux/signal.h2
-rw-r--r--include/linux/smp.h11
-rw-r--r--include/linux/spi/mc33880.h10
-rw-r--r--include/linux/spi/spi.h51
-rw-r--r--include/linux/sunrpc/auth.h4
-rw-r--r--include/linux/sunrpc/clnt.h114
-rw-r--r--include/linux/sunrpc/svc.h2
-rw-r--r--include/linux/sunrpc/svc_xprt.h1
-rw-r--r--include/linux/sunrpc/svcsock.h1
-rw-r--r--include/linux/sunrpc/xdr.h5
-rw-r--r--include/linux/sunrpc/xprt.h19
-rw-r--r--include/linux/sunrpc/xprtrdma.h5
-rw-r--r--include/linux/sunrpc/xprtsock.h11
-rw-r--r--include/linux/swap.h61
-rw-r--r--include/linux/swapops.h38
-rw-r--r--include/linux/syscalls.h33
-rw-r--r--include/linux/sysctl.h19
-rw-r--r--include/linux/taskstats_kern.h1
-rw-r--r--include/linux/time.h38
-rw-r--r--include/linux/timer.h5
-rw-r--r--include/linux/topology.h6
-rw-r--r--include/linux/tracehook.h34
-rw-r--r--include/linux/tracepoint.h2
-rw-r--r--include/linux/tty.h19
-rw-r--r--include/linux/ucb1400.h19
-rw-r--r--include/linux/unaligned/be_byteshift.h2
-rw-r--r--include/linux/unaligned/le_byteshift.h2
-rw-r--r--include/linux/usb.h31
-rw-r--r--include/linux/usb/audio.h287
-rw-r--r--include/linux/usb/ch9.h8
-rw-r--r--include/linux/usb/ehci_def.h35
-rw-r--r--include/linux/usb/isp1362.h46
-rw-r--r--include/linux/usb/isp1760.h18
-rw-r--r--include/linux/usb/m66592.h44
-rw-r--r--include/linux/usb/r8a66597.h375
-rw-r--r--include/linux/usb/serial.h12
-rw-r--r--include/linux/usbdevice_fs.h3
-rw-r--r--include/linux/utsname.h1
-rw-r--r--include/linux/vgaarb.h14
-rw-r--r--include/linux/videodev2.h3
-rw-r--r--include/linux/virtio.h2
-rw-r--r--include/linux/virtio_9p.h2
-rw-r--r--include/linux/virtio_balloon.h3
-rw-r--r--include/linux/virtio_blk.h18
-rw-r--r--include/linux/virtio_config.h3
-rw-r--r--include/linux/virtio_console.h3
-rw-r--r--include/linux/virtio_ids.h17
-rw-r--r--include/linux/virtio_net.h3
-rw-r--r--include/linux/virtio_rng.h3
-rw-r--r--include/linux/vmstat.h16
-rw-r--r--include/linux/vt.h32
-rw-r--r--include/linux/vt_kern.h16
-rw-r--r--include/linux/wm97xx.h18
-rw-r--r--include/linux/wm97xx_batt.h18
-rw-r--r--include/linux/workqueue.h2
-rw-r--r--include/linux/writeback.h11
195 files changed, 7885 insertions, 2133 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 34321cfffeab..dfcd920c3e54 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -41,8 +41,6 @@
41#include <acpi/acpi_drivers.h> 41#include <acpi/acpi_drivers.h>
42#include <acpi/acpi_numa.h> 42#include <acpi/acpi_numa.h>
43#include <asm/acpi.h> 43#include <asm/acpi.h>
44#include <linux/dmi.h>
45
46 44
47enum acpi_irq_model_id { 45enum acpi_irq_model_id {
48 ACPI_IRQ_MODEL_PIC = 0, 46 ACPI_IRQ_MODEL_PIC = 0,
@@ -219,10 +217,8 @@ static inline int acpi_video_display_switch_support(void)
219#endif /* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */ 217#endif /* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */
220 218
221extern int acpi_blacklisted(void); 219extern int acpi_blacklisted(void);
222#ifdef CONFIG_DMI
223extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); 220extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
224extern int acpi_osi_setup(char *str); 221extern int acpi_osi_setup(char *str);
225#endif
226 222
227#ifdef CONFIG_ACPI_NUMA 223#ifdef CONFIG_ACPI_NUMA
228int acpi_get_pxm(acpi_handle handle); 224int acpi_get_pxm(acpi_handle handle);
@@ -292,7 +288,10 @@ void __init acpi_s4_no_nvs(void);
292extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags); 288extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags);
293extern void acpi_early_init(void); 289extern void acpi_early_init(void);
294 290
295#else /* CONFIG_ACPI */ 291#else /* !CONFIG_ACPI */
292
293#define acpi_disabled 1
294
296static inline void acpi_early_init(void) { } 295static inline void acpi_early_init(void) { }
297 296
298static inline int early_acpi_boot_init(void) 297static inline int early_acpi_boot_init(void)
@@ -331,5 +330,11 @@ static inline int acpi_check_mem_region(resource_size_t start,
331 return 0; 330 return 0;
332} 331}
333 332
333struct acpi_table_header;
334static inline int acpi_table_parse(char *id,
335 int (*handler)(struct acpi_table_header *))
336{
337 return -1;
338}
334#endif /* !CONFIG_ACPI */ 339#endif /* !CONFIG_ACPI */
335#endif /*_LINUX_ACPI_H*/ 340#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 47f7d932a01d..aea219d7d8d1 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -225,8 +225,6 @@ static inline void exit_aio(struct mm_struct *mm) { }
225 225
226#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) 226#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
227 227
228#include <linux/aio_abi.h>
229
230static inline struct kiocb *list_kiocb(struct list_head *h) 228static inline struct kiocb *list_kiocb(struct list_head *h)
231{ 229{
232 return list_entry(h, struct kiocb, ki_list); 230 return list_entry(h, struct kiocb, ki_list);
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h
index e0a0cdc2da43..69a21e0ebd33 100644
--- a/include/linux/anon_inodes.h
+++ b/include/linux/anon_inodes.h
@@ -8,6 +8,9 @@
8#ifndef _LINUX_ANON_INODES_H 8#ifndef _LINUX_ANON_INODES_H
9#define _LINUX_ANON_INODES_H 9#define _LINUX_ANON_INODES_H
10 10
11struct file *anon_inode_getfile(const char *name,
12 const struct file_operations *fops,
13 void *priv, int flags);
11int anon_inode_getfd(const char *name, const struct file_operations *fops, 14int anon_inode_getfd(const char *name, const struct file_operations *fops,
12 void *priv, int flags); 15 void *priv, int flags);
13 16
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 5fc2ef8d97fa..a1c486a88e88 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -58,25 +58,60 @@ struct dma_chan_ref {
58 * array. 58 * array.
59 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a 59 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a
60 * dependency chain 60 * dependency chain
61 * @ASYNC_TX_DEP_ACK: ack the dependency descriptor. Useful for chaining. 61 * @ASYNC_TX_FENCE: specify that the next operation in the dependency
62 * chain uses this operation's result as an input
62 */ 63 */
63enum async_tx_flags { 64enum async_tx_flags {
64 ASYNC_TX_XOR_ZERO_DST = (1 << 0), 65 ASYNC_TX_XOR_ZERO_DST = (1 << 0),
65 ASYNC_TX_XOR_DROP_DST = (1 << 1), 66 ASYNC_TX_XOR_DROP_DST = (1 << 1),
66 ASYNC_TX_ACK = (1 << 3), 67 ASYNC_TX_ACK = (1 << 2),
67 ASYNC_TX_DEP_ACK = (1 << 4), 68 ASYNC_TX_FENCE = (1 << 3),
69};
70
71/**
72 * struct async_submit_ctl - async_tx submission/completion modifiers
73 * @flags: submission modifiers
74 * @depend_tx: parent dependency of the current operation being submitted
75 * @cb_fn: callback routine to run at operation completion
76 * @cb_param: parameter for the callback routine
77 * @scribble: caller provided space for dma/page address conversions
78 */
79struct async_submit_ctl {
80 enum async_tx_flags flags;
81 struct dma_async_tx_descriptor *depend_tx;
82 dma_async_tx_callback cb_fn;
83 void *cb_param;
84 void *scribble;
68}; 85};
69 86
70#ifdef CONFIG_DMA_ENGINE 87#ifdef CONFIG_DMA_ENGINE
71#define async_tx_issue_pending_all dma_issue_pending_all 88#define async_tx_issue_pending_all dma_issue_pending_all
89
90/**
91 * async_tx_issue_pending - send pending descriptor to the hardware channel
92 * @tx: descriptor handle to retrieve hardware context
93 *
94 * Note: any dependent operations will have already been issued by
95 * async_tx_channel_switch, or (in the case of no channel switch) will
96 * be already pending on this channel.
97 */
98static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx)
99{
100 if (likely(tx)) {
101 struct dma_chan *chan = tx->chan;
102 struct dma_device *dma = chan->device;
103
104 dma->device_issue_pending(chan);
105 }
106}
72#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL 107#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL
73#include <asm/async_tx.h> 108#include <asm/async_tx.h>
74#else 109#else
75#define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \ 110#define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \
76 __async_tx_find_channel(dep, type) 111 __async_tx_find_channel(dep, type)
77struct dma_chan * 112struct dma_chan *
78__async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 113__async_tx_find_channel(struct async_submit_ctl *submit,
79 enum dma_transaction_type tx_type); 114 enum dma_transaction_type tx_type);
80#endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */ 115#endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */
81#else 116#else
82static inline void async_tx_issue_pending_all(void) 117static inline void async_tx_issue_pending_all(void)
@@ -84,10 +119,16 @@ static inline void async_tx_issue_pending_all(void)
84 do { } while (0); 119 do { } while (0);
85} 120}
86 121
122static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx)
123{
124 do { } while (0);
125}
126
87static inline struct dma_chan * 127static inline struct dma_chan *
88async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 128async_tx_find_channel(struct async_submit_ctl *submit,
89 enum dma_transaction_type tx_type, struct page **dst, int dst_count, 129 enum dma_transaction_type tx_type, struct page **dst,
90 struct page **src, int src_count, size_t len) 130 int dst_count, struct page **src, int src_count,
131 size_t len)
91{ 132{
92 return NULL; 133 return NULL;
93} 134}
@@ -99,46 +140,70 @@ async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
99 * @cb_fn_param: parameter to pass to the callback routine 140 * @cb_fn_param: parameter to pass to the callback routine
100 */ 141 */
101static inline void 142static inline void
102async_tx_sync_epilog(dma_async_tx_callback cb_fn, void *cb_fn_param) 143async_tx_sync_epilog(struct async_submit_ctl *submit)
103{ 144{
104 if (cb_fn) 145 if (submit->cb_fn)
105 cb_fn(cb_fn_param); 146 submit->cb_fn(submit->cb_param);
106} 147}
107 148
108void 149typedef union {
109async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx, 150 unsigned long addr;
110 enum async_tx_flags flags, struct dma_async_tx_descriptor *depend_tx, 151 struct page *page;
111 dma_async_tx_callback cb_fn, void *cb_fn_param); 152 dma_addr_t dma;
153} addr_conv_t;
154
155static inline void
156init_async_submit(struct async_submit_ctl *args, enum async_tx_flags flags,
157 struct dma_async_tx_descriptor *tx,
158 dma_async_tx_callback cb_fn, void *cb_param,
159 addr_conv_t *scribble)
160{
161 args->flags = flags;
162 args->depend_tx = tx;
163 args->cb_fn = cb_fn;
164 args->cb_param = cb_param;
165 args->scribble = scribble;
166}
167
168void async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx,
169 struct async_submit_ctl *submit);
112 170
113struct dma_async_tx_descriptor * 171struct dma_async_tx_descriptor *
114async_xor(struct page *dest, struct page **src_list, unsigned int offset, 172async_xor(struct page *dest, struct page **src_list, unsigned int offset,
115 int src_cnt, size_t len, enum async_tx_flags flags, 173 int src_cnt, size_t len, struct async_submit_ctl *submit);
116 struct dma_async_tx_descriptor *depend_tx,
117 dma_async_tx_callback cb_fn, void *cb_fn_param);
118 174
119struct dma_async_tx_descriptor * 175struct dma_async_tx_descriptor *
120async_xor_zero_sum(struct page *dest, struct page **src_list, 176async_xor_val(struct page *dest, struct page **src_list, unsigned int offset,
121 unsigned int offset, int src_cnt, size_t len, 177 int src_cnt, size_t len, enum sum_check_flags *result,
122 u32 *result, enum async_tx_flags flags, 178 struct async_submit_ctl *submit);
123 struct dma_async_tx_descriptor *depend_tx,
124 dma_async_tx_callback cb_fn, void *cb_fn_param);
125 179
126struct dma_async_tx_descriptor * 180struct dma_async_tx_descriptor *
127async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset, 181async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset,
128 unsigned int src_offset, size_t len, enum async_tx_flags flags, 182 unsigned int src_offset, size_t len,
129 struct dma_async_tx_descriptor *depend_tx, 183 struct async_submit_ctl *submit);
130 dma_async_tx_callback cb_fn, void *cb_fn_param);
131 184
132struct dma_async_tx_descriptor * 185struct dma_async_tx_descriptor *
133async_memset(struct page *dest, int val, unsigned int offset, 186async_memset(struct page *dest, int val, unsigned int offset,
134 size_t len, enum async_tx_flags flags, 187 size_t len, struct async_submit_ctl *submit);
135 struct dma_async_tx_descriptor *depend_tx, 188
136 dma_async_tx_callback cb_fn, void *cb_fn_param); 189struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit_ctl *submit);
190
191struct dma_async_tx_descriptor *
192async_gen_syndrome(struct page **blocks, unsigned int offset, int src_cnt,
193 size_t len, struct async_submit_ctl *submit);
194
195struct dma_async_tx_descriptor *
196async_syndrome_val(struct page **blocks, unsigned int offset, int src_cnt,
197 size_t len, enum sum_check_flags *pqres, struct page *spare,
198 struct async_submit_ctl *submit);
199
200struct dma_async_tx_descriptor *
201async_raid6_2data_recov(int src_num, size_t bytes, int faila, int failb,
202 struct page **ptrs, struct async_submit_ctl *submit);
137 203
138struct dma_async_tx_descriptor * 204struct dma_async_tx_descriptor *
139async_trigger_callback(enum async_tx_flags flags, 205async_raid6_datap_recov(int src_num, size_t bytes, int faila,
140 struct dma_async_tx_descriptor *depend_tx, 206 struct page **ptrs, struct async_submit_ctl *submit);
141 dma_async_tx_callback cb_fn, void *cb_fn_param);
142 207
143void async_tx_quiesce(struct dma_async_tx_descriptor **tx); 208void async_tx_quiesce(struct dma_async_tx_descriptor **tx);
144#endif /* _ASYNC_TX_H_ */ 209#endif /* _ASYNC_TX_H_ */
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 2046b5b8af48..aece486ac734 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -120,7 +120,7 @@ extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
120extern int prepare_bprm_creds(struct linux_binprm *bprm); 120extern int prepare_bprm_creds(struct linux_binprm *bprm);
121extern void install_exec_creds(struct linux_binprm *bprm); 121extern void install_exec_creds(struct linux_binprm *bprm);
122extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); 122extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
123extern int set_binfmt(struct linux_binfmt *new); 123extern void set_binfmt(struct linux_binfmt *new);
124extern void free_bprm(struct linux_binprm *); 124extern void free_bprm(struct linux_binprm *);
125 125
126#endif /* __KERNEL__ */ 126#endif /* __KERNEL__ */
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index bc3ab7073695..dd97fb8408a8 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -132,9 +132,6 @@ static inline void *alloc_remap(int nid, unsigned long size)
132} 132}
133#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */ 133#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
134 134
135extern unsigned long __meminitdata nr_kernel_pages;
136extern unsigned long __meminitdata nr_all_pages;
137
138extern void *alloc_large_system_hash(const char *tablename, 135extern void *alloc_large_system_hash(const char *tablename,
139 unsigned long bucketsize, 136 unsigned long bucketsize,
140 unsigned long numentries, 137 unsigned long numentries,
@@ -145,6 +142,8 @@ extern void *alloc_large_system_hash(const char *tablename,
145 unsigned long limit); 142 unsigned long limit);
146 143
147#define HASH_EARLY 0x00000001 /* Allocating during early boot? */ 144#define HASH_EARLY 0x00000001 /* Allocating during early boot? */
145#define HASH_SMALL 0x00000002 /* sub-page allocation allowed, min
146 * shift passed via *_hash_shift */
148 147
149/* Only NUMA needs hash distribution. 64bit NUMA architectures have 148/* Only NUMA needs hash distribution. 64bit NUMA architectures have
150 * sufficient vmalloc space. 149 * sufficient vmalloc space.
diff --git a/include/linux/capability.h b/include/linux/capability.h
index c3021105edc0..c8f2a5f70ed5 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -7,7 +7,7 @@
7 * 7 *
8 * See here for the libcap library ("POSIX draft" compliance): 8 * See here for the libcap library ("POSIX draft" compliance):
9 * 9 *
10 * ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/ 10 * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
11 */ 11 */
12 12
13#ifndef _LINUX_CAPABILITY_H 13#ifndef _LINUX_CAPABILITY_H
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 90bba9e62286..b62bb9294d0c 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -141,6 +141,38 @@ enum {
141 CGRP_WAIT_ON_RMDIR, 141 CGRP_WAIT_ON_RMDIR,
142}; 142};
143 143
144/* which pidlist file are we talking about? */
145enum cgroup_filetype {
146 CGROUP_FILE_PROCS,
147 CGROUP_FILE_TASKS,
148};
149
150/*
151 * A pidlist is a list of pids that virtually represents the contents of one
152 * of the cgroup files ("procs" or "tasks"). We keep a list of such pidlists,
153 * a pair (one each for procs, tasks) for each pid namespace that's relevant
154 * to the cgroup.
155 */
156struct cgroup_pidlist {
157 /*
158 * used to find which pidlist is wanted. doesn't change as long as
159 * this particular list stays in the list.
160 */
161 struct { enum cgroup_filetype type; struct pid_namespace *ns; } key;
162 /* array of xids */
163 pid_t *list;
164 /* how many elements the above list has */
165 int length;
166 /* how many files are using the current array */
167 int use_count;
168 /* each of these stored in a list by its cgroup */
169 struct list_head links;
170 /* pointer to the cgroup we belong to, for list removal purposes */
171 struct cgroup *owner;
172 /* protects the other fields */
173 struct rw_semaphore mutex;
174};
175
144struct cgroup { 176struct cgroup {
145 unsigned long flags; /* "unsigned long" so bitops work */ 177 unsigned long flags; /* "unsigned long" so bitops work */
146 178
@@ -179,11 +211,12 @@ struct cgroup {
179 */ 211 */
180 struct list_head release_list; 212 struct list_head release_list;
181 213
182 /* pids_mutex protects pids_list and cached pid arrays. */ 214 /*
183 struct rw_semaphore pids_mutex; 215 * list of pidlists, up to two for each namespace (one for procs, one
184 216 * for tasks); created on demand.
185 /* Linked list of struct cgroup_pids */ 217 */
186 struct list_head pids_list; 218 struct list_head pidlists;
219 struct mutex pidlist_mutex;
187 220
188 /* For RCU-protected deletion */ 221 /* For RCU-protected deletion */
189 struct rcu_head rcu_head; 222 struct rcu_head rcu_head;
@@ -227,6 +260,9 @@ struct css_set {
227 * during subsystem registration (at boot time). 260 * during subsystem registration (at boot time).
228 */ 261 */
229 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 262 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
263
264 /* For RCU-protected deletion */
265 struct rcu_head rcu_head;
230}; 266};
231 267
232/* 268/*
@@ -389,10 +425,11 @@ struct cgroup_subsys {
389 struct cgroup *cgrp); 425 struct cgroup *cgrp);
390 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 426 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
391 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 427 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
392 int (*can_attach)(struct cgroup_subsys *ss, 428 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
393 struct cgroup *cgrp, struct task_struct *tsk); 429 struct task_struct *tsk, bool threadgroup);
394 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 430 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
395 struct cgroup *old_cgrp, struct task_struct *tsk); 431 struct cgroup *old_cgrp, struct task_struct *tsk,
432 bool threadgroup);
396 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); 433 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
397 void (*exit)(struct cgroup_subsys *ss, struct task_struct *task); 434 void (*exit)(struct cgroup_subsys *ss, struct task_struct *task);
398 int (*populate)(struct cgroup_subsys *ss, 435 int (*populate)(struct cgroup_subsys *ss,
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 1219be4fb42e..83d2fbd81b93 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -14,6 +14,7 @@
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/cache.h> 15#include <linux/cache.h>
16#include <linux/timer.h> 16#include <linux/timer.h>
17#include <linux/init.h>
17#include <asm/div64.h> 18#include <asm/div64.h>
18#include <asm/io.h> 19#include <asm/io.h>
19 20
@@ -148,14 +149,11 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
148 * @disable: optional function to disable the clocksource 149 * @disable: optional function to disable the clocksource
149 * @mask: bitmask for two's complement 150 * @mask: bitmask for two's complement
150 * subtraction of non 64 bit counters 151 * subtraction of non 64 bit counters
151 * @mult: cycle to nanosecond multiplier (adjusted by NTP) 152 * @mult: cycle to nanosecond multiplier
152 * @mult_orig: cycle to nanosecond multiplier (unadjusted by NTP)
153 * @shift: cycle to nanosecond divisor (power of two) 153 * @shift: cycle to nanosecond divisor (power of two)
154 * @flags: flags describing special properties 154 * @flags: flags describing special properties
155 * @vread: vsyscall based read 155 * @vread: vsyscall based read
156 * @resume: resume function for the clocksource, if necessary 156 * @resume: resume function for the clocksource, if necessary
157 * @cycle_interval: Used internally by timekeeping core, please ignore.
158 * @xtime_interval: Used internally by timekeeping core, please ignore.
159 */ 157 */
160struct clocksource { 158struct clocksource {
161 /* 159 /*
@@ -169,7 +167,6 @@ struct clocksource {
169 void (*disable)(struct clocksource *cs); 167 void (*disable)(struct clocksource *cs);
170 cycle_t mask; 168 cycle_t mask;
171 u32 mult; 169 u32 mult;
172 u32 mult_orig;
173 u32 shift; 170 u32 shift;
174 unsigned long flags; 171 unsigned long flags;
175 cycle_t (*vread)(void); 172 cycle_t (*vread)(void);
@@ -181,19 +178,12 @@ struct clocksource {
181#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0) 178#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0)
182#endif 179#endif
183 180
184 /* timekeeping specific data, ignore */
185 cycle_t cycle_interval;
186 u64 xtime_interval;
187 u32 raw_interval;
188 /* 181 /*
189 * Second part is written at each timer interrupt 182 * Second part is written at each timer interrupt
190 * Keep it in a different cache line to dirty no 183 * Keep it in a different cache line to dirty no
191 * more than one cache line. 184 * more than one cache line.
192 */ 185 */
193 cycle_t cycle_last ____cacheline_aligned_in_smp; 186 cycle_t cycle_last ____cacheline_aligned_in_smp;
194 u64 xtime_nsec;
195 s64 error;
196 struct timespec raw_time;
197 187
198#ifdef CONFIG_CLOCKSOURCE_WATCHDOG 188#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
199 /* Watchdog related data, used by the framework */ 189 /* Watchdog related data, used by the framework */
@@ -202,8 +192,6 @@ struct clocksource {
202#endif 192#endif
203}; 193};
204 194
205extern struct clocksource *clock; /* current clocksource */
206
207/* 195/*
208 * Clock source flags bits:: 196 * Clock source flags bits::
209 */ 197 */
@@ -212,6 +200,7 @@ extern struct clocksource *clock; /* current clocksource */
212 200
213#define CLOCK_SOURCE_WATCHDOG 0x10 201#define CLOCK_SOURCE_WATCHDOG 0x10
214#define CLOCK_SOURCE_VALID_FOR_HRES 0x20 202#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
203#define CLOCK_SOURCE_UNSTABLE 0x40
215 204
216/* simplify initialization of mask field */ 205/* simplify initialization of mask field */
217#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) 206#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
@@ -268,108 +257,15 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
268} 257}
269 258
270/** 259/**
271 * clocksource_read: - Access the clocksource's current cycle value 260 * clocksource_cyc2ns - converts clocksource cycles to nanoseconds
272 * @cs: pointer to clocksource being read
273 *
274 * Uses the clocksource to return the current cycle_t value
275 */
276static inline cycle_t clocksource_read(struct clocksource *cs)
277{
278 return cs->read(cs);
279}
280
281/**
282 * clocksource_enable: - enable clocksource
283 * @cs: pointer to clocksource
284 *
285 * Enables the specified clocksource. The clocksource callback
286 * function should start up the hardware and setup mult and field
287 * members of struct clocksource to reflect hardware capabilities.
288 */
289static inline int clocksource_enable(struct clocksource *cs)
290{
291 int ret = 0;
292
293 if (cs->enable)
294 ret = cs->enable(cs);
295
296 /*
297 * The frequency may have changed while the clocksource
298 * was disabled. If so the code in ->enable() must update
299 * the mult value to reflect the new frequency. Make sure
300 * mult_orig follows this change.
301 */
302 cs->mult_orig = cs->mult;
303
304 return ret;
305}
306
307/**
308 * clocksource_disable: - disable clocksource
309 * @cs: pointer to clocksource
310 *
311 * Disables the specified clocksource. The clocksource callback
312 * function should power down the now unused hardware block to
313 * save power.
314 */
315static inline void clocksource_disable(struct clocksource *cs)
316{
317 /*
318 * Save mult_orig in mult so clocksource_enable() can
319 * restore the value regardless if ->enable() updates
320 * the value of mult or not.
321 */
322 cs->mult = cs->mult_orig;
323
324 if (cs->disable)
325 cs->disable(cs);
326}
327
328/**
329 * cyc2ns - converts clocksource cycles to nanoseconds
330 * @cs: Pointer to clocksource
331 * @cycles: Cycles
332 * 261 *
333 * Uses the clocksource and ntp ajdustment to convert cycle_ts to nanoseconds. 262 * Converts cycles to nanoseconds, using the given mult and shift.
334 * 263 *
335 * XXX - This could use some mult_lxl_ll() asm optimization 264 * XXX - This could use some mult_lxl_ll() asm optimization
336 */ 265 */
337static inline s64 cyc2ns(struct clocksource *cs, cycle_t cycles) 266static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
338{
339 u64 ret = (u64)cycles;
340 ret = (ret * cs->mult) >> cs->shift;
341 return ret;
342}
343
344/**
345 * clocksource_calculate_interval - Calculates a clocksource interval struct
346 *
347 * @c: Pointer to clocksource.
348 * @length_nsec: Desired interval length in nanoseconds.
349 *
350 * Calculates a fixed cycle/nsec interval for a given clocksource/adjustment
351 * pair and interval request.
352 *
353 * Unless you're the timekeeping code, you should not be using this!
354 */
355static inline void clocksource_calculate_interval(struct clocksource *c,
356 unsigned long length_nsec)
357{ 267{
358 u64 tmp; 268 return ((u64) cycles * mult) >> shift;
359
360 /* Do the ns -> cycle conversion first, using original mult */
361 tmp = length_nsec;
362 tmp <<= c->shift;
363 tmp += c->mult_orig/2;
364 do_div(tmp, c->mult_orig);
365
366 c->cycle_interval = (cycle_t)tmp;
367 if (c->cycle_interval == 0)
368 c->cycle_interval = 1;
369
370 /* Go back from cycles -> shifted ns, this time use ntp adjused mult */
371 c->xtime_interval = (u64)c->cycle_interval * c->mult;
372 c->raw_interval = ((u64)c->cycle_interval * c->mult_orig) >> c->shift;
373} 269}
374 270
375 271
@@ -380,6 +276,8 @@ extern void clocksource_touch_watchdog(void);
380extern struct clocksource* clocksource_get_next(void); 276extern struct clocksource* clocksource_get_next(void);
381extern void clocksource_change_rating(struct clocksource *cs, int rating); 277extern void clocksource_change_rating(struct clocksource *cs, int rating);
382extern void clocksource_resume(void); 278extern void clocksource_resume(void);
279extern struct clocksource * __init __weak clocksource_default_clock(void);
280extern void clocksource_mark_unstable(struct clocksource *cs);
383 281
384#ifdef CONFIG_GENERIC_TIME_VSYSCALL 282#ifdef CONFIG_GENERIC_TIME_VSYSCALL
385extern void update_vsyscall(struct timespec *ts, struct clocksource *c); 283extern void update_vsyscall(struct timespec *ts, struct clocksource *c);
@@ -394,4 +292,6 @@ static inline void update_vsyscall_tz(void)
394} 292}
395#endif 293#endif
396 294
295extern void timekeeping_notify(struct clocksource *clock);
296
397#endif /* _LINUX_CLOCKSOURCE_H */ 297#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index b8125b2eb665..47dac5ea8d3a 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -52,6 +52,7 @@ struct proc_event {
52 PROC_EVENT_EXEC = 0x00000002, 52 PROC_EVENT_EXEC = 0x00000002,
53 PROC_EVENT_UID = 0x00000004, 53 PROC_EVENT_UID = 0x00000004,
54 PROC_EVENT_GID = 0x00000040, 54 PROC_EVENT_GID = 0x00000040,
55 PROC_EVENT_SID = 0x00000080,
55 /* "next" should be 0x00000400 */ 56 /* "next" should be 0x00000400 */
56 /* "last" is the last process event: exit */ 57 /* "last" is the last process event: exit */
57 PROC_EVENT_EXIT = 0x80000000 58 PROC_EVENT_EXIT = 0x80000000
@@ -89,6 +90,11 @@ struct proc_event {
89 } e; 90 } e;
90 } id; 91 } id;
91 92
93 struct sid_proc_event {
94 __kernel_pid_t process_pid;
95 __kernel_pid_t process_tgid;
96 } sid;
97
92 struct exit_proc_event { 98 struct exit_proc_event {
93 __kernel_pid_t process_pid; 99 __kernel_pid_t process_pid;
94 __kernel_pid_t process_tgid; 100 __kernel_pid_t process_tgid;
@@ -102,6 +108,7 @@ struct proc_event {
102void proc_fork_connector(struct task_struct *task); 108void proc_fork_connector(struct task_struct *task);
103void proc_exec_connector(struct task_struct *task); 109void proc_exec_connector(struct task_struct *task);
104void proc_id_connector(struct task_struct *task, int which_id); 110void proc_id_connector(struct task_struct *task, int which_id);
111void proc_sid_connector(struct task_struct *task);
105void proc_exit_connector(struct task_struct *task); 112void proc_exit_connector(struct task_struct *task);
106#else 113#else
107static inline void proc_fork_connector(struct task_struct *task) 114static inline void proc_fork_connector(struct task_struct *task)
@@ -114,6 +121,9 @@ static inline void proc_id_connector(struct task_struct *task,
114 int which_id) 121 int which_id)
115{} 122{}
116 123
124static inline void proc_sid_connector(struct task_struct *task)
125{}
126
117static inline void proc_exit_connector(struct task_struct *task) 127static inline void proc_exit_connector(struct task_struct *task)
118{} 128{}
119#endif /* CONFIG_PROC_EVENTS */ 129#endif /* CONFIG_PROC_EVENTS */
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 7f627775c947..ddb7a97c78c2 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -27,8 +27,8 @@
27 * 27 *
28 * configfs Copyright (C) 2005 Oracle. All rights reserved. 28 * configfs Copyright (C) 2005 Oracle. All rights reserved.
29 * 29 *
30 * Please read Documentation/filesystems/configfs.txt before using the 30 * Please read Documentation/filesystems/configfs/configfs.txt before using
31 * configfs interface, ESPECIALLY the parts about reference counts and 31 * the configfs interface, ESPECIALLY the parts about reference counts and
32 * item destructors. 32 * item destructors.
33 */ 33 */
34 34
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 161042746afc..44717eb47639 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -65,6 +65,9 @@ static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
65 65
66struct cpufreq_governor; 66struct cpufreq_governor;
67 67
68/* /sys/devices/system/cpu/cpufreq: entry point for global variables */
69extern struct kobject *cpufreq_global_kobject;
70
68#define CPUFREQ_ETERNAL (-1) 71#define CPUFREQ_ETERNAL (-1)
69struct cpufreq_cpuinfo { 72struct cpufreq_cpuinfo {
70 unsigned int max_freq; 73 unsigned int max_freq;
@@ -274,6 +277,13 @@ struct freq_attr {
274 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count); 277 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count);
275}; 278};
276 279
280struct global_attr {
281 struct attribute attr;
282 ssize_t (*show)(struct kobject *kobj,
283 struct attribute *attr, char *buf);
284 ssize_t (*store)(struct kobject *a, struct attribute *b,
285 const char *c, size_t count);
286};
277 287
278/********************************************************************* 288/*********************************************************************
279 * CPUFREQ 2.6. INTERFACE * 289 * CPUFREQ 2.6. INTERFACE *
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 796df12091b7..789cf5f920ce 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -3,444 +3,37 @@
3 3
4/* 4/*
5 * Cpumasks provide a bitmap suitable for representing the 5 * Cpumasks provide a bitmap suitable for representing the
6 * set of CPU's in a system, one bit position per CPU number. 6 * set of CPU's in a system, one bit position per CPU number. In general,
7 * 7 * only nr_cpu_ids (<= NR_CPUS) bits are valid.
8 * The new cpumask_ ops take a "struct cpumask *"; the old ones
9 * use cpumask_t.
10 *
11 * See detailed comments in the file linux/bitmap.h describing the
12 * data type on which these cpumasks are based.
13 *
14 * For details of cpumask_scnprintf() and cpumask_parse_user(),
15 * see bitmap_scnprintf() and bitmap_parse_user() in lib/bitmap.c.
16 * For details of cpulist_scnprintf() and cpulist_parse(), see
17 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c.
18 * For details of cpu_remap(), see bitmap_bitremap in lib/bitmap.c
19 * For details of cpus_remap(), see bitmap_remap in lib/bitmap.c.
20 * For details of cpus_onto(), see bitmap_onto in lib/bitmap.c.
21 * For details of cpus_fold(), see bitmap_fold in lib/bitmap.c.
22 *
23 * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24 * Note: The alternate operations with the suffix "_nr" are used
25 * to limit the range of the loop to nr_cpu_ids instead of
26 * NR_CPUS when NR_CPUS > 64 for performance reasons.
27 * If NR_CPUS is <= 64 then most assembler bitmask
28 * operators execute faster with a constant range, so
29 * the operator will continue to use NR_CPUS.
30 *
31 * Another consideration is that nr_cpu_ids is initialized
32 * to NR_CPUS and isn't lowered until the possible cpus are
33 * discovered (including any disabled cpus). So early uses
34 * will span the entire range of NR_CPUS.
35 * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36 *
37 * The obsolescent cpumask operations are:
38 *
39 * void cpu_set(cpu, mask) turn on bit 'cpu' in mask
40 * void cpu_clear(cpu, mask) turn off bit 'cpu' in mask
41 * void cpus_setall(mask) set all bits
42 * void cpus_clear(mask) clear all bits
43 * int cpu_isset(cpu, mask) true iff bit 'cpu' set in mask
44 * int cpu_test_and_set(cpu, mask) test and set bit 'cpu' in mask
45 *
46 * int cpus_and(dst, src1, src2) dst = src1 & src2 [intersection]
47 * void cpus_or(dst, src1, src2) dst = src1 | src2 [union]
48 * void cpus_xor(dst, src1, src2) dst = src1 ^ src2
49 * int cpus_andnot(dst, src1, src2) dst = src1 & ~src2
50 * void cpus_complement(dst, src) dst = ~src
51 *
52 * int cpus_equal(mask1, mask2) Does mask1 == mask2?
53 * int cpus_intersects(mask1, mask2) Do mask1 and mask2 intersect?
54 * int cpus_subset(mask1, mask2) Is mask1 a subset of mask2?
55 * int cpus_empty(mask) Is mask empty (no bits sets)?
56 * int cpus_full(mask) Is mask full (all bits sets)?
57 * int cpus_weight(mask) Hamming weigh - number of set bits
58 * int cpus_weight_nr(mask) Same using nr_cpu_ids instead of NR_CPUS
59 *
60 * void cpus_shift_right(dst, src, n) Shift right
61 * void cpus_shift_left(dst, src, n) Shift left
62 *
63 * int first_cpu(mask) Number lowest set bit, or NR_CPUS
64 * int next_cpu(cpu, mask) Next cpu past 'cpu', or NR_CPUS
65 * int next_cpu_nr(cpu, mask) Next cpu past 'cpu', or nr_cpu_ids
66 *
67 * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set
68 * (can be used as an lvalue)
69 * CPU_MASK_ALL Initializer - all bits set
70 * CPU_MASK_NONE Initializer - no bits set
71 * unsigned long *cpus_addr(mask) Array of unsigned long's in mask
72 *
73 * CPUMASK_ALLOC kmalloc's a structure that is a composite of many cpumask_t
74 * variables, and CPUMASK_PTR provides pointers to each field.
75 *
76 * The structure should be defined something like this:
77 * struct my_cpumasks {
78 * cpumask_t mask1;
79 * cpumask_t mask2;
80 * };
81 *
82 * Usage is then:
83 * CPUMASK_ALLOC(my_cpumasks);
84 * CPUMASK_PTR(mask1, my_cpumasks);
85 * CPUMASK_PTR(mask2, my_cpumasks);
86 *
87 * --- DO NOT reference cpumask_t pointers until this check ---
88 * if (my_cpumasks == NULL)
89 * "kmalloc failed"...
90 *
91 * References are now pointers to the cpumask_t variables (*mask1, ...)
92 *
93 *if NR_CPUS > BITS_PER_LONG
94 * CPUMASK_ALLOC(m) Declares and allocates struct m *m =
95 * kmalloc(sizeof(*m), GFP_KERNEL)
96 * CPUMASK_FREE(m) Macro for kfree(m)
97 *else
98 * CPUMASK_ALLOC(m) Declares struct m _m, *m = &_m
99 * CPUMASK_FREE(m) Nop
100 *endif
101 * CPUMASK_PTR(v, m) Declares cpumask_t *v = &(m->v)
102 * ------------------------------------------------------------------------
103 *
104 * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing
105 * int cpumask_parse_user(ubuf, ulen, mask) Parse ascii string as cpumask
106 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
107 * int cpulist_parse(buf, map) Parse ascii string as cpulist
108 * int cpu_remap(oldbit, old, new) newbit = map(old, new)(oldbit)
109 * void cpus_remap(dst, src, old, new) *dst = map(old, new)(src)
110 * void cpus_onto(dst, orig, relmap) *dst = orig relative to relmap
111 * void cpus_fold(dst, orig, sz) dst bits = orig bits mod sz
112 *
113 * for_each_cpu_mask(cpu, mask) for-loop cpu over mask using NR_CPUS
114 * for_each_cpu_mask_nr(cpu, mask) for-loop cpu over mask using nr_cpu_ids
115 *
116 * int num_online_cpus() Number of online CPUs
117 * int num_possible_cpus() Number of all possible CPUs
118 * int num_present_cpus() Number of present CPUs
119 *
120 * int cpu_online(cpu) Is some cpu online?
121 * int cpu_possible(cpu) Is some cpu possible?
122 * int cpu_present(cpu) Is some cpu present (can schedule)?
123 *
124 * int any_online_cpu(mask) First online cpu in mask
125 *
126 * for_each_possible_cpu(cpu) for-loop cpu over cpu_possible_map
127 * for_each_online_cpu(cpu) for-loop cpu over cpu_online_map
128 * for_each_present_cpu(cpu) for-loop cpu over cpu_present_map
129 *
130 * Subtlety:
131 * 1) The 'type-checked' form of cpu_isset() causes gcc (3.3.2, anyway)
132 * to generate slightly worse code. Note for example the additional
133 * 40 lines of assembly code compiling the "for each possible cpu"
134 * loops buried in the disk_stat_read() macros calls when compiling
135 * drivers/block/genhd.c (arch i386, CONFIG_SMP=y). So use a simple
136 * one-line #define for cpu_isset(), instead of wrapping an inline
137 * inside a macro, the way we do the other calls.
138 */ 8 */
139
140#include <linux/kernel.h> 9#include <linux/kernel.h>
141#include <linux/threads.h> 10#include <linux/threads.h>
142#include <linux/bitmap.h> 11#include <linux/bitmap.h>
143 12
144typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; 13typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
145extern cpumask_t _unused_cpumask_arg_;
146
147#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
148#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
149static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
150{
151 set_bit(cpu, dstp->bits);
152}
153
154#define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst))
155static inline void __cpu_clear(int cpu, volatile cpumask_t *dstp)
156{
157 clear_bit(cpu, dstp->bits);
158}
159
160#define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)
161static inline void __cpus_setall(cpumask_t *dstp, int nbits)
162{
163 bitmap_fill(dstp->bits, nbits);
164}
165
166#define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS)
167static inline void __cpus_clear(cpumask_t *dstp, int nbits)
168{
169 bitmap_zero(dstp->bits, nbits);
170}
171
172/* No static inline type checking - see Subtlety (1) above. */
173#define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits)
174
175#define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), &(cpumask))
176static inline int __cpu_test_and_set(int cpu, cpumask_t *addr)
177{
178 return test_and_set_bit(cpu, addr->bits);
179}
180
181#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
182static inline int __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
183 const cpumask_t *src2p, int nbits)
184{
185 return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
186}
187
188#define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
189static inline void __cpus_or(cpumask_t *dstp, const cpumask_t *src1p,
190 const cpumask_t *src2p, int nbits)
191{
192 bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
193}
194
195#define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)
196static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
197 const cpumask_t *src2p, int nbits)
198{
199 bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
200}
201
202#define cpus_andnot(dst, src1, src2) \
203 __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
204static inline int __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
205 const cpumask_t *src2p, int nbits)
206{
207 return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
208}
209
210#define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS)
211static inline void __cpus_complement(cpumask_t *dstp,
212 const cpumask_t *srcp, int nbits)
213{
214 bitmap_complement(dstp->bits, srcp->bits, nbits);
215}
216
217#define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS)
218static inline int __cpus_equal(const cpumask_t *src1p,
219 const cpumask_t *src2p, int nbits)
220{
221 return bitmap_equal(src1p->bits, src2p->bits, nbits);
222}
223
224#define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS)
225static inline int __cpus_intersects(const cpumask_t *src1p,
226 const cpumask_t *src2p, int nbits)
227{
228 return bitmap_intersects(src1p->bits, src2p->bits, nbits);
229}
230
231#define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS)
232static inline int __cpus_subset(const cpumask_t *src1p,
233 const cpumask_t *src2p, int nbits)
234{
235 return bitmap_subset(src1p->bits, src2p->bits, nbits);
236}
237
238#define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
239static inline int __cpus_empty(const cpumask_t *srcp, int nbits)
240{
241 return bitmap_empty(srcp->bits, nbits);
242}
243
244#define cpus_full(cpumask) __cpus_full(&(cpumask), NR_CPUS)
245static inline int __cpus_full(const cpumask_t *srcp, int nbits)
246{
247 return bitmap_full(srcp->bits, nbits);
248}
249
250#define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS)
251static inline int __cpus_weight(const cpumask_t *srcp, int nbits)
252{
253 return bitmap_weight(srcp->bits, nbits);
254}
255
256#define cpus_shift_right(dst, src, n) \
257 __cpus_shift_right(&(dst), &(src), (n), NR_CPUS)
258static inline void __cpus_shift_right(cpumask_t *dstp,
259 const cpumask_t *srcp, int n, int nbits)
260{
261 bitmap_shift_right(dstp->bits, srcp->bits, n, nbits);
262}
263
264#define cpus_shift_left(dst, src, n) \
265 __cpus_shift_left(&(dst), &(src), (n), NR_CPUS)
266static inline void __cpus_shift_left(cpumask_t *dstp,
267 const cpumask_t *srcp, int n, int nbits)
268{
269 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
270}
271#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
272 14
273/** 15/**
274 * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask * 16 * cpumask_bits - get the bits in a cpumask
275 * @bitmap: the bitmap 17 * @maskp: the struct cpumask *
276 *
277 * There are a few places where cpumask_var_t isn't appropriate and
278 * static cpumasks must be used (eg. very early boot), yet we don't
279 * expose the definition of 'struct cpumask'.
280 * 18 *
281 * This does the conversion, and can be used as a constant initializer. 19 * You should only assume nr_cpu_ids bits of this mask are valid. This is
20 * a macro so it's const-correct.
282 */ 21 */
283#define to_cpumask(bitmap) \ 22#define cpumask_bits(maskp) ((maskp)->bits)
284 ((struct cpumask *)(1 ? (bitmap) \
285 : (void *)sizeof(__check_is_bitmap(bitmap))))
286
287static inline int __check_is_bitmap(const unsigned long *bitmap)
288{
289 return 1;
290}
291
292/*
293 * Special-case data structure for "single bit set only" constant CPU masks.
294 *
295 * We pre-generate all the 64 (or 32) possible bit positions, with enough
296 * padding to the left and the right, and return the constant pointer
297 * appropriately offset.
298 */
299extern const unsigned long
300 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)];
301
302static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
303{
304 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
305 p -= cpu / BITS_PER_LONG;
306 return to_cpumask(p);
307}
308
309#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
310/*
311 * In cases where we take the address of the cpumask immediately,
312 * gcc optimizes it out (it's a constant) and there's no huge stack
313 * variable created:
314 */
315#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu))
316
317
318#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
319
320#if NR_CPUS <= BITS_PER_LONG
321
322#define CPU_MASK_ALL \
323(cpumask_t) { { \
324 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
325} }
326
327#define CPU_MASK_ALL_PTR (&CPU_MASK_ALL)
328
329#else
330
331#define CPU_MASK_ALL \
332(cpumask_t) { { \
333 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
334 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
335} }
336
337/* cpu_mask_all is in init/main.c */
338extern cpumask_t cpu_mask_all;
339#define CPU_MASK_ALL_PTR (&cpu_mask_all)
340
341#endif
342
343#define CPU_MASK_NONE \
344(cpumask_t) { { \
345 [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \
346} }
347
348#define CPU_MASK_CPU0 \
349(cpumask_t) { { \
350 [0] = 1UL \
351} }
352
353#define cpus_addr(src) ((src).bits)
354
355#if NR_CPUS > BITS_PER_LONG
356#define CPUMASK_ALLOC(m) struct m *m = kmalloc(sizeof(*m), GFP_KERNEL)
357#define CPUMASK_FREE(m) kfree(m)
358#else
359#define CPUMASK_ALLOC(m) struct m _m, *m = &_m
360#define CPUMASK_FREE(m)
361#endif
362#define CPUMASK_PTR(v, m) cpumask_t *v = &(m->v)
363
364#define cpu_remap(oldbit, old, new) \
365 __cpu_remap((oldbit), &(old), &(new), NR_CPUS)
366static inline int __cpu_remap(int oldbit,
367 const cpumask_t *oldp, const cpumask_t *newp, int nbits)
368{
369 return bitmap_bitremap(oldbit, oldp->bits, newp->bits, nbits);
370}
371
372#define cpus_remap(dst, src, old, new) \
373 __cpus_remap(&(dst), &(src), &(old), &(new), NR_CPUS)
374static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp,
375 const cpumask_t *oldp, const cpumask_t *newp, int nbits)
376{
377 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits);
378}
379
380#define cpus_onto(dst, orig, relmap) \
381 __cpus_onto(&(dst), &(orig), &(relmap), NR_CPUS)
382static inline void __cpus_onto(cpumask_t *dstp, const cpumask_t *origp,
383 const cpumask_t *relmapp, int nbits)
384{
385 bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits);
386}
387
388#define cpus_fold(dst, orig, sz) \
389 __cpus_fold(&(dst), &(orig), sz, NR_CPUS)
390static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp,
391 int sz, int nbits)
392{
393 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
394}
395#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
396 23
397#if NR_CPUS == 1 24#if NR_CPUS == 1
398
399#define nr_cpu_ids 1 25#define nr_cpu_ids 1
400#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS 26#else
401#define first_cpu(src) ({ (void)(src); 0; })
402#define next_cpu(n, src) ({ (void)(src); 1; })
403#define any_online_cpu(mask) 0
404#define for_each_cpu_mask(cpu, mask) \
405 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
406#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
407#else /* NR_CPUS > 1 */
408
409extern int nr_cpu_ids; 27extern int nr_cpu_ids;
410#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
411int __first_cpu(const cpumask_t *srcp);
412int __next_cpu(int n, const cpumask_t *srcp);
413int __any_online_cpu(const cpumask_t *mask);
414
415#define first_cpu(src) __first_cpu(&(src))
416#define next_cpu(n, src) __next_cpu((n), &(src))
417#define any_online_cpu(mask) __any_online_cpu(&(mask))
418#define for_each_cpu_mask(cpu, mask) \
419 for ((cpu) = -1; \
420 (cpu) = next_cpu((cpu), (mask)), \
421 (cpu) < NR_CPUS; )
422#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
423#endif 28#endif
424 29
425#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS 30#ifdef CONFIG_CPUMASK_OFFSTACK
426#if NR_CPUS <= 64 31/* Assuming NR_CPUS is huge, a runtime limit is more efficient. Also,
427 32 * not all bits may be allocated. */
428#define next_cpu_nr(n, src) next_cpu(n, src) 33#define nr_cpumask_bits nr_cpu_ids
429#define cpus_weight_nr(cpumask) cpus_weight(cpumask) 34#else
430#define for_each_cpu_mask_nr(cpu, mask) for_each_cpu_mask(cpu, mask) 35#define nr_cpumask_bits NR_CPUS
431 36#endif
432#else /* NR_CPUS > 64 */
433
434int __next_cpu_nr(int n, const cpumask_t *srcp);
435#define next_cpu_nr(n, src) __next_cpu_nr((n), &(src))
436#define cpus_weight_nr(cpumask) __cpus_weight(&(cpumask), nr_cpu_ids)
437#define for_each_cpu_mask_nr(cpu, mask) \
438 for ((cpu) = -1; \
439 (cpu) = next_cpu_nr((cpu), (mask)), \
440 (cpu) < nr_cpu_ids; )
441
442#endif /* NR_CPUS > 64 */
443#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
444 37
445/* 38/*
446 * The following particular system cpumasks and operations manage 39 * The following particular system cpumasks and operations manage
@@ -487,12 +80,6 @@ extern const struct cpumask *const cpu_online_mask;
487extern const struct cpumask *const cpu_present_mask; 80extern const struct cpumask *const cpu_present_mask;
488extern const struct cpumask *const cpu_active_mask; 81extern const struct cpumask *const cpu_active_mask;
489 82
490/* These strip const, as traditionally they weren't const. */
491#define cpu_possible_map (*(cpumask_t *)cpu_possible_mask)
492#define cpu_online_map (*(cpumask_t *)cpu_online_mask)
493#define cpu_present_map (*(cpumask_t *)cpu_present_mask)
494#define cpu_active_map (*(cpumask_t *)cpu_active_mask)
495
496#if NR_CPUS > 1 83#if NR_CPUS > 1
497#define num_online_cpus() cpumask_weight(cpu_online_mask) 84#define num_online_cpus() cpumask_weight(cpu_online_mask)
498#define num_possible_cpus() cpumask_weight(cpu_possible_mask) 85#define num_possible_cpus() cpumask_weight(cpu_possible_mask)
@@ -511,35 +98,6 @@ extern const struct cpumask *const cpu_active_mask;
511#define cpu_active(cpu) ((cpu) == 0) 98#define cpu_active(cpu) ((cpu) == 0)
512#endif 99#endif
513 100
514#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
515
516/* These are the new versions of the cpumask operators: passed by pointer.
517 * The older versions will be implemented in terms of these, then deleted. */
518#define cpumask_bits(maskp) ((maskp)->bits)
519
520#if NR_CPUS <= BITS_PER_LONG
521#define CPU_BITS_ALL \
522{ \
523 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
524}
525
526#else /* NR_CPUS > BITS_PER_LONG */
527
528#define CPU_BITS_ALL \
529{ \
530 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
531 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
532}
533#endif /* NR_CPUS > BITS_PER_LONG */
534
535#ifdef CONFIG_CPUMASK_OFFSTACK
536/* Assuming NR_CPUS is huge, a runtime limit is more efficient. Also,
537 * not all bits may be allocated. */
538#define nr_cpumask_bits nr_cpu_ids
539#else
540#define nr_cpumask_bits NR_CPUS
541#endif
542
543/* verify cpu argument to cpumask_* operators */ 101/* verify cpu argument to cpumask_* operators */
544static inline unsigned int cpumask_check(unsigned int cpu) 102static inline unsigned int cpumask_check(unsigned int cpu)
545{ 103{
@@ -715,6 +273,18 @@ static inline int cpumask_test_and_set_cpu(int cpu, struct cpumask *cpumask)
715} 273}
716 274
717/** 275/**
276 * cpumask_test_and_clear_cpu - atomically test and clear a cpu in a cpumask
277 * @cpu: cpu number (< nr_cpu_ids)
278 * @cpumask: the cpumask pointer
279 *
280 * test_and_clear_bit wrapper for cpumasks.
281 */
282static inline int cpumask_test_and_clear_cpu(int cpu, struct cpumask *cpumask)
283{
284 return test_and_clear_bit(cpumask_check(cpu), cpumask_bits(cpumask));
285}
286
287/**
718 * cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask 288 * cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask
719 * @dstp: the cpumask pointer 289 * @dstp: the cpumask pointer
720 */ 290 */
@@ -1088,4 +658,241 @@ void set_cpu_active(unsigned int cpu, bool active);
1088void init_cpu_present(const struct cpumask *src); 658void init_cpu_present(const struct cpumask *src);
1089void init_cpu_possible(const struct cpumask *src); 659void init_cpu_possible(const struct cpumask *src);
1090void init_cpu_online(const struct cpumask *src); 660void init_cpu_online(const struct cpumask *src);
661
662/**
663 * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask *
664 * @bitmap: the bitmap
665 *
666 * There are a few places where cpumask_var_t isn't appropriate and
667 * static cpumasks must be used (eg. very early boot), yet we don't
668 * expose the definition of 'struct cpumask'.
669 *
670 * This does the conversion, and can be used as a constant initializer.
671 */
672#define to_cpumask(bitmap) \
673 ((struct cpumask *)(1 ? (bitmap) \
674 : (void *)sizeof(__check_is_bitmap(bitmap))))
675
676static inline int __check_is_bitmap(const unsigned long *bitmap)
677{
678 return 1;
679}
680
681/*
682 * Special-case data structure for "single bit set only" constant CPU masks.
683 *
684 * We pre-generate all the 64 (or 32) possible bit positions, with enough
685 * padding to the left and the right, and return the constant pointer
686 * appropriately offset.
687 */
688extern const unsigned long
689 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)];
690
691static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
692{
693 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
694 p -= cpu / BITS_PER_LONG;
695 return to_cpumask(p);
696}
697
698#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
699
700#if NR_CPUS <= BITS_PER_LONG
701#define CPU_BITS_ALL \
702{ \
703 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
704}
705
706#else /* NR_CPUS > BITS_PER_LONG */
707
708#define CPU_BITS_ALL \
709{ \
710 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
711 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
712}
713#endif /* NR_CPUS > BITS_PER_LONG */
714
715/*
716 *
717 * From here down, all obsolete. Use cpumask_ variants!
718 *
719 */
720#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
721/* These strip const, as traditionally they weren't const. */
722#define cpu_possible_map (*(cpumask_t *)cpu_possible_mask)
723#define cpu_online_map (*(cpumask_t *)cpu_online_mask)
724#define cpu_present_map (*(cpumask_t *)cpu_present_mask)
725#define cpu_active_map (*(cpumask_t *)cpu_active_mask)
726
727#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu))
728
729#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
730
731#if NR_CPUS <= BITS_PER_LONG
732
733#define CPU_MASK_ALL \
734(cpumask_t) { { \
735 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
736} }
737
738#else
739
740#define CPU_MASK_ALL \
741(cpumask_t) { { \
742 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
743 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
744} }
745
746#endif
747
748#define CPU_MASK_NONE \
749(cpumask_t) { { \
750 [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \
751} }
752
753#define CPU_MASK_CPU0 \
754(cpumask_t) { { \
755 [0] = 1UL \
756} }
757
758#if NR_CPUS == 1
759#define first_cpu(src) ({ (void)(src); 0; })
760#define next_cpu(n, src) ({ (void)(src); 1; })
761#define any_online_cpu(mask) 0
762#define for_each_cpu_mask(cpu, mask) \
763 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
764#else /* NR_CPUS > 1 */
765int __first_cpu(const cpumask_t *srcp);
766int __next_cpu(int n, const cpumask_t *srcp);
767int __any_online_cpu(const cpumask_t *mask);
768
769#define first_cpu(src) __first_cpu(&(src))
770#define next_cpu(n, src) __next_cpu((n), &(src))
771#define any_online_cpu(mask) __any_online_cpu(&(mask))
772#define for_each_cpu_mask(cpu, mask) \
773 for ((cpu) = -1; \
774 (cpu) = next_cpu((cpu), (mask)), \
775 (cpu) < NR_CPUS; )
776#endif /* SMP */
777
778#if NR_CPUS <= 64
779
780#define for_each_cpu_mask_nr(cpu, mask) for_each_cpu_mask(cpu, mask)
781
782#else /* NR_CPUS > 64 */
783
784int __next_cpu_nr(int n, const cpumask_t *srcp);
785#define for_each_cpu_mask_nr(cpu, mask) \
786 for ((cpu) = -1; \
787 (cpu) = __next_cpu_nr((cpu), &(mask)), \
788 (cpu) < nr_cpu_ids; )
789
790#endif /* NR_CPUS > 64 */
791
792#define cpus_addr(src) ((src).bits)
793
794#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
795static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
796{
797 set_bit(cpu, dstp->bits);
798}
799
800#define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst))
801static inline void __cpu_clear(int cpu, volatile cpumask_t *dstp)
802{
803 clear_bit(cpu, dstp->bits);
804}
805
806#define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)
807static inline void __cpus_setall(cpumask_t *dstp, int nbits)
808{
809 bitmap_fill(dstp->bits, nbits);
810}
811
812#define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS)
813static inline void __cpus_clear(cpumask_t *dstp, int nbits)
814{
815 bitmap_zero(dstp->bits, nbits);
816}
817
818/* No static inline type checking - see Subtlety (1) above. */
819#define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits)
820
821#define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), &(cpumask))
822static inline int __cpu_test_and_set(int cpu, cpumask_t *addr)
823{
824 return test_and_set_bit(cpu, addr->bits);
825}
826
827#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
828static inline int __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
829 const cpumask_t *src2p, int nbits)
830{
831 return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
832}
833
834#define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
835static inline void __cpus_or(cpumask_t *dstp, const cpumask_t *src1p,
836 const cpumask_t *src2p, int nbits)
837{
838 bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
839}
840
841#define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)
842static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
843 const cpumask_t *src2p, int nbits)
844{
845 bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
846}
847
848#define cpus_andnot(dst, src1, src2) \
849 __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
850static inline int __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
851 const cpumask_t *src2p, int nbits)
852{
853 return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
854}
855
856#define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS)
857static inline int __cpus_equal(const cpumask_t *src1p,
858 const cpumask_t *src2p, int nbits)
859{
860 return bitmap_equal(src1p->bits, src2p->bits, nbits);
861}
862
863#define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS)
864static inline int __cpus_intersects(const cpumask_t *src1p,
865 const cpumask_t *src2p, int nbits)
866{
867 return bitmap_intersects(src1p->bits, src2p->bits, nbits);
868}
869
870#define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS)
871static inline int __cpus_subset(const cpumask_t *src1p,
872 const cpumask_t *src2p, int nbits)
873{
874 return bitmap_subset(src1p->bits, src2p->bits, nbits);
875}
876
877#define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
878static inline int __cpus_empty(const cpumask_t *srcp, int nbits)
879{
880 return bitmap_empty(srcp->bits, nbits);
881}
882
883#define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS)
884static inline int __cpus_weight(const cpumask_t *srcp, int nbits)
885{
886 return bitmap_weight(srcp->bits, nbits);
887}
888
889#define cpus_shift_left(dst, src, n) \
890 __cpus_shift_left(&(dst), &(src), (n), NR_CPUS)
891static inline void __cpus_shift_left(cpumask_t *dstp,
892 const cpumask_t *srcp, int n, int nbits)
893{
894 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
895}
896#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
897
1091#endif /* __LINUX_CPUMASK_H */ 898#endif /* __LINUX_CPUMASK_H */
diff --git a/include/linux/cred.h b/include/linux/cred.h
index fb371601a3b4..4e3387a89cb9 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -176,23 +176,7 @@ extern void __invalid_creds(const struct cred *, const char *, unsigned);
176extern void __validate_process_creds(struct task_struct *, 176extern void __validate_process_creds(struct task_struct *,
177 const char *, unsigned); 177 const char *, unsigned);
178 178
179static inline bool creds_are_invalid(const struct cred *cred) 179extern bool creds_are_invalid(const struct cred *cred);
180{
181 if (cred->magic != CRED_MAGIC)
182 return true;
183 if (atomic_read(&cred->usage) < atomic_read(&cred->subscribers))
184 return true;
185#ifdef CONFIG_SECURITY_SELINUX
186 if (selinux_is_enabled()) {
187 if ((unsigned long) cred->security < PAGE_SIZE)
188 return true;
189 if ((*(u32 *)cred->security & 0xffffff00) ==
190 (POISON_FREE << 24 | POISON_FREE << 16 | POISON_FREE << 8))
191 return true;
192 }
193#endif
194 return false;
195}
196 180
197static inline void __validate_creds(const struct cred *cred, 181static inline void __validate_creds(const struct cred *cred,
198 const char *file, unsigned line) 182 const char *file, unsigned line)
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 1fbdea4f08eb..a5049eaf782d 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -499,6 +499,7 @@ struct cyclades_card {
499 void __iomem *p9050; 499 void __iomem *p9050;
500 struct RUNTIME_9060 __iomem *p9060; 500 struct RUNTIME_9060 __iomem *p9060;
501 } ctl_addr; 501 } ctl_addr;
502 struct BOARD_CTRL __iomem *board_ctrl; /* cyz specific */
502 int irq; 503 int irq;
503 unsigned int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */ 504 unsigned int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */
504 unsigned int first_line; /* minor number of first channel on card */ 505 unsigned int first_line; /* minor number of first channel on card */
@@ -541,6 +542,15 @@ struct cyclades_port {
541 int magic; 542 int magic;
542 struct tty_port port; 543 struct tty_port port;
543 struct cyclades_card *card; 544 struct cyclades_card *card;
545 union {
546 struct {
547 void __iomem *base_addr;
548 } cyy;
549 struct {
550 struct CH_CTRL __iomem *ch_ctrl;
551 struct BUF_CTRL __iomem *buf_ctrl;
552 } cyz;
553 } u;
544 int line; 554 int line;
545 int flags; /* defined in tty.h */ 555 int flags; /* defined in tty.h */
546 int type; /* UART type */ 556 int type; /* UART type */
@@ -568,7 +578,6 @@ struct cyclades_port {
568 struct cyclades_idle_stats idle_stats; 578 struct cyclades_idle_stats idle_stats;
569 struct cyclades_icount icount; 579 struct cyclades_icount icount;
570 struct completion shutdown_wait; 580 struct completion shutdown_wait;
571 wait_queue_head_t delta_msr_wait;
572 int throttle; 581 int throttle;
573}; 582};
574 583
diff --git a/include/linux/dca.h b/include/linux/dca.h
index 9c20c7e87d0a..d27a7a05718d 100644
--- a/include/linux/dca.h
+++ b/include/linux/dca.h
@@ -20,6 +20,9 @@
20 */ 20 */
21#ifndef DCA_H 21#ifndef DCA_H
22#define DCA_H 22#define DCA_H
23
24#include <linux/pci.h>
25
23/* DCA Provider API */ 26/* DCA Provider API */
24 27
25/* DCA Notifier Interface */ 28/* DCA Notifier Interface */
@@ -36,6 +39,12 @@ struct dca_provider {
36 int id; 39 int id;
37}; 40};
38 41
42struct dca_domain {
43 struct list_head node;
44 struct list_head dca_providers;
45 struct pci_bus *pci_rc;
46};
47
39struct dca_ops { 48struct dca_ops {
40 int (*add_requester) (struct dca_provider *, struct device *); 49 int (*add_requester) (struct dca_provider *, struct device *);
41 int (*remove_requester) (struct dca_provider *, struct device *); 50 int (*remove_requester) (struct dca_provider *, struct device *);
@@ -47,7 +56,7 @@ struct dca_ops {
47struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size); 56struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size);
48void free_dca_provider(struct dca_provider *dca); 57void free_dca_provider(struct dca_provider *dca);
49int register_dca_provider(struct dca_provider *dca, struct device *dev); 58int register_dca_provider(struct dca_provider *dca, struct device *dev);
50void unregister_dca_provider(struct dca_provider *dca); 59void unregister_dca_provider(struct dca_provider *dca, struct device *dev);
51 60
52static inline void *dca_priv(struct dca_provider *dca) 61static inline void *dca_priv(struct dca_provider *dca)
53{ 62{
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index eb5c2ba2f81a..fc1b930f246c 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -9,7 +9,7 @@
9 * 2 as published by the Free Software Foundation. 9 * 2 as published by the Free Software Foundation.
10 * 10 *
11 * debugfs is for people to use instead of /proc or /sys. 11 * debugfs is for people to use instead of /proc or /sys.
12 * See Documentation/DocBook/kernel-api for more details. 12 * See Documentation/DocBook/filesystems for more details.
13 */ 13 */
14 14
15#ifndef _DEBUGFS_H_ 15#ifndef _DEBUGFS_H_
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
index f352f06fa063..5076fe0c8a96 100644
--- a/include/linux/delayacct.h
+++ b/include/linux/delayacct.h
@@ -18,7 +18,6 @@
18#define _LINUX_DELAYACCT_H 18#define _LINUX_DELAYACCT_H
19 19
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/taskstats_kern.h>
22 21
23/* 22/*
24 * Per-task flags relevant to delay accounting 23 * Per-task flags relevant to delay accounting
diff --git a/include/linux/device.h b/include/linux/device.h
index 847b763e40e9..aca31bf7d8ed 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -193,7 +193,7 @@ struct class {
193 struct kobject *dev_kobj; 193 struct kobject *dev_kobj;
194 194
195 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 195 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
196 char *(*nodename)(struct device *dev); 196 char *(*devnode)(struct device *dev, mode_t *mode);
197 197
198 void (*class_release)(struct class *class); 198 void (*class_release)(struct class *class);
199 void (*dev_release)(struct device *dev); 199 void (*dev_release)(struct device *dev);
@@ -298,7 +298,7 @@ struct device_type {
298 const char *name; 298 const char *name;
299 const struct attribute_group **groups; 299 const struct attribute_group **groups;
300 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 300 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
301 char *(*nodename)(struct device *dev); 301 char *(*devnode)(struct device *dev, mode_t *mode);
302 void (*release)(struct device *dev); 302 void (*release)(struct device *dev);
303 303
304 const struct dev_pm_ops *pm; 304 const struct dev_pm_ops *pm;
@@ -487,7 +487,8 @@ extern struct device *device_find_child(struct device *dev, void *data,
487extern int device_rename(struct device *dev, char *new_name); 487extern int device_rename(struct device *dev, char *new_name);
488extern int device_move(struct device *dev, struct device *new_parent, 488extern int device_move(struct device *dev, struct device *new_parent,
489 enum dpm_order dpm_order); 489 enum dpm_order dpm_order);
490extern const char *device_get_nodename(struct device *dev, const char **tmp); 490extern const char *device_get_devnode(struct device *dev,
491 mode_t *mode, const char **tmp);
491extern void *dev_get_drvdata(const struct device *dev); 492extern void *dev_get_drvdata(const struct device *dev);
492extern void dev_set_drvdata(struct device *dev, void *data); 493extern void dev_set_drvdata(struct device *dev, void *data);
493 494
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index ffefba81c818..2b9f2ac7ed60 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -48,19 +48,20 @@ enum dma_status {
48 48
49/** 49/**
50 * enum dma_transaction_type - DMA transaction types/indexes 50 * enum dma_transaction_type - DMA transaction types/indexes
51 *
52 * Note: The DMA_ASYNC_TX capability is not to be set by drivers. It is
53 * automatically set as dma devices are registered.
51 */ 54 */
52enum dma_transaction_type { 55enum dma_transaction_type {
53 DMA_MEMCPY, 56 DMA_MEMCPY,
54 DMA_XOR, 57 DMA_XOR,
55 DMA_PQ_XOR, 58 DMA_PQ,
56 DMA_DUAL_XOR, 59 DMA_XOR_VAL,
57 DMA_PQ_UPDATE, 60 DMA_PQ_VAL,
58 DMA_ZERO_SUM,
59 DMA_PQ_ZERO_SUM,
60 DMA_MEMSET, 61 DMA_MEMSET,
61 DMA_MEMCPY_CRC32C,
62 DMA_INTERRUPT, 62 DMA_INTERRUPT,
63 DMA_PRIVATE, 63 DMA_PRIVATE,
64 DMA_ASYNC_TX,
64 DMA_SLAVE, 65 DMA_SLAVE,
65}; 66};
66 67
@@ -70,18 +71,25 @@ enum dma_transaction_type {
70 71
71/** 72/**
72 * enum dma_ctrl_flags - DMA flags to augment operation preparation, 73 * enum dma_ctrl_flags - DMA flags to augment operation preparation,
73 * control completion, and communicate status. 74 * control completion, and communicate status.
74 * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of 75 * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of
75 * this transaction 76 * this transaction
76 * @DMA_CTRL_ACK - the descriptor cannot be reused until the client 77 * @DMA_CTRL_ACK - the descriptor cannot be reused until the client
77 * acknowledges receipt, i.e. has has a chance to establish any 78 * acknowledges receipt, i.e. has has a chance to establish any dependency
78 * dependency chains 79 * chains
79 * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s) 80 * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s)
80 * @DMA_COMPL_SKIP_DEST_UNMAP - set to disable dma-unmapping the destination(s) 81 * @DMA_COMPL_SKIP_DEST_UNMAP - set to disable dma-unmapping the destination(s)
81 * @DMA_COMPL_SRC_UNMAP_SINGLE - set to do the source dma-unmapping as single 82 * @DMA_COMPL_SRC_UNMAP_SINGLE - set to do the source dma-unmapping as single
82 * (if not set, do the source dma-unmapping as page) 83 * (if not set, do the source dma-unmapping as page)
83 * @DMA_COMPL_DEST_UNMAP_SINGLE - set to do the destination dma-unmapping as single 84 * @DMA_COMPL_DEST_UNMAP_SINGLE - set to do the destination dma-unmapping as single
84 * (if not set, do the destination dma-unmapping as page) 85 * (if not set, do the destination dma-unmapping as page)
86 * @DMA_PREP_PQ_DISABLE_P - prevent generation of P while generating Q
87 * @DMA_PREP_PQ_DISABLE_Q - prevent generation of Q while generating P
88 * @DMA_PREP_CONTINUE - indicate to a driver that it is reusing buffers as
89 * sources that were the result of a previous operation, in the case of a PQ
90 * operation it continues the calculation with new sources
91 * @DMA_PREP_FENCE - tell the driver that subsequent operations depend
92 * on the result of this operation
85 */ 93 */
86enum dma_ctrl_flags { 94enum dma_ctrl_flags {
87 DMA_PREP_INTERRUPT = (1 << 0), 95 DMA_PREP_INTERRUPT = (1 << 0),
@@ -90,9 +98,32 @@ enum dma_ctrl_flags {
90 DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3), 98 DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3),
91 DMA_COMPL_SRC_UNMAP_SINGLE = (1 << 4), 99 DMA_COMPL_SRC_UNMAP_SINGLE = (1 << 4),
92 DMA_COMPL_DEST_UNMAP_SINGLE = (1 << 5), 100 DMA_COMPL_DEST_UNMAP_SINGLE = (1 << 5),
101 DMA_PREP_PQ_DISABLE_P = (1 << 6),
102 DMA_PREP_PQ_DISABLE_Q = (1 << 7),
103 DMA_PREP_CONTINUE = (1 << 8),
104 DMA_PREP_FENCE = (1 << 9),
93}; 105};
94 106
95/** 107/**
108 * enum sum_check_bits - bit position of pq_check_flags
109 */
110enum sum_check_bits {
111 SUM_CHECK_P = 0,
112 SUM_CHECK_Q = 1,
113};
114
115/**
116 * enum pq_check_flags - result of async_{xor,pq}_zero_sum operations
117 * @SUM_CHECK_P_RESULT - 1 if xor zero sum error, 0 otherwise
118 * @SUM_CHECK_Q_RESULT - 1 if reed-solomon zero sum error, 0 otherwise
119 */
120enum sum_check_flags {
121 SUM_CHECK_P_RESULT = (1 << SUM_CHECK_P),
122 SUM_CHECK_Q_RESULT = (1 << SUM_CHECK_Q),
123};
124
125
126/**
96 * dma_cap_mask_t - capabilities bitmap modeled after cpumask_t. 127 * dma_cap_mask_t - capabilities bitmap modeled after cpumask_t.
97 * See linux/cpumask.h 128 * See linux/cpumask.h
98 */ 129 */
@@ -180,8 +211,6 @@ typedef void (*dma_async_tx_callback)(void *dma_async_param);
180 * @flags: flags to augment operation preparation, control completion, and 211 * @flags: flags to augment operation preparation, control completion, and
181 * communicate status 212 * communicate status
182 * @phys: physical address of the descriptor 213 * @phys: physical address of the descriptor
183 * @tx_list: driver common field for operations that require multiple
184 * descriptors
185 * @chan: target channel for this operation 214 * @chan: target channel for this operation
186 * @tx_submit: set the prepared descriptor(s) to be executed by the engine 215 * @tx_submit: set the prepared descriptor(s) to be executed by the engine
187 * @callback: routine to call after this operation is complete 216 * @callback: routine to call after this operation is complete
@@ -195,7 +224,6 @@ struct dma_async_tx_descriptor {
195 dma_cookie_t cookie; 224 dma_cookie_t cookie;
196 enum dma_ctrl_flags flags; /* not a 'long' to pack with cookie */ 225 enum dma_ctrl_flags flags; /* not a 'long' to pack with cookie */
197 dma_addr_t phys; 226 dma_addr_t phys;
198 struct list_head tx_list;
199 struct dma_chan *chan; 227 struct dma_chan *chan;
200 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); 228 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx);
201 dma_async_tx_callback callback; 229 dma_async_tx_callback callback;
@@ -213,6 +241,11 @@ struct dma_async_tx_descriptor {
213 * @global_node: list_head for global dma_device_list 241 * @global_node: list_head for global dma_device_list
214 * @cap_mask: one or more dma_capability flags 242 * @cap_mask: one or more dma_capability flags
215 * @max_xor: maximum number of xor sources, 0 if no capability 243 * @max_xor: maximum number of xor sources, 0 if no capability
244 * @max_pq: maximum number of PQ sources and PQ-continue capability
245 * @copy_align: alignment shift for memcpy operations
246 * @xor_align: alignment shift for xor operations
247 * @pq_align: alignment shift for pq operations
248 * @fill_align: alignment shift for memset operations
216 * @dev_id: unique device ID 249 * @dev_id: unique device ID
217 * @dev: struct device reference for dma mapping api 250 * @dev: struct device reference for dma mapping api
218 * @device_alloc_chan_resources: allocate resources and return the 251 * @device_alloc_chan_resources: allocate resources and return the
@@ -220,7 +253,9 @@ struct dma_async_tx_descriptor {
220 * @device_free_chan_resources: release DMA channel's resources 253 * @device_free_chan_resources: release DMA channel's resources
221 * @device_prep_dma_memcpy: prepares a memcpy operation 254 * @device_prep_dma_memcpy: prepares a memcpy operation
222 * @device_prep_dma_xor: prepares a xor operation 255 * @device_prep_dma_xor: prepares a xor operation
223 * @device_prep_dma_zero_sum: prepares a zero_sum operation 256 * @device_prep_dma_xor_val: prepares a xor validation operation
257 * @device_prep_dma_pq: prepares a pq operation
258 * @device_prep_dma_pq_val: prepares a pqzero_sum operation
224 * @device_prep_dma_memset: prepares a memset operation 259 * @device_prep_dma_memset: prepares a memset operation
225 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 260 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
226 * @device_prep_slave_sg: prepares a slave dma operation 261 * @device_prep_slave_sg: prepares a slave dma operation
@@ -235,7 +270,13 @@ struct dma_device {
235 struct list_head channels; 270 struct list_head channels;
236 struct list_head global_node; 271 struct list_head global_node;
237 dma_cap_mask_t cap_mask; 272 dma_cap_mask_t cap_mask;
238 int max_xor; 273 unsigned short max_xor;
274 unsigned short max_pq;
275 u8 copy_align;
276 u8 xor_align;
277 u8 pq_align;
278 u8 fill_align;
279 #define DMA_HAS_PQ_CONTINUE (1 << 15)
239 280
240 int dev_id; 281 int dev_id;
241 struct device *dev; 282 struct device *dev;
@@ -249,9 +290,17 @@ struct dma_device {
249 struct dma_async_tx_descriptor *(*device_prep_dma_xor)( 290 struct dma_async_tx_descriptor *(*device_prep_dma_xor)(
250 struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src, 291 struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src,
251 unsigned int src_cnt, size_t len, unsigned long flags); 292 unsigned int src_cnt, size_t len, unsigned long flags);
252 struct dma_async_tx_descriptor *(*device_prep_dma_zero_sum)( 293 struct dma_async_tx_descriptor *(*device_prep_dma_xor_val)(
253 struct dma_chan *chan, dma_addr_t *src, unsigned int src_cnt, 294 struct dma_chan *chan, dma_addr_t *src, unsigned int src_cnt,
254 size_t len, u32 *result, unsigned long flags); 295 size_t len, enum sum_check_flags *result, unsigned long flags);
296 struct dma_async_tx_descriptor *(*device_prep_dma_pq)(
297 struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src,
298 unsigned int src_cnt, const unsigned char *scf,
299 size_t len, unsigned long flags);
300 struct dma_async_tx_descriptor *(*device_prep_dma_pq_val)(
301 struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
302 unsigned int src_cnt, const unsigned char *scf, size_t len,
303 enum sum_check_flags *pqres, unsigned long flags);
255 struct dma_async_tx_descriptor *(*device_prep_dma_memset)( 304 struct dma_async_tx_descriptor *(*device_prep_dma_memset)(
256 struct dma_chan *chan, dma_addr_t dest, int value, size_t len, 305 struct dma_chan *chan, dma_addr_t dest, int value, size_t len,
257 unsigned long flags); 306 unsigned long flags);
@@ -270,6 +319,96 @@ struct dma_device {
270 void (*device_issue_pending)(struct dma_chan *chan); 319 void (*device_issue_pending)(struct dma_chan *chan);
271}; 320};
272 321
322static inline bool dmaengine_check_align(u8 align, size_t off1, size_t off2, size_t len)
323{
324 size_t mask;
325
326 if (!align)
327 return true;
328 mask = (1 << align) - 1;
329 if (mask & (off1 | off2 | len))
330 return false;
331 return true;
332}
333
334static inline bool is_dma_copy_aligned(struct dma_device *dev, size_t off1,
335 size_t off2, size_t len)
336{
337 return dmaengine_check_align(dev->copy_align, off1, off2, len);
338}
339
340static inline bool is_dma_xor_aligned(struct dma_device *dev, size_t off1,
341 size_t off2, size_t len)
342{
343 return dmaengine_check_align(dev->xor_align, off1, off2, len);
344}
345
346static inline bool is_dma_pq_aligned(struct dma_device *dev, size_t off1,
347 size_t off2, size_t len)
348{
349 return dmaengine_check_align(dev->pq_align, off1, off2, len);
350}
351
352static inline bool is_dma_fill_aligned(struct dma_device *dev, size_t off1,
353 size_t off2, size_t len)
354{
355 return dmaengine_check_align(dev->fill_align, off1, off2, len);
356}
357
358static inline void
359dma_set_maxpq(struct dma_device *dma, int maxpq, int has_pq_continue)
360{
361 dma->max_pq = maxpq;
362 if (has_pq_continue)
363 dma->max_pq |= DMA_HAS_PQ_CONTINUE;
364}
365
366static inline bool dmaf_continue(enum dma_ctrl_flags flags)
367{
368 return (flags & DMA_PREP_CONTINUE) == DMA_PREP_CONTINUE;
369}
370
371static inline bool dmaf_p_disabled_continue(enum dma_ctrl_flags flags)
372{
373 enum dma_ctrl_flags mask = DMA_PREP_CONTINUE | DMA_PREP_PQ_DISABLE_P;
374
375 return (flags & mask) == mask;
376}
377
378static inline bool dma_dev_has_pq_continue(struct dma_device *dma)
379{
380 return (dma->max_pq & DMA_HAS_PQ_CONTINUE) == DMA_HAS_PQ_CONTINUE;
381}
382
383static unsigned short dma_dev_to_maxpq(struct dma_device *dma)
384{
385 return dma->max_pq & ~DMA_HAS_PQ_CONTINUE;
386}
387
388/* dma_maxpq - reduce maxpq in the face of continued operations
389 * @dma - dma device with PQ capability
390 * @flags - to check if DMA_PREP_CONTINUE and DMA_PREP_PQ_DISABLE_P are set
391 *
392 * When an engine does not support native continuation we need 3 extra
393 * source slots to reuse P and Q with the following coefficients:
394 * 1/ {00} * P : remove P from Q', but use it as a source for P'
395 * 2/ {01} * Q : use Q to continue Q' calculation
396 * 3/ {00} * Q : subtract Q from P' to cancel (2)
397 *
398 * In the case where P is disabled we only need 1 extra source:
399 * 1/ {01} * Q : use Q to continue Q' calculation
400 */
401static inline int dma_maxpq(struct dma_device *dma, enum dma_ctrl_flags flags)
402{
403 if (dma_dev_has_pq_continue(dma) || !dmaf_continue(flags))
404 return dma_dev_to_maxpq(dma);
405 else if (dmaf_p_disabled_continue(flags))
406 return dma_dev_to_maxpq(dma) - 1;
407 else if (dmaf_continue(flags))
408 return dma_dev_to_maxpq(dma) - 3;
409 BUG();
410}
411
273/* --- public DMA engine API --- */ 412/* --- public DMA engine API --- */
274 413
275#ifdef CONFIG_DMA_ENGINE 414#ifdef CONFIG_DMA_ENGINE
@@ -299,7 +438,11 @@ static inline void net_dmaengine_put(void)
299#ifdef CONFIG_ASYNC_TX_DMA 438#ifdef CONFIG_ASYNC_TX_DMA
300#define async_dmaengine_get() dmaengine_get() 439#define async_dmaengine_get() dmaengine_get()
301#define async_dmaengine_put() dmaengine_put() 440#define async_dmaengine_put() dmaengine_put()
441#ifdef CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH
442#define async_dma_find_channel(type) dma_find_channel(DMA_ASYNC_TX)
443#else
302#define async_dma_find_channel(type) dma_find_channel(type) 444#define async_dma_find_channel(type) dma_find_channel(type)
445#endif /* CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH */
303#else 446#else
304static inline void async_dmaengine_get(void) 447static inline void async_dmaengine_get(void)
305{ 448{
@@ -312,7 +455,7 @@ async_dma_find_channel(enum dma_transaction_type type)
312{ 455{
313 return NULL; 456 return NULL;
314} 457}
315#endif 458#endif /* CONFIG_ASYNC_TX_DMA */
316 459
317dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, 460dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
318 void *dest, void *src, size_t len); 461 void *dest, void *src, size_t len);
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index 51c8d2d49e42..b6cb5425cde3 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -173,7 +173,8 @@ typedef enum fe_modulation {
173typedef enum fe_transmit_mode { 173typedef enum fe_transmit_mode {
174 TRANSMISSION_MODE_2K, 174 TRANSMISSION_MODE_2K,
175 TRANSMISSION_MODE_8K, 175 TRANSMISSION_MODE_8K,
176 TRANSMISSION_MODE_AUTO 176 TRANSMISSION_MODE_AUTO,
177 TRANSMISSION_MODE_4K
177} fe_transmit_mode_t; 178} fe_transmit_mode_t;
178 179
179typedef enum fe_bandwidth { 180typedef enum fe_bandwidth {
@@ -268,15 +269,42 @@ struct dvb_frontend_event {
268#define DTV_FE_CAPABILITY 16 269#define DTV_FE_CAPABILITY 16
269#define DTV_DELIVERY_SYSTEM 17 270#define DTV_DELIVERY_SYSTEM 17
270 271
271#define DTV_API_VERSION 35 272/* ISDB-T and ISDB-Tsb */
272#define DTV_API_VERSION 35 273#define DTV_ISDBT_PARTIAL_RECEPTION 18
273#define DTV_CODE_RATE_HP 36 274#define DTV_ISDBT_SOUND_BROADCASTING 19
274#define DTV_CODE_RATE_LP 37
275#define DTV_GUARD_INTERVAL 38
276#define DTV_TRANSMISSION_MODE 39
277#define DTV_HIERARCHY 40
278 275
279#define DTV_MAX_COMMAND DTV_HIERARCHY 276#define DTV_ISDBT_SB_SUBCHANNEL_ID 20
277#define DTV_ISDBT_SB_SEGMENT_IDX 21
278#define DTV_ISDBT_SB_SEGMENT_COUNT 22
279
280#define DTV_ISDBT_LAYERA_FEC 23
281#define DTV_ISDBT_LAYERA_MODULATION 24
282#define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25
283#define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26
284
285#define DTV_ISDBT_LAYERB_FEC 27
286#define DTV_ISDBT_LAYERB_MODULATION 28
287#define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29
288#define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30
289
290#define DTV_ISDBT_LAYERC_FEC 31
291#define DTV_ISDBT_LAYERC_MODULATION 32
292#define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33
293#define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34
294
295#define DTV_API_VERSION 35
296
297#define DTV_CODE_RATE_HP 36
298#define DTV_CODE_RATE_LP 37
299#define DTV_GUARD_INTERVAL 38
300#define DTV_TRANSMISSION_MODE 39
301#define DTV_HIERARCHY 40
302
303#define DTV_ISDBT_LAYER_ENABLED 41
304
305#define DTV_ISDBS_TS_ID 42
306
307#define DTV_MAX_COMMAND DTV_ISDBS_TS_ID
280 308
281typedef enum fe_pilot { 309typedef enum fe_pilot {
282 PILOT_ON, 310 PILOT_ON,
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 25b823b81734..540b0583d9fb 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 5 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 0 27#define DVB_API_VERSION_MINOR 1
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index 3b85ba6479f4..94dd10366a78 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -27,6 +27,7 @@
27 27
28#ifdef CONFIG_EVENTFD 28#ifdef CONFIG_EVENTFD
29 29
30struct file *eventfd_file_create(unsigned int count, int flags);
30struct eventfd_ctx *eventfd_ctx_get(struct eventfd_ctx *ctx); 31struct eventfd_ctx *eventfd_ctx_get(struct eventfd_ctx *ctx);
31void eventfd_ctx_put(struct eventfd_ctx *ctx); 32void eventfd_ctx_put(struct eventfd_ctx *ctx);
32struct file *eventfd_fget(int fd); 33struct file *eventfd_fget(int fd);
@@ -40,6 +41,11 @@ int eventfd_signal(struct eventfd_ctx *ctx, int n);
40 * Ugly ugly ugly error layer to support modules that uses eventfd but 41 * Ugly ugly ugly error layer to support modules that uses eventfd but
41 * pretend to work in !CONFIG_EVENTFD configurations. Namely, AIO. 42 * pretend to work in !CONFIG_EVENTFD configurations. Namely, AIO.
42 */ 43 */
44static inline struct file *eventfd_file_create(unsigned int count, int flags)
45{
46 return ERR_PTR(-ENOSYS);
47}
48
43static inline struct eventfd_ctx *eventfd_ctx_fdget(int fd) 49static inline struct eventfd_ctx *eventfd_ctx_fdget(int fd)
44{ 50{
45 return ERR_PTR(-ENOSYS); 51 return ERR_PTR(-ENOSYS);
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 192d1e43c43c..7e1d4dec83e7 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -134,20 +134,6 @@ struct fw_card {
134 u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; 134 u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
135}; 135};
136 136
137static inline struct fw_card *fw_card_get(struct fw_card *card)
138{
139 kref_get(&card->kref);
140
141 return card;
142}
143
144void fw_card_release(struct kref *kref);
145
146static inline void fw_card_put(struct fw_card *card)
147{
148 kref_put(&card->kref, fw_card_release);
149}
150
151struct fw_attribute_group { 137struct fw_attribute_group {
152 struct attribute_group *groups[2]; 138 struct attribute_group *groups[2];
153 struct attribute_group group; 139 struct attribute_group group;
diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h
index 45ff18491514..1d747f72298b 100644
--- a/include/linux/flex_array.h
+++ b/include/linux/flex_array.h
@@ -31,10 +31,32 @@ struct flex_array {
31 }; 31 };
32}; 32};
33 33
34#define FLEX_ARRAY_INIT(size, total) { { {\ 34/* Number of bytes left in base struct flex_array, excluding metadata */
35 .element_size = (size), \ 35#define FLEX_ARRAY_BASE_BYTES_LEFT \
36 .total_nr_elements = (total), \ 36 (FLEX_ARRAY_BASE_SIZE - offsetof(struct flex_array, parts))
37} } } 37
38/* Number of pointers in base to struct flex_array_part pages */
39#define FLEX_ARRAY_NR_BASE_PTRS \
40 (FLEX_ARRAY_BASE_BYTES_LEFT / sizeof(struct flex_array_part *))
41
42/* Number of elements of size that fit in struct flex_array_part */
43#define FLEX_ARRAY_ELEMENTS_PER_PART(size) \
44 (FLEX_ARRAY_PART_SIZE / size)
45
46/*
47 * Defines a statically allocated flex array and ensures its parameters are
48 * valid.
49 */
50#define DEFINE_FLEX_ARRAY(__arrayname, __element_size, __total) \
51 struct flex_array __arrayname = { { { \
52 .element_size = (__element_size), \
53 .total_nr_elements = (__total), \
54 } } }; \
55 static inline void __arrayname##_invalid_parameter(void) \
56 { \
57 BUILD_BUG_ON((__total) > FLEX_ARRAY_NR_BASE_PTRS * \
58 FLEX_ARRAY_ELEMENTS_PER_PART(__element_size)); \
59 }
38 60
39struct flex_array *flex_array_alloc(int element_size, unsigned int total, 61struct flex_array *flex_array_alloc(int element_size, unsigned int total,
40 gfp_t flags); 62 gfp_t flags);
@@ -44,6 +66,8 @@ void flex_array_free(struct flex_array *fa);
44void flex_array_free_parts(struct flex_array *fa); 66void flex_array_free_parts(struct flex_array *fa);
45int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, 67int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src,
46 gfp_t flags); 68 gfp_t flags);
69int flex_array_clear(struct flex_array *fa, unsigned int element_nr);
47void *flex_array_get(struct flex_array *fa, unsigned int element_nr); 70void *flex_array_get(struct flex_array *fa, unsigned int element_nr);
71int flex_array_shrink(struct flex_array *fa);
48 72
49#endif /* _FLEX_ARRAY_H */ 73#endif /* _FLEX_ARRAY_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 90162fb3bf04..2adaa2529f18 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -595,6 +595,7 @@ struct address_space_operations {
595 int (*launder_page) (struct page *); 595 int (*launder_page) (struct page *);
596 int (*is_partially_uptodate) (struct page *, read_descriptor_t *, 596 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
597 unsigned long); 597 unsigned long);
598 int (*error_remove_page)(struct address_space *, struct page *);
598}; 599};
599 600
600/* 601/*
@@ -640,7 +641,6 @@ struct block_device {
640 struct super_block * bd_super; 641 struct super_block * bd_super;
641 int bd_openers; 642 int bd_openers;
642 struct mutex bd_mutex; /* open/close mutex */ 643 struct mutex bd_mutex; /* open/close mutex */
643 struct semaphore bd_mount_sem;
644 struct list_head bd_inodes; 644 struct list_head bd_inodes;
645 void * bd_holder; 645 void * bd_holder;
646 int bd_holders; 646 int bd_holders;
@@ -1066,8 +1066,8 @@ struct file_lock {
1066 struct fasync_struct * fl_fasync; /* for lease break notifications */ 1066 struct fasync_struct * fl_fasync; /* for lease break notifications */
1067 unsigned long fl_break_time; /* for nonblocking lease breaks */ 1067 unsigned long fl_break_time; /* for nonblocking lease breaks */
1068 1068
1069 struct file_lock_operations *fl_ops; /* Callbacks for filesystems */ 1069 const struct file_lock_operations *fl_ops; /* Callbacks for filesystems */
1070 struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */ 1070 const struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */
1071 union { 1071 union {
1072 struct nfs_lock_info nfs_fl; 1072 struct nfs_lock_info nfs_fl;
1073 struct nfs4_lock_info nfs4_fl; 1073 struct nfs4_lock_info nfs4_fl;
@@ -1315,11 +1315,11 @@ struct super_block {
1315 unsigned long s_blocksize; 1315 unsigned long s_blocksize;
1316 unsigned char s_blocksize_bits; 1316 unsigned char s_blocksize_bits;
1317 unsigned char s_dirt; 1317 unsigned char s_dirt;
1318 unsigned long long s_maxbytes; /* Max file size */ 1318 loff_t s_maxbytes; /* Max file size */
1319 struct file_system_type *s_type; 1319 struct file_system_type *s_type;
1320 const struct super_operations *s_op; 1320 const struct super_operations *s_op;
1321 struct dquot_operations *dq_op; 1321 const struct dquot_operations *dq_op;
1322 struct quotactl_ops *s_qcop; 1322 const struct quotactl_ops *s_qcop;
1323 const struct export_operations *s_export_op; 1323 const struct export_operations *s_export_op;
1324 unsigned long s_flags; 1324 unsigned long s_flags;
1325 unsigned long s_magic; 1325 unsigned long s_magic;
@@ -2156,6 +2156,7 @@ extern ino_t iunique(struct super_block *, ino_t);
2156extern int inode_needs_sync(struct inode *inode); 2156extern int inode_needs_sync(struct inode *inode);
2157extern void generic_delete_inode(struct inode *inode); 2157extern void generic_delete_inode(struct inode *inode);
2158extern void generic_drop_inode(struct inode *inode); 2158extern void generic_drop_inode(struct inode *inode);
2159extern int generic_detach_inode(struct inode *inode);
2159 2160
2160extern struct inode *ilookup5_nowait(struct super_block *sb, 2161extern struct inode *ilookup5_nowait(struct super_block *sb,
2161 unsigned long hashval, int (*test)(struct inode *, void *), 2162 unsigned long hashval, int (*test)(struct inode *, void *),
@@ -2334,6 +2335,7 @@ extern void get_filesystem(struct file_system_type *fs);
2334extern void put_filesystem(struct file_system_type *fs); 2335extern void put_filesystem(struct file_system_type *fs);
2335extern struct file_system_type *get_fs_type(const char *name); 2336extern struct file_system_type *get_fs_type(const char *name);
2336extern struct super_block *get_super(struct block_device *); 2337extern struct super_block *get_super(struct block_device *);
2338extern struct super_block *get_active_super(struct block_device *bdev);
2337extern struct super_block *user_get_super(dev_t); 2339extern struct super_block *user_get_super(dev_t);
2338extern void drop_super(struct super_block *sb); 2340extern void drop_super(struct super_block *sb);
2339 2341
@@ -2381,7 +2383,8 @@ extern int buffer_migrate_page(struct address_space *,
2381#define buffer_migrate_page NULL 2383#define buffer_migrate_page NULL
2382#endif 2384#endif
2383 2385
2384extern int inode_change_ok(struct inode *, struct iattr *); 2386extern int inode_change_ok(const struct inode *, struct iattr *);
2387extern int inode_newsize_ok(const struct inode *, loff_t offset);
2385extern int __must_check inode_setattr(struct inode *, struct iattr *); 2388extern int __must_check inode_setattr(struct inode *, struct iattr *);
2386 2389
2387extern void file_update_time(struct file *file); 2390extern void file_update_time(struct file *file);
@@ -2467,7 +2470,7 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
2467 size_t len, loff_t *ppos); 2470 size_t len, loff_t *ppos);
2468 2471
2469struct ctl_table; 2472struct ctl_table;
2470int proc_nr_files(struct ctl_table *table, int write, struct file *filp, 2473int proc_nr_files(struct ctl_table *table, int write,
2471 void __user *buffer, size_t *lenp, loff_t *ppos); 2474 void __user *buffer, size_t *lenp, loff_t *ppos);
2472 2475
2473int __init get_filesystem_list(char *buf); 2476int __init get_filesystem_list(char *buf);
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index dc3b1328aaeb..cd3d2abaf30a 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -19,7 +19,7 @@
19extern int ftrace_enabled; 19extern int ftrace_enabled;
20extern int 20extern int
21ftrace_enable_sysctl(struct ctl_table *table, int write, 21ftrace_enable_sysctl(struct ctl_table *table, int write,
22 struct file *filp, void __user *buffer, size_t *lenp, 22 void __user *buffer, size_t *lenp,
23 loff_t *ppos); 23 loff_t *ppos);
24 24
25typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip); 25typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
@@ -94,7 +94,7 @@ static inline void ftrace_start(void) { }
94extern int stack_tracer_enabled; 94extern int stack_tracer_enabled;
95int 95int
96stack_trace_sysctl(struct ctl_table *table, int write, 96stack_trace_sysctl(struct ctl_table *table, int write,
97 struct file *file, void __user *buffer, size_t *lenp, 97 void __user *buffer, size_t *lenp,
98 loff_t *ppos); 98 loff_t *ppos);
99#endif 99#endif
100 100
@@ -446,7 +446,6 @@ static inline void unpause_graph_tracing(void) { }
446#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 446#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
447 447
448#ifdef CONFIG_TRACING 448#ifdef CONFIG_TRACING
449#include <linux/sched.h>
450 449
451/* flags for current->trace */ 450/* flags for current->trace */
452enum { 451enum {
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index bd099ba82ccc..4ec5e67e18cf 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -4,6 +4,7 @@
4#include <linux/ring_buffer.h> 4#include <linux/ring_buffer.h>
5#include <linux/trace_seq.h> 5#include <linux/trace_seq.h>
6#include <linux/percpu.h> 6#include <linux/percpu.h>
7#include <linux/hardirq.h>
7 8
8struct trace_array; 9struct trace_array;
9struct tracer; 10struct tracer;
@@ -130,10 +131,15 @@ struct ftrace_event_call {
130 void *data; 131 void *data;
131 132
132 atomic_t profile_count; 133 atomic_t profile_count;
133 int (*profile_enable)(struct ftrace_event_call *); 134 int (*profile_enable)(void);
134 void (*profile_disable)(struct ftrace_event_call *); 135 void (*profile_disable)(void);
135}; 136};
136 137
138#define FTRACE_MAX_PROFILE_SIZE 2048
139
140extern char *trace_profile_buf;
141extern char *trace_profile_buf_nmi;
142
137#define MAX_FILTER_PRED 32 143#define MAX_FILTER_PRED 32
138#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ 144#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */
139 145
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index cf593bf9fd32..3e2925a34bf0 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -30,6 +30,10 @@
30 * - add umask flag to input argument of open, mknod and mkdir 30 * - add umask flag to input argument of open, mknod and mkdir
31 * - add notification messages for invalidation of inodes and 31 * - add notification messages for invalidation of inodes and
32 * directory entries 32 * directory entries
33 *
34 * 7.13
35 * - make max number of background requests and congestion threshold
36 * tunables
33 */ 37 */
34 38
35#ifndef _LINUX_FUSE_H 39#ifndef _LINUX_FUSE_H
@@ -37,11 +41,31 @@
37 41
38#include <linux/types.h> 42#include <linux/types.h>
39 43
44/*
45 * Version negotiation:
46 *
47 * Both the kernel and userspace send the version they support in the
48 * INIT request and reply respectively.
49 *
50 * If the major versions match then both shall use the smallest
51 * of the two minor versions for communication.
52 *
53 * If the kernel supports a larger major version, then userspace shall
54 * reply with the major version it supports, ignore the rest of the
55 * INIT message and expect a new INIT message from the kernel with a
56 * matching major version.
57 *
58 * If the library supports a larger major version, then it shall fall
59 * back to the major protocol version sent by the kernel for
60 * communication and reply with that major version (and an arbitrary
61 * supported minor version).
62 */
63
40/** Version number of this interface */ 64/** Version number of this interface */
41#define FUSE_KERNEL_VERSION 7 65#define FUSE_KERNEL_VERSION 7
42 66
43/** Minor version number of this interface */ 67/** Minor version number of this interface */
44#define FUSE_KERNEL_MINOR_VERSION 12 68#define FUSE_KERNEL_MINOR_VERSION 13
45 69
46/** The node ID of the root inode */ 70/** The node ID of the root inode */
47#define FUSE_ROOT_ID 1 71#define FUSE_ROOT_ID 1
@@ -427,7 +451,8 @@ struct fuse_init_out {
427 __u32 minor; 451 __u32 minor;
428 __u32 max_readahead; 452 __u32 max_readahead;
429 __u32 flags; 453 __u32 flags;
430 __u32 unused; 454 __u16 max_background;
455 __u16 congestion_threshold;
431 __u32 max_write; 456 __u32 max_write;
432}; 457};
433 458
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 34956c8fdebf..8ec17997d94f 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -4,11 +4,6 @@
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/types.h> 5#include <linux/types.h>
6 6
7struct inode;
8struct mm_struct;
9struct task_struct;
10union ktime;
11
12/* Second argument to futex syscall */ 7/* Second argument to futex syscall */
13 8
14 9
@@ -129,6 +124,11 @@ struct robust_list_head {
129#define FUTEX_BITSET_MATCH_ANY 0xffffffff 124#define FUTEX_BITSET_MATCH_ANY 0xffffffff
130 125
131#ifdef __KERNEL__ 126#ifdef __KERNEL__
127struct inode;
128struct mm_struct;
129struct task_struct;
130union ktime;
131
132long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout, 132long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout,
133 u32 __user *uaddr2, u32 val2, u32 val3); 133 u32 __user *uaddr2, u32 val2, u32 val3);
134 134
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 44263cb27121..297df45ffd0a 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -142,7 +142,7 @@ struct gendisk {
142 * disks that can't be partitioned. */ 142 * disks that can't be partitioned. */
143 143
144 char disk_name[DISK_NAME_LEN]; /* name of major driver */ 144 char disk_name[DISK_NAME_LEN]; /* name of major driver */
145 char *(*nodename)(struct gendisk *gd); 145 char *(*devnode)(struct gendisk *gd, mode_t *mode);
146 /* Array of pointers to partitions indexed by partno. 146 /* Array of pointers to partitions indexed by partno.
147 * Protected with matching bdev lock but stat and other 147 * Protected with matching bdev lock but stat and other
148 * non-critical accesses use RCU. Always access through 148 * non-critical accesses use RCU. Always access through
@@ -151,7 +151,7 @@ struct gendisk {
151 struct disk_part_tbl *part_tbl; 151 struct disk_part_tbl *part_tbl;
152 struct hd_struct part0; 152 struct hd_struct part0;
153 153
154 struct block_device_operations *fops; 154 const struct block_device_operations *fops;
155 struct request_queue *queue; 155 struct request_queue *queue;
156 void *private_data; 156 void *private_data;
157 157
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 7c777a0da17a..557bdad320b6 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -220,7 +220,7 @@ static inline enum zone_type gfp_zone(gfp_t flags)
220 ((1 << ZONES_SHIFT) - 1); 220 ((1 << ZONES_SHIFT) - 1);
221 221
222 if (__builtin_constant_p(bit)) 222 if (__builtin_constant_p(bit))
223 BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1); 223 MAYBE_BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
224 else { 224 else {
225#ifdef CONFIG_DEBUG_VM 225#ifdef CONFIG_DEBUG_VM
226 BUG_ON((GFP_ZONE_BAD >> bit) & 1); 226 BUG_ON((GFP_ZONE_BAD >> bit) & 1);
@@ -326,7 +326,6 @@ void free_pages_exact(void *virt, size_t size);
326extern void __free_pages(struct page *page, unsigned int order); 326extern void __free_pages(struct page *page, unsigned int order);
327extern void free_pages(unsigned long addr, unsigned int order); 327extern void free_pages(unsigned long addr, unsigned int order);
328extern void free_hot_page(struct page *page); 328extern void free_hot_page(struct page *page);
329extern void free_cold_page(struct page *page);
330 329
331#define __free_page(page) __free_pages((page), 0) 330#define __free_page(page) __free_pages((page), 0)
332#define free_page(addr) free_pages((addr),0) 331#define free_page(addr) free_pages((addr),0)
@@ -336,18 +335,6 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
336void drain_all_pages(void); 335void drain_all_pages(void);
337void drain_local_pages(void *dummy); 336void drain_local_pages(void *dummy);
338 337
339extern bool oom_killer_disabled;
340
341static inline void oom_killer_disable(void)
342{
343 oom_killer_disabled = true;
344}
345
346static inline void oom_killer_enable(void)
347{
348 oom_killer_disabled = false;
349}
350
351extern gfp_t gfp_allowed_mask; 338extern gfp_t gfp_allowed_mask;
352 339
353static inline void set_gfp_allowed_mask(gfp_t mask) 340static inline void set_gfp_allowed_mask(gfp_t mask)
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index e10c49a5b96e..059bd189d35d 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -12,6 +12,8 @@
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14 14
15struct device;
16
15/* 17/*
16 * Some platforms don't support the GPIO programming interface. 18 * Some platforms don't support the GPIO programming interface.
17 * 19 *
@@ -89,6 +91,15 @@ static inline int gpio_export(unsigned gpio, bool direction_may_change)
89 return -EINVAL; 91 return -EINVAL;
90} 92}
91 93
94static inline int gpio_export_link(struct device *dev, const char *name,
95 unsigned gpio)
96{
97 /* GPIO can never have been exported */
98 WARN_ON(1);
99 return -EINVAL;
100}
101
102
92static inline void gpio_unexport(unsigned gpio) 103static inline void gpio_unexport(unsigned gpio)
93{ 104{
94 /* GPIO can never have been exported */ 105 /* GPIO can never have been exported */
diff --git a/include/linux/hayesesp.h b/include/linux/hayesesp.h
index 940aeb51d53f..92b08cfe4a75 100644
--- a/include/linux/hayesesp.h
+++ b/include/linux/hayesesp.h
@@ -96,7 +96,6 @@ struct esp_struct {
96 int xmit_head; 96 int xmit_head;
97 int xmit_tail; 97 int xmit_tail;
98 int xmit_cnt; 98 int xmit_cnt;
99 wait_queue_head_t delta_msr_wait;
100 wait_queue_head_t break_wait; 99 wait_queue_head_t break_wait;
101 struct async_icount icount; /* kernel counters for the 4 input interrupts */ 100 struct async_icount icount; /* kernel counters for the 4 input interrupts */
102 struct hayes_esp_config config; /* port configuration */ 101 struct hayes_esp_config config; /* port configuration */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index a0ebdace7baa..10f628416740 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -494,6 +494,7 @@ struct hid_device { /* device report descriptor */
494 494
495 /* hiddev event handler */ 495 /* hiddev event handler */
496 int (*hiddev_connect)(struct hid_device *, unsigned int); 496 int (*hiddev_connect)(struct hid_device *, unsigned int);
497 void (*hiddev_disconnect)(struct hid_device *);
497 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, 498 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
498 struct hid_usage *, __s32); 499 struct hid_usage *, __s32);
499 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 500 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
@@ -691,6 +692,7 @@ struct hid_device *hid_allocate_device(void);
691int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 692int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
692int hid_check_keys_pressed(struct hid_device *hid); 693int hid_check_keys_pressed(struct hid_device *hid);
693int hid_connect(struct hid_device *hid, unsigned int connect_mask); 694int hid_connect(struct hid_device *hid, unsigned int connect_mask);
695void hid_disconnect(struct hid_device *hid);
694 696
695/** 697/**
696 * hid_map_usage - map usage input bits 698 * hid_map_usage - map usage input bits
@@ -800,6 +802,7 @@ static inline int __must_check hid_hw_start(struct hid_device *hdev,
800 */ 802 */
801static inline void hid_hw_stop(struct hid_device *hdev) 803static inline void hid_hw_stop(struct hid_device *hdev)
802{ 804{
805 hid_disconnect(hdev);
803 hdev->ll_driver->stop(hdev); 806 hdev->ll_driver->stop(hdev);
804} 807}
805 808
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 4759917adc71..ff037f0b1b4e 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -91,7 +91,6 @@ enum hrtimer_restart {
91 * @function: timer expiry callback function 91 * @function: timer expiry callback function
92 * @base: pointer to the timer base (per cpu and per clock) 92 * @base: pointer to the timer base (per cpu and per clock)
93 * @state: state information (See bit values above) 93 * @state: state information (See bit values above)
94 * @cb_entry: list head to enqueue an expired timer into the callback list
95 * @start_site: timer statistics field to store the site where the timer 94 * @start_site: timer statistics field to store the site where the timer
96 * was started 95 * was started
97 * @start_comm: timer statistics field to store the name of the process which 96 * @start_comm: timer statistics field to store the name of the process which
@@ -108,7 +107,6 @@ struct hrtimer {
108 enum hrtimer_restart (*function)(struct hrtimer *); 107 enum hrtimer_restart (*function)(struct hrtimer *);
109 struct hrtimer_clock_base *base; 108 struct hrtimer_clock_base *base;
110 unsigned long state; 109 unsigned long state;
111 struct list_head cb_entry;
112#ifdef CONFIG_TIMER_STATS 110#ifdef CONFIG_TIMER_STATS
113 int start_pid; 111 int start_pid;
114 void *start_site; 112 void *start_site;
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 5cbc620bdfe0..11ab19ac6b3d 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -20,11 +20,13 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
20} 20}
21 21
22void reset_vma_resv_huge_pages(struct vm_area_struct *vma); 22void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
23int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 23int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
24int hugetlb_overcommit_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 24int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
25int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 25int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
26int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); 26int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
27int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int, int); 27int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *,
28 struct page **, struct vm_area_struct **,
29 unsigned long *, int *, int, unsigned int flags);
28void unmap_hugepage_range(struct vm_area_struct *, 30void unmap_hugepage_range(struct vm_area_struct *,
29 unsigned long, unsigned long, struct page *); 31 unsigned long, unsigned long, struct page *);
30void __unmap_hugepage_range(struct vm_area_struct *, 32void __unmap_hugepage_range(struct vm_area_struct *,
@@ -110,6 +112,21 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
110 112
111#endif /* !CONFIG_HUGETLB_PAGE */ 113#endif /* !CONFIG_HUGETLB_PAGE */
112 114
115#define HUGETLB_ANON_FILE "anon_hugepage"
116
117enum {
118 /*
119 * The file will be used as an shm file so shmfs accounting rules
120 * apply
121 */
122 HUGETLB_SHMFS_INODE = 1,
123 /*
124 * The file is being created on the internal vfs mount and shmfs
125 * accounting rules do not apply
126 */
127 HUGETLB_ANONHUGE_INODE = 2,
128};
129
113#ifdef CONFIG_HUGETLBFS 130#ifdef CONFIG_HUGETLBFS
114struct hugetlbfs_config { 131struct hugetlbfs_config {
115 uid_t uid; 132 uid_t uid;
@@ -148,7 +165,7 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
148extern const struct file_operations hugetlbfs_file_operations; 165extern const struct file_operations hugetlbfs_file_operations;
149extern struct vm_operations_struct hugetlb_vm_ops; 166extern struct vm_operations_struct hugetlb_vm_ops;
150struct file *hugetlb_file_setup(const char *name, size_t size, int acct, 167struct file *hugetlb_file_setup(const char *name, size_t size, int acct,
151 struct user_struct **user); 168 struct user_struct **user, int creat_flags);
152int hugetlb_get_quota(struct address_space *mapping, long delta); 169int hugetlb_get_quota(struct address_space *mapping, long delta);
153void hugetlb_put_quota(struct address_space *mapping, long delta); 170void hugetlb_put_quota(struct address_space *mapping, long delta);
154 171
@@ -170,7 +187,7 @@ static inline void set_file_hugepages(struct file *file)
170 187
171#define is_file_hugepages(file) 0 188#define is_file_hugepages(file) 0
172#define set_file_hugepages(file) BUG() 189#define set_file_hugepages(file) BUG()
173#define hugetlb_file_setup(name,size,acct,user) ERR_PTR(-ENOSYS) 190#define hugetlb_file_setup(name,size,acct,user,creat) ERR_PTR(-ENOSYS)
174 191
175#endif /* !CONFIG_HUGETLBFS */ 192#endif /* !CONFIG_HUGETLBFS */
176 193
@@ -185,7 +202,8 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
185#define HSTATE_NAME_LEN 32 202#define HSTATE_NAME_LEN 32
186/* Defines one hugetlb page size */ 203/* Defines one hugetlb page size */
187struct hstate { 204struct hstate {
188 int hugetlb_next_nid; 205 int next_nid_to_alloc;
206 int next_nid_to_free;
189 unsigned int order; 207 unsigned int order;
190 unsigned long mask; 208 unsigned long mask;
191 unsigned long max_huge_pages; 209 unsigned long max_huge_pages;
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index c9087de5c6c6..e844a0b18695 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -28,17 +28,6 @@
28 identify a legacy client. If you don't need them, just don't set them. */ 28 identify a legacy client. If you don't need them, just don't set them. */
29 29
30/* 30/*
31 * ---- Driver types -----------------------------------------------------
32 */
33
34#define I2C_DRIVERID_MSP3400 1
35#define I2C_DRIVERID_TUNER 2
36#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */
37#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */
38#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
39#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */
40
41/*
42 * ---- Adapter types ---------------------------------------------------- 31 * ---- Adapter types ----------------------------------------------------
43 */ 32 */
44 33
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index f4784c0fe975..57d41b0abce2 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -98,7 +98,6 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
98 98
99/** 99/**
100 * struct i2c_driver - represent an I2C device driver 100 * struct i2c_driver - represent an I2C device driver
101 * @id: Unique driver ID (optional)
102 * @class: What kind of i2c device we instantiate (for detect) 101 * @class: What kind of i2c device we instantiate (for detect)
103 * @attach_adapter: Callback for bus addition (for legacy drivers) 102 * @attach_adapter: Callback for bus addition (for legacy drivers)
104 * @detach_adapter: Callback for bus removal (for legacy drivers) 103 * @detach_adapter: Callback for bus removal (for legacy drivers)
@@ -135,7 +134,6 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
135 * not allowed. 134 * not allowed.
136 */ 135 */
137struct i2c_driver { 136struct i2c_driver {
138 int id;
139 unsigned int class; 137 unsigned int class;
140 138
141 /* Notifies the driver that a new bus has appeared or is about to be 139 /* Notifies the driver that a new bus has appeared or is about to be
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
new file mode 100644
index 000000000000..fc5db826b48e
--- /dev/null
+++ b/include/linux/i2c/adp5588.h
@@ -0,0 +1,92 @@
1/*
2 * Analog Devices ADP5588 I/O Expander and QWERTY Keypad Controller
3 *
4 * Copyright 2009 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef _ADP5588_H
10#define _ADP5588_H
11
12#define DEV_ID 0x00 /* Device ID */
13#define CFG 0x01 /* Configuration Register1 */
14#define INT_STAT 0x02 /* Interrupt Status Register */
15#define KEY_LCK_EC_STAT 0x03 /* Key Lock and Event Counter Register */
16#define Key_EVENTA 0x04 /* Key Event Register A */
17#define Key_EVENTB 0x05 /* Key Event Register B */
18#define Key_EVENTC 0x06 /* Key Event Register C */
19#define Key_EVENTD 0x07 /* Key Event Register D */
20#define Key_EVENTE 0x08 /* Key Event Register E */
21#define Key_EVENTF 0x09 /* Key Event Register F */
22#define Key_EVENTG 0x0A /* Key Event Register G */
23#define Key_EVENTH 0x0B /* Key Event Register H */
24#define Key_EVENTI 0x0C /* Key Event Register I */
25#define Key_EVENTJ 0x0D /* Key Event Register J */
26#define KP_LCK_TMR 0x0E /* Keypad Lock1 to Lock2 Timer */
27#define UNLOCK1 0x0F /* Unlock Key1 */
28#define UNLOCK2 0x10 /* Unlock Key2 */
29#define GPIO_INT_STAT1 0x11 /* GPIO Interrupt Status */
30#define GPIO_INT_STAT2 0x12 /* GPIO Interrupt Status */
31#define GPIO_INT_STAT3 0x13 /* GPIO Interrupt Status */
32#define GPIO_DAT_STAT1 0x14 /* GPIO Data Status, Read twice to clear */
33#define GPIO_DAT_STAT2 0x15 /* GPIO Data Status, Read twice to clear */
34#define GPIO_DAT_STAT3 0x16 /* GPIO Data Status, Read twice to clear */
35#define GPIO_DAT_OUT1 0x17 /* GPIO DATA OUT */
36#define GPIO_DAT_OUT2 0x18 /* GPIO DATA OUT */
37#define GPIO_DAT_OUT3 0x19 /* GPIO DATA OUT */
38#define GPIO_INT_EN1 0x1A /* GPIO Interrupt Enable */
39#define GPIO_INT_EN2 0x1B /* GPIO Interrupt Enable */
40#define GPIO_INT_EN3 0x1C /* GPIO Interrupt Enable */
41#define KP_GPIO1 0x1D /* Keypad or GPIO Selection */
42#define KP_GPIO2 0x1E /* Keypad or GPIO Selection */
43#define KP_GPIO3 0x1F /* Keypad or GPIO Selection */
44#define GPI_EM1 0x20 /* GPI Event Mode 1 */
45#define GPI_EM2 0x21 /* GPI Event Mode 2 */
46#define GPI_EM3 0x22 /* GPI Event Mode 3 */
47#define GPIO_DIR1 0x23 /* GPIO Data Direction */
48#define GPIO_DIR2 0x24 /* GPIO Data Direction */
49#define GPIO_DIR3 0x25 /* GPIO Data Direction */
50#define GPIO_INT_LVL1 0x26 /* GPIO Edge/Level Detect */
51#define GPIO_INT_LVL2 0x27 /* GPIO Edge/Level Detect */
52#define GPIO_INT_LVL3 0x28 /* GPIO Edge/Level Detect */
53#define Debounce_DIS1 0x29 /* Debounce Disable */
54#define Debounce_DIS2 0x2A /* Debounce Disable */
55#define Debounce_DIS3 0x2B /* Debounce Disable */
56#define GPIO_PULL1 0x2C /* GPIO Pull Disable */
57#define GPIO_PULL2 0x2D /* GPIO Pull Disable */
58#define GPIO_PULL3 0x2E /* GPIO Pull Disable */
59#define CMP_CFG_STAT 0x30 /* Comparator Configuration and Status Register */
60#define CMP_CONFG_SENS1 0x31 /* Sensor1 Comparator Configuration Register */
61#define CMP_CONFG_SENS2 0x32 /* L2 Light Sensor Reference Level, Output Falling for Sensor 1 */
62#define CMP1_LVL2_TRIP 0x33 /* L2 Light Sensor Hysteresis (Active when Output Rising) for Sensor 1 */
63#define CMP1_LVL2_HYS 0x34 /* L3 Light Sensor Reference Level, Output Falling For Sensor 1 */
64#define CMP1_LVL3_TRIP 0x35 /* L3 Light Sensor Hysteresis (Active when Output Rising) For Sensor 1 */
65#define CMP1_LVL3_HYS 0x36 /* Sensor 2 Comparator Configuration Register */
66#define CMP2_LVL2_TRIP 0x37 /* L2 Light Sensor Reference Level, Output Falling for Sensor 2 */
67#define CMP2_LVL2_HYS 0x38 /* L2 Light Sensor Hysteresis (Active when Output Rising) for Sensor 2 */
68#define CMP2_LVL3_TRIP 0x39 /* L3 Light Sensor Reference Level, Output Falling For Sensor 2 */
69#define CMP2_LVL3_HYS 0x3A /* L3 Light Sensor Hysteresis (Active when Output Rising) For Sensor 2 */
70#define CMP1_ADC_DAT_R1 0x3B /* Comparator 1 ADC data Register1 */
71#define CMP1_ADC_DAT_R2 0x3C /* Comparator 1 ADC data Register2 */
72#define CMP2_ADC_DAT_R1 0x3D /* Comparator 2 ADC data Register1 */
73#define CMP2_ADC_DAT_R2 0x3E /* Comparator 2 ADC data Register2 */
74
75#define ADP5588_DEVICE_ID_MASK 0xF
76
77/* Put one of these structures in i2c_board_info platform_data */
78
79#define ADP5588_KEYMAPSIZE 80
80
81struct adp5588_kpad_platform_data {
82 int rows; /* Number of rows */
83 int cols; /* Number of columns */
84 const unsigned short *keymap; /* Pointer to keymap */
85 unsigned short keymapsize; /* Keymap size */
86 unsigned repeat:1; /* Enable key repeat */
87 unsigned en_keylock:1; /* Enable Key Lock feature */
88 unsigned short unlock_key1; /* Unlock Key 1 */
89 unsigned short unlock_key2; /* Unlock Key 2 */
90};
91
92#endif
diff --git a/include/linux/i2c/mcs5000_ts.h b/include/linux/i2c/mcs5000_ts.h
new file mode 100644
index 000000000000..5a117b5ca15e
--- /dev/null
+++ b/include/linux/i2c/mcs5000_ts.h
@@ -0,0 +1,24 @@
1/*
2 * mcs5000_ts.h
3 *
4 * Copyright (C) 2009 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MCS5000_TS_H
15#define __LINUX_MCS5000_TS_H
16
17/* platform data for the MELFAS MCS-5000 touchscreen driver */
18struct mcs5000_ts_platform_data {
19 void (*cfg_pin)(void);
20 int x_size;
21 int y_size;
22};
23
24#endif /* __LINUX_MCS5000_TS_H */
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index 3fd21d7cb6bf..2d02dfd7076c 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -223,19 +223,28 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
223 223
224/* Power bus message definitions */ 224/* Power bus message definitions */
225 225
226#define DEV_GRP_NULL 0x0 226/* The TWL4030/5030 splits its power-management resources (the various
227#define DEV_GRP_P1 0x1 227 * regulators, clock and reset lines) into 3 processor groups - P1, P2 and
228#define DEV_GRP_P2 0x2 228 * P3. These groups can then be configured to transition between sleep, wait-on
229#define DEV_GRP_P3 0x4 229 * and active states by sending messages to the power bus. See Section 5.4.2
230 * Power Resources of TWL4030 TRM
231 */
230 232
231#define RES_GRP_RES 0x0 233/* Processor groups */
232#define RES_GRP_PP 0x1 234#define DEV_GRP_NULL 0x0
233#define RES_GRP_RC 0x2 235#define DEV_GRP_P1 0x1 /* P1: all OMAP devices */
236#define DEV_GRP_P2 0x2 /* P2: all Modem devices */
237#define DEV_GRP_P3 0x4 /* P3: all peripheral devices */
238
239/* Resource groups */
240#define RES_GRP_RES 0x0 /* Reserved */
241#define RES_GRP_PP 0x1 /* Power providers */
242#define RES_GRP_RC 0x2 /* Reset and control */
234#define RES_GRP_PP_RC 0x3 243#define RES_GRP_PP_RC 0x3
235#define RES_GRP_PR 0x4 244#define RES_GRP_PR 0x4 /* Power references */
236#define RES_GRP_PP_PR 0x5 245#define RES_GRP_PP_PR 0x5
237#define RES_GRP_RC_PR 0x6 246#define RES_GRP_RC_PR 0x6
238#define RES_GRP_ALL 0x7 247#define RES_GRP_ALL 0x7 /* All resource groups */
239 248
240#define RES_TYPE2_R0 0x0 249#define RES_TYPE2_R0 0x0
241 250
@@ -246,6 +255,41 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
246#define RES_STATE_SLEEP 0x8 255#define RES_STATE_SLEEP 0x8
247#define RES_STATE_OFF 0x0 256#define RES_STATE_OFF 0x0
248 257
258/* Power resources */
259
260/* Power providers */
261#define RES_VAUX1 1
262#define RES_VAUX2 2
263#define RES_VAUX3 3
264#define RES_VAUX4 4
265#define RES_VMMC1 5
266#define RES_VMMC2 6
267#define RES_VPLL1 7
268#define RES_VPLL2 8
269#define RES_VSIM 9
270#define RES_VDAC 10
271#define RES_VINTANA1 11
272#define RES_VINTANA2 12
273#define RES_VINTDIG 13
274#define RES_VIO 14
275#define RES_VDD1 15
276#define RES_VDD2 16
277#define RES_VUSB_1V5 17
278#define RES_VUSB_1V8 18
279#define RES_VUSB_3V1 19
280#define RES_VUSBCP 20
281#define RES_REGEN 21
282/* Reset and control */
283#define RES_NRES_PWRON 22
284#define RES_CLKEN 23
285#define RES_SYSEN 24
286#define RES_HFCLKOUT 25
287#define RES_32KCLKOUT 26
288#define RES_RESET 27
289/* Power Reference */
290#define RES_Main_Ref 28
291
292#define TOTAL_RESOURCES 28
249/* 293/*
250 * Power Bus Message Format ... these can be sent individually by Linux, 294 * Power Bus Message Format ... these can be sent individually by Linux,
251 * but are usually part of downloaded scripts that are run when various 295 * but are usually part of downloaded scripts that are run when various
@@ -327,6 +371,36 @@ struct twl4030_usb_data {
327 enum twl4030_usb_mode usb_mode; 371 enum twl4030_usb_mode usb_mode;
328}; 372};
329 373
374struct twl4030_ins {
375 u16 pmb_message;
376 u8 delay;
377};
378
379struct twl4030_script {
380 struct twl4030_ins *script;
381 unsigned size;
382 u8 flags;
383#define TWL4030_WRST_SCRIPT (1<<0)
384#define TWL4030_WAKEUP12_SCRIPT (1<<1)
385#define TWL4030_WAKEUP3_SCRIPT (1<<2)
386#define TWL4030_SLEEP_SCRIPT (1<<3)
387};
388
389struct twl4030_resconfig {
390 u8 resource;
391 u8 devgroup; /* Processor group that Power resource belongs to */
392 u8 type; /* Power resource addressed, 6 / broadcast message */
393 u8 type2; /* Power resource addressed, 3 / broadcast message */
394};
395
396struct twl4030_power_data {
397 struct twl4030_script **scripts;
398 unsigned num;
399 struct twl4030_resconfig *resource_config;
400};
401
402extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
403
330struct twl4030_platform_data { 404struct twl4030_platform_data {
331 unsigned irq_base, irq_end; 405 unsigned irq_base, irq_end;
332 struct twl4030_bci_platform_data *bci; 406 struct twl4030_bci_platform_data *bci;
@@ -334,6 +408,7 @@ struct twl4030_platform_data {
334 struct twl4030_madc_platform_data *madc; 408 struct twl4030_madc_platform_data *madc;
335 struct twl4030_keypad_data *keypad; 409 struct twl4030_keypad_data *keypad;
336 struct twl4030_usb_data *usb; 410 struct twl4030_usb_data *usb;
411 struct twl4030_power_data *power;
337 412
338 /* LDO regulators */ 413 /* LDO regulators */
339 struct regulator_init_data *vdac; 414 struct regulator_init_data *vdac;
@@ -364,7 +439,6 @@ int twl4030_sih_setup(int module);
364#define TWL4030_VAUX3_DEV_GRP 0x1F 439#define TWL4030_VAUX3_DEV_GRP 0x1F
365#define TWL4030_VAUX3_DEDICATED 0x22 440#define TWL4030_VAUX3_DEDICATED 0x22
366 441
367
368#if defined(CONFIG_TWL4030_BCI_BATTERY) || \ 442#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
369 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE) 443 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
370 extern int twl4030charger_usb_en(int enable); 444 extern int twl4030charger_usb_en(int enable);
diff --git a/include/linux/i8042.h b/include/linux/i8042.h
index 7907a72403ee..60c3360ef6ad 100644
--- a/include/linux/i8042.h
+++ b/include/linux/i8042.h
@@ -7,6 +7,7 @@
7 * the Free Software Foundation. 7 * the Free Software Foundation.
8 */ 8 */
9 9
10#include <linux/types.h>
10 11
11/* 12/*
12 * Standard commands. 13 * Standard commands.
@@ -30,6 +31,35 @@
30#define I8042_CMD_MUX_PFX 0x0090 31#define I8042_CMD_MUX_PFX 0x0090
31#define I8042_CMD_MUX_SEND 0x1090 32#define I8042_CMD_MUX_SEND 0x1090
32 33
34struct serio;
35
36#if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE)
37
38void i8042_lock_chip(void);
39void i8042_unlock_chip(void);
33int i8042_command(unsigned char *param, int command); 40int i8042_command(unsigned char *param, int command);
41bool i8042_check_port_owner(const struct serio *);
42
43#else
44
45void i8042_lock_chip(void)
46{
47}
48
49void i8042_unlock_chip(void)
50{
51}
52
53int i8042_command(unsigned char *param, int command)
54{
55 return -ENOSYS;
56}
57
58bool i8042_check_port_owner(const struct serio *serio)
59{
60 return false;
61}
62
63#endif
34 64
35#endif 65#endif
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 9e7f2e8fc66e..21a6f5d9af22 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -106,13 +106,13 @@ extern struct group_info init_groups;
106 106
107extern struct cred init_cred; 107extern struct cred init_cred;
108 108
109#ifdef CONFIG_PERF_COUNTERS 109#ifdef CONFIG_PERF_EVENTS
110# define INIT_PERF_COUNTERS(tsk) \ 110# define INIT_PERF_EVENTS(tsk) \
111 .perf_counter_mutex = \ 111 .perf_event_mutex = \
112 __MUTEX_INITIALIZER(tsk.perf_counter_mutex), \ 112 __MUTEX_INITIALIZER(tsk.perf_event_mutex), \
113 .perf_counter_list = LIST_HEAD_INIT(tsk.perf_counter_list), 113 .perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
114#else 114#else
115# define INIT_PERF_COUNTERS(tsk) 115# define INIT_PERF_EVENTS(tsk)
116#endif 116#endif
117 117
118/* 118/*
@@ -178,7 +178,7 @@ extern struct cred init_cred;
178 }, \ 178 }, \
179 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ 179 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
180 INIT_IDS \ 180 INIT_IDS \
181 INIT_PERF_COUNTERS(tsk) \ 181 INIT_PERF_EVENTS(tsk) \
182 INIT_TRACE_IRQFLAGS \ 182 INIT_TRACE_IRQFLAGS \
183 INIT_LOCKDEP \ 183 INIT_LOCKDEP \
184 INIT_FTRACE_GRAPH \ 184 INIT_FTRACE_GRAPH \
diff --git a/include/linux/input.h b/include/linux/input.h
index 8b3bc3e0d146..0ccfc30cd40f 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1123,7 +1123,7 @@ struct input_dev {
1123 struct mutex mutex; 1123 struct mutex mutex;
1124 1124
1125 unsigned int users; 1125 unsigned int users;
1126 int going_away; 1126 bool going_away;
1127 1127
1128 struct device dev; 1128 struct device dev;
1129 1129
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 482dc91fd53a..4f0a72a9740c 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -360,4 +360,6 @@ extern void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep,
360 360
361extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); 361extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
362 362
363extern int dmar_ir_support(void);
364
363#endif 365#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 8e9e151f811e..b78cf8194957 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -84,7 +84,6 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
84 * struct irqaction - per interrupt action descriptor 84 * struct irqaction - per interrupt action descriptor
85 * @handler: interrupt handler function 85 * @handler: interrupt handler function
86 * @flags: flags (see IRQF_* above) 86 * @flags: flags (see IRQF_* above)
87 * @mask: no comment as it is useless and about to be removed
88 * @name: name of the device 87 * @name: name of the device
89 * @dev_id: cookie to identify the device 88 * @dev_id: cookie to identify the device
90 * @next: pointer to the next irqaction for shared interrupts 89 * @next: pointer to the next irqaction for shared interrupts
@@ -97,7 +96,6 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
97struct irqaction { 96struct irqaction {
98 irq_handler_t handler; 97 irq_handler_t handler;
99 unsigned long flags; 98 unsigned long flags;
100 cpumask_t mask;
101 const char *name; 99 const char *name;
102 void *dev_id; 100 void *dev_id;
103 struct irqaction *next; 101 struct irqaction *next;
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 786e7b8cece9..83aa81297ea3 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -184,5 +184,9 @@ extern void __devm_release_region(struct device *dev, struct resource *parent,
184extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size); 184extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size);
185extern int iomem_is_exclusive(u64 addr); 185extern int iomem_is_exclusive(u64 addr);
186 186
187extern int
188walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
189 void *arg, int (*func)(unsigned long, unsigned long, void *));
190
187#endif /* __ASSEMBLY__ */ 191#endif /* __ASSEMBLY__ */
188#endif /* _LINUX_IOPORT_H */ 192#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/iova.h b/include/linux/iova.h
index 228f6c94b69c..76a0759e88ec 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -28,7 +28,6 @@ struct iova {
28 28
29/* holds all the iova translations for a domain */ 29/* holds all the iova translations for a domain */
30struct iova_domain { 30struct iova_domain {
31 spinlock_t iova_alloc_lock;/* Lock to protect iova allocation */
32 spinlock_t iova_rbtree_lock; /* Lock to protect update of rbtree */ 31 spinlock_t iova_rbtree_lock; /* Lock to protect update of rbtree */
33 struct rb_root rbroot; /* iova domain rbtree root */ 32 struct rb_root rbroot; /* iova domain rbtree root */
34 struct rb_node *cached32_node; /* Save last alloced node */ 33 struct rb_node *cached32_node; /* Save last alloced node */
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index c2049a04fa0b..331530cd3cc6 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -446,7 +446,7 @@ struct transaction_s
446 /* 446 /*
447 * Where in the log does this transaction's commit start? [no locking] 447 * Where in the log does this transaction's commit start? [no locking]
448 */ 448 */
449 unsigned long t_log_start; 449 unsigned int t_log_start;
450 450
451 /* Number of buffers on the t_buffers list [j_list_lock] */ 451 /* Number of buffers on the t_buffers list [j_list_lock] */
452 int t_nr_buffers; 452 int t_nr_buffers;
@@ -556,7 +556,7 @@ struct transaction_s
556 * This transaction is being forced and some process is 556 * This transaction is being forced and some process is
557 * waiting for it to finish. 557 * waiting for it to finish.
558 */ 558 */
559 int t_synchronous_commit:1; 559 unsigned int t_synchronous_commit:1;
560}; 560};
561 561
562/** 562/**
@@ -701,26 +701,26 @@ struct journal_s
701 * Journal head: identifies the first unused block in the journal. 701 * Journal head: identifies the first unused block in the journal.
702 * [j_state_lock] 702 * [j_state_lock]
703 */ 703 */
704 unsigned long j_head; 704 unsigned int j_head;
705 705
706 /* 706 /*
707 * Journal tail: identifies the oldest still-used block in the journal. 707 * Journal tail: identifies the oldest still-used block in the journal.
708 * [j_state_lock] 708 * [j_state_lock]
709 */ 709 */
710 unsigned long j_tail; 710 unsigned int j_tail;
711 711
712 /* 712 /*
713 * Journal free: how many free blocks are there in the journal? 713 * Journal free: how many free blocks are there in the journal?
714 * [j_state_lock] 714 * [j_state_lock]
715 */ 715 */
716 unsigned long j_free; 716 unsigned int j_free;
717 717
718 /* 718 /*
719 * Journal start and end: the block numbers of the first usable block 719 * Journal start and end: the block numbers of the first usable block
720 * and one beyond the last usable block in the journal. [j_state_lock] 720 * and one beyond the last usable block in the journal. [j_state_lock]
721 */ 721 */
722 unsigned long j_first; 722 unsigned int j_first;
723 unsigned long j_last; 723 unsigned int j_last;
724 724
725 /* 725 /*
726 * Device, blocksize and starting block offset for the location where we 726 * Device, blocksize and starting block offset for the location where we
@@ -728,7 +728,7 @@ struct journal_s
728 */ 728 */
729 struct block_device *j_dev; 729 struct block_device *j_dev;
730 int j_blocksize; 730 int j_blocksize;
731 unsigned long j_blk_offset; 731 unsigned int j_blk_offset;
732 732
733 /* 733 /*
734 * Device which holds the client fs. For internal journal this will be 734 * Device which holds the client fs. For internal journal this will be
@@ -859,7 +859,7 @@ extern void __journal_clean_data_list(transaction_t *transaction);
859 859
860/* Log buffer allocation */ 860/* Log buffer allocation */
861extern struct journal_head * journal_get_descriptor_buffer(journal_t *); 861extern struct journal_head * journal_get_descriptor_buffer(journal_t *);
862int journal_next_log_block(journal_t *, unsigned long *); 862int journal_next_log_block(journal_t *, unsigned int *);
863 863
864/* Commit management */ 864/* Commit management */
865extern void journal_commit_transaction(journal_t *); 865extern void journal_commit_transaction(journal_t *);
@@ -874,7 +874,7 @@ extern int
874journal_write_metadata_buffer(transaction_t *transaction, 874journal_write_metadata_buffer(transaction_t *transaction,
875 struct journal_head *jh_in, 875 struct journal_head *jh_in,
876 struct journal_head **jh_out, 876 struct journal_head **jh_out,
877 unsigned long blocknr); 877 unsigned int blocknr);
878 878
879/* Transaction locking */ 879/* Transaction locking */
880extern void __wait_on_journal (journal_t *); 880extern void __wait_on_journal (journal_t *);
@@ -942,7 +942,7 @@ extern void journal_abort (journal_t *, int);
942extern int journal_errno (journal_t *); 942extern int journal_errno (journal_t *);
943extern void journal_ack_err (journal_t *); 943extern void journal_ack_err (journal_t *);
944extern int journal_clear_err (journal_t *); 944extern int journal_clear_err (journal_t *);
945extern int journal_bmap(journal_t *, unsigned long, unsigned long *); 945extern int journal_bmap(journal_t *, unsigned int, unsigned int *);
946extern int journal_force_commit(journal_t *); 946extern int journal_force_commit(journal_t *);
947 947
948/* 948/*
@@ -976,14 +976,14 @@ extern int journal_init_revoke_caches(void);
976 976
977extern void journal_destroy_revoke(journal_t *); 977extern void journal_destroy_revoke(journal_t *);
978extern int journal_revoke (handle_t *, 978extern int journal_revoke (handle_t *,
979 unsigned long, struct buffer_head *); 979 unsigned int, struct buffer_head *);
980extern int journal_cancel_revoke(handle_t *, struct journal_head *); 980extern int journal_cancel_revoke(handle_t *, struct journal_head *);
981extern void journal_write_revoke_records(journal_t *, 981extern void journal_write_revoke_records(journal_t *,
982 transaction_t *, int); 982 transaction_t *, int);
983 983
984/* Recovery revoke support */ 984/* Recovery revoke support */
985extern int journal_set_revoke(journal_t *, unsigned long, tid_t); 985extern int journal_set_revoke(journal_t *, unsigned int, tid_t);
986extern int journal_test_revoke(journal_t *, unsigned long, tid_t); 986extern int journal_test_revoke(journal_t *, unsigned int, tid_t);
987extern void journal_clear_revoke(journal_t *); 987extern void journal_clear_revoke(journal_t *);
988extern void journal_switch_revoke_table(journal_t *journal); 988extern void journal_switch_revoke_table(journal_t *journal);
989 989
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index d97eb652d6ca..52695d3dfd0b 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -652,7 +652,7 @@ struct transaction_s
652 * This transaction is being forced and some process is 652 * This transaction is being forced and some process is
653 * waiting for it to finish. 653 * waiting for it to finish.
654 */ 654 */
655 int t_synchronous_commit:1; 655 unsigned int t_synchronous_commit:1;
656 656
657 /* 657 /*
658 * For use by the filesystem to store fs-specific data 658 * For use by the filesystem to store fs-specific data
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2b5b1e0899a8..d3cd23f30039 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -146,7 +146,7 @@ extern int _cond_resched(void);
146#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) 146#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
147 147
148#define abs(x) ({ \ 148#define abs(x) ({ \
149 int __x = (x); \ 149 long __x = (x); \
150 (__x < 0) ? -__x : __x; \ 150 (__x < 0) ? -__x : __x; \
151 }) 151 })
152 152
@@ -246,14 +246,16 @@ extern int printk_ratelimit(void);
246extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, 246extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
247 unsigned int interval_msec); 247 unsigned int interval_msec);
248 248
249extern int printk_delay_msec;
250
249/* 251/*
250 * Print a one-time message (analogous to WARN_ONCE() et al): 252 * Print a one-time message (analogous to WARN_ONCE() et al):
251 */ 253 */
252#define printk_once(x...) ({ \ 254#define printk_once(x...) ({ \
253 static int __print_once = 1; \ 255 static bool __print_once = true; \
254 \ 256 \
255 if (__print_once) { \ 257 if (__print_once) { \
256 __print_once = 0; \ 258 __print_once = false; \
257 printk(x); \ 259 printk(x); \
258 } \ 260 } \
259}) 261})
@@ -676,13 +678,17 @@ struct sysinfo {
676}; 678};
677 679
678/* Force a compilation error if condition is true */ 680/* Force a compilation error if condition is true */
679#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 681#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
682
683/* Force a compilation error if condition is constant and true */
684#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
680 685
681/* Force a compilation error if condition is true, but also produce a 686/* Force a compilation error if condition is true, but also produce a
682 result (of value 0 and type size_t), so the expression can be used 687 result (of value 0 and type size_t), so the expression can be used
683 e.g. in a structure initializer (or where-ever else comma expressions 688 e.g. in a structure initializer (or where-ever else comma expressions
684 aren't permitted). */ 689 aren't permitted). */
685#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1) 690#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
691#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
686 692
687/* Trap pasters of __FUNCTION__ at compile-time */ 693/* Trap pasters of __FUNCTION__ at compile-time */
688#define __FUNCTION__ (__func__) 694#define __FUNCTION__ (__func__)
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 29f62e1733ff..ad6bdf5a5970 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -38,7 +38,7 @@ extern struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask,
38 spinlock_t *lock); 38 spinlock_t *lock);
39extern void kfifo_free(struct kfifo *fifo); 39extern void kfifo_free(struct kfifo *fifo);
40extern unsigned int __kfifo_put(struct kfifo *fifo, 40extern unsigned int __kfifo_put(struct kfifo *fifo,
41 unsigned char *buffer, unsigned int len); 41 const unsigned char *buffer, unsigned int len);
42extern unsigned int __kfifo_get(struct kfifo *fifo, 42extern unsigned int __kfifo_get(struct kfifo *fifo,
43 unsigned char *buffer, unsigned int len); 43 unsigned char *buffer, unsigned int len);
44 44
@@ -77,7 +77,7 @@ static inline void kfifo_reset(struct kfifo *fifo)
77 * bytes copied. 77 * bytes copied.
78 */ 78 */
79static inline unsigned int kfifo_put(struct kfifo *fifo, 79static inline unsigned int kfifo_put(struct kfifo *fifo,
80 unsigned char *buffer, unsigned int len) 80 const unsigned char *buffer, unsigned int len)
81{ 81{
82 unsigned long flags; 82 unsigned long flags;
83 unsigned int ret; 83 unsigned int ret;
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
index dc2fd545db00..e880d4cf9e22 100644
--- a/include/linux/kmemcheck.h
+++ b/include/linux/kmemcheck.h
@@ -144,10 +144,15 @@ static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size)
144 int name##_end[0]; 144 int name##_end[0];
145 145
146#define kmemcheck_annotate_bitfield(ptr, name) \ 146#define kmemcheck_annotate_bitfield(ptr, name) \
147 do if (ptr) { \ 147 do { \
148 int _n = (long) &((ptr)->name##_end) \ 148 int _n; \
149 \
150 if (!ptr) \
151 break; \
152 \
153 _n = (long) &((ptr)->name##_end) \
149 - (long) &((ptr)->name##_begin); \ 154 - (long) &((ptr)->name##_begin); \
150 BUILD_BUG_ON(_n < 0); \ 155 MAYBE_BUILD_BUG_ON(_n < 0); \
151 \ 156 \
152 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ 157 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
153 } while (0) 158 } while (0)
diff --git a/include/linux/ksm.h b/include/linux/ksm.h
new file mode 100644
index 000000000000..a485c14ecd5d
--- /dev/null
+++ b/include/linux/ksm.h
@@ -0,0 +1,79 @@
1#ifndef __LINUX_KSM_H
2#define __LINUX_KSM_H
3/*
4 * Memory merging support.
5 *
6 * This code enables dynamic sharing of identical pages found in different
7 * memory areas, even if they are not shared by fork().
8 */
9
10#include <linux/bitops.h>
11#include <linux/mm.h>
12#include <linux/sched.h>
13#include <linux/vmstat.h>
14
15#ifdef CONFIG_KSM
16int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
17 unsigned long end, int advice, unsigned long *vm_flags);
18int __ksm_enter(struct mm_struct *mm);
19void __ksm_exit(struct mm_struct *mm);
20
21static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
22{
23 if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags))
24 return __ksm_enter(mm);
25 return 0;
26}
27
28static inline void ksm_exit(struct mm_struct *mm)
29{
30 if (test_bit(MMF_VM_MERGEABLE, &mm->flags))
31 __ksm_exit(mm);
32}
33
34/*
35 * A KSM page is one of those write-protected "shared pages" or "merged pages"
36 * which KSM maps into multiple mms, wherever identical anonymous page content
37 * is found in VM_MERGEABLE vmas. It's a PageAnon page, with NULL anon_vma.
38 */
39static inline int PageKsm(struct page *page)
40{
41 return ((unsigned long)page->mapping == PAGE_MAPPING_ANON);
42}
43
44/*
45 * But we have to avoid the checking which page_add_anon_rmap() performs.
46 */
47static inline void page_add_ksm_rmap(struct page *page)
48{
49 if (atomic_inc_and_test(&page->_mapcount)) {
50 page->mapping = (void *) PAGE_MAPPING_ANON;
51 __inc_zone_page_state(page, NR_ANON_PAGES);
52 }
53}
54#else /* !CONFIG_KSM */
55
56static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
57 unsigned long end, int advice, unsigned long *vm_flags)
58{
59 return 0;
60}
61
62static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
63{
64 return 0;
65}
66
67static inline void ksm_exit(struct mm_struct *mm)
68{
69}
70
71static inline int PageKsm(struct page *page)
72{
73 return 0;
74}
75
76/* No stub required for page_add_ksm_rmap(page) */
77#endif /* !CONFIG_KSM */
78
79#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 4af56036a6bf..b7bbb5ddd7ae 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -15,7 +15,6 @@
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/preempt.h> 17#include <linux/preempt.h>
18#include <linux/marker.h>
19#include <linux/msi.h> 18#include <linux/msi.h>
20#include <asm/signal.h> 19#include <asm/signal.h>
21 20
diff --git a/include/linux/libps2.h b/include/linux/libps2.h
index fcf5fbe6a50c..79603a6c356f 100644
--- a/include/linux/libps2.h
+++ b/include/linux/libps2.h
@@ -44,6 +44,8 @@ struct ps2dev {
44void ps2_init(struct ps2dev *ps2dev, struct serio *serio); 44void ps2_init(struct ps2dev *ps2dev, struct serio *serio);
45int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout); 45int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout);
46void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout); 46void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout);
47void ps2_begin_command(struct ps2dev *ps2dev);
48void ps2_end_command(struct ps2dev *ps2dev);
47int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command); 49int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command);
48int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command); 50int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command);
49int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data); 51int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data);
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 691f59171c6c..5126cceb6ae9 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -57,6 +57,7 @@
57 57
58#ifdef __ASSEMBLY__ 58#ifdef __ASSEMBLY__
59 59
60#ifndef LINKER_SCRIPT
60#define ALIGN __ALIGN 61#define ALIGN __ALIGN
61#define ALIGN_STR __ALIGN_STR 62#define ALIGN_STR __ALIGN_STR
62 63
@@ -66,6 +67,7 @@
66 ALIGN; \ 67 ALIGN; \
67 name: 68 name:
68#endif 69#endif
70#endif /* LINKER_SCRIPT */
69 71
70#ifndef WEAK 72#ifndef WEAK
71#define WEAK(name) \ 73#define WEAK(name) \
diff --git a/include/linux/lis3lv02d.h b/include/linux/lis3lv02d.h
index ad651f4e45ac..3cc2f2c53e4c 100644
--- a/include/linux/lis3lv02d.h
+++ b/include/linux/lis3lv02d.h
@@ -32,8 +32,17 @@ struct lis3lv02d_platform_data {
32#define LIS3_IRQ2_DATA_READY (4 << 3) 32#define LIS3_IRQ2_DATA_READY (4 << 3)
33#define LIS3_IRQ2_CLICK (7 << 3) 33#define LIS3_IRQ2_CLICK (7 << 3)
34#define LIS3_IRQ_OPEN_DRAIN (1 << 6) 34#define LIS3_IRQ_OPEN_DRAIN (1 << 6)
35#define LIS3_IRQ_ACTIVE_HIGH (1 << 7) 35#define LIS3_IRQ_ACTIVE_LOW (1 << 7)
36 unsigned char irq_cfg; 36 unsigned char irq_cfg;
37
38#define LIS3_WAKEUP_X_LO (1 << 0)
39#define LIS3_WAKEUP_X_HI (1 << 1)
40#define LIS3_WAKEUP_Y_LO (1 << 2)
41#define LIS3_WAKEUP_Y_HI (1 << 3)
42#define LIS3_WAKEUP_Z_LO (1 << 4)
43#define LIS3_WAKEUP_Z_HI (1 << 5)
44 unsigned char wakeup_flags;
45 unsigned char wakeup_thresh;
37}; 46};
38 47
39#endif /* __LIS3LV02D_H_ */ 48#endif /* __LIS3LV02D_H_ */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index c325b187966b..a34dea46b629 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -338,49 +338,6 @@ static inline int nlm_privileged_requester(const struct svc_rqst *rqstp)
338 } 338 }
339} 339}
340 340
341static inline int __nlm_cmp_addr4(const struct sockaddr *sap1,
342 const struct sockaddr *sap2)
343{
344 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
345 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
346 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
347}
348
349#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
350static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
351 const struct sockaddr *sap2)
352{
353 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
354 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
355 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
356}
357#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
358static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
359 const struct sockaddr *sap2)
360{
361 return 0;
362}
363#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
364
365/*
366 * Compare two host addresses
367 *
368 * Return TRUE if the addresses are the same; otherwise FALSE.
369 */
370static inline int nlm_cmp_addr(const struct sockaddr *sap1,
371 const struct sockaddr *sap2)
372{
373 if (sap1->sa_family == sap2->sa_family) {
374 switch (sap1->sa_family) {
375 case AF_INET:
376 return __nlm_cmp_addr4(sap1, sap2);
377 case AF_INET6:
378 return __nlm_cmp_addr6(sap1, sap2);
379 }
380 }
381 return 0;
382}
383
384/* 341/*
385 * Compare two NLM locks. 342 * Compare two NLM locks.
386 * When the second lock is of type F_UNLCK, this acts like a wildcard. 343 * When the second lock is of type F_UNLCK, this acts like a wildcard.
@@ -395,7 +352,7 @@ static inline int nlm_compare_locks(const struct file_lock *fl1,
395 &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK); 352 &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK);
396} 353}
397 354
398extern struct lock_manager_operations nlmsvc_lock_operations; 355extern const struct lock_manager_operations nlmsvc_lock_operations;
399 356
400#endif /* __KERNEL__ */ 357#endif /* __KERNEL__ */
401 358
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index 536ca12442ca..78c3bed1c3f5 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -104,7 +104,7 @@
104#define DL_UNITDATA_IND 0x3108 104#define DL_UNITDATA_IND 0x3108
105#define DL_INFORMATION_IND 0x0008 105#define DL_INFORMATION_IND 0x0008
106 106
107/* intern layer 2 managment */ 107/* intern layer 2 management */
108#define MDL_ASSIGN_REQ 0x1804 108#define MDL_ASSIGN_REQ 0x1804
109#define MDL_ASSIGN_IND 0x1904 109#define MDL_ASSIGN_IND 0x1904
110#define MDL_REMOVE_REQ 0x1A04 110#define MDL_REMOVE_REQ 0x1A04
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 1923327b9869..76285e01b39e 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -12,7 +12,9 @@
12#define SYSFS_MAGIC 0x62656572 12#define SYSFS_MAGIC 0x62656572
13#define SECURITYFS_MAGIC 0x73636673 13#define SECURITYFS_MAGIC 0x73636673
14#define SELINUX_MAGIC 0xf97cff8c 14#define SELINUX_MAGIC 0xf97cff8c
15#define RAMFS_MAGIC 0x858458f6 /* some random number */
15#define TMPFS_MAGIC 0x01021994 16#define TMPFS_MAGIC 0x01021994
17#define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
16#define SQUASHFS_MAGIC 0x73717368 18#define SQUASHFS_MAGIC 0x73717368
17#define EFS_SUPER_MAGIC 0x414A53 19#define EFS_SUPER_MAGIC 0x414A53
18#define EXT2_SUPER_MAGIC 0xEF53 20#define EXT2_SUPER_MAGIC 0xEF53
@@ -53,4 +55,8 @@
53#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA 55#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA
54 56
55#define STACK_END_MAGIC 0x57AC6E9D 57#define STACK_END_MAGIC 0x57AC6E9D
58
59#define DEVPTS_SUPER_MAGIC 0x1cd1
60#define SOCKFS_MAGIC 0x534F434B
61
56#endif /* __LINUX_MAGIC_H__ */ 62#endif /* __LINUX_MAGIC_H__ */
diff --git a/include/linux/marker.h b/include/linux/marker.h
deleted file mode 100644
index b85e74ca782f..000000000000
--- a/include/linux/marker.h
+++ /dev/null
@@ -1,221 +0,0 @@
1#ifndef _LINUX_MARKER_H
2#define _LINUX_MARKER_H
3
4/*
5 * Code markup for dynamic and static tracing.
6 *
7 * See Documentation/marker.txt.
8 *
9 * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
10 *
11 * This file is released under the GPLv2.
12 * See the file COPYING for more details.
13 */
14
15#include <stdarg.h>
16#include <linux/types.h>
17
18struct module;
19struct marker;
20
21/**
22 * marker_probe_func - Type of a marker probe function
23 * @probe_private: probe private data
24 * @call_private: call site private data
25 * @fmt: format string
26 * @args: variable argument list pointer. Use a pointer to overcome C's
27 * inability to pass this around as a pointer in a portable manner in
28 * the callee otherwise.
29 *
30 * Type of marker probe functions. They receive the mdata and need to parse the
31 * format string to recover the variable argument list.
32 */
33typedef void marker_probe_func(void *probe_private, void *call_private,
34 const char *fmt, va_list *args);
35
36struct marker_probe_closure {
37 marker_probe_func *func; /* Callback */
38 void *probe_private; /* Private probe data */
39};
40
41struct marker {
42 const char *name; /* Marker name */
43 const char *format; /* Marker format string, describing the
44 * variable argument list.
45 */
46 char state; /* Marker state. */
47 char ptype; /* probe type : 0 : single, 1 : multi */
48 /* Probe wrapper */
49 void (*call)(const struct marker *mdata, void *call_private, ...);
50 struct marker_probe_closure single;
51 struct marker_probe_closure *multi;
52 const char *tp_name; /* Optional tracepoint name */
53 void *tp_cb; /* Optional tracepoint callback */
54} __attribute__((aligned(8)));
55
56#ifdef CONFIG_MARKERS
57
58#define _DEFINE_MARKER(name, tp_name_str, tp_cb, format) \
59 static const char __mstrtab_##name[] \
60 __attribute__((section("__markers_strings"))) \
61 = #name "\0" format; \
62 static struct marker __mark_##name \
63 __attribute__((section("__markers"), aligned(8))) = \
64 { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)], \
65 0, 0, marker_probe_cb, { __mark_empty_function, NULL},\
66 NULL, tp_name_str, tp_cb }
67
68#define DEFINE_MARKER(name, format) \
69 _DEFINE_MARKER(name, NULL, NULL, format)
70
71#define DEFINE_MARKER_TP(name, tp_name, tp_cb, format) \
72 _DEFINE_MARKER(name, #tp_name, tp_cb, format)
73
74/*
75 * Note : the empty asm volatile with read constraint is used here instead of a
76 * "used" attribute to fix a gcc 4.1.x bug.
77 * Make sure the alignment of the structure in the __markers section will
78 * not add unwanted padding between the beginning of the section and the
79 * structure. Force alignment to the same alignment as the section start.
80 *
81 * The "generic" argument controls which marker enabling mechanism must be used.
82 * If generic is true, a variable read is used.
83 * If generic is false, immediate values are used.
84 */
85#define __trace_mark(generic, name, call_private, format, args...) \
86 do { \
87 DEFINE_MARKER(name, format); \
88 __mark_check_format(format, ## args); \
89 if (unlikely(__mark_##name.state)) { \
90 (*__mark_##name.call) \
91 (&__mark_##name, call_private, ## args);\
92 } \
93 } while (0)
94
95#define __trace_mark_tp(name, call_private, tp_name, tp_cb, format, args...) \
96 do { \
97 void __check_tp_type(void) \
98 { \
99 register_trace_##tp_name(tp_cb); \
100 } \
101 DEFINE_MARKER_TP(name, tp_name, tp_cb, format); \
102 __mark_check_format(format, ## args); \
103 (*__mark_##name.call)(&__mark_##name, call_private, \
104 ## args); \
105 } while (0)
106
107extern void marker_update_probe_range(struct marker *begin,
108 struct marker *end);
109
110#define GET_MARKER(name) (__mark_##name)
111
112#else /* !CONFIG_MARKERS */
113#define DEFINE_MARKER(name, tp_name, tp_cb, format)
114#define __trace_mark(generic, name, call_private, format, args...) \
115 __mark_check_format(format, ## args)
116#define __trace_mark_tp(name, call_private, tp_name, tp_cb, format, args...) \
117 do { \
118 void __check_tp_type(void) \
119 { \
120 register_trace_##tp_name(tp_cb); \
121 } \
122 __mark_check_format(format, ## args); \
123 } while (0)
124static inline void marker_update_probe_range(struct marker *begin,
125 struct marker *end)
126{ }
127#define GET_MARKER(name)
128#endif /* CONFIG_MARKERS */
129
130/**
131 * trace_mark - Marker using code patching
132 * @name: marker name, not quoted.
133 * @format: format string
134 * @args...: variable argument list
135 *
136 * Places a marker using optimized code patching technique (imv_read())
137 * to be enabled when immediate values are present.
138 */
139#define trace_mark(name, format, args...) \
140 __trace_mark(0, name, NULL, format, ## args)
141
142/**
143 * _trace_mark - Marker using variable read
144 * @name: marker name, not quoted.
145 * @format: format string
146 * @args...: variable argument list
147 *
148 * Places a marker using a standard memory read (_imv_read()) to be
149 * enabled. Should be used for markers in code paths where instruction
150 * modification based enabling is not welcome. (__init and __exit functions,
151 * lockdep, some traps, printk).
152 */
153#define _trace_mark(name, format, args...) \
154 __trace_mark(1, name, NULL, format, ## args)
155
156/**
157 * trace_mark_tp - Marker in a tracepoint callback
158 * @name: marker name, not quoted.
159 * @tp_name: tracepoint name, not quoted.
160 * @tp_cb: tracepoint callback. Should have an associated global symbol so it
161 * is not optimized away by the compiler (should not be static).
162 * @format: format string
163 * @args...: variable argument list
164 *
165 * Places a marker in a tracepoint callback.
166 */
167#define trace_mark_tp(name, tp_name, tp_cb, format, args...) \
168 __trace_mark_tp(name, NULL, tp_name, tp_cb, format, ## args)
169
170/**
171 * MARK_NOARGS - Format string for a marker with no argument.
172 */
173#define MARK_NOARGS " "
174
175/* To be used for string format validity checking with gcc */
176static inline void __printf(1, 2) ___mark_check_format(const char *fmt, ...)
177{
178}
179
180#define __mark_check_format(format, args...) \
181 do { \
182 if (0) \
183 ___mark_check_format(format, ## args); \
184 } while (0)
185
186extern marker_probe_func __mark_empty_function;
187
188extern void marker_probe_cb(const struct marker *mdata,
189 void *call_private, ...);
190
191/*
192 * Connect a probe to a marker.
193 * private data pointer must be a valid allocated memory address, or NULL.
194 */
195extern int marker_probe_register(const char *name, const char *format,
196 marker_probe_func *probe, void *probe_private);
197
198/*
199 * Returns the private data given to marker_probe_register.
200 */
201extern int marker_probe_unregister(const char *name,
202 marker_probe_func *probe, void *probe_private);
203/*
204 * Unregister a marker by providing the registered private data.
205 */
206extern int marker_probe_unregister_private_data(marker_probe_func *probe,
207 void *probe_private);
208
209extern void *marker_get_private_data(const char *name, marker_probe_func *probe,
210 int num);
211
212/*
213 * marker_synchronize_unregister must be called between the last marker probe
214 * unregistration and the first one of
215 * - the end of module exit function
216 * - the free of any resource used by the probes
217 * to ensure the code and data are valid for any possibly running probes.
218 */
219#define marker_synchronize_unregister() synchronize_sched()
220
221#endif
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index e46a0734ab6e..bf9213b2db8f 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -118,6 +118,9 @@ static inline bool mem_cgroup_disabled(void)
118 118
119extern bool mem_cgroup_oom_called(struct task_struct *task); 119extern bool mem_cgroup_oom_called(struct task_struct *task);
120void mem_cgroup_update_mapped_file_stat(struct page *page, int val); 120void mem_cgroup_update_mapped_file_stat(struct page *page, int val);
121unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
122 gfp_t gfp_mask, int nid,
123 int zid);
121#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 124#else /* CONFIG_CGROUP_MEM_RES_CTLR */
122struct mem_cgroup; 125struct mem_cgroup;
123 126
@@ -276,6 +279,13 @@ static inline void mem_cgroup_update_mapped_file_stat(struct page *page,
276{ 279{
277} 280}
278 281
282static inline
283unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
284 gfp_t gfp_mask, int nid, int zid)
285{
286 return 0;
287}
288
279#endif /* CONFIG_CGROUP_MEM_CONT */ 289#endif /* CONFIG_CGROUP_MEM_CONT */
280 290
281#endif /* _LINUX_MEMCONTROL_H */ 291#endif /* _LINUX_MEMCONTROL_H */
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index d95f72e79b82..fed969281a41 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -191,14 +191,6 @@ static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
191 191
192#endif /* ! CONFIG_MEMORY_HOTPLUG */ 192#endif /* ! CONFIG_MEMORY_HOTPLUG */
193 193
194/*
195 * Walk through all memory which is registered as resource.
196 * arg is (start_pfn, nr_pages, private_arg_pointer)
197 */
198extern int walk_memory_resource(unsigned long start_pfn,
199 unsigned long nr_pages, void *arg,
200 int (*func)(unsigned long, unsigned long, void *));
201
202#ifdef CONFIG_MEMORY_HOTREMOVE 194#ifdef CONFIG_MEMORY_HOTREMOVE
203 195
204extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); 196extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
diff --git a/include/linux/mempool.h b/include/linux/mempool.h
index 9be484d11283..7c08052e3321 100644
--- a/include/linux/mempool.h
+++ b/include/linux/mempool.h
@@ -47,22 +47,16 @@ mempool_create_slab_pool(int min_nr, struct kmem_cache *kc)
47} 47}
48 48
49/* 49/*
50 * 2 mempool_alloc_t's and a mempool_free_t to kmalloc/kzalloc and kfree 50 * a mempool_alloc_t and a mempool_free_t to kmalloc and kfree the
51 * the amount of memory specified by pool_data 51 * amount of memory specified by pool_data
52 */ 52 */
53void *mempool_kmalloc(gfp_t gfp_mask, void *pool_data); 53void *mempool_kmalloc(gfp_t gfp_mask, void *pool_data);
54void *mempool_kzalloc(gfp_t gfp_mask, void *pool_data);
55void mempool_kfree(void *element, void *pool_data); 54void mempool_kfree(void *element, void *pool_data);
56static inline mempool_t *mempool_create_kmalloc_pool(int min_nr, size_t size) 55static inline mempool_t *mempool_create_kmalloc_pool(int min_nr, size_t size)
57{ 56{
58 return mempool_create(min_nr, mempool_kmalloc, mempool_kfree, 57 return mempool_create(min_nr, mempool_kmalloc, mempool_kfree,
59 (void *) size); 58 (void *) size);
60} 59}
61static inline mempool_t *mempool_create_kzalloc_pool(int min_nr, size_t size)
62{
63 return mempool_create(min_nr, mempool_kzalloc, mempool_kfree,
64 (void *) size);
65}
66 60
67/* 61/*
68 * A mempool_alloc_t and mempool_free_t for a simple page allocator that 62 * A mempool_alloc_t and mempool_free_t for a simple page allocator that
diff --git a/include/linux/mfd/ab3100.h b/include/linux/mfd/ab3100.h
index 7a3f316e3848..e9aa4c9d749d 100644
--- a/include/linux/mfd/ab3100.h
+++ b/include/linux/mfd/ab3100.h
@@ -6,6 +6,8 @@
6 */ 6 */
7 7
8#include <linux/device.h> 8#include <linux/device.h>
9#include <linux/workqueue.h>
10#include <linux/regulator/machine.h>
9 11
10#ifndef MFD_AB3100_H 12#ifndef MFD_AB3100_H
11#define MFD_AB3100_H 13#define MFD_AB3100_H
@@ -56,6 +58,14 @@
56#define AB3100_STR_BATT_REMOVAL (0x40) 58#define AB3100_STR_BATT_REMOVAL (0x40)
57#define AB3100_STR_VBUS (0x80) 59#define AB3100_STR_VBUS (0x80)
58 60
61/*
62 * AB3100 contains 8 regulators, one external regulator controller
63 * and a buck converter, further the LDO E and buck converter can
64 * have separate settings if they are in sleep mode, this is
65 * modeled as a separate regulator.
66 */
67#define AB3100_NUM_REGULATORS 10
68
59/** 69/**
60 * struct ab3100 70 * struct ab3100
61 * @access_mutex: lock out concurrent accesses to the AB3100 registers 71 * @access_mutex: lock out concurrent accesses to the AB3100 registers
@@ -86,11 +96,30 @@ struct ab3100 {
86 bool startup_events_read; 96 bool startup_events_read;
87}; 97};
88 98
89int ab3100_set_register(struct ab3100 *ab3100, u8 reg, u8 regval); 99/**
90int ab3100_get_register(struct ab3100 *ab3100, u8 reg, u8 *regval); 100 * struct ab3100_platform_data
91int ab3100_get_register_page(struct ab3100 *ab3100, 101 * Data supplied to initialize board connections to the AB3100
102 * @reg_constraints: regulator constraints for target board
103 * the order of these constraints are: LDO A, C, D, E,
104 * F, G, H, K, EXT and BUCK.
105 * @reg_initvals: initial values for the regulator registers
106 * plus two sleep settings for LDO E and the BUCK converter.
107 * exactly AB3100_NUM_REGULATORS+2 values must be sent in.
108 * Order: LDO A, C, E, E sleep, F, G, H, K, EXT, BUCK,
109 * BUCK sleep, LDO D. (LDO D need to be initialized last.)
110 * @external_voltage: voltage level of the external regulator.
111 */
112struct ab3100_platform_data {
113 struct regulator_init_data reg_constraints[AB3100_NUM_REGULATORS];
114 u8 reg_initvals[AB3100_NUM_REGULATORS+2];
115 int external_voltage;
116};
117
118int ab3100_set_register_interruptible(struct ab3100 *ab3100, u8 reg, u8 regval);
119int ab3100_get_register_interruptible(struct ab3100 *ab3100, u8 reg, u8 *regval);
120int ab3100_get_register_page_interruptible(struct ab3100 *ab3100,
92 u8 first_reg, u8 *regvals, u8 numregs); 121 u8 first_reg, u8 *regvals, u8 numregs);
93int ab3100_mask_and_set_register(struct ab3100 *ab3100, 122int ab3100_mask_and_set_register_interruptible(struct ab3100 *ab3100,
94 u8 reg, u8 andmask, u8 ormask); 123 u8 reg, u8 andmask, u8 ormask);
95u8 ab3100_get_chip_type(struct ab3100 *ab3100); 124u8 ab3100_get_chip_type(struct ab3100 *ab3100);
96int ab3100_event_register(struct ab3100 *ab3100, 125int ab3100_event_register(struct ab3100 *ab3100,
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 49ef857cdb2d..11d740b8831d 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -23,6 +23,7 @@
23 */ 23 */
24struct mfd_cell { 24struct mfd_cell {
25 const char *name; 25 const char *name;
26 int id;
26 27
27 int (*enable)(struct platform_device *dev); 28 int (*enable)(struct platform_device *dev);
28 int (*disable)(struct platform_device *dev); 29 int (*disable)(struct platform_device *dev);
diff --git a/include/linux/mfd/da903x.h b/include/linux/mfd/da903x.h
index 115dbe965082..c63b65c94429 100644
--- a/include/linux/mfd/da903x.h
+++ b/include/linux/mfd/da903x.h
@@ -1,7 +1,7 @@
1#ifndef __LINUX_PMIC_DA903X_H 1#ifndef __LINUX_PMIC_DA903X_H
2#define __LINUX_PMIC_DA903X_H 2#define __LINUX_PMIC_DA903X_H
3 3
4/* Unified sub device IDs for DA9030/DA9034 */ 4/* Unified sub device IDs for DA9030/DA9034/DA9035 */
5enum { 5enum {
6 DA9030_ID_LED_1, 6 DA9030_ID_LED_1,
7 DA9030_ID_LED_2, 7 DA9030_ID_LED_2,
@@ -57,6 +57,8 @@ enum {
57 DA9034_ID_LDO13, 57 DA9034_ID_LDO13,
58 DA9034_ID_LDO14, 58 DA9034_ID_LDO14,
59 DA9034_ID_LDO15, 59 DA9034_ID_LDO15,
60
61 DA9035_ID_BUCK3,
60}; 62};
61 63
62/* 64/*
diff --git a/include/linux/mfd/ezx-pcap.h b/include/linux/mfd/ezx-pcap.h
index c12c3c0932bf..e5124ceea769 100644
--- a/include/linux/mfd/ezx-pcap.h
+++ b/include/linux/mfd/ezx-pcap.h
@@ -25,9 +25,12 @@ struct pcap_chip;
25 25
26int ezx_pcap_write(struct pcap_chip *, u8, u32); 26int ezx_pcap_write(struct pcap_chip *, u8, u32);
27int ezx_pcap_read(struct pcap_chip *, u8, u32 *); 27int ezx_pcap_read(struct pcap_chip *, u8, u32 *);
28int ezx_pcap_set_bits(struct pcap_chip *, u8, u32, u32);
28int pcap_to_irq(struct pcap_chip *, int); 29int pcap_to_irq(struct pcap_chip *, int);
30int irq_to_pcap(struct pcap_chip *, int);
29int pcap_adc_async(struct pcap_chip *, u8, u32, u8[], void *, void *); 31int pcap_adc_async(struct pcap_chip *, u8, u32, u8[], void *, void *);
30int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]); 32int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]);
33void pcap_set_ts_bits(struct pcap_chip *, u32);
31 34
32#define PCAP_SECOND_PORT 1 35#define PCAP_SECOND_PORT 1
33#define PCAP_CS_AH 2 36#define PCAP_CS_AH 2
@@ -224,7 +227,6 @@ int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]);
224#define PCAP_LED1 1 227#define PCAP_LED1 1
225#define PCAP_BL0 2 228#define PCAP_BL0 2
226#define PCAP_BL1 3 229#define PCAP_BL1 3
227#define PCAP_VIB 4
228#define PCAP_LED_3MA 0 230#define PCAP_LED_3MA 0
229#define PCAP_LED_4MA 1 231#define PCAP_LED_4MA 1
230#define PCAP_LED_5MA 2 232#define PCAP_LED_5MA 2
@@ -243,9 +245,6 @@ int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]);
243#define PCAP_LED0_C_SHIFT 15 245#define PCAP_LED0_C_SHIFT 15
244#define PCAP_LED1_C_SHIFT 17 246#define PCAP_LED1_C_SHIFT 17
245#define PCAP_BL1_SHIFT 20 247#define PCAP_BL1_SHIFT 20
246#define PCAP_VIB_MASK 0x3
247#define PCAP_VIB_SHIFT 20
248#define PCAP_VIB_EN (1 << 19)
249 248
250/* RTC */ 249/* RTC */
251#define PCAP_RTC_DAY_MASK 0x3fff 250#define PCAP_RTC_DAY_MASK 0x3fff
diff --git a/include/linux/mfd/mc13783-private.h b/include/linux/mfd/mc13783-private.h
new file mode 100644
index 000000000000..47e698cb0f16
--- /dev/null
+++ b/include/linux/mfd/mc13783-private.h
@@ -0,0 +1,396 @@
1/*
2 * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
3 *
4 * Initial development of this code was funded by
5 * Phytec Messtechnik GmbH, http://www.phytec.de
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#ifndef __LINUX_MFD_MC13783_PRIV_H
23#define __LINUX_MFD_MC13783_PRIV_H
24
25#include <linux/platform_device.h>
26#include <linux/mfd/mc13783.h>
27#include <linux/workqueue.h>
28#include <linux/mutex.h>
29
30struct mc13783_irq {
31 void (*handler)(int, void *);
32 void *data;
33};
34
35#define MC13783_NUM_IRQ 2
36#define MC13783_IRQ_TS 0
37#define MC13783_IRQ_REGULATOR 1
38
39#define MC13783_ADC_MODE_TS 1
40#define MC13783_ADC_MODE_SINGLE_CHAN 2
41#define MC13783_ADC_MODE_MULT_CHAN 3
42
43struct mc13783 {
44 int revision;
45 struct device *dev;
46 struct spi_device *spi_device;
47
48 int (*read_dev)(void *data, char reg, int count, u32 *dst);
49 int (*write_dev)(void *data, char reg, int count, const u32 *src);
50
51 struct mutex io_lock;
52 void *io_data;
53 int irq;
54 unsigned int flags;
55
56 struct mc13783_irq irq_handler[MC13783_NUM_IRQ];
57 struct work_struct work;
58 struct completion adc_done;
59 unsigned int ts_active;
60 struct mutex adc_conv_lock;
61
62 struct mc13783_regulator_init_data *regulators;
63 int num_regulators;
64};
65
66int mc13783_reg_read(struct mc13783 *, int reg_num, u32 *);
67int mc13783_reg_write(struct mc13783 *, int, u32);
68int mc13783_set_bits(struct mc13783 *, int, u32, u32);
69int mc13783_free_irq(struct mc13783 *mc13783, int irq);
70int mc13783_register_irq(struct mc13783 *mc13783, int irq,
71 void (*handler) (int, void *), void *data);
72
73#define MC13783_REG_INTERRUPT_STATUS_0 0
74#define MC13783_REG_INTERRUPT_MASK_0 1
75#define MC13783_REG_INTERRUPT_SENSE_0 2
76#define MC13783_REG_INTERRUPT_STATUS_1 3
77#define MC13783_REG_INTERRUPT_MASK_1 4
78#define MC13783_REG_INTERRUPT_SENSE_1 5
79#define MC13783_REG_POWER_UP_MODE_SENSE 6
80#define MC13783_REG_REVISION 7
81#define MC13783_REG_SEMAPHORE 8
82#define MC13783_REG_ARBITRATION_PERIPHERAL_AUDIO 9
83#define MC13783_REG_ARBITRATION_SWITCHERS 10
84#define MC13783_REG_ARBITRATION_REGULATORS_0 11
85#define MC13783_REG_ARBITRATION_REGULATORS_1 12
86#define MC13783_REG_POWER_CONTROL_0 13
87#define MC13783_REG_POWER_CONTROL_1 14
88#define MC13783_REG_POWER_CONTROL_2 15
89#define MC13783_REG_REGEN_ASSIGNMENT 16
90#define MC13783_REG_CONTROL_SPARE 17
91#define MC13783_REG_MEMORY_A 18
92#define MC13783_REG_MEMORY_B 19
93#define MC13783_REG_RTC_TIME 20
94#define MC13783_REG_RTC_ALARM 21
95#define MC13783_REG_RTC_DAY 22
96#define MC13783_REG_RTC_DAY_ALARM 23
97#define MC13783_REG_SWITCHERS_0 24
98#define MC13783_REG_SWITCHERS_1 25
99#define MC13783_REG_SWITCHERS_2 26
100#define MC13783_REG_SWITCHERS_3 27
101#define MC13783_REG_SWITCHERS_4 28
102#define MC13783_REG_SWITCHERS_5 29
103#define MC13783_REG_REGULATOR_SETTING_0 30
104#define MC13783_REG_REGULATOR_SETTING_1 31
105#define MC13783_REG_REGULATOR_MODE_0 32
106#define MC13783_REG_REGULATOR_MODE_1 33
107#define MC13783_REG_POWER_MISCELLANEOUS 34
108#define MC13783_REG_POWER_SPARE 35
109#define MC13783_REG_AUDIO_RX_0 36
110#define MC13783_REG_AUDIO_RX_1 37
111#define MC13783_REG_AUDIO_TX 38
112#define MC13783_REG_AUDIO_SSI_NETWORK 39
113#define MC13783_REG_AUDIO_CODEC 40
114#define MC13783_REG_AUDIO_STEREO_DAC 41
115#define MC13783_REG_AUDIO_SPARE 42
116#define MC13783_REG_ADC_0 43
117#define MC13783_REG_ADC_1 44
118#define MC13783_REG_ADC_2 45
119#define MC13783_REG_ADC_3 46
120#define MC13783_REG_ADC_4 47
121#define MC13783_REG_CHARGER 48
122#define MC13783_REG_USB 49
123#define MC13783_REG_CHARGE_USB_SPARE 50
124#define MC13783_REG_LED_CONTROL_0 51
125#define MC13783_REG_LED_CONTROL_1 52
126#define MC13783_REG_LED_CONTROL_2 53
127#define MC13783_REG_LED_CONTROL_3 54
128#define MC13783_REG_LED_CONTROL_4 55
129#define MC13783_REG_LED_CONTROL_5 56
130#define MC13783_REG_SPARE 57
131#define MC13783_REG_TRIM_0 58
132#define MC13783_REG_TRIM_1 59
133#define MC13783_REG_TEST_0 60
134#define MC13783_REG_TEST_1 61
135#define MC13783_REG_TEST_2 62
136#define MC13783_REG_TEST_3 63
137#define MC13783_REG_NB 64
138
139
140/*
141 * Interrupt Status
142 */
143#define MC13783_INT_STAT_ADCDONEI (1 << 0)
144#define MC13783_INT_STAT_ADCBISDONEI (1 << 1)
145#define MC13783_INT_STAT_TSI (1 << 2)
146#define MC13783_INT_STAT_WHIGHI (1 << 3)
147#define MC13783_INT_STAT_WLOWI (1 << 4)
148#define MC13783_INT_STAT_CHGDETI (1 << 6)
149#define MC13783_INT_STAT_CHGOVI (1 << 7)
150#define MC13783_INT_STAT_CHGREVI (1 << 8)
151#define MC13783_INT_STAT_CHGSHORTI (1 << 9)
152#define MC13783_INT_STAT_CCCVI (1 << 10)
153#define MC13783_INT_STAT_CHGCURRI (1 << 11)
154#define MC13783_INT_STAT_BPONI (1 << 12)
155#define MC13783_INT_STAT_LOBATLI (1 << 13)
156#define MC13783_INT_STAT_LOBATHI (1 << 14)
157#define MC13783_INT_STAT_UDPI (1 << 15)
158#define MC13783_INT_STAT_USBI (1 << 16)
159#define MC13783_INT_STAT_IDI (1 << 19)
160#define MC13783_INT_STAT_Unused (1 << 20)
161#define MC13783_INT_STAT_SE1I (1 << 21)
162#define MC13783_INT_STAT_CKDETI (1 << 22)
163#define MC13783_INT_STAT_UDMI (1 << 23)
164
165/*
166 * Interrupt Mask
167 */
168#define MC13783_INT_MASK_ADCDONEM (1 << 0)
169#define MC13783_INT_MASK_ADCBISDONEM (1 << 1)
170#define MC13783_INT_MASK_TSM (1 << 2)
171#define MC13783_INT_MASK_WHIGHM (1 << 3)
172#define MC13783_INT_MASK_WLOWM (1 << 4)
173#define MC13783_INT_MASK_CHGDETM (1 << 6)
174#define MC13783_INT_MASK_CHGOVM (1 << 7)
175#define MC13783_INT_MASK_CHGREVM (1 << 8)
176#define MC13783_INT_MASK_CHGSHORTM (1 << 9)
177#define MC13783_INT_MASK_CCCVM (1 << 10)
178#define MC13783_INT_MASK_CHGCURRM (1 << 11)
179#define MC13783_INT_MASK_BPONM (1 << 12)
180#define MC13783_INT_MASK_LOBATLM (1 << 13)
181#define MC13783_INT_MASK_LOBATHM (1 << 14)
182#define MC13783_INT_MASK_UDPM (1 << 15)
183#define MC13783_INT_MASK_USBM (1 << 16)
184#define MC13783_INT_MASK_IDM (1 << 19)
185#define MC13783_INT_MASK_SE1M (1 << 21)
186#define MC13783_INT_MASK_CKDETM (1 << 22)
187
188/*
189 * Reg Regulator Mode 0
190 */
191#define MC13783_REGCTRL_VAUDIO_EN (1 << 0)
192#define MC13783_REGCTRL_VAUDIO_STBY (1 << 1)
193#define MC13783_REGCTRL_VAUDIO_MODE (1 << 2)
194#define MC13783_REGCTRL_VIOHI_EN (1 << 3)
195#define MC13783_REGCTRL_VIOHI_STBY (1 << 4)
196#define MC13783_REGCTRL_VIOHI_MODE (1 << 5)
197#define MC13783_REGCTRL_VIOLO_EN (1 << 6)
198#define MC13783_REGCTRL_VIOLO_STBY (1 << 7)
199#define MC13783_REGCTRL_VIOLO_MODE (1 << 8)
200#define MC13783_REGCTRL_VDIG_EN (1 << 9)
201#define MC13783_REGCTRL_VDIG_STBY (1 << 10)
202#define MC13783_REGCTRL_VDIG_MODE (1 << 11)
203#define MC13783_REGCTRL_VGEN_EN (1 << 12)
204#define MC13783_REGCTRL_VGEN_STBY (1 << 13)
205#define MC13783_REGCTRL_VGEN_MODE (1 << 14)
206#define MC13783_REGCTRL_VRFDIG_EN (1 << 15)
207#define MC13783_REGCTRL_VRFDIG_STBY (1 << 16)
208#define MC13783_REGCTRL_VRFDIG_MODE (1 << 17)
209#define MC13783_REGCTRL_VRFREF_EN (1 << 18)
210#define MC13783_REGCTRL_VRFREF_STBY (1 << 19)
211#define MC13783_REGCTRL_VRFREF_MODE (1 << 20)
212#define MC13783_REGCTRL_VRFCP_EN (1 << 21)
213#define MC13783_REGCTRL_VRFCP_STBY (1 << 22)
214#define MC13783_REGCTRL_VRFCP_MODE (1 << 23)
215
216/*
217 * Reg Regulator Mode 1
218 */
219#define MC13783_REGCTRL_VSIM_EN (1 << 0)
220#define MC13783_REGCTRL_VSIM_STBY (1 << 1)
221#define MC13783_REGCTRL_VSIM_MODE (1 << 2)
222#define MC13783_REGCTRL_VESIM_EN (1 << 3)
223#define MC13783_REGCTRL_VESIM_STBY (1 << 4)
224#define MC13783_REGCTRL_VESIM_MODE (1 << 5)
225#define MC13783_REGCTRL_VCAM_EN (1 << 6)
226#define MC13783_REGCTRL_VCAM_STBY (1 << 7)
227#define MC13783_REGCTRL_VCAM_MODE (1 << 8)
228#define MC13783_REGCTRL_VRFBG_EN (1 << 9)
229#define MC13783_REGCTRL_VRFBG_STBY (1 << 10)
230#define MC13783_REGCTRL_VVIB_EN (1 << 11)
231#define MC13783_REGCTRL_VRF1_EN (1 << 12)
232#define MC13783_REGCTRL_VRF1_STBY (1 << 13)
233#define MC13783_REGCTRL_VRF1_MODE (1 << 14)
234#define MC13783_REGCTRL_VRF2_EN (1 << 15)
235#define MC13783_REGCTRL_VRF2_STBY (1 << 16)
236#define MC13783_REGCTRL_VRF2_MODE (1 << 17)
237#define MC13783_REGCTRL_VMMC1_EN (1 << 18)
238#define MC13783_REGCTRL_VMMC1_STBY (1 << 19)
239#define MC13783_REGCTRL_VMMC1_MODE (1 << 20)
240#define MC13783_REGCTRL_VMMC2_EN (1 << 21)
241#define MC13783_REGCTRL_VMMC2_STBY (1 << 22)
242#define MC13783_REGCTRL_VMMC2_MODE (1 << 23)
243
244/*
245 * Reg Regulator Misc.
246 */
247#define MC13783_REGCTRL_GPO1_EN (1 << 6)
248#define MC13783_REGCTRL_GPO2_EN (1 << 8)
249#define MC13783_REGCTRL_GPO3_EN (1 << 10)
250#define MC13783_REGCTRL_GPO4_EN (1 << 12)
251#define MC13783_REGCTRL_VIBPINCTRL (1 << 14)
252
253/*
254 * Reg Switcher 4
255 */
256#define MC13783_SWCTRL_SW1A_MODE (1 << 0)
257#define MC13783_SWCTRL_SW1A_STBY_MODE (1 << 2)
258#define MC13783_SWCTRL_SW1A_DVS_SPEED (1 << 6)
259#define MC13783_SWCTRL_SW1A_PANIC_MODE (1 << 8)
260#define MC13783_SWCTRL_SW1A_SOFTSTART (1 << 9)
261#define MC13783_SWCTRL_SW1B_MODE (1 << 10)
262#define MC13783_SWCTRL_SW1B_STBY_MODE (1 << 12)
263#define MC13783_SWCTRL_SW1B_DVS_SPEED (1 << 14)
264#define MC13783_SWCTRL_SW1B_PANIC_MODE (1 << 16)
265#define MC13783_SWCTRL_SW1B_SOFTSTART (1 << 17)
266#define MC13783_SWCTRL_PLL_EN (1 << 18)
267#define MC13783_SWCTRL_PLL_FACTOR (1 << 19)
268
269/*
270 * Reg Switcher 5
271 */
272#define MC13783_SWCTRL_SW2A_MODE (1 << 0)
273#define MC13783_SWCTRL_SW2A_STBY_MODE (1 << 2)
274#define MC13783_SWCTRL_SW2A_DVS_SPEED (1 << 6)
275#define MC13783_SWCTRL_SW2A_PANIC_MODE (1 << 8)
276#define MC13783_SWCTRL_SW2A_SOFTSTART (1 << 9)
277#define MC13783_SWCTRL_SW2B_MODE (1 << 10)
278#define MC13783_SWCTRL_SW2B_STBY_MODE (1 << 12)
279#define MC13783_SWCTRL_SW2B_DVS_SPEED (1 << 14)
280#define MC13783_SWCTRL_SW2B_PANIC_MODE (1 << 16)
281#define MC13783_SWCTRL_SW2B_SOFTSTART (1 << 17)
282#define MC13783_SWSET_SW3 (1 << 18)
283#define MC13783_SWCTRL_SW3_EN (1 << 20)
284#define MC13783_SWCTRL_SW3_STBY (1 << 21)
285#define MC13783_SWCTRL_SW3_MODE (1 << 22)
286
287/*
288 * ADC/Touch
289 */
290#define MC13783_ADC0_LICELLCON (1 << 0)
291#define MC13783_ADC0_CHRGICON (1 << 1)
292#define MC13783_ADC0_BATICON (1 << 2)
293#define MC13783_ADC0_RTHEN (1 << 3)
294#define MC13783_ADC0_DTHEN (1 << 4)
295#define MC13783_ADC0_UIDEN (1 << 5)
296#define MC13783_ADC0_ADOUTEN (1 << 6)
297#define MC13783_ADC0_ADOUTPER (1 << 7)
298#define MC13783_ADC0_ADREFEN (1 << 10)
299#define MC13783_ADC0_ADREFMODE (1 << 11)
300#define MC13783_ADC0_TSMOD0 (1 << 12)
301#define MC13783_ADC0_TSMOD1 (1 << 13)
302#define MC13783_ADC0_TSMOD2 (1 << 14)
303#define MC13783_ADC0_CHRGRAWDIV (1 << 15)
304#define MC13783_ADC0_ADINC1 (1 << 16)
305#define MC13783_ADC0_ADINC2 (1 << 17)
306#define MC13783_ADC0_WCOMP (1 << 18)
307#define MC13783_ADC0_ADCBIS0 (1 << 23)
308
309#define MC13783_ADC1_ADEN (1 << 0)
310#define MC13783_ADC1_RAND (1 << 1)
311#define MC13783_ADC1_ADSEL (1 << 3)
312#define MC13783_ADC1_TRIGMASK (1 << 4)
313#define MC13783_ADC1_ADA10 (1 << 5)
314#define MC13783_ADC1_ADA11 (1 << 6)
315#define MC13783_ADC1_ADA12 (1 << 7)
316#define MC13783_ADC1_ADA20 (1 << 8)
317#define MC13783_ADC1_ADA21 (1 << 9)
318#define MC13783_ADC1_ADA22 (1 << 10)
319#define MC13783_ADC1_ATO0 (1 << 11)
320#define MC13783_ADC1_ATO1 (1 << 12)
321#define MC13783_ADC1_ATO2 (1 << 13)
322#define MC13783_ADC1_ATO3 (1 << 14)
323#define MC13783_ADC1_ATO4 (1 << 15)
324#define MC13783_ADC1_ATO5 (1 << 16)
325#define MC13783_ADC1_ATO6 (1 << 17)
326#define MC13783_ADC1_ATO7 (1 << 18)
327#define MC13783_ADC1_ATOX (1 << 19)
328#define MC13783_ADC1_ASC (1 << 20)
329#define MC13783_ADC1_ADTRIGIGN (1 << 21)
330#define MC13783_ADC1_ADONESHOT (1 << 22)
331#define MC13783_ADC1_ADCBIS1 (1 << 23)
332
333#define MC13783_ADC1_CHAN0_SHIFT 5
334#define MC13783_ADC1_CHAN1_SHIFT 8
335
336#define MC13783_ADC2_ADD10 (1 << 2)
337#define MC13783_ADC2_ADD11 (1 << 3)
338#define MC13783_ADC2_ADD12 (1 << 4)
339#define MC13783_ADC2_ADD13 (1 << 5)
340#define MC13783_ADC2_ADD14 (1 << 6)
341#define MC13783_ADC2_ADD15 (1 << 7)
342#define MC13783_ADC2_ADD16 (1 << 8)
343#define MC13783_ADC2_ADD17 (1 << 9)
344#define MC13783_ADC2_ADD18 (1 << 10)
345#define MC13783_ADC2_ADD19 (1 << 11)
346#define MC13783_ADC2_ADD20 (1 << 14)
347#define MC13783_ADC2_ADD21 (1 << 15)
348#define MC13783_ADC2_ADD22 (1 << 16)
349#define MC13783_ADC2_ADD23 (1 << 17)
350#define MC13783_ADC2_ADD24 (1 << 18)
351#define MC13783_ADC2_ADD25 (1 << 19)
352#define MC13783_ADC2_ADD26 (1 << 20)
353#define MC13783_ADC2_ADD27 (1 << 21)
354#define MC13783_ADC2_ADD28 (1 << 22)
355#define MC13783_ADC2_ADD29 (1 << 23)
356
357#define MC13783_ADC3_WHIGH0 (1 << 0)
358#define MC13783_ADC3_WHIGH1 (1 << 1)
359#define MC13783_ADC3_WHIGH2 (1 << 2)
360#define MC13783_ADC3_WHIGH3 (1 << 3)
361#define MC13783_ADC3_WHIGH4 (1 << 4)
362#define MC13783_ADC3_WHIGH5 (1 << 5)
363#define MC13783_ADC3_ICID0 (1 << 6)
364#define MC13783_ADC3_ICID1 (1 << 7)
365#define MC13783_ADC3_ICID2 (1 << 8)
366#define MC13783_ADC3_WLOW0 (1 << 9)
367#define MC13783_ADC3_WLOW1 (1 << 10)
368#define MC13783_ADC3_WLOW2 (1 << 11)
369#define MC13783_ADC3_WLOW3 (1 << 12)
370#define MC13783_ADC3_WLOW4 (1 << 13)
371#define MC13783_ADC3_WLOW5 (1 << 14)
372#define MC13783_ADC3_ADCBIS2 (1 << 23)
373
374#define MC13783_ADC4_ADDBIS10 (1 << 2)
375#define MC13783_ADC4_ADDBIS11 (1 << 3)
376#define MC13783_ADC4_ADDBIS12 (1 << 4)
377#define MC13783_ADC4_ADDBIS13 (1 << 5)
378#define MC13783_ADC4_ADDBIS14 (1 << 6)
379#define MC13783_ADC4_ADDBIS15 (1 << 7)
380#define MC13783_ADC4_ADDBIS16 (1 << 8)
381#define MC13783_ADC4_ADDBIS17 (1 << 9)
382#define MC13783_ADC4_ADDBIS18 (1 << 10)
383#define MC13783_ADC4_ADDBIS19 (1 << 11)
384#define MC13783_ADC4_ADDBIS20 (1 << 14)
385#define MC13783_ADC4_ADDBIS21 (1 << 15)
386#define MC13783_ADC4_ADDBIS22 (1 << 16)
387#define MC13783_ADC4_ADDBIS23 (1 << 17)
388#define MC13783_ADC4_ADDBIS24 (1 << 18)
389#define MC13783_ADC4_ADDBIS25 (1 << 19)
390#define MC13783_ADC4_ADDBIS26 (1 << 20)
391#define MC13783_ADC4_ADDBIS27 (1 << 21)
392#define MC13783_ADC4_ADDBIS28 (1 << 22)
393#define MC13783_ADC4_ADDBIS29 (1 << 23)
394
395#endif /* __LINUX_MFD_MC13783_PRIV_H */
396
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
new file mode 100644
index 000000000000..b3a2a7243573
--- /dev/null
+++ b/include/linux/mfd/mc13783.h
@@ -0,0 +1,84 @@
1/*
2 * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
3 *
4 * Initial development of this code was funded by
5 * Phytec Messtechnik GmbH, http://www.phytec.de
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#ifndef __INCLUDE_LINUX_MFD_MC13783_H
23#define __INCLUDE_LINUX_MFD_MC13783_H
24
25struct mc13783;
26struct regulator_init_data;
27
28struct mc13783_regulator_init_data {
29 int id;
30 struct regulator_init_data *init_data;
31};
32
33struct mc13783_platform_data {
34 struct mc13783_regulator_init_data *regulators;
35 int num_regulators;
36 unsigned int flags;
37};
38
39/* mc13783_platform_data flags */
40#define MC13783_USE_TOUCHSCREEN (1 << 0)
41#define MC13783_USE_CODEC (1 << 1)
42#define MC13783_USE_ADC (1 << 2)
43#define MC13783_USE_RTC (1 << 3)
44#define MC13783_USE_REGULATOR (1 << 4)
45
46int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
47 unsigned int channel, unsigned int *sample);
48
49void mc13783_adc_set_ts_status(struct mc13783 *mc13783, unsigned int status);
50
51#define MC13783_SW_SW1A 0
52#define MC13783_SW_SW1B 1
53#define MC13783_SW_SW2A 2
54#define MC13783_SW_SW2B 3
55#define MC13783_SW_SW3 4
56#define MC13783_SW_PLL 5
57#define MC13783_REGU_VAUDIO 6
58#define MC13783_REGU_VIOHI 7
59#define MC13783_REGU_VIOLO 8
60#define MC13783_REGU_VDIG 9
61#define MC13783_REGU_VGEN 10
62#define MC13783_REGU_VRFDIG 11
63#define MC13783_REGU_VRFREF 12
64#define MC13783_REGU_VRFCP 13
65#define MC13783_REGU_VSIM 14
66#define MC13783_REGU_VESIM 15
67#define MC13783_REGU_VCAM 16
68#define MC13783_REGU_VRFBG 17
69#define MC13783_REGU_VVIB 18
70#define MC13783_REGU_VRF1 19
71#define MC13783_REGU_VRF2 20
72#define MC13783_REGU_VMMC1 21
73#define MC13783_REGU_VMMC2 22
74#define MC13783_REGU_GPO1 23
75#define MC13783_REGU_GPO2 24
76#define MC13783_REGU_GPO3 25
77#define MC13783_REGU_GPO4 26
78#define MC13783_REGU_V1 27
79#define MC13783_REGU_V2 28
80#define MC13783_REGU_V3 29
81#define MC13783_REGU_V4 30
82
83#endif /* __INCLUDE_LINUX_MFD_MC13783_H */
84
diff --git a/include/linux/mfd/pcf50633/adc.h b/include/linux/mfd/pcf50633/adc.h
index 56669b4183ad..b35e62801ffa 100644
--- a/include/linux/mfd/pcf50633/adc.h
+++ b/include/linux/mfd/pcf50633/adc.h
@@ -25,7 +25,8 @@
25#define PCF50633_REG_ADCS3 0x57 25#define PCF50633_REG_ADCS3 0x57
26 26
27#define PCF50633_ADCC1_ADCSTART 0x01 27#define PCF50633_ADCC1_ADCSTART 0x01
28#define PCF50633_ADCC1_RES_10BIT 0x02 28#define PCF50633_ADCC1_RES_8BIT 0x02
29#define PCF50633_ADCC1_RES_10BIT 0x00
29#define PCF50633_ADCC1_AVERAGE_NO 0x00 30#define PCF50633_ADCC1_AVERAGE_NO 0x00
30#define PCF50633_ADCC1_AVERAGE_4 0x04 31#define PCF50633_ADCC1_AVERAGE_4 0x04
31#define PCF50633_ADCC1_AVERAGE_8 0x08 32#define PCF50633_ADCC1_AVERAGE_8 0x08
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index c8f51c3c0a72..9aba7b779fbc 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -136,6 +136,7 @@ struct pcf50633 {
136 int irq; 136 int irq;
137 struct pcf50633_irq irq_handler[PCF50633_NUM_IRQ]; 137 struct pcf50633_irq irq_handler[PCF50633_NUM_IRQ];
138 struct work_struct irq_work; 138 struct work_struct irq_work;
139 struct workqueue_struct *work_queue;
139 struct mutex lock; 140 struct mutex lock;
140 141
141 u8 mask_regs[5]; 142 u8 mask_regs[5];
diff --git a/include/linux/mfd/wm831x/auxadc.h b/include/linux/mfd/wm831x/auxadc.h
new file mode 100644
index 000000000000..b132067e9e99
--- /dev/null
+++ b/include/linux/mfd/wm831x/auxadc.h
@@ -0,0 +1,216 @@
1/*
2 * include/linux/mfd/wm831x/auxadc.h -- Auxiliary ADC interface for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_AUXADC_H__
16#define __MFD_WM831X_AUXADC_H__
17
18/*
19 * R16429 (0x402D) - AuxADC Data
20 */
21#define WM831X_AUX_DATA_SRC_MASK 0xF000 /* AUX_DATA_SRC - [15:12] */
22#define WM831X_AUX_DATA_SRC_SHIFT 12 /* AUX_DATA_SRC - [15:12] */
23#define WM831X_AUX_DATA_SRC_WIDTH 4 /* AUX_DATA_SRC - [15:12] */
24#define WM831X_AUX_DATA_MASK 0x0FFF /* AUX_DATA - [11:0] */
25#define WM831X_AUX_DATA_SHIFT 0 /* AUX_DATA - [11:0] */
26#define WM831X_AUX_DATA_WIDTH 12 /* AUX_DATA - [11:0] */
27
28/*
29 * R16430 (0x402E) - AuxADC Control
30 */
31#define WM831X_AUX_ENA 0x8000 /* AUX_ENA */
32#define WM831X_AUX_ENA_MASK 0x8000 /* AUX_ENA */
33#define WM831X_AUX_ENA_SHIFT 15 /* AUX_ENA */
34#define WM831X_AUX_ENA_WIDTH 1 /* AUX_ENA */
35#define WM831X_AUX_CVT_ENA 0x4000 /* AUX_CVT_ENA */
36#define WM831X_AUX_CVT_ENA_MASK 0x4000 /* AUX_CVT_ENA */
37#define WM831X_AUX_CVT_ENA_SHIFT 14 /* AUX_CVT_ENA */
38#define WM831X_AUX_CVT_ENA_WIDTH 1 /* AUX_CVT_ENA */
39#define WM831X_AUX_SLPENA 0x1000 /* AUX_SLPENA */
40#define WM831X_AUX_SLPENA_MASK 0x1000 /* AUX_SLPENA */
41#define WM831X_AUX_SLPENA_SHIFT 12 /* AUX_SLPENA */
42#define WM831X_AUX_SLPENA_WIDTH 1 /* AUX_SLPENA */
43#define WM831X_AUX_FRC_ENA 0x0800 /* AUX_FRC_ENA */
44#define WM831X_AUX_FRC_ENA_MASK 0x0800 /* AUX_FRC_ENA */
45#define WM831X_AUX_FRC_ENA_SHIFT 11 /* AUX_FRC_ENA */
46#define WM831X_AUX_FRC_ENA_WIDTH 1 /* AUX_FRC_ENA */
47#define WM831X_AUX_RATE_MASK 0x003F /* AUX_RATE - [5:0] */
48#define WM831X_AUX_RATE_SHIFT 0 /* AUX_RATE - [5:0] */
49#define WM831X_AUX_RATE_WIDTH 6 /* AUX_RATE - [5:0] */
50
51/*
52 * R16431 (0x402F) - AuxADC Source
53 */
54#define WM831X_AUX_CAL_SEL 0x8000 /* AUX_CAL_SEL */
55#define WM831X_AUX_CAL_SEL_MASK 0x8000 /* AUX_CAL_SEL */
56#define WM831X_AUX_CAL_SEL_SHIFT 15 /* AUX_CAL_SEL */
57#define WM831X_AUX_CAL_SEL_WIDTH 1 /* AUX_CAL_SEL */
58#define WM831X_AUX_BKUP_BATT_SEL 0x0400 /* AUX_BKUP_BATT_SEL */
59#define WM831X_AUX_BKUP_BATT_SEL_MASK 0x0400 /* AUX_BKUP_BATT_SEL */
60#define WM831X_AUX_BKUP_BATT_SEL_SHIFT 10 /* AUX_BKUP_BATT_SEL */
61#define WM831X_AUX_BKUP_BATT_SEL_WIDTH 1 /* AUX_BKUP_BATT_SEL */
62#define WM831X_AUX_WALL_SEL 0x0200 /* AUX_WALL_SEL */
63#define WM831X_AUX_WALL_SEL_MASK 0x0200 /* AUX_WALL_SEL */
64#define WM831X_AUX_WALL_SEL_SHIFT 9 /* AUX_WALL_SEL */
65#define WM831X_AUX_WALL_SEL_WIDTH 1 /* AUX_WALL_SEL */
66#define WM831X_AUX_BATT_SEL 0x0100 /* AUX_BATT_SEL */
67#define WM831X_AUX_BATT_SEL_MASK 0x0100 /* AUX_BATT_SEL */
68#define WM831X_AUX_BATT_SEL_SHIFT 8 /* AUX_BATT_SEL */
69#define WM831X_AUX_BATT_SEL_WIDTH 1 /* AUX_BATT_SEL */
70#define WM831X_AUX_USB_SEL 0x0080 /* AUX_USB_SEL */
71#define WM831X_AUX_USB_SEL_MASK 0x0080 /* AUX_USB_SEL */
72#define WM831X_AUX_USB_SEL_SHIFT 7 /* AUX_USB_SEL */
73#define WM831X_AUX_USB_SEL_WIDTH 1 /* AUX_USB_SEL */
74#define WM831X_AUX_SYSVDD_SEL 0x0040 /* AUX_SYSVDD_SEL */
75#define WM831X_AUX_SYSVDD_SEL_MASK 0x0040 /* AUX_SYSVDD_SEL */
76#define WM831X_AUX_SYSVDD_SEL_SHIFT 6 /* AUX_SYSVDD_SEL */
77#define WM831X_AUX_SYSVDD_SEL_WIDTH 1 /* AUX_SYSVDD_SEL */
78#define WM831X_AUX_BATT_TEMP_SEL 0x0020 /* AUX_BATT_TEMP_SEL */
79#define WM831X_AUX_BATT_TEMP_SEL_MASK 0x0020 /* AUX_BATT_TEMP_SEL */
80#define WM831X_AUX_BATT_TEMP_SEL_SHIFT 5 /* AUX_BATT_TEMP_SEL */
81#define WM831X_AUX_BATT_TEMP_SEL_WIDTH 1 /* AUX_BATT_TEMP_SEL */
82#define WM831X_AUX_CHIP_TEMP_SEL 0x0010 /* AUX_CHIP_TEMP_SEL */
83#define WM831X_AUX_CHIP_TEMP_SEL_MASK 0x0010 /* AUX_CHIP_TEMP_SEL */
84#define WM831X_AUX_CHIP_TEMP_SEL_SHIFT 4 /* AUX_CHIP_TEMP_SEL */
85#define WM831X_AUX_CHIP_TEMP_SEL_WIDTH 1 /* AUX_CHIP_TEMP_SEL */
86#define WM831X_AUX_AUX4_SEL 0x0008 /* AUX_AUX4_SEL */
87#define WM831X_AUX_AUX4_SEL_MASK 0x0008 /* AUX_AUX4_SEL */
88#define WM831X_AUX_AUX4_SEL_SHIFT 3 /* AUX_AUX4_SEL */
89#define WM831X_AUX_AUX4_SEL_WIDTH 1 /* AUX_AUX4_SEL */
90#define WM831X_AUX_AUX3_SEL 0x0004 /* AUX_AUX3_SEL */
91#define WM831X_AUX_AUX3_SEL_MASK 0x0004 /* AUX_AUX3_SEL */
92#define WM831X_AUX_AUX3_SEL_SHIFT 2 /* AUX_AUX3_SEL */
93#define WM831X_AUX_AUX3_SEL_WIDTH 1 /* AUX_AUX3_SEL */
94#define WM831X_AUX_AUX2_SEL 0x0002 /* AUX_AUX2_SEL */
95#define WM831X_AUX_AUX2_SEL_MASK 0x0002 /* AUX_AUX2_SEL */
96#define WM831X_AUX_AUX2_SEL_SHIFT 1 /* AUX_AUX2_SEL */
97#define WM831X_AUX_AUX2_SEL_WIDTH 1 /* AUX_AUX2_SEL */
98#define WM831X_AUX_AUX1_SEL 0x0001 /* AUX_AUX1_SEL */
99#define WM831X_AUX_AUX1_SEL_MASK 0x0001 /* AUX_AUX1_SEL */
100#define WM831X_AUX_AUX1_SEL_SHIFT 0 /* AUX_AUX1_SEL */
101#define WM831X_AUX_AUX1_SEL_WIDTH 1 /* AUX_AUX1_SEL */
102
103/*
104 * R16432 (0x4030) - Comparator Control
105 */
106#define WM831X_DCOMP4_STS 0x0800 /* DCOMP4_STS */
107#define WM831X_DCOMP4_STS_MASK 0x0800 /* DCOMP4_STS */
108#define WM831X_DCOMP4_STS_SHIFT 11 /* DCOMP4_STS */
109#define WM831X_DCOMP4_STS_WIDTH 1 /* DCOMP4_STS */
110#define WM831X_DCOMP3_STS 0x0400 /* DCOMP3_STS */
111#define WM831X_DCOMP3_STS_MASK 0x0400 /* DCOMP3_STS */
112#define WM831X_DCOMP3_STS_SHIFT 10 /* DCOMP3_STS */
113#define WM831X_DCOMP3_STS_WIDTH 1 /* DCOMP3_STS */
114#define WM831X_DCOMP2_STS 0x0200 /* DCOMP2_STS */
115#define WM831X_DCOMP2_STS_MASK 0x0200 /* DCOMP2_STS */
116#define WM831X_DCOMP2_STS_SHIFT 9 /* DCOMP2_STS */
117#define WM831X_DCOMP2_STS_WIDTH 1 /* DCOMP2_STS */
118#define WM831X_DCOMP1_STS 0x0100 /* DCOMP1_STS */
119#define WM831X_DCOMP1_STS_MASK 0x0100 /* DCOMP1_STS */
120#define WM831X_DCOMP1_STS_SHIFT 8 /* DCOMP1_STS */
121#define WM831X_DCOMP1_STS_WIDTH 1 /* DCOMP1_STS */
122#define WM831X_DCMP4_ENA 0x0008 /* DCMP4_ENA */
123#define WM831X_DCMP4_ENA_MASK 0x0008 /* DCMP4_ENA */
124#define WM831X_DCMP4_ENA_SHIFT 3 /* DCMP4_ENA */
125#define WM831X_DCMP4_ENA_WIDTH 1 /* DCMP4_ENA */
126#define WM831X_DCMP3_ENA 0x0004 /* DCMP3_ENA */
127#define WM831X_DCMP3_ENA_MASK 0x0004 /* DCMP3_ENA */
128#define WM831X_DCMP3_ENA_SHIFT 2 /* DCMP3_ENA */
129#define WM831X_DCMP3_ENA_WIDTH 1 /* DCMP3_ENA */
130#define WM831X_DCMP2_ENA 0x0002 /* DCMP2_ENA */
131#define WM831X_DCMP2_ENA_MASK 0x0002 /* DCMP2_ENA */
132#define WM831X_DCMP2_ENA_SHIFT 1 /* DCMP2_ENA */
133#define WM831X_DCMP2_ENA_WIDTH 1 /* DCMP2_ENA */
134#define WM831X_DCMP1_ENA 0x0001 /* DCMP1_ENA */
135#define WM831X_DCMP1_ENA_MASK 0x0001 /* DCMP1_ENA */
136#define WM831X_DCMP1_ENA_SHIFT 0 /* DCMP1_ENA */
137#define WM831X_DCMP1_ENA_WIDTH 1 /* DCMP1_ENA */
138
139/*
140 * R16433 (0x4031) - Comparator 1
141 */
142#define WM831X_DCMP1_SRC_MASK 0xE000 /* DCMP1_SRC - [15:13] */
143#define WM831X_DCMP1_SRC_SHIFT 13 /* DCMP1_SRC - [15:13] */
144#define WM831X_DCMP1_SRC_WIDTH 3 /* DCMP1_SRC - [15:13] */
145#define WM831X_DCMP1_GT 0x1000 /* DCMP1_GT */
146#define WM831X_DCMP1_GT_MASK 0x1000 /* DCMP1_GT */
147#define WM831X_DCMP1_GT_SHIFT 12 /* DCMP1_GT */
148#define WM831X_DCMP1_GT_WIDTH 1 /* DCMP1_GT */
149#define WM831X_DCMP1_THR_MASK 0x0FFF /* DCMP1_THR - [11:0] */
150#define WM831X_DCMP1_THR_SHIFT 0 /* DCMP1_THR - [11:0] */
151#define WM831X_DCMP1_THR_WIDTH 12 /* DCMP1_THR - [11:0] */
152
153/*
154 * R16434 (0x4032) - Comparator 2
155 */
156#define WM831X_DCMP2_SRC_MASK 0xE000 /* DCMP2_SRC - [15:13] */
157#define WM831X_DCMP2_SRC_SHIFT 13 /* DCMP2_SRC - [15:13] */
158#define WM831X_DCMP2_SRC_WIDTH 3 /* DCMP2_SRC - [15:13] */
159#define WM831X_DCMP2_GT 0x1000 /* DCMP2_GT */
160#define WM831X_DCMP2_GT_MASK 0x1000 /* DCMP2_GT */
161#define WM831X_DCMP2_GT_SHIFT 12 /* DCMP2_GT */
162#define WM831X_DCMP2_GT_WIDTH 1 /* DCMP2_GT */
163#define WM831X_DCMP2_THR_MASK 0x0FFF /* DCMP2_THR - [11:0] */
164#define WM831X_DCMP2_THR_SHIFT 0 /* DCMP2_THR - [11:0] */
165#define WM831X_DCMP2_THR_WIDTH 12 /* DCMP2_THR - [11:0] */
166
167/*
168 * R16435 (0x4033) - Comparator 3
169 */
170#define WM831X_DCMP3_SRC_MASK 0xE000 /* DCMP3_SRC - [15:13] */
171#define WM831X_DCMP3_SRC_SHIFT 13 /* DCMP3_SRC - [15:13] */
172#define WM831X_DCMP3_SRC_WIDTH 3 /* DCMP3_SRC - [15:13] */
173#define WM831X_DCMP3_GT 0x1000 /* DCMP3_GT */
174#define WM831X_DCMP3_GT_MASK 0x1000 /* DCMP3_GT */
175#define WM831X_DCMP3_GT_SHIFT 12 /* DCMP3_GT */
176#define WM831X_DCMP3_GT_WIDTH 1 /* DCMP3_GT */
177#define WM831X_DCMP3_THR_MASK 0x0FFF /* DCMP3_THR - [11:0] */
178#define WM831X_DCMP3_THR_SHIFT 0 /* DCMP3_THR - [11:0] */
179#define WM831X_DCMP3_THR_WIDTH 12 /* DCMP3_THR - [11:0] */
180
181/*
182 * R16436 (0x4034) - Comparator 4
183 */
184#define WM831X_DCMP4_SRC_MASK 0xE000 /* DCMP4_SRC - [15:13] */
185#define WM831X_DCMP4_SRC_SHIFT 13 /* DCMP4_SRC - [15:13] */
186#define WM831X_DCMP4_SRC_WIDTH 3 /* DCMP4_SRC - [15:13] */
187#define WM831X_DCMP4_GT 0x1000 /* DCMP4_GT */
188#define WM831X_DCMP4_GT_MASK 0x1000 /* DCMP4_GT */
189#define WM831X_DCMP4_GT_SHIFT 12 /* DCMP4_GT */
190#define WM831X_DCMP4_GT_WIDTH 1 /* DCMP4_GT */
191#define WM831X_DCMP4_THR_MASK 0x0FFF /* DCMP4_THR - [11:0] */
192#define WM831X_DCMP4_THR_SHIFT 0 /* DCMP4_THR - [11:0] */
193#define WM831X_DCMP4_THR_WIDTH 12 /* DCMP4_THR - [11:0] */
194
195#define WM831X_AUX_CAL_FACTOR 0xfff
196#define WM831X_AUX_CAL_NOMINAL 0x222
197
198enum wm831x_auxadc {
199 WM831X_AUX_CAL = 15,
200 WM831X_AUX_BKUP_BATT = 10,
201 WM831X_AUX_WALL = 9,
202 WM831X_AUX_BATT = 8,
203 WM831X_AUX_USB = 7,
204 WM831X_AUX_SYSVDD = 6,
205 WM831X_AUX_BATT_TEMP = 5,
206 WM831X_AUX_CHIP_TEMP = 4,
207 WM831X_AUX_AUX4 = 3,
208 WM831X_AUX_AUX3 = 2,
209 WM831X_AUX_AUX2 = 1,
210 WM831X_AUX_AUX1 = 0,
211};
212
213int wm831x_auxadc_read(struct wm831x *wm831x, enum wm831x_auxadc input);
214int wm831x_auxadc_read_uv(struct wm831x *wm831x, enum wm831x_auxadc input);
215
216#endif
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
new file mode 100644
index 000000000000..91eb493bf14c
--- /dev/null
+++ b/include/linux/mfd/wm831x/core.h
@@ -0,0 +1,289 @@
1/*
2 * include/linux/mfd/wm831x/core.h -- Core interface for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_CORE_H__
16#define __MFD_WM831X_CORE_H__
17
18#include <linux/interrupt.h>
19#include <linux/workqueue.h>
20
21/*
22 * Register values.
23 */
24#define WM831X_RESET_ID 0x00
25#define WM831X_REVISION 0x01
26#define WM831X_PARENT_ID 0x4000
27#define WM831X_SYSVDD_CONTROL 0x4001
28#define WM831X_THERMAL_MONITORING 0x4002
29#define WM831X_POWER_STATE 0x4003
30#define WM831X_WATCHDOG 0x4004
31#define WM831X_ON_PIN_CONTROL 0x4005
32#define WM831X_RESET_CONTROL 0x4006
33#define WM831X_CONTROL_INTERFACE 0x4007
34#define WM831X_SECURITY_KEY 0x4008
35#define WM831X_SOFTWARE_SCRATCH 0x4009
36#define WM831X_OTP_CONTROL 0x400A
37#define WM831X_GPIO_LEVEL 0x400C
38#define WM831X_SYSTEM_STATUS 0x400D
39#define WM831X_ON_SOURCE 0x400E
40#define WM831X_OFF_SOURCE 0x400F
41#define WM831X_SYSTEM_INTERRUPTS 0x4010
42#define WM831X_INTERRUPT_STATUS_1 0x4011
43#define WM831X_INTERRUPT_STATUS_2 0x4012
44#define WM831X_INTERRUPT_STATUS_3 0x4013
45#define WM831X_INTERRUPT_STATUS_4 0x4014
46#define WM831X_INTERRUPT_STATUS_5 0x4015
47#define WM831X_IRQ_CONFIG 0x4017
48#define WM831X_SYSTEM_INTERRUPTS_MASK 0x4018
49#define WM831X_INTERRUPT_STATUS_1_MASK 0x4019
50#define WM831X_INTERRUPT_STATUS_2_MASK 0x401A
51#define WM831X_INTERRUPT_STATUS_3_MASK 0x401B
52#define WM831X_INTERRUPT_STATUS_4_MASK 0x401C
53#define WM831X_INTERRUPT_STATUS_5_MASK 0x401D
54#define WM831X_RTC_WRITE_COUNTER 0x4020
55#define WM831X_RTC_TIME_1 0x4021
56#define WM831X_RTC_TIME_2 0x4022
57#define WM831X_RTC_ALARM_1 0x4023
58#define WM831X_RTC_ALARM_2 0x4024
59#define WM831X_RTC_CONTROL 0x4025
60#define WM831X_RTC_TRIM 0x4026
61#define WM831X_TOUCH_CONTROL_1 0x4028
62#define WM831X_TOUCH_CONTROL_2 0x4029
63#define WM831X_TOUCH_DATA_X 0x402A
64#define WM831X_TOUCH_DATA_Y 0x402B
65#define WM831X_TOUCH_DATA_Z 0x402C
66#define WM831X_AUXADC_DATA 0x402D
67#define WM831X_AUXADC_CONTROL 0x402E
68#define WM831X_AUXADC_SOURCE 0x402F
69#define WM831X_COMPARATOR_CONTROL 0x4030
70#define WM831X_COMPARATOR_1 0x4031
71#define WM831X_COMPARATOR_2 0x4032
72#define WM831X_COMPARATOR_3 0x4033
73#define WM831X_COMPARATOR_4 0x4034
74#define WM831X_GPIO1_CONTROL 0x4038
75#define WM831X_GPIO2_CONTROL 0x4039
76#define WM831X_GPIO3_CONTROL 0x403A
77#define WM831X_GPIO4_CONTROL 0x403B
78#define WM831X_GPIO5_CONTROL 0x403C
79#define WM831X_GPIO6_CONTROL 0x403D
80#define WM831X_GPIO7_CONTROL 0x403E
81#define WM831X_GPIO8_CONTROL 0x403F
82#define WM831X_GPIO9_CONTROL 0x4040
83#define WM831X_GPIO10_CONTROL 0x4041
84#define WM831X_GPIO11_CONTROL 0x4042
85#define WM831X_GPIO12_CONTROL 0x4043
86#define WM831X_GPIO13_CONTROL 0x4044
87#define WM831X_GPIO14_CONTROL 0x4045
88#define WM831X_GPIO15_CONTROL 0x4046
89#define WM831X_GPIO16_CONTROL 0x4047
90#define WM831X_CHARGER_CONTROL_1 0x4048
91#define WM831X_CHARGER_CONTROL_2 0x4049
92#define WM831X_CHARGER_STATUS 0x404A
93#define WM831X_BACKUP_CHARGER_CONTROL 0x404B
94#define WM831X_STATUS_LED_1 0x404C
95#define WM831X_STATUS_LED_2 0x404D
96#define WM831X_CURRENT_SINK_1 0x404E
97#define WM831X_CURRENT_SINK_2 0x404F
98#define WM831X_DCDC_ENABLE 0x4050
99#define WM831X_LDO_ENABLE 0x4051
100#define WM831X_DCDC_STATUS 0x4052
101#define WM831X_LDO_STATUS 0x4053
102#define WM831X_DCDC_UV_STATUS 0x4054
103#define WM831X_LDO_UV_STATUS 0x4055
104#define WM831X_DC1_CONTROL_1 0x4056
105#define WM831X_DC1_CONTROL_2 0x4057
106#define WM831X_DC1_ON_CONFIG 0x4058
107#define WM831X_DC1_SLEEP_CONTROL 0x4059
108#define WM831X_DC1_DVS_CONTROL 0x405A
109#define WM831X_DC2_CONTROL_1 0x405B
110#define WM831X_DC2_CONTROL_2 0x405C
111#define WM831X_DC2_ON_CONFIG 0x405D
112#define WM831X_DC2_SLEEP_CONTROL 0x405E
113#define WM831X_DC2_DVS_CONTROL 0x405F
114#define WM831X_DC3_CONTROL_1 0x4060
115#define WM831X_DC3_CONTROL_2 0x4061
116#define WM831X_DC3_ON_CONFIG 0x4062
117#define WM831X_DC3_SLEEP_CONTROL 0x4063
118#define WM831X_DC4_CONTROL 0x4064
119#define WM831X_DC4_SLEEP_CONTROL 0x4065
120#define WM831X_EPE1_CONTROL 0x4066
121#define WM831X_EPE2_CONTROL 0x4067
122#define WM831X_LDO1_CONTROL 0x4068
123#define WM831X_LDO1_ON_CONTROL 0x4069
124#define WM831X_LDO1_SLEEP_CONTROL 0x406A
125#define WM831X_LDO2_CONTROL 0x406B
126#define WM831X_LDO2_ON_CONTROL 0x406C
127#define WM831X_LDO2_SLEEP_CONTROL 0x406D
128#define WM831X_LDO3_CONTROL 0x406E
129#define WM831X_LDO3_ON_CONTROL 0x406F
130#define WM831X_LDO3_SLEEP_CONTROL 0x4070
131#define WM831X_LDO4_CONTROL 0x4071
132#define WM831X_LDO4_ON_CONTROL 0x4072
133#define WM831X_LDO4_SLEEP_CONTROL 0x4073
134#define WM831X_LDO5_CONTROL 0x4074
135#define WM831X_LDO5_ON_CONTROL 0x4075
136#define WM831X_LDO5_SLEEP_CONTROL 0x4076
137#define WM831X_LDO6_CONTROL 0x4077
138#define WM831X_LDO6_ON_CONTROL 0x4078
139#define WM831X_LDO6_SLEEP_CONTROL 0x4079
140#define WM831X_LDO7_CONTROL 0x407A
141#define WM831X_LDO7_ON_CONTROL 0x407B
142#define WM831X_LDO7_SLEEP_CONTROL 0x407C
143#define WM831X_LDO8_CONTROL 0x407D
144#define WM831X_LDO8_ON_CONTROL 0x407E
145#define WM831X_LDO8_SLEEP_CONTROL 0x407F
146#define WM831X_LDO9_CONTROL 0x4080
147#define WM831X_LDO9_ON_CONTROL 0x4081
148#define WM831X_LDO9_SLEEP_CONTROL 0x4082
149#define WM831X_LDO10_CONTROL 0x4083
150#define WM831X_LDO10_ON_CONTROL 0x4084
151#define WM831X_LDO10_SLEEP_CONTROL 0x4085
152#define WM831X_LDO11_ON_CONTROL 0x4087
153#define WM831X_LDO11_SLEEP_CONTROL 0x4088
154#define WM831X_POWER_GOOD_SOURCE_1 0x408E
155#define WM831X_POWER_GOOD_SOURCE_2 0x408F
156#define WM831X_CLOCK_CONTROL_1 0x4090
157#define WM831X_CLOCK_CONTROL_2 0x4091
158#define WM831X_FLL_CONTROL_1 0x4092
159#define WM831X_FLL_CONTROL_2 0x4093
160#define WM831X_FLL_CONTROL_3 0x4094
161#define WM831X_FLL_CONTROL_4 0x4095
162#define WM831X_FLL_CONTROL_5 0x4096
163#define WM831X_UNIQUE_ID_1 0x7800
164#define WM831X_UNIQUE_ID_2 0x7801
165#define WM831X_UNIQUE_ID_3 0x7802
166#define WM831X_UNIQUE_ID_4 0x7803
167#define WM831X_UNIQUE_ID_5 0x7804
168#define WM831X_UNIQUE_ID_6 0x7805
169#define WM831X_UNIQUE_ID_7 0x7806
170#define WM831X_UNIQUE_ID_8 0x7807
171#define WM831X_FACTORY_OTP_ID 0x7808
172#define WM831X_FACTORY_OTP_1 0x7809
173#define WM831X_FACTORY_OTP_2 0x780A
174#define WM831X_FACTORY_OTP_3 0x780B
175#define WM831X_FACTORY_OTP_4 0x780C
176#define WM831X_FACTORY_OTP_5 0x780D
177#define WM831X_CUSTOMER_OTP_ID 0x7810
178#define WM831X_DC1_OTP_CONTROL 0x7811
179#define WM831X_DC2_OTP_CONTROL 0x7812
180#define WM831X_DC3_OTP_CONTROL 0x7813
181#define WM831X_LDO1_2_OTP_CONTROL 0x7814
182#define WM831X_LDO3_4_OTP_CONTROL 0x7815
183#define WM831X_LDO5_6_OTP_CONTROL 0x7816
184#define WM831X_LDO7_8_OTP_CONTROL 0x7817
185#define WM831X_LDO9_10_OTP_CONTROL 0x7818
186#define WM831X_LDO11_EPE_CONTROL 0x7819
187#define WM831X_GPIO1_OTP_CONTROL 0x781A
188#define WM831X_GPIO2_OTP_CONTROL 0x781B
189#define WM831X_GPIO3_OTP_CONTROL 0x781C
190#define WM831X_GPIO4_OTP_CONTROL 0x781D
191#define WM831X_GPIO5_OTP_CONTROL 0x781E
192#define WM831X_GPIO6_OTP_CONTROL 0x781F
193#define WM831X_DBE_CHECK_DATA 0x7827
194
195/*
196 * R0 (0x00) - Reset ID
197 */
198#define WM831X_CHIP_ID_MASK 0xFFFF /* CHIP_ID - [15:0] */
199#define WM831X_CHIP_ID_SHIFT 0 /* CHIP_ID - [15:0] */
200#define WM831X_CHIP_ID_WIDTH 16 /* CHIP_ID - [15:0] */
201
202/*
203 * R1 (0x01) - Revision
204 */
205#define WM831X_PARENT_REV_MASK 0xFF00 /* PARENT_REV - [15:8] */
206#define WM831X_PARENT_REV_SHIFT 8 /* PARENT_REV - [15:8] */
207#define WM831X_PARENT_REV_WIDTH 8 /* PARENT_REV - [15:8] */
208#define WM831X_CHILD_REV_MASK 0x00FF /* CHILD_REV - [7:0] */
209#define WM831X_CHILD_REV_SHIFT 0 /* CHILD_REV - [7:0] */
210#define WM831X_CHILD_REV_WIDTH 8 /* CHILD_REV - [7:0] */
211
212/*
213 * R16384 (0x4000) - Parent ID
214 */
215#define WM831X_PARENT_ID_MASK 0xFFFF /* PARENT_ID - [15:0] */
216#define WM831X_PARENT_ID_SHIFT 0 /* PARENT_ID - [15:0] */
217#define WM831X_PARENT_ID_WIDTH 16 /* PARENT_ID - [15:0] */
218
219/*
220 * R16389 (0x4005) - ON Pin Control
221 */
222#define WM831X_ON_PIN_SECACT_MASK 0x0300 /* ON_PIN_SECACT - [9:8] */
223#define WM831X_ON_PIN_SECACT_SHIFT 8 /* ON_PIN_SECACT - [9:8] */
224#define WM831X_ON_PIN_SECACT_WIDTH 2 /* ON_PIN_SECACT - [9:8] */
225#define WM831X_ON_PIN_PRIMACT_MASK 0x0030 /* ON_PIN_PRIMACT - [5:4] */
226#define WM831X_ON_PIN_PRIMACT_SHIFT 4 /* ON_PIN_PRIMACT - [5:4] */
227#define WM831X_ON_PIN_PRIMACT_WIDTH 2 /* ON_PIN_PRIMACT - [5:4] */
228#define WM831X_ON_PIN_STS 0x0008 /* ON_PIN_STS */
229#define WM831X_ON_PIN_STS_MASK 0x0008 /* ON_PIN_STS */
230#define WM831X_ON_PIN_STS_SHIFT 3 /* ON_PIN_STS */
231#define WM831X_ON_PIN_STS_WIDTH 1 /* ON_PIN_STS */
232#define WM831X_ON_PIN_TO_MASK 0x0003 /* ON_PIN_TO - [1:0] */
233#define WM831X_ON_PIN_TO_SHIFT 0 /* ON_PIN_TO - [1:0] */
234#define WM831X_ON_PIN_TO_WIDTH 2 /* ON_PIN_TO - [1:0] */
235
236struct regulator_dev;
237
238struct wm831x {
239 struct mutex io_lock;
240
241 struct device *dev;
242 int (*read_dev)(struct wm831x *wm831x, unsigned short reg,
243 int bytes, void *dest);
244 int (*write_dev)(struct wm831x *wm831x, unsigned short reg,
245 int bytes, void *src);
246
247 void *control_data;
248
249 int irq; /* Our chip IRQ */
250 struct mutex irq_lock;
251 struct workqueue_struct *irq_wq;
252 struct work_struct irq_work;
253 unsigned int irq_base;
254 int irq_masks[5];
255
256 struct mutex auxadc_lock;
257
258 /* The WM831x has a security key blocking access to certain
259 * registers. The mutex is taken by the accessors for locking
260 * and unlocking the security key, locked is used to fail
261 * writes if the lock is held.
262 */
263 struct mutex key_lock;
264 unsigned int locked:1;
265};
266
267/* Device I/O API */
268int wm831x_reg_read(struct wm831x *wm831x, unsigned short reg);
269int wm831x_reg_write(struct wm831x *wm831x, unsigned short reg,
270 unsigned short val);
271void wm831x_reg_lock(struct wm831x *wm831x);
272int wm831x_reg_unlock(struct wm831x *wm831x);
273int wm831x_set_bits(struct wm831x *wm831x, unsigned short reg,
274 unsigned short mask, unsigned short val);
275int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg,
276 int count, u16 *buf);
277
278int wm831x_irq_init(struct wm831x *wm831x, int irq);
279void wm831x_irq_exit(struct wm831x *wm831x);
280
281int __must_check wm831x_request_irq(struct wm831x *wm831x,
282 unsigned int irq, irq_handler_t handler,
283 unsigned long flags, const char *name,
284 void *dev);
285void wm831x_free_irq(struct wm831x *wm831x, unsigned int, void *);
286void wm831x_disable_irq(struct wm831x *wm831x, int irq);
287void wm831x_enable_irq(struct wm831x *wm831x, int irq);
288
289#endif
diff --git a/include/linux/mfd/wm831x/gpio.h b/include/linux/mfd/wm831x/gpio.h
new file mode 100644
index 000000000000..2835614af0e3
--- /dev/null
+++ b/include/linux/mfd/wm831x/gpio.h
@@ -0,0 +1,55 @@
1/*
2 * include/linux/mfd/wm831x/gpio.h -- GPIO for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_GPIO_H__
16#define __MFD_WM831X_GPIO_H__
17
18/*
19 * R16440-16455 (0x4038-0x4047) - GPIOx Control
20 */
21#define WM831X_GPN_DIR 0x8000 /* GPN_DIR */
22#define WM831X_GPN_DIR_MASK 0x8000 /* GPN_DIR */
23#define WM831X_GPN_DIR_SHIFT 15 /* GPN_DIR */
24#define WM831X_GPN_DIR_WIDTH 1 /* GPN_DIR */
25#define WM831X_GPN_PULL_MASK 0x6000 /* GPN_PULL - [14:13] */
26#define WM831X_GPN_PULL_SHIFT 13 /* GPN_PULL - [14:13] */
27#define WM831X_GPN_PULL_WIDTH 2 /* GPN_PULL - [14:13] */
28#define WM831X_GPN_INT_MODE 0x1000 /* GPN_INT_MODE */
29#define WM831X_GPN_INT_MODE_MASK 0x1000 /* GPN_INT_MODE */
30#define WM831X_GPN_INT_MODE_SHIFT 12 /* GPN_INT_MODE */
31#define WM831X_GPN_INT_MODE_WIDTH 1 /* GPN_INT_MODE */
32#define WM831X_GPN_PWR_DOM 0x0800 /* GPN_PWR_DOM */
33#define WM831X_GPN_PWR_DOM_MASK 0x0800 /* GPN_PWR_DOM */
34#define WM831X_GPN_PWR_DOM_SHIFT 11 /* GPN_PWR_DOM */
35#define WM831X_GPN_PWR_DOM_WIDTH 1 /* GPN_PWR_DOM */
36#define WM831X_GPN_POL 0x0400 /* GPN_POL */
37#define WM831X_GPN_POL_MASK 0x0400 /* GPN_POL */
38#define WM831X_GPN_POL_SHIFT 10 /* GPN_POL */
39#define WM831X_GPN_POL_WIDTH 1 /* GPN_POL */
40#define WM831X_GPN_OD 0x0200 /* GPN_OD */
41#define WM831X_GPN_OD_MASK 0x0200 /* GPN_OD */
42#define WM831X_GPN_OD_SHIFT 9 /* GPN_OD */
43#define WM831X_GPN_OD_WIDTH 1 /* GPN_OD */
44#define WM831X_GPN_TRI 0x0080 /* GPN_TRI */
45#define WM831X_GPN_TRI_MASK 0x0080 /* GPN_TRI */
46#define WM831X_GPN_TRI_SHIFT 7 /* GPN_TRI */
47#define WM831X_GPN_TRI_WIDTH 1 /* GPN_TRI */
48#define WM831X_GPN_FN_MASK 0x000F /* GPN_FN - [3:0] */
49#define WM831X_GPN_FN_SHIFT 0 /* GPN_FN - [3:0] */
50#define WM831X_GPN_FN_WIDTH 4 /* GPN_FN - [3:0] */
51
52#define WM831X_GPIO_PULL_NONE (0 << WM831X_GPN_PULL_SHIFT)
53#define WM831X_GPIO_PULL_DOWN (1 << WM831X_GPN_PULL_SHIFT)
54#define WM831X_GPIO_PULL_UP (2 << WM831X_GPN_PULL_SHIFT)
55#endif
diff --git a/include/linux/mfd/wm831x/irq.h b/include/linux/mfd/wm831x/irq.h
new file mode 100644
index 000000000000..3a8c97656fda
--- /dev/null
+++ b/include/linux/mfd/wm831x/irq.h
@@ -0,0 +1,764 @@
1/*
2 * include/linux/mfd/wm831x/irq.h -- Interrupt controller for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_IRQ_H__
16#define __MFD_WM831X_IRQ_H__
17
18/* Interrupt number assignments within Linux */
19#define WM831X_IRQ_TEMP_THW 0
20#define WM831X_IRQ_GPIO_1 1
21#define WM831X_IRQ_GPIO_2 2
22#define WM831X_IRQ_GPIO_3 3
23#define WM831X_IRQ_GPIO_4 4
24#define WM831X_IRQ_GPIO_5 5
25#define WM831X_IRQ_GPIO_6 6
26#define WM831X_IRQ_GPIO_7 7
27#define WM831X_IRQ_GPIO_8 8
28#define WM831X_IRQ_GPIO_9 9
29#define WM831X_IRQ_GPIO_10 10
30#define WM831X_IRQ_GPIO_11 11
31#define WM831X_IRQ_GPIO_12 12
32#define WM831X_IRQ_GPIO_13 13
33#define WM831X_IRQ_GPIO_14 14
34#define WM831X_IRQ_GPIO_15 15
35#define WM831X_IRQ_GPIO_16 16
36#define WM831X_IRQ_ON 17
37#define WM831X_IRQ_PPM_SYSLO 18
38#define WM831X_IRQ_PPM_PWR_SRC 19
39#define WM831X_IRQ_PPM_USB_CURR 20
40#define WM831X_IRQ_WDOG_TO 21
41#define WM831X_IRQ_RTC_PER 22
42#define WM831X_IRQ_RTC_ALM 23
43#define WM831X_IRQ_CHG_BATT_HOT 24
44#define WM831X_IRQ_CHG_BATT_COLD 25
45#define WM831X_IRQ_CHG_BATT_FAIL 26
46#define WM831X_IRQ_CHG_OV 27
47#define WM831X_IRQ_CHG_END 29
48#define WM831X_IRQ_CHG_TO 30
49#define WM831X_IRQ_CHG_MODE 31
50#define WM831X_IRQ_CHG_START 32
51#define WM831X_IRQ_TCHDATA 33
52#define WM831X_IRQ_TCHPD 34
53#define WM831X_IRQ_AUXADC_DATA 35
54#define WM831X_IRQ_AUXADC_DCOMP1 36
55#define WM831X_IRQ_AUXADC_DCOMP2 37
56#define WM831X_IRQ_AUXADC_DCOMP3 38
57#define WM831X_IRQ_AUXADC_DCOMP4 39
58#define WM831X_IRQ_CS1 40
59#define WM831X_IRQ_CS2 41
60#define WM831X_IRQ_HC_DC1 42
61#define WM831X_IRQ_HC_DC2 43
62#define WM831X_IRQ_UV_LDO1 44
63#define WM831X_IRQ_UV_LDO2 45
64#define WM831X_IRQ_UV_LDO3 46
65#define WM831X_IRQ_UV_LDO4 47
66#define WM831X_IRQ_UV_LDO5 48
67#define WM831X_IRQ_UV_LDO6 49
68#define WM831X_IRQ_UV_LDO7 50
69#define WM831X_IRQ_UV_LDO8 51
70#define WM831X_IRQ_UV_LDO9 52
71#define WM831X_IRQ_UV_LDO10 53
72#define WM831X_IRQ_UV_DC1 54
73#define WM831X_IRQ_UV_DC2 55
74#define WM831X_IRQ_UV_DC3 56
75#define WM831X_IRQ_UV_DC4 57
76
77#define WM831X_NUM_IRQS 58
78
79/*
80 * R16400 (0x4010) - System Interrupts
81 */
82#define WM831X_PS_INT 0x8000 /* PS_INT */
83#define WM831X_PS_INT_MASK 0x8000 /* PS_INT */
84#define WM831X_PS_INT_SHIFT 15 /* PS_INT */
85#define WM831X_PS_INT_WIDTH 1 /* PS_INT */
86#define WM831X_TEMP_INT 0x4000 /* TEMP_INT */
87#define WM831X_TEMP_INT_MASK 0x4000 /* TEMP_INT */
88#define WM831X_TEMP_INT_SHIFT 14 /* TEMP_INT */
89#define WM831X_TEMP_INT_WIDTH 1 /* TEMP_INT */
90#define WM831X_GP_INT 0x2000 /* GP_INT */
91#define WM831X_GP_INT_MASK 0x2000 /* GP_INT */
92#define WM831X_GP_INT_SHIFT 13 /* GP_INT */
93#define WM831X_GP_INT_WIDTH 1 /* GP_INT */
94#define WM831X_ON_PIN_INT 0x1000 /* ON_PIN_INT */
95#define WM831X_ON_PIN_INT_MASK 0x1000 /* ON_PIN_INT */
96#define WM831X_ON_PIN_INT_SHIFT 12 /* ON_PIN_INT */
97#define WM831X_ON_PIN_INT_WIDTH 1 /* ON_PIN_INT */
98#define WM831X_WDOG_INT 0x0800 /* WDOG_INT */
99#define WM831X_WDOG_INT_MASK 0x0800 /* WDOG_INT */
100#define WM831X_WDOG_INT_SHIFT 11 /* WDOG_INT */
101#define WM831X_WDOG_INT_WIDTH 1 /* WDOG_INT */
102#define WM831X_TCHDATA_INT 0x0400 /* TCHDATA_INT */
103#define WM831X_TCHDATA_INT_MASK 0x0400 /* TCHDATA_INT */
104#define WM831X_TCHDATA_INT_SHIFT 10 /* TCHDATA_INT */
105#define WM831X_TCHDATA_INT_WIDTH 1 /* TCHDATA_INT */
106#define WM831X_TCHPD_INT 0x0200 /* TCHPD_INT */
107#define WM831X_TCHPD_INT_MASK 0x0200 /* TCHPD_INT */
108#define WM831X_TCHPD_INT_SHIFT 9 /* TCHPD_INT */
109#define WM831X_TCHPD_INT_WIDTH 1 /* TCHPD_INT */
110#define WM831X_AUXADC_INT 0x0100 /* AUXADC_INT */
111#define WM831X_AUXADC_INT_MASK 0x0100 /* AUXADC_INT */
112#define WM831X_AUXADC_INT_SHIFT 8 /* AUXADC_INT */
113#define WM831X_AUXADC_INT_WIDTH 1 /* AUXADC_INT */
114#define WM831X_PPM_INT 0x0080 /* PPM_INT */
115#define WM831X_PPM_INT_MASK 0x0080 /* PPM_INT */
116#define WM831X_PPM_INT_SHIFT 7 /* PPM_INT */
117#define WM831X_PPM_INT_WIDTH 1 /* PPM_INT */
118#define WM831X_CS_INT 0x0040 /* CS_INT */
119#define WM831X_CS_INT_MASK 0x0040 /* CS_INT */
120#define WM831X_CS_INT_SHIFT 6 /* CS_INT */
121#define WM831X_CS_INT_WIDTH 1 /* CS_INT */
122#define WM831X_RTC_INT 0x0020 /* RTC_INT */
123#define WM831X_RTC_INT_MASK 0x0020 /* RTC_INT */
124#define WM831X_RTC_INT_SHIFT 5 /* RTC_INT */
125#define WM831X_RTC_INT_WIDTH 1 /* RTC_INT */
126#define WM831X_OTP_INT 0x0010 /* OTP_INT */
127#define WM831X_OTP_INT_MASK 0x0010 /* OTP_INT */
128#define WM831X_OTP_INT_SHIFT 4 /* OTP_INT */
129#define WM831X_OTP_INT_WIDTH 1 /* OTP_INT */
130#define WM831X_CHILD_INT 0x0008 /* CHILD_INT */
131#define WM831X_CHILD_INT_MASK 0x0008 /* CHILD_INT */
132#define WM831X_CHILD_INT_SHIFT 3 /* CHILD_INT */
133#define WM831X_CHILD_INT_WIDTH 1 /* CHILD_INT */
134#define WM831X_CHG_INT 0x0004 /* CHG_INT */
135#define WM831X_CHG_INT_MASK 0x0004 /* CHG_INT */
136#define WM831X_CHG_INT_SHIFT 2 /* CHG_INT */
137#define WM831X_CHG_INT_WIDTH 1 /* CHG_INT */
138#define WM831X_HC_INT 0x0002 /* HC_INT */
139#define WM831X_HC_INT_MASK 0x0002 /* HC_INT */
140#define WM831X_HC_INT_SHIFT 1 /* HC_INT */
141#define WM831X_HC_INT_WIDTH 1 /* HC_INT */
142#define WM831X_UV_INT 0x0001 /* UV_INT */
143#define WM831X_UV_INT_MASK 0x0001 /* UV_INT */
144#define WM831X_UV_INT_SHIFT 0 /* UV_INT */
145#define WM831X_UV_INT_WIDTH 1 /* UV_INT */
146
147/*
148 * R16401 (0x4011) - Interrupt Status 1
149 */
150#define WM831X_PPM_SYSLO_EINT 0x8000 /* PPM_SYSLO_EINT */
151#define WM831X_PPM_SYSLO_EINT_MASK 0x8000 /* PPM_SYSLO_EINT */
152#define WM831X_PPM_SYSLO_EINT_SHIFT 15 /* PPM_SYSLO_EINT */
153#define WM831X_PPM_SYSLO_EINT_WIDTH 1 /* PPM_SYSLO_EINT */
154#define WM831X_PPM_PWR_SRC_EINT 0x4000 /* PPM_PWR_SRC_EINT */
155#define WM831X_PPM_PWR_SRC_EINT_MASK 0x4000 /* PPM_PWR_SRC_EINT */
156#define WM831X_PPM_PWR_SRC_EINT_SHIFT 14 /* PPM_PWR_SRC_EINT */
157#define WM831X_PPM_PWR_SRC_EINT_WIDTH 1 /* PPM_PWR_SRC_EINT */
158#define WM831X_PPM_USB_CURR_EINT 0x2000 /* PPM_USB_CURR_EINT */
159#define WM831X_PPM_USB_CURR_EINT_MASK 0x2000 /* PPM_USB_CURR_EINT */
160#define WM831X_PPM_USB_CURR_EINT_SHIFT 13 /* PPM_USB_CURR_EINT */
161#define WM831X_PPM_USB_CURR_EINT_WIDTH 1 /* PPM_USB_CURR_EINT */
162#define WM831X_ON_PIN_EINT 0x1000 /* ON_PIN_EINT */
163#define WM831X_ON_PIN_EINT_MASK 0x1000 /* ON_PIN_EINT */
164#define WM831X_ON_PIN_EINT_SHIFT 12 /* ON_PIN_EINT */
165#define WM831X_ON_PIN_EINT_WIDTH 1 /* ON_PIN_EINT */
166#define WM831X_WDOG_TO_EINT 0x0800 /* WDOG_TO_EINT */
167#define WM831X_WDOG_TO_EINT_MASK 0x0800 /* WDOG_TO_EINT */
168#define WM831X_WDOG_TO_EINT_SHIFT 11 /* WDOG_TO_EINT */
169#define WM831X_WDOG_TO_EINT_WIDTH 1 /* WDOG_TO_EINT */
170#define WM831X_TCHDATA_EINT 0x0400 /* TCHDATA_EINT */
171#define WM831X_TCHDATA_EINT_MASK 0x0400 /* TCHDATA_EINT */
172#define WM831X_TCHDATA_EINT_SHIFT 10 /* TCHDATA_EINT */
173#define WM831X_TCHDATA_EINT_WIDTH 1 /* TCHDATA_EINT */
174#define WM831X_TCHPD_EINT 0x0200 /* TCHPD_EINT */
175#define WM831X_TCHPD_EINT_MASK 0x0200 /* TCHPD_EINT */
176#define WM831X_TCHPD_EINT_SHIFT 9 /* TCHPD_EINT */
177#define WM831X_TCHPD_EINT_WIDTH 1 /* TCHPD_EINT */
178#define WM831X_AUXADC_DATA_EINT 0x0100 /* AUXADC_DATA_EINT */
179#define WM831X_AUXADC_DATA_EINT_MASK 0x0100 /* AUXADC_DATA_EINT */
180#define WM831X_AUXADC_DATA_EINT_SHIFT 8 /* AUXADC_DATA_EINT */
181#define WM831X_AUXADC_DATA_EINT_WIDTH 1 /* AUXADC_DATA_EINT */
182#define WM831X_AUXADC_DCOMP4_EINT 0x0080 /* AUXADC_DCOMP4_EINT */
183#define WM831X_AUXADC_DCOMP4_EINT_MASK 0x0080 /* AUXADC_DCOMP4_EINT */
184#define WM831X_AUXADC_DCOMP4_EINT_SHIFT 7 /* AUXADC_DCOMP4_EINT */
185#define WM831X_AUXADC_DCOMP4_EINT_WIDTH 1 /* AUXADC_DCOMP4_EINT */
186#define WM831X_AUXADC_DCOMP3_EINT 0x0040 /* AUXADC_DCOMP3_EINT */
187#define WM831X_AUXADC_DCOMP3_EINT_MASK 0x0040 /* AUXADC_DCOMP3_EINT */
188#define WM831X_AUXADC_DCOMP3_EINT_SHIFT 6 /* AUXADC_DCOMP3_EINT */
189#define WM831X_AUXADC_DCOMP3_EINT_WIDTH 1 /* AUXADC_DCOMP3_EINT */
190#define WM831X_AUXADC_DCOMP2_EINT 0x0020 /* AUXADC_DCOMP2_EINT */
191#define WM831X_AUXADC_DCOMP2_EINT_MASK 0x0020 /* AUXADC_DCOMP2_EINT */
192#define WM831X_AUXADC_DCOMP2_EINT_SHIFT 5 /* AUXADC_DCOMP2_EINT */
193#define WM831X_AUXADC_DCOMP2_EINT_WIDTH 1 /* AUXADC_DCOMP2_EINT */
194#define WM831X_AUXADC_DCOMP1_EINT 0x0010 /* AUXADC_DCOMP1_EINT */
195#define WM831X_AUXADC_DCOMP1_EINT_MASK 0x0010 /* AUXADC_DCOMP1_EINT */
196#define WM831X_AUXADC_DCOMP1_EINT_SHIFT 4 /* AUXADC_DCOMP1_EINT */
197#define WM831X_AUXADC_DCOMP1_EINT_WIDTH 1 /* AUXADC_DCOMP1_EINT */
198#define WM831X_RTC_PER_EINT 0x0008 /* RTC_PER_EINT */
199#define WM831X_RTC_PER_EINT_MASK 0x0008 /* RTC_PER_EINT */
200#define WM831X_RTC_PER_EINT_SHIFT 3 /* RTC_PER_EINT */
201#define WM831X_RTC_PER_EINT_WIDTH 1 /* RTC_PER_EINT */
202#define WM831X_RTC_ALM_EINT 0x0004 /* RTC_ALM_EINT */
203#define WM831X_RTC_ALM_EINT_MASK 0x0004 /* RTC_ALM_EINT */
204#define WM831X_RTC_ALM_EINT_SHIFT 2 /* RTC_ALM_EINT */
205#define WM831X_RTC_ALM_EINT_WIDTH 1 /* RTC_ALM_EINT */
206#define WM831X_TEMP_THW_EINT 0x0002 /* TEMP_THW_EINT */
207#define WM831X_TEMP_THW_EINT_MASK 0x0002 /* TEMP_THW_EINT */
208#define WM831X_TEMP_THW_EINT_SHIFT 1 /* TEMP_THW_EINT */
209#define WM831X_TEMP_THW_EINT_WIDTH 1 /* TEMP_THW_EINT */
210
211/*
212 * R16402 (0x4012) - Interrupt Status 2
213 */
214#define WM831X_CHG_BATT_HOT_EINT 0x8000 /* CHG_BATT_HOT_EINT */
215#define WM831X_CHG_BATT_HOT_EINT_MASK 0x8000 /* CHG_BATT_HOT_EINT */
216#define WM831X_CHG_BATT_HOT_EINT_SHIFT 15 /* CHG_BATT_HOT_EINT */
217#define WM831X_CHG_BATT_HOT_EINT_WIDTH 1 /* CHG_BATT_HOT_EINT */
218#define WM831X_CHG_BATT_COLD_EINT 0x4000 /* CHG_BATT_COLD_EINT */
219#define WM831X_CHG_BATT_COLD_EINT_MASK 0x4000 /* CHG_BATT_COLD_EINT */
220#define WM831X_CHG_BATT_COLD_EINT_SHIFT 14 /* CHG_BATT_COLD_EINT */
221#define WM831X_CHG_BATT_COLD_EINT_WIDTH 1 /* CHG_BATT_COLD_EINT */
222#define WM831X_CHG_BATT_FAIL_EINT 0x2000 /* CHG_BATT_FAIL_EINT */
223#define WM831X_CHG_BATT_FAIL_EINT_MASK 0x2000 /* CHG_BATT_FAIL_EINT */
224#define WM831X_CHG_BATT_FAIL_EINT_SHIFT 13 /* CHG_BATT_FAIL_EINT */
225#define WM831X_CHG_BATT_FAIL_EINT_WIDTH 1 /* CHG_BATT_FAIL_EINT */
226#define WM831X_CHG_OV_EINT 0x1000 /* CHG_OV_EINT */
227#define WM831X_CHG_OV_EINT_MASK 0x1000 /* CHG_OV_EINT */
228#define WM831X_CHG_OV_EINT_SHIFT 12 /* CHG_OV_EINT */
229#define WM831X_CHG_OV_EINT_WIDTH 1 /* CHG_OV_EINT */
230#define WM831X_CHG_END_EINT 0x0800 /* CHG_END_EINT */
231#define WM831X_CHG_END_EINT_MASK 0x0800 /* CHG_END_EINT */
232#define WM831X_CHG_END_EINT_SHIFT 11 /* CHG_END_EINT */
233#define WM831X_CHG_END_EINT_WIDTH 1 /* CHG_END_EINT */
234#define WM831X_CHG_TO_EINT 0x0400 /* CHG_TO_EINT */
235#define WM831X_CHG_TO_EINT_MASK 0x0400 /* CHG_TO_EINT */
236#define WM831X_CHG_TO_EINT_SHIFT 10 /* CHG_TO_EINT */
237#define WM831X_CHG_TO_EINT_WIDTH 1 /* CHG_TO_EINT */
238#define WM831X_CHG_MODE_EINT 0x0200 /* CHG_MODE_EINT */
239#define WM831X_CHG_MODE_EINT_MASK 0x0200 /* CHG_MODE_EINT */
240#define WM831X_CHG_MODE_EINT_SHIFT 9 /* CHG_MODE_EINT */
241#define WM831X_CHG_MODE_EINT_WIDTH 1 /* CHG_MODE_EINT */
242#define WM831X_CHG_START_EINT 0x0100 /* CHG_START_EINT */
243#define WM831X_CHG_START_EINT_MASK 0x0100 /* CHG_START_EINT */
244#define WM831X_CHG_START_EINT_SHIFT 8 /* CHG_START_EINT */
245#define WM831X_CHG_START_EINT_WIDTH 1 /* CHG_START_EINT */
246#define WM831X_CS2_EINT 0x0080 /* CS2_EINT */
247#define WM831X_CS2_EINT_MASK 0x0080 /* CS2_EINT */
248#define WM831X_CS2_EINT_SHIFT 7 /* CS2_EINT */
249#define WM831X_CS2_EINT_WIDTH 1 /* CS2_EINT */
250#define WM831X_CS1_EINT 0x0040 /* CS1_EINT */
251#define WM831X_CS1_EINT_MASK 0x0040 /* CS1_EINT */
252#define WM831X_CS1_EINT_SHIFT 6 /* CS1_EINT */
253#define WM831X_CS1_EINT_WIDTH 1 /* CS1_EINT */
254#define WM831X_OTP_CMD_END_EINT 0x0020 /* OTP_CMD_END_EINT */
255#define WM831X_OTP_CMD_END_EINT_MASK 0x0020 /* OTP_CMD_END_EINT */
256#define WM831X_OTP_CMD_END_EINT_SHIFT 5 /* OTP_CMD_END_EINT */
257#define WM831X_OTP_CMD_END_EINT_WIDTH 1 /* OTP_CMD_END_EINT */
258#define WM831X_OTP_ERR_EINT 0x0010 /* OTP_ERR_EINT */
259#define WM831X_OTP_ERR_EINT_MASK 0x0010 /* OTP_ERR_EINT */
260#define WM831X_OTP_ERR_EINT_SHIFT 4 /* OTP_ERR_EINT */
261#define WM831X_OTP_ERR_EINT_WIDTH 1 /* OTP_ERR_EINT */
262#define WM831X_PS_POR_EINT 0x0004 /* PS_POR_EINT */
263#define WM831X_PS_POR_EINT_MASK 0x0004 /* PS_POR_EINT */
264#define WM831X_PS_POR_EINT_SHIFT 2 /* PS_POR_EINT */
265#define WM831X_PS_POR_EINT_WIDTH 1 /* PS_POR_EINT */
266#define WM831X_PS_SLEEP_OFF_EINT 0x0002 /* PS_SLEEP_OFF_EINT */
267#define WM831X_PS_SLEEP_OFF_EINT_MASK 0x0002 /* PS_SLEEP_OFF_EINT */
268#define WM831X_PS_SLEEP_OFF_EINT_SHIFT 1 /* PS_SLEEP_OFF_EINT */
269#define WM831X_PS_SLEEP_OFF_EINT_WIDTH 1 /* PS_SLEEP_OFF_EINT */
270#define WM831X_PS_ON_WAKE_EINT 0x0001 /* PS_ON_WAKE_EINT */
271#define WM831X_PS_ON_WAKE_EINT_MASK 0x0001 /* PS_ON_WAKE_EINT */
272#define WM831X_PS_ON_WAKE_EINT_SHIFT 0 /* PS_ON_WAKE_EINT */
273#define WM831X_PS_ON_WAKE_EINT_WIDTH 1 /* PS_ON_WAKE_EINT */
274
275/*
276 * R16403 (0x4013) - Interrupt Status 3
277 */
278#define WM831X_UV_LDO10_EINT 0x0200 /* UV_LDO10_EINT */
279#define WM831X_UV_LDO10_EINT_MASK 0x0200 /* UV_LDO10_EINT */
280#define WM831X_UV_LDO10_EINT_SHIFT 9 /* UV_LDO10_EINT */
281#define WM831X_UV_LDO10_EINT_WIDTH 1 /* UV_LDO10_EINT */
282#define WM831X_UV_LDO9_EINT 0x0100 /* UV_LDO9_EINT */
283#define WM831X_UV_LDO9_EINT_MASK 0x0100 /* UV_LDO9_EINT */
284#define WM831X_UV_LDO9_EINT_SHIFT 8 /* UV_LDO9_EINT */
285#define WM831X_UV_LDO9_EINT_WIDTH 1 /* UV_LDO9_EINT */
286#define WM831X_UV_LDO8_EINT 0x0080 /* UV_LDO8_EINT */
287#define WM831X_UV_LDO8_EINT_MASK 0x0080 /* UV_LDO8_EINT */
288#define WM831X_UV_LDO8_EINT_SHIFT 7 /* UV_LDO8_EINT */
289#define WM831X_UV_LDO8_EINT_WIDTH 1 /* UV_LDO8_EINT */
290#define WM831X_UV_LDO7_EINT 0x0040 /* UV_LDO7_EINT */
291#define WM831X_UV_LDO7_EINT_MASK 0x0040 /* UV_LDO7_EINT */
292#define WM831X_UV_LDO7_EINT_SHIFT 6 /* UV_LDO7_EINT */
293#define WM831X_UV_LDO7_EINT_WIDTH 1 /* UV_LDO7_EINT */
294#define WM831X_UV_LDO6_EINT 0x0020 /* UV_LDO6_EINT */
295#define WM831X_UV_LDO6_EINT_MASK 0x0020 /* UV_LDO6_EINT */
296#define WM831X_UV_LDO6_EINT_SHIFT 5 /* UV_LDO6_EINT */
297#define WM831X_UV_LDO6_EINT_WIDTH 1 /* UV_LDO6_EINT */
298#define WM831X_UV_LDO5_EINT 0x0010 /* UV_LDO5_EINT */
299#define WM831X_UV_LDO5_EINT_MASK 0x0010 /* UV_LDO5_EINT */
300#define WM831X_UV_LDO5_EINT_SHIFT 4 /* UV_LDO5_EINT */
301#define WM831X_UV_LDO5_EINT_WIDTH 1 /* UV_LDO5_EINT */
302#define WM831X_UV_LDO4_EINT 0x0008 /* UV_LDO4_EINT */
303#define WM831X_UV_LDO4_EINT_MASK 0x0008 /* UV_LDO4_EINT */
304#define WM831X_UV_LDO4_EINT_SHIFT 3 /* UV_LDO4_EINT */
305#define WM831X_UV_LDO4_EINT_WIDTH 1 /* UV_LDO4_EINT */
306#define WM831X_UV_LDO3_EINT 0x0004 /* UV_LDO3_EINT */
307#define WM831X_UV_LDO3_EINT_MASK 0x0004 /* UV_LDO3_EINT */
308#define WM831X_UV_LDO3_EINT_SHIFT 2 /* UV_LDO3_EINT */
309#define WM831X_UV_LDO3_EINT_WIDTH 1 /* UV_LDO3_EINT */
310#define WM831X_UV_LDO2_EINT 0x0002 /* UV_LDO2_EINT */
311#define WM831X_UV_LDO2_EINT_MASK 0x0002 /* UV_LDO2_EINT */
312#define WM831X_UV_LDO2_EINT_SHIFT 1 /* UV_LDO2_EINT */
313#define WM831X_UV_LDO2_EINT_WIDTH 1 /* UV_LDO2_EINT */
314#define WM831X_UV_LDO1_EINT 0x0001 /* UV_LDO1_EINT */
315#define WM831X_UV_LDO1_EINT_MASK 0x0001 /* UV_LDO1_EINT */
316#define WM831X_UV_LDO1_EINT_SHIFT 0 /* UV_LDO1_EINT */
317#define WM831X_UV_LDO1_EINT_WIDTH 1 /* UV_LDO1_EINT */
318
319/*
320 * R16404 (0x4014) - Interrupt Status 4
321 */
322#define WM831X_HC_DC2_EINT 0x0200 /* HC_DC2_EINT */
323#define WM831X_HC_DC2_EINT_MASK 0x0200 /* HC_DC2_EINT */
324#define WM831X_HC_DC2_EINT_SHIFT 9 /* HC_DC2_EINT */
325#define WM831X_HC_DC2_EINT_WIDTH 1 /* HC_DC2_EINT */
326#define WM831X_HC_DC1_EINT 0x0100 /* HC_DC1_EINT */
327#define WM831X_HC_DC1_EINT_MASK 0x0100 /* HC_DC1_EINT */
328#define WM831X_HC_DC1_EINT_SHIFT 8 /* HC_DC1_EINT */
329#define WM831X_HC_DC1_EINT_WIDTH 1 /* HC_DC1_EINT */
330#define WM831X_UV_DC4_EINT 0x0008 /* UV_DC4_EINT */
331#define WM831X_UV_DC4_EINT_MASK 0x0008 /* UV_DC4_EINT */
332#define WM831X_UV_DC4_EINT_SHIFT 3 /* UV_DC4_EINT */
333#define WM831X_UV_DC4_EINT_WIDTH 1 /* UV_DC4_EINT */
334#define WM831X_UV_DC3_EINT 0x0004 /* UV_DC3_EINT */
335#define WM831X_UV_DC3_EINT_MASK 0x0004 /* UV_DC3_EINT */
336#define WM831X_UV_DC3_EINT_SHIFT 2 /* UV_DC3_EINT */
337#define WM831X_UV_DC3_EINT_WIDTH 1 /* UV_DC3_EINT */
338#define WM831X_UV_DC2_EINT 0x0002 /* UV_DC2_EINT */
339#define WM831X_UV_DC2_EINT_MASK 0x0002 /* UV_DC2_EINT */
340#define WM831X_UV_DC2_EINT_SHIFT 1 /* UV_DC2_EINT */
341#define WM831X_UV_DC2_EINT_WIDTH 1 /* UV_DC2_EINT */
342#define WM831X_UV_DC1_EINT 0x0001 /* UV_DC1_EINT */
343#define WM831X_UV_DC1_EINT_MASK 0x0001 /* UV_DC1_EINT */
344#define WM831X_UV_DC1_EINT_SHIFT 0 /* UV_DC1_EINT */
345#define WM831X_UV_DC1_EINT_WIDTH 1 /* UV_DC1_EINT */
346
347/*
348 * R16405 (0x4015) - Interrupt Status 5
349 */
350#define WM831X_GP16_EINT 0x8000 /* GP16_EINT */
351#define WM831X_GP16_EINT_MASK 0x8000 /* GP16_EINT */
352#define WM831X_GP16_EINT_SHIFT 15 /* GP16_EINT */
353#define WM831X_GP16_EINT_WIDTH 1 /* GP16_EINT */
354#define WM831X_GP15_EINT 0x4000 /* GP15_EINT */
355#define WM831X_GP15_EINT_MASK 0x4000 /* GP15_EINT */
356#define WM831X_GP15_EINT_SHIFT 14 /* GP15_EINT */
357#define WM831X_GP15_EINT_WIDTH 1 /* GP15_EINT */
358#define WM831X_GP14_EINT 0x2000 /* GP14_EINT */
359#define WM831X_GP14_EINT_MASK 0x2000 /* GP14_EINT */
360#define WM831X_GP14_EINT_SHIFT 13 /* GP14_EINT */
361#define WM831X_GP14_EINT_WIDTH 1 /* GP14_EINT */
362#define WM831X_GP13_EINT 0x1000 /* GP13_EINT */
363#define WM831X_GP13_EINT_MASK 0x1000 /* GP13_EINT */
364#define WM831X_GP13_EINT_SHIFT 12 /* GP13_EINT */
365#define WM831X_GP13_EINT_WIDTH 1 /* GP13_EINT */
366#define WM831X_GP12_EINT 0x0800 /* GP12_EINT */
367#define WM831X_GP12_EINT_MASK 0x0800 /* GP12_EINT */
368#define WM831X_GP12_EINT_SHIFT 11 /* GP12_EINT */
369#define WM831X_GP12_EINT_WIDTH 1 /* GP12_EINT */
370#define WM831X_GP11_EINT 0x0400 /* GP11_EINT */
371#define WM831X_GP11_EINT_MASK 0x0400 /* GP11_EINT */
372#define WM831X_GP11_EINT_SHIFT 10 /* GP11_EINT */
373#define WM831X_GP11_EINT_WIDTH 1 /* GP11_EINT */
374#define WM831X_GP10_EINT 0x0200 /* GP10_EINT */
375#define WM831X_GP10_EINT_MASK 0x0200 /* GP10_EINT */
376#define WM831X_GP10_EINT_SHIFT 9 /* GP10_EINT */
377#define WM831X_GP10_EINT_WIDTH 1 /* GP10_EINT */
378#define WM831X_GP9_EINT 0x0100 /* GP9_EINT */
379#define WM831X_GP9_EINT_MASK 0x0100 /* GP9_EINT */
380#define WM831X_GP9_EINT_SHIFT 8 /* GP9_EINT */
381#define WM831X_GP9_EINT_WIDTH 1 /* GP9_EINT */
382#define WM831X_GP8_EINT 0x0080 /* GP8_EINT */
383#define WM831X_GP8_EINT_MASK 0x0080 /* GP8_EINT */
384#define WM831X_GP8_EINT_SHIFT 7 /* GP8_EINT */
385#define WM831X_GP8_EINT_WIDTH 1 /* GP8_EINT */
386#define WM831X_GP7_EINT 0x0040 /* GP7_EINT */
387#define WM831X_GP7_EINT_MASK 0x0040 /* GP7_EINT */
388#define WM831X_GP7_EINT_SHIFT 6 /* GP7_EINT */
389#define WM831X_GP7_EINT_WIDTH 1 /* GP7_EINT */
390#define WM831X_GP6_EINT 0x0020 /* GP6_EINT */
391#define WM831X_GP6_EINT_MASK 0x0020 /* GP6_EINT */
392#define WM831X_GP6_EINT_SHIFT 5 /* GP6_EINT */
393#define WM831X_GP6_EINT_WIDTH 1 /* GP6_EINT */
394#define WM831X_GP5_EINT 0x0010 /* GP5_EINT */
395#define WM831X_GP5_EINT_MASK 0x0010 /* GP5_EINT */
396#define WM831X_GP5_EINT_SHIFT 4 /* GP5_EINT */
397#define WM831X_GP5_EINT_WIDTH 1 /* GP5_EINT */
398#define WM831X_GP4_EINT 0x0008 /* GP4_EINT */
399#define WM831X_GP4_EINT_MASK 0x0008 /* GP4_EINT */
400#define WM831X_GP4_EINT_SHIFT 3 /* GP4_EINT */
401#define WM831X_GP4_EINT_WIDTH 1 /* GP4_EINT */
402#define WM831X_GP3_EINT 0x0004 /* GP3_EINT */
403#define WM831X_GP3_EINT_MASK 0x0004 /* GP3_EINT */
404#define WM831X_GP3_EINT_SHIFT 2 /* GP3_EINT */
405#define WM831X_GP3_EINT_WIDTH 1 /* GP3_EINT */
406#define WM831X_GP2_EINT 0x0002 /* GP2_EINT */
407#define WM831X_GP2_EINT_MASK 0x0002 /* GP2_EINT */
408#define WM831X_GP2_EINT_SHIFT 1 /* GP2_EINT */
409#define WM831X_GP2_EINT_WIDTH 1 /* GP2_EINT */
410#define WM831X_GP1_EINT 0x0001 /* GP1_EINT */
411#define WM831X_GP1_EINT_MASK 0x0001 /* GP1_EINT */
412#define WM831X_GP1_EINT_SHIFT 0 /* GP1_EINT */
413#define WM831X_GP1_EINT_WIDTH 1 /* GP1_EINT */
414
415/*
416 * R16407 (0x4017) - IRQ Config
417 */
418#define WM831X_IRQ_OD 0x0002 /* IRQ_OD */
419#define WM831X_IRQ_OD_MASK 0x0002 /* IRQ_OD */
420#define WM831X_IRQ_OD_SHIFT 1 /* IRQ_OD */
421#define WM831X_IRQ_OD_WIDTH 1 /* IRQ_OD */
422#define WM831X_IM_IRQ 0x0001 /* IM_IRQ */
423#define WM831X_IM_IRQ_MASK 0x0001 /* IM_IRQ */
424#define WM831X_IM_IRQ_SHIFT 0 /* IM_IRQ */
425#define WM831X_IM_IRQ_WIDTH 1 /* IM_IRQ */
426
427/*
428 * R16408 (0x4018) - System Interrupts Mask
429 */
430#define WM831X_IM_PS_INT 0x8000 /* IM_PS_INT */
431#define WM831X_IM_PS_INT_MASK 0x8000 /* IM_PS_INT */
432#define WM831X_IM_PS_INT_SHIFT 15 /* IM_PS_INT */
433#define WM831X_IM_PS_INT_WIDTH 1 /* IM_PS_INT */
434#define WM831X_IM_TEMP_INT 0x4000 /* IM_TEMP_INT */
435#define WM831X_IM_TEMP_INT_MASK 0x4000 /* IM_TEMP_INT */
436#define WM831X_IM_TEMP_INT_SHIFT 14 /* IM_TEMP_INT */
437#define WM831X_IM_TEMP_INT_WIDTH 1 /* IM_TEMP_INT */
438#define WM831X_IM_GP_INT 0x2000 /* IM_GP_INT */
439#define WM831X_IM_GP_INT_MASK 0x2000 /* IM_GP_INT */
440#define WM831X_IM_GP_INT_SHIFT 13 /* IM_GP_INT */
441#define WM831X_IM_GP_INT_WIDTH 1 /* IM_GP_INT */
442#define WM831X_IM_ON_PIN_INT 0x1000 /* IM_ON_PIN_INT */
443#define WM831X_IM_ON_PIN_INT_MASK 0x1000 /* IM_ON_PIN_INT */
444#define WM831X_IM_ON_PIN_INT_SHIFT 12 /* IM_ON_PIN_INT */
445#define WM831X_IM_ON_PIN_INT_WIDTH 1 /* IM_ON_PIN_INT */
446#define WM831X_IM_WDOG_INT 0x0800 /* IM_WDOG_INT */
447#define WM831X_IM_WDOG_INT_MASK 0x0800 /* IM_WDOG_INT */
448#define WM831X_IM_WDOG_INT_SHIFT 11 /* IM_WDOG_INT */
449#define WM831X_IM_WDOG_INT_WIDTH 1 /* IM_WDOG_INT */
450#define WM831X_IM_TCHDATA_INT 0x0400 /* IM_TCHDATA_INT */
451#define WM831X_IM_TCHDATA_INT_MASK 0x0400 /* IM_TCHDATA_INT */
452#define WM831X_IM_TCHDATA_INT_SHIFT 10 /* IM_TCHDATA_INT */
453#define WM831X_IM_TCHDATA_INT_WIDTH 1 /* IM_TCHDATA_INT */
454#define WM831X_IM_TCHPD_INT 0x0200 /* IM_TCHPD_INT */
455#define WM831X_IM_TCHPD_INT_MASK 0x0200 /* IM_TCHPD_INT */
456#define WM831X_IM_TCHPD_INT_SHIFT 9 /* IM_TCHPD_INT */
457#define WM831X_IM_TCHPD_INT_WIDTH 1 /* IM_TCHPD_INT */
458#define WM831X_IM_AUXADC_INT 0x0100 /* IM_AUXADC_INT */
459#define WM831X_IM_AUXADC_INT_MASK 0x0100 /* IM_AUXADC_INT */
460#define WM831X_IM_AUXADC_INT_SHIFT 8 /* IM_AUXADC_INT */
461#define WM831X_IM_AUXADC_INT_WIDTH 1 /* IM_AUXADC_INT */
462#define WM831X_IM_PPM_INT 0x0080 /* IM_PPM_INT */
463#define WM831X_IM_PPM_INT_MASK 0x0080 /* IM_PPM_INT */
464#define WM831X_IM_PPM_INT_SHIFT 7 /* IM_PPM_INT */
465#define WM831X_IM_PPM_INT_WIDTH 1 /* IM_PPM_INT */
466#define WM831X_IM_CS_INT 0x0040 /* IM_CS_INT */
467#define WM831X_IM_CS_INT_MASK 0x0040 /* IM_CS_INT */
468#define WM831X_IM_CS_INT_SHIFT 6 /* IM_CS_INT */
469#define WM831X_IM_CS_INT_WIDTH 1 /* IM_CS_INT */
470#define WM831X_IM_RTC_INT 0x0020 /* IM_RTC_INT */
471#define WM831X_IM_RTC_INT_MASK 0x0020 /* IM_RTC_INT */
472#define WM831X_IM_RTC_INT_SHIFT 5 /* IM_RTC_INT */
473#define WM831X_IM_RTC_INT_WIDTH 1 /* IM_RTC_INT */
474#define WM831X_IM_OTP_INT 0x0010 /* IM_OTP_INT */
475#define WM831X_IM_OTP_INT_MASK 0x0010 /* IM_OTP_INT */
476#define WM831X_IM_OTP_INT_SHIFT 4 /* IM_OTP_INT */
477#define WM831X_IM_OTP_INT_WIDTH 1 /* IM_OTP_INT */
478#define WM831X_IM_CHILD_INT 0x0008 /* IM_CHILD_INT */
479#define WM831X_IM_CHILD_INT_MASK 0x0008 /* IM_CHILD_INT */
480#define WM831X_IM_CHILD_INT_SHIFT 3 /* IM_CHILD_INT */
481#define WM831X_IM_CHILD_INT_WIDTH 1 /* IM_CHILD_INT */
482#define WM831X_IM_CHG_INT 0x0004 /* IM_CHG_INT */
483#define WM831X_IM_CHG_INT_MASK 0x0004 /* IM_CHG_INT */
484#define WM831X_IM_CHG_INT_SHIFT 2 /* IM_CHG_INT */
485#define WM831X_IM_CHG_INT_WIDTH 1 /* IM_CHG_INT */
486#define WM831X_IM_HC_INT 0x0002 /* IM_HC_INT */
487#define WM831X_IM_HC_INT_MASK 0x0002 /* IM_HC_INT */
488#define WM831X_IM_HC_INT_SHIFT 1 /* IM_HC_INT */
489#define WM831X_IM_HC_INT_WIDTH 1 /* IM_HC_INT */
490#define WM831X_IM_UV_INT 0x0001 /* IM_UV_INT */
491#define WM831X_IM_UV_INT_MASK 0x0001 /* IM_UV_INT */
492#define WM831X_IM_UV_INT_SHIFT 0 /* IM_UV_INT */
493#define WM831X_IM_UV_INT_WIDTH 1 /* IM_UV_INT */
494
495/*
496 * R16409 (0x4019) - Interrupt Status 1 Mask
497 */
498#define WM831X_IM_PPM_SYSLO_EINT 0x8000 /* IM_PPM_SYSLO_EINT */
499#define WM831X_IM_PPM_SYSLO_EINT_MASK 0x8000 /* IM_PPM_SYSLO_EINT */
500#define WM831X_IM_PPM_SYSLO_EINT_SHIFT 15 /* IM_PPM_SYSLO_EINT */
501#define WM831X_IM_PPM_SYSLO_EINT_WIDTH 1 /* IM_PPM_SYSLO_EINT */
502#define WM831X_IM_PPM_PWR_SRC_EINT 0x4000 /* IM_PPM_PWR_SRC_EINT */
503#define WM831X_IM_PPM_PWR_SRC_EINT_MASK 0x4000 /* IM_PPM_PWR_SRC_EINT */
504#define WM831X_IM_PPM_PWR_SRC_EINT_SHIFT 14 /* IM_PPM_PWR_SRC_EINT */
505#define WM831X_IM_PPM_PWR_SRC_EINT_WIDTH 1 /* IM_PPM_PWR_SRC_EINT */
506#define WM831X_IM_PPM_USB_CURR_EINT 0x2000 /* IM_PPM_USB_CURR_EINT */
507#define WM831X_IM_PPM_USB_CURR_EINT_MASK 0x2000 /* IM_PPM_USB_CURR_EINT */
508#define WM831X_IM_PPM_USB_CURR_EINT_SHIFT 13 /* IM_PPM_USB_CURR_EINT */
509#define WM831X_IM_PPM_USB_CURR_EINT_WIDTH 1 /* IM_PPM_USB_CURR_EINT */
510#define WM831X_IM_ON_PIN_EINT 0x1000 /* IM_ON_PIN_EINT */
511#define WM831X_IM_ON_PIN_EINT_MASK 0x1000 /* IM_ON_PIN_EINT */
512#define WM831X_IM_ON_PIN_EINT_SHIFT 12 /* IM_ON_PIN_EINT */
513#define WM831X_IM_ON_PIN_EINT_WIDTH 1 /* IM_ON_PIN_EINT */
514#define WM831X_IM_WDOG_TO_EINT 0x0800 /* IM_WDOG_TO_EINT */
515#define WM831X_IM_WDOG_TO_EINT_MASK 0x0800 /* IM_WDOG_TO_EINT */
516#define WM831X_IM_WDOG_TO_EINT_SHIFT 11 /* IM_WDOG_TO_EINT */
517#define WM831X_IM_WDOG_TO_EINT_WIDTH 1 /* IM_WDOG_TO_EINT */
518#define WM831X_IM_TCHDATA_EINT 0x0400 /* IM_TCHDATA_EINT */
519#define WM831X_IM_TCHDATA_EINT_MASK 0x0400 /* IM_TCHDATA_EINT */
520#define WM831X_IM_TCHDATA_EINT_SHIFT 10 /* IM_TCHDATA_EINT */
521#define WM831X_IM_TCHDATA_EINT_WIDTH 1 /* IM_TCHDATA_EINT */
522#define WM831X_IM_TCHPD_EINT 0x0200 /* IM_TCHPD_EINT */
523#define WM831X_IM_TCHPD_EINT_MASK 0x0200 /* IM_TCHPD_EINT */
524#define WM831X_IM_TCHPD_EINT_SHIFT 9 /* IM_TCHPD_EINT */
525#define WM831X_IM_TCHPD_EINT_WIDTH 1 /* IM_TCHPD_EINT */
526#define WM831X_IM_AUXADC_DATA_EINT 0x0100 /* IM_AUXADC_DATA_EINT */
527#define WM831X_IM_AUXADC_DATA_EINT_MASK 0x0100 /* IM_AUXADC_DATA_EINT */
528#define WM831X_IM_AUXADC_DATA_EINT_SHIFT 8 /* IM_AUXADC_DATA_EINT */
529#define WM831X_IM_AUXADC_DATA_EINT_WIDTH 1 /* IM_AUXADC_DATA_EINT */
530#define WM831X_IM_AUXADC_DCOMP4_EINT 0x0080 /* IM_AUXADC_DCOMP4_EINT */
531#define WM831X_IM_AUXADC_DCOMP4_EINT_MASK 0x0080 /* IM_AUXADC_DCOMP4_EINT */
532#define WM831X_IM_AUXADC_DCOMP4_EINT_SHIFT 7 /* IM_AUXADC_DCOMP4_EINT */
533#define WM831X_IM_AUXADC_DCOMP4_EINT_WIDTH 1 /* IM_AUXADC_DCOMP4_EINT */
534#define WM831X_IM_AUXADC_DCOMP3_EINT 0x0040 /* IM_AUXADC_DCOMP3_EINT */
535#define WM831X_IM_AUXADC_DCOMP3_EINT_MASK 0x0040 /* IM_AUXADC_DCOMP3_EINT */
536#define WM831X_IM_AUXADC_DCOMP3_EINT_SHIFT 6 /* IM_AUXADC_DCOMP3_EINT */
537#define WM831X_IM_AUXADC_DCOMP3_EINT_WIDTH 1 /* IM_AUXADC_DCOMP3_EINT */
538#define WM831X_IM_AUXADC_DCOMP2_EINT 0x0020 /* IM_AUXADC_DCOMP2_EINT */
539#define WM831X_IM_AUXADC_DCOMP2_EINT_MASK 0x0020 /* IM_AUXADC_DCOMP2_EINT */
540#define WM831X_IM_AUXADC_DCOMP2_EINT_SHIFT 5 /* IM_AUXADC_DCOMP2_EINT */
541#define WM831X_IM_AUXADC_DCOMP2_EINT_WIDTH 1 /* IM_AUXADC_DCOMP2_EINT */
542#define WM831X_IM_AUXADC_DCOMP1_EINT 0x0010 /* IM_AUXADC_DCOMP1_EINT */
543#define WM831X_IM_AUXADC_DCOMP1_EINT_MASK 0x0010 /* IM_AUXADC_DCOMP1_EINT */
544#define WM831X_IM_AUXADC_DCOMP1_EINT_SHIFT 4 /* IM_AUXADC_DCOMP1_EINT */
545#define WM831X_IM_AUXADC_DCOMP1_EINT_WIDTH 1 /* IM_AUXADC_DCOMP1_EINT */
546#define WM831X_IM_RTC_PER_EINT 0x0008 /* IM_RTC_PER_EINT */
547#define WM831X_IM_RTC_PER_EINT_MASK 0x0008 /* IM_RTC_PER_EINT */
548#define WM831X_IM_RTC_PER_EINT_SHIFT 3 /* IM_RTC_PER_EINT */
549#define WM831X_IM_RTC_PER_EINT_WIDTH 1 /* IM_RTC_PER_EINT */
550#define WM831X_IM_RTC_ALM_EINT 0x0004 /* IM_RTC_ALM_EINT */
551#define WM831X_IM_RTC_ALM_EINT_MASK 0x0004 /* IM_RTC_ALM_EINT */
552#define WM831X_IM_RTC_ALM_EINT_SHIFT 2 /* IM_RTC_ALM_EINT */
553#define WM831X_IM_RTC_ALM_EINT_WIDTH 1 /* IM_RTC_ALM_EINT */
554#define WM831X_IM_TEMP_THW_EINT 0x0002 /* IM_TEMP_THW_EINT */
555#define WM831X_IM_TEMP_THW_EINT_MASK 0x0002 /* IM_TEMP_THW_EINT */
556#define WM831X_IM_TEMP_THW_EINT_SHIFT 1 /* IM_TEMP_THW_EINT */
557#define WM831X_IM_TEMP_THW_EINT_WIDTH 1 /* IM_TEMP_THW_EINT */
558
559/*
560 * R16410 (0x401A) - Interrupt Status 2 Mask
561 */
562#define WM831X_IM_CHG_BATT_HOT_EINT 0x8000 /* IM_CHG_BATT_HOT_EINT */
563#define WM831X_IM_CHG_BATT_HOT_EINT_MASK 0x8000 /* IM_CHG_BATT_HOT_EINT */
564#define WM831X_IM_CHG_BATT_HOT_EINT_SHIFT 15 /* IM_CHG_BATT_HOT_EINT */
565#define WM831X_IM_CHG_BATT_HOT_EINT_WIDTH 1 /* IM_CHG_BATT_HOT_EINT */
566#define WM831X_IM_CHG_BATT_COLD_EINT 0x4000 /* IM_CHG_BATT_COLD_EINT */
567#define WM831X_IM_CHG_BATT_COLD_EINT_MASK 0x4000 /* IM_CHG_BATT_COLD_EINT */
568#define WM831X_IM_CHG_BATT_COLD_EINT_SHIFT 14 /* IM_CHG_BATT_COLD_EINT */
569#define WM831X_IM_CHG_BATT_COLD_EINT_WIDTH 1 /* IM_CHG_BATT_COLD_EINT */
570#define WM831X_IM_CHG_BATT_FAIL_EINT 0x2000 /* IM_CHG_BATT_FAIL_EINT */
571#define WM831X_IM_CHG_BATT_FAIL_EINT_MASK 0x2000 /* IM_CHG_BATT_FAIL_EINT */
572#define WM831X_IM_CHG_BATT_FAIL_EINT_SHIFT 13 /* IM_CHG_BATT_FAIL_EINT */
573#define WM831X_IM_CHG_BATT_FAIL_EINT_WIDTH 1 /* IM_CHG_BATT_FAIL_EINT */
574#define WM831X_IM_CHG_OV_EINT 0x1000 /* IM_CHG_OV_EINT */
575#define WM831X_IM_CHG_OV_EINT_MASK 0x1000 /* IM_CHG_OV_EINT */
576#define WM831X_IM_CHG_OV_EINT_SHIFT 12 /* IM_CHG_OV_EINT */
577#define WM831X_IM_CHG_OV_EINT_WIDTH 1 /* IM_CHG_OV_EINT */
578#define WM831X_IM_CHG_END_EINT 0x0800 /* IM_CHG_END_EINT */
579#define WM831X_IM_CHG_END_EINT_MASK 0x0800 /* IM_CHG_END_EINT */
580#define WM831X_IM_CHG_END_EINT_SHIFT 11 /* IM_CHG_END_EINT */
581#define WM831X_IM_CHG_END_EINT_WIDTH 1 /* IM_CHG_END_EINT */
582#define WM831X_IM_CHG_TO_EINT 0x0400 /* IM_CHG_TO_EINT */
583#define WM831X_IM_CHG_TO_EINT_MASK 0x0400 /* IM_CHG_TO_EINT */
584#define WM831X_IM_CHG_TO_EINT_SHIFT 10 /* IM_CHG_TO_EINT */
585#define WM831X_IM_CHG_TO_EINT_WIDTH 1 /* IM_CHG_TO_EINT */
586#define WM831X_IM_CHG_MODE_EINT 0x0200 /* IM_CHG_MODE_EINT */
587#define WM831X_IM_CHG_MODE_EINT_MASK 0x0200 /* IM_CHG_MODE_EINT */
588#define WM831X_IM_CHG_MODE_EINT_SHIFT 9 /* IM_CHG_MODE_EINT */
589#define WM831X_IM_CHG_MODE_EINT_WIDTH 1 /* IM_CHG_MODE_EINT */
590#define WM831X_IM_CHG_START_EINT 0x0100 /* IM_CHG_START_EINT */
591#define WM831X_IM_CHG_START_EINT_MASK 0x0100 /* IM_CHG_START_EINT */
592#define WM831X_IM_CHG_START_EINT_SHIFT 8 /* IM_CHG_START_EINT */
593#define WM831X_IM_CHG_START_EINT_WIDTH 1 /* IM_CHG_START_EINT */
594#define WM831X_IM_CS2_EINT 0x0080 /* IM_CS2_EINT */
595#define WM831X_IM_CS2_EINT_MASK 0x0080 /* IM_CS2_EINT */
596#define WM831X_IM_CS2_EINT_SHIFT 7 /* IM_CS2_EINT */
597#define WM831X_IM_CS2_EINT_WIDTH 1 /* IM_CS2_EINT */
598#define WM831X_IM_CS1_EINT 0x0040 /* IM_CS1_EINT */
599#define WM831X_IM_CS1_EINT_MASK 0x0040 /* IM_CS1_EINT */
600#define WM831X_IM_CS1_EINT_SHIFT 6 /* IM_CS1_EINT */
601#define WM831X_IM_CS1_EINT_WIDTH 1 /* IM_CS1_EINT */
602#define WM831X_IM_OTP_CMD_END_EINT 0x0020 /* IM_OTP_CMD_END_EINT */
603#define WM831X_IM_OTP_CMD_END_EINT_MASK 0x0020 /* IM_OTP_CMD_END_EINT */
604#define WM831X_IM_OTP_CMD_END_EINT_SHIFT 5 /* IM_OTP_CMD_END_EINT */
605#define WM831X_IM_OTP_CMD_END_EINT_WIDTH 1 /* IM_OTP_CMD_END_EINT */
606#define WM831X_IM_OTP_ERR_EINT 0x0010 /* IM_OTP_ERR_EINT */
607#define WM831X_IM_OTP_ERR_EINT_MASK 0x0010 /* IM_OTP_ERR_EINT */
608#define WM831X_IM_OTP_ERR_EINT_SHIFT 4 /* IM_OTP_ERR_EINT */
609#define WM831X_IM_OTP_ERR_EINT_WIDTH 1 /* IM_OTP_ERR_EINT */
610#define WM831X_IM_PS_POR_EINT 0x0004 /* IM_PS_POR_EINT */
611#define WM831X_IM_PS_POR_EINT_MASK 0x0004 /* IM_PS_POR_EINT */
612#define WM831X_IM_PS_POR_EINT_SHIFT 2 /* IM_PS_POR_EINT */
613#define WM831X_IM_PS_POR_EINT_WIDTH 1 /* IM_PS_POR_EINT */
614#define WM831X_IM_PS_SLEEP_OFF_EINT 0x0002 /* IM_PS_SLEEP_OFF_EINT */
615#define WM831X_IM_PS_SLEEP_OFF_EINT_MASK 0x0002 /* IM_PS_SLEEP_OFF_EINT */
616#define WM831X_IM_PS_SLEEP_OFF_EINT_SHIFT 1 /* IM_PS_SLEEP_OFF_EINT */
617#define WM831X_IM_PS_SLEEP_OFF_EINT_WIDTH 1 /* IM_PS_SLEEP_OFF_EINT */
618#define WM831X_IM_PS_ON_WAKE_EINT 0x0001 /* IM_PS_ON_WAKE_EINT */
619#define WM831X_IM_PS_ON_WAKE_EINT_MASK 0x0001 /* IM_PS_ON_WAKE_EINT */
620#define WM831X_IM_PS_ON_WAKE_EINT_SHIFT 0 /* IM_PS_ON_WAKE_EINT */
621#define WM831X_IM_PS_ON_WAKE_EINT_WIDTH 1 /* IM_PS_ON_WAKE_EINT */
622
623/*
624 * R16411 (0x401B) - Interrupt Status 3 Mask
625 */
626#define WM831X_IM_UV_LDO10_EINT 0x0200 /* IM_UV_LDO10_EINT */
627#define WM831X_IM_UV_LDO10_EINT_MASK 0x0200 /* IM_UV_LDO10_EINT */
628#define WM831X_IM_UV_LDO10_EINT_SHIFT 9 /* IM_UV_LDO10_EINT */
629#define WM831X_IM_UV_LDO10_EINT_WIDTH 1 /* IM_UV_LDO10_EINT */
630#define WM831X_IM_UV_LDO9_EINT 0x0100 /* IM_UV_LDO9_EINT */
631#define WM831X_IM_UV_LDO9_EINT_MASK 0x0100 /* IM_UV_LDO9_EINT */
632#define WM831X_IM_UV_LDO9_EINT_SHIFT 8 /* IM_UV_LDO9_EINT */
633#define WM831X_IM_UV_LDO9_EINT_WIDTH 1 /* IM_UV_LDO9_EINT */
634#define WM831X_IM_UV_LDO8_EINT 0x0080 /* IM_UV_LDO8_EINT */
635#define WM831X_IM_UV_LDO8_EINT_MASK 0x0080 /* IM_UV_LDO8_EINT */
636#define WM831X_IM_UV_LDO8_EINT_SHIFT 7 /* IM_UV_LDO8_EINT */
637#define WM831X_IM_UV_LDO8_EINT_WIDTH 1 /* IM_UV_LDO8_EINT */
638#define WM831X_IM_UV_LDO7_EINT 0x0040 /* IM_UV_LDO7_EINT */
639#define WM831X_IM_UV_LDO7_EINT_MASK 0x0040 /* IM_UV_LDO7_EINT */
640#define WM831X_IM_UV_LDO7_EINT_SHIFT 6 /* IM_UV_LDO7_EINT */
641#define WM831X_IM_UV_LDO7_EINT_WIDTH 1 /* IM_UV_LDO7_EINT */
642#define WM831X_IM_UV_LDO6_EINT 0x0020 /* IM_UV_LDO6_EINT */
643#define WM831X_IM_UV_LDO6_EINT_MASK 0x0020 /* IM_UV_LDO6_EINT */
644#define WM831X_IM_UV_LDO6_EINT_SHIFT 5 /* IM_UV_LDO6_EINT */
645#define WM831X_IM_UV_LDO6_EINT_WIDTH 1 /* IM_UV_LDO6_EINT */
646#define WM831X_IM_UV_LDO5_EINT 0x0010 /* IM_UV_LDO5_EINT */
647#define WM831X_IM_UV_LDO5_EINT_MASK 0x0010 /* IM_UV_LDO5_EINT */
648#define WM831X_IM_UV_LDO5_EINT_SHIFT 4 /* IM_UV_LDO5_EINT */
649#define WM831X_IM_UV_LDO5_EINT_WIDTH 1 /* IM_UV_LDO5_EINT */
650#define WM831X_IM_UV_LDO4_EINT 0x0008 /* IM_UV_LDO4_EINT */
651#define WM831X_IM_UV_LDO4_EINT_MASK 0x0008 /* IM_UV_LDO4_EINT */
652#define WM831X_IM_UV_LDO4_EINT_SHIFT 3 /* IM_UV_LDO4_EINT */
653#define WM831X_IM_UV_LDO4_EINT_WIDTH 1 /* IM_UV_LDO4_EINT */
654#define WM831X_IM_UV_LDO3_EINT 0x0004 /* IM_UV_LDO3_EINT */
655#define WM831X_IM_UV_LDO3_EINT_MASK 0x0004 /* IM_UV_LDO3_EINT */
656#define WM831X_IM_UV_LDO3_EINT_SHIFT 2 /* IM_UV_LDO3_EINT */
657#define WM831X_IM_UV_LDO3_EINT_WIDTH 1 /* IM_UV_LDO3_EINT */
658#define WM831X_IM_UV_LDO2_EINT 0x0002 /* IM_UV_LDO2_EINT */
659#define WM831X_IM_UV_LDO2_EINT_MASK 0x0002 /* IM_UV_LDO2_EINT */
660#define WM831X_IM_UV_LDO2_EINT_SHIFT 1 /* IM_UV_LDO2_EINT */
661#define WM831X_IM_UV_LDO2_EINT_WIDTH 1 /* IM_UV_LDO2_EINT */
662#define WM831X_IM_UV_LDO1_EINT 0x0001 /* IM_UV_LDO1_EINT */
663#define WM831X_IM_UV_LDO1_EINT_MASK 0x0001 /* IM_UV_LDO1_EINT */
664#define WM831X_IM_UV_LDO1_EINT_SHIFT 0 /* IM_UV_LDO1_EINT */
665#define WM831X_IM_UV_LDO1_EINT_WIDTH 1 /* IM_UV_LDO1_EINT */
666
667/*
668 * R16412 (0x401C) - Interrupt Status 4 Mask
669 */
670#define WM831X_IM_HC_DC2_EINT 0x0200 /* IM_HC_DC2_EINT */
671#define WM831X_IM_HC_DC2_EINT_MASK 0x0200 /* IM_HC_DC2_EINT */
672#define WM831X_IM_HC_DC2_EINT_SHIFT 9 /* IM_HC_DC2_EINT */
673#define WM831X_IM_HC_DC2_EINT_WIDTH 1 /* IM_HC_DC2_EINT */
674#define WM831X_IM_HC_DC1_EINT 0x0100 /* IM_HC_DC1_EINT */
675#define WM831X_IM_HC_DC1_EINT_MASK 0x0100 /* IM_HC_DC1_EINT */
676#define WM831X_IM_HC_DC1_EINT_SHIFT 8 /* IM_HC_DC1_EINT */
677#define WM831X_IM_HC_DC1_EINT_WIDTH 1 /* IM_HC_DC1_EINT */
678#define WM831X_IM_UV_DC4_EINT 0x0008 /* IM_UV_DC4_EINT */
679#define WM831X_IM_UV_DC4_EINT_MASK 0x0008 /* IM_UV_DC4_EINT */
680#define WM831X_IM_UV_DC4_EINT_SHIFT 3 /* IM_UV_DC4_EINT */
681#define WM831X_IM_UV_DC4_EINT_WIDTH 1 /* IM_UV_DC4_EINT */
682#define WM831X_IM_UV_DC3_EINT 0x0004 /* IM_UV_DC3_EINT */
683#define WM831X_IM_UV_DC3_EINT_MASK 0x0004 /* IM_UV_DC3_EINT */
684#define WM831X_IM_UV_DC3_EINT_SHIFT 2 /* IM_UV_DC3_EINT */
685#define WM831X_IM_UV_DC3_EINT_WIDTH 1 /* IM_UV_DC3_EINT */
686#define WM831X_IM_UV_DC2_EINT 0x0002 /* IM_UV_DC2_EINT */
687#define WM831X_IM_UV_DC2_EINT_MASK 0x0002 /* IM_UV_DC2_EINT */
688#define WM831X_IM_UV_DC2_EINT_SHIFT 1 /* IM_UV_DC2_EINT */
689#define WM831X_IM_UV_DC2_EINT_WIDTH 1 /* IM_UV_DC2_EINT */
690#define WM831X_IM_UV_DC1_EINT 0x0001 /* IM_UV_DC1_EINT */
691#define WM831X_IM_UV_DC1_EINT_MASK 0x0001 /* IM_UV_DC1_EINT */
692#define WM831X_IM_UV_DC1_EINT_SHIFT 0 /* IM_UV_DC1_EINT */
693#define WM831X_IM_UV_DC1_EINT_WIDTH 1 /* IM_UV_DC1_EINT */
694
695/*
696 * R16413 (0x401D) - Interrupt Status 5 Mask
697 */
698#define WM831X_IM_GP16_EINT 0x8000 /* IM_GP16_EINT */
699#define WM831X_IM_GP16_EINT_MASK 0x8000 /* IM_GP16_EINT */
700#define WM831X_IM_GP16_EINT_SHIFT 15 /* IM_GP16_EINT */
701#define WM831X_IM_GP16_EINT_WIDTH 1 /* IM_GP16_EINT */
702#define WM831X_IM_GP15_EINT 0x4000 /* IM_GP15_EINT */
703#define WM831X_IM_GP15_EINT_MASK 0x4000 /* IM_GP15_EINT */
704#define WM831X_IM_GP15_EINT_SHIFT 14 /* IM_GP15_EINT */
705#define WM831X_IM_GP15_EINT_WIDTH 1 /* IM_GP15_EINT */
706#define WM831X_IM_GP14_EINT 0x2000 /* IM_GP14_EINT */
707#define WM831X_IM_GP14_EINT_MASK 0x2000 /* IM_GP14_EINT */
708#define WM831X_IM_GP14_EINT_SHIFT 13 /* IM_GP14_EINT */
709#define WM831X_IM_GP14_EINT_WIDTH 1 /* IM_GP14_EINT */
710#define WM831X_IM_GP13_EINT 0x1000 /* IM_GP13_EINT */
711#define WM831X_IM_GP13_EINT_MASK 0x1000 /* IM_GP13_EINT */
712#define WM831X_IM_GP13_EINT_SHIFT 12 /* IM_GP13_EINT */
713#define WM831X_IM_GP13_EINT_WIDTH 1 /* IM_GP13_EINT */
714#define WM831X_IM_GP12_EINT 0x0800 /* IM_GP12_EINT */
715#define WM831X_IM_GP12_EINT_MASK 0x0800 /* IM_GP12_EINT */
716#define WM831X_IM_GP12_EINT_SHIFT 11 /* IM_GP12_EINT */
717#define WM831X_IM_GP12_EINT_WIDTH 1 /* IM_GP12_EINT */
718#define WM831X_IM_GP11_EINT 0x0400 /* IM_GP11_EINT */
719#define WM831X_IM_GP11_EINT_MASK 0x0400 /* IM_GP11_EINT */
720#define WM831X_IM_GP11_EINT_SHIFT 10 /* IM_GP11_EINT */
721#define WM831X_IM_GP11_EINT_WIDTH 1 /* IM_GP11_EINT */
722#define WM831X_IM_GP10_EINT 0x0200 /* IM_GP10_EINT */
723#define WM831X_IM_GP10_EINT_MASK 0x0200 /* IM_GP10_EINT */
724#define WM831X_IM_GP10_EINT_SHIFT 9 /* IM_GP10_EINT */
725#define WM831X_IM_GP10_EINT_WIDTH 1 /* IM_GP10_EINT */
726#define WM831X_IM_GP9_EINT 0x0100 /* IM_GP9_EINT */
727#define WM831X_IM_GP9_EINT_MASK 0x0100 /* IM_GP9_EINT */
728#define WM831X_IM_GP9_EINT_SHIFT 8 /* IM_GP9_EINT */
729#define WM831X_IM_GP9_EINT_WIDTH 1 /* IM_GP9_EINT */
730#define WM831X_IM_GP8_EINT 0x0080 /* IM_GP8_EINT */
731#define WM831X_IM_GP8_EINT_MASK 0x0080 /* IM_GP8_EINT */
732#define WM831X_IM_GP8_EINT_SHIFT 7 /* IM_GP8_EINT */
733#define WM831X_IM_GP8_EINT_WIDTH 1 /* IM_GP8_EINT */
734#define WM831X_IM_GP7_EINT 0x0040 /* IM_GP7_EINT */
735#define WM831X_IM_GP7_EINT_MASK 0x0040 /* IM_GP7_EINT */
736#define WM831X_IM_GP7_EINT_SHIFT 6 /* IM_GP7_EINT */
737#define WM831X_IM_GP7_EINT_WIDTH 1 /* IM_GP7_EINT */
738#define WM831X_IM_GP6_EINT 0x0020 /* IM_GP6_EINT */
739#define WM831X_IM_GP6_EINT_MASK 0x0020 /* IM_GP6_EINT */
740#define WM831X_IM_GP6_EINT_SHIFT 5 /* IM_GP6_EINT */
741#define WM831X_IM_GP6_EINT_WIDTH 1 /* IM_GP6_EINT */
742#define WM831X_IM_GP5_EINT 0x0010 /* IM_GP5_EINT */
743#define WM831X_IM_GP5_EINT_MASK 0x0010 /* IM_GP5_EINT */
744#define WM831X_IM_GP5_EINT_SHIFT 4 /* IM_GP5_EINT */
745#define WM831X_IM_GP5_EINT_WIDTH 1 /* IM_GP5_EINT */
746#define WM831X_IM_GP4_EINT 0x0008 /* IM_GP4_EINT */
747#define WM831X_IM_GP4_EINT_MASK 0x0008 /* IM_GP4_EINT */
748#define WM831X_IM_GP4_EINT_SHIFT 3 /* IM_GP4_EINT */
749#define WM831X_IM_GP4_EINT_WIDTH 1 /* IM_GP4_EINT */
750#define WM831X_IM_GP3_EINT 0x0004 /* IM_GP3_EINT */
751#define WM831X_IM_GP3_EINT_MASK 0x0004 /* IM_GP3_EINT */
752#define WM831X_IM_GP3_EINT_SHIFT 2 /* IM_GP3_EINT */
753#define WM831X_IM_GP3_EINT_WIDTH 1 /* IM_GP3_EINT */
754#define WM831X_IM_GP2_EINT 0x0002 /* IM_GP2_EINT */
755#define WM831X_IM_GP2_EINT_MASK 0x0002 /* IM_GP2_EINT */
756#define WM831X_IM_GP2_EINT_SHIFT 1 /* IM_GP2_EINT */
757#define WM831X_IM_GP2_EINT_WIDTH 1 /* IM_GP2_EINT */
758#define WM831X_IM_GP1_EINT 0x0001 /* IM_GP1_EINT */
759#define WM831X_IM_GP1_EINT_MASK 0x0001 /* IM_GP1_EINT */
760#define WM831X_IM_GP1_EINT_SHIFT 0 /* IM_GP1_EINT */
761#define WM831X_IM_GP1_EINT_WIDTH 1 /* IM_GP1_EINT */
762
763
764#endif
diff --git a/include/linux/mfd/wm831x/otp.h b/include/linux/mfd/wm831x/otp.h
new file mode 100644
index 000000000000..ce1f81a39bfc
--- /dev/null
+++ b/include/linux/mfd/wm831x/otp.h
@@ -0,0 +1,162 @@
1/*
2 * include/linux/mfd/wm831x/otp.h -- OTP interface for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_OTP_H__
16#define __MFD_WM831X_OTP_H__
17
18int wm831x_otp_init(struct wm831x *wm831x);
19void wm831x_otp_exit(struct wm831x *wm831x);
20
21/*
22 * R30720 (0x7800) - Unique ID 1
23 */
24#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
25#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
26#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
27
28/*
29 * R30721 (0x7801) - Unique ID 2
30 */
31#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
32#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
33#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
34
35/*
36 * R30722 (0x7802) - Unique ID 3
37 */
38#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
39#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
40#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
41
42/*
43 * R30723 (0x7803) - Unique ID 4
44 */
45#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
46#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
47#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
48
49/*
50 * R30724 (0x7804) - Unique ID 5
51 */
52#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
53#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
54#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
55
56/*
57 * R30725 (0x7805) - Unique ID 6
58 */
59#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
60#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
61#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
62
63/*
64 * R30726 (0x7806) - Unique ID 7
65 */
66#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
67#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
68#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
69
70/*
71 * R30727 (0x7807) - Unique ID 8
72 */
73#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
74#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
75#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
76
77/*
78 * R30728 (0x7808) - Factory OTP ID
79 */
80#define WM831X_OTP_FACT_ID_MASK 0xFFFE /* OTP_FACT_ID - [15:1] */
81#define WM831X_OTP_FACT_ID_SHIFT 1 /* OTP_FACT_ID - [15:1] */
82#define WM831X_OTP_FACT_ID_WIDTH 15 /* OTP_FACT_ID - [15:1] */
83#define WM831X_OTP_FACT_FINAL 0x0001 /* OTP_FACT_FINAL */
84#define WM831X_OTP_FACT_FINAL_MASK 0x0001 /* OTP_FACT_FINAL */
85#define WM831X_OTP_FACT_FINAL_SHIFT 0 /* OTP_FACT_FINAL */
86#define WM831X_OTP_FACT_FINAL_WIDTH 1 /* OTP_FACT_FINAL */
87
88/*
89 * R30729 (0x7809) - Factory OTP 1
90 */
91#define WM831X_DC3_TRIM_MASK 0xF000 /* DC3_TRIM - [15:12] */
92#define WM831X_DC3_TRIM_SHIFT 12 /* DC3_TRIM - [15:12] */
93#define WM831X_DC3_TRIM_WIDTH 4 /* DC3_TRIM - [15:12] */
94#define WM831X_DC2_TRIM_MASK 0x0FC0 /* DC2_TRIM - [11:6] */
95#define WM831X_DC2_TRIM_SHIFT 6 /* DC2_TRIM - [11:6] */
96#define WM831X_DC2_TRIM_WIDTH 6 /* DC2_TRIM - [11:6] */
97#define WM831X_DC1_TRIM_MASK 0x003F /* DC1_TRIM - [5:0] */
98#define WM831X_DC1_TRIM_SHIFT 0 /* DC1_TRIM - [5:0] */
99#define WM831X_DC1_TRIM_WIDTH 6 /* DC1_TRIM - [5:0] */
100
101/*
102 * R30730 (0x780A) - Factory OTP 2
103 */
104#define WM831X_CHIP_ID_MASK 0xFFFF /* CHIP_ID - [15:0] */
105#define WM831X_CHIP_ID_SHIFT 0 /* CHIP_ID - [15:0] */
106#define WM831X_CHIP_ID_WIDTH 16 /* CHIP_ID - [15:0] */
107
108/*
109 * R30731 (0x780B) - Factory OTP 3
110 */
111#define WM831X_OSC_TRIM_MASK 0x0780 /* OSC_TRIM - [10:7] */
112#define WM831X_OSC_TRIM_SHIFT 7 /* OSC_TRIM - [10:7] */
113#define WM831X_OSC_TRIM_WIDTH 4 /* OSC_TRIM - [10:7] */
114#define WM831X_BG_TRIM_MASK 0x0078 /* BG_TRIM - [6:3] */
115#define WM831X_BG_TRIM_SHIFT 3 /* BG_TRIM - [6:3] */
116#define WM831X_BG_TRIM_WIDTH 4 /* BG_TRIM - [6:3] */
117#define WM831X_LPBG_TRIM_MASK 0x0007 /* LPBG_TRIM - [2:0] */
118#define WM831X_LPBG_TRIM_SHIFT 0 /* LPBG_TRIM - [2:0] */
119#define WM831X_LPBG_TRIM_WIDTH 3 /* LPBG_TRIM - [2:0] */
120
121/*
122 * R30732 (0x780C) - Factory OTP 4
123 */
124#define WM831X_CHILD_I2C_ADDR_MASK 0x00FE /* CHILD_I2C_ADDR - [7:1] */
125#define WM831X_CHILD_I2C_ADDR_SHIFT 1 /* CHILD_I2C_ADDR - [7:1] */
126#define WM831X_CHILD_I2C_ADDR_WIDTH 7 /* CHILD_I2C_ADDR - [7:1] */
127#define WM831X_CH_AW 0x0001 /* CH_AW */
128#define WM831X_CH_AW_MASK 0x0001 /* CH_AW */
129#define WM831X_CH_AW_SHIFT 0 /* CH_AW */
130#define WM831X_CH_AW_WIDTH 1 /* CH_AW */
131
132/*
133 * R30733 (0x780D) - Factory OTP 5
134 */
135#define WM831X_CHARGE_TRIM_MASK 0x003F /* CHARGE_TRIM - [5:0] */
136#define WM831X_CHARGE_TRIM_SHIFT 0 /* CHARGE_TRIM - [5:0] */
137#define WM831X_CHARGE_TRIM_WIDTH 6 /* CHARGE_TRIM - [5:0] */
138
139/*
140 * R30736 (0x7810) - Customer OTP ID
141 */
142#define WM831X_OTP_AUTO_PROG 0x8000 /* OTP_AUTO_PROG */
143#define WM831X_OTP_AUTO_PROG_MASK 0x8000 /* OTP_AUTO_PROG */
144#define WM831X_OTP_AUTO_PROG_SHIFT 15 /* OTP_AUTO_PROG */
145#define WM831X_OTP_AUTO_PROG_WIDTH 1 /* OTP_AUTO_PROG */
146#define WM831X_OTP_CUST_ID_MASK 0x7FFE /* OTP_CUST_ID - [14:1] */
147#define WM831X_OTP_CUST_ID_SHIFT 1 /* OTP_CUST_ID - [14:1] */
148#define WM831X_OTP_CUST_ID_WIDTH 14 /* OTP_CUST_ID - [14:1] */
149#define WM831X_OTP_CUST_FINAL 0x0001 /* OTP_CUST_FINAL */
150#define WM831X_OTP_CUST_FINAL_MASK 0x0001 /* OTP_CUST_FINAL */
151#define WM831X_OTP_CUST_FINAL_SHIFT 0 /* OTP_CUST_FINAL */
152#define WM831X_OTP_CUST_FINAL_WIDTH 1 /* OTP_CUST_FINAL */
153
154/*
155 * R30759 (0x7827) - DBE CHECK DATA
156 */
157#define WM831X_DBE_VALID_DATA_MASK 0xFFFF /* DBE_VALID_DATA - [15:0] */
158#define WM831X_DBE_VALID_DATA_SHIFT 0 /* DBE_VALID_DATA - [15:0] */
159#define WM831X_DBE_VALID_DATA_WIDTH 16 /* DBE_VALID_DATA - [15:0] */
160
161
162#endif
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h
new file mode 100644
index 000000000000..90d820260aad
--- /dev/null
+++ b/include/linux/mfd/wm831x/pdata.h
@@ -0,0 +1,113 @@
1/*
2 * include/linux/mfd/wm831x/pdata.h -- Platform data for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_PDATA_H__
16#define __MFD_WM831X_PDATA_H__
17
18struct wm831x;
19struct regulator_init_data;
20
21struct wm831x_backlight_pdata {
22 int isink; /** ISINK to use, 1 or 2 */
23 int max_uA; /** Maximum current to allow */
24};
25
26struct wm831x_backup_pdata {
27 int charger_enable;
28 int no_constant_voltage; /** Disable constant voltage charging */
29 int vlim; /** Voltage limit in milivolts */
30 int ilim; /** Current limit in microamps */
31};
32
33struct wm831x_battery_pdata {
34 int enable; /** Enable charging */
35 int fast_enable; /** Enable fast charging */
36 int off_mask; /** Mask OFF while charging */
37 int trickle_ilim; /** Trickle charge current limit, in mA */
38 int vsel; /** Target voltage, in mV */
39 int eoc_iterm; /** End of trickle charge current, in mA */
40 int fast_ilim; /** Fast charge current limit, in mA */
41 int timeout; /** Charge cycle timeout, in minutes */
42};
43
44/* Sources for status LED configuration. Values are register values
45 * plus 1 to allow for a zero default for preserve.
46 */
47enum wm831x_status_src {
48 WM831X_STATUS_PRESERVE = 0, /* Keep the current hardware setting */
49 WM831X_STATUS_OTP = 1,
50 WM831X_STATUS_POWER = 2,
51 WM831X_STATUS_CHARGER = 3,
52 WM831X_STATUS_MANUAL = 4,
53};
54
55struct wm831x_status_pdata {
56 enum wm831x_status_src default_src;
57 const char *name;
58 const char *default_trigger;
59};
60
61struct wm831x_touch_pdata {
62 int fivewire; /** 1 for five wire mode, 0 for 4 wire */
63 int isel; /** Current for pen down (uA) */
64 int rpu; /** Pen down sensitivity resistor divider */
65 int pressure; /** Report pressure (boolean) */
66 int data_irq; /** Touch data ready IRQ */
67};
68
69enum wm831x_watchdog_action {
70 WM831X_WDOG_NONE = 0,
71 WM831X_WDOG_INTERRUPT = 1,
72 WM831X_WDOG_RESET = 2,
73 WM831X_WDOG_WAKE = 3,
74};
75
76struct wm831x_watchdog_pdata {
77 enum wm831x_watchdog_action primary, secondary;
78 int update_gpio;
79 unsigned int software:1;
80};
81
82#define WM831X_MAX_STATUS 2
83#define WM831X_MAX_DCDC 4
84#define WM831X_MAX_EPE 2
85#define WM831X_MAX_LDO 11
86#define WM831X_MAX_ISINK 2
87
88struct wm831x_pdata {
89 /** Called before subdevices are set up */
90 int (*pre_init)(struct wm831x *wm831x);
91 /** Called after subdevices are set up */
92 int (*post_init)(struct wm831x *wm831x);
93
94 int gpio_base;
95 struct wm831x_backlight_pdata *backlight;
96 struct wm831x_backup_pdata *backup;
97 struct wm831x_battery_pdata *battery;
98 struct wm831x_touch_pdata *touch;
99 struct wm831x_watchdog_pdata *watchdog;
100
101 /** LED1 = 0 and so on */
102 struct wm831x_status_pdata *status[WM831X_MAX_STATUS];
103 /** DCDC1 = 0 and so on */
104 struct regulator_init_data *dcdc[WM831X_MAX_DCDC];
105 /** EPE1 = 0 and so on */
106 struct regulator_init_data *epe[WM831X_MAX_EPE];
107 /** LDO1 = 0 and so on */
108 struct regulator_init_data *ldo[WM831X_MAX_LDO];
109 /** ISINK1 = 0 and so on*/
110 struct regulator_init_data *isink[WM831X_MAX_ISINK];
111};
112
113#endif
diff --git a/include/linux/mfd/wm831x/pmu.h b/include/linux/mfd/wm831x/pmu.h
new file mode 100644
index 000000000000..b18cbb027bc3
--- /dev/null
+++ b/include/linux/mfd/wm831x/pmu.h
@@ -0,0 +1,189 @@
1/*
2 * include/linux/mfd/wm831x/pmu.h -- PMU for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_PMU_H__
16#define __MFD_WM831X_PMU_H__
17
18/*
19 * R16387 (0x4003) - Power State
20 */
21#define WM831X_CHIP_ON 0x8000 /* CHIP_ON */
22#define WM831X_CHIP_ON_MASK 0x8000 /* CHIP_ON */
23#define WM831X_CHIP_ON_SHIFT 15 /* CHIP_ON */
24#define WM831X_CHIP_ON_WIDTH 1 /* CHIP_ON */
25#define WM831X_CHIP_SLP 0x4000 /* CHIP_SLP */
26#define WM831X_CHIP_SLP_MASK 0x4000 /* CHIP_SLP */
27#define WM831X_CHIP_SLP_SHIFT 14 /* CHIP_SLP */
28#define WM831X_CHIP_SLP_WIDTH 1 /* CHIP_SLP */
29#define WM831X_REF_LP 0x1000 /* REF_LP */
30#define WM831X_REF_LP_MASK 0x1000 /* REF_LP */
31#define WM831X_REF_LP_SHIFT 12 /* REF_LP */
32#define WM831X_REF_LP_WIDTH 1 /* REF_LP */
33#define WM831X_PWRSTATE_DLY_MASK 0x0C00 /* PWRSTATE_DLY - [11:10] */
34#define WM831X_PWRSTATE_DLY_SHIFT 10 /* PWRSTATE_DLY - [11:10] */
35#define WM831X_PWRSTATE_DLY_WIDTH 2 /* PWRSTATE_DLY - [11:10] */
36#define WM831X_SWRST_DLY 0x0200 /* SWRST_DLY */
37#define WM831X_SWRST_DLY_MASK 0x0200 /* SWRST_DLY */
38#define WM831X_SWRST_DLY_SHIFT 9 /* SWRST_DLY */
39#define WM831X_SWRST_DLY_WIDTH 1 /* SWRST_DLY */
40#define WM831X_USB100MA_STARTUP_MASK 0x0030 /* USB100MA_STARTUP - [5:4] */
41#define WM831X_USB100MA_STARTUP_SHIFT 4 /* USB100MA_STARTUP - [5:4] */
42#define WM831X_USB100MA_STARTUP_WIDTH 2 /* USB100MA_STARTUP - [5:4] */
43#define WM831X_USB_CURR_STS 0x0008 /* USB_CURR_STS */
44#define WM831X_USB_CURR_STS_MASK 0x0008 /* USB_CURR_STS */
45#define WM831X_USB_CURR_STS_SHIFT 3 /* USB_CURR_STS */
46#define WM831X_USB_CURR_STS_WIDTH 1 /* USB_CURR_STS */
47#define WM831X_USB_ILIM_MASK 0x0007 /* USB_ILIM - [2:0] */
48#define WM831X_USB_ILIM_SHIFT 0 /* USB_ILIM - [2:0] */
49#define WM831X_USB_ILIM_WIDTH 3 /* USB_ILIM - [2:0] */
50
51/*
52 * R16397 (0x400D) - System Status
53 */
54#define WM831X_THW_STS 0x8000 /* THW_STS */
55#define WM831X_THW_STS_MASK 0x8000 /* THW_STS */
56#define WM831X_THW_STS_SHIFT 15 /* THW_STS */
57#define WM831X_THW_STS_WIDTH 1 /* THW_STS */
58#define WM831X_PWR_SRC_BATT 0x0400 /* PWR_SRC_BATT */
59#define WM831X_PWR_SRC_BATT_MASK 0x0400 /* PWR_SRC_BATT */
60#define WM831X_PWR_SRC_BATT_SHIFT 10 /* PWR_SRC_BATT */
61#define WM831X_PWR_SRC_BATT_WIDTH 1 /* PWR_SRC_BATT */
62#define WM831X_PWR_WALL 0x0200 /* PWR_WALL */
63#define WM831X_PWR_WALL_MASK 0x0200 /* PWR_WALL */
64#define WM831X_PWR_WALL_SHIFT 9 /* PWR_WALL */
65#define WM831X_PWR_WALL_WIDTH 1 /* PWR_WALL */
66#define WM831X_PWR_USB 0x0100 /* PWR_USB */
67#define WM831X_PWR_USB_MASK 0x0100 /* PWR_USB */
68#define WM831X_PWR_USB_SHIFT 8 /* PWR_USB */
69#define WM831X_PWR_USB_WIDTH 1 /* PWR_USB */
70#define WM831X_MAIN_STATE_MASK 0x001F /* MAIN_STATE - [4:0] */
71#define WM831X_MAIN_STATE_SHIFT 0 /* MAIN_STATE - [4:0] */
72#define WM831X_MAIN_STATE_WIDTH 5 /* MAIN_STATE - [4:0] */
73
74/*
75 * R16456 (0x4048) - Charger Control 1
76 */
77#define WM831X_CHG_ENA 0x8000 /* CHG_ENA */
78#define WM831X_CHG_ENA_MASK 0x8000 /* CHG_ENA */
79#define WM831X_CHG_ENA_SHIFT 15 /* CHG_ENA */
80#define WM831X_CHG_ENA_WIDTH 1 /* CHG_ENA */
81#define WM831X_CHG_FRC 0x4000 /* CHG_FRC */
82#define WM831X_CHG_FRC_MASK 0x4000 /* CHG_FRC */
83#define WM831X_CHG_FRC_SHIFT 14 /* CHG_FRC */
84#define WM831X_CHG_FRC_WIDTH 1 /* CHG_FRC */
85#define WM831X_CHG_ITERM_MASK 0x1C00 /* CHG_ITERM - [12:10] */
86#define WM831X_CHG_ITERM_SHIFT 10 /* CHG_ITERM - [12:10] */
87#define WM831X_CHG_ITERM_WIDTH 3 /* CHG_ITERM - [12:10] */
88#define WM831X_CHG_FAST 0x0020 /* CHG_FAST */
89#define WM831X_CHG_FAST_MASK 0x0020 /* CHG_FAST */
90#define WM831X_CHG_FAST_SHIFT 5 /* CHG_FAST */
91#define WM831X_CHG_FAST_WIDTH 1 /* CHG_FAST */
92#define WM831X_CHG_IMON_ENA 0x0002 /* CHG_IMON_ENA */
93#define WM831X_CHG_IMON_ENA_MASK 0x0002 /* CHG_IMON_ENA */
94#define WM831X_CHG_IMON_ENA_SHIFT 1 /* CHG_IMON_ENA */
95#define WM831X_CHG_IMON_ENA_WIDTH 1 /* CHG_IMON_ENA */
96#define WM831X_CHG_CHIP_TEMP_MON 0x0001 /* CHG_CHIP_TEMP_MON */
97#define WM831X_CHG_CHIP_TEMP_MON_MASK 0x0001 /* CHG_CHIP_TEMP_MON */
98#define WM831X_CHG_CHIP_TEMP_MON_SHIFT 0 /* CHG_CHIP_TEMP_MON */
99#define WM831X_CHG_CHIP_TEMP_MON_WIDTH 1 /* CHG_CHIP_TEMP_MON */
100
101/*
102 * R16457 (0x4049) - Charger Control 2
103 */
104#define WM831X_CHG_OFF_MSK 0x4000 /* CHG_OFF_MSK */
105#define WM831X_CHG_OFF_MSK_MASK 0x4000 /* CHG_OFF_MSK */
106#define WM831X_CHG_OFF_MSK_SHIFT 14 /* CHG_OFF_MSK */
107#define WM831X_CHG_OFF_MSK_WIDTH 1 /* CHG_OFF_MSK */
108#define WM831X_CHG_TIME_MASK 0x0F00 /* CHG_TIME - [11:8] */
109#define WM831X_CHG_TIME_SHIFT 8 /* CHG_TIME - [11:8] */
110#define WM831X_CHG_TIME_WIDTH 4 /* CHG_TIME - [11:8] */
111#define WM831X_CHG_TRKL_ILIM_MASK 0x00C0 /* CHG_TRKL_ILIM - [7:6] */
112#define WM831X_CHG_TRKL_ILIM_SHIFT 6 /* CHG_TRKL_ILIM - [7:6] */
113#define WM831X_CHG_TRKL_ILIM_WIDTH 2 /* CHG_TRKL_ILIM - [7:6] */
114#define WM831X_CHG_VSEL_MASK 0x0030 /* CHG_VSEL - [5:4] */
115#define WM831X_CHG_VSEL_SHIFT 4 /* CHG_VSEL - [5:4] */
116#define WM831X_CHG_VSEL_WIDTH 2 /* CHG_VSEL - [5:4] */
117#define WM831X_CHG_FAST_ILIM_MASK 0x000F /* CHG_FAST_ILIM - [3:0] */
118#define WM831X_CHG_FAST_ILIM_SHIFT 0 /* CHG_FAST_ILIM - [3:0] */
119#define WM831X_CHG_FAST_ILIM_WIDTH 4 /* CHG_FAST_ILIM - [3:0] */
120
121/*
122 * R16458 (0x404A) - Charger Status
123 */
124#define WM831X_BATT_OV_STS 0x8000 /* BATT_OV_STS */
125#define WM831X_BATT_OV_STS_MASK 0x8000 /* BATT_OV_STS */
126#define WM831X_BATT_OV_STS_SHIFT 15 /* BATT_OV_STS */
127#define WM831X_BATT_OV_STS_WIDTH 1 /* BATT_OV_STS */
128#define WM831X_CHG_STATE_MASK 0x7000 /* CHG_STATE - [14:12] */
129#define WM831X_CHG_STATE_SHIFT 12 /* CHG_STATE - [14:12] */
130#define WM831X_CHG_STATE_WIDTH 3 /* CHG_STATE - [14:12] */
131#define WM831X_BATT_HOT_STS 0x0800 /* BATT_HOT_STS */
132#define WM831X_BATT_HOT_STS_MASK 0x0800 /* BATT_HOT_STS */
133#define WM831X_BATT_HOT_STS_SHIFT 11 /* BATT_HOT_STS */
134#define WM831X_BATT_HOT_STS_WIDTH 1 /* BATT_HOT_STS */
135#define WM831X_BATT_COLD_STS 0x0400 /* BATT_COLD_STS */
136#define WM831X_BATT_COLD_STS_MASK 0x0400 /* BATT_COLD_STS */
137#define WM831X_BATT_COLD_STS_SHIFT 10 /* BATT_COLD_STS */
138#define WM831X_BATT_COLD_STS_WIDTH 1 /* BATT_COLD_STS */
139#define WM831X_CHG_TOPOFF 0x0200 /* CHG_TOPOFF */
140#define WM831X_CHG_TOPOFF_MASK 0x0200 /* CHG_TOPOFF */
141#define WM831X_CHG_TOPOFF_SHIFT 9 /* CHG_TOPOFF */
142#define WM831X_CHG_TOPOFF_WIDTH 1 /* CHG_TOPOFF */
143#define WM831X_CHG_ACTIVE 0x0100 /* CHG_ACTIVE */
144#define WM831X_CHG_ACTIVE_MASK 0x0100 /* CHG_ACTIVE */
145#define WM831X_CHG_ACTIVE_SHIFT 8 /* CHG_ACTIVE */
146#define WM831X_CHG_ACTIVE_WIDTH 1 /* CHG_ACTIVE */
147#define WM831X_CHG_TIME_ELAPSED_MASK 0x00FF /* CHG_TIME_ELAPSED - [7:0] */
148#define WM831X_CHG_TIME_ELAPSED_SHIFT 0 /* CHG_TIME_ELAPSED - [7:0] */
149#define WM831X_CHG_TIME_ELAPSED_WIDTH 8 /* CHG_TIME_ELAPSED - [7:0] */
150
151#define WM831X_CHG_STATE_OFF (0 << WM831X_CHG_STATE_SHIFT)
152#define WM831X_CHG_STATE_TRICKLE (1 << WM831X_CHG_STATE_SHIFT)
153#define WM831X_CHG_STATE_FAST (2 << WM831X_CHG_STATE_SHIFT)
154#define WM831X_CHG_STATE_TRICKLE_OT (3 << WM831X_CHG_STATE_SHIFT)
155#define WM831X_CHG_STATE_FAST_OT (4 << WM831X_CHG_STATE_SHIFT)
156#define WM831X_CHG_STATE_DEFECTIVE (5 << WM831X_CHG_STATE_SHIFT)
157
158/*
159 * R16459 (0x404B) - Backup Charger Control
160 */
161#define WM831X_BKUP_CHG_ENA 0x8000 /* BKUP_CHG_ENA */
162#define WM831X_BKUP_CHG_ENA_MASK 0x8000 /* BKUP_CHG_ENA */
163#define WM831X_BKUP_CHG_ENA_SHIFT 15 /* BKUP_CHG_ENA */
164#define WM831X_BKUP_CHG_ENA_WIDTH 1 /* BKUP_CHG_ENA */
165#define WM831X_BKUP_CHG_STS 0x4000 /* BKUP_CHG_STS */
166#define WM831X_BKUP_CHG_STS_MASK 0x4000 /* BKUP_CHG_STS */
167#define WM831X_BKUP_CHG_STS_SHIFT 14 /* BKUP_CHG_STS */
168#define WM831X_BKUP_CHG_STS_WIDTH 1 /* BKUP_CHG_STS */
169#define WM831X_BKUP_CHG_MODE 0x1000 /* BKUP_CHG_MODE */
170#define WM831X_BKUP_CHG_MODE_MASK 0x1000 /* BKUP_CHG_MODE */
171#define WM831X_BKUP_CHG_MODE_SHIFT 12 /* BKUP_CHG_MODE */
172#define WM831X_BKUP_CHG_MODE_WIDTH 1 /* BKUP_CHG_MODE */
173#define WM831X_BKUP_BATT_DET_ENA 0x0800 /* BKUP_BATT_DET_ENA */
174#define WM831X_BKUP_BATT_DET_ENA_MASK 0x0800 /* BKUP_BATT_DET_ENA */
175#define WM831X_BKUP_BATT_DET_ENA_SHIFT 11 /* BKUP_BATT_DET_ENA */
176#define WM831X_BKUP_BATT_DET_ENA_WIDTH 1 /* BKUP_BATT_DET_ENA */
177#define WM831X_BKUP_BATT_STS 0x0400 /* BKUP_BATT_STS */
178#define WM831X_BKUP_BATT_STS_MASK 0x0400 /* BKUP_BATT_STS */
179#define WM831X_BKUP_BATT_STS_SHIFT 10 /* BKUP_BATT_STS */
180#define WM831X_BKUP_BATT_STS_WIDTH 1 /* BKUP_BATT_STS */
181#define WM831X_BKUP_CHG_VLIM 0x0010 /* BKUP_CHG_VLIM */
182#define WM831X_BKUP_CHG_VLIM_MASK 0x0010 /* BKUP_CHG_VLIM */
183#define WM831X_BKUP_CHG_VLIM_SHIFT 4 /* BKUP_CHG_VLIM */
184#define WM831X_BKUP_CHG_VLIM_WIDTH 1 /* BKUP_CHG_VLIM */
185#define WM831X_BKUP_CHG_ILIM_MASK 0x0003 /* BKUP_CHG_ILIM - [1:0] */
186#define WM831X_BKUP_CHG_ILIM_SHIFT 0 /* BKUP_CHG_ILIM - [1:0] */
187#define WM831X_BKUP_CHG_ILIM_WIDTH 2 /* BKUP_CHG_ILIM - [1:0] */
188
189#endif
diff --git a/include/linux/mfd/wm831x/regulator.h b/include/linux/mfd/wm831x/regulator.h
new file mode 100644
index 000000000000..f95466343fb2
--- /dev/null
+++ b/include/linux/mfd/wm831x/regulator.h
@@ -0,0 +1,1218 @@
1/*
2 * linux/mfd/wm831x/regulator.h -- Regulator definitons for wm831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_REGULATOR_H__
16#define __MFD_WM831X_REGULATOR_H__
17
18/*
19 * R16462 (0x404E) - Current Sink 1
20 */
21#define WM831X_CS1_ENA 0x8000 /* CS1_ENA */
22#define WM831X_CS1_ENA_MASK 0x8000 /* CS1_ENA */
23#define WM831X_CS1_ENA_SHIFT 15 /* CS1_ENA */
24#define WM831X_CS1_ENA_WIDTH 1 /* CS1_ENA */
25#define WM831X_CS1_DRIVE 0x4000 /* CS1_DRIVE */
26#define WM831X_CS1_DRIVE_MASK 0x4000 /* CS1_DRIVE */
27#define WM831X_CS1_DRIVE_SHIFT 14 /* CS1_DRIVE */
28#define WM831X_CS1_DRIVE_WIDTH 1 /* CS1_DRIVE */
29#define WM831X_CS1_SLPENA 0x1000 /* CS1_SLPENA */
30#define WM831X_CS1_SLPENA_MASK 0x1000 /* CS1_SLPENA */
31#define WM831X_CS1_SLPENA_SHIFT 12 /* CS1_SLPENA */
32#define WM831X_CS1_SLPENA_WIDTH 1 /* CS1_SLPENA */
33#define WM831X_CS1_OFF_RAMP_MASK 0x0C00 /* CS1_OFF_RAMP - [11:10] */
34#define WM831X_CS1_OFF_RAMP_SHIFT 10 /* CS1_OFF_RAMP - [11:10] */
35#define WM831X_CS1_OFF_RAMP_WIDTH 2 /* CS1_OFF_RAMP - [11:10] */
36#define WM831X_CS1_ON_RAMP_MASK 0x0300 /* CS1_ON_RAMP - [9:8] */
37#define WM831X_CS1_ON_RAMP_SHIFT 8 /* CS1_ON_RAMP - [9:8] */
38#define WM831X_CS1_ON_RAMP_WIDTH 2 /* CS1_ON_RAMP - [9:8] */
39#define WM831X_CS1_ISEL_MASK 0x003F /* CS1_ISEL - [5:0] */
40#define WM831X_CS1_ISEL_SHIFT 0 /* CS1_ISEL - [5:0] */
41#define WM831X_CS1_ISEL_WIDTH 6 /* CS1_ISEL - [5:0] */
42
43/*
44 * R16463 (0x404F) - Current Sink 2
45 */
46#define WM831X_CS2_ENA 0x8000 /* CS2_ENA */
47#define WM831X_CS2_ENA_MASK 0x8000 /* CS2_ENA */
48#define WM831X_CS2_ENA_SHIFT 15 /* CS2_ENA */
49#define WM831X_CS2_ENA_WIDTH 1 /* CS2_ENA */
50#define WM831X_CS2_DRIVE 0x4000 /* CS2_DRIVE */
51#define WM831X_CS2_DRIVE_MASK 0x4000 /* CS2_DRIVE */
52#define WM831X_CS2_DRIVE_SHIFT 14 /* CS2_DRIVE */
53#define WM831X_CS2_DRIVE_WIDTH 1 /* CS2_DRIVE */
54#define WM831X_CS2_SLPENA 0x1000 /* CS2_SLPENA */
55#define WM831X_CS2_SLPENA_MASK 0x1000 /* CS2_SLPENA */
56#define WM831X_CS2_SLPENA_SHIFT 12 /* CS2_SLPENA */
57#define WM831X_CS2_SLPENA_WIDTH 1 /* CS2_SLPENA */
58#define WM831X_CS2_OFF_RAMP_MASK 0x0C00 /* CS2_OFF_RAMP - [11:10] */
59#define WM831X_CS2_OFF_RAMP_SHIFT 10 /* CS2_OFF_RAMP - [11:10] */
60#define WM831X_CS2_OFF_RAMP_WIDTH 2 /* CS2_OFF_RAMP - [11:10] */
61#define WM831X_CS2_ON_RAMP_MASK 0x0300 /* CS2_ON_RAMP - [9:8] */
62#define WM831X_CS2_ON_RAMP_SHIFT 8 /* CS2_ON_RAMP - [9:8] */
63#define WM831X_CS2_ON_RAMP_WIDTH 2 /* CS2_ON_RAMP - [9:8] */
64#define WM831X_CS2_ISEL_MASK 0x003F /* CS2_ISEL - [5:0] */
65#define WM831X_CS2_ISEL_SHIFT 0 /* CS2_ISEL - [5:0] */
66#define WM831X_CS2_ISEL_WIDTH 6 /* CS2_ISEL - [5:0] */
67
68/*
69 * R16464 (0x4050) - DCDC Enable
70 */
71#define WM831X_EPE2_ENA 0x0080 /* EPE2_ENA */
72#define WM831X_EPE2_ENA_MASK 0x0080 /* EPE2_ENA */
73#define WM831X_EPE2_ENA_SHIFT 7 /* EPE2_ENA */
74#define WM831X_EPE2_ENA_WIDTH 1 /* EPE2_ENA */
75#define WM831X_EPE1_ENA 0x0040 /* EPE1_ENA */
76#define WM831X_EPE1_ENA_MASK 0x0040 /* EPE1_ENA */
77#define WM831X_EPE1_ENA_SHIFT 6 /* EPE1_ENA */
78#define WM831X_EPE1_ENA_WIDTH 1 /* EPE1_ENA */
79#define WM831X_DC4_ENA 0x0008 /* DC4_ENA */
80#define WM831X_DC4_ENA_MASK 0x0008 /* DC4_ENA */
81#define WM831X_DC4_ENA_SHIFT 3 /* DC4_ENA */
82#define WM831X_DC4_ENA_WIDTH 1 /* DC4_ENA */
83#define WM831X_DC3_ENA 0x0004 /* DC3_ENA */
84#define WM831X_DC3_ENA_MASK 0x0004 /* DC3_ENA */
85#define WM831X_DC3_ENA_SHIFT 2 /* DC3_ENA */
86#define WM831X_DC3_ENA_WIDTH 1 /* DC3_ENA */
87#define WM831X_DC2_ENA 0x0002 /* DC2_ENA */
88#define WM831X_DC2_ENA_MASK 0x0002 /* DC2_ENA */
89#define WM831X_DC2_ENA_SHIFT 1 /* DC2_ENA */
90#define WM831X_DC2_ENA_WIDTH 1 /* DC2_ENA */
91#define WM831X_DC1_ENA 0x0001 /* DC1_ENA */
92#define WM831X_DC1_ENA_MASK 0x0001 /* DC1_ENA */
93#define WM831X_DC1_ENA_SHIFT 0 /* DC1_ENA */
94#define WM831X_DC1_ENA_WIDTH 1 /* DC1_ENA */
95
96/*
97 * R16465 (0x4051) - LDO Enable
98 */
99#define WM831X_LDO11_ENA 0x0400 /* LDO11_ENA */
100#define WM831X_LDO11_ENA_MASK 0x0400 /* LDO11_ENA */
101#define WM831X_LDO11_ENA_SHIFT 10 /* LDO11_ENA */
102#define WM831X_LDO11_ENA_WIDTH 1 /* LDO11_ENA */
103#define WM831X_LDO10_ENA 0x0200 /* LDO10_ENA */
104#define WM831X_LDO10_ENA_MASK 0x0200 /* LDO10_ENA */
105#define WM831X_LDO10_ENA_SHIFT 9 /* LDO10_ENA */
106#define WM831X_LDO10_ENA_WIDTH 1 /* LDO10_ENA */
107#define WM831X_LDO9_ENA 0x0100 /* LDO9_ENA */
108#define WM831X_LDO9_ENA_MASK 0x0100 /* LDO9_ENA */
109#define WM831X_LDO9_ENA_SHIFT 8 /* LDO9_ENA */
110#define WM831X_LDO9_ENA_WIDTH 1 /* LDO9_ENA */
111#define WM831X_LDO8_ENA 0x0080 /* LDO8_ENA */
112#define WM831X_LDO8_ENA_MASK 0x0080 /* LDO8_ENA */
113#define WM831X_LDO8_ENA_SHIFT 7 /* LDO8_ENA */
114#define WM831X_LDO8_ENA_WIDTH 1 /* LDO8_ENA */
115#define WM831X_LDO7_ENA 0x0040 /* LDO7_ENA */
116#define WM831X_LDO7_ENA_MASK 0x0040 /* LDO7_ENA */
117#define WM831X_LDO7_ENA_SHIFT 6 /* LDO7_ENA */
118#define WM831X_LDO7_ENA_WIDTH 1 /* LDO7_ENA */
119#define WM831X_LDO6_ENA 0x0020 /* LDO6_ENA */
120#define WM831X_LDO6_ENA_MASK 0x0020 /* LDO6_ENA */
121#define WM831X_LDO6_ENA_SHIFT 5 /* LDO6_ENA */
122#define WM831X_LDO6_ENA_WIDTH 1 /* LDO6_ENA */
123#define WM831X_LDO5_ENA 0x0010 /* LDO5_ENA */
124#define WM831X_LDO5_ENA_MASK 0x0010 /* LDO5_ENA */
125#define WM831X_LDO5_ENA_SHIFT 4 /* LDO5_ENA */
126#define WM831X_LDO5_ENA_WIDTH 1 /* LDO5_ENA */
127#define WM831X_LDO4_ENA 0x0008 /* LDO4_ENA */
128#define WM831X_LDO4_ENA_MASK 0x0008 /* LDO4_ENA */
129#define WM831X_LDO4_ENA_SHIFT 3 /* LDO4_ENA */
130#define WM831X_LDO4_ENA_WIDTH 1 /* LDO4_ENA */
131#define WM831X_LDO3_ENA 0x0004 /* LDO3_ENA */
132#define WM831X_LDO3_ENA_MASK 0x0004 /* LDO3_ENA */
133#define WM831X_LDO3_ENA_SHIFT 2 /* LDO3_ENA */
134#define WM831X_LDO3_ENA_WIDTH 1 /* LDO3_ENA */
135#define WM831X_LDO2_ENA 0x0002 /* LDO2_ENA */
136#define WM831X_LDO2_ENA_MASK 0x0002 /* LDO2_ENA */
137#define WM831X_LDO2_ENA_SHIFT 1 /* LDO2_ENA */
138#define WM831X_LDO2_ENA_WIDTH 1 /* LDO2_ENA */
139#define WM831X_LDO1_ENA 0x0001 /* LDO1_ENA */
140#define WM831X_LDO1_ENA_MASK 0x0001 /* LDO1_ENA */
141#define WM831X_LDO1_ENA_SHIFT 0 /* LDO1_ENA */
142#define WM831X_LDO1_ENA_WIDTH 1 /* LDO1_ENA */
143
144/*
145 * R16466 (0x4052) - DCDC Status
146 */
147#define WM831X_EPE2_STS 0x0080 /* EPE2_STS */
148#define WM831X_EPE2_STS_MASK 0x0080 /* EPE2_STS */
149#define WM831X_EPE2_STS_SHIFT 7 /* EPE2_STS */
150#define WM831X_EPE2_STS_WIDTH 1 /* EPE2_STS */
151#define WM831X_EPE1_STS 0x0040 /* EPE1_STS */
152#define WM831X_EPE1_STS_MASK 0x0040 /* EPE1_STS */
153#define WM831X_EPE1_STS_SHIFT 6 /* EPE1_STS */
154#define WM831X_EPE1_STS_WIDTH 1 /* EPE1_STS */
155#define WM831X_DC4_STS 0x0008 /* DC4_STS */
156#define WM831X_DC4_STS_MASK 0x0008 /* DC4_STS */
157#define WM831X_DC4_STS_SHIFT 3 /* DC4_STS */
158#define WM831X_DC4_STS_WIDTH 1 /* DC4_STS */
159#define WM831X_DC3_STS 0x0004 /* DC3_STS */
160#define WM831X_DC3_STS_MASK 0x0004 /* DC3_STS */
161#define WM831X_DC3_STS_SHIFT 2 /* DC3_STS */
162#define WM831X_DC3_STS_WIDTH 1 /* DC3_STS */
163#define WM831X_DC2_STS 0x0002 /* DC2_STS */
164#define WM831X_DC2_STS_MASK 0x0002 /* DC2_STS */
165#define WM831X_DC2_STS_SHIFT 1 /* DC2_STS */
166#define WM831X_DC2_STS_WIDTH 1 /* DC2_STS */
167#define WM831X_DC1_STS 0x0001 /* DC1_STS */
168#define WM831X_DC1_STS_MASK 0x0001 /* DC1_STS */
169#define WM831X_DC1_STS_SHIFT 0 /* DC1_STS */
170#define WM831X_DC1_STS_WIDTH 1 /* DC1_STS */
171
172/*
173 * R16467 (0x4053) - LDO Status
174 */
175#define WM831X_LDO11_STS 0x0400 /* LDO11_STS */
176#define WM831X_LDO11_STS_MASK 0x0400 /* LDO11_STS */
177#define WM831X_LDO11_STS_SHIFT 10 /* LDO11_STS */
178#define WM831X_LDO11_STS_WIDTH 1 /* LDO11_STS */
179#define WM831X_LDO10_STS 0x0200 /* LDO10_STS */
180#define WM831X_LDO10_STS_MASK 0x0200 /* LDO10_STS */
181#define WM831X_LDO10_STS_SHIFT 9 /* LDO10_STS */
182#define WM831X_LDO10_STS_WIDTH 1 /* LDO10_STS */
183#define WM831X_LDO9_STS 0x0100 /* LDO9_STS */
184#define WM831X_LDO9_STS_MASK 0x0100 /* LDO9_STS */
185#define WM831X_LDO9_STS_SHIFT 8 /* LDO9_STS */
186#define WM831X_LDO9_STS_WIDTH 1 /* LDO9_STS */
187#define WM831X_LDO8_STS 0x0080 /* LDO8_STS */
188#define WM831X_LDO8_STS_MASK 0x0080 /* LDO8_STS */
189#define WM831X_LDO8_STS_SHIFT 7 /* LDO8_STS */
190#define WM831X_LDO8_STS_WIDTH 1 /* LDO8_STS */
191#define WM831X_LDO7_STS 0x0040 /* LDO7_STS */
192#define WM831X_LDO7_STS_MASK 0x0040 /* LDO7_STS */
193#define WM831X_LDO7_STS_SHIFT 6 /* LDO7_STS */
194#define WM831X_LDO7_STS_WIDTH 1 /* LDO7_STS */
195#define WM831X_LDO6_STS 0x0020 /* LDO6_STS */
196#define WM831X_LDO6_STS_MASK 0x0020 /* LDO6_STS */
197#define WM831X_LDO6_STS_SHIFT 5 /* LDO6_STS */
198#define WM831X_LDO6_STS_WIDTH 1 /* LDO6_STS */
199#define WM831X_LDO5_STS 0x0010 /* LDO5_STS */
200#define WM831X_LDO5_STS_MASK 0x0010 /* LDO5_STS */
201#define WM831X_LDO5_STS_SHIFT 4 /* LDO5_STS */
202#define WM831X_LDO5_STS_WIDTH 1 /* LDO5_STS */
203#define WM831X_LDO4_STS 0x0008 /* LDO4_STS */
204#define WM831X_LDO4_STS_MASK 0x0008 /* LDO4_STS */
205#define WM831X_LDO4_STS_SHIFT 3 /* LDO4_STS */
206#define WM831X_LDO4_STS_WIDTH 1 /* LDO4_STS */
207#define WM831X_LDO3_STS 0x0004 /* LDO3_STS */
208#define WM831X_LDO3_STS_MASK 0x0004 /* LDO3_STS */
209#define WM831X_LDO3_STS_SHIFT 2 /* LDO3_STS */
210#define WM831X_LDO3_STS_WIDTH 1 /* LDO3_STS */
211#define WM831X_LDO2_STS 0x0002 /* LDO2_STS */
212#define WM831X_LDO2_STS_MASK 0x0002 /* LDO2_STS */
213#define WM831X_LDO2_STS_SHIFT 1 /* LDO2_STS */
214#define WM831X_LDO2_STS_WIDTH 1 /* LDO2_STS */
215#define WM831X_LDO1_STS 0x0001 /* LDO1_STS */
216#define WM831X_LDO1_STS_MASK 0x0001 /* LDO1_STS */
217#define WM831X_LDO1_STS_SHIFT 0 /* LDO1_STS */
218#define WM831X_LDO1_STS_WIDTH 1 /* LDO1_STS */
219
220/*
221 * R16468 (0x4054) - DCDC UV Status
222 */
223#define WM831X_DC2_OV_STS 0x2000 /* DC2_OV_STS */
224#define WM831X_DC2_OV_STS_MASK 0x2000 /* DC2_OV_STS */
225#define WM831X_DC2_OV_STS_SHIFT 13 /* DC2_OV_STS */
226#define WM831X_DC2_OV_STS_WIDTH 1 /* DC2_OV_STS */
227#define WM831X_DC1_OV_STS 0x1000 /* DC1_OV_STS */
228#define WM831X_DC1_OV_STS_MASK 0x1000 /* DC1_OV_STS */
229#define WM831X_DC1_OV_STS_SHIFT 12 /* DC1_OV_STS */
230#define WM831X_DC1_OV_STS_WIDTH 1 /* DC1_OV_STS */
231#define WM831X_DC2_HC_STS 0x0200 /* DC2_HC_STS */
232#define WM831X_DC2_HC_STS_MASK 0x0200 /* DC2_HC_STS */
233#define WM831X_DC2_HC_STS_SHIFT 9 /* DC2_HC_STS */
234#define WM831X_DC2_HC_STS_WIDTH 1 /* DC2_HC_STS */
235#define WM831X_DC1_HC_STS 0x0100 /* DC1_HC_STS */
236#define WM831X_DC1_HC_STS_MASK 0x0100 /* DC1_HC_STS */
237#define WM831X_DC1_HC_STS_SHIFT 8 /* DC1_HC_STS */
238#define WM831X_DC1_HC_STS_WIDTH 1 /* DC1_HC_STS */
239#define WM831X_DC4_UV_STS 0x0008 /* DC4_UV_STS */
240#define WM831X_DC4_UV_STS_MASK 0x0008 /* DC4_UV_STS */
241#define WM831X_DC4_UV_STS_SHIFT 3 /* DC4_UV_STS */
242#define WM831X_DC4_UV_STS_WIDTH 1 /* DC4_UV_STS */
243#define WM831X_DC3_UV_STS 0x0004 /* DC3_UV_STS */
244#define WM831X_DC3_UV_STS_MASK 0x0004 /* DC3_UV_STS */
245#define WM831X_DC3_UV_STS_SHIFT 2 /* DC3_UV_STS */
246#define WM831X_DC3_UV_STS_WIDTH 1 /* DC3_UV_STS */
247#define WM831X_DC2_UV_STS 0x0002 /* DC2_UV_STS */
248#define WM831X_DC2_UV_STS_MASK 0x0002 /* DC2_UV_STS */
249#define WM831X_DC2_UV_STS_SHIFT 1 /* DC2_UV_STS */
250#define WM831X_DC2_UV_STS_WIDTH 1 /* DC2_UV_STS */
251#define WM831X_DC1_UV_STS 0x0001 /* DC1_UV_STS */
252#define WM831X_DC1_UV_STS_MASK 0x0001 /* DC1_UV_STS */
253#define WM831X_DC1_UV_STS_SHIFT 0 /* DC1_UV_STS */
254#define WM831X_DC1_UV_STS_WIDTH 1 /* DC1_UV_STS */
255
256/*
257 * R16469 (0x4055) - LDO UV Status
258 */
259#define WM831X_INTLDO_UV_STS 0x8000 /* INTLDO_UV_STS */
260#define WM831X_INTLDO_UV_STS_MASK 0x8000 /* INTLDO_UV_STS */
261#define WM831X_INTLDO_UV_STS_SHIFT 15 /* INTLDO_UV_STS */
262#define WM831X_INTLDO_UV_STS_WIDTH 1 /* INTLDO_UV_STS */
263#define WM831X_LDO10_UV_STS 0x0200 /* LDO10_UV_STS */
264#define WM831X_LDO10_UV_STS_MASK 0x0200 /* LDO10_UV_STS */
265#define WM831X_LDO10_UV_STS_SHIFT 9 /* LDO10_UV_STS */
266#define WM831X_LDO10_UV_STS_WIDTH 1 /* LDO10_UV_STS */
267#define WM831X_LDO9_UV_STS 0x0100 /* LDO9_UV_STS */
268#define WM831X_LDO9_UV_STS_MASK 0x0100 /* LDO9_UV_STS */
269#define WM831X_LDO9_UV_STS_SHIFT 8 /* LDO9_UV_STS */
270#define WM831X_LDO9_UV_STS_WIDTH 1 /* LDO9_UV_STS */
271#define WM831X_LDO8_UV_STS 0x0080 /* LDO8_UV_STS */
272#define WM831X_LDO8_UV_STS_MASK 0x0080 /* LDO8_UV_STS */
273#define WM831X_LDO8_UV_STS_SHIFT 7 /* LDO8_UV_STS */
274#define WM831X_LDO8_UV_STS_WIDTH 1 /* LDO8_UV_STS */
275#define WM831X_LDO7_UV_STS 0x0040 /* LDO7_UV_STS */
276#define WM831X_LDO7_UV_STS_MASK 0x0040 /* LDO7_UV_STS */
277#define WM831X_LDO7_UV_STS_SHIFT 6 /* LDO7_UV_STS */
278#define WM831X_LDO7_UV_STS_WIDTH 1 /* LDO7_UV_STS */
279#define WM831X_LDO6_UV_STS 0x0020 /* LDO6_UV_STS */
280#define WM831X_LDO6_UV_STS_MASK 0x0020 /* LDO6_UV_STS */
281#define WM831X_LDO6_UV_STS_SHIFT 5 /* LDO6_UV_STS */
282#define WM831X_LDO6_UV_STS_WIDTH 1 /* LDO6_UV_STS */
283#define WM831X_LDO5_UV_STS 0x0010 /* LDO5_UV_STS */
284#define WM831X_LDO5_UV_STS_MASK 0x0010 /* LDO5_UV_STS */
285#define WM831X_LDO5_UV_STS_SHIFT 4 /* LDO5_UV_STS */
286#define WM831X_LDO5_UV_STS_WIDTH 1 /* LDO5_UV_STS */
287#define WM831X_LDO4_UV_STS 0x0008 /* LDO4_UV_STS */
288#define WM831X_LDO4_UV_STS_MASK 0x0008 /* LDO4_UV_STS */
289#define WM831X_LDO4_UV_STS_SHIFT 3 /* LDO4_UV_STS */
290#define WM831X_LDO4_UV_STS_WIDTH 1 /* LDO4_UV_STS */
291#define WM831X_LDO3_UV_STS 0x0004 /* LDO3_UV_STS */
292#define WM831X_LDO3_UV_STS_MASK 0x0004 /* LDO3_UV_STS */
293#define WM831X_LDO3_UV_STS_SHIFT 2 /* LDO3_UV_STS */
294#define WM831X_LDO3_UV_STS_WIDTH 1 /* LDO3_UV_STS */
295#define WM831X_LDO2_UV_STS 0x0002 /* LDO2_UV_STS */
296#define WM831X_LDO2_UV_STS_MASK 0x0002 /* LDO2_UV_STS */
297#define WM831X_LDO2_UV_STS_SHIFT 1 /* LDO2_UV_STS */
298#define WM831X_LDO2_UV_STS_WIDTH 1 /* LDO2_UV_STS */
299#define WM831X_LDO1_UV_STS 0x0001 /* LDO1_UV_STS */
300#define WM831X_LDO1_UV_STS_MASK 0x0001 /* LDO1_UV_STS */
301#define WM831X_LDO1_UV_STS_SHIFT 0 /* LDO1_UV_STS */
302#define WM831X_LDO1_UV_STS_WIDTH 1 /* LDO1_UV_STS */
303
304/*
305 * R16470 (0x4056) - DC1 Control 1
306 */
307#define WM831X_DC1_RATE_MASK 0xC000 /* DC1_RATE - [15:14] */
308#define WM831X_DC1_RATE_SHIFT 14 /* DC1_RATE - [15:14] */
309#define WM831X_DC1_RATE_WIDTH 2 /* DC1_RATE - [15:14] */
310#define WM831X_DC1_PHASE 0x1000 /* DC1_PHASE */
311#define WM831X_DC1_PHASE_MASK 0x1000 /* DC1_PHASE */
312#define WM831X_DC1_PHASE_SHIFT 12 /* DC1_PHASE */
313#define WM831X_DC1_PHASE_WIDTH 1 /* DC1_PHASE */
314#define WM831X_DC1_FREQ_MASK 0x0300 /* DC1_FREQ - [9:8] */
315#define WM831X_DC1_FREQ_SHIFT 8 /* DC1_FREQ - [9:8] */
316#define WM831X_DC1_FREQ_WIDTH 2 /* DC1_FREQ - [9:8] */
317#define WM831X_DC1_FLT 0x0080 /* DC1_FLT */
318#define WM831X_DC1_FLT_MASK 0x0080 /* DC1_FLT */
319#define WM831X_DC1_FLT_SHIFT 7 /* DC1_FLT */
320#define WM831X_DC1_FLT_WIDTH 1 /* DC1_FLT */
321#define WM831X_DC1_SOFT_START_MASK 0x0030 /* DC1_SOFT_START - [5:4] */
322#define WM831X_DC1_SOFT_START_SHIFT 4 /* DC1_SOFT_START - [5:4] */
323#define WM831X_DC1_SOFT_START_WIDTH 2 /* DC1_SOFT_START - [5:4] */
324#define WM831X_DC1_CAP_MASK 0x0003 /* DC1_CAP - [1:0] */
325#define WM831X_DC1_CAP_SHIFT 0 /* DC1_CAP - [1:0] */
326#define WM831X_DC1_CAP_WIDTH 2 /* DC1_CAP - [1:0] */
327
328/*
329 * R16471 (0x4057) - DC1 Control 2
330 */
331#define WM831X_DC1_ERR_ACT_MASK 0xC000 /* DC1_ERR_ACT - [15:14] */
332#define WM831X_DC1_ERR_ACT_SHIFT 14 /* DC1_ERR_ACT - [15:14] */
333#define WM831X_DC1_ERR_ACT_WIDTH 2 /* DC1_ERR_ACT - [15:14] */
334#define WM831X_DC1_HWC_SRC_MASK 0x1800 /* DC1_HWC_SRC - [12:11] */
335#define WM831X_DC1_HWC_SRC_SHIFT 11 /* DC1_HWC_SRC - [12:11] */
336#define WM831X_DC1_HWC_SRC_WIDTH 2 /* DC1_HWC_SRC - [12:11] */
337#define WM831X_DC1_HWC_VSEL 0x0400 /* DC1_HWC_VSEL */
338#define WM831X_DC1_HWC_VSEL_MASK 0x0400 /* DC1_HWC_VSEL */
339#define WM831X_DC1_HWC_VSEL_SHIFT 10 /* DC1_HWC_VSEL */
340#define WM831X_DC1_HWC_VSEL_WIDTH 1 /* DC1_HWC_VSEL */
341#define WM831X_DC1_HWC_MODE_MASK 0x0300 /* DC1_HWC_MODE - [9:8] */
342#define WM831X_DC1_HWC_MODE_SHIFT 8 /* DC1_HWC_MODE - [9:8] */
343#define WM831X_DC1_HWC_MODE_WIDTH 2 /* DC1_HWC_MODE - [9:8] */
344#define WM831X_DC1_HC_THR_MASK 0x0070 /* DC1_HC_THR - [6:4] */
345#define WM831X_DC1_HC_THR_SHIFT 4 /* DC1_HC_THR - [6:4] */
346#define WM831X_DC1_HC_THR_WIDTH 3 /* DC1_HC_THR - [6:4] */
347#define WM831X_DC1_HC_IND_ENA 0x0001 /* DC1_HC_IND_ENA */
348#define WM831X_DC1_HC_IND_ENA_MASK 0x0001 /* DC1_HC_IND_ENA */
349#define WM831X_DC1_HC_IND_ENA_SHIFT 0 /* DC1_HC_IND_ENA */
350#define WM831X_DC1_HC_IND_ENA_WIDTH 1 /* DC1_HC_IND_ENA */
351
352/*
353 * R16472 (0x4058) - DC1 ON Config
354 */
355#define WM831X_DC1_ON_SLOT_MASK 0xE000 /* DC1_ON_SLOT - [15:13] */
356#define WM831X_DC1_ON_SLOT_SHIFT 13 /* DC1_ON_SLOT - [15:13] */
357#define WM831X_DC1_ON_SLOT_WIDTH 3 /* DC1_ON_SLOT - [15:13] */
358#define WM831X_DC1_ON_MODE_MASK 0x0300 /* DC1_ON_MODE - [9:8] */
359#define WM831X_DC1_ON_MODE_SHIFT 8 /* DC1_ON_MODE - [9:8] */
360#define WM831X_DC1_ON_MODE_WIDTH 2 /* DC1_ON_MODE - [9:8] */
361#define WM831X_DC1_ON_VSEL_MASK 0x007F /* DC1_ON_VSEL - [6:0] */
362#define WM831X_DC1_ON_VSEL_SHIFT 0 /* DC1_ON_VSEL - [6:0] */
363#define WM831X_DC1_ON_VSEL_WIDTH 7 /* DC1_ON_VSEL - [6:0] */
364
365/*
366 * R16473 (0x4059) - DC1 SLEEP Control
367 */
368#define WM831X_DC1_SLP_SLOT_MASK 0xE000 /* DC1_SLP_SLOT - [15:13] */
369#define WM831X_DC1_SLP_SLOT_SHIFT 13 /* DC1_SLP_SLOT - [15:13] */
370#define WM831X_DC1_SLP_SLOT_WIDTH 3 /* DC1_SLP_SLOT - [15:13] */
371#define WM831X_DC1_SLP_MODE_MASK 0x0300 /* DC1_SLP_MODE - [9:8] */
372#define WM831X_DC1_SLP_MODE_SHIFT 8 /* DC1_SLP_MODE - [9:8] */
373#define WM831X_DC1_SLP_MODE_WIDTH 2 /* DC1_SLP_MODE - [9:8] */
374#define WM831X_DC1_SLP_VSEL_MASK 0x007F /* DC1_SLP_VSEL - [6:0] */
375#define WM831X_DC1_SLP_VSEL_SHIFT 0 /* DC1_SLP_VSEL - [6:0] */
376#define WM831X_DC1_SLP_VSEL_WIDTH 7 /* DC1_SLP_VSEL - [6:0] */
377
378/*
379 * R16474 (0x405A) - DC1 DVS Control
380 */
381#define WM831X_DC1_DVS_SRC_MASK 0x1800 /* DC1_DVS_SRC - [12:11] */
382#define WM831X_DC1_DVS_SRC_SHIFT 11 /* DC1_DVS_SRC - [12:11] */
383#define WM831X_DC1_DVS_SRC_WIDTH 2 /* DC1_DVS_SRC - [12:11] */
384#define WM831X_DC1_DVS_VSEL_MASK 0x007F /* DC1_DVS_VSEL - [6:0] */
385#define WM831X_DC1_DVS_VSEL_SHIFT 0 /* DC1_DVS_VSEL - [6:0] */
386#define WM831X_DC1_DVS_VSEL_WIDTH 7 /* DC1_DVS_VSEL - [6:0] */
387
388/*
389 * R16475 (0x405B) - DC2 Control 1
390 */
391#define WM831X_DC2_RATE_MASK 0xC000 /* DC2_RATE - [15:14] */
392#define WM831X_DC2_RATE_SHIFT 14 /* DC2_RATE - [15:14] */
393#define WM831X_DC2_RATE_WIDTH 2 /* DC2_RATE - [15:14] */
394#define WM831X_DC2_PHASE 0x1000 /* DC2_PHASE */
395#define WM831X_DC2_PHASE_MASK 0x1000 /* DC2_PHASE */
396#define WM831X_DC2_PHASE_SHIFT 12 /* DC2_PHASE */
397#define WM831X_DC2_PHASE_WIDTH 1 /* DC2_PHASE */
398#define WM831X_DC2_FREQ_MASK 0x0300 /* DC2_FREQ - [9:8] */
399#define WM831X_DC2_FREQ_SHIFT 8 /* DC2_FREQ - [9:8] */
400#define WM831X_DC2_FREQ_WIDTH 2 /* DC2_FREQ - [9:8] */
401#define WM831X_DC2_FLT 0x0080 /* DC2_FLT */
402#define WM831X_DC2_FLT_MASK 0x0080 /* DC2_FLT */
403#define WM831X_DC2_FLT_SHIFT 7 /* DC2_FLT */
404#define WM831X_DC2_FLT_WIDTH 1 /* DC2_FLT */
405#define WM831X_DC2_SOFT_START_MASK 0x0030 /* DC2_SOFT_START - [5:4] */
406#define WM831X_DC2_SOFT_START_SHIFT 4 /* DC2_SOFT_START - [5:4] */
407#define WM831X_DC2_SOFT_START_WIDTH 2 /* DC2_SOFT_START - [5:4] */
408#define WM831X_DC2_CAP_MASK 0x0003 /* DC2_CAP - [1:0] */
409#define WM831X_DC2_CAP_SHIFT 0 /* DC2_CAP - [1:0] */
410#define WM831X_DC2_CAP_WIDTH 2 /* DC2_CAP - [1:0] */
411
412/*
413 * R16476 (0x405C) - DC2 Control 2
414 */
415#define WM831X_DC2_ERR_ACT_MASK 0xC000 /* DC2_ERR_ACT - [15:14] */
416#define WM831X_DC2_ERR_ACT_SHIFT 14 /* DC2_ERR_ACT - [15:14] */
417#define WM831X_DC2_ERR_ACT_WIDTH 2 /* DC2_ERR_ACT - [15:14] */
418#define WM831X_DC2_HWC_SRC_MASK 0x1800 /* DC2_HWC_SRC - [12:11] */
419#define WM831X_DC2_HWC_SRC_SHIFT 11 /* DC2_HWC_SRC - [12:11] */
420#define WM831X_DC2_HWC_SRC_WIDTH 2 /* DC2_HWC_SRC - [12:11] */
421#define WM831X_DC2_HWC_VSEL 0x0400 /* DC2_HWC_VSEL */
422#define WM831X_DC2_HWC_VSEL_MASK 0x0400 /* DC2_HWC_VSEL */
423#define WM831X_DC2_HWC_VSEL_SHIFT 10 /* DC2_HWC_VSEL */
424#define WM831X_DC2_HWC_VSEL_WIDTH 1 /* DC2_HWC_VSEL */
425#define WM831X_DC2_HWC_MODE_MASK 0x0300 /* DC2_HWC_MODE - [9:8] */
426#define WM831X_DC2_HWC_MODE_SHIFT 8 /* DC2_HWC_MODE - [9:8] */
427#define WM831X_DC2_HWC_MODE_WIDTH 2 /* DC2_HWC_MODE - [9:8] */
428#define WM831X_DC2_HC_THR_MASK 0x0070 /* DC2_HC_THR - [6:4] */
429#define WM831X_DC2_HC_THR_SHIFT 4 /* DC2_HC_THR - [6:4] */
430#define WM831X_DC2_HC_THR_WIDTH 3 /* DC2_HC_THR - [6:4] */
431#define WM831X_DC2_HC_IND_ENA 0x0001 /* DC2_HC_IND_ENA */
432#define WM831X_DC2_HC_IND_ENA_MASK 0x0001 /* DC2_HC_IND_ENA */
433#define WM831X_DC2_HC_IND_ENA_SHIFT 0 /* DC2_HC_IND_ENA */
434#define WM831X_DC2_HC_IND_ENA_WIDTH 1 /* DC2_HC_IND_ENA */
435
436/*
437 * R16477 (0x405D) - DC2 ON Config
438 */
439#define WM831X_DC2_ON_SLOT_MASK 0xE000 /* DC2_ON_SLOT - [15:13] */
440#define WM831X_DC2_ON_SLOT_SHIFT 13 /* DC2_ON_SLOT - [15:13] */
441#define WM831X_DC2_ON_SLOT_WIDTH 3 /* DC2_ON_SLOT - [15:13] */
442#define WM831X_DC2_ON_MODE_MASK 0x0300 /* DC2_ON_MODE - [9:8] */
443#define WM831X_DC2_ON_MODE_SHIFT 8 /* DC2_ON_MODE - [9:8] */
444#define WM831X_DC2_ON_MODE_WIDTH 2 /* DC2_ON_MODE - [9:8] */
445#define WM831X_DC2_ON_VSEL_MASK 0x007F /* DC2_ON_VSEL - [6:0] */
446#define WM831X_DC2_ON_VSEL_SHIFT 0 /* DC2_ON_VSEL - [6:0] */
447#define WM831X_DC2_ON_VSEL_WIDTH 7 /* DC2_ON_VSEL - [6:0] */
448
449/*
450 * R16478 (0x405E) - DC2 SLEEP Control
451 */
452#define WM831X_DC2_SLP_SLOT_MASK 0xE000 /* DC2_SLP_SLOT - [15:13] */
453#define WM831X_DC2_SLP_SLOT_SHIFT 13 /* DC2_SLP_SLOT - [15:13] */
454#define WM831X_DC2_SLP_SLOT_WIDTH 3 /* DC2_SLP_SLOT - [15:13] */
455#define WM831X_DC2_SLP_MODE_MASK 0x0300 /* DC2_SLP_MODE - [9:8] */
456#define WM831X_DC2_SLP_MODE_SHIFT 8 /* DC2_SLP_MODE - [9:8] */
457#define WM831X_DC2_SLP_MODE_WIDTH 2 /* DC2_SLP_MODE - [9:8] */
458#define WM831X_DC2_SLP_VSEL_MASK 0x007F /* DC2_SLP_VSEL - [6:0] */
459#define WM831X_DC2_SLP_VSEL_SHIFT 0 /* DC2_SLP_VSEL - [6:0] */
460#define WM831X_DC2_SLP_VSEL_WIDTH 7 /* DC2_SLP_VSEL - [6:0] */
461
462/*
463 * R16479 (0x405F) - DC2 DVS Control
464 */
465#define WM831X_DC2_DVS_SRC_MASK 0x1800 /* DC2_DVS_SRC - [12:11] */
466#define WM831X_DC2_DVS_SRC_SHIFT 11 /* DC2_DVS_SRC - [12:11] */
467#define WM831X_DC2_DVS_SRC_WIDTH 2 /* DC2_DVS_SRC - [12:11] */
468#define WM831X_DC2_DVS_VSEL_MASK 0x007F /* DC2_DVS_VSEL - [6:0] */
469#define WM831X_DC2_DVS_VSEL_SHIFT 0 /* DC2_DVS_VSEL - [6:0] */
470#define WM831X_DC2_DVS_VSEL_WIDTH 7 /* DC2_DVS_VSEL - [6:0] */
471
472/*
473 * R16480 (0x4060) - DC3 Control 1
474 */
475#define WM831X_DC3_PHASE 0x1000 /* DC3_PHASE */
476#define WM831X_DC3_PHASE_MASK 0x1000 /* DC3_PHASE */
477#define WM831X_DC3_PHASE_SHIFT 12 /* DC3_PHASE */
478#define WM831X_DC3_PHASE_WIDTH 1 /* DC3_PHASE */
479#define WM831X_DC3_FLT 0x0080 /* DC3_FLT */
480#define WM831X_DC3_FLT_MASK 0x0080 /* DC3_FLT */
481#define WM831X_DC3_FLT_SHIFT 7 /* DC3_FLT */
482#define WM831X_DC3_FLT_WIDTH 1 /* DC3_FLT */
483#define WM831X_DC3_SOFT_START_MASK 0x0030 /* DC3_SOFT_START - [5:4] */
484#define WM831X_DC3_SOFT_START_SHIFT 4 /* DC3_SOFT_START - [5:4] */
485#define WM831X_DC3_SOFT_START_WIDTH 2 /* DC3_SOFT_START - [5:4] */
486#define WM831X_DC3_STNBY_LIM_MASK 0x000C /* DC3_STNBY_LIM - [3:2] */
487#define WM831X_DC3_STNBY_LIM_SHIFT 2 /* DC3_STNBY_LIM - [3:2] */
488#define WM831X_DC3_STNBY_LIM_WIDTH 2 /* DC3_STNBY_LIM - [3:2] */
489#define WM831X_DC3_CAP_MASK 0x0003 /* DC3_CAP - [1:0] */
490#define WM831X_DC3_CAP_SHIFT 0 /* DC3_CAP - [1:0] */
491#define WM831X_DC3_CAP_WIDTH 2 /* DC3_CAP - [1:0] */
492
493/*
494 * R16481 (0x4061) - DC3 Control 2
495 */
496#define WM831X_DC3_ERR_ACT_MASK 0xC000 /* DC3_ERR_ACT - [15:14] */
497#define WM831X_DC3_ERR_ACT_SHIFT 14 /* DC3_ERR_ACT - [15:14] */
498#define WM831X_DC3_ERR_ACT_WIDTH 2 /* DC3_ERR_ACT - [15:14] */
499#define WM831X_DC3_HWC_SRC_MASK 0x1800 /* DC3_HWC_SRC - [12:11] */
500#define WM831X_DC3_HWC_SRC_SHIFT 11 /* DC3_HWC_SRC - [12:11] */
501#define WM831X_DC3_HWC_SRC_WIDTH 2 /* DC3_HWC_SRC - [12:11] */
502#define WM831X_DC3_HWC_VSEL 0x0400 /* DC3_HWC_VSEL */
503#define WM831X_DC3_HWC_VSEL_MASK 0x0400 /* DC3_HWC_VSEL */
504#define WM831X_DC3_HWC_VSEL_SHIFT 10 /* DC3_HWC_VSEL */
505#define WM831X_DC3_HWC_VSEL_WIDTH 1 /* DC3_HWC_VSEL */
506#define WM831X_DC3_HWC_MODE_MASK 0x0300 /* DC3_HWC_MODE - [9:8] */
507#define WM831X_DC3_HWC_MODE_SHIFT 8 /* DC3_HWC_MODE - [9:8] */
508#define WM831X_DC3_HWC_MODE_WIDTH 2 /* DC3_HWC_MODE - [9:8] */
509#define WM831X_DC3_OVP 0x0080 /* DC3_OVP */
510#define WM831X_DC3_OVP_MASK 0x0080 /* DC3_OVP */
511#define WM831X_DC3_OVP_SHIFT 7 /* DC3_OVP */
512#define WM831X_DC3_OVP_WIDTH 1 /* DC3_OVP */
513
514/*
515 * R16482 (0x4062) - DC3 ON Config
516 */
517#define WM831X_DC3_ON_SLOT_MASK 0xE000 /* DC3_ON_SLOT - [15:13] */
518#define WM831X_DC3_ON_SLOT_SHIFT 13 /* DC3_ON_SLOT - [15:13] */
519#define WM831X_DC3_ON_SLOT_WIDTH 3 /* DC3_ON_SLOT - [15:13] */
520#define WM831X_DC3_ON_MODE_MASK 0x0300 /* DC3_ON_MODE - [9:8] */
521#define WM831X_DC3_ON_MODE_SHIFT 8 /* DC3_ON_MODE - [9:8] */
522#define WM831X_DC3_ON_MODE_WIDTH 2 /* DC3_ON_MODE - [9:8] */
523#define WM831X_DC3_ON_VSEL_MASK 0x007F /* DC3_ON_VSEL - [6:0] */
524#define WM831X_DC3_ON_VSEL_SHIFT 0 /* DC3_ON_VSEL - [6:0] */
525#define WM831X_DC3_ON_VSEL_WIDTH 7 /* DC3_ON_VSEL - [6:0] */
526
527/*
528 * R16483 (0x4063) - DC3 SLEEP Control
529 */
530#define WM831X_DC3_SLP_SLOT_MASK 0xE000 /* DC3_SLP_SLOT - [15:13] */
531#define WM831X_DC3_SLP_SLOT_SHIFT 13 /* DC3_SLP_SLOT - [15:13] */
532#define WM831X_DC3_SLP_SLOT_WIDTH 3 /* DC3_SLP_SLOT - [15:13] */
533#define WM831X_DC3_SLP_MODE_MASK 0x0300 /* DC3_SLP_MODE - [9:8] */
534#define WM831X_DC3_SLP_MODE_SHIFT 8 /* DC3_SLP_MODE - [9:8] */
535#define WM831X_DC3_SLP_MODE_WIDTH 2 /* DC3_SLP_MODE - [9:8] */
536#define WM831X_DC3_SLP_VSEL_MASK 0x007F /* DC3_SLP_VSEL - [6:0] */
537#define WM831X_DC3_SLP_VSEL_SHIFT 0 /* DC3_SLP_VSEL - [6:0] */
538#define WM831X_DC3_SLP_VSEL_WIDTH 7 /* DC3_SLP_VSEL - [6:0] */
539
540/*
541 * R16484 (0x4064) - DC4 Control
542 */
543#define WM831X_DC4_ERR_ACT_MASK 0xC000 /* DC4_ERR_ACT - [15:14] */
544#define WM831X_DC4_ERR_ACT_SHIFT 14 /* DC4_ERR_ACT - [15:14] */
545#define WM831X_DC4_ERR_ACT_WIDTH 2 /* DC4_ERR_ACT - [15:14] */
546#define WM831X_DC4_HWC_SRC_MASK 0x1800 /* DC4_HWC_SRC - [12:11] */
547#define WM831X_DC4_HWC_SRC_SHIFT 11 /* DC4_HWC_SRC - [12:11] */
548#define WM831X_DC4_HWC_SRC_WIDTH 2 /* DC4_HWC_SRC - [12:11] */
549#define WM831X_DC4_HWC_MODE 0x0100 /* DC4_HWC_MODE */
550#define WM831X_DC4_HWC_MODE_MASK 0x0100 /* DC4_HWC_MODE */
551#define WM831X_DC4_HWC_MODE_SHIFT 8 /* DC4_HWC_MODE */
552#define WM831X_DC4_HWC_MODE_WIDTH 1 /* DC4_HWC_MODE */
553#define WM831X_DC4_RANGE_MASK 0x000C /* DC4_RANGE - [3:2] */
554#define WM831X_DC4_RANGE_SHIFT 2 /* DC4_RANGE - [3:2] */
555#define WM831X_DC4_RANGE_WIDTH 2 /* DC4_RANGE - [3:2] */
556#define WM831X_DC4_FBSRC 0x0001 /* DC4_FBSRC */
557#define WM831X_DC4_FBSRC_MASK 0x0001 /* DC4_FBSRC */
558#define WM831X_DC4_FBSRC_SHIFT 0 /* DC4_FBSRC */
559#define WM831X_DC4_FBSRC_WIDTH 1 /* DC4_FBSRC */
560
561/*
562 * R16485 (0x4065) - DC4 SLEEP Control
563 */
564#define WM831X_DC4_SLPENA 0x0100 /* DC4_SLPENA */
565#define WM831X_DC4_SLPENA_MASK 0x0100 /* DC4_SLPENA */
566#define WM831X_DC4_SLPENA_SHIFT 8 /* DC4_SLPENA */
567#define WM831X_DC4_SLPENA_WIDTH 1 /* DC4_SLPENA */
568
569/*
570 * R16488 (0x4068) - LDO1 Control
571 */
572#define WM831X_LDO1_ERR_ACT_MASK 0xC000 /* LDO1_ERR_ACT - [15:14] */
573#define WM831X_LDO1_ERR_ACT_SHIFT 14 /* LDO1_ERR_ACT - [15:14] */
574#define WM831X_LDO1_ERR_ACT_WIDTH 2 /* LDO1_ERR_ACT - [15:14] */
575#define WM831X_LDO1_HWC_SRC_MASK 0x1800 /* LDO1_HWC_SRC - [12:11] */
576#define WM831X_LDO1_HWC_SRC_SHIFT 11 /* LDO1_HWC_SRC - [12:11] */
577#define WM831X_LDO1_HWC_SRC_WIDTH 2 /* LDO1_HWC_SRC - [12:11] */
578#define WM831X_LDO1_HWC_VSEL 0x0400 /* LDO1_HWC_VSEL */
579#define WM831X_LDO1_HWC_VSEL_MASK 0x0400 /* LDO1_HWC_VSEL */
580#define WM831X_LDO1_HWC_VSEL_SHIFT 10 /* LDO1_HWC_VSEL */
581#define WM831X_LDO1_HWC_VSEL_WIDTH 1 /* LDO1_HWC_VSEL */
582#define WM831X_LDO1_HWC_MODE_MASK 0x0300 /* LDO1_HWC_MODE - [9:8] */
583#define WM831X_LDO1_HWC_MODE_SHIFT 8 /* LDO1_HWC_MODE - [9:8] */
584#define WM831X_LDO1_HWC_MODE_WIDTH 2 /* LDO1_HWC_MODE - [9:8] */
585#define WM831X_LDO1_FLT 0x0080 /* LDO1_FLT */
586#define WM831X_LDO1_FLT_MASK 0x0080 /* LDO1_FLT */
587#define WM831X_LDO1_FLT_SHIFT 7 /* LDO1_FLT */
588#define WM831X_LDO1_FLT_WIDTH 1 /* LDO1_FLT */
589#define WM831X_LDO1_SWI 0x0040 /* LDO1_SWI */
590#define WM831X_LDO1_SWI_MASK 0x0040 /* LDO1_SWI */
591#define WM831X_LDO1_SWI_SHIFT 6 /* LDO1_SWI */
592#define WM831X_LDO1_SWI_WIDTH 1 /* LDO1_SWI */
593#define WM831X_LDO1_LP_MODE 0x0001 /* LDO1_LP_MODE */
594#define WM831X_LDO1_LP_MODE_MASK 0x0001 /* LDO1_LP_MODE */
595#define WM831X_LDO1_LP_MODE_SHIFT 0 /* LDO1_LP_MODE */
596#define WM831X_LDO1_LP_MODE_WIDTH 1 /* LDO1_LP_MODE */
597
598/*
599 * R16489 (0x4069) - LDO1 ON Control
600 */
601#define WM831X_LDO1_ON_SLOT_MASK 0xE000 /* LDO1_ON_SLOT - [15:13] */
602#define WM831X_LDO1_ON_SLOT_SHIFT 13 /* LDO1_ON_SLOT - [15:13] */
603#define WM831X_LDO1_ON_SLOT_WIDTH 3 /* LDO1_ON_SLOT - [15:13] */
604#define WM831X_LDO1_ON_MODE 0x0100 /* LDO1_ON_MODE */
605#define WM831X_LDO1_ON_MODE_MASK 0x0100 /* LDO1_ON_MODE */
606#define WM831X_LDO1_ON_MODE_SHIFT 8 /* LDO1_ON_MODE */
607#define WM831X_LDO1_ON_MODE_WIDTH 1 /* LDO1_ON_MODE */
608#define WM831X_LDO1_ON_VSEL_MASK 0x001F /* LDO1_ON_VSEL - [4:0] */
609#define WM831X_LDO1_ON_VSEL_SHIFT 0 /* LDO1_ON_VSEL - [4:0] */
610#define WM831X_LDO1_ON_VSEL_WIDTH 5 /* LDO1_ON_VSEL - [4:0] */
611
612/*
613 * R16490 (0x406A) - LDO1 SLEEP Control
614 */
615#define WM831X_LDO1_SLP_SLOT_MASK 0xE000 /* LDO1_SLP_SLOT - [15:13] */
616#define WM831X_LDO1_SLP_SLOT_SHIFT 13 /* LDO1_SLP_SLOT - [15:13] */
617#define WM831X_LDO1_SLP_SLOT_WIDTH 3 /* LDO1_SLP_SLOT - [15:13] */
618#define WM831X_LDO1_SLP_MODE 0x0100 /* LDO1_SLP_MODE */
619#define WM831X_LDO1_SLP_MODE_MASK 0x0100 /* LDO1_SLP_MODE */
620#define WM831X_LDO1_SLP_MODE_SHIFT 8 /* LDO1_SLP_MODE */
621#define WM831X_LDO1_SLP_MODE_WIDTH 1 /* LDO1_SLP_MODE */
622#define WM831X_LDO1_SLP_VSEL_MASK 0x001F /* LDO1_SLP_VSEL - [4:0] */
623#define WM831X_LDO1_SLP_VSEL_SHIFT 0 /* LDO1_SLP_VSEL - [4:0] */
624#define WM831X_LDO1_SLP_VSEL_WIDTH 5 /* LDO1_SLP_VSEL - [4:0] */
625
626/*
627 * R16491 (0x406B) - LDO2 Control
628 */
629#define WM831X_LDO2_ERR_ACT_MASK 0xC000 /* LDO2_ERR_ACT - [15:14] */
630#define WM831X_LDO2_ERR_ACT_SHIFT 14 /* LDO2_ERR_ACT - [15:14] */
631#define WM831X_LDO2_ERR_ACT_WIDTH 2 /* LDO2_ERR_ACT - [15:14] */
632#define WM831X_LDO2_HWC_SRC_MASK 0x1800 /* LDO2_HWC_SRC - [12:11] */
633#define WM831X_LDO2_HWC_SRC_SHIFT 11 /* LDO2_HWC_SRC - [12:11] */
634#define WM831X_LDO2_HWC_SRC_WIDTH 2 /* LDO2_HWC_SRC - [12:11] */
635#define WM831X_LDO2_HWC_VSEL 0x0400 /* LDO2_HWC_VSEL */
636#define WM831X_LDO2_HWC_VSEL_MASK 0x0400 /* LDO2_HWC_VSEL */
637#define WM831X_LDO2_HWC_VSEL_SHIFT 10 /* LDO2_HWC_VSEL */
638#define WM831X_LDO2_HWC_VSEL_WIDTH 1 /* LDO2_HWC_VSEL */
639#define WM831X_LDO2_HWC_MODE_MASK 0x0300 /* LDO2_HWC_MODE - [9:8] */
640#define WM831X_LDO2_HWC_MODE_SHIFT 8 /* LDO2_HWC_MODE - [9:8] */
641#define WM831X_LDO2_HWC_MODE_WIDTH 2 /* LDO2_HWC_MODE - [9:8] */
642#define WM831X_LDO2_FLT 0x0080 /* LDO2_FLT */
643#define WM831X_LDO2_FLT_MASK 0x0080 /* LDO2_FLT */
644#define WM831X_LDO2_FLT_SHIFT 7 /* LDO2_FLT */
645#define WM831X_LDO2_FLT_WIDTH 1 /* LDO2_FLT */
646#define WM831X_LDO2_SWI 0x0040 /* LDO2_SWI */
647#define WM831X_LDO2_SWI_MASK 0x0040 /* LDO2_SWI */
648#define WM831X_LDO2_SWI_SHIFT 6 /* LDO2_SWI */
649#define WM831X_LDO2_SWI_WIDTH 1 /* LDO2_SWI */
650#define WM831X_LDO2_LP_MODE 0x0001 /* LDO2_LP_MODE */
651#define WM831X_LDO2_LP_MODE_MASK 0x0001 /* LDO2_LP_MODE */
652#define WM831X_LDO2_LP_MODE_SHIFT 0 /* LDO2_LP_MODE */
653#define WM831X_LDO2_LP_MODE_WIDTH 1 /* LDO2_LP_MODE */
654
655/*
656 * R16492 (0x406C) - LDO2 ON Control
657 */
658#define WM831X_LDO2_ON_SLOT_MASK 0xE000 /* LDO2_ON_SLOT - [15:13] */
659#define WM831X_LDO2_ON_SLOT_SHIFT 13 /* LDO2_ON_SLOT - [15:13] */
660#define WM831X_LDO2_ON_SLOT_WIDTH 3 /* LDO2_ON_SLOT - [15:13] */
661#define WM831X_LDO2_ON_MODE 0x0100 /* LDO2_ON_MODE */
662#define WM831X_LDO2_ON_MODE_MASK 0x0100 /* LDO2_ON_MODE */
663#define WM831X_LDO2_ON_MODE_SHIFT 8 /* LDO2_ON_MODE */
664#define WM831X_LDO2_ON_MODE_WIDTH 1 /* LDO2_ON_MODE */
665#define WM831X_LDO2_ON_VSEL_MASK 0x001F /* LDO2_ON_VSEL - [4:0] */
666#define WM831X_LDO2_ON_VSEL_SHIFT 0 /* LDO2_ON_VSEL - [4:0] */
667#define WM831X_LDO2_ON_VSEL_WIDTH 5 /* LDO2_ON_VSEL - [4:0] */
668
669/*
670 * R16493 (0x406D) - LDO2 SLEEP Control
671 */
672#define WM831X_LDO2_SLP_SLOT_MASK 0xE000 /* LDO2_SLP_SLOT - [15:13] */
673#define WM831X_LDO2_SLP_SLOT_SHIFT 13 /* LDO2_SLP_SLOT - [15:13] */
674#define WM831X_LDO2_SLP_SLOT_WIDTH 3 /* LDO2_SLP_SLOT - [15:13] */
675#define WM831X_LDO2_SLP_MODE 0x0100 /* LDO2_SLP_MODE */
676#define WM831X_LDO2_SLP_MODE_MASK 0x0100 /* LDO2_SLP_MODE */
677#define WM831X_LDO2_SLP_MODE_SHIFT 8 /* LDO2_SLP_MODE */
678#define WM831X_LDO2_SLP_MODE_WIDTH 1 /* LDO2_SLP_MODE */
679#define WM831X_LDO2_SLP_VSEL_MASK 0x001F /* LDO2_SLP_VSEL - [4:0] */
680#define WM831X_LDO2_SLP_VSEL_SHIFT 0 /* LDO2_SLP_VSEL - [4:0] */
681#define WM831X_LDO2_SLP_VSEL_WIDTH 5 /* LDO2_SLP_VSEL - [4:0] */
682
683/*
684 * R16494 (0x406E) - LDO3 Control
685 */
686#define WM831X_LDO3_ERR_ACT_MASK 0xC000 /* LDO3_ERR_ACT - [15:14] */
687#define WM831X_LDO3_ERR_ACT_SHIFT 14 /* LDO3_ERR_ACT - [15:14] */
688#define WM831X_LDO3_ERR_ACT_WIDTH 2 /* LDO3_ERR_ACT - [15:14] */
689#define WM831X_LDO3_HWC_SRC_MASK 0x1800 /* LDO3_HWC_SRC - [12:11] */
690#define WM831X_LDO3_HWC_SRC_SHIFT 11 /* LDO3_HWC_SRC - [12:11] */
691#define WM831X_LDO3_HWC_SRC_WIDTH 2 /* LDO3_HWC_SRC - [12:11] */
692#define WM831X_LDO3_HWC_VSEL 0x0400 /* LDO3_HWC_VSEL */
693#define WM831X_LDO3_HWC_VSEL_MASK 0x0400 /* LDO3_HWC_VSEL */
694#define WM831X_LDO3_HWC_VSEL_SHIFT 10 /* LDO3_HWC_VSEL */
695#define WM831X_LDO3_HWC_VSEL_WIDTH 1 /* LDO3_HWC_VSEL */
696#define WM831X_LDO3_HWC_MODE_MASK 0x0300 /* LDO3_HWC_MODE - [9:8] */
697#define WM831X_LDO3_HWC_MODE_SHIFT 8 /* LDO3_HWC_MODE - [9:8] */
698#define WM831X_LDO3_HWC_MODE_WIDTH 2 /* LDO3_HWC_MODE - [9:8] */
699#define WM831X_LDO3_FLT 0x0080 /* LDO3_FLT */
700#define WM831X_LDO3_FLT_MASK 0x0080 /* LDO3_FLT */
701#define WM831X_LDO3_FLT_SHIFT 7 /* LDO3_FLT */
702#define WM831X_LDO3_FLT_WIDTH 1 /* LDO3_FLT */
703#define WM831X_LDO3_SWI 0x0040 /* LDO3_SWI */
704#define WM831X_LDO3_SWI_MASK 0x0040 /* LDO3_SWI */
705#define WM831X_LDO3_SWI_SHIFT 6 /* LDO3_SWI */
706#define WM831X_LDO3_SWI_WIDTH 1 /* LDO3_SWI */
707#define WM831X_LDO3_LP_MODE 0x0001 /* LDO3_LP_MODE */
708#define WM831X_LDO3_LP_MODE_MASK 0x0001 /* LDO3_LP_MODE */
709#define WM831X_LDO3_LP_MODE_SHIFT 0 /* LDO3_LP_MODE */
710#define WM831X_LDO3_LP_MODE_WIDTH 1 /* LDO3_LP_MODE */
711
712/*
713 * R16495 (0x406F) - LDO3 ON Control
714 */
715#define WM831X_LDO3_ON_SLOT_MASK 0xE000 /* LDO3_ON_SLOT - [15:13] */
716#define WM831X_LDO3_ON_SLOT_SHIFT 13 /* LDO3_ON_SLOT - [15:13] */
717#define WM831X_LDO3_ON_SLOT_WIDTH 3 /* LDO3_ON_SLOT - [15:13] */
718#define WM831X_LDO3_ON_MODE 0x0100 /* LDO3_ON_MODE */
719#define WM831X_LDO3_ON_MODE_MASK 0x0100 /* LDO3_ON_MODE */
720#define WM831X_LDO3_ON_MODE_SHIFT 8 /* LDO3_ON_MODE */
721#define WM831X_LDO3_ON_MODE_WIDTH 1 /* LDO3_ON_MODE */
722#define WM831X_LDO3_ON_VSEL_MASK 0x001F /* LDO3_ON_VSEL - [4:0] */
723#define WM831X_LDO3_ON_VSEL_SHIFT 0 /* LDO3_ON_VSEL - [4:0] */
724#define WM831X_LDO3_ON_VSEL_WIDTH 5 /* LDO3_ON_VSEL - [4:0] */
725
726/*
727 * R16496 (0x4070) - LDO3 SLEEP Control
728 */
729#define WM831X_LDO3_SLP_SLOT_MASK 0xE000 /* LDO3_SLP_SLOT - [15:13] */
730#define WM831X_LDO3_SLP_SLOT_SHIFT 13 /* LDO3_SLP_SLOT - [15:13] */
731#define WM831X_LDO3_SLP_SLOT_WIDTH 3 /* LDO3_SLP_SLOT - [15:13] */
732#define WM831X_LDO3_SLP_MODE 0x0100 /* LDO3_SLP_MODE */
733#define WM831X_LDO3_SLP_MODE_MASK 0x0100 /* LDO3_SLP_MODE */
734#define WM831X_LDO3_SLP_MODE_SHIFT 8 /* LDO3_SLP_MODE */
735#define WM831X_LDO3_SLP_MODE_WIDTH 1 /* LDO3_SLP_MODE */
736#define WM831X_LDO3_SLP_VSEL_MASK 0x001F /* LDO3_SLP_VSEL - [4:0] */
737#define WM831X_LDO3_SLP_VSEL_SHIFT 0 /* LDO3_SLP_VSEL - [4:0] */
738#define WM831X_LDO3_SLP_VSEL_WIDTH 5 /* LDO3_SLP_VSEL - [4:0] */
739
740/*
741 * R16497 (0x4071) - LDO4 Control
742 */
743#define WM831X_LDO4_ERR_ACT_MASK 0xC000 /* LDO4_ERR_ACT - [15:14] */
744#define WM831X_LDO4_ERR_ACT_SHIFT 14 /* LDO4_ERR_ACT - [15:14] */
745#define WM831X_LDO4_ERR_ACT_WIDTH 2 /* LDO4_ERR_ACT - [15:14] */
746#define WM831X_LDO4_HWC_SRC_MASK 0x1800 /* LDO4_HWC_SRC - [12:11] */
747#define WM831X_LDO4_HWC_SRC_SHIFT 11 /* LDO4_HWC_SRC - [12:11] */
748#define WM831X_LDO4_HWC_SRC_WIDTH 2 /* LDO4_HWC_SRC - [12:11] */
749#define WM831X_LDO4_HWC_VSEL 0x0400 /* LDO4_HWC_VSEL */
750#define WM831X_LDO4_HWC_VSEL_MASK 0x0400 /* LDO4_HWC_VSEL */
751#define WM831X_LDO4_HWC_VSEL_SHIFT 10 /* LDO4_HWC_VSEL */
752#define WM831X_LDO4_HWC_VSEL_WIDTH 1 /* LDO4_HWC_VSEL */
753#define WM831X_LDO4_HWC_MODE_MASK 0x0300 /* LDO4_HWC_MODE - [9:8] */
754#define WM831X_LDO4_HWC_MODE_SHIFT 8 /* LDO4_HWC_MODE - [9:8] */
755#define WM831X_LDO4_HWC_MODE_WIDTH 2 /* LDO4_HWC_MODE - [9:8] */
756#define WM831X_LDO4_FLT 0x0080 /* LDO4_FLT */
757#define WM831X_LDO4_FLT_MASK 0x0080 /* LDO4_FLT */
758#define WM831X_LDO4_FLT_SHIFT 7 /* LDO4_FLT */
759#define WM831X_LDO4_FLT_WIDTH 1 /* LDO4_FLT */
760#define WM831X_LDO4_SWI 0x0040 /* LDO4_SWI */
761#define WM831X_LDO4_SWI_MASK 0x0040 /* LDO4_SWI */
762#define WM831X_LDO4_SWI_SHIFT 6 /* LDO4_SWI */
763#define WM831X_LDO4_SWI_WIDTH 1 /* LDO4_SWI */
764#define WM831X_LDO4_LP_MODE 0x0001 /* LDO4_LP_MODE */
765#define WM831X_LDO4_LP_MODE_MASK 0x0001 /* LDO4_LP_MODE */
766#define WM831X_LDO4_LP_MODE_SHIFT 0 /* LDO4_LP_MODE */
767#define WM831X_LDO4_LP_MODE_WIDTH 1 /* LDO4_LP_MODE */
768
769/*
770 * R16498 (0x4072) - LDO4 ON Control
771 */
772#define WM831X_LDO4_ON_SLOT_MASK 0xE000 /* LDO4_ON_SLOT - [15:13] */
773#define WM831X_LDO4_ON_SLOT_SHIFT 13 /* LDO4_ON_SLOT - [15:13] */
774#define WM831X_LDO4_ON_SLOT_WIDTH 3 /* LDO4_ON_SLOT - [15:13] */
775#define WM831X_LDO4_ON_MODE 0x0100 /* LDO4_ON_MODE */
776#define WM831X_LDO4_ON_MODE_MASK 0x0100 /* LDO4_ON_MODE */
777#define WM831X_LDO4_ON_MODE_SHIFT 8 /* LDO4_ON_MODE */
778#define WM831X_LDO4_ON_MODE_WIDTH 1 /* LDO4_ON_MODE */
779#define WM831X_LDO4_ON_VSEL_MASK 0x001F /* LDO4_ON_VSEL - [4:0] */
780#define WM831X_LDO4_ON_VSEL_SHIFT 0 /* LDO4_ON_VSEL - [4:0] */
781#define WM831X_LDO4_ON_VSEL_WIDTH 5 /* LDO4_ON_VSEL - [4:0] */
782
783/*
784 * R16499 (0x4073) - LDO4 SLEEP Control
785 */
786#define WM831X_LDO4_SLP_SLOT_MASK 0xE000 /* LDO4_SLP_SLOT - [15:13] */
787#define WM831X_LDO4_SLP_SLOT_SHIFT 13 /* LDO4_SLP_SLOT - [15:13] */
788#define WM831X_LDO4_SLP_SLOT_WIDTH 3 /* LDO4_SLP_SLOT - [15:13] */
789#define WM831X_LDO4_SLP_MODE 0x0100 /* LDO4_SLP_MODE */
790#define WM831X_LDO4_SLP_MODE_MASK 0x0100 /* LDO4_SLP_MODE */
791#define WM831X_LDO4_SLP_MODE_SHIFT 8 /* LDO4_SLP_MODE */
792#define WM831X_LDO4_SLP_MODE_WIDTH 1 /* LDO4_SLP_MODE */
793#define WM831X_LDO4_SLP_VSEL_MASK 0x001F /* LDO4_SLP_VSEL - [4:0] */
794#define WM831X_LDO4_SLP_VSEL_SHIFT 0 /* LDO4_SLP_VSEL - [4:0] */
795#define WM831X_LDO4_SLP_VSEL_WIDTH 5 /* LDO4_SLP_VSEL - [4:0] */
796
797/*
798 * R16500 (0x4074) - LDO5 Control
799 */
800#define WM831X_LDO5_ERR_ACT_MASK 0xC000 /* LDO5_ERR_ACT - [15:14] */
801#define WM831X_LDO5_ERR_ACT_SHIFT 14 /* LDO5_ERR_ACT - [15:14] */
802#define WM831X_LDO5_ERR_ACT_WIDTH 2 /* LDO5_ERR_ACT - [15:14] */
803#define WM831X_LDO5_HWC_SRC_MASK 0x1800 /* LDO5_HWC_SRC - [12:11] */
804#define WM831X_LDO5_HWC_SRC_SHIFT 11 /* LDO5_HWC_SRC - [12:11] */
805#define WM831X_LDO5_HWC_SRC_WIDTH 2 /* LDO5_HWC_SRC - [12:11] */
806#define WM831X_LDO5_HWC_VSEL 0x0400 /* LDO5_HWC_VSEL */
807#define WM831X_LDO5_HWC_VSEL_MASK 0x0400 /* LDO5_HWC_VSEL */
808#define WM831X_LDO5_HWC_VSEL_SHIFT 10 /* LDO5_HWC_VSEL */
809#define WM831X_LDO5_HWC_VSEL_WIDTH 1 /* LDO5_HWC_VSEL */
810#define WM831X_LDO5_HWC_MODE_MASK 0x0300 /* LDO5_HWC_MODE - [9:8] */
811#define WM831X_LDO5_HWC_MODE_SHIFT 8 /* LDO5_HWC_MODE - [9:8] */
812#define WM831X_LDO5_HWC_MODE_WIDTH 2 /* LDO5_HWC_MODE - [9:8] */
813#define WM831X_LDO5_FLT 0x0080 /* LDO5_FLT */
814#define WM831X_LDO5_FLT_MASK 0x0080 /* LDO5_FLT */
815#define WM831X_LDO5_FLT_SHIFT 7 /* LDO5_FLT */
816#define WM831X_LDO5_FLT_WIDTH 1 /* LDO5_FLT */
817#define WM831X_LDO5_SWI 0x0040 /* LDO5_SWI */
818#define WM831X_LDO5_SWI_MASK 0x0040 /* LDO5_SWI */
819#define WM831X_LDO5_SWI_SHIFT 6 /* LDO5_SWI */
820#define WM831X_LDO5_SWI_WIDTH 1 /* LDO5_SWI */
821#define WM831X_LDO5_LP_MODE 0x0001 /* LDO5_LP_MODE */
822#define WM831X_LDO5_LP_MODE_MASK 0x0001 /* LDO5_LP_MODE */
823#define WM831X_LDO5_LP_MODE_SHIFT 0 /* LDO5_LP_MODE */
824#define WM831X_LDO5_LP_MODE_WIDTH 1 /* LDO5_LP_MODE */
825
826/*
827 * R16501 (0x4075) - LDO5 ON Control
828 */
829#define WM831X_LDO5_ON_SLOT_MASK 0xE000 /* LDO5_ON_SLOT - [15:13] */
830#define WM831X_LDO5_ON_SLOT_SHIFT 13 /* LDO5_ON_SLOT - [15:13] */
831#define WM831X_LDO5_ON_SLOT_WIDTH 3 /* LDO5_ON_SLOT - [15:13] */
832#define WM831X_LDO5_ON_MODE 0x0100 /* LDO5_ON_MODE */
833#define WM831X_LDO5_ON_MODE_MASK 0x0100 /* LDO5_ON_MODE */
834#define WM831X_LDO5_ON_MODE_SHIFT 8 /* LDO5_ON_MODE */
835#define WM831X_LDO5_ON_MODE_WIDTH 1 /* LDO5_ON_MODE */
836#define WM831X_LDO5_ON_VSEL_MASK 0x001F /* LDO5_ON_VSEL - [4:0] */
837#define WM831X_LDO5_ON_VSEL_SHIFT 0 /* LDO5_ON_VSEL - [4:0] */
838#define WM831X_LDO5_ON_VSEL_WIDTH 5 /* LDO5_ON_VSEL - [4:0] */
839
840/*
841 * R16502 (0x4076) - LDO5 SLEEP Control
842 */
843#define WM831X_LDO5_SLP_SLOT_MASK 0xE000 /* LDO5_SLP_SLOT - [15:13] */
844#define WM831X_LDO5_SLP_SLOT_SHIFT 13 /* LDO5_SLP_SLOT - [15:13] */
845#define WM831X_LDO5_SLP_SLOT_WIDTH 3 /* LDO5_SLP_SLOT - [15:13] */
846#define WM831X_LDO5_SLP_MODE 0x0100 /* LDO5_SLP_MODE */
847#define WM831X_LDO5_SLP_MODE_MASK 0x0100 /* LDO5_SLP_MODE */
848#define WM831X_LDO5_SLP_MODE_SHIFT 8 /* LDO5_SLP_MODE */
849#define WM831X_LDO5_SLP_MODE_WIDTH 1 /* LDO5_SLP_MODE */
850#define WM831X_LDO5_SLP_VSEL_MASK 0x001F /* LDO5_SLP_VSEL - [4:0] */
851#define WM831X_LDO5_SLP_VSEL_SHIFT 0 /* LDO5_SLP_VSEL - [4:0] */
852#define WM831X_LDO5_SLP_VSEL_WIDTH 5 /* LDO5_SLP_VSEL - [4:0] */
853
854/*
855 * R16503 (0x4077) - LDO6 Control
856 */
857#define WM831X_LDO6_ERR_ACT_MASK 0xC000 /* LDO6_ERR_ACT - [15:14] */
858#define WM831X_LDO6_ERR_ACT_SHIFT 14 /* LDO6_ERR_ACT - [15:14] */
859#define WM831X_LDO6_ERR_ACT_WIDTH 2 /* LDO6_ERR_ACT - [15:14] */
860#define WM831X_LDO6_HWC_SRC_MASK 0x1800 /* LDO6_HWC_SRC - [12:11] */
861#define WM831X_LDO6_HWC_SRC_SHIFT 11 /* LDO6_HWC_SRC - [12:11] */
862#define WM831X_LDO6_HWC_SRC_WIDTH 2 /* LDO6_HWC_SRC - [12:11] */
863#define WM831X_LDO6_HWC_VSEL 0x0400 /* LDO6_HWC_VSEL */
864#define WM831X_LDO6_HWC_VSEL_MASK 0x0400 /* LDO6_HWC_VSEL */
865#define WM831X_LDO6_HWC_VSEL_SHIFT 10 /* LDO6_HWC_VSEL */
866#define WM831X_LDO6_HWC_VSEL_WIDTH 1 /* LDO6_HWC_VSEL */
867#define WM831X_LDO6_HWC_MODE_MASK 0x0300 /* LDO6_HWC_MODE - [9:8] */
868#define WM831X_LDO6_HWC_MODE_SHIFT 8 /* LDO6_HWC_MODE - [9:8] */
869#define WM831X_LDO6_HWC_MODE_WIDTH 2 /* LDO6_HWC_MODE - [9:8] */
870#define WM831X_LDO6_FLT 0x0080 /* LDO6_FLT */
871#define WM831X_LDO6_FLT_MASK 0x0080 /* LDO6_FLT */
872#define WM831X_LDO6_FLT_SHIFT 7 /* LDO6_FLT */
873#define WM831X_LDO6_FLT_WIDTH 1 /* LDO6_FLT */
874#define WM831X_LDO6_SWI 0x0040 /* LDO6_SWI */
875#define WM831X_LDO6_SWI_MASK 0x0040 /* LDO6_SWI */
876#define WM831X_LDO6_SWI_SHIFT 6 /* LDO6_SWI */
877#define WM831X_LDO6_SWI_WIDTH 1 /* LDO6_SWI */
878#define WM831X_LDO6_LP_MODE 0x0001 /* LDO6_LP_MODE */
879#define WM831X_LDO6_LP_MODE_MASK 0x0001 /* LDO6_LP_MODE */
880#define WM831X_LDO6_LP_MODE_SHIFT 0 /* LDO6_LP_MODE */
881#define WM831X_LDO6_LP_MODE_WIDTH 1 /* LDO6_LP_MODE */
882
883/*
884 * R16504 (0x4078) - LDO6 ON Control
885 */
886#define WM831X_LDO6_ON_SLOT_MASK 0xE000 /* LDO6_ON_SLOT - [15:13] */
887#define WM831X_LDO6_ON_SLOT_SHIFT 13 /* LDO6_ON_SLOT - [15:13] */
888#define WM831X_LDO6_ON_SLOT_WIDTH 3 /* LDO6_ON_SLOT - [15:13] */
889#define WM831X_LDO6_ON_MODE 0x0100 /* LDO6_ON_MODE */
890#define WM831X_LDO6_ON_MODE_MASK 0x0100 /* LDO6_ON_MODE */
891#define WM831X_LDO6_ON_MODE_SHIFT 8 /* LDO6_ON_MODE */
892#define WM831X_LDO6_ON_MODE_WIDTH 1 /* LDO6_ON_MODE */
893#define WM831X_LDO6_ON_VSEL_MASK 0x001F /* LDO6_ON_VSEL - [4:0] */
894#define WM831X_LDO6_ON_VSEL_SHIFT 0 /* LDO6_ON_VSEL - [4:0] */
895#define WM831X_LDO6_ON_VSEL_WIDTH 5 /* LDO6_ON_VSEL - [4:0] */
896
897/*
898 * R16505 (0x4079) - LDO6 SLEEP Control
899 */
900#define WM831X_LDO6_SLP_SLOT_MASK 0xE000 /* LDO6_SLP_SLOT - [15:13] */
901#define WM831X_LDO6_SLP_SLOT_SHIFT 13 /* LDO6_SLP_SLOT - [15:13] */
902#define WM831X_LDO6_SLP_SLOT_WIDTH 3 /* LDO6_SLP_SLOT - [15:13] */
903#define WM831X_LDO6_SLP_MODE 0x0100 /* LDO6_SLP_MODE */
904#define WM831X_LDO6_SLP_MODE_MASK 0x0100 /* LDO6_SLP_MODE */
905#define WM831X_LDO6_SLP_MODE_SHIFT 8 /* LDO6_SLP_MODE */
906#define WM831X_LDO6_SLP_MODE_WIDTH 1 /* LDO6_SLP_MODE */
907#define WM831X_LDO6_SLP_VSEL_MASK 0x001F /* LDO6_SLP_VSEL - [4:0] */
908#define WM831X_LDO6_SLP_VSEL_SHIFT 0 /* LDO6_SLP_VSEL - [4:0] */
909#define WM831X_LDO6_SLP_VSEL_WIDTH 5 /* LDO6_SLP_VSEL - [4:0] */
910
911/*
912 * R16506 (0x407A) - LDO7 Control
913 */
914#define WM831X_LDO7_ERR_ACT_MASK 0xC000 /* LDO7_ERR_ACT - [15:14] */
915#define WM831X_LDO7_ERR_ACT_SHIFT 14 /* LDO7_ERR_ACT - [15:14] */
916#define WM831X_LDO7_ERR_ACT_WIDTH 2 /* LDO7_ERR_ACT - [15:14] */
917#define WM831X_LDO7_HWC_SRC_MASK 0x1800 /* LDO7_HWC_SRC - [12:11] */
918#define WM831X_LDO7_HWC_SRC_SHIFT 11 /* LDO7_HWC_SRC - [12:11] */
919#define WM831X_LDO7_HWC_SRC_WIDTH 2 /* LDO7_HWC_SRC - [12:11] */
920#define WM831X_LDO7_HWC_VSEL 0x0400 /* LDO7_HWC_VSEL */
921#define WM831X_LDO7_HWC_VSEL_MASK 0x0400 /* LDO7_HWC_VSEL */
922#define WM831X_LDO7_HWC_VSEL_SHIFT 10 /* LDO7_HWC_VSEL */
923#define WM831X_LDO7_HWC_VSEL_WIDTH 1 /* LDO7_HWC_VSEL */
924#define WM831X_LDO7_HWC_MODE_MASK 0x0300 /* LDO7_HWC_MODE - [9:8] */
925#define WM831X_LDO7_HWC_MODE_SHIFT 8 /* LDO7_HWC_MODE - [9:8] */
926#define WM831X_LDO7_HWC_MODE_WIDTH 2 /* LDO7_HWC_MODE - [9:8] */
927#define WM831X_LDO7_FLT 0x0080 /* LDO7_FLT */
928#define WM831X_LDO7_FLT_MASK 0x0080 /* LDO7_FLT */
929#define WM831X_LDO7_FLT_SHIFT 7 /* LDO7_FLT */
930#define WM831X_LDO7_FLT_WIDTH 1 /* LDO7_FLT */
931#define WM831X_LDO7_SWI 0x0040 /* LDO7_SWI */
932#define WM831X_LDO7_SWI_MASK 0x0040 /* LDO7_SWI */
933#define WM831X_LDO7_SWI_SHIFT 6 /* LDO7_SWI */
934#define WM831X_LDO7_SWI_WIDTH 1 /* LDO7_SWI */
935
936/*
937 * R16507 (0x407B) - LDO7 ON Control
938 */
939#define WM831X_LDO7_ON_SLOT_MASK 0xE000 /* LDO7_ON_SLOT - [15:13] */
940#define WM831X_LDO7_ON_SLOT_SHIFT 13 /* LDO7_ON_SLOT - [15:13] */
941#define WM831X_LDO7_ON_SLOT_WIDTH 3 /* LDO7_ON_SLOT - [15:13] */
942#define WM831X_LDO7_ON_MODE 0x0100 /* LDO7_ON_MODE */
943#define WM831X_LDO7_ON_MODE_MASK 0x0100 /* LDO7_ON_MODE */
944#define WM831X_LDO7_ON_MODE_SHIFT 8 /* LDO7_ON_MODE */
945#define WM831X_LDO7_ON_MODE_WIDTH 1 /* LDO7_ON_MODE */
946#define WM831X_LDO7_ON_VSEL_MASK 0x001F /* LDO7_ON_VSEL - [4:0] */
947#define WM831X_LDO7_ON_VSEL_SHIFT 0 /* LDO7_ON_VSEL - [4:0] */
948#define WM831X_LDO7_ON_VSEL_WIDTH 5 /* LDO7_ON_VSEL - [4:0] */
949
950/*
951 * R16508 (0x407C) - LDO7 SLEEP Control
952 */
953#define WM831X_LDO7_SLP_SLOT_MASK 0xE000 /* LDO7_SLP_SLOT - [15:13] */
954#define WM831X_LDO7_SLP_SLOT_SHIFT 13 /* LDO7_SLP_SLOT - [15:13] */
955#define WM831X_LDO7_SLP_SLOT_WIDTH 3 /* LDO7_SLP_SLOT - [15:13] */
956#define WM831X_LDO7_SLP_MODE 0x0100 /* LDO7_SLP_MODE */
957#define WM831X_LDO7_SLP_MODE_MASK 0x0100 /* LDO7_SLP_MODE */
958#define WM831X_LDO7_SLP_MODE_SHIFT 8 /* LDO7_SLP_MODE */
959#define WM831X_LDO7_SLP_MODE_WIDTH 1 /* LDO7_SLP_MODE */
960#define WM831X_LDO7_SLP_VSEL_MASK 0x001F /* LDO7_SLP_VSEL - [4:0] */
961#define WM831X_LDO7_SLP_VSEL_SHIFT 0 /* LDO7_SLP_VSEL - [4:0] */
962#define WM831X_LDO7_SLP_VSEL_WIDTH 5 /* LDO7_SLP_VSEL - [4:0] */
963
964/*
965 * R16509 (0x407D) - LDO8 Control
966 */
967#define WM831X_LDO8_ERR_ACT_MASK 0xC000 /* LDO8_ERR_ACT - [15:14] */
968#define WM831X_LDO8_ERR_ACT_SHIFT 14 /* LDO8_ERR_ACT - [15:14] */
969#define WM831X_LDO8_ERR_ACT_WIDTH 2 /* LDO8_ERR_ACT - [15:14] */
970#define WM831X_LDO8_HWC_SRC_MASK 0x1800 /* LDO8_HWC_SRC - [12:11] */
971#define WM831X_LDO8_HWC_SRC_SHIFT 11 /* LDO8_HWC_SRC - [12:11] */
972#define WM831X_LDO8_HWC_SRC_WIDTH 2 /* LDO8_HWC_SRC - [12:11] */
973#define WM831X_LDO8_HWC_VSEL 0x0400 /* LDO8_HWC_VSEL */
974#define WM831X_LDO8_HWC_VSEL_MASK 0x0400 /* LDO8_HWC_VSEL */
975#define WM831X_LDO8_HWC_VSEL_SHIFT 10 /* LDO8_HWC_VSEL */
976#define WM831X_LDO8_HWC_VSEL_WIDTH 1 /* LDO8_HWC_VSEL */
977#define WM831X_LDO8_HWC_MODE_MASK 0x0300 /* LDO8_HWC_MODE - [9:8] */
978#define WM831X_LDO8_HWC_MODE_SHIFT 8 /* LDO8_HWC_MODE - [9:8] */
979#define WM831X_LDO8_HWC_MODE_WIDTH 2 /* LDO8_HWC_MODE - [9:8] */
980#define WM831X_LDO8_FLT 0x0080 /* LDO8_FLT */
981#define WM831X_LDO8_FLT_MASK 0x0080 /* LDO8_FLT */
982#define WM831X_LDO8_FLT_SHIFT 7 /* LDO8_FLT */
983#define WM831X_LDO8_FLT_WIDTH 1 /* LDO8_FLT */
984#define WM831X_LDO8_SWI 0x0040 /* LDO8_SWI */
985#define WM831X_LDO8_SWI_MASK 0x0040 /* LDO8_SWI */
986#define WM831X_LDO8_SWI_SHIFT 6 /* LDO8_SWI */
987#define WM831X_LDO8_SWI_WIDTH 1 /* LDO8_SWI */
988
989/*
990 * R16510 (0x407E) - LDO8 ON Control
991 */
992#define WM831X_LDO8_ON_SLOT_MASK 0xE000 /* LDO8_ON_SLOT - [15:13] */
993#define WM831X_LDO8_ON_SLOT_SHIFT 13 /* LDO8_ON_SLOT - [15:13] */
994#define WM831X_LDO8_ON_SLOT_WIDTH 3 /* LDO8_ON_SLOT - [15:13] */
995#define WM831X_LDO8_ON_MODE 0x0100 /* LDO8_ON_MODE */
996#define WM831X_LDO8_ON_MODE_MASK 0x0100 /* LDO8_ON_MODE */
997#define WM831X_LDO8_ON_MODE_SHIFT 8 /* LDO8_ON_MODE */
998#define WM831X_LDO8_ON_MODE_WIDTH 1 /* LDO8_ON_MODE */
999#define WM831X_LDO8_ON_VSEL_MASK 0x001F /* LDO8_ON_VSEL - [4:0] */
1000#define WM831X_LDO8_ON_VSEL_SHIFT 0 /* LDO8_ON_VSEL - [4:0] */
1001#define WM831X_LDO8_ON_VSEL_WIDTH 5 /* LDO8_ON_VSEL - [4:0] */
1002
1003/*
1004 * R16511 (0x407F) - LDO8 SLEEP Control
1005 */
1006#define WM831X_LDO8_SLP_SLOT_MASK 0xE000 /* LDO8_SLP_SLOT - [15:13] */
1007#define WM831X_LDO8_SLP_SLOT_SHIFT 13 /* LDO8_SLP_SLOT - [15:13] */
1008#define WM831X_LDO8_SLP_SLOT_WIDTH 3 /* LDO8_SLP_SLOT - [15:13] */
1009#define WM831X_LDO8_SLP_MODE 0x0100 /* LDO8_SLP_MODE */
1010#define WM831X_LDO8_SLP_MODE_MASK 0x0100 /* LDO8_SLP_MODE */
1011#define WM831X_LDO8_SLP_MODE_SHIFT 8 /* LDO8_SLP_MODE */
1012#define WM831X_LDO8_SLP_MODE_WIDTH 1 /* LDO8_SLP_MODE */
1013#define WM831X_LDO8_SLP_VSEL_MASK 0x001F /* LDO8_SLP_VSEL - [4:0] */
1014#define WM831X_LDO8_SLP_VSEL_SHIFT 0 /* LDO8_SLP_VSEL - [4:0] */
1015#define WM831X_LDO8_SLP_VSEL_WIDTH 5 /* LDO8_SLP_VSEL - [4:0] */
1016
1017/*
1018 * R16512 (0x4080) - LDO9 Control
1019 */
1020#define WM831X_LDO9_ERR_ACT_MASK 0xC000 /* LDO9_ERR_ACT - [15:14] */
1021#define WM831X_LDO9_ERR_ACT_SHIFT 14 /* LDO9_ERR_ACT - [15:14] */
1022#define WM831X_LDO9_ERR_ACT_WIDTH 2 /* LDO9_ERR_ACT - [15:14] */
1023#define WM831X_LDO9_HWC_SRC_MASK 0x1800 /* LDO9_HWC_SRC - [12:11] */
1024#define WM831X_LDO9_HWC_SRC_SHIFT 11 /* LDO9_HWC_SRC - [12:11] */
1025#define WM831X_LDO9_HWC_SRC_WIDTH 2 /* LDO9_HWC_SRC - [12:11] */
1026#define WM831X_LDO9_HWC_VSEL 0x0400 /* LDO9_HWC_VSEL */
1027#define WM831X_LDO9_HWC_VSEL_MASK 0x0400 /* LDO9_HWC_VSEL */
1028#define WM831X_LDO9_HWC_VSEL_SHIFT 10 /* LDO9_HWC_VSEL */
1029#define WM831X_LDO9_HWC_VSEL_WIDTH 1 /* LDO9_HWC_VSEL */
1030#define WM831X_LDO9_HWC_MODE_MASK 0x0300 /* LDO9_HWC_MODE - [9:8] */
1031#define WM831X_LDO9_HWC_MODE_SHIFT 8 /* LDO9_HWC_MODE - [9:8] */
1032#define WM831X_LDO9_HWC_MODE_WIDTH 2 /* LDO9_HWC_MODE - [9:8] */
1033#define WM831X_LDO9_FLT 0x0080 /* LDO9_FLT */
1034#define WM831X_LDO9_FLT_MASK 0x0080 /* LDO9_FLT */
1035#define WM831X_LDO9_FLT_SHIFT 7 /* LDO9_FLT */
1036#define WM831X_LDO9_FLT_WIDTH 1 /* LDO9_FLT */
1037#define WM831X_LDO9_SWI 0x0040 /* LDO9_SWI */
1038#define WM831X_LDO9_SWI_MASK 0x0040 /* LDO9_SWI */
1039#define WM831X_LDO9_SWI_SHIFT 6 /* LDO9_SWI */
1040#define WM831X_LDO9_SWI_WIDTH 1 /* LDO9_SWI */
1041
1042/*
1043 * R16513 (0x4081) - LDO9 ON Control
1044 */
1045#define WM831X_LDO9_ON_SLOT_MASK 0xE000 /* LDO9_ON_SLOT - [15:13] */
1046#define WM831X_LDO9_ON_SLOT_SHIFT 13 /* LDO9_ON_SLOT - [15:13] */
1047#define WM831X_LDO9_ON_SLOT_WIDTH 3 /* LDO9_ON_SLOT - [15:13] */
1048#define WM831X_LDO9_ON_MODE 0x0100 /* LDO9_ON_MODE */
1049#define WM831X_LDO9_ON_MODE_MASK 0x0100 /* LDO9_ON_MODE */
1050#define WM831X_LDO9_ON_MODE_SHIFT 8 /* LDO9_ON_MODE */
1051#define WM831X_LDO9_ON_MODE_WIDTH 1 /* LDO9_ON_MODE */
1052#define WM831X_LDO9_ON_VSEL_MASK 0x001F /* LDO9_ON_VSEL - [4:0] */
1053#define WM831X_LDO9_ON_VSEL_SHIFT 0 /* LDO9_ON_VSEL - [4:0] */
1054#define WM831X_LDO9_ON_VSEL_WIDTH 5 /* LDO9_ON_VSEL - [4:0] */
1055
1056/*
1057 * R16514 (0x4082) - LDO9 SLEEP Control
1058 */
1059#define WM831X_LDO9_SLP_SLOT_MASK 0xE000 /* LDO9_SLP_SLOT - [15:13] */
1060#define WM831X_LDO9_SLP_SLOT_SHIFT 13 /* LDO9_SLP_SLOT - [15:13] */
1061#define WM831X_LDO9_SLP_SLOT_WIDTH 3 /* LDO9_SLP_SLOT - [15:13] */
1062#define WM831X_LDO9_SLP_MODE 0x0100 /* LDO9_SLP_MODE */
1063#define WM831X_LDO9_SLP_MODE_MASK 0x0100 /* LDO9_SLP_MODE */
1064#define WM831X_LDO9_SLP_MODE_SHIFT 8 /* LDO9_SLP_MODE */
1065#define WM831X_LDO9_SLP_MODE_WIDTH 1 /* LDO9_SLP_MODE */
1066#define WM831X_LDO9_SLP_VSEL_MASK 0x001F /* LDO9_SLP_VSEL - [4:0] */
1067#define WM831X_LDO9_SLP_VSEL_SHIFT 0 /* LDO9_SLP_VSEL - [4:0] */
1068#define WM831X_LDO9_SLP_VSEL_WIDTH 5 /* LDO9_SLP_VSEL - [4:0] */
1069
1070/*
1071 * R16515 (0x4083) - LDO10 Control
1072 */
1073#define WM831X_LDO10_ERR_ACT_MASK 0xC000 /* LDO10_ERR_ACT - [15:14] */
1074#define WM831X_LDO10_ERR_ACT_SHIFT 14 /* LDO10_ERR_ACT - [15:14] */
1075#define WM831X_LDO10_ERR_ACT_WIDTH 2 /* LDO10_ERR_ACT - [15:14] */
1076#define WM831X_LDO10_HWC_SRC_MASK 0x1800 /* LDO10_HWC_SRC - [12:11] */
1077#define WM831X_LDO10_HWC_SRC_SHIFT 11 /* LDO10_HWC_SRC - [12:11] */
1078#define WM831X_LDO10_HWC_SRC_WIDTH 2 /* LDO10_HWC_SRC - [12:11] */
1079#define WM831X_LDO10_HWC_VSEL 0x0400 /* LDO10_HWC_VSEL */
1080#define WM831X_LDO10_HWC_VSEL_MASK 0x0400 /* LDO10_HWC_VSEL */
1081#define WM831X_LDO10_HWC_VSEL_SHIFT 10 /* LDO10_HWC_VSEL */
1082#define WM831X_LDO10_HWC_VSEL_WIDTH 1 /* LDO10_HWC_VSEL */
1083#define WM831X_LDO10_HWC_MODE_MASK 0x0300 /* LDO10_HWC_MODE - [9:8] */
1084#define WM831X_LDO10_HWC_MODE_SHIFT 8 /* LDO10_HWC_MODE - [9:8] */
1085#define WM831X_LDO10_HWC_MODE_WIDTH 2 /* LDO10_HWC_MODE - [9:8] */
1086#define WM831X_LDO10_FLT 0x0080 /* LDO10_FLT */
1087#define WM831X_LDO10_FLT_MASK 0x0080 /* LDO10_FLT */
1088#define WM831X_LDO10_FLT_SHIFT 7 /* LDO10_FLT */
1089#define WM831X_LDO10_FLT_WIDTH 1 /* LDO10_FLT */
1090#define WM831X_LDO10_SWI 0x0040 /* LDO10_SWI */
1091#define WM831X_LDO10_SWI_MASK 0x0040 /* LDO10_SWI */
1092#define WM831X_LDO10_SWI_SHIFT 6 /* LDO10_SWI */
1093#define WM831X_LDO10_SWI_WIDTH 1 /* LDO10_SWI */
1094
1095/*
1096 * R16516 (0x4084) - LDO10 ON Control
1097 */
1098#define WM831X_LDO10_ON_SLOT_MASK 0xE000 /* LDO10_ON_SLOT - [15:13] */
1099#define WM831X_LDO10_ON_SLOT_SHIFT 13 /* LDO10_ON_SLOT - [15:13] */
1100#define WM831X_LDO10_ON_SLOT_WIDTH 3 /* LDO10_ON_SLOT - [15:13] */
1101#define WM831X_LDO10_ON_MODE 0x0100 /* LDO10_ON_MODE */
1102#define WM831X_LDO10_ON_MODE_MASK 0x0100 /* LDO10_ON_MODE */
1103#define WM831X_LDO10_ON_MODE_SHIFT 8 /* LDO10_ON_MODE */
1104#define WM831X_LDO10_ON_MODE_WIDTH 1 /* LDO10_ON_MODE */
1105#define WM831X_LDO10_ON_VSEL_MASK 0x001F /* LDO10_ON_VSEL - [4:0] */
1106#define WM831X_LDO10_ON_VSEL_SHIFT 0 /* LDO10_ON_VSEL - [4:0] */
1107#define WM831X_LDO10_ON_VSEL_WIDTH 5 /* LDO10_ON_VSEL - [4:0] */
1108
1109/*
1110 * R16517 (0x4085) - LDO10 SLEEP Control
1111 */
1112#define WM831X_LDO10_SLP_SLOT_MASK 0xE000 /* LDO10_SLP_SLOT - [15:13] */
1113#define WM831X_LDO10_SLP_SLOT_SHIFT 13 /* LDO10_SLP_SLOT - [15:13] */
1114#define WM831X_LDO10_SLP_SLOT_WIDTH 3 /* LDO10_SLP_SLOT - [15:13] */
1115#define WM831X_LDO10_SLP_MODE 0x0100 /* LDO10_SLP_MODE */
1116#define WM831X_LDO10_SLP_MODE_MASK 0x0100 /* LDO10_SLP_MODE */
1117#define WM831X_LDO10_SLP_MODE_SHIFT 8 /* LDO10_SLP_MODE */
1118#define WM831X_LDO10_SLP_MODE_WIDTH 1 /* LDO10_SLP_MODE */
1119#define WM831X_LDO10_SLP_VSEL_MASK 0x001F /* LDO10_SLP_VSEL - [4:0] */
1120#define WM831X_LDO10_SLP_VSEL_SHIFT 0 /* LDO10_SLP_VSEL - [4:0] */
1121#define WM831X_LDO10_SLP_VSEL_WIDTH 5 /* LDO10_SLP_VSEL - [4:0] */
1122
1123/*
1124 * R16519 (0x4087) - LDO11 ON Control
1125 */
1126#define WM831X_LDO11_ON_SLOT_MASK 0xE000 /* LDO11_ON_SLOT - [15:13] */
1127#define WM831X_LDO11_ON_SLOT_SHIFT 13 /* LDO11_ON_SLOT - [15:13] */
1128#define WM831X_LDO11_ON_SLOT_WIDTH 3 /* LDO11_ON_SLOT - [15:13] */
1129#define WM831X_LDO11_OFFENA 0x1000 /* LDO11_OFFENA */
1130#define WM831X_LDO11_OFFENA_MASK 0x1000 /* LDO11_OFFENA */
1131#define WM831X_LDO11_OFFENA_SHIFT 12 /* LDO11_OFFENA */
1132#define WM831X_LDO11_OFFENA_WIDTH 1 /* LDO11_OFFENA */
1133#define WM831X_LDO11_VSEL_SRC 0x0080 /* LDO11_VSEL_SRC */
1134#define WM831X_LDO11_VSEL_SRC_MASK 0x0080 /* LDO11_VSEL_SRC */
1135#define WM831X_LDO11_VSEL_SRC_SHIFT 7 /* LDO11_VSEL_SRC */
1136#define WM831X_LDO11_VSEL_SRC_WIDTH 1 /* LDO11_VSEL_SRC */
1137#define WM831X_LDO11_ON_VSEL_MASK 0x000F /* LDO11_ON_VSEL - [3:0] */
1138#define WM831X_LDO11_ON_VSEL_SHIFT 0 /* LDO11_ON_VSEL - [3:0] */
1139#define WM831X_LDO11_ON_VSEL_WIDTH 4 /* LDO11_ON_VSEL - [3:0] */
1140
1141/*
1142 * R16520 (0x4088) - LDO11 SLEEP Control
1143 */
1144#define WM831X_LDO11_SLP_SLOT_MASK 0xE000 /* LDO11_SLP_SLOT - [15:13] */
1145#define WM831X_LDO11_SLP_SLOT_SHIFT 13 /* LDO11_SLP_SLOT - [15:13] */
1146#define WM831X_LDO11_SLP_SLOT_WIDTH 3 /* LDO11_SLP_SLOT - [15:13] */
1147#define WM831X_LDO11_SLP_VSEL_MASK 0x000F /* LDO11_SLP_VSEL - [3:0] */
1148#define WM831X_LDO11_SLP_VSEL_SHIFT 0 /* LDO11_SLP_VSEL - [3:0] */
1149#define WM831X_LDO11_SLP_VSEL_WIDTH 4 /* LDO11_SLP_VSEL - [3:0] */
1150
1151/*
1152 * R16526 (0x408E) - Power Good Source 1
1153 */
1154#define WM831X_DC4_OK 0x0008 /* DC4_OK */
1155#define WM831X_DC4_OK_MASK 0x0008 /* DC4_OK */
1156#define WM831X_DC4_OK_SHIFT 3 /* DC4_OK */
1157#define WM831X_DC4_OK_WIDTH 1 /* DC4_OK */
1158#define WM831X_DC3_OK 0x0004 /* DC3_OK */
1159#define WM831X_DC3_OK_MASK 0x0004 /* DC3_OK */
1160#define WM831X_DC3_OK_SHIFT 2 /* DC3_OK */
1161#define WM831X_DC3_OK_WIDTH 1 /* DC3_OK */
1162#define WM831X_DC2_OK 0x0002 /* DC2_OK */
1163#define WM831X_DC2_OK_MASK 0x0002 /* DC2_OK */
1164#define WM831X_DC2_OK_SHIFT 1 /* DC2_OK */
1165#define WM831X_DC2_OK_WIDTH 1 /* DC2_OK */
1166#define WM831X_DC1_OK 0x0001 /* DC1_OK */
1167#define WM831X_DC1_OK_MASK 0x0001 /* DC1_OK */
1168#define WM831X_DC1_OK_SHIFT 0 /* DC1_OK */
1169#define WM831X_DC1_OK_WIDTH 1 /* DC1_OK */
1170
1171/*
1172 * R16527 (0x408F) - Power Good Source 2
1173 */
1174#define WM831X_LDO10_OK 0x0200 /* LDO10_OK */
1175#define WM831X_LDO10_OK_MASK 0x0200 /* LDO10_OK */
1176#define WM831X_LDO10_OK_SHIFT 9 /* LDO10_OK */
1177#define WM831X_LDO10_OK_WIDTH 1 /* LDO10_OK */
1178#define WM831X_LDO9_OK 0x0100 /* LDO9_OK */
1179#define WM831X_LDO9_OK_MASK 0x0100 /* LDO9_OK */
1180#define WM831X_LDO9_OK_SHIFT 8 /* LDO9_OK */
1181#define WM831X_LDO9_OK_WIDTH 1 /* LDO9_OK */
1182#define WM831X_LDO8_OK 0x0080 /* LDO8_OK */
1183#define WM831X_LDO8_OK_MASK 0x0080 /* LDO8_OK */
1184#define WM831X_LDO8_OK_SHIFT 7 /* LDO8_OK */
1185#define WM831X_LDO8_OK_WIDTH 1 /* LDO8_OK */
1186#define WM831X_LDO7_OK 0x0040 /* LDO7_OK */
1187#define WM831X_LDO7_OK_MASK 0x0040 /* LDO7_OK */
1188#define WM831X_LDO7_OK_SHIFT 6 /* LDO7_OK */
1189#define WM831X_LDO7_OK_WIDTH 1 /* LDO7_OK */
1190#define WM831X_LDO6_OK 0x0020 /* LDO6_OK */
1191#define WM831X_LDO6_OK_MASK 0x0020 /* LDO6_OK */
1192#define WM831X_LDO6_OK_SHIFT 5 /* LDO6_OK */
1193#define WM831X_LDO6_OK_WIDTH 1 /* LDO6_OK */
1194#define WM831X_LDO5_OK 0x0010 /* LDO5_OK */
1195#define WM831X_LDO5_OK_MASK 0x0010 /* LDO5_OK */
1196#define WM831X_LDO5_OK_SHIFT 4 /* LDO5_OK */
1197#define WM831X_LDO5_OK_WIDTH 1 /* LDO5_OK */
1198#define WM831X_LDO4_OK 0x0008 /* LDO4_OK */
1199#define WM831X_LDO4_OK_MASK 0x0008 /* LDO4_OK */
1200#define WM831X_LDO4_OK_SHIFT 3 /* LDO4_OK */
1201#define WM831X_LDO4_OK_WIDTH 1 /* LDO4_OK */
1202#define WM831X_LDO3_OK 0x0004 /* LDO3_OK */
1203#define WM831X_LDO3_OK_MASK 0x0004 /* LDO3_OK */
1204#define WM831X_LDO3_OK_SHIFT 2 /* LDO3_OK */
1205#define WM831X_LDO3_OK_WIDTH 1 /* LDO3_OK */
1206#define WM831X_LDO2_OK 0x0002 /* LDO2_OK */
1207#define WM831X_LDO2_OK_MASK 0x0002 /* LDO2_OK */
1208#define WM831X_LDO2_OK_SHIFT 1 /* LDO2_OK */
1209#define WM831X_LDO2_OK_WIDTH 1 /* LDO2_OK */
1210#define WM831X_LDO1_OK 0x0001 /* LDO1_OK */
1211#define WM831X_LDO1_OK_MASK 0x0001 /* LDO1_OK */
1212#define WM831X_LDO1_OK_SHIFT 0 /* LDO1_OK */
1213#define WM831X_LDO1_OK_WIDTH 1 /* LDO1_OK */
1214
1215#define WM831X_ISINK_MAX_ISEL 56
1216extern int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL];
1217
1218#endif
diff --git a/include/linux/mfd/wm831x/watchdog.h b/include/linux/mfd/wm831x/watchdog.h
new file mode 100644
index 000000000000..97a99b52956f
--- /dev/null
+++ b/include/linux/mfd/wm831x/watchdog.h
@@ -0,0 +1,52 @@
1/*
2 * include/linux/mfd/wm831x/watchdog.h -- Watchdog for WM831x
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM831X_WATCHDOG_H__
16#define __MFD_WM831X_WATCHDOG_H__
17
18
19/*
20 * R16388 (0x4004) - Watchdog
21 */
22#define WM831X_WDOG_ENA 0x8000 /* WDOG_ENA */
23#define WM831X_WDOG_ENA_MASK 0x8000 /* WDOG_ENA */
24#define WM831X_WDOG_ENA_SHIFT 15 /* WDOG_ENA */
25#define WM831X_WDOG_ENA_WIDTH 1 /* WDOG_ENA */
26#define WM831X_WDOG_DEBUG 0x4000 /* WDOG_DEBUG */
27#define WM831X_WDOG_DEBUG_MASK 0x4000 /* WDOG_DEBUG */
28#define WM831X_WDOG_DEBUG_SHIFT 14 /* WDOG_DEBUG */
29#define WM831X_WDOG_DEBUG_WIDTH 1 /* WDOG_DEBUG */
30#define WM831X_WDOG_RST_SRC 0x2000 /* WDOG_RST_SRC */
31#define WM831X_WDOG_RST_SRC_MASK 0x2000 /* WDOG_RST_SRC */
32#define WM831X_WDOG_RST_SRC_SHIFT 13 /* WDOG_RST_SRC */
33#define WM831X_WDOG_RST_SRC_WIDTH 1 /* WDOG_RST_SRC */
34#define WM831X_WDOG_SLPENA 0x1000 /* WDOG_SLPENA */
35#define WM831X_WDOG_SLPENA_MASK 0x1000 /* WDOG_SLPENA */
36#define WM831X_WDOG_SLPENA_SHIFT 12 /* WDOG_SLPENA */
37#define WM831X_WDOG_SLPENA_WIDTH 1 /* WDOG_SLPENA */
38#define WM831X_WDOG_RESET 0x0800 /* WDOG_RESET */
39#define WM831X_WDOG_RESET_MASK 0x0800 /* WDOG_RESET */
40#define WM831X_WDOG_RESET_SHIFT 11 /* WDOG_RESET */
41#define WM831X_WDOG_RESET_WIDTH 1 /* WDOG_RESET */
42#define WM831X_WDOG_SECACT_MASK 0x0300 /* WDOG_SECACT - [9:8] */
43#define WM831X_WDOG_SECACT_SHIFT 8 /* WDOG_SECACT - [9:8] */
44#define WM831X_WDOG_SECACT_WIDTH 2 /* WDOG_SECACT - [9:8] */
45#define WM831X_WDOG_PRIMACT_MASK 0x0030 /* WDOG_PRIMACT - [5:4] */
46#define WM831X_WDOG_PRIMACT_SHIFT 4 /* WDOG_PRIMACT - [5:4] */
47#define WM831X_WDOG_PRIMACT_WIDTH 2 /* WDOG_PRIMACT - [5:4] */
48#define WM831X_WDOG_TO_MASK 0x0007 /* WDOG_TO - [2:0] */
49#define WM831X_WDOG_TO_SHIFT 0 /* WDOG_TO - [2:0] */
50#define WM831X_WDOG_TO_WIDTH 3 /* WDOG_TO - [2:0] */
51
52#endif
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 42cca672f340..1d595de6a055 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -605,6 +605,11 @@ struct wm8350_irq {
605 void *data; 605 void *data;
606}; 606};
607 607
608struct wm8350_hwmon {
609 struct platform_device *pdev;
610 struct device *classdev;
611};
612
608struct wm8350 { 613struct wm8350 {
609 struct device *dev; 614 struct device *dev;
610 615
@@ -621,7 +626,6 @@ struct wm8350 {
621 struct mutex auxadc_mutex; 626 struct mutex auxadc_mutex;
622 627
623 /* Interrupt handling */ 628 /* Interrupt handling */
624 struct work_struct irq_work;
625 struct mutex irq_mutex; /* IRQ table mutex */ 629 struct mutex irq_mutex; /* IRQ table mutex */
626 struct wm8350_irq irq[WM8350_NUM_IRQ]; 630 struct wm8350_irq irq[WM8350_NUM_IRQ];
627 int chip_irq; 631 int chip_irq;
@@ -629,6 +633,7 @@ struct wm8350 {
629 /* Client devices */ 633 /* Client devices */
630 struct wm8350_codec codec; 634 struct wm8350_codec codec;
631 struct wm8350_gpio gpio; 635 struct wm8350_gpio gpio;
636 struct wm8350_hwmon hwmon;
632 struct wm8350_pmic pmic; 637 struct wm8350_pmic pmic;
633 struct wm8350_power power; 638 struct wm8350_power power;
634 struct wm8350_rtc rtc; 639 struct wm8350_rtc rtc;
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 052117744629..adaf3c15e449 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -41,7 +41,8 @@ struct miscdevice {
41 struct list_head list; 41 struct list_head list;
42 struct device *parent; 42 struct device *parent;
43 struct device *this_device; 43 struct device *this_device;
44 const char *devnode; 44 const char *nodename;
45 mode_t mode;
45}; 46};
46 47
47extern int misc_register(struct miscdevice * misc); 48extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9a72cc78e6b8..df08551cb0ad 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -25,6 +25,7 @@ extern unsigned long max_mapnr;
25#endif 25#endif
26 26
27extern unsigned long num_physpages; 27extern unsigned long num_physpages;
28extern unsigned long totalram_pages;
28extern void * high_memory; 29extern void * high_memory;
29extern int page_cluster; 30extern int page_cluster;
30 31
@@ -103,6 +104,7 @@ extern unsigned int kobjsize(const void *objp);
103#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 104#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
104#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */ 105#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */
105#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */ 106#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */
107#define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */
106 108
107#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 109#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
108#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 110#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
@@ -283,6 +285,14 @@ static inline int is_vmalloc_addr(const void *x)
283 return 0; 285 return 0;
284#endif 286#endif
285} 287}
288#ifdef CONFIG_MMU
289extern int is_vmalloc_or_module_addr(const void *x);
290#else
291static int is_vmalloc_or_module_addr(const void *x)
292{
293 return 0;
294}
295#endif
286 296
287static inline struct page *compound_head(struct page *page) 297static inline struct page *compound_head(struct page *page)
288{ 298{
@@ -685,11 +695,12 @@ static inline int page_mapped(struct page *page)
685#define VM_FAULT_SIGBUS 0x0002 695#define VM_FAULT_SIGBUS 0x0002
686#define VM_FAULT_MAJOR 0x0004 696#define VM_FAULT_MAJOR 0x0004
687#define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */ 697#define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */
698#define VM_FAULT_HWPOISON 0x0010 /* Hit poisoned page */
688 699
689#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */ 700#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */
690#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */ 701#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */
691 702
692#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS) 703#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON)
693 704
694/* 705/*
695 * Can be called by the pagefault handler when it gets a VM_FAULT_OOM. 706 * Can be called by the pagefault handler when it gets a VM_FAULT_OOM.
@@ -700,17 +711,8 @@ extern void pagefault_out_of_memory(void);
700 711
701extern void show_free_areas(void); 712extern void show_free_areas(void);
702 713
703#ifdef CONFIG_SHMEM 714int shmem_lock(struct file *file, int lock, struct user_struct *user);
704extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
705#else
706static inline int shmem_lock(struct file *file, int lock,
707 struct user_struct *user)
708{
709 return 0;
710}
711#endif
712struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); 715struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
713
714int shmem_zero_setup(struct vm_area_struct *); 716int shmem_zero_setup(struct vm_area_struct *);
715 717
716#ifndef CONFIG_MMU 718#ifndef CONFIG_MMU
@@ -790,8 +792,14 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
790 unmap_mapping_range(mapping, holebegin, holelen, 0); 792 unmap_mapping_range(mapping, holebegin, holelen, 0);
791} 793}
792 794
793extern int vmtruncate(struct inode * inode, loff_t offset); 795extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
794extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end); 796extern int vmtruncate(struct inode *inode, loff_t offset);
797extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end);
798
799int truncate_inode_page(struct address_space *mapping, struct page *page);
800int generic_error_remove_page(struct address_space *mapping, struct page *page);
801
802int invalidate_inode_page(struct page *page);
795 803
796#ifdef CONFIG_MMU 804#ifdef CONFIG_MMU
797extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, 805extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,
@@ -815,6 +823,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
815 struct page **pages, struct vm_area_struct **vmas); 823 struct page **pages, struct vm_area_struct **vmas);
816int get_user_pages_fast(unsigned long start, int nr_pages, int write, 824int get_user_pages_fast(unsigned long start, int nr_pages, int write,
817 struct page **pages); 825 struct page **pages);
826struct page *get_dump_page(unsigned long addr);
818 827
819extern int try_to_release_page(struct page * page, gfp_t gfp_mask); 828extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
820extern void do_invalidatepage(struct page *page, unsigned long offset); 829extern void do_invalidatepage(struct page *page, unsigned long offset);
@@ -1058,6 +1067,8 @@ extern void setup_per_cpu_pageset(void);
1058static inline void setup_per_cpu_pageset(void) {} 1067static inline void setup_per_cpu_pageset(void) {}
1059#endif 1068#endif
1060 1069
1070extern void zone_pcp_update(struct zone *zone);
1071
1061/* nommu.c */ 1072/* nommu.c */
1062extern atomic_long_t mmap_pages_allocated; 1073extern atomic_long_t mmap_pages_allocated;
1063 1074
@@ -1226,7 +1237,8 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address,
1226#define FOLL_WRITE 0x01 /* check pte is writable */ 1237#define FOLL_WRITE 0x01 /* check pte is writable */
1227#define FOLL_TOUCH 0x02 /* mark page accessed */ 1238#define FOLL_TOUCH 0x02 /* mark page accessed */
1228#define FOLL_GET 0x04 /* do get_page on page */ 1239#define FOLL_GET 0x04 /* do get_page on page */
1229#define FOLL_ANON 0x08 /* give ZERO_PAGE if no pgtable */ 1240#define FOLL_DUMP 0x08 /* give error on hole if it would be zero */
1241#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */
1230 1242
1231typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, 1243typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
1232 void *data); 1244 void *data);
@@ -1274,7 +1286,7 @@ int in_gate_area_no_task(unsigned long addr);
1274#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) 1286#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);})
1275#endif /* __HAVE_ARCH_GATE_AREA */ 1287#endif /* __HAVE_ARCH_GATE_AREA */
1276 1288
1277int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *, 1289int drop_caches_sysctl_handler(struct ctl_table *, int,
1278 void __user *, size_t *, loff_t *); 1290 void __user *, size_t *, loff_t *);
1279unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, 1291unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
1280 unsigned long lru_pages); 1292 unsigned long lru_pages);
@@ -1303,5 +1315,12 @@ void vmemmap_populate_print_last(void);
1303extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim, 1315extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim,
1304 size_t size); 1316 size_t size);
1305extern void refund_locked_memory(struct mm_struct *mm, size_t size); 1317extern void refund_locked_memory(struct mm_struct *mm, size_t size);
1318
1319extern void memory_failure(unsigned long pfn, int trapno);
1320extern int __memory_failure(unsigned long pfn, int trapno, int ref);
1321extern int sysctl_memory_failure_early_kill;
1322extern int sysctl_memory_failure_recovery;
1323extern atomic_long_t mce_bad_pages;
1324
1306#endif /* __KERNEL__ */ 1325#endif /* __KERNEL__ */
1307#endif /* _LINUX_MM_H */ 1326#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 7fbb97267556..8835b877b8db 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -5,7 +5,7 @@
5 * page_is_file_cache - should the page be on a file LRU or anon LRU? 5 * page_is_file_cache - should the page be on a file LRU or anon LRU?
6 * @page: the page to test 6 * @page: the page to test
7 * 7 *
8 * Returns LRU_FILE if @page is page cache page backed by a regular filesystem, 8 * Returns 1 if @page is page cache page backed by a regular filesystem,
9 * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed. 9 * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed.
10 * Used by functions that manipulate the LRU lists, to sort a page 10 * Used by functions that manipulate the LRU lists, to sort a page
11 * onto the right LRU list. 11 * onto the right LRU list.
@@ -16,11 +16,7 @@
16 */ 16 */
17static inline int page_is_file_cache(struct page *page) 17static inline int page_is_file_cache(struct page *page)
18{ 18{
19 if (PageSwapBacked(page)) 19 return !PageSwapBacked(page);
20 return 0;
21
22 /* The page is page cache backed by a normal filesystem. */
23 return LRU_FILE;
24} 20}
25 21
26static inline void 22static inline void
@@ -39,21 +35,36 @@ del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l)
39 mem_cgroup_del_lru_list(page, l); 35 mem_cgroup_del_lru_list(page, l);
40} 36}
41 37
38/**
39 * page_lru_base_type - which LRU list type should a page be on?
40 * @page: the page to test
41 *
42 * Used for LRU list index arithmetic.
43 *
44 * Returns the base LRU type - file or anon - @page should be on.
45 */
46static inline enum lru_list page_lru_base_type(struct page *page)
47{
48 if (page_is_file_cache(page))
49 return LRU_INACTIVE_FILE;
50 return LRU_INACTIVE_ANON;
51}
52
42static inline void 53static inline void
43del_page_from_lru(struct zone *zone, struct page *page) 54del_page_from_lru(struct zone *zone, struct page *page)
44{ 55{
45 enum lru_list l = LRU_BASE; 56 enum lru_list l;
46 57
47 list_del(&page->lru); 58 list_del(&page->lru);
48 if (PageUnevictable(page)) { 59 if (PageUnevictable(page)) {
49 __ClearPageUnevictable(page); 60 __ClearPageUnevictable(page);
50 l = LRU_UNEVICTABLE; 61 l = LRU_UNEVICTABLE;
51 } else { 62 } else {
63 l = page_lru_base_type(page);
52 if (PageActive(page)) { 64 if (PageActive(page)) {
53 __ClearPageActive(page); 65 __ClearPageActive(page);
54 l += LRU_ACTIVE; 66 l += LRU_ACTIVE;
55 } 67 }
56 l += page_is_file_cache(page);
57 } 68 }
58 __dec_zone_state(zone, NR_LRU_BASE + l); 69 __dec_zone_state(zone, NR_LRU_BASE + l);
59 mem_cgroup_del_lru_list(page, l); 70 mem_cgroup_del_lru_list(page, l);
@@ -68,14 +79,14 @@ del_page_from_lru(struct zone *zone, struct page *page)
68 */ 79 */
69static inline enum lru_list page_lru(struct page *page) 80static inline enum lru_list page_lru(struct page *page)
70{ 81{
71 enum lru_list lru = LRU_BASE; 82 enum lru_list lru;
72 83
73 if (PageUnevictable(page)) 84 if (PageUnevictable(page))
74 lru = LRU_UNEVICTABLE; 85 lru = LRU_UNEVICTABLE;
75 else { 86 else {
87 lru = page_lru_base_type(page);
76 if (PageActive(page)) 88 if (PageActive(page))
77 lru += LRU_ACTIVE; 89 lru += LRU_ACTIVE;
78 lru += page_is_file_cache(page);
79 } 90 }
80 91
81 return lru; 92 return lru;
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 0042090a4d70..21d6aa45206a 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -240,6 +240,8 @@ struct mm_struct {
240 240
241 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ 241 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
242 242
243 struct linux_binfmt *binfmt;
244
243 cpumask_t cpu_vm_mask; 245 cpumask_t cpu_vm_mask;
244 246
245 /* Architecture-specific MM context */ 247 /* Architecture-specific MM context */
@@ -259,11 +261,10 @@ struct mm_struct {
259 unsigned long flags; /* Must use atomic bitops to access the bits */ 261 unsigned long flags; /* Must use atomic bitops to access the bits */
260 262
261 struct core_state *core_state; /* coredumping support */ 263 struct core_state *core_state; /* coredumping support */
262 264#ifdef CONFIG_AIO
263 /* aio bits */
264 spinlock_t ioctx_lock; 265 spinlock_t ioctx_lock;
265 struct hlist_head ioctx_list; 266 struct hlist_head ioctx_list;
266 267#endif
267#ifdef CONFIG_MM_OWNER 268#ifdef CONFIG_MM_OWNER
268 /* 269 /*
269 * "owner" points to a task that is regarded as the canonical 270 * "owner" points to a task that is regarded as the canonical
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 403aa505f27e..2ee22e8af110 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -40,6 +40,8 @@ struct mmc_csd {
40}; 40};
41 41
42struct mmc_ext_csd { 42struct mmc_ext_csd {
43 u8 rev;
44 unsigned int sa_timeout; /* Units: 100ns */
43 unsigned int hs_max_dtr; 45 unsigned int hs_max_dtr;
44 unsigned int sectors; 46 unsigned int sectors;
45}; 47};
@@ -62,7 +64,8 @@ struct sdio_cccr {
62 low_speed:1, 64 low_speed:1,
63 wide_bus:1, 65 wide_bus:1,
64 high_power:1, 66 high_power:1,
65 high_speed:1; 67 high_speed:1,
68 disable_cd:1;
66}; 69};
67 70
68struct sdio_cis { 71struct sdio_cis {
@@ -94,6 +97,8 @@ struct mmc_card {
94#define MMC_STATE_READONLY (1<<1) /* card is read-only */ 97#define MMC_STATE_READONLY (1<<1) /* card is read-only */
95#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */ 98#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */
96#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ 99#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */
100 unsigned int quirks; /* card quirks */
101#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
97 102
98 u32 raw_cid[4]; /* raw card CID */ 103 u32 raw_cid[4]; /* raw card CID */
99 u32 raw_csd[4]; /* raw card CSD */ 104 u32 raw_csd[4]; /* raw card CSD */
@@ -129,6 +134,11 @@ struct mmc_card {
129#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) 134#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
130#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) 135#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
131 136
137static inline int mmc_card_lenient_fn0(const struct mmc_card *c)
138{
139 return c->quirks & MMC_QUIRK_LENIENT_FN0;
140}
141
132#define mmc_card_name(c) ((c)->cid.prod_name) 142#define mmc_card_name(c) ((c)->cid.prod_name)
133#define mmc_card_id(c) (dev_name(&(c)->dev)) 143#define mmc_card_id(c) (dev_name(&(c)->dev))
134 144
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 7ac8b500d55c..e4898e9eeb59 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -139,6 +139,7 @@ extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
139 139
140extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); 140extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
141extern void mmc_release_host(struct mmc_host *host); 141extern void mmc_release_host(struct mmc_host *host);
142extern int mmc_try_claim_host(struct mmc_host *host);
142 143
143/** 144/**
144 * mmc_claim_host - exclusively claim a host 145 * mmc_claim_host - exclusively claim a host
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 3e7615e9087e..81bb42358595 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -51,6 +51,35 @@ struct mmc_ios {
51}; 51};
52 52
53struct mmc_host_ops { 53struct mmc_host_ops {
54 /*
55 * Hosts that support power saving can use the 'enable' and 'disable'
56 * methods to exit and enter power saving states. 'enable' is called
57 * when the host is claimed and 'disable' is called (or scheduled with
58 * a delay) when the host is released. The 'disable' is scheduled if
59 * the disable delay set by 'mmc_set_disable_delay()' is non-zero,
60 * otherwise 'disable' is called immediately. 'disable' may be
61 * scheduled repeatedly, to permit ever greater power saving at the
62 * expense of ever greater latency to re-enable. Rescheduling is
63 * determined by the return value of the 'disable' method. A positive
64 * value gives the delay in milliseconds.
65 *
66 * In the case where a host function (like set_ios) may be called
67 * with or without the host claimed, enabling and disabling can be
68 * done directly and will nest correctly. Call 'mmc_host_enable()' and
69 * 'mmc_host_lazy_disable()' for this purpose, but note that these
70 * functions must be paired.
71 *
72 * Alternatively, 'mmc_host_enable()' may be paired with
73 * 'mmc_host_disable()' which calls 'disable' immediately. In this
74 * case the 'disable' method will be called with 'lazy' set to 0.
75 * This is mainly useful for error paths.
76 *
77 * Because lazy disable may be called from a work queue, the 'disable'
78 * method must claim the host when 'lazy' != 0, which will work
79 * correctly because recursion is detected and handled.
80 */
81 int (*enable)(struct mmc_host *host);
82 int (*disable)(struct mmc_host *host, int lazy);
54 void (*request)(struct mmc_host *host, struct mmc_request *req); 83 void (*request)(struct mmc_host *host, struct mmc_request *req);
55 /* 84 /*
56 * Avoid calling these three functions too often or in a "fast path", 85 * Avoid calling these three functions too often or in a "fast path",
@@ -118,6 +147,9 @@ struct mmc_host {
118#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ 147#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
119#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ 148#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
120#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ 149#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
150#define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */
151#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
152#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
121 153
122 /* host specific block data */ 154 /* host specific block data */
123 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 155 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
@@ -142,9 +174,18 @@ struct mmc_host {
142 unsigned int removed:1; /* host is being removed */ 174 unsigned int removed:1; /* host is being removed */
143#endif 175#endif
144 176
177 /* Only used with MMC_CAP_DISABLE */
178 int enabled; /* host is enabled */
179 int nesting_cnt; /* "enable" nesting count */
180 int en_dis_recurs; /* detect recursion */
181 unsigned int disable_delay; /* disable delay in msecs */
182 struct delayed_work disable; /* disabling work */
183
145 struct mmc_card *card; /* device attached to this host */ 184 struct mmc_card *card; /* device attached to this host */
146 185
147 wait_queue_head_t wq; 186 wait_queue_head_t wq;
187 struct task_struct *claimer; /* task that has host claimed */
188 int claim_cnt; /* "claim" nesting count */
148 189
149 struct delayed_work detect; 190 struct delayed_work detect;
150 191
@@ -183,6 +224,9 @@ static inline void *mmc_priv(struct mmc_host *host)
183extern int mmc_suspend_host(struct mmc_host *, pm_message_t); 224extern int mmc_suspend_host(struct mmc_host *, pm_message_t);
184extern int mmc_resume_host(struct mmc_host *); 225extern int mmc_resume_host(struct mmc_host *);
185 226
227extern void mmc_power_save_host(struct mmc_host *host);
228extern void mmc_power_restore_host(struct mmc_host *host);
229
186extern void mmc_detect_change(struct mmc_host *, unsigned long delay); 230extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
187extern void mmc_request_done(struct mmc_host *, struct mmc_request *); 231extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
188 232
@@ -197,5 +241,19 @@ struct regulator;
197int mmc_regulator_get_ocrmask(struct regulator *supply); 241int mmc_regulator_get_ocrmask(struct regulator *supply);
198int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit); 242int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit);
199 243
244int mmc_card_awake(struct mmc_host *host);
245int mmc_card_sleep(struct mmc_host *host);
246int mmc_card_can_sleep(struct mmc_host *host);
247
248int mmc_host_enable(struct mmc_host *host);
249int mmc_host_disable(struct mmc_host *host);
250int mmc_host_lazy_disable(struct mmc_host *host);
251
252static inline void mmc_set_disable_delay(struct mmc_host *host,
253 unsigned int disable_delay)
254{
255 host->disable_delay = disable_delay;
256}
257
200#endif 258#endif
201 259
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 14b81f3e5232..c02c8db73701 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -31,6 +31,7 @@
31#define MMC_ALL_SEND_CID 2 /* bcr R2 */ 31#define MMC_ALL_SEND_CID 2 /* bcr R2 */
32#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */ 32#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */
33#define MMC_SET_DSR 4 /* bc [31:16] RCA */ 33#define MMC_SET_DSR 4 /* bc [31:16] RCA */
34#define MMC_SLEEP_AWAKE 5 /* ac [31:16] RCA 15:flg R1b */
34#define MMC_SWITCH 6 /* ac [31:0] See below R1b */ 35#define MMC_SWITCH 6 /* ac [31:0] See below R1b */
35#define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */ 36#define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */
36#define MMC_SEND_EXT_CSD 8 /* adtc R1 */ 37#define MMC_SEND_EXT_CSD 8 /* adtc R1 */
@@ -127,6 +128,7 @@
127#define R1_STATUS(x) (x & 0xFFFFE000) 128#define R1_STATUS(x) (x & 0xFFFFE000)
128#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ 129#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
129#define R1_READY_FOR_DATA (1 << 8) /* sx, a */ 130#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
131#define R1_SWITCH_ERROR (1 << 7) /* sx, c */
130#define R1_APP_CMD (1 << 5) /* sr, c */ 132#define R1_APP_CMD (1 << 5) /* sr, c */
131 133
132/* 134/*
@@ -254,6 +256,7 @@ struct _mmc_csd {
254#define EXT_CSD_CARD_TYPE 196 /* RO */ 256#define EXT_CSD_CARD_TYPE 196 /* RO */
255#define EXT_CSD_REV 192 /* RO */ 257#define EXT_CSD_REV 192 /* RO */
256#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 258#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
259#define EXT_CSD_S_A_TIMEOUT 217
257 260
258/* 261/*
259 * EXT_CSD field definitions 262 * EXT_CSD field definitions
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index 451bdfc85830..ac3ab683fec6 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -67,6 +67,7 @@ struct sdio_func {
67 67
68#define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev) 68#define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev)
69#define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d) 69#define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d)
70#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev)
70 71
71/* 72/*
72 * SDIO function device driver 73 * SDIO function device driver
@@ -81,6 +82,8 @@ struct sdio_driver {
81 struct device_driver drv; 82 struct device_driver drv;
82}; 83};
83 84
85#define to_sdio_driver(d) container_of(d, struct sdio_driver, drv)
86
84/** 87/**
85 * SDIO_DEVICE - macro used to describe a specific SDIO device 88 * SDIO_DEVICE - macro used to describe a specific SDIO device
86 * @vend: the 16 bit manufacturer code 89 * @vend: the 16 bit manufacturer code
diff --git a/include/linux/mmu_context.h b/include/linux/mmu_context.h
new file mode 100644
index 000000000000..70fffeba7495
--- /dev/null
+++ b/include/linux/mmu_context.h
@@ -0,0 +1,9 @@
1#ifndef _LINUX_MMU_CONTEXT_H
2#define _LINUX_MMU_CONTEXT_H
3
4struct mm_struct;
5
6void use_mm(struct mm_struct *mm);
7void unuse_mm(struct mm_struct *mm);
8
9#endif
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index b77486d152cd..4e02ee2b071e 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -62,6 +62,15 @@ struct mmu_notifier_ops {
62 unsigned long address); 62 unsigned long address);
63 63
64 /* 64 /*
65 * change_pte is called in cases that pte mapping to page is changed:
66 * for example, when ksm remaps pte to point to a new shared page.
67 */
68 void (*change_pte)(struct mmu_notifier *mn,
69 struct mm_struct *mm,
70 unsigned long address,
71 pte_t pte);
72
73 /*
65 * Before this is invoked any secondary MMU is still ok to 74 * Before this is invoked any secondary MMU is still ok to
66 * read/write to the page previously pointed to by the Linux 75 * read/write to the page previously pointed to by the Linux
67 * pte because the page hasn't been freed yet and it won't be 76 * pte because the page hasn't been freed yet and it won't be
@@ -154,6 +163,8 @@ extern void __mmu_notifier_mm_destroy(struct mm_struct *mm);
154extern void __mmu_notifier_release(struct mm_struct *mm); 163extern void __mmu_notifier_release(struct mm_struct *mm);
155extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm, 164extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
156 unsigned long address); 165 unsigned long address);
166extern void __mmu_notifier_change_pte(struct mm_struct *mm,
167 unsigned long address, pte_t pte);
157extern void __mmu_notifier_invalidate_page(struct mm_struct *mm, 168extern void __mmu_notifier_invalidate_page(struct mm_struct *mm,
158 unsigned long address); 169 unsigned long address);
159extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm, 170extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
@@ -175,6 +186,13 @@ static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
175 return 0; 186 return 0;
176} 187}
177 188
189static inline void mmu_notifier_change_pte(struct mm_struct *mm,
190 unsigned long address, pte_t pte)
191{
192 if (mm_has_notifiers(mm))
193 __mmu_notifier_change_pte(mm, address, pte);
194}
195
178static inline void mmu_notifier_invalidate_page(struct mm_struct *mm, 196static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
179 unsigned long address) 197 unsigned long address)
180{ 198{
@@ -236,6 +254,16 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
236 __young; \ 254 __young; \
237}) 255})
238 256
257#define set_pte_at_notify(__mm, __address, __ptep, __pte) \
258({ \
259 struct mm_struct *___mm = __mm; \
260 unsigned long ___address = __address; \
261 pte_t ___pte = __pte; \
262 \
263 set_pte_at(___mm, ___address, __ptep, ___pte); \
264 mmu_notifier_change_pte(___mm, ___address, ___pte); \
265})
266
239#else /* CONFIG_MMU_NOTIFIER */ 267#else /* CONFIG_MMU_NOTIFIER */
240 268
241static inline void mmu_notifier_release(struct mm_struct *mm) 269static inline void mmu_notifier_release(struct mm_struct *mm)
@@ -248,6 +276,11 @@ static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
248 return 0; 276 return 0;
249} 277}
250 278
279static inline void mmu_notifier_change_pte(struct mm_struct *mm,
280 unsigned long address, pte_t pte)
281{
282}
283
251static inline void mmu_notifier_invalidate_page(struct mm_struct *mm, 284static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
252 unsigned long address) 285 unsigned long address)
253{ 286{
@@ -273,6 +306,7 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
273 306
274#define ptep_clear_flush_young_notify ptep_clear_flush_young 307#define ptep_clear_flush_young_notify ptep_clear_flush_young
275#define ptep_clear_flush_notify ptep_clear_flush 308#define ptep_clear_flush_notify ptep_clear_flush
309#define set_pte_at_notify set_pte_at
276 310
277#endif /* CONFIG_MMU_NOTIFIER */ 311#endif /* CONFIG_MMU_NOTIFIER */
278 312
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 889598537370..6f7561730d88 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -38,6 +38,7 @@
38#define MIGRATE_UNMOVABLE 0 38#define MIGRATE_UNMOVABLE 0
39#define MIGRATE_RECLAIMABLE 1 39#define MIGRATE_RECLAIMABLE 1
40#define MIGRATE_MOVABLE 2 40#define MIGRATE_MOVABLE 2
41#define MIGRATE_PCPTYPES 3 /* the number of types on the pcp lists */
41#define MIGRATE_RESERVE 3 42#define MIGRATE_RESERVE 3
42#define MIGRATE_ISOLATE 4 /* can't allocate from here */ 43#define MIGRATE_ISOLATE 4 /* can't allocate from here */
43#define MIGRATE_TYPES 5 44#define MIGRATE_TYPES 5
@@ -94,11 +95,15 @@ enum zone_stat_item {
94 NR_SLAB_RECLAIMABLE, 95 NR_SLAB_RECLAIMABLE,
95 NR_SLAB_UNRECLAIMABLE, 96 NR_SLAB_UNRECLAIMABLE,
96 NR_PAGETABLE, /* used for pagetables */ 97 NR_PAGETABLE, /* used for pagetables */
98 NR_KERNEL_STACK,
99 /* Second 128 byte cacheline */
97 NR_UNSTABLE_NFS, /* NFS unstable pages */ 100 NR_UNSTABLE_NFS, /* NFS unstable pages */
98 NR_BOUNCE, 101 NR_BOUNCE,
99 NR_VMSCAN_WRITE, 102 NR_VMSCAN_WRITE,
100 /* Second 128 byte cacheline */
101 NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */ 103 NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */
104 NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */
105 NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */
106 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */
102#ifdef CONFIG_NUMA 107#ifdef CONFIG_NUMA
103 NUMA_HIT, /* allocated in intended node */ 108 NUMA_HIT, /* allocated in intended node */
104 NUMA_MISS, /* allocated in non intended node */ 109 NUMA_MISS, /* allocated in non intended node */
@@ -165,7 +170,9 @@ struct per_cpu_pages {
165 int count; /* number of pages in the list */ 170 int count; /* number of pages in the list */
166 int high; /* high watermark, emptying needed */ 171 int high; /* high watermark, emptying needed */
167 int batch; /* chunk size for buddy add/remove */ 172 int batch; /* chunk size for buddy add/remove */
168 struct list_head list; /* the list of pages */ 173
174 /* Lists of pages, one per migrate type stored on the pcp-lists */
175 struct list_head lists[MIGRATE_PCPTYPES];
169}; 176};
170 177
171struct per_cpu_pageset { 178struct per_cpu_pageset {
@@ -269,6 +276,11 @@ struct zone_reclaim_stat {
269 */ 276 */
270 unsigned long recent_rotated[2]; 277 unsigned long recent_rotated[2];
271 unsigned long recent_scanned[2]; 278 unsigned long recent_scanned[2];
279
280 /*
281 * accumulated for batching
282 */
283 unsigned long nr_saved_scan[NR_LRU_LISTS];
272}; 284};
273 285
274struct zone { 286struct zone {
@@ -323,7 +335,6 @@ struct zone {
323 spinlock_t lru_lock; 335 spinlock_t lru_lock;
324 struct zone_lru { 336 struct zone_lru {
325 struct list_head list; 337 struct list_head list;
326 unsigned long nr_saved_scan; /* accumulated for batching */
327 } lru[NR_LRU_LISTS]; 338 } lru[NR_LRU_LISTS];
328 339
329 struct zone_reclaim_stat reclaim_stat; 340 struct zone_reclaim_stat reclaim_stat;
@@ -744,21 +755,20 @@ static inline int is_dma(struct zone *zone)
744 755
745/* These two functions are used to setup the per zone pages min values */ 756/* These two functions are used to setup the per zone pages min values */
746struct ctl_table; 757struct ctl_table;
747struct file; 758int min_free_kbytes_sysctl_handler(struct ctl_table *, int,
748int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *,
749 void __user *, size_t *, loff_t *); 759 void __user *, size_t *, loff_t *);
750extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1]; 760extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1];
751int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *, 761int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int,
752 void __user *, size_t *, loff_t *); 762 void __user *, size_t *, loff_t *);
753int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file *, 763int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int,
754 void __user *, size_t *, loff_t *); 764 void __user *, size_t *, loff_t *);
755int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int, 765int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int,
756 struct file *, void __user *, size_t *, loff_t *); 766 void __user *, size_t *, loff_t *);
757int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int, 767int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int,
758 struct file *, void __user *, size_t *, loff_t *); 768 void __user *, size_t *, loff_t *);
759 769
760extern int numa_zonelist_order_handler(struct ctl_table *, int, 770extern int numa_zonelist_order_handler(struct ctl_table *, int,
761 struct file *, void __user *, size_t *, loff_t *); 771 void __user *, size_t *, loff_t *);
762extern char numa_zonelist_order[]; 772extern char numa_zonelist_order[];
763#define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */ 773#define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */
764 774
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 1bf5900ffe43..f58e9d836f32 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -399,6 +399,17 @@ struct i2c_device_id {
399 __attribute__((aligned(sizeof(kernel_ulong_t)))); 399 __attribute__((aligned(sizeof(kernel_ulong_t))));
400}; 400};
401 401
402/* spi */
403
404#define SPI_NAME_SIZE 32
405#define SPI_MODULE_PREFIX "spi:"
406
407struct spi_device_id {
408 char name[SPI_NAME_SIZE];
409 kernel_ulong_t driver_data /* Data private to the driver */
410 __attribute__((aligned(sizeof(kernel_ulong_t))));
411};
412
402/* dmi */ 413/* dmi */
403enum dmi_field { 414enum dmi_field {
404 DMI_NONE, 415 DMI_NONE,
diff --git a/include/linux/module.h b/include/linux/module.h
index f8f92d015efe..482efc865acf 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -15,7 +15,6 @@
15#include <linux/stringify.h> 15#include <linux/stringify.h>
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
18#include <linux/marker.h>
19#include <linux/tracepoint.h> 18#include <linux/tracepoint.h>
20 19
21#include <asm/local.h> 20#include <asm/local.h>
@@ -129,7 +128,10 @@ extern struct module __this_module;
129 */ 128 */
130#define MODULE_LICENSE(_license) MODULE_INFO(license, _license) 129#define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
131 130
132/* Author, ideally of form NAME[, NAME]*[ and NAME] */ 131/*
132 * Author(s), use "Name <email>" or just "Name", for multiple
133 * authors use multiple MODULE_AUTHOR() statements/lines.
134 */
133#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author) 135#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
134 136
135/* What your module does. */ 137/* What your module does. */
@@ -309,10 +311,14 @@ struct module
309#endif 311#endif
310 312
311#ifdef CONFIG_KALLSYMS 313#ifdef CONFIG_KALLSYMS
312 /* We keep the symbol and string tables for kallsyms. */ 314 /*
313 Elf_Sym *symtab; 315 * We keep the symbol and string tables for kallsyms.
314 unsigned int num_symtab; 316 * The core_* fields below are temporary, loader-only (they
315 char *strtab; 317 * could really be discarded after module init).
318 */
319 Elf_Sym *symtab, *core_symtab;
320 unsigned int num_symtab, core_num_syms;
321 char *strtab, *core_strtab;
316 322
317 /* Section attributes */ 323 /* Section attributes */
318 struct module_sect_attrs *sect_attrs; 324 struct module_sect_attrs *sect_attrs;
@@ -327,10 +333,6 @@ struct module
327 /* The command line arguments (may be mangled). People like 333 /* The command line arguments (may be mangled). People like
328 keeping pointers to this stuff */ 334 keeping pointers to this stuff */
329 char *args; 335 char *args;
330#ifdef CONFIG_MARKERS
331 struct marker *markers;
332 unsigned int num_markers;
333#endif
334#ifdef CONFIG_TRACEPOINTS 336#ifdef CONFIG_TRACEPOINTS
335 struct tracepoint *tracepoints; 337 struct tracepoint *tracepoints;
336 unsigned int num_tracepoints; 338 unsigned int num_tracepoints;
@@ -535,8 +537,6 @@ int unregister_module_notifier(struct notifier_block * nb);
535 537
536extern void print_modules(void); 538extern void print_modules(void);
537 539
538extern void module_update_markers(void);
539
540extern void module_update_tracepoints(void); 540extern void module_update_tracepoints(void);
541extern int module_get_iter_tracepoints(struct tracepoint_iter *iter); 541extern int module_get_iter_tracepoints(struct tracepoint_iter *iter);
542 542
@@ -651,10 +651,6 @@ static inline void print_modules(void)
651{ 651{
652} 652}
653 653
654static inline void module_update_markers(void)
655{
656}
657
658static inline void module_update_tracepoints(void) 654static inline void module_update_tracepoints(void)
659{ 655{
660} 656}
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 4030ebada49e..7a232a9bdd62 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -121,6 +121,7 @@ typedef enum {
121 NAND_ECC_SOFT, 121 NAND_ECC_SOFT,
122 NAND_ECC_HW, 122 NAND_ECC_HW,
123 NAND_ECC_HW_SYNDROME, 123 NAND_ECC_HW_SYNDROME,
124 NAND_ECC_HW_OOB_FIRST,
124} nand_ecc_modes_t; 125} nand_ecc_modes_t;
125 126
126/* 127/*
@@ -271,13 +272,13 @@ struct nand_ecc_ctrl {
271 uint8_t *calc_ecc); 272 uint8_t *calc_ecc);
272 int (*read_page_raw)(struct mtd_info *mtd, 273 int (*read_page_raw)(struct mtd_info *mtd,
273 struct nand_chip *chip, 274 struct nand_chip *chip,
274 uint8_t *buf); 275 uint8_t *buf, int page);
275 void (*write_page_raw)(struct mtd_info *mtd, 276 void (*write_page_raw)(struct mtd_info *mtd,
276 struct nand_chip *chip, 277 struct nand_chip *chip,
277 const uint8_t *buf); 278 const uint8_t *buf);
278 int (*read_page)(struct mtd_info *mtd, 279 int (*read_page)(struct mtd_info *mtd,
279 struct nand_chip *chip, 280 struct nand_chip *chip,
280 uint8_t *buf); 281 uint8_t *buf, int page);
281 int (*read_subpage)(struct mtd_info *mtd, 282 int (*read_subpage)(struct mtd_info *mtd,
282 struct nand_chip *chip, 283 struct nand_chip *chip,
283 uint32_t offs, uint32_t len, 284 uint32_t offs, uint32_t len,
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h
index 090da505425d..052ea8ca2434 100644
--- a/include/linux/mtd/nand_ecc.h
+++ b/include/linux/mtd/nand_ecc.h
@@ -21,6 +21,12 @@ struct mtd_info;
21int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code); 21int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code);
22 22
23/* 23/*
24 * Detect and correct a 1 bit error for eccsize byte block
25 */
26int __nand_correct_data(u_char *dat, u_char *read_ecc, u_char *calc_ecc,
27 unsigned int eccsize);
28
29/*
24 * Detect and correct a 1 bit error for 256 byte block 30 * Detect and correct a 1 bit error for 256 byte block
25 */ 31 */
26int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc); 32int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc);
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 8ed873374381..4e49f3350678 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -214,4 +214,12 @@ unsigned onenand_block(struct onenand_chip *this, loff_t addr);
214loff_t onenand_addr(struct onenand_chip *this, int block); 214loff_t onenand_addr(struct onenand_chip *this, int block);
215int flexonenand_region(struct mtd_info *mtd, loff_t addr); 215int flexonenand_region(struct mtd_info *mtd, loff_t addr);
216 216
217struct mtd_partition;
218
219struct onenand_platform_data {
220 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
221 struct mtd_partition *parts;
222 unsigned int nr_parts;
223};
224
217#endif /* __LINUX_MTD_ONENAND_H */ 225#endif /* __LINUX_MTD_ONENAND_H */
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h
index 86a6bbef6465..acadbf53a69f 100644
--- a/include/linux/mtd/onenand_regs.h
+++ b/include/linux/mtd/onenand_regs.h
@@ -207,6 +207,9 @@
207#define ONENAND_ECC_2BIT (1 << 1) 207#define ONENAND_ECC_2BIT (1 << 1)
208#define ONENAND_ECC_2BIT_ALL (0xAAAA) 208#define ONENAND_ECC_2BIT_ALL (0xAAAA)
209#define FLEXONENAND_UNCORRECTABLE_ERROR (0x1010) 209#define FLEXONENAND_UNCORRECTABLE_ERROR (0x1010)
210#define ONENAND_ECC_3BIT (1 << 2)
211#define ONENAND_ECC_4BIT (1 << 3)
212#define ONENAND_ECC_4BIT_UNCORRECTABLE (0x1010)
210 213
211/* 214/*
212 * One-Time Programmable (OTP) 215 * One-Time Programmable (OTP)
diff --git a/include/linux/namei.h b/include/linux/namei.h
index d870ae2faedc..ec0f607b364a 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -40,7 +40,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
40 * - follow links at the end 40 * - follow links at the end
41 * - require a directory 41 * - require a directory
42 * - ending slashes ok even for nonexistent files 42 * - ending slashes ok even for nonexistent files
43 * - internal "there are more path compnents" flag 43 * - internal "there are more path components" flag
44 * - locked when lookup done with dcache_lock held 44 * - locked when lookup done with dcache_lock held
45 * - dentry cache is untrusted; force a real lookup 45 * - dentry cache is untrusted; force a real lookup
46 */ 46 */
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 33b283601f62..c4c060208109 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -234,7 +234,7 @@ enum nfs_opnum4 {
234Needs to be updated if more operations are defined in future.*/ 234Needs to be updated if more operations are defined in future.*/
235 235
236#define FIRST_NFS4_OP OP_ACCESS 236#define FIRST_NFS4_OP OP_ACCESS
237#define LAST_NFS4_OP OP_RELEASE_LOCKOWNER 237#define LAST_NFS4_OP OP_RECLAIM_COMPLETE
238 238
239enum nfsstat4 { 239enum nfsstat4 {
240 NFS4_OK = 0, 240 NFS4_OK = 0,
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 2b49d676d0c9..510ffdd5020e 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -56,8 +56,11 @@ extern struct svc_version nfsd_version2, nfsd_version3,
56extern u32 nfsd_supported_minorversion; 56extern u32 nfsd_supported_minorversion;
57extern struct mutex nfsd_mutex; 57extern struct mutex nfsd_mutex;
58extern struct svc_serv *nfsd_serv; 58extern struct svc_serv *nfsd_serv;
59extern spinlock_t nfsd_drc_lock;
60extern unsigned int nfsd_drc_max_mem;
61extern unsigned int nfsd_drc_mem_used;
59 62
60extern struct seq_operations nfs_exports_op; 63extern const struct seq_operations nfs_exports_op;
61 64
62/* 65/*
63 * Function prototypes. 66 * Function prototypes.
@@ -163,7 +166,7 @@ extern int nfsd_max_blksize;
163extern unsigned int max_delegations; 166extern unsigned int max_delegations;
164int nfs4_state_init(void); 167int nfs4_state_init(void);
165void nfsd4_free_slabs(void); 168void nfsd4_free_slabs(void);
166void nfs4_state_start(void); 169int nfs4_state_start(void);
167void nfs4_state_shutdown(void); 170void nfs4_state_shutdown(void);
168time_t nfs4_lease_time(void); 171time_t nfs4_lease_time(void);
169void nfs4_reset_lease(time_t leasetime); 172void nfs4_reset_lease(time_t leasetime);
@@ -171,7 +174,7 @@ int nfs4_reset_recoverydir(char *recdir);
171#else 174#else
172static inline int nfs4_state_init(void) { return 0; } 175static inline int nfs4_state_init(void) { return 0; }
173static inline void nfsd4_free_slabs(void) { } 176static inline void nfsd4_free_slabs(void) { }
174static inline void nfs4_state_start(void) { } 177static inline int nfs4_state_start(void) { return 0; }
175static inline void nfs4_state_shutdown(void) { } 178static inline void nfs4_state_shutdown(void) { }
176static inline time_t nfs4_lease_time(void) { return 0; } 179static inline time_t nfs4_lease_time(void) { return 0; }
177static inline void nfs4_reset_lease(time_t leasetime) { } 180static inline void nfs4_reset_lease(time_t leasetime) { }
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index 57ab2ed08459..b38d11324189 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -60,6 +60,12 @@ typedef struct {
60#define si_stateownerid si_opaque.so_stateownerid 60#define si_stateownerid si_opaque.so_stateownerid
61#define si_fileid si_opaque.so_fileid 61#define si_fileid si_opaque.so_fileid
62 62
63struct nfsd4_cb_sequence {
64 /* args/res */
65 u32 cbs_minorversion;
66 struct nfs4_client *cbs_clp;
67};
68
63struct nfs4_delegation { 69struct nfs4_delegation {
64 struct list_head dl_perfile; 70 struct list_head dl_perfile;
65 struct list_head dl_perclnt; 71 struct list_head dl_perclnt;
@@ -81,38 +87,35 @@ struct nfs4_delegation {
81/* client delegation callback info */ 87/* client delegation callback info */
82struct nfs4_cb_conn { 88struct nfs4_cb_conn {
83 /* SETCLIENTID info */ 89 /* SETCLIENTID info */
84 u32 cb_addr; 90 struct sockaddr_storage cb_addr;
85 unsigned short cb_port; 91 size_t cb_addrlen;
86 u32 cb_prog; 92 u32 cb_prog;
87 u32 cb_minorversion; 93 u32 cb_minorversion;
88 u32 cb_ident; /* minorversion 0 only */ 94 u32 cb_ident; /* minorversion 0 only */
89 /* RPC client info */ 95 /* RPC client info */
90 atomic_t cb_set; /* successful CB_NULL call */ 96 atomic_t cb_set; /* successful CB_NULL call */
91 struct rpc_clnt * cb_client; 97 struct rpc_clnt * cb_client;
92 struct rpc_cred * cb_cred;
93}; 98};
94 99
95/* Maximum number of slots per session. 128 is useful for long haul TCP */ 100/* Maximum number of slots per session. 160 is useful for long haul TCP */
96#define NFSD_MAX_SLOTS_PER_SESSION 128 101#define NFSD_MAX_SLOTS_PER_SESSION 160
97/* Maximum number of pages per slot cache entry */
98#define NFSD_PAGES_PER_SLOT 1
99/* Maximum number of operations per session compound */ 102/* Maximum number of operations per session compound */
100#define NFSD_MAX_OPS_PER_COMPOUND 16 103#define NFSD_MAX_OPS_PER_COMPOUND 16
101 104/* Maximum session per slot cache size */
102struct nfsd4_cache_entry { 105#define NFSD_SLOT_CACHE_SIZE 1024
103 __be32 ce_status; 106/* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */
104 struct kvec ce_datav; /* encoded NFSv4.1 data in rq_res.head[0] */ 107#define NFSD_CACHE_SIZE_SLOTS_PER_SESSION 32
105 struct page *ce_respages[NFSD_PAGES_PER_SLOT + 1]; 108#define NFSD_MAX_MEM_PER_SESSION \
106 int ce_cachethis; 109 (NFSD_CACHE_SIZE_SLOTS_PER_SESSION * NFSD_SLOT_CACHE_SIZE)
107 short ce_resused;
108 int ce_opcnt;
109 int ce_rpchdrlen;
110};
111 110
112struct nfsd4_slot { 111struct nfsd4_slot {
113 bool sl_inuse; 112 bool sl_inuse;
114 u32 sl_seqid; 113 bool sl_cachethis;
115 struct nfsd4_cache_entry sl_cache_entry; 114 u16 sl_opcnt;
115 u32 sl_seqid;
116 __be32 sl_status;
117 u32 sl_datalen;
118 char sl_data[];
116}; 119};
117 120
118struct nfsd4_channel_attrs { 121struct nfsd4_channel_attrs {
@@ -126,6 +129,25 @@ struct nfsd4_channel_attrs {
126 u32 rdma_attrs; 129 u32 rdma_attrs;
127}; 130};
128 131
132struct nfsd4_create_session {
133 clientid_t clientid;
134 struct nfs4_sessionid sessionid;
135 u32 seqid;
136 u32 flags;
137 struct nfsd4_channel_attrs fore_channel;
138 struct nfsd4_channel_attrs back_channel;
139 u32 callback_prog;
140 u32 uid;
141 u32 gid;
142};
143
144/* The single slot clientid cache structure */
145struct nfsd4_clid_slot {
146 u32 sl_seqid;
147 __be32 sl_status;
148 struct nfsd4_create_session sl_cr_ses;
149};
150
129struct nfsd4_session { 151struct nfsd4_session {
130 struct kref se_ref; 152 struct kref se_ref;
131 struct list_head se_hash; /* hash by sessionid */ 153 struct list_head se_hash; /* hash by sessionid */
@@ -135,7 +157,7 @@ struct nfsd4_session {
135 struct nfs4_sessionid se_sessionid; 157 struct nfs4_sessionid se_sessionid;
136 struct nfsd4_channel_attrs se_fchannel; 158 struct nfsd4_channel_attrs se_fchannel;
137 struct nfsd4_channel_attrs se_bchannel; 159 struct nfsd4_channel_attrs se_bchannel;
138 struct nfsd4_slot se_slots[]; /* forward channel slots */ 160 struct nfsd4_slot *se_slots[]; /* forward channel slots */
139}; 161};
140 162
141static inline void 163static inline void
@@ -180,7 +202,7 @@ struct nfs4_client {
180 char cl_recdir[HEXDIR_LEN]; /* recovery dir */ 202 char cl_recdir[HEXDIR_LEN]; /* recovery dir */
181 nfs4_verifier cl_verifier; /* generated by client */ 203 nfs4_verifier cl_verifier; /* generated by client */
182 time_t cl_time; /* time of last lease renewal */ 204 time_t cl_time; /* time of last lease renewal */
183 __be32 cl_addr; /* client ipaddress */ 205 struct sockaddr_storage cl_addr; /* client ipaddress */
184 u32 cl_flavor; /* setclientid pseudoflavor */ 206 u32 cl_flavor; /* setclientid pseudoflavor */
185 char *cl_principal; /* setclientid principal name */ 207 char *cl_principal; /* setclientid principal name */
186 struct svc_cred cl_cred; /* setclientid principal */ 208 struct svc_cred cl_cred; /* setclientid principal */
@@ -192,9 +214,17 @@ struct nfs4_client {
192 214
193 /* for nfs41 */ 215 /* for nfs41 */
194 struct list_head cl_sessions; 216 struct list_head cl_sessions;
195 struct nfsd4_slot cl_slot; /* create_session slot */ 217 struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */
196 u32 cl_exchange_flags; 218 u32 cl_exchange_flags;
197 struct nfs4_sessionid cl_sessionid; 219 struct nfs4_sessionid cl_sessionid;
220
221 /* for nfs41 callbacks */
222 /* We currently support a single back channel with a single slot */
223 unsigned long cl_cb_slot_busy;
224 u32 cl_cb_seq_nr;
225 struct svc_xprt *cl_cb_xprt; /* 4.1 callback transport */
226 struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */
227 /* wait here for slots */
198}; 228};
199 229
200/* struct nfs4_client_reset 230/* struct nfs4_client_reset
@@ -345,6 +375,7 @@ extern int nfs4_in_grace(void);
345extern __be32 nfs4_check_open_reclaim(clientid_t *clid); 375extern __be32 nfs4_check_open_reclaim(clientid_t *clid);
346extern void put_nfs4_client(struct nfs4_client *clp); 376extern void put_nfs4_client(struct nfs4_client *clp);
347extern void nfs4_free_stateowner(struct kref *kref); 377extern void nfs4_free_stateowner(struct kref *kref);
378extern int set_callback_cred(void);
348extern void nfsd4_probe_callback(struct nfs4_client *clp); 379extern void nfsd4_probe_callback(struct nfs4_client *clp);
349extern void nfsd4_cb_recall(struct nfs4_delegation *dp); 380extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
350extern void nfs4_put_delegation(struct nfs4_delegation *dp); 381extern void nfs4_put_delegation(struct nfs4_delegation *dp);
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index 2bacf7535069..73164c2b3d29 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -51,7 +51,7 @@ struct nfsd4_compound_state {
51 /* For sessions DRC */ 51 /* For sessions DRC */
52 struct nfsd4_session *session; 52 struct nfsd4_session *session;
53 struct nfsd4_slot *slot; 53 struct nfsd4_slot *slot;
54 __be32 *statp; 54 __be32 *datap;
55 size_t iovlen; 55 size_t iovlen;
56 u32 minorversion; 56 u32 minorversion;
57 u32 status; 57 u32 status;
@@ -366,18 +366,6 @@ struct nfsd4_exchange_id {
366 int spa_how; 366 int spa_how;
367}; 367};
368 368
369struct nfsd4_create_session {
370 clientid_t clientid;
371 struct nfs4_sessionid sessionid;
372 u32 seqid;
373 u32 flags;
374 struct nfsd4_channel_attrs fore_channel;
375 struct nfsd4_channel_attrs back_channel;
376 u32 callback_prog;
377 u32 uid;
378 u32 gid;
379};
380
381struct nfsd4_sequence { 369struct nfsd4_sequence {
382 struct nfs4_sessionid sessionid; /* request/response */ 370 struct nfs4_sessionid sessionid; /* request/response */
383 u32 seqid; /* request/response */ 371 u32 seqid; /* request/response */
@@ -479,13 +467,12 @@ struct nfsd4_compoundres {
479static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp) 467static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
480{ 468{
481 struct nfsd4_compoundargs *args = resp->rqstp->rq_argp; 469 struct nfsd4_compoundargs *args = resp->rqstp->rq_argp;
482 return args->opcnt == 1; 470 return resp->opcnt == 1 && args->ops[0].opnum == OP_SEQUENCE;
483} 471}
484 472
485static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp) 473static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
486{ 474{
487 return !resp->cstate.slot->sl_cache_entry.ce_cachethis || 475 return !resp->cstate.slot->sl_cachethis || nfsd4_is_solo_sequence(resp);
488 nfsd4_is_solo_sequence(resp);
489} 476}
490 477
491#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) 478#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
diff --git a/include/linux/oom.h b/include/linux/oom.h
index a7979baf1e39..6aac5fe4f6f1 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -30,5 +30,16 @@ extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
30extern int register_oom_notifier(struct notifier_block *nb); 30extern int register_oom_notifier(struct notifier_block *nb);
31extern int unregister_oom_notifier(struct notifier_block *nb); 31extern int unregister_oom_notifier(struct notifier_block *nb);
32 32
33extern bool oom_killer_disabled;
34
35static inline void oom_killer_disable(void)
36{
37 oom_killer_disabled = true;
38}
39
40static inline void oom_killer_enable(void)
41{
42 oom_killer_disabled = false;
43}
33#endif /* __KERNEL__*/ 44#endif /* __KERNEL__*/
34#endif /* _INCLUDE_LINUX_OOM_H */ 45#endif /* _INCLUDE_LINUX_OOM_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 2b87acfc5f87..6b202b173955 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -51,6 +51,9 @@
51 * PG_buddy is set to indicate that the page is free and in the buddy system 51 * PG_buddy is set to indicate that the page is free and in the buddy system
52 * (see mm/page_alloc.c). 52 * (see mm/page_alloc.c).
53 * 53 *
54 * PG_hwpoison indicates that a page got corrupted in hardware and contains
55 * data with incorrect ECC bits that triggered a machine check. Accessing is
56 * not safe since it may cause another machine check. Don't touch!
54 */ 57 */
55 58
56/* 59/*
@@ -102,6 +105,9 @@ enum pageflags {
102#ifdef CONFIG_ARCH_USES_PG_UNCACHED 105#ifdef CONFIG_ARCH_USES_PG_UNCACHED
103 PG_uncached, /* Page has been mapped as uncached */ 106 PG_uncached, /* Page has been mapped as uncached */
104#endif 107#endif
108#ifdef CONFIG_MEMORY_FAILURE
109 PG_hwpoison, /* hardware poisoned page. Don't touch */
110#endif
105 __NR_PAGEFLAGS, 111 __NR_PAGEFLAGS,
106 112
107 /* Filesystems */ 113 /* Filesystems */
@@ -158,6 +164,9 @@ static inline int TestSetPage##uname(struct page *page) \
158static inline int TestClearPage##uname(struct page *page) \ 164static inline int TestClearPage##uname(struct page *page) \
159 { return test_and_clear_bit(PG_##lname, &page->flags); } 165 { return test_and_clear_bit(PG_##lname, &page->flags); }
160 166
167#define __TESTCLEARFLAG(uname, lname) \
168static inline int __TestClearPage##uname(struct page *page) \
169 { return __test_and_clear_bit(PG_##lname, &page->flags); }
161 170
162#define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \ 171#define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
163 SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname) 172 SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname)
@@ -184,6 +193,9 @@ static inline void __ClearPage##uname(struct page *page) { }
184#define TESTCLEARFLAG_FALSE(uname) \ 193#define TESTCLEARFLAG_FALSE(uname) \
185static inline int TestClearPage##uname(struct page *page) { return 0; } 194static inline int TestClearPage##uname(struct page *page) { return 0; }
186 195
196#define __TESTCLEARFLAG_FALSE(uname) \
197static inline int __TestClearPage##uname(struct page *page) { return 0; }
198
187struct page; /* forward declaration */ 199struct page; /* forward declaration */
188 200
189TESTPAGEFLAG(Locked, locked) TESTSETFLAG(Locked, locked) 201TESTPAGEFLAG(Locked, locked) TESTSETFLAG(Locked, locked)
@@ -250,11 +262,11 @@ PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
250#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 262#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
251#define MLOCK_PAGES 1 263#define MLOCK_PAGES 1
252PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) 264PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked)
253 TESTSCFLAG(Mlocked, mlocked) 265 TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked)
254#else 266#else
255#define MLOCK_PAGES 0 267#define MLOCK_PAGES 0
256PAGEFLAG_FALSE(Mlocked) 268PAGEFLAG_FALSE(Mlocked) SETPAGEFLAG_NOOP(Mlocked)
257 SETPAGEFLAG_NOOP(Mlocked) TESTCLEARFLAG_FALSE(Mlocked) 269 TESTCLEARFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked)
258#endif 270#endif
259 271
260#ifdef CONFIG_ARCH_USES_PG_UNCACHED 272#ifdef CONFIG_ARCH_USES_PG_UNCACHED
@@ -263,6 +275,15 @@ PAGEFLAG(Uncached, uncached)
263PAGEFLAG_FALSE(Uncached) 275PAGEFLAG_FALSE(Uncached)
264#endif 276#endif
265 277
278#ifdef CONFIG_MEMORY_FAILURE
279PAGEFLAG(HWPoison, hwpoison)
280TESTSETFLAG(HWPoison, hwpoison)
281#define __PG_HWPOISON (1UL << PG_hwpoison)
282#else
283PAGEFLAG_FALSE(HWPoison)
284#define __PG_HWPOISON 0
285#endif
286
266static inline int PageUptodate(struct page *page) 287static inline int PageUptodate(struct page *page)
267{ 288{
268 int ret = test_bit(PG_uptodate, &(page)->flags); 289 int ret = test_bit(PG_uptodate, &(page)->flags);
@@ -387,7 +408,7 @@ static inline void __ClearPageTail(struct page *page)
387 1 << PG_private | 1 << PG_private_2 | \ 408 1 << PG_private | 1 << PG_private_2 | \
388 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ 409 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \
389 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ 410 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
390 1 << PG_unevictable | __PG_MLOCKED) 411 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON)
391 412
392/* 413/*
393 * Flags checked when a page is prepped for return by the page allocator. 414 * Flags checked when a page is prepped for return by the page allocator.
@@ -396,8 +417,8 @@ static inline void __ClearPageTail(struct page *page)
396 */ 417 */
397#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1) 418#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1)
398 419
399#endif /* !__GENERATING_BOUNDS_H */ 420#define PAGE_FLAGS_PRIVATE \
400 421 (1 << PG_private | 1 << PG_private_2)
401/** 422/**
402 * page_has_private - Determine if page has private stuff 423 * page_has_private - Determine if page has private stuff
403 * @page: The page to be checked 424 * @page: The page to be checked
@@ -405,8 +426,11 @@ static inline void __ClearPageTail(struct page *page)
405 * Determine if a page has private stuff, indicating that release routines 426 * Determine if a page has private stuff, indicating that release routines
406 * should be invoked upon it. 427 * should be invoked upon it.
407 */ 428 */
408#define page_has_private(page) \ 429static inline int page_has_private(struct page *page)
409 ((page)->flags & ((1 << PG_private) | \ 430{
410 (1 << PG_private_2))) 431 return !!(page->flags & PAGE_FLAGS_PRIVATE);
432}
433
434#endif /* !__GENERATING_BOUNDS_H */
411 435
412#endif /* PAGE_FLAGS_H */ 436#endif /* PAGE_FLAGS_H */
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 13f126c89ae8..4b938d4f3ac2 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -38,6 +38,7 @@ enum {
38 PCG_LOCK, /* page cgroup is locked */ 38 PCG_LOCK, /* page cgroup is locked */
39 PCG_CACHE, /* charged as cache */ 39 PCG_CACHE, /* charged as cache */
40 PCG_USED, /* this object is in use. */ 40 PCG_USED, /* this object is in use. */
41 PCG_ACCT_LRU, /* page has been accounted for */
41}; 42};
42 43
43#define TESTPCGFLAG(uname, lname) \ 44#define TESTPCGFLAG(uname, lname) \
@@ -52,11 +53,23 @@ static inline void SetPageCgroup##uname(struct page_cgroup *pc)\
52static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ 53static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
53 { clear_bit(PCG_##lname, &pc->flags); } 54 { clear_bit(PCG_##lname, &pc->flags); }
54 55
56#define TESTCLEARPCGFLAG(uname, lname) \
57static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \
58 { return test_and_clear_bit(PCG_##lname, &pc->flags); }
59
55/* Cache flag is set only once (at allocation) */ 60/* Cache flag is set only once (at allocation) */
56TESTPCGFLAG(Cache, CACHE) 61TESTPCGFLAG(Cache, CACHE)
62CLEARPCGFLAG(Cache, CACHE)
63SETPCGFLAG(Cache, CACHE)
57 64
58TESTPCGFLAG(Used, USED) 65TESTPCGFLAG(Used, USED)
59CLEARPCGFLAG(Used, USED) 66CLEARPCGFLAG(Used, USED)
67SETPCGFLAG(Used, USED)
68
69SETPCGFLAG(AcctLRU, ACCT_LRU)
70CLEARPCGFLAG(AcctLRU, ACCT_LRU)
71TESTPCGFLAG(AcctLRU, ACCT_LRU)
72TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU)
60 73
61static inline int page_cgroup_nid(struct page_cgroup *pc) 74static inline int page_cgroup_nid(struct page_cgroup *pc)
62{ 75{
@@ -105,14 +118,14 @@ static inline void __init page_cgroup_init_flatmem(void)
105 118
106#endif 119#endif
107 120
108#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
109#include <linux/swap.h> 121#include <linux/swap.h>
122
123#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
110extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); 124extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id);
111extern unsigned short lookup_swap_cgroup(swp_entry_t ent); 125extern unsigned short lookup_swap_cgroup(swp_entry_t ent);
112extern int swap_cgroup_swapon(int type, unsigned long max_pages); 126extern int swap_cgroup_swapon(int type, unsigned long max_pages);
113extern void swap_cgroup_swapoff(int type); 127extern void swap_cgroup_swapoff(int type);
114#else 128#else
115#include <linux/swap.h>
116 129
117static inline 130static inline
118unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) 131unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 3b6b788fe2b5..da1fda8623e0 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -543,6 +543,7 @@
543#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450 543#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450
544#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451 544#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451
545#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458 545#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458
546#define PCI_DEVICE_ID_AMD_SB900_SMBUS 0x780b
546#define PCI_DEVICE_ID_AMD_CS5535_IDE 0x208F 547#define PCI_DEVICE_ID_AMD_CS5535_IDE 0x208F
547#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090 548#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090
548#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 549#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091
@@ -2526,6 +2527,16 @@
2526#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e 2527#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e
2527#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b 2528#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b
2528#define PCI_DEVICE_ID_INTEL_FBD_CNB 0x360c 2529#define PCI_DEVICE_ID_INTEL_FBD_CNB 0x360c
2530#define PCI_DEVICE_ID_INTEL_IOAT_JSF0 0x3710
2531#define PCI_DEVICE_ID_INTEL_IOAT_JSF1 0x3711
2532#define PCI_DEVICE_ID_INTEL_IOAT_JSF2 0x3712
2533#define PCI_DEVICE_ID_INTEL_IOAT_JSF3 0x3713
2534#define PCI_DEVICE_ID_INTEL_IOAT_JSF4 0x3714
2535#define PCI_DEVICE_ID_INTEL_IOAT_JSF5 0x3715
2536#define PCI_DEVICE_ID_INTEL_IOAT_JSF6 0x3716
2537#define PCI_DEVICE_ID_INTEL_IOAT_JSF7 0x3717
2538#define PCI_DEVICE_ID_INTEL_IOAT_JSF8 0x3718
2539#define PCI_DEVICE_ID_INTEL_IOAT_JSF9 0x3719
2529#define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14 2540#define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14
2530#define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16 2541#define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16
2531#define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18 2542#define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 972f90d7a32f..368bd70f1d2d 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -1,5 +1,9 @@
1/* 1/*
2 * Performance counters: 2 * NOTE: this file will be removed in a future kernel release, it is
3 * provided as a courtesy copy of user-space code that relies on the
4 * old (pre-rename) symbols and constants.
5 *
6 * Performance events:
3 * 7 *
4 * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de> 8 * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
5 * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar 9 * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar
@@ -131,19 +135,19 @@ enum perf_counter_sample_format {
131 * as specified by attr.read_format: 135 * as specified by attr.read_format:
132 * 136 *
133 * struct read_format { 137 * struct read_format {
134 * { u64 value; 138 * { u64 value;
135 * { u64 time_enabled; } && PERF_FORMAT_ENABLED 139 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
136 * { u64 time_running; } && PERF_FORMAT_RUNNING 140 * { u64 time_running; } && PERF_FORMAT_RUNNING
137 * { u64 id; } && PERF_FORMAT_ID 141 * { u64 id; } && PERF_FORMAT_ID
138 * } && !PERF_FORMAT_GROUP 142 * } && !PERF_FORMAT_GROUP
139 * 143 *
140 * { u64 nr; 144 * { u64 nr;
141 * { u64 time_enabled; } && PERF_FORMAT_ENABLED 145 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
142 * { u64 time_running; } && PERF_FORMAT_RUNNING 146 * { u64 time_running; } && PERF_FORMAT_RUNNING
143 * { u64 value; 147 * { u64 value;
144 * { u64 id; } && PERF_FORMAT_ID 148 * { u64 id; } && PERF_FORMAT_ID
145 * } cntr[nr]; 149 * } cntr[nr];
146 * } && PERF_FORMAT_GROUP 150 * } && PERF_FORMAT_GROUP
147 * }; 151 * };
148 */ 152 */
149enum perf_counter_read_format { 153enum perf_counter_read_format {
@@ -199,10 +203,14 @@ struct perf_counter_attr {
199 inherit_stat : 1, /* per task counts */ 203 inherit_stat : 1, /* per task counts */
200 enable_on_exec : 1, /* next exec enables */ 204 enable_on_exec : 1, /* next exec enables */
201 task : 1, /* trace fork/exit */ 205 task : 1, /* trace fork/exit */
206 watermark : 1, /* wakeup_watermark */
202 207
203 __reserved_1 : 50; 208 __reserved_1 : 49;
204 209
205 __u32 wakeup_events; /* wakeup every n events */ 210 union {
211 __u32 wakeup_events; /* wakeup every n events */
212 __u32 wakeup_watermark; /* bytes before wakeup */
213 };
206 __u32 __reserved_2; 214 __u32 __reserved_2;
207 215
208 __u64 __reserved_3; 216 __u64 __reserved_3;
@@ -310,9 +318,9 @@ enum perf_event_type {
310 318
311 /* 319 /*
312 * struct { 320 * struct {
313 * struct perf_event_header header; 321 * struct perf_event_header header;
314 * u64 id; 322 * u64 id;
315 * u64 lost; 323 * u64 lost;
316 * }; 324 * };
317 */ 325 */
318 PERF_EVENT_LOST = 2, 326 PERF_EVENT_LOST = 2,
@@ -332,6 +340,7 @@ enum perf_event_type {
332 * struct perf_event_header header; 340 * struct perf_event_header header;
333 * u32 pid, ppid; 341 * u32 pid, ppid;
334 * u32 tid, ptid; 342 * u32 tid, ptid;
343 * u64 time;
335 * }; 344 * };
336 */ 345 */
337 PERF_EVENT_EXIT = 4, 346 PERF_EVENT_EXIT = 4,
@@ -352,16 +361,17 @@ enum perf_event_type {
352 * struct perf_event_header header; 361 * struct perf_event_header header;
353 * u32 pid, ppid; 362 * u32 pid, ppid;
354 * u32 tid, ptid; 363 * u32 tid, ptid;
364 * { u64 time; } && PERF_SAMPLE_TIME
355 * }; 365 * };
356 */ 366 */
357 PERF_EVENT_FORK = 7, 367 PERF_EVENT_FORK = 7,
358 368
359 /* 369 /*
360 * struct { 370 * struct {
361 * struct perf_event_header header; 371 * struct perf_event_header header;
362 * u32 pid, tid; 372 * u32 pid, tid;
363 * 373 *
364 * struct read_format values; 374 * struct read_format values;
365 * }; 375 * };
366 */ 376 */
367 PERF_EVENT_READ = 8, 377 PERF_EVENT_READ = 8,
@@ -377,23 +387,23 @@ enum perf_event_type {
377 * { u64 id; } && PERF_SAMPLE_ID 387 * { u64 id; } && PERF_SAMPLE_ID
378 * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID 388 * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID
379 * { u32 cpu, res; } && PERF_SAMPLE_CPU 389 * { u32 cpu, res; } && PERF_SAMPLE_CPU
380 * { u64 period; } && PERF_SAMPLE_PERIOD 390 * { u64 period; } && PERF_SAMPLE_PERIOD
381 * 391 *
382 * { struct read_format values; } && PERF_SAMPLE_READ 392 * { struct read_format values; } && PERF_SAMPLE_READ
383 * 393 *
384 * { u64 nr, 394 * { u64 nr,
385 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN 395 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN
386 * 396 *
387 * # 397 * #
388 * # The RAW record below is opaque data wrt the ABI 398 * # The RAW record below is opaque data wrt the ABI
389 * # 399 * #
390 * # That is, the ABI doesn't make any promises wrt to 400 * # That is, the ABI doesn't make any promises wrt to
391 * # the stability of its content, it may vary depending 401 * # the stability of its content, it may vary depending
392 * # on event, hardware, kernel version and phase of 402 * # on event, hardware, kernel version and phase of
393 * # the moon. 403 * # the moon.
394 * # 404 * #
395 * # In other words, PERF_SAMPLE_RAW contents are not an ABI. 405 * # In other words, PERF_SAMPLE_RAW contents are not an ABI.
396 * # 406 * #
397 * 407 *
398 * { u32 size; 408 * { u32 size;
399 * char data[size];}&& PERF_SAMPLE_RAW 409 * char data[size];}&& PERF_SAMPLE_RAW
@@ -416,392 +426,16 @@ enum perf_callchain_context {
416 PERF_CONTEXT_MAX = (__u64)-4095, 426 PERF_CONTEXT_MAX = (__u64)-4095,
417}; 427};
418 428
419#define PERF_FLAG_FD_NO_GROUP (1U << 0) 429#define PERF_FLAG_FD_NO_GROUP (1U << 0)
420#define PERF_FLAG_FD_OUTPUT (1U << 1) 430#define PERF_FLAG_FD_OUTPUT (1U << 1)
421 431
422#ifdef __KERNEL__
423/* 432/*
424 * Kernel-internal data types and definitions: 433 * In case some app still references the old symbols:
425 */
426
427#ifdef CONFIG_PERF_COUNTERS
428# include <asm/perf_counter.h>
429#endif
430
431#include <linux/list.h>
432#include <linux/mutex.h>
433#include <linux/rculist.h>
434#include <linux/rcupdate.h>
435#include <linux/spinlock.h>
436#include <linux/hrtimer.h>
437#include <linux/fs.h>
438#include <linux/pid_namespace.h>
439#include <asm/atomic.h>
440
441#define PERF_MAX_STACK_DEPTH 255
442
443struct perf_callchain_entry {
444 __u64 nr;
445 __u64 ip[PERF_MAX_STACK_DEPTH];
446};
447
448struct perf_raw_record {
449 u32 size;
450 void *data;
451};
452
453struct task_struct;
454
455/**
456 * struct hw_perf_counter - performance counter hardware details:
457 */
458struct hw_perf_counter {
459#ifdef CONFIG_PERF_COUNTERS
460 union {
461 struct { /* hardware */
462 u64 config;
463 unsigned long config_base;
464 unsigned long counter_base;
465 int idx;
466 };
467 union { /* software */
468 atomic64_t count;
469 struct hrtimer hrtimer;
470 };
471 };
472 atomic64_t prev_count;
473 u64 sample_period;
474 u64 last_period;
475 atomic64_t period_left;
476 u64 interrupts;
477
478 u64 freq_count;
479 u64 freq_interrupts;
480 u64 freq_stamp;
481#endif
482};
483
484struct perf_counter;
485
486/**
487 * struct pmu - generic performance monitoring unit
488 */
489struct pmu {
490 int (*enable) (struct perf_counter *counter);
491 void (*disable) (struct perf_counter *counter);
492 void (*read) (struct perf_counter *counter);
493 void (*unthrottle) (struct perf_counter *counter);
494};
495
496/**
497 * enum perf_counter_active_state - the states of a counter
498 */
499enum perf_counter_active_state {
500 PERF_COUNTER_STATE_ERROR = -2,
501 PERF_COUNTER_STATE_OFF = -1,
502 PERF_COUNTER_STATE_INACTIVE = 0,
503 PERF_COUNTER_STATE_ACTIVE = 1,
504};
505
506struct file;
507
508struct perf_mmap_data {
509 struct rcu_head rcu_head;
510 int nr_pages; /* nr of data pages */
511 int writable; /* are we writable */
512 int nr_locked; /* nr pages mlocked */
513
514 atomic_t poll; /* POLL_ for wakeups */
515 atomic_t events; /* event limit */
516
517 atomic_long_t head; /* write position */
518 atomic_long_t done_head; /* completed head */
519
520 atomic_t lock; /* concurrent writes */
521 atomic_t wakeup; /* needs a wakeup */
522 atomic_t lost; /* nr records lost */
523
524 struct perf_counter_mmap_page *user_page;
525 void *data_pages[0];
526};
527
528struct perf_pending_entry {
529 struct perf_pending_entry *next;
530 void (*func)(struct perf_pending_entry *);
531};
532
533/**
534 * struct perf_counter - performance counter kernel representation:
535 */
536struct perf_counter {
537#ifdef CONFIG_PERF_COUNTERS
538 struct list_head list_entry;
539 struct list_head event_entry;
540 struct list_head sibling_list;
541 int nr_siblings;
542 struct perf_counter *group_leader;
543 struct perf_counter *output;
544 const struct pmu *pmu;
545
546 enum perf_counter_active_state state;
547 atomic64_t count;
548
549 /*
550 * These are the total time in nanoseconds that the counter
551 * has been enabled (i.e. eligible to run, and the task has
552 * been scheduled in, if this is a per-task counter)
553 * and running (scheduled onto the CPU), respectively.
554 *
555 * They are computed from tstamp_enabled, tstamp_running and
556 * tstamp_stopped when the counter is in INACTIVE or ACTIVE state.
557 */
558 u64 total_time_enabled;
559 u64 total_time_running;
560
561 /*
562 * These are timestamps used for computing total_time_enabled
563 * and total_time_running when the counter is in INACTIVE or
564 * ACTIVE state, measured in nanoseconds from an arbitrary point
565 * in time.
566 * tstamp_enabled: the notional time when the counter was enabled
567 * tstamp_running: the notional time when the counter was scheduled on
568 * tstamp_stopped: in INACTIVE state, the notional time when the
569 * counter was scheduled off.
570 */
571 u64 tstamp_enabled;
572 u64 tstamp_running;
573 u64 tstamp_stopped;
574
575 struct perf_counter_attr attr;
576 struct hw_perf_counter hw;
577
578 struct perf_counter_context *ctx;
579 struct file *filp;
580
581 /*
582 * These accumulate total time (in nanoseconds) that children
583 * counters have been enabled and running, respectively.
584 */
585 atomic64_t child_total_time_enabled;
586 atomic64_t child_total_time_running;
587
588 /*
589 * Protect attach/detach and child_list:
590 */
591 struct mutex child_mutex;
592 struct list_head child_list;
593 struct perf_counter *parent;
594
595 int oncpu;
596 int cpu;
597
598 struct list_head owner_entry;
599 struct task_struct *owner;
600
601 /* mmap bits */
602 struct mutex mmap_mutex;
603 atomic_t mmap_count;
604 struct perf_mmap_data *data;
605
606 /* poll related */
607 wait_queue_head_t waitq;
608 struct fasync_struct *fasync;
609
610 /* delayed work for NMIs and such */
611 int pending_wakeup;
612 int pending_kill;
613 int pending_disable;
614 struct perf_pending_entry pending;
615
616 atomic_t event_limit;
617
618 void (*destroy)(struct perf_counter *);
619 struct rcu_head rcu_head;
620
621 struct pid_namespace *ns;
622 u64 id;
623#endif
624};
625
626/**
627 * struct perf_counter_context - counter context structure
628 *
629 * Used as a container for task counters and CPU counters as well:
630 */
631struct perf_counter_context {
632 /*
633 * Protect the states of the counters in the list,
634 * nr_active, and the list:
635 */
636 spinlock_t lock;
637 /*
638 * Protect the list of counters. Locking either mutex or lock
639 * is sufficient to ensure the list doesn't change; to change
640 * the list you need to lock both the mutex and the spinlock.
641 */
642 struct mutex mutex;
643
644 struct list_head counter_list;
645 struct list_head event_list;
646 int nr_counters;
647 int nr_active;
648 int is_active;
649 int nr_stat;
650 atomic_t refcount;
651 struct task_struct *task;
652
653 /*
654 * Context clock, runs when context enabled.
655 */
656 u64 time;
657 u64 timestamp;
658
659 /*
660 * These fields let us detect when two contexts have both
661 * been cloned (inherited) from a common ancestor.
662 */
663 struct perf_counter_context *parent_ctx;
664 u64 parent_gen;
665 u64 generation;
666 int pin_count;
667 struct rcu_head rcu_head;
668};
669
670/**
671 * struct perf_counter_cpu_context - per cpu counter context structure
672 */ 434 */
673struct perf_cpu_context {
674 struct perf_counter_context ctx;
675 struct perf_counter_context *task_ctx;
676 int active_oncpu;
677 int max_pertask;
678 int exclusive;
679 435
680 /* 436#define __NR_perf_counter_open __NR_perf_event_open
681 * Recursion avoidance:
682 *
683 * task, softirq, irq, nmi context
684 */
685 int recursion[4];
686};
687 437
688#ifdef CONFIG_PERF_COUNTERS 438#define PR_TASK_PERF_COUNTERS_DISABLE PR_TASK_PERF_EVENTS_DISABLE
439#define PR_TASK_PERF_COUNTERS_ENABLE PR_TASK_PERF_EVENTS_ENABLE
689 440
690/*
691 * Set by architecture code:
692 */
693extern int perf_max_counters;
694
695extern const struct pmu *hw_perf_counter_init(struct perf_counter *counter);
696
697extern void perf_counter_task_sched_in(struct task_struct *task, int cpu);
698extern void perf_counter_task_sched_out(struct task_struct *task,
699 struct task_struct *next, int cpu);
700extern void perf_counter_task_tick(struct task_struct *task, int cpu);
701extern int perf_counter_init_task(struct task_struct *child);
702extern void perf_counter_exit_task(struct task_struct *child);
703extern void perf_counter_free_task(struct task_struct *task);
704extern void set_perf_counter_pending(void);
705extern void perf_counter_do_pending(void);
706extern void perf_counter_print_debug(void);
707extern void __perf_disable(void);
708extern bool __perf_enable(void);
709extern void perf_disable(void);
710extern void perf_enable(void);
711extern int perf_counter_task_disable(void);
712extern int perf_counter_task_enable(void);
713extern int hw_perf_group_sched_in(struct perf_counter *group_leader,
714 struct perf_cpu_context *cpuctx,
715 struct perf_counter_context *ctx, int cpu);
716extern void perf_counter_update_userpage(struct perf_counter *counter);
717
718struct perf_sample_data {
719 struct pt_regs *regs;
720 u64 addr;
721 u64 period;
722 struct perf_raw_record *raw;
723};
724
725extern int perf_counter_overflow(struct perf_counter *counter, int nmi,
726 struct perf_sample_data *data);
727extern void perf_counter_output(struct perf_counter *counter, int nmi,
728 struct perf_sample_data *data);
729
730/*
731 * Return 1 for a software counter, 0 for a hardware counter
732 */
733static inline int is_software_counter(struct perf_counter *counter)
734{
735 return (counter->attr.type != PERF_TYPE_RAW) &&
736 (counter->attr.type != PERF_TYPE_HARDWARE) &&
737 (counter->attr.type != PERF_TYPE_HW_CACHE);
738}
739
740extern atomic_t perf_swcounter_enabled[PERF_COUNT_SW_MAX];
741
742extern void __perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
743
744static inline void
745perf_swcounter_event(u32 event, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
746{
747 if (atomic_read(&perf_swcounter_enabled[event]))
748 __perf_swcounter_event(event, nr, nmi, regs, addr);
749}
750
751extern void __perf_counter_mmap(struct vm_area_struct *vma);
752
753static inline void perf_counter_mmap(struct vm_area_struct *vma)
754{
755 if (vma->vm_flags & VM_EXEC)
756 __perf_counter_mmap(vma);
757}
758
759extern void perf_counter_comm(struct task_struct *tsk);
760extern void perf_counter_fork(struct task_struct *tsk);
761
762extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs);
763
764extern int sysctl_perf_counter_paranoid;
765extern int sysctl_perf_counter_mlock;
766extern int sysctl_perf_counter_sample_rate;
767
768extern void perf_counter_init(void);
769extern void perf_tpcounter_event(int event_id, u64 addr, u64 count,
770 void *record, int entry_size);
771
772#ifndef perf_misc_flags
773#define perf_misc_flags(regs) (user_mode(regs) ? PERF_EVENT_MISC_USER : \
774 PERF_EVENT_MISC_KERNEL)
775#define perf_instruction_pointer(regs) instruction_pointer(regs)
776#endif
777
778#else
779static inline void
780perf_counter_task_sched_in(struct task_struct *task, int cpu) { }
781static inline void
782perf_counter_task_sched_out(struct task_struct *task,
783 struct task_struct *next, int cpu) { }
784static inline void
785perf_counter_task_tick(struct task_struct *task, int cpu) { }
786static inline int perf_counter_init_task(struct task_struct *child) { return 0; }
787static inline void perf_counter_exit_task(struct task_struct *child) { }
788static inline void perf_counter_free_task(struct task_struct *task) { }
789static inline void perf_counter_do_pending(void) { }
790static inline void perf_counter_print_debug(void) { }
791static inline void perf_disable(void) { }
792static inline void perf_enable(void) { }
793static inline int perf_counter_task_disable(void) { return -EINVAL; }
794static inline int perf_counter_task_enable(void) { return -EINVAL; }
795
796static inline void
797perf_swcounter_event(u32 event, u64 nr, int nmi,
798 struct pt_regs *regs, u64 addr) { }
799
800static inline void perf_counter_mmap(struct vm_area_struct *vma) { }
801static inline void perf_counter_comm(struct task_struct *tsk) { }
802static inline void perf_counter_fork(struct task_struct *tsk) { }
803static inline void perf_counter_init(void) { }
804#endif
805
806#endif /* __KERNEL__ */
807#endif /* _LINUX_PERF_COUNTER_H */ 441#endif /* _LINUX_PERF_COUNTER_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
new file mode 100644
index 000000000000..acefaf71e6dd
--- /dev/null
+++ b/include/linux/perf_event.h
@@ -0,0 +1,858 @@
1/*
2 * Performance events:
3 *
4 * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
5 * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar
6 * Copyright (C) 2008-2009, Red Hat, Inc., Peter Zijlstra
7 *
8 * Data type definitions, declarations, prototypes.
9 *
10 * Started by: Thomas Gleixner and Ingo Molnar
11 *
12 * For licencing details see kernel-base/COPYING
13 */
14#ifndef _LINUX_PERF_EVENT_H
15#define _LINUX_PERF_EVENT_H
16
17#include <linux/types.h>
18#include <linux/ioctl.h>
19#include <asm/byteorder.h>
20
21/*
22 * User-space ABI bits:
23 */
24
25/*
26 * attr.type
27 */
28enum perf_type_id {
29 PERF_TYPE_HARDWARE = 0,
30 PERF_TYPE_SOFTWARE = 1,
31 PERF_TYPE_TRACEPOINT = 2,
32 PERF_TYPE_HW_CACHE = 3,
33 PERF_TYPE_RAW = 4,
34
35 PERF_TYPE_MAX, /* non-ABI */
36};
37
38/*
39 * Generalized performance event event_id types, used by the
40 * attr.event_id parameter of the sys_perf_event_open()
41 * syscall:
42 */
43enum perf_hw_id {
44 /*
45 * Common hardware events, generalized by the kernel:
46 */
47 PERF_COUNT_HW_CPU_CYCLES = 0,
48 PERF_COUNT_HW_INSTRUCTIONS = 1,
49 PERF_COUNT_HW_CACHE_REFERENCES = 2,
50 PERF_COUNT_HW_CACHE_MISSES = 3,
51 PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
52 PERF_COUNT_HW_BRANCH_MISSES = 5,
53 PERF_COUNT_HW_BUS_CYCLES = 6,
54
55 PERF_COUNT_HW_MAX, /* non-ABI */
56};
57
58/*
59 * Generalized hardware cache events:
60 *
61 * { L1-D, L1-I, LLC, ITLB, DTLB, BPU } x
62 * { read, write, prefetch } x
63 * { accesses, misses }
64 */
65enum perf_hw_cache_id {
66 PERF_COUNT_HW_CACHE_L1D = 0,
67 PERF_COUNT_HW_CACHE_L1I = 1,
68 PERF_COUNT_HW_CACHE_LL = 2,
69 PERF_COUNT_HW_CACHE_DTLB = 3,
70 PERF_COUNT_HW_CACHE_ITLB = 4,
71 PERF_COUNT_HW_CACHE_BPU = 5,
72
73 PERF_COUNT_HW_CACHE_MAX, /* non-ABI */
74};
75
76enum perf_hw_cache_op_id {
77 PERF_COUNT_HW_CACHE_OP_READ = 0,
78 PERF_COUNT_HW_CACHE_OP_WRITE = 1,
79 PERF_COUNT_HW_CACHE_OP_PREFETCH = 2,
80
81 PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */
82};
83
84enum perf_hw_cache_op_result_id {
85 PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0,
86 PERF_COUNT_HW_CACHE_RESULT_MISS = 1,
87
88 PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */
89};
90
91/*
92 * Special "software" events provided by the kernel, even if the hardware
93 * does not support performance events. These events measure various
94 * physical and sw events of the kernel (and allow the profiling of them as
95 * well):
96 */
97enum perf_sw_ids {
98 PERF_COUNT_SW_CPU_CLOCK = 0,
99 PERF_COUNT_SW_TASK_CLOCK = 1,
100 PERF_COUNT_SW_PAGE_FAULTS = 2,
101 PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
102 PERF_COUNT_SW_CPU_MIGRATIONS = 4,
103 PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
104 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
105
106 PERF_COUNT_SW_MAX, /* non-ABI */
107};
108
109/*
110 * Bits that can be set in attr.sample_type to request information
111 * in the overflow packets.
112 */
113enum perf_event_sample_format {
114 PERF_SAMPLE_IP = 1U << 0,
115 PERF_SAMPLE_TID = 1U << 1,
116 PERF_SAMPLE_TIME = 1U << 2,
117 PERF_SAMPLE_ADDR = 1U << 3,
118 PERF_SAMPLE_READ = 1U << 4,
119 PERF_SAMPLE_CALLCHAIN = 1U << 5,
120 PERF_SAMPLE_ID = 1U << 6,
121 PERF_SAMPLE_CPU = 1U << 7,
122 PERF_SAMPLE_PERIOD = 1U << 8,
123 PERF_SAMPLE_STREAM_ID = 1U << 9,
124 PERF_SAMPLE_RAW = 1U << 10,
125
126 PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */
127};
128
129/*
130 * The format of the data returned by read() on a perf event fd,
131 * as specified by attr.read_format:
132 *
133 * struct read_format {
134 * { u64 value;
135 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
136 * { u64 time_running; } && PERF_FORMAT_RUNNING
137 * { u64 id; } && PERF_FORMAT_ID
138 * } && !PERF_FORMAT_GROUP
139 *
140 * { u64 nr;
141 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
142 * { u64 time_running; } && PERF_FORMAT_RUNNING
143 * { u64 value;
144 * { u64 id; } && PERF_FORMAT_ID
145 * } cntr[nr];
146 * } && PERF_FORMAT_GROUP
147 * };
148 */
149enum perf_event_read_format {
150 PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0,
151 PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1,
152 PERF_FORMAT_ID = 1U << 2,
153 PERF_FORMAT_GROUP = 1U << 3,
154
155 PERF_FORMAT_MAX = 1U << 4, /* non-ABI */
156};
157
158#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
159
160/*
161 * Hardware event_id to monitor via a performance monitoring event:
162 */
163struct perf_event_attr {
164
165 /*
166 * Major type: hardware/software/tracepoint/etc.
167 */
168 __u32 type;
169
170 /*
171 * Size of the attr structure, for fwd/bwd compat.
172 */
173 __u32 size;
174
175 /*
176 * Type specific configuration information.
177 */
178 __u64 config;
179
180 union {
181 __u64 sample_period;
182 __u64 sample_freq;
183 };
184
185 __u64 sample_type;
186 __u64 read_format;
187
188 __u64 disabled : 1, /* off by default */
189 inherit : 1, /* children inherit it */
190 pinned : 1, /* must always be on PMU */
191 exclusive : 1, /* only group on PMU */
192 exclude_user : 1, /* don't count user */
193 exclude_kernel : 1, /* ditto kernel */
194 exclude_hv : 1, /* ditto hypervisor */
195 exclude_idle : 1, /* don't count when idle */
196 mmap : 1, /* include mmap data */
197 comm : 1, /* include comm data */
198 freq : 1, /* use freq, not period */
199 inherit_stat : 1, /* per task counts */
200 enable_on_exec : 1, /* next exec enables */
201 task : 1, /* trace fork/exit */
202 watermark : 1, /* wakeup_watermark */
203
204 __reserved_1 : 49;
205
206 union {
207 __u32 wakeup_events; /* wakeup every n events */
208 __u32 wakeup_watermark; /* bytes before wakeup */
209 };
210 __u32 __reserved_2;
211
212 __u64 __reserved_3;
213};
214
215/*
216 * Ioctls that can be done on a perf event fd:
217 */
218#define PERF_EVENT_IOC_ENABLE _IO ('$', 0)
219#define PERF_EVENT_IOC_DISABLE _IO ('$', 1)
220#define PERF_EVENT_IOC_REFRESH _IO ('$', 2)
221#define PERF_EVENT_IOC_RESET _IO ('$', 3)
222#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, u64)
223#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5)
224
225enum perf_event_ioc_flags {
226 PERF_IOC_FLAG_GROUP = 1U << 0,
227};
228
229/*
230 * Structure of the page that can be mapped via mmap
231 */
232struct perf_event_mmap_page {
233 __u32 version; /* version number of this structure */
234 __u32 compat_version; /* lowest version this is compat with */
235
236 /*
237 * Bits needed to read the hw events in user-space.
238 *
239 * u32 seq;
240 * s64 count;
241 *
242 * do {
243 * seq = pc->lock;
244 *
245 * barrier()
246 * if (pc->index) {
247 * count = pmc_read(pc->index - 1);
248 * count += pc->offset;
249 * } else
250 * goto regular_read;
251 *
252 * barrier();
253 * } while (pc->lock != seq);
254 *
255 * NOTE: for obvious reason this only works on self-monitoring
256 * processes.
257 */
258 __u32 lock; /* seqlock for synchronization */
259 __u32 index; /* hardware event identifier */
260 __s64 offset; /* add to hardware event value */
261 __u64 time_enabled; /* time event active */
262 __u64 time_running; /* time event on cpu */
263
264 /*
265 * Hole for extension of the self monitor capabilities
266 */
267
268 __u64 __reserved[123]; /* align to 1k */
269
270 /*
271 * Control data for the mmap() data buffer.
272 *
273 * User-space reading the @data_head value should issue an rmb(), on
274 * SMP capable platforms, after reading this value -- see
275 * perf_event_wakeup().
276 *
277 * When the mapping is PROT_WRITE the @data_tail value should be
278 * written by userspace to reflect the last read data. In this case
279 * the kernel will not over-write unread data.
280 */
281 __u64 data_head; /* head in the data section */
282 __u64 data_tail; /* user-space written tail */
283};
284
285#define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0)
286#define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0)
287#define PERF_RECORD_MISC_KERNEL (1 << 0)
288#define PERF_RECORD_MISC_USER (2 << 0)
289#define PERF_RECORD_MISC_HYPERVISOR (3 << 0)
290
291struct perf_event_header {
292 __u32 type;
293 __u16 misc;
294 __u16 size;
295};
296
297enum perf_event_type {
298
299 /*
300 * The MMAP events record the PROT_EXEC mappings so that we can
301 * correlate userspace IPs to code. They have the following structure:
302 *
303 * struct {
304 * struct perf_event_header header;
305 *
306 * u32 pid, tid;
307 * u64 addr;
308 * u64 len;
309 * u64 pgoff;
310 * char filename[];
311 * };
312 */
313 PERF_RECORD_MMAP = 1,
314
315 /*
316 * struct {
317 * struct perf_event_header header;
318 * u64 id;
319 * u64 lost;
320 * };
321 */
322 PERF_RECORD_LOST = 2,
323
324 /*
325 * struct {
326 * struct perf_event_header header;
327 *
328 * u32 pid, tid;
329 * char comm[];
330 * };
331 */
332 PERF_RECORD_COMM = 3,
333
334 /*
335 * struct {
336 * struct perf_event_header header;
337 * u32 pid, ppid;
338 * u32 tid, ptid;
339 * u64 time;
340 * };
341 */
342 PERF_RECORD_EXIT = 4,
343
344 /*
345 * struct {
346 * struct perf_event_header header;
347 * u64 time;
348 * u64 id;
349 * u64 stream_id;
350 * };
351 */
352 PERF_RECORD_THROTTLE = 5,
353 PERF_RECORD_UNTHROTTLE = 6,
354
355 /*
356 * struct {
357 * struct perf_event_header header;
358 * u32 pid, ppid;
359 * u32 tid, ptid;
360 * { u64 time; } && PERF_SAMPLE_TIME
361 * };
362 */
363 PERF_RECORD_FORK = 7,
364
365 /*
366 * struct {
367 * struct perf_event_header header;
368 * u32 pid, tid;
369 *
370 * struct read_format values;
371 * };
372 */
373 PERF_RECORD_READ = 8,
374
375 /*
376 * struct {
377 * struct perf_event_header header;
378 *
379 * { u64 ip; } && PERF_SAMPLE_IP
380 * { u32 pid, tid; } && PERF_SAMPLE_TID
381 * { u64 time; } && PERF_SAMPLE_TIME
382 * { u64 addr; } && PERF_SAMPLE_ADDR
383 * { u64 id; } && PERF_SAMPLE_ID
384 * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID
385 * { u32 cpu, res; } && PERF_SAMPLE_CPU
386 * { u64 period; } && PERF_SAMPLE_PERIOD
387 *
388 * { struct read_format values; } && PERF_SAMPLE_READ
389 *
390 * { u64 nr,
391 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN
392 *
393 * #
394 * # The RAW record below is opaque data wrt the ABI
395 * #
396 * # That is, the ABI doesn't make any promises wrt to
397 * # the stability of its content, it may vary depending
398 * # on event, hardware, kernel version and phase of
399 * # the moon.
400 * #
401 * # In other words, PERF_SAMPLE_RAW contents are not an ABI.
402 * #
403 *
404 * { u32 size;
405 * char data[size];}&& PERF_SAMPLE_RAW
406 * };
407 */
408 PERF_RECORD_SAMPLE = 9,
409
410 PERF_RECORD_MAX, /* non-ABI */
411};
412
413enum perf_callchain_context {
414 PERF_CONTEXT_HV = (__u64)-32,
415 PERF_CONTEXT_KERNEL = (__u64)-128,
416 PERF_CONTEXT_USER = (__u64)-512,
417
418 PERF_CONTEXT_GUEST = (__u64)-2048,
419 PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176,
420 PERF_CONTEXT_GUEST_USER = (__u64)-2560,
421
422 PERF_CONTEXT_MAX = (__u64)-4095,
423};
424
425#define PERF_FLAG_FD_NO_GROUP (1U << 0)
426#define PERF_FLAG_FD_OUTPUT (1U << 1)
427
428#ifdef __KERNEL__
429/*
430 * Kernel-internal data types and definitions:
431 */
432
433#ifdef CONFIG_PERF_EVENTS
434# include <asm/perf_event.h>
435#endif
436
437#include <linux/list.h>
438#include <linux/mutex.h>
439#include <linux/rculist.h>
440#include <linux/rcupdate.h>
441#include <linux/spinlock.h>
442#include <linux/hrtimer.h>
443#include <linux/fs.h>
444#include <linux/pid_namespace.h>
445#include <asm/atomic.h>
446
447#define PERF_MAX_STACK_DEPTH 255
448
449struct perf_callchain_entry {
450 __u64 nr;
451 __u64 ip[PERF_MAX_STACK_DEPTH];
452};
453
454struct perf_raw_record {
455 u32 size;
456 void *data;
457};
458
459struct task_struct;
460
461/**
462 * struct hw_perf_event - performance event hardware details:
463 */
464struct hw_perf_event {
465#ifdef CONFIG_PERF_EVENTS
466 union {
467 struct { /* hardware */
468 u64 config;
469 unsigned long config_base;
470 unsigned long event_base;
471 int idx;
472 };
473 union { /* software */
474 atomic64_t count;
475 struct hrtimer hrtimer;
476 };
477 };
478 atomic64_t prev_count;
479 u64 sample_period;
480 u64 last_period;
481 atomic64_t period_left;
482 u64 interrupts;
483
484 u64 freq_count;
485 u64 freq_interrupts;
486 u64 freq_stamp;
487#endif
488};
489
490struct perf_event;
491
492/**
493 * struct pmu - generic performance monitoring unit
494 */
495struct pmu {
496 int (*enable) (struct perf_event *event);
497 void (*disable) (struct perf_event *event);
498 void (*read) (struct perf_event *event);
499 void (*unthrottle) (struct perf_event *event);
500};
501
502/**
503 * enum perf_event_active_state - the states of a event
504 */
505enum perf_event_active_state {
506 PERF_EVENT_STATE_ERROR = -2,
507 PERF_EVENT_STATE_OFF = -1,
508 PERF_EVENT_STATE_INACTIVE = 0,
509 PERF_EVENT_STATE_ACTIVE = 1,
510};
511
512struct file;
513
514struct perf_mmap_data {
515 struct rcu_head rcu_head;
516 int nr_pages; /* nr of data pages */
517 int writable; /* are we writable */
518 int nr_locked; /* nr pages mlocked */
519
520 atomic_t poll; /* POLL_ for wakeups */
521 atomic_t events; /* event_id limit */
522
523 atomic_long_t head; /* write position */
524 atomic_long_t done_head; /* completed head */
525
526 atomic_t lock; /* concurrent writes */
527 atomic_t wakeup; /* needs a wakeup */
528 atomic_t lost; /* nr records lost */
529
530 long watermark; /* wakeup watermark */
531
532 struct perf_event_mmap_page *user_page;
533 void *data_pages[0];
534};
535
536struct perf_pending_entry {
537 struct perf_pending_entry *next;
538 void (*func)(struct perf_pending_entry *);
539};
540
541/**
542 * struct perf_event - performance event kernel representation:
543 */
544struct perf_event {
545#ifdef CONFIG_PERF_EVENTS
546 struct list_head group_entry;
547 struct list_head event_entry;
548 struct list_head sibling_list;
549 int nr_siblings;
550 struct perf_event *group_leader;
551 struct perf_event *output;
552 const struct pmu *pmu;
553
554 enum perf_event_active_state state;
555 atomic64_t count;
556
557 /*
558 * These are the total time in nanoseconds that the event
559 * has been enabled (i.e. eligible to run, and the task has
560 * been scheduled in, if this is a per-task event)
561 * and running (scheduled onto the CPU), respectively.
562 *
563 * They are computed from tstamp_enabled, tstamp_running and
564 * tstamp_stopped when the event is in INACTIVE or ACTIVE state.
565 */
566 u64 total_time_enabled;
567 u64 total_time_running;
568
569 /*
570 * These are timestamps used for computing total_time_enabled
571 * and total_time_running when the event is in INACTIVE or
572 * ACTIVE state, measured in nanoseconds from an arbitrary point
573 * in time.
574 * tstamp_enabled: the notional time when the event was enabled
575 * tstamp_running: the notional time when the event was scheduled on
576 * tstamp_stopped: in INACTIVE state, the notional time when the
577 * event was scheduled off.
578 */
579 u64 tstamp_enabled;
580 u64 tstamp_running;
581 u64 tstamp_stopped;
582
583 struct perf_event_attr attr;
584 struct hw_perf_event hw;
585
586 struct perf_event_context *ctx;
587 struct file *filp;
588
589 /*
590 * These accumulate total time (in nanoseconds) that children
591 * events have been enabled and running, respectively.
592 */
593 atomic64_t child_total_time_enabled;
594 atomic64_t child_total_time_running;
595
596 /*
597 * Protect attach/detach and child_list:
598 */
599 struct mutex child_mutex;
600 struct list_head child_list;
601 struct perf_event *parent;
602
603 int oncpu;
604 int cpu;
605
606 struct list_head owner_entry;
607 struct task_struct *owner;
608
609 /* mmap bits */
610 struct mutex mmap_mutex;
611 atomic_t mmap_count;
612 struct perf_mmap_data *data;
613
614 /* poll related */
615 wait_queue_head_t waitq;
616 struct fasync_struct *fasync;
617
618 /* delayed work for NMIs and such */
619 int pending_wakeup;
620 int pending_kill;
621 int pending_disable;
622 struct perf_pending_entry pending;
623
624 atomic_t event_limit;
625
626 void (*destroy)(struct perf_event *);
627 struct rcu_head rcu_head;
628
629 struct pid_namespace *ns;
630 u64 id;
631#endif
632};
633
634/**
635 * struct perf_event_context - event context structure
636 *
637 * Used as a container for task events and CPU events as well:
638 */
639struct perf_event_context {
640 /*
641 * Protect the states of the events in the list,
642 * nr_active, and the list:
643 */
644 spinlock_t lock;
645 /*
646 * Protect the list of events. Locking either mutex or lock
647 * is sufficient to ensure the list doesn't change; to change
648 * the list you need to lock both the mutex and the spinlock.
649 */
650 struct mutex mutex;
651
652 struct list_head group_list;
653 struct list_head event_list;
654 int nr_events;
655 int nr_active;
656 int is_active;
657 int nr_stat;
658 atomic_t refcount;
659 struct task_struct *task;
660
661 /*
662 * Context clock, runs when context enabled.
663 */
664 u64 time;
665 u64 timestamp;
666
667 /*
668 * These fields let us detect when two contexts have both
669 * been cloned (inherited) from a common ancestor.
670 */
671 struct perf_event_context *parent_ctx;
672 u64 parent_gen;
673 u64 generation;
674 int pin_count;
675 struct rcu_head rcu_head;
676};
677
678/**
679 * struct perf_event_cpu_context - per cpu event context structure
680 */
681struct perf_cpu_context {
682 struct perf_event_context ctx;
683 struct perf_event_context *task_ctx;
684 int active_oncpu;
685 int max_pertask;
686 int exclusive;
687
688 /*
689 * Recursion avoidance:
690 *
691 * task, softirq, irq, nmi context
692 */
693 int recursion[4];
694};
695
696struct perf_output_handle {
697 struct perf_event *event;
698 struct perf_mmap_data *data;
699 unsigned long head;
700 unsigned long offset;
701 int nmi;
702 int sample;
703 int locked;
704 unsigned long flags;
705};
706
707#ifdef CONFIG_PERF_EVENTS
708
709/*
710 * Set by architecture code:
711 */
712extern int perf_max_events;
713
714extern const struct pmu *hw_perf_event_init(struct perf_event *event);
715
716extern void perf_event_task_sched_in(struct task_struct *task, int cpu);
717extern void perf_event_task_sched_out(struct task_struct *task,
718 struct task_struct *next, int cpu);
719extern void perf_event_task_tick(struct task_struct *task, int cpu);
720extern int perf_event_init_task(struct task_struct *child);
721extern void perf_event_exit_task(struct task_struct *child);
722extern void perf_event_free_task(struct task_struct *task);
723extern void set_perf_event_pending(void);
724extern void perf_event_do_pending(void);
725extern void perf_event_print_debug(void);
726extern void __perf_disable(void);
727extern bool __perf_enable(void);
728extern void perf_disable(void);
729extern void perf_enable(void);
730extern int perf_event_task_disable(void);
731extern int perf_event_task_enable(void);
732extern int hw_perf_group_sched_in(struct perf_event *group_leader,
733 struct perf_cpu_context *cpuctx,
734 struct perf_event_context *ctx, int cpu);
735extern void perf_event_update_userpage(struct perf_event *event);
736
737struct perf_sample_data {
738 u64 type;
739
740 u64 ip;
741 struct {
742 u32 pid;
743 u32 tid;
744 } tid_entry;
745 u64 time;
746 u64 addr;
747 u64 id;
748 u64 stream_id;
749 struct {
750 u32 cpu;
751 u32 reserved;
752 } cpu_entry;
753 u64 period;
754 struct perf_callchain_entry *callchain;
755 struct perf_raw_record *raw;
756};
757
758extern void perf_output_sample(struct perf_output_handle *handle,
759 struct perf_event_header *header,
760 struct perf_sample_data *data,
761 struct perf_event *event);
762extern void perf_prepare_sample(struct perf_event_header *header,
763 struct perf_sample_data *data,
764 struct perf_event *event,
765 struct pt_regs *regs);
766
767extern int perf_event_overflow(struct perf_event *event, int nmi,
768 struct perf_sample_data *data,
769 struct pt_regs *regs);
770
771/*
772 * Return 1 for a software event, 0 for a hardware event
773 */
774static inline int is_software_event(struct perf_event *event)
775{
776 return (event->attr.type != PERF_TYPE_RAW) &&
777 (event->attr.type != PERF_TYPE_HARDWARE) &&
778 (event->attr.type != PERF_TYPE_HW_CACHE);
779}
780
781extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX];
782
783extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64);
784
785static inline void
786perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
787{
788 if (atomic_read(&perf_swevent_enabled[event_id]))
789 __perf_sw_event(event_id, nr, nmi, regs, addr);
790}
791
792extern void __perf_event_mmap(struct vm_area_struct *vma);
793
794static inline void perf_event_mmap(struct vm_area_struct *vma)
795{
796 if (vma->vm_flags & VM_EXEC)
797 __perf_event_mmap(vma);
798}
799
800extern void perf_event_comm(struct task_struct *tsk);
801extern void perf_event_fork(struct task_struct *tsk);
802
803extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs);
804
805extern int sysctl_perf_event_paranoid;
806extern int sysctl_perf_event_mlock;
807extern int sysctl_perf_event_sample_rate;
808
809extern void perf_event_init(void);
810extern void perf_tp_event(int event_id, u64 addr, u64 count,
811 void *record, int entry_size);
812
813#ifndef perf_misc_flags
814#define perf_misc_flags(regs) (user_mode(regs) ? PERF_RECORD_MISC_USER : \
815 PERF_RECORD_MISC_KERNEL)
816#define perf_instruction_pointer(regs) instruction_pointer(regs)
817#endif
818
819extern int perf_output_begin(struct perf_output_handle *handle,
820 struct perf_event *event, unsigned int size,
821 int nmi, int sample);
822extern void perf_output_end(struct perf_output_handle *handle);
823extern void perf_output_copy(struct perf_output_handle *handle,
824 const void *buf, unsigned int len);
825#else
826static inline void
827perf_event_task_sched_in(struct task_struct *task, int cpu) { }
828static inline void
829perf_event_task_sched_out(struct task_struct *task,
830 struct task_struct *next, int cpu) { }
831static inline void
832perf_event_task_tick(struct task_struct *task, int cpu) { }
833static inline int perf_event_init_task(struct task_struct *child) { return 0; }
834static inline void perf_event_exit_task(struct task_struct *child) { }
835static inline void perf_event_free_task(struct task_struct *task) { }
836static inline void perf_event_do_pending(void) { }
837static inline void perf_event_print_debug(void) { }
838static inline void perf_disable(void) { }
839static inline void perf_enable(void) { }
840static inline int perf_event_task_disable(void) { return -EINVAL; }
841static inline int perf_event_task_enable(void) { return -EINVAL; }
842
843static inline void
844perf_sw_event(u32 event_id, u64 nr, int nmi,
845 struct pt_regs *regs, u64 addr) { }
846
847static inline void perf_event_mmap(struct vm_area_struct *vma) { }
848static inline void perf_event_comm(struct task_struct *tsk) { }
849static inline void perf_event_fork(struct task_struct *tsk) { }
850static inline void perf_event_init(void) { }
851
852#endif
853
854#define perf_output_put(handle, x) \
855 perf_output_copy((handle), &(x), sizeof(x))
856
857#endif /* __KERNEL__ */
858#endif /* _LINUX_PERF_EVENT_H */
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index b063c7328ba5..fddfafaed024 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -360,6 +360,7 @@ struct pnp_driver {
360 unsigned int flags; 360 unsigned int flags;
361 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); 361 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
362 void (*remove) (struct pnp_dev *dev); 362 void (*remove) (struct pnp_dev *dev);
363 void (*shutdown) (struct pnp_dev *dev);
363 int (*suspend) (struct pnp_dev *dev, pm_message_t state); 364 int (*suspend) (struct pnp_dev *dev, pm_message_t state);
364 int (*resume) (struct pnp_dev *dev); 365 int (*resume) (struct pnp_dev *dev);
365 struct device_driver driver; 366 struct device_driver driver;
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 6729f7dcd60e..7fc194aef8c2 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -65,6 +65,9 @@
65#define MUTEX_DEBUG_INIT 0x11 65#define MUTEX_DEBUG_INIT 0x11
66#define MUTEX_DEBUG_FREE 0x22 66#define MUTEX_DEBUG_FREE 0x22
67 67
68/********** lib/flex_array.c **********/
69#define FLEX_ARRAY_FREE 0x6c /* for use-after-free poisoning */
70
68/********** security/ **********/ 71/********** security/ **********/
69#define KEY_DESTROY 0xbd 72#define KEY_DESTROY 0xbd
70 73
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 594c494ac3f0..b5d096d3a9be 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -39,6 +39,13 @@ enum {
39}; 39};
40 40
41enum { 41enum {
42 POWER_SUPPLY_CHARGE_TYPE_UNKNOWN = 0,
43 POWER_SUPPLY_CHARGE_TYPE_NONE,
44 POWER_SUPPLY_CHARGE_TYPE_TRICKLE,
45 POWER_SUPPLY_CHARGE_TYPE_FAST,
46};
47
48enum {
42 POWER_SUPPLY_HEALTH_UNKNOWN = 0, 49 POWER_SUPPLY_HEALTH_UNKNOWN = 0,
43 POWER_SUPPLY_HEALTH_GOOD, 50 POWER_SUPPLY_HEALTH_GOOD,
44 POWER_SUPPLY_HEALTH_OVERHEAT, 51 POWER_SUPPLY_HEALTH_OVERHEAT,
@@ -58,9 +65,19 @@ enum {
58 POWER_SUPPLY_TECHNOLOGY_LiMn, 65 POWER_SUPPLY_TECHNOLOGY_LiMn,
59}; 66};
60 67
68enum {
69 POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN = 0,
70 POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL,
71 POWER_SUPPLY_CAPACITY_LEVEL_LOW,
72 POWER_SUPPLY_CAPACITY_LEVEL_NORMAL,
73 POWER_SUPPLY_CAPACITY_LEVEL_HIGH,
74 POWER_SUPPLY_CAPACITY_LEVEL_FULL,
75};
76
61enum power_supply_property { 77enum power_supply_property {
62 /* Properties of type `int' */ 78 /* Properties of type `int' */
63 POWER_SUPPLY_PROP_STATUS = 0, 79 POWER_SUPPLY_PROP_STATUS = 0,
80 POWER_SUPPLY_PROP_CHARGE_TYPE,
64 POWER_SUPPLY_PROP_HEALTH, 81 POWER_SUPPLY_PROP_HEALTH,
65 POWER_SUPPLY_PROP_PRESENT, 82 POWER_SUPPLY_PROP_PRESENT,
66 POWER_SUPPLY_PROP_ONLINE, 83 POWER_SUPPLY_PROP_ONLINE,
@@ -89,6 +106,7 @@ enum power_supply_property {
89 POWER_SUPPLY_PROP_ENERGY_NOW, 106 POWER_SUPPLY_PROP_ENERGY_NOW,
90 POWER_SUPPLY_PROP_ENERGY_AVG, 107 POWER_SUPPLY_PROP_ENERGY_AVG,
91 POWER_SUPPLY_PROP_CAPACITY, /* in percents! */ 108 POWER_SUPPLY_PROP_CAPACITY, /* in percents! */
109 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
92 POWER_SUPPLY_PROP_TEMP, 110 POWER_SUPPLY_PROP_TEMP,
93 POWER_SUPPLY_PROP_TEMP_AMBIENT, 111 POWER_SUPPLY_PROP_TEMP_AMBIENT,
94 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, 112 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
@@ -126,6 +144,7 @@ struct power_supply {
126 enum power_supply_property psp, 144 enum power_supply_property psp,
127 union power_supply_propval *val); 145 union power_supply_propval *val);
128 void (*external_power_changed)(struct power_supply *psy); 146 void (*external_power_changed)(struct power_supply *psy);
147 void (*set_charged)(struct power_supply *psy);
129 148
130 /* For APM emulation, think legacy userspace. */ 149 /* For APM emulation, think legacy userspace. */
131 int use_for_apm; 150 int use_for_apm;
@@ -165,8 +184,10 @@ struct power_supply_info {
165 int use_for_apm; 184 int use_for_apm;
166}; 185};
167 186
187extern struct power_supply *power_supply_get_by_name(char *name);
168extern void power_supply_changed(struct power_supply *psy); 188extern void power_supply_changed(struct power_supply *psy);
169extern int power_supply_am_i_supplied(struct power_supply *psy); 189extern int power_supply_am_i_supplied(struct power_supply *psy);
190extern int power_supply_set_battery_charged(struct power_supply *psy);
170 191
171#if defined(CONFIG_POWER_SUPPLY) || defined(CONFIG_POWER_SUPPLY_MODULE) 192#if defined(CONFIG_POWER_SUPPLY) || defined(CONFIG_POWER_SUPPLY_MODULE)
172extern int power_supply_is_system_supplied(void); 193extern int power_supply_is_system_supplied(void);
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index b00df4c79c63..931150566ade 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -85,7 +85,9 @@
85#define PR_SET_TIMERSLACK 29 85#define PR_SET_TIMERSLACK 29
86#define PR_GET_TIMERSLACK 30 86#define PR_GET_TIMERSLACK 30
87 87
88#define PR_TASK_PERF_COUNTERS_DISABLE 31 88#define PR_TASK_PERF_EVENTS_DISABLE 31
89#define PR_TASK_PERF_COUNTERS_ENABLE 32 89#define PR_TASK_PERF_EVENTS_ENABLE 32
90
91#define PR_MCE_KILL 33
90 92
91#endif /* _LINUX_PRCTL_H */ 93#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index e6e77d31c418..379eaed72d4b 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -78,10 +78,19 @@ struct proc_dir_entry {
78 struct list_head pde_openers; /* who did ->open, but not ->release */ 78 struct list_head pde_openers; /* who did ->open, but not ->release */
79}; 79};
80 80
81enum kcore_type {
82 KCORE_TEXT,
83 KCORE_VMALLOC,
84 KCORE_RAM,
85 KCORE_VMEMMAP,
86 KCORE_OTHER,
87};
88
81struct kcore_list { 89struct kcore_list {
82 struct kcore_list *next; 90 struct list_head list;
83 unsigned long addr; 91 unsigned long addr;
84 size_t size; 92 size_t size;
93 int type;
85}; 94};
86 95
87struct vmcore { 96struct vmcore {
@@ -233,11 +242,12 @@ static inline void dup_mm_exe_file(struct mm_struct *oldmm,
233#endif /* CONFIG_PROC_FS */ 242#endif /* CONFIG_PROC_FS */
234 243
235#if !defined(CONFIG_PROC_KCORE) 244#if !defined(CONFIG_PROC_KCORE)
236static inline void kclist_add(struct kcore_list *new, void *addr, size_t size) 245static inline void
246kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
237{ 247{
238} 248}
239#else 249#else
240extern void kclist_add(struct kcore_list *, void *, size_t); 250extern void kclist_add(struct kcore_list *, void *, size_t, int type);
241#endif 251#endif
242 252
243union proc_op { 253union proc_op {
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 26361c4c037a..3ebb23153640 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -135,8 +135,8 @@ static inline int sb_any_quota_active(struct super_block *sb)
135/* 135/*
136 * Operations supported for diskquotas. 136 * Operations supported for diskquotas.
137 */ 137 */
138extern struct dquot_operations dquot_operations; 138extern const struct dquot_operations dquot_operations;
139extern struct quotactl_ops vfs_quotactl_ops; 139extern const struct quotactl_ops vfs_quotactl_ops;
140 140
141#define sb_dquot_ops (&dquot_operations) 141#define sb_dquot_ops (&dquot_operations)
142#define sb_quotactl_ops (&vfs_quotactl_ops) 142#define sb_quotactl_ops (&vfs_quotactl_ops)
diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h
index f9ddd03961a8..589a40919f01 100644
--- a/include/linux/rculist_nulls.h
+++ b/include/linux/rculist_nulls.h
@@ -102,7 +102,7 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,
102 */ 102 */
103#define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \ 103#define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \
104 for (pos = rcu_dereference((head)->first); \ 104 for (pos = rcu_dereference((head)->first); \
105 (!is_a_nulls(pos)) && \ 105 (!is_a_nulls(pos)) && \
106 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \ 106 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \
107 pos = rcu_dereference(pos->next)) 107 pos = rcu_dereference(pos->next))
108 108
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 95e0615f4d75..6fe0363724e9 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Read-Copy Update mechanism for mutual exclusion 2 * Read-Copy Update mechanism for mutual exclusion
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
18 * Copyright IBM Corporation, 2001 18 * Copyright IBM Corporation, 2001
19 * 19 *
20 * Author: Dipankar Sarma <dipankar@in.ibm.com> 20 * Author: Dipankar Sarma <dipankar@in.ibm.com>
21 * 21 *
22 * Based on the original work by Paul McKenney <paulmck@us.ibm.com> 22 * Based on the original work by Paul McKenney <paulmck@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen. 23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers: 24 * Papers:
@@ -26,7 +26,7 @@
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001) 26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 * 27 *
28 * For detailed explanation of Read-Copy Update mechanism see - 28 * For detailed explanation of Read-Copy Update mechanism see -
29 * http://lse.sourceforge.net/locking/rcupdate.html 29 * http://lse.sourceforge.net/locking/rcupdate.html
30 * 30 *
31 */ 31 */
32 32
@@ -52,8 +52,13 @@ struct rcu_head {
52}; 52};
53 53
54/* Exported common interfaces */ 54/* Exported common interfaces */
55#ifdef CONFIG_TREE_PREEMPT_RCU
55extern void synchronize_rcu(void); 56extern void synchronize_rcu(void);
57#else /* #ifdef CONFIG_TREE_PREEMPT_RCU */
58#define synchronize_rcu synchronize_sched
59#endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */
56extern void synchronize_rcu_bh(void); 60extern void synchronize_rcu_bh(void);
61extern void synchronize_sched(void);
57extern void rcu_barrier(void); 62extern void rcu_barrier(void);
58extern void rcu_barrier_bh(void); 63extern void rcu_barrier_bh(void);
59extern void rcu_barrier_sched(void); 64extern void rcu_barrier_sched(void);
@@ -262,24 +267,6 @@ struct rcu_synchronize {
262extern void wakeme_after_rcu(struct rcu_head *head); 267extern void wakeme_after_rcu(struct rcu_head *head);
263 268
264/** 269/**
265 * synchronize_sched - block until all CPUs have exited any non-preemptive
266 * kernel code sequences.
267 *
268 * This means that all preempt_disable code sequences, including NMI and
269 * hardware-interrupt handlers, in progress on entry will have completed
270 * before this primitive returns. However, this does not guarantee that
271 * softirq handlers will have completed, since in some kernels, these
272 * handlers can run in process context, and can block.
273 *
274 * This primitive provides the guarantees made by the (now removed)
275 * synchronize_kernel() API. In contrast, synchronize_rcu() only
276 * guarantees that rcu_read_lock() sections will have completed.
277 * In "classic RCU", these two guarantees happen to be one and
278 * the same, but can differ in realtime RCU implementations.
279 */
280#define synchronize_sched() __synchronize_sched()
281
282/**
283 * call_rcu - Queue an RCU callback for invocation after a grace period. 270 * call_rcu - Queue an RCU callback for invocation after a grace period.
284 * @head: structure to be used for queueing the RCU updates. 271 * @head: structure to be used for queueing the RCU updates.
285 * @func: actual update function to be invoked after the grace period 272 * @func: actual update function to be invoked after the grace period
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index a89307717825..37682770e9d2 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -24,7 +24,7 @@
24 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen. 24 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
25 * 25 *
26 * For detailed explanation of Read-Copy Update mechanism see - 26 * For detailed explanation of Read-Copy Update mechanism see -
27 * Documentation/RCU 27 * Documentation/RCU
28 */ 28 */
29 29
30#ifndef __LINUX_RCUTREE_H 30#ifndef __LINUX_RCUTREE_H
@@ -53,6 +53,8 @@ static inline void __rcu_read_unlock(void)
53 preempt_enable(); 53 preempt_enable();
54} 54}
55 55
56#define __synchronize_sched() synchronize_rcu()
57
56static inline void exit_rcu(void) 58static inline void exit_rcu(void)
57{ 59{
58} 60}
@@ -68,8 +70,6 @@ static inline void __rcu_read_unlock_bh(void)
68 local_bh_enable(); 70 local_bh_enable();
69} 71}
70 72
71#define __synchronize_sched() synchronize_rcu()
72
73extern void call_rcu_sched(struct rcu_head *head, 73extern void call_rcu_sched(struct rcu_head *head,
74 void (*func)(struct rcu_head *rcu)); 74 void (*func)(struct rcu_head *rcu));
75 75
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 277f4b964df5..490c5b37b6d7 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -125,6 +125,8 @@ struct regulator_bulk_data {
125/* regulator get and put */ 125/* regulator get and put */
126struct regulator *__must_check regulator_get(struct device *dev, 126struct regulator *__must_check regulator_get(struct device *dev,
127 const char *id); 127 const char *id);
128struct regulator *__must_check regulator_get_exclusive(struct device *dev,
129 const char *id);
128void regulator_put(struct regulator *regulator); 130void regulator_put(struct regulator *regulator);
129 131
130/* regulator output control and status */ 132/* regulator output control and status */
@@ -144,6 +146,8 @@ void regulator_bulk_free(int num_consumers,
144 146
145int regulator_count_voltages(struct regulator *regulator); 147int regulator_count_voltages(struct regulator *regulator);
146int regulator_list_voltage(struct regulator *regulator, unsigned selector); 148int regulator_list_voltage(struct regulator *regulator, unsigned selector);
149int regulator_is_supported_voltage(struct regulator *regulator,
150 int min_uV, int max_uV);
147int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); 151int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
148int regulator_get_voltage(struct regulator *regulator); 152int regulator_get_voltage(struct regulator *regulator);
149int regulator_set_current_limit(struct regulator *regulator, 153int regulator_set_current_limit(struct regulator *regulator,
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 225f733e7533..31f2055eae28 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -37,7 +37,8 @@ enum regulator_status {
37 * 37 *
38 * @enable: Configure the regulator as enabled. 38 * @enable: Configure the regulator as enabled.
39 * @disable: Configure the regulator as disabled. 39 * @disable: Configure the regulator as disabled.
40 * @is_enabled: Return 1 if the regulator is enabled, 0 otherwise. 40 * @is_enabled: Return 1 if the regulator is enabled, 0 if not.
41 * May also return negative errno.
41 * 42 *
42 * @set_voltage: Set the voltage for the regulator within the range specified. 43 * @set_voltage: Set the voltage for the regulator within the range specified.
43 * The driver should select the voltage closest to min_uV. 44 * The driver should select the voltage closest to min_uV.
@@ -162,6 +163,8 @@ struct regulator_desc {
162struct regulator_dev { 163struct regulator_dev {
163 struct regulator_desc *desc; 164 struct regulator_desc *desc;
164 int use_count; 165 int use_count;
166 int open_count;
167 int exclusive;
165 168
166 /* lists we belong to */ 169 /* lists we belong to */
167 struct list_head list; /* list of all regulators */ 170 struct list_head list; /* list of all regulators */
@@ -193,6 +196,8 @@ void *rdev_get_drvdata(struct regulator_dev *rdev);
193struct device *rdev_get_dev(struct regulator_dev *rdev); 196struct device *rdev_get_dev(struct regulator_dev *rdev);
194int rdev_get_id(struct regulator_dev *rdev); 197int rdev_get_id(struct regulator_dev *rdev);
195 198
199int regulator_mode_to_status(unsigned int);
200
196void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); 201void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
197 202
198#endif 203#endif
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index 91b4da31f1b5..e94a4a1c7c8a 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -5,6 +5,9 @@
5 * 5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> 6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 * 7 *
8 * Copyright (c) 2009 Nokia Corporation
9 * Roger Quadros <ext-roger.quadros@nokia.com>
10 *
8 * This program is free software; you can redistribute it and/or 11 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as 12 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the 13 * published by the Free Software Foundation; either version 2 of the
@@ -16,9 +19,30 @@
16 19
17struct regulator_init_data; 20struct regulator_init_data;
18 21
22/**
23 * struct fixed_voltage_config - fixed_voltage_config structure
24 * @supply_name: Name of the regulator supply
25 * @microvolts: Output voltage of regulator
26 * @gpio: GPIO to use for enable control
27 * set to -EINVAL if not used
28 * @enable_high: Polarity of enable GPIO
29 * 1 = Active high, 0 = Active low
30 * @enabled_at_boot: Whether regulator has been enabled at
31 * boot or not. 1 = Yes, 0 = No
32 * This is used to keep the regulator at
33 * the default state
34 * @init_data: regulator_init_data
35 *
36 * This structure contains fixed voltage regulator configuration
37 * information that must be passed by platform code to the fixed
38 * voltage regulator driver.
39 */
19struct fixed_voltage_config { 40struct fixed_voltage_config {
20 const char *supply_name; 41 const char *supply_name;
21 int microvolts; 42 int microvolts;
43 int gpio;
44 unsigned enable_high:1;
45 unsigned enabled_at_boot:1;
22 struct regulator_init_data *init_data; 46 struct regulator_init_data *init_data;
23}; 47};
24 48
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index bac64fa390f2..87f5f176d4ef 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -41,7 +41,7 @@ struct regulator;
41#define REGULATOR_CHANGE_DRMS 0x10 41#define REGULATOR_CHANGE_DRMS 0x10
42 42
43/** 43/**
44 * struct regulator_state - regulator state during low power syatem states 44 * struct regulator_state - regulator state during low power system states
45 * 45 *
46 * This describes a regulators state during a system wide low power state. 46 * This describes a regulators state during a system wide low power state.
47 * 47 *
@@ -117,25 +117,37 @@ struct regulation_constraints {
117 /* mode to set on startup */ 117 /* mode to set on startup */
118 unsigned int initial_mode; 118 unsigned int initial_mode;
119 119
120 /* constriant flags */ 120 /* constraint flags */
121 unsigned always_on:1; /* regulator never off when system is on */ 121 unsigned always_on:1; /* regulator never off when system is on */
122 unsigned boot_on:1; /* bootloader/firmware enabled regulator */ 122 unsigned boot_on:1; /* bootloader/firmware enabled regulator */
123 unsigned apply_uV:1; /* apply uV constraint iff min == max */ 123 unsigned apply_uV:1; /* apply uV constraint if min == max */
124}; 124};
125 125
126/** 126/**
127 * struct regulator_consumer_supply - supply -> device mapping 127 * struct regulator_consumer_supply - supply -> device mapping
128 * 128 *
129 * This maps a supply name to a device. 129 * This maps a supply name to a device. Only one of dev or dev_name
130 * can be specified. Use of dev_name allows support for buses which
131 * make struct device available late such as I2C and is the preferred
132 * form.
130 * 133 *
131 * @dev: Device structure for the consumer. 134 * @dev: Device structure for the consumer.
135 * @dev_name: Result of dev_name() for the consumer.
132 * @supply: Name for the supply. 136 * @supply: Name for the supply.
133 */ 137 */
134struct regulator_consumer_supply { 138struct regulator_consumer_supply {
135 struct device *dev; /* consumer */ 139 struct device *dev; /* consumer */
140 const char *dev_name; /* dev_name() for consumer */
136 const char *supply; /* consumer supply - e.g. "vcc" */ 141 const char *supply; /* consumer supply - e.g. "vcc" */
137}; 142};
138 143
144/* Initialize struct regulator_consumer_supply */
145#define REGULATOR_SUPPLY(_name, _dev_name) \
146{ \
147 .supply = _name, \
148 .dev_name = _dev_name, \
149}
150
139/** 151/**
140 * struct regulator_init_data - regulator platform initialisation data. 152 * struct regulator_init_data - regulator platform initialisation data.
141 * 153 *
@@ -166,6 +178,12 @@ struct regulator_init_data {
166 178
167int regulator_suspend_prepare(suspend_state_t state); 179int regulator_suspend_prepare(suspend_state_t state);
168 180
181#ifdef CONFIG_REGULATOR
169void regulator_has_full_constraints(void); 182void regulator_has_full_constraints(void);
183#else
184static inline void regulator_has_full_constraints(void)
185{
186}
187#endif
170 188
171#endif 189#endif
diff --git a/include/linux/regulator/max1586.h b/include/linux/regulator/max1586.h
index 44563192bf16..de9a7fae20be 100644
--- a/include/linux/regulator/max1586.h
+++ b/include/linux/regulator/max1586.h
@@ -36,7 +36,7 @@
36 * max1586_subdev_data - regulator data 36 * max1586_subdev_data - regulator data
37 * @id: regulator Id (either MAX1586_V3 or MAX1586_V6) 37 * @id: regulator Id (either MAX1586_V3 or MAX1586_V6)
38 * @name: regulator cute name (example for V3: "vcc_core") 38 * @name: regulator cute name (example for V3: "vcc_core")
39 * @platform_data: regulator init data (contraints, supplies, ...) 39 * @platform_data: regulator init data (constraints, supplies, ...)
40 */ 40 */
41struct max1586_subdev_data { 41struct max1586_subdev_data {
42 int id; 42 int id;
@@ -46,7 +46,7 @@ struct max1586_subdev_data {
46 46
47/** 47/**
48 * max1586_platform_data - platform data for max1586 48 * max1586_platform_data - platform data for max1586
49 * @num_subdevs: number of regultors used (may be 1 or 2) 49 * @num_subdevs: number of regulators used (may be 1 or 2)
50 * @subdevs: regulator used 50 * @subdevs: regulator used
51 * At most, there will be a regulator for V3 and one for V6 voltages. 51 * At most, there will be a regulator for V3 and one for V6 voltages.
52 * @v3_gain: gain on the V3 voltage output multiplied by 1e6. 52 * @v3_gain: gain on the V3 voltage output multiplied by 1e6.
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 953fc055e875..14a86bc7102b 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -140,7 +140,7 @@ struct rchan_callbacks
140 * cause relay_open() to create a single global buffer rather 140 * cause relay_open() to create a single global buffer rather
141 * than the default set of per-cpu buffers. 141 * than the default set of per-cpu buffers.
142 * 142 *
143 * See Documentation/filesystems/relayfs.txt for more info. 143 * See Documentation/filesystems/relay.txt for more info.
144 */ 144 */
145 struct dentry *(*create_buf_file)(const char *filename, 145 struct dentry *(*create_buf_file)(const char *filename,
146 struct dentry *parent, 146 struct dentry *parent,
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 511f42fc6816..731af71cddc9 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -35,6 +35,10 @@ struct res_counter {
35 */ 35 */
36 unsigned long long limit; 36 unsigned long long limit;
37 /* 37 /*
38 * the limit that usage can be exceed
39 */
40 unsigned long long soft_limit;
41 /*
38 * the number of unsuccessful attempts to consume the resource 42 * the number of unsuccessful attempts to consume the resource
39 */ 43 */
40 unsigned long long failcnt; 44 unsigned long long failcnt;
@@ -87,6 +91,7 @@ enum {
87 RES_MAX_USAGE, 91 RES_MAX_USAGE,
88 RES_LIMIT, 92 RES_LIMIT,
89 RES_FAILCNT, 93 RES_FAILCNT,
94 RES_SOFT_LIMIT,
90}; 95};
91 96
92/* 97/*
@@ -109,7 +114,8 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent);
109int __must_check res_counter_charge_locked(struct res_counter *counter, 114int __must_check res_counter_charge_locked(struct res_counter *counter,
110 unsigned long val); 115 unsigned long val);
111int __must_check res_counter_charge(struct res_counter *counter, 116int __must_check res_counter_charge(struct res_counter *counter,
112 unsigned long val, struct res_counter **limit_fail_at); 117 unsigned long val, struct res_counter **limit_fail_at,
118 struct res_counter **soft_limit_at);
113 119
114/* 120/*
115 * uncharge - tell that some portion of the resource is released 121 * uncharge - tell that some portion of the resource is released
@@ -122,7 +128,8 @@ int __must_check res_counter_charge(struct res_counter *counter,
122 */ 128 */
123 129
124void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val); 130void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val);
125void res_counter_uncharge(struct res_counter *counter, unsigned long val); 131void res_counter_uncharge(struct res_counter *counter, unsigned long val,
132 bool *was_soft_limit_excess);
126 133
127static inline bool res_counter_limit_check_locked(struct res_counter *cnt) 134static inline bool res_counter_limit_check_locked(struct res_counter *cnt)
128{ 135{
@@ -132,6 +139,36 @@ static inline bool res_counter_limit_check_locked(struct res_counter *cnt)
132 return false; 139 return false;
133} 140}
134 141
142static inline bool res_counter_soft_limit_check_locked(struct res_counter *cnt)
143{
144 if (cnt->usage < cnt->soft_limit)
145 return true;
146
147 return false;
148}
149
150/**
151 * Get the difference between the usage and the soft limit
152 * @cnt: The counter
153 *
154 * Returns 0 if usage is less than or equal to soft limit
155 * The difference between usage and soft limit, otherwise.
156 */
157static inline unsigned long long
158res_counter_soft_limit_excess(struct res_counter *cnt)
159{
160 unsigned long long excess;
161 unsigned long flags;
162
163 spin_lock_irqsave(&cnt->lock, flags);
164 if (cnt->usage <= cnt->soft_limit)
165 excess = 0;
166 else
167 excess = cnt->usage - cnt->soft_limit;
168 spin_unlock_irqrestore(&cnt->lock, flags);
169 return excess;
170}
171
135/* 172/*
136 * Helper function to detect if the cgroup is within it's limit or 173 * Helper function to detect if the cgroup is within it's limit or
137 * not. It's currently called from cgroup_rss_prepare() 174 * not. It's currently called from cgroup_rss_prepare()
@@ -147,6 +184,17 @@ static inline bool res_counter_check_under_limit(struct res_counter *cnt)
147 return ret; 184 return ret;
148} 185}
149 186
187static inline bool res_counter_check_under_soft_limit(struct res_counter *cnt)
188{
189 bool ret;
190 unsigned long flags;
191
192 spin_lock_irqsave(&cnt->lock, flags);
193 ret = res_counter_soft_limit_check_locked(cnt);
194 spin_unlock_irqrestore(&cnt->lock, flags);
195 return ret;
196}
197
150static inline void res_counter_reset_max(struct res_counter *cnt) 198static inline void res_counter_reset_max(struct res_counter *cnt)
151{ 199{
152 unsigned long flags; 200 unsigned long flags;
@@ -180,4 +228,16 @@ static inline int res_counter_set_limit(struct res_counter *cnt,
180 return ret; 228 return ret;
181} 229}
182 230
231static inline int
232res_counter_set_soft_limit(struct res_counter *cnt,
233 unsigned long long soft_limit)
234{
235 unsigned long flags;
236
237 spin_lock_irqsave(&cnt->lock, flags);
238 cnt->soft_limit = soft_limit;
239 spin_unlock_irqrestore(&cnt->lock, flags);
240 return 0;
241}
242
183#endif 243#endif
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index bf116d0dbf23..cb0ba7032609 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -71,21 +71,29 @@ void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned lon
71void page_add_file_rmap(struct page *); 71void page_add_file_rmap(struct page *);
72void page_remove_rmap(struct page *); 72void page_remove_rmap(struct page *);
73 73
74#ifdef CONFIG_DEBUG_VM 74static inline void page_dup_rmap(struct page *page)
75void page_dup_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address);
76#else
77static inline void page_dup_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address)
78{ 75{
79 atomic_inc(&page->_mapcount); 76 atomic_inc(&page->_mapcount);
80} 77}
81#endif
82 78
83/* 79/*
84 * Called from mm/vmscan.c to handle paging out 80 * Called from mm/vmscan.c to handle paging out
85 */ 81 */
86int page_referenced(struct page *, int is_locked, 82int page_referenced(struct page *, int is_locked,
87 struct mem_cgroup *cnt, unsigned long *vm_flags); 83 struct mem_cgroup *cnt, unsigned long *vm_flags);
88int try_to_unmap(struct page *, int ignore_refs); 84enum ttu_flags {
85 TTU_UNMAP = 0, /* unmap mode */
86 TTU_MIGRATION = 1, /* migration mode */
87 TTU_MUNLOCK = 2, /* munlock mode */
88 TTU_ACTION_MASK = 0xff,
89
90 TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */
91 TTU_IGNORE_ACCESS = (1 << 9), /* don't age */
92 TTU_IGNORE_HWPOISON = (1 << 10),/* corrupted page is recoverable */
93};
94#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK)
95
96int try_to_unmap(struct page *, enum ttu_flags flags);
89 97
90/* 98/*
91 * Called from mm/filemap_xip.c to unmap empty zero page 99 * Called from mm/filemap_xip.c to unmap empty zero page
@@ -112,6 +120,13 @@ int page_mkclean(struct page *);
112 */ 120 */
113int try_to_munlock(struct page *); 121int try_to_munlock(struct page *);
114 122
123/*
124 * Called by memory-failure.c to kill processes.
125 */
126struct anon_vma *page_lock_anon_vma(struct page *page);
127void page_unlock_anon_vma(struct anon_vma *anon_vma);
128int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma);
129
115#else /* !CONFIG_MMU */ 130#else /* !CONFIG_MMU */
116 131
117#define anon_vma_init() do {} while (0) 132#define anon_vma_init() do {} while (0)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 8af3d249170e..75e6e60bf583 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -100,7 +100,7 @@ struct robust_list_head;
100struct bio; 100struct bio;
101struct fs_struct; 101struct fs_struct;
102struct bts_context; 102struct bts_context;
103struct perf_counter_context; 103struct perf_event_context;
104 104
105/* 105/*
106 * List of flags we want to share for kernel threads, 106 * List of flags we want to share for kernel threads,
@@ -140,6 +140,10 @@ extern int nr_processes(void);
140extern unsigned long nr_running(void); 140extern unsigned long nr_running(void);
141extern unsigned long nr_uninterruptible(void); 141extern unsigned long nr_uninterruptible(void);
142extern unsigned long nr_iowait(void); 142extern unsigned long nr_iowait(void);
143extern unsigned long nr_iowait_cpu(void);
144extern unsigned long this_cpu_load(void);
145
146
143extern void calc_global_load(void); 147extern void calc_global_load(void);
144extern u64 cpu_nr_migrations(int cpu); 148extern u64 cpu_nr_migrations(int cpu);
145 149
@@ -257,7 +261,7 @@ extern asmlinkage void schedule_tail(struct task_struct *prev);
257extern void init_idle(struct task_struct *idle, int cpu); 261extern void init_idle(struct task_struct *idle, int cpu);
258extern void init_idle_bootup_task(struct task_struct *idle); 262extern void init_idle_bootup_task(struct task_struct *idle);
259 263
260extern int runqueue_is_locked(void); 264extern int runqueue_is_locked(int cpu);
261extern void task_rq_unlock_wait(struct task_struct *p); 265extern void task_rq_unlock_wait(struct task_struct *p);
262 266
263extern cpumask_var_t nohz_cpu_mask; 267extern cpumask_var_t nohz_cpu_mask;
@@ -305,7 +309,7 @@ extern void softlockup_tick(void);
305extern void touch_softlockup_watchdog(void); 309extern void touch_softlockup_watchdog(void);
306extern void touch_all_softlockup_watchdogs(void); 310extern void touch_all_softlockup_watchdogs(void);
307extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, 311extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
308 struct file *filp, void __user *buffer, 312 void __user *buffer,
309 size_t *lenp, loff_t *ppos); 313 size_t *lenp, loff_t *ppos);
310extern unsigned int softlockup_panic; 314extern unsigned int softlockup_panic;
311extern int softlockup_thresh; 315extern int softlockup_thresh;
@@ -327,7 +331,7 @@ extern unsigned long sysctl_hung_task_check_count;
327extern unsigned long sysctl_hung_task_timeout_secs; 331extern unsigned long sysctl_hung_task_timeout_secs;
328extern unsigned long sysctl_hung_task_warnings; 332extern unsigned long sysctl_hung_task_warnings;
329extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write, 333extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
330 struct file *filp, void __user *buffer, 334 void __user *buffer,
331 size_t *lenp, loff_t *ppos); 335 size_t *lenp, loff_t *ppos);
332#endif 336#endif
333 337
@@ -422,6 +426,15 @@ static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)
422 return max(mm->hiwater_rss, get_mm_rss(mm)); 426 return max(mm->hiwater_rss, get_mm_rss(mm));
423} 427}
424 428
429static inline void setmax_mm_hiwater_rss(unsigned long *maxrss,
430 struct mm_struct *mm)
431{
432 unsigned long hiwater_rss = get_mm_hiwater_rss(mm);
433
434 if (*maxrss < hiwater_rss)
435 *maxrss = hiwater_rss;
436}
437
425static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm) 438static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm)
426{ 439{
427 return max(mm->hiwater_vm, mm->total_vm); 440 return max(mm->hiwater_vm, mm->total_vm);
@@ -434,7 +447,9 @@ extern int get_dumpable(struct mm_struct *mm);
434/* dumpable bits */ 447/* dumpable bits */
435#define MMF_DUMPABLE 0 /* core dump is permitted */ 448#define MMF_DUMPABLE 0 /* core dump is permitted */
436#define MMF_DUMP_SECURELY 1 /* core file is readable only by root */ 449#define MMF_DUMP_SECURELY 1 /* core file is readable only by root */
450
437#define MMF_DUMPABLE_BITS 2 451#define MMF_DUMPABLE_BITS 2
452#define MMF_DUMPABLE_MASK ((1 << MMF_DUMPABLE_BITS) - 1)
438 453
439/* coredump filter bits */ 454/* coredump filter bits */
440#define MMF_DUMP_ANON_PRIVATE 2 455#define MMF_DUMP_ANON_PRIVATE 2
@@ -444,6 +459,7 @@ extern int get_dumpable(struct mm_struct *mm);
444#define MMF_DUMP_ELF_HEADERS 6 459#define MMF_DUMP_ELF_HEADERS 6
445#define MMF_DUMP_HUGETLB_PRIVATE 7 460#define MMF_DUMP_HUGETLB_PRIVATE 7
446#define MMF_DUMP_HUGETLB_SHARED 8 461#define MMF_DUMP_HUGETLB_SHARED 8
462
447#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS 463#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS
448#define MMF_DUMP_FILTER_BITS 7 464#define MMF_DUMP_FILTER_BITS 7
449#define MMF_DUMP_FILTER_MASK \ 465#define MMF_DUMP_FILTER_MASK \
@@ -457,6 +473,10 @@ extern int get_dumpable(struct mm_struct *mm);
457#else 473#else
458# define MMF_DUMP_MASK_DEFAULT_ELF 0 474# define MMF_DUMP_MASK_DEFAULT_ELF 0
459#endif 475#endif
476 /* leave room for more dump flags */
477#define MMF_VM_MERGEABLE 16 /* KSM may merge identical pages */
478
479#define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK)
460 480
461struct sighand_struct { 481struct sighand_struct {
462 atomic_t count; 482 atomic_t count;
@@ -473,6 +493,13 @@ struct pacct_struct {
473 unsigned long ac_minflt, ac_majflt; 493 unsigned long ac_minflt, ac_majflt;
474}; 494};
475 495
496struct cpu_itimer {
497 cputime_t expires;
498 cputime_t incr;
499 u32 error;
500 u32 incr_error;
501};
502
476/** 503/**
477 * struct task_cputime - collected CPU time counts 504 * struct task_cputime - collected CPU time counts
478 * @utime: time spent in user mode, in &cputime_t units 505 * @utime: time spent in user mode, in &cputime_t units
@@ -567,9 +594,12 @@ struct signal_struct {
567 struct pid *leader_pid; 594 struct pid *leader_pid;
568 ktime_t it_real_incr; 595 ktime_t it_real_incr;
569 596
570 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ 597 /*
571 cputime_t it_prof_expires, it_virt_expires; 598 * ITIMER_PROF and ITIMER_VIRTUAL timers for the process, we use
572 cputime_t it_prof_incr, it_virt_incr; 599 * CPUCLOCK_PROF and CPUCLOCK_VIRT for indexing array as these
600 * values are defined to 0 and 1 respectively
601 */
602 struct cpu_itimer it[2];
573 603
574 /* 604 /*
575 * Thread group totals for process CPU timers. 605 * Thread group totals for process CPU timers.
@@ -601,6 +631,7 @@ struct signal_struct {
601 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; 631 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
602 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; 632 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
603 unsigned long inblock, oublock, cinblock, coublock; 633 unsigned long inblock, oublock, cinblock, coublock;
634 unsigned long maxrss, cmaxrss;
604 struct task_io_accounting ioac; 635 struct task_io_accounting ioac;
605 636
606 /* 637 /*
@@ -632,6 +663,8 @@ struct signal_struct {
632 unsigned audit_tty; 663 unsigned audit_tty;
633 struct tty_audit_buf *tty_audit_buf; 664 struct tty_audit_buf *tty_audit_buf;
634#endif 665#endif
666
667 int oom_adj; /* OOM kill score adjustment (bit shift) */
635}; 668};
636 669
637/* Context switch must be unlocked if interrupts are to be enabled */ 670/* Context switch must be unlocked if interrupts are to be enabled */
@@ -701,7 +734,7 @@ struct user_struct {
701#endif 734#endif
702#endif 735#endif
703 736
704#ifdef CONFIG_PERF_COUNTERS 737#ifdef CONFIG_PERF_EVENTS
705 atomic_long_t locked_vm; 738 atomic_long_t locked_vm;
706#endif 739#endif
707}; 740};
@@ -1075,6 +1108,8 @@ struct sched_class {
1075 void (*prio_changed) (struct rq *this_rq, struct task_struct *task, 1108 void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
1076 int oldprio, int running); 1109 int oldprio, int running);
1077 1110
1111 unsigned int (*get_rr_interval) (struct task_struct *task);
1112
1078#ifdef CONFIG_FAIR_GROUP_SCHED 1113#ifdef CONFIG_FAIR_GROUP_SCHED
1079 void (*moved_group) (struct task_struct *p); 1114 void (*moved_group) (struct task_struct *p);
1080#endif 1115#endif
@@ -1212,7 +1247,6 @@ struct task_struct {
1212 * a short time 1247 * a short time
1213 */ 1248 */
1214 unsigned char fpu_counter; 1249 unsigned char fpu_counter;
1215 s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
1216#ifdef CONFIG_BLK_DEV_IO_TRACE 1250#ifdef CONFIG_BLK_DEV_IO_TRACE
1217 unsigned int btrace_seq; 1251 unsigned int btrace_seq;
1218#endif 1252#endif
@@ -1237,7 +1271,6 @@ struct task_struct {
1237 struct mm_struct *mm, *active_mm; 1271 struct mm_struct *mm, *active_mm;
1238 1272
1239/* task state */ 1273/* task state */
1240 struct linux_binfmt *binfmt;
1241 int exit_state; 1274 int exit_state;
1242 int exit_code, exit_signal; 1275 int exit_code, exit_signal;
1243 int pdeath_signal; /* The signal sent when the parent dies */ 1276 int pdeath_signal; /* The signal sent when the parent dies */
@@ -1449,10 +1482,10 @@ struct task_struct {
1449 struct list_head pi_state_list; 1482 struct list_head pi_state_list;
1450 struct futex_pi_state *pi_state_cache; 1483 struct futex_pi_state *pi_state_cache;
1451#endif 1484#endif
1452#ifdef CONFIG_PERF_COUNTERS 1485#ifdef CONFIG_PERF_EVENTS
1453 struct perf_counter_context *perf_counter_ctxp; 1486 struct perf_event_context *perf_event_ctxp;
1454 struct mutex perf_counter_mutex; 1487 struct mutex perf_event_mutex;
1455 struct list_head perf_counter_list; 1488 struct list_head perf_event_list;
1456#endif 1489#endif
1457#ifdef CONFIG_NUMA 1490#ifdef CONFIG_NUMA
1458 struct mempolicy *mempolicy; /* Protected by alloc_lock */ 1491 struct mempolicy *mempolicy; /* Protected by alloc_lock */
@@ -1505,6 +1538,7 @@ struct task_struct {
1505 /* bitmask of trace recursion */ 1538 /* bitmask of trace recursion */
1506 unsigned long trace_recursion; 1539 unsigned long trace_recursion;
1507#endif /* CONFIG_TRACING */ 1540#endif /* CONFIG_TRACING */
1541 unsigned long stack_start;
1508}; 1542};
1509 1543
1510/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1544/* Future-safe accessor for struct task_struct's cpus_allowed. */
@@ -1700,6 +1734,7 @@ extern cputime_t task_gtime(struct task_struct *p);
1700#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ 1734#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */
1701#define PF_VCPU 0x00000010 /* I'm a virtual CPU */ 1735#define PF_VCPU 0x00000010 /* I'm a virtual CPU */
1702#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ 1736#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */
1737#define PF_MCE_PROCESS 0x00000080 /* process policy on mce errors */
1703#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ 1738#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */
1704#define PF_DUMPCORE 0x00000200 /* dumped core */ 1739#define PF_DUMPCORE 0x00000200 /* dumped core */
1705#define PF_SIGNALED 0x00000400 /* killed by a signal */ 1740#define PF_SIGNALED 0x00000400 /* killed by a signal */
@@ -1711,7 +1746,7 @@ extern cputime_t task_gtime(struct task_struct *p);
1711#define PF_FROZEN 0x00010000 /* frozen for system suspend */ 1746#define PF_FROZEN 0x00010000 /* frozen for system suspend */
1712#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ 1747#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
1713#define PF_KSWAPD 0x00040000 /* I am kswapd */ 1748#define PF_KSWAPD 0x00040000 /* I am kswapd */
1714#define PF_SWAPOFF 0x00080000 /* I am in swapoff */ 1749#define PF_OOM_ORIGIN 0x00080000 /* Allocating much memory to others */
1715#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ 1750#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */
1716#define PF_KTHREAD 0x00200000 /* I am a kernel thread */ 1751#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
1717#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ 1752#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */
@@ -1719,6 +1754,7 @@ extern cputime_t task_gtime(struct task_struct *p);
1719#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ 1754#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
1720#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1755#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1721#define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */ 1756#define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */
1757#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
1722#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1758#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1723#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1759#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1724#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ 1760#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */
@@ -1753,7 +1789,6 @@ extern cputime_t task_gtime(struct task_struct *p);
1753 1789
1754#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */ 1790#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */
1755#define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */ 1791#define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */
1756#define RCU_READ_UNLOCK_GOT_QS (1 << 2) /* CPU has responded to RCU core. */
1757 1792
1758static inline void rcu_copy_process(struct task_struct *p) 1793static inline void rcu_copy_process(struct task_struct *p)
1759{ 1794{
@@ -1783,10 +1818,13 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p,
1783 return 0; 1818 return 0;
1784} 1819}
1785#endif 1820#endif
1821
1822#ifndef CONFIG_CPUMASK_OFFSTACK
1786static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) 1823static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1787{ 1824{
1788 return set_cpus_allowed_ptr(p, &new_mask); 1825 return set_cpus_allowed_ptr(p, &new_mask);
1789} 1826}
1827#endif
1790 1828
1791/* 1829/*
1792 * Architectures can set this to 1 if they have specified 1830 * Architectures can set this to 1 if they have specified
@@ -1869,7 +1907,7 @@ extern unsigned int sysctl_sched_time_avg;
1869extern unsigned int sysctl_timer_migration; 1907extern unsigned int sysctl_timer_migration;
1870 1908
1871int sched_nr_latency_handler(struct ctl_table *table, int write, 1909int sched_nr_latency_handler(struct ctl_table *table, int write,
1872 struct file *file, void __user *buffer, size_t *length, 1910 void __user *buffer, size_t *length,
1873 loff_t *ppos); 1911 loff_t *ppos);
1874#endif 1912#endif
1875#ifdef CONFIG_SCHED_DEBUG 1913#ifdef CONFIG_SCHED_DEBUG
@@ -1887,7 +1925,7 @@ extern unsigned int sysctl_sched_rt_period;
1887extern int sysctl_sched_rt_runtime; 1925extern int sysctl_sched_rt_runtime;
1888 1926
1889int sched_rt_handler(struct ctl_table *table, int write, 1927int sched_rt_handler(struct ctl_table *table, int write,
1890 struct file *filp, void __user *buffer, size_t *lenp, 1928 void __user *buffer, size_t *lenp,
1891 loff_t *ppos); 1929 loff_t *ppos);
1892 1930
1893extern unsigned int sysctl_sched_compat_yield; 1931extern unsigned int sysctl_sched_compat_yield;
@@ -2022,6 +2060,7 @@ extern int kill_pgrp(struct pid *pid, int sig, int priv);
2022extern int kill_pid(struct pid *pid, int sig, int priv); 2060extern int kill_pid(struct pid *pid, int sig, int priv);
2023extern int kill_proc_info(int, struct siginfo *, pid_t); 2061extern int kill_proc_info(int, struct siginfo *, pid_t);
2024extern int do_notify_parent(struct task_struct *, int); 2062extern int do_notify_parent(struct task_struct *, int);
2063extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
2025extern void force_sig(int, struct task_struct *); 2064extern void force_sig(int, struct task_struct *);
2026extern void force_sig_specific(int, struct task_struct *); 2065extern void force_sig_specific(int, struct task_struct *);
2027extern int send_sig(int, struct task_struct *, int); 2066extern int send_sig(int, struct task_struct *, int);
@@ -2299,7 +2338,10 @@ static inline int signal_pending(struct task_struct *p)
2299 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING)); 2338 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
2300} 2339}
2301 2340
2302extern int __fatal_signal_pending(struct task_struct *p); 2341static inline int __fatal_signal_pending(struct task_struct *p)
2342{
2343 return unlikely(sigismember(&p->pending.signal, SIGKILL));
2344}
2303 2345
2304static inline int fatal_signal_pending(struct task_struct *p) 2346static inline int fatal_signal_pending(struct task_struct *p)
2305{ 2347{
diff --git a/include/linux/security.h b/include/linux/security.h
index d050b66ab9ef..239e40d0450b 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -133,7 +133,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint)
133 return PAGE_ALIGN(mmap_min_addr); 133 return PAGE_ALIGN(mmap_min_addr);
134 return hint; 134 return hint;
135} 135}
136extern int mmap_min_addr_handler(struct ctl_table *table, int write, struct file *filp, 136extern int mmap_min_addr_handler(struct ctl_table *table, int write,
137 void __user *buffer, size_t *lenp, loff_t *ppos); 137 void __user *buffer, size_t *lenp, loff_t *ppos);
138 138
139#ifdef CONFIG_SECURITY 139#ifdef CONFIG_SECURITY
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 0c6a86b79596..8366d8f12e53 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -35,6 +35,44 @@ struct seq_operations {
35 35
36#define SEQ_SKIP 1 36#define SEQ_SKIP 1
37 37
38/**
39 * seq_get_buf - get buffer to write arbitrary data to
40 * @m: the seq_file handle
41 * @bufp: the beginning of the buffer is stored here
42 *
43 * Return the number of bytes available in the buffer, or zero if
44 * there's no space.
45 */
46static inline size_t seq_get_buf(struct seq_file *m, char **bufp)
47{
48 BUG_ON(m->count > m->size);
49 if (m->count < m->size)
50 *bufp = m->buf + m->count;
51 else
52 *bufp = NULL;
53
54 return m->size - m->count;
55}
56
57/**
58 * seq_commit - commit data to the buffer
59 * @m: the seq_file handle
60 * @num: the number of bytes to commit
61 *
62 * Commit @num bytes of data written to a buffer previously acquired
63 * by seq_buf_get. To signal an error condition, or that the data
64 * didn't fit in the available space, pass a negative @num value.
65 */
66static inline void seq_commit(struct seq_file *m, int num)
67{
68 if (num < 0) {
69 m->count = m->size;
70 } else {
71 BUG_ON(m->count + num > m->size);
72 m->count += num;
73 }
74}
75
38char *mangle_path(char *s, char *p, char *esc); 76char *mangle_path(char *s, char *p, char *esc);
39int seq_open(struct file *, const struct seq_operations *); 77int seq_open(struct file *, const struct seq_operations *);
40ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); 78ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
diff --git a/include/linux/serial.h b/include/linux/serial.h
index e5bb75a63802..c8613c3ff9d3 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -122,6 +122,7 @@ struct serial_uart_config {
122 122
123/* Internal flags used only by kernel */ 123/* Internal flags used only by kernel */
124#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */ 124#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */
125#define ASYNCB_SUSPENDED 30 /* Serial port is suspended */
125#define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */ 126#define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */
126#define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */ 127#define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */
127#define ASYNCB_CLOSING 27 /* Serial port is closing */ 128#define ASYNCB_CLOSING 27 /* Serial port is closing */
@@ -133,6 +134,7 @@ struct serial_uart_config {
133#define ASYNCB_FIRST_KERNEL 22 134#define ASYNCB_FIRST_KERNEL 22
134 135
135#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY) 136#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY)
137#define ASYNC_SUSPENDED (1U << ASYNCB_SUSPENDED)
136#define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT) 138#define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT)
137#define ASYNC_SAK (1U << ASYNCB_SAK) 139#define ASYNC_SAK (1U << ASYNCB_SAK)
138#define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS) 140#define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS)
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index d4d2a78ad43e..fb46aba11fb5 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -22,6 +22,7 @@ struct plat_serial8250_port {
22 void __iomem *membase; /* ioremap cookie or NULL */ 22 void __iomem *membase; /* ioremap cookie or NULL */
23 resource_size_t mapbase; /* resource base */ 23 resource_size_t mapbase; /* resource base */
24 unsigned int irq; /* interrupt number */ 24 unsigned int irq; /* interrupt number */
25 unsigned long irqflags; /* request_irq flags */
25 unsigned int uartclk; /* UART clock rate */ 26 unsigned int uartclk; /* UART clock rate */
26 void *private_data; 27 void *private_data;
27 unsigned char regshift; /* register shift */ 28 unsigned char regshift; /* register shift */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 23d2fb051f97..fe661afe0713 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -20,6 +20,8 @@
20#ifndef LINUX_SERIAL_CORE_H 20#ifndef LINUX_SERIAL_CORE_H
21#define LINUX_SERIAL_CORE_H 21#define LINUX_SERIAL_CORE_H
22 22
23#include <linux/serial.h>
24
23/* 25/*
24 * The type definitions. These are from Ted Ts'o's serial.h 26 * The type definitions. These are from Ted Ts'o's serial.h
25 */ 27 */
@@ -186,7 +188,6 @@
186#include <linux/sysrq.h> 188#include <linux/sysrq.h>
187 189
188struct uart_port; 190struct uart_port;
189struct uart_info;
190struct serial_struct; 191struct serial_struct;
191struct device; 192struct device;
192 193
@@ -265,6 +266,7 @@ struct uart_port {
265 unsigned int (*serial_in)(struct uart_port *, int); 266 unsigned int (*serial_in)(struct uart_port *, int);
266 void (*serial_out)(struct uart_port *, int, int); 267 void (*serial_out)(struct uart_port *, int, int);
267 unsigned int irq; /* irq number */ 268 unsigned int irq; /* irq number */
269 unsigned long irqflags; /* irq flags */
268 unsigned int uartclk; /* base uart clock */ 270 unsigned int uartclk; /* base uart clock */
269 unsigned int fifosize; /* tx fifo size */ 271 unsigned int fifosize; /* tx fifo size */
270 unsigned char x_char; /* xon/xoff char */ 272 unsigned char x_char; /* xon/xoff char */
@@ -283,7 +285,7 @@ struct uart_port {
283 285
284 unsigned int read_status_mask; /* driver specific */ 286 unsigned int read_status_mask; /* driver specific */
285 unsigned int ignore_status_mask; /* driver specific */ 287 unsigned int ignore_status_mask; /* driver specific */
286 struct uart_info *info; /* pointer to parent info */ 288 struct uart_state *state; /* pointer to parent state */
287 struct uart_icount icount; /* statistics */ 289 struct uart_icount icount; /* statistics */
288 290
289 struct console *cons; /* struct console, if any */ 291 struct console *cons; /* struct console, if any */
@@ -335,52 +337,16 @@ struct uart_port {
335}; 337};
336 338
337/* 339/*
338 * This is the state information which is only valid when the port
339 * is open; it may be cleared the core driver once the device has
340 * been closed. Either the low level driver or the core can modify
341 * stuff here.
342 */
343typedef unsigned int __bitwise__ uif_t;
344
345struct uart_info {
346 struct tty_port port;
347 struct circ_buf xmit;
348 uif_t flags;
349
350/*
351 * Definitions for info->flags. These are _private_ to serial_core, and
352 * are specific to this structure. They may be queried by low level drivers.
353 *
354 * FIXME: use the ASY_ definitions
355 */
356#define UIF_CHECK_CD ((__force uif_t) (1 << 25))
357#define UIF_CTS_FLOW ((__force uif_t) (1 << 26))
358#define UIF_NORMAL_ACTIVE ((__force uif_t) (1 << 29))
359#define UIF_INITIALIZED ((__force uif_t) (1 << 31))
360#define UIF_SUSPENDED ((__force uif_t) (1 << 30))
361
362 struct tasklet_struct tlet;
363 wait_queue_head_t delta_msr_wait;
364};
365
366/*
367 * This is the state information which is persistent across opens. 340 * This is the state information which is persistent across opens.
368 * The low level driver must not to touch any elements contained
369 * within.
370 */ 341 */
371struct uart_state { 342struct uart_state {
372 unsigned int close_delay; /* msec */ 343 struct tty_port port;
373 unsigned int closing_wait; /* msec */
374
375#define USF_CLOSING_WAIT_INF (0)
376#define USF_CLOSING_WAIT_NONE (~0U)
377 344
378 int count;
379 int pm_state; 345 int pm_state;
380 struct uart_info info; 346 struct circ_buf xmit;
381 struct uart_port *port;
382 347
383 struct mutex mutex; 348 struct tasklet_struct tlet;
349 struct uart_port *uart_port;
384}; 350};
385 351
386#define UART_XMIT_SIZE PAGE_SIZE 352#define UART_XMIT_SIZE PAGE_SIZE
@@ -461,7 +427,7 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
461 427
462static inline int uart_tx_stopped(struct uart_port *port) 428static inline int uart_tx_stopped(struct uart_port *port)
463{ 429{
464 struct tty_struct *tty = port->info->port.tty; 430 struct tty_struct *tty = port->state->port.tty;
465 if(tty->stopped || tty->hw_stopped) 431 if(tty->stopped || tty->hw_stopped)
466 return 1; 432 return 1;
467 return 0; 433 return 0;
@@ -476,7 +442,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
476#ifdef SUPPORT_SYSRQ 442#ifdef SUPPORT_SYSRQ
477 if (port->sysrq) { 443 if (port->sysrq) {
478 if (ch && time_before(jiffies, port->sysrq)) { 444 if (ch && time_before(jiffies, port->sysrq)) {
479 handle_sysrq(ch, port->info->port.tty); 445 handle_sysrq(ch, port->state->port.tty);
480 port->sysrq = 0; 446 port->sysrq = 0;
481 return 1; 447 return 1;
482 } 448 }
@@ -494,7 +460,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
494 */ 460 */
495static inline int uart_handle_break(struct uart_port *port) 461static inline int uart_handle_break(struct uart_port *port)
496{ 462{
497 struct uart_info *info = port->info; 463 struct uart_state *state = port->state;
498#ifdef SUPPORT_SYSRQ 464#ifdef SUPPORT_SYSRQ
499 if (port->cons && port->cons->index == port->line) { 465 if (port->cons && port->cons->index == port->line) {
500 if (!port->sysrq) { 466 if (!port->sysrq) {
@@ -505,59 +471,60 @@ static inline int uart_handle_break(struct uart_port *port)
505 } 471 }
506#endif 472#endif
507 if (port->flags & UPF_SAK) 473 if (port->flags & UPF_SAK)
508 do_SAK(info->port.tty); 474 do_SAK(state->port.tty);
509 return 0; 475 return 0;
510} 476}
511 477
512/** 478/**
513 * uart_handle_dcd_change - handle a change of carrier detect state 479 * uart_handle_dcd_change - handle a change of carrier detect state
514 * @port: uart_port structure for the open port 480 * @uport: uart_port structure for the open port
515 * @status: new carrier detect status, nonzero if active 481 * @status: new carrier detect status, nonzero if active
516 */ 482 */
517static inline void 483static inline void
518uart_handle_dcd_change(struct uart_port *port, unsigned int status) 484uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
519{ 485{
520 struct uart_info *info = port->info; 486 struct uart_state *state = uport->state;
487 struct tty_port *port = &state->port;
521 488
522 port->icount.dcd++; 489 uport->icount.dcd++;
523 490
524#ifdef CONFIG_HARD_PPS 491#ifdef CONFIG_HARD_PPS
525 if ((port->flags & UPF_HARDPPS_CD) && status) 492 if ((uport->flags & UPF_HARDPPS_CD) && status)
526 hardpps(); 493 hardpps();
527#endif 494#endif
528 495
529 if (info->flags & UIF_CHECK_CD) { 496 if (port->flags & ASYNC_CHECK_CD) {
530 if (status) 497 if (status)
531 wake_up_interruptible(&info->port.open_wait); 498 wake_up_interruptible(&port->open_wait);
532 else if (info->port.tty) 499 else if (port->tty)
533 tty_hangup(info->port.tty); 500 tty_hangup(port->tty);
534 } 501 }
535} 502}
536 503
537/** 504/**
538 * uart_handle_cts_change - handle a change of clear-to-send state 505 * uart_handle_cts_change - handle a change of clear-to-send state
539 * @port: uart_port structure for the open port 506 * @uport: uart_port structure for the open port
540 * @status: new clear to send status, nonzero if active 507 * @status: new clear to send status, nonzero if active
541 */ 508 */
542static inline void 509static inline void
543uart_handle_cts_change(struct uart_port *port, unsigned int status) 510uart_handle_cts_change(struct uart_port *uport, unsigned int status)
544{ 511{
545 struct uart_info *info = port->info; 512 struct tty_port *port = &uport->state->port;
546 struct tty_struct *tty = info->port.tty; 513 struct tty_struct *tty = port->tty;
547 514
548 port->icount.cts++; 515 uport->icount.cts++;
549 516
550 if (info->flags & UIF_CTS_FLOW) { 517 if (port->flags & ASYNC_CTS_FLOW) {
551 if (tty->hw_stopped) { 518 if (tty->hw_stopped) {
552 if (status) { 519 if (status) {
553 tty->hw_stopped = 0; 520 tty->hw_stopped = 0;
554 port->ops->start_tx(port); 521 uport->ops->start_tx(uport);
555 uart_write_wakeup(port); 522 uart_write_wakeup(uport);
556 } 523 }
557 } else { 524 } else {
558 if (!status) { 525 if (!status) {
559 tty->hw_stopped = 1; 526 tty->hw_stopped = 1;
560 port->ops->stop_tx(port); 527 uport->ops->stop_tx(uport);
561 } 528 }
562 } 529 }
563 } 530 }
@@ -569,7 +536,7 @@ static inline void
569uart_insert_char(struct uart_port *port, unsigned int status, 536uart_insert_char(struct uart_port *port, unsigned int status,
570 unsigned int overrun, unsigned int ch, unsigned int flag) 537 unsigned int overrun, unsigned int ch, unsigned int flag)
571{ 538{
572 struct tty_struct *tty = port->info->port.tty; 539 struct tty_struct *tty = port->state->port.tty;
573 540
574 if ((status & port->ignore_status_mask & ~overrun) == 0) 541 if ((status & port->ignore_status_mask & ~overrun) == 0)
575 tty_insert_flip_char(tty, ch, flag); 542 tty_insert_flip_char(tty, ch, flag);
diff --git a/include/linux/sfi.h b/include/linux/sfi.h
new file mode 100644
index 000000000000..9a6f7607174e
--- /dev/null
+++ b/include/linux/sfi.h
@@ -0,0 +1,206 @@
1/* sfi.h Simple Firmware Interface */
2
3/*
4
5 This file is provided under a dual BSD/GPLv2 license. When using or
6 redistributing this file, you may do so under either license.
7
8 GPL LICENSE SUMMARY
9
10 Copyright(c) 2009 Intel Corporation. All rights reserved.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of version 2 of the GNU General Public License as
14 published by the Free Software Foundation.
15
16 This program is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
24 The full GNU General Public License is included in this distribution
25 in the file called LICENSE.GPL.
26
27 BSD LICENSE
28
29 Copyright(c) 2009 Intel Corporation. All rights reserved.
30
31 Redistribution and use in source and binary forms, with or without
32 modification, are permitted provided that the following conditions
33 are met:
34
35 * Redistributions of source code must retain the above copyright
36 notice, this list of conditions and the following disclaimer.
37 * Redistributions in binary form must reproduce the above copyright
38 notice, this list of conditions and the following disclaimer in
39 the documentation and/or other materials provided with the
40 distribution.
41 * Neither the name of Intel Corporation nor the names of its
42 contributors may be used to endorse or promote products derived
43 from this software without specific prior written permission.
44
45 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
47 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
48 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
49 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
52 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
53 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
54 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
55 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
57*/
58
59#ifndef _LINUX_SFI_H
60#define _LINUX_SFI_H
61
62/* Table signatures reserved by the SFI specification */
63#define SFI_SIG_SYST "SYST"
64#define SFI_SIG_FREQ "FREQ"
65#define SFI_SIG_IDLE "IDLE"
66#define SFI_SIG_CPUS "CPUS"
67#define SFI_SIG_MTMR "MTMR"
68#define SFI_SIG_MRTC "MRTC"
69#define SFI_SIG_MMAP "MMAP"
70#define SFI_SIG_APIC "APIC"
71#define SFI_SIG_XSDT "XSDT"
72#define SFI_SIG_WAKE "WAKE"
73#define SFI_SIG_SPIB "SPIB"
74#define SFI_SIG_I2CB "I2CB"
75#define SFI_SIG_GPEM "GPEM"
76
77#define SFI_SIGNATURE_SIZE 4
78#define SFI_OEM_ID_SIZE 6
79#define SFI_OEM_TABLE_ID_SIZE 8
80
81#define SFI_SYST_SEARCH_BEGIN 0x000E0000
82#define SFI_SYST_SEARCH_END 0x000FFFFF
83
84#define SFI_GET_NUM_ENTRIES(ptable, entry_type) \
85 ((ptable->header.len - sizeof(struct sfi_table_header)) / \
86 (sizeof(entry_type)))
87/*
88 * Table structures must be byte-packed to match the SFI specification,
89 * as they are provided by the BIOS.
90 */
91struct sfi_table_header {
92 char sig[SFI_SIGNATURE_SIZE];
93 u32 len;
94 u8 rev;
95 u8 csum;
96 char oem_id[SFI_OEM_ID_SIZE];
97 char oem_table_id[SFI_OEM_TABLE_ID_SIZE];
98} __packed;
99
100struct sfi_table_simple {
101 struct sfi_table_header header;
102 u64 pentry[1];
103} __packed;
104
105/* Comply with UEFI spec 2.1 */
106struct sfi_mem_entry {
107 u32 type;
108 u64 phys_start;
109 u64 virt_start;
110 u64 pages;
111 u64 attrib;
112} __packed;
113
114struct sfi_cpu_table_entry {
115 u32 apic_id;
116} __packed;
117
118struct sfi_cstate_table_entry {
119 u32 hint; /* MWAIT hint */
120 u32 latency; /* latency in ms */
121} __packed;
122
123struct sfi_apic_table_entry {
124 u64 phys_addr; /* phy base addr for APIC reg */
125} __packed;
126
127struct sfi_freq_table_entry {
128 u32 freq_mhz; /* in MHZ */
129 u32 latency; /* transition latency in ms */
130 u32 ctrl_val; /* value to write to PERF_CTL */
131} __packed;
132
133struct sfi_wake_table_entry {
134 u64 phys_addr; /* pointer to where the wake vector locates */
135} __packed;
136
137struct sfi_timer_table_entry {
138 u64 phys_addr; /* phy base addr for the timer */
139 u32 freq_hz; /* in HZ */
140 u32 irq;
141} __packed;
142
143struct sfi_rtc_table_entry {
144 u64 phys_addr; /* phy base addr for the RTC */
145 u32 irq;
146} __packed;
147
148struct sfi_spi_table_entry {
149 u16 host_num; /* attached to host 0, 1...*/
150 u16 cs; /* chip select */
151 u16 irq_info;
152 char name[16];
153 u8 dev_info[10];
154} __packed;
155
156struct sfi_i2c_table_entry {
157 u16 host_num;
158 u16 addr; /* slave addr */
159 u16 irq_info;
160 char name[16];
161 u8 dev_info[10];
162} __packed;
163
164struct sfi_gpe_table_entry {
165 u16 logical_id; /* logical id */
166 u16 phys_id; /* physical GPE id */
167} __packed;
168
169
170typedef int (*sfi_table_handler) (struct sfi_table_header *table);
171
172#ifdef CONFIG_SFI
173extern void __init sfi_init(void);
174extern int __init sfi_platform_init(void);
175extern void __init sfi_init_late(void);
176extern int sfi_table_parse(char *signature, char *oem_id, char *oem_table_id,
177 sfi_table_handler handler);
178
179extern int sfi_disabled;
180static inline void disable_sfi(void)
181{
182 sfi_disabled = 1;
183}
184
185#else /* !CONFIG_SFI */
186
187static inline void sfi_init(void)
188{
189}
190
191static inline void sfi_init_late(void)
192{
193}
194
195#define sfi_disabled 0
196
197static inline int sfi_table_parse(char *signature, char *oem_id,
198 char *oem_table_id,
199 sfi_table_handler handler)
200{
201 return -1;
202}
203
204#endif /* !CONFIG_SFI */
205
206#endif /*_LINUX_SFI_H*/
diff --git a/include/linux/sfi_acpi.h b/include/linux/sfi_acpi.h
new file mode 100644
index 000000000000..c4a5a8cd4469
--- /dev/null
+++ b/include/linux/sfi_acpi.h
@@ -0,0 +1,93 @@
1/* sfi.h Simple Firmware Interface */
2
3/*
4
5 This file is provided under a dual BSD/GPLv2 license. When using or
6 redistributing this file, you may do so under either license.
7
8 GPL LICENSE SUMMARY
9
10 Copyright(c) 2009 Intel Corporation. All rights reserved.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of version 2 of the GNU General Public License as
14 published by the Free Software Foundation.
15
16 This program is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
24 The full GNU General Public License is included in this distribution
25 in the file called LICENSE.GPL.
26
27 BSD LICENSE
28
29 Copyright(c) 2009 Intel Corporation. All rights reserved.
30
31 Redistribution and use in source and binary forms, with or without
32 modification, are permitted provided that the following conditions
33 are met:
34
35 * Redistributions of source code must retain the above copyright
36 notice, this list of conditions and the following disclaimer.
37 * Redistributions in binary form must reproduce the above copyright
38 notice, this list of conditions and the following disclaimer in
39 the documentation and/or other materials provided with the
40 distribution.
41 * Neither the name of Intel Corporation nor the names of its
42 contributors may be used to endorse or promote products derived
43 from this software without specific prior written permission.
44
45 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
47 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
48 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
49 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
52 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
53 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
54 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
55 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
57*/
58
59#ifndef _LINUX_SFI_ACPI_H
60#define _LINUX_SFI_ACPI_H
61
62#ifdef CONFIG_SFI
63#include <acpi/acpi.h> /* struct acpi_table_header */
64
65extern int sfi_acpi_table_parse(char *signature, char *oem_id,
66 char *oem_table_id,
67 int (*handler)(struct acpi_table_header *));
68
69static inline int acpi_sfi_table_parse(char *signature,
70 int (*handler)(struct acpi_table_header *))
71{
72 if (!acpi_table_parse(signature, handler))
73 return 0;
74
75 return sfi_acpi_table_parse(signature, NULL, NULL, handler);
76}
77#else /* !CONFIG_SFI */
78
79static inline int sfi_acpi_table_parse(char *signature, char *oem_id,
80 char *oem_table_id,
81 int (*handler)(struct acpi_table_header *))
82{
83 return -1;
84}
85
86static inline int acpi_sfi_table_parse(char *signature,
87 int (*handler)(struct acpi_table_header *))
88{
89 return acpi_table_parse(signature, handler);
90}
91#endif /* !CONFIG_SFI */
92
93#endif /*_LINUX_SFI_ACPI_H*/
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index eb1423a0078d..68e212ff9dde 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -85,7 +85,6 @@ struct intc_desc symbol __initdata = { \
85} 85}
86#endif 86#endif
87 87
88unsigned int intc_evt2irq(unsigned int vector);
89void __init register_intc_controller(struct intc_desc *desc); 88void __init register_intc_controller(struct intc_desc *desc);
90int intc_set_priority(unsigned int irq, unsigned int prio); 89int intc_set_priority(unsigned int irq, unsigned int prio);
91 90
diff --git a/include/linux/signal.h b/include/linux/signal.h
index c7552836bd95..ab9272cc270c 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -233,6 +233,8 @@ static inline int valid_signal(unsigned long sig)
233} 233}
234 234
235extern int next_signal(struct sigpending *pending, sigset_t *mask); 235extern int next_signal(struct sigpending *pending, sigset_t *mask);
236extern int do_send_sig_info(int sig, struct siginfo *info,
237 struct task_struct *p, bool group);
236extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p); 238extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p);
237extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); 239extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
238extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, 240extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig,
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 9e3d8af09207..39c64bae776d 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -73,15 +73,6 @@ int smp_call_function(void(*func)(void *info), void *info, int wait);
73void smp_call_function_many(const struct cpumask *mask, 73void smp_call_function_many(const struct cpumask *mask,
74 void (*func)(void *info), void *info, bool wait); 74 void (*func)(void *info), void *info, bool wait);
75 75
76/* Deprecated: Use smp_call_function_many which takes a pointer to the mask. */
77static inline int
78smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info,
79 int wait)
80{
81 smp_call_function_many(&mask, func, info, wait);
82 return 0;
83}
84
85void __smp_call_function_single(int cpuid, struct call_single_data *data, 76void __smp_call_function_single(int cpuid, struct call_single_data *data,
86 int wait); 77 int wait);
87 78
@@ -144,8 +135,6 @@ static inline int up_smp_call_function(void (*func)(void *), void *info)
144static inline void smp_send_reschedule(int cpu) { } 135static inline void smp_send_reschedule(int cpu) { }
145#define num_booting_cpus() 1 136#define num_booting_cpus() 1
146#define smp_prepare_boot_cpu() do {} while (0) 137#define smp_prepare_boot_cpu() do {} while (0)
147#define smp_call_function_mask(mask, func, info, wait) \
148 (up_smp_call_function(func, info))
149#define smp_call_function_many(mask, func, info, wait) \ 138#define smp_call_function_many(mask, func, info, wait) \
150 (up_smp_call_function(func, info)) 139 (up_smp_call_function(func, info))
151static inline void init_call_single_data(void) 140static inline void init_call_single_data(void)
diff --git a/include/linux/spi/mc33880.h b/include/linux/spi/mc33880.h
new file mode 100644
index 000000000000..82ffccd6fbe5
--- /dev/null
+++ b/include/linux/spi/mc33880.h
@@ -0,0 +1,10 @@
1#ifndef LINUX_SPI_MC33880_H
2#define LINUX_SPI_MC33880_H
3
4struct mc33880_platform_data {
5 /* number assigned to the first GPIO */
6 unsigned base;
7};
8
9#endif
10
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index c47c4b4da97e..97b60b37f445 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -20,6 +20,7 @@
20#define __LINUX_SPI_H 20#define __LINUX_SPI_H
21 21
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/mod_devicetable.h>
23 24
24/* 25/*
25 * INTERFACES between SPI master-side drivers and SPI infrastructure. 26 * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -86,7 +87,7 @@ struct spi_device {
86 int irq; 87 int irq;
87 void *controller_state; 88 void *controller_state;
88 void *controller_data; 89 void *controller_data;
89 char modalias[32]; 90 char modalias[SPI_NAME_SIZE];
90 91
91 /* 92 /*
92 * likely need more hooks for more protocol options affecting how 93 * likely need more hooks for more protocol options affecting how
@@ -145,6 +146,7 @@ struct spi_message;
145 146
146/** 147/**
147 * struct spi_driver - Host side "protocol" driver 148 * struct spi_driver - Host side "protocol" driver
149 * @id_table: List of SPI devices supported by this driver
148 * @probe: Binds this driver to the spi device. Drivers can verify 150 * @probe: Binds this driver to the spi device. Drivers can verify
149 * that the device is actually present, and may need to configure 151 * that the device is actually present, and may need to configure
150 * characteristics (such as bits_per_word) which weren't needed for 152 * characteristics (such as bits_per_word) which weren't needed for
@@ -170,6 +172,7 @@ struct spi_message;
170 * MMC, RTC, filesystem character device nodes, and hardware monitoring. 172 * MMC, RTC, filesystem character device nodes, and hardware monitoring.
171 */ 173 */
172struct spi_driver { 174struct spi_driver {
175 const struct spi_device_id *id_table;
173 int (*probe)(struct spi_device *spi); 176 int (*probe)(struct spi_device *spi);
174 int (*remove)(struct spi_device *spi); 177 int (*remove)(struct spi_device *spi);
175 void (*shutdown)(struct spi_device *spi); 178 void (*shutdown)(struct spi_device *spi);
@@ -207,6 +210,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
207 * each slave has a chipselect signal, but it's common that not 210 * each slave has a chipselect signal, but it's common that not
208 * every chipselect is connected to a slave. 211 * every chipselect is connected to a slave.
209 * @dma_alignment: SPI controller constraint on DMA buffers alignment. 212 * @dma_alignment: SPI controller constraint on DMA buffers alignment.
213 * @mode_bits: flags understood by this controller driver
214 * @flags: other constraints relevant to this driver
210 * @setup: updates the device mode and clocking records used by a 215 * @setup: updates the device mode and clocking records used by a
211 * device's SPI controller; protocol code may call this. This 216 * device's SPI controller; protocol code may call this. This
212 * must fail if an unrecognized or unsupported mode is requested. 217 * must fail if an unrecognized or unsupported mode is requested.
@@ -253,6 +258,8 @@ struct spi_master {
253 /* other constraints relevant to this driver */ 258 /* other constraints relevant to this driver */
254 u16 flags; 259 u16 flags;
255#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ 260#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */
261#define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */
262#define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */
256 263
257 /* Setup mode and clock, etc (spi driver may call many times). 264 /* Setup mode and clock, etc (spi driver may call many times).
258 * 265 *
@@ -533,42 +540,7 @@ static inline void spi_message_free(struct spi_message *m)
533} 540}
534 541
535extern int spi_setup(struct spi_device *spi); 542extern int spi_setup(struct spi_device *spi);
536 543extern int spi_async(struct spi_device *spi, struct spi_message *message);
537/**
538 * spi_async - asynchronous SPI transfer
539 * @spi: device with which data will be exchanged
540 * @message: describes the data transfers, including completion callback
541 * Context: any (irqs may be blocked, etc)
542 *
543 * This call may be used in_irq and other contexts which can't sleep,
544 * as well as from task contexts which can sleep.
545 *
546 * The completion callback is invoked in a context which can't sleep.
547 * Before that invocation, the value of message->status is undefined.
548 * When the callback is issued, message->status holds either zero (to
549 * indicate complete success) or a negative error code. After that
550 * callback returns, the driver which issued the transfer request may
551 * deallocate the associated memory; it's no longer in use by any SPI
552 * core or controller driver code.
553 *
554 * Note that although all messages to a spi_device are handled in
555 * FIFO order, messages may go to different devices in other orders.
556 * Some device might be higher priority, or have various "hard" access
557 * time requirements, for example.
558 *
559 * On detection of any fault during the transfer, processing of
560 * the entire message is aborted, and the device is deselected.
561 * Until returning from the associated message completion callback,
562 * no other spi_message queued to that device will be processed.
563 * (This rule applies equally to all the synchronous transfer calls,
564 * which are wrappers around this core asynchronous primitive.)
565 */
566static inline int
567spi_async(struct spi_device *spi, struct spi_message *message)
568{
569 message->spi = spi;
570 return spi->master->transfer(spi, message);
571}
572 544
573/*---------------------------------------------------------------------------*/ 545/*---------------------------------------------------------------------------*/
574 546
@@ -732,7 +704,7 @@ struct spi_board_info {
732 * controller_data goes to spi_device.controller_data, 704 * controller_data goes to spi_device.controller_data,
733 * irq is copied too 705 * irq is copied too
734 */ 706 */
735 char modalias[32]; 707 char modalias[SPI_NAME_SIZE];
736 const void *platform_data; 708 const void *platform_data;
737 void *controller_data; 709 void *controller_data;
738 int irq; 710 int irq;
@@ -800,4 +772,7 @@ spi_unregister_device(struct spi_device *spi)
800 device_unregister(&spi->dev); 772 device_unregister(&spi->dev);
801} 773}
802 774
775extern const struct spi_device_id *
776spi_get_device_id(const struct spi_device *sdev);
777
803#endif /* __LINUX_SPI_H */ 778#endif /* __LINUX_SPI_H */
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 3f632182d8eb..996df4dac7d4 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -111,7 +111,7 @@ struct rpc_credops {
111 void (*crdestroy)(struct rpc_cred *); 111 void (*crdestroy)(struct rpc_cred *);
112 112
113 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); 113 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int);
114 void (*crbind)(struct rpc_task *, struct rpc_cred *); 114 void (*crbind)(struct rpc_task *, struct rpc_cred *, int);
115 __be32 * (*crmarshal)(struct rpc_task *, __be32 *); 115 __be32 * (*crmarshal)(struct rpc_task *, __be32 *);
116 int (*crrefresh)(struct rpc_task *); 116 int (*crrefresh)(struct rpc_task *);
117 __be32 * (*crvalidate)(struct rpc_task *, __be32 *); 117 __be32 * (*crvalidate)(struct rpc_task *, __be32 *);
@@ -140,7 +140,7 @@ struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *
140void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); 140void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *);
141struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); 141struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int);
142void rpcauth_bindcred(struct rpc_task *, struct rpc_cred *, int); 142void rpcauth_bindcred(struct rpc_task *, struct rpc_cred *, int);
143void rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *); 143void rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *, int);
144void put_rpccred(struct rpc_cred *); 144void put_rpccred(struct rpc_cred *);
145void rpcauth_unbindcred(struct rpc_task *); 145void rpcauth_unbindcred(struct rpc_task *);
146__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *); 146__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index ab3f6e90caa5..8ed9642a5a76 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -22,6 +22,7 @@
22#include <linux/sunrpc/timer.h> 22#include <linux/sunrpc/timer.h>
23#include <asm/signal.h> 23#include <asm/signal.h>
24#include <linux/path.h> 24#include <linux/path.h>
25#include <net/ipv6.h>
25 26
26struct rpc_inode; 27struct rpc_inode;
27 28
@@ -113,6 +114,7 @@ struct rpc_create_args {
113 rpc_authflavor_t authflavor; 114 rpc_authflavor_t authflavor;
114 unsigned long flags; 115 unsigned long flags;
115 char *client_name; 116 char *client_name;
117 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
116}; 118};
117 119
118/* Values for "flags" field */ 120/* Values for "flags" field */
@@ -188,5 +190,117 @@ static inline void rpc_set_port(struct sockaddr *sap,
188#define IPV6_SCOPE_DELIMITER '%' 190#define IPV6_SCOPE_DELIMITER '%'
189#define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn") 191#define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn")
190 192
193static inline bool __rpc_cmp_addr4(const struct sockaddr *sap1,
194 const struct sockaddr *sap2)
195{
196 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
197 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
198
199 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
200}
201
202static inline bool __rpc_copy_addr4(struct sockaddr *dst,
203 const struct sockaddr *src)
204{
205 const struct sockaddr_in *ssin = (struct sockaddr_in *) src;
206 struct sockaddr_in *dsin = (struct sockaddr_in *) dst;
207
208 dsin->sin_family = ssin->sin_family;
209 dsin->sin_addr.s_addr = ssin->sin_addr.s_addr;
210 return true;
211}
212
213#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
214static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
215 const struct sockaddr *sap2)
216{
217 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
218 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
219 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
220}
221
222static inline bool __rpc_copy_addr6(struct sockaddr *dst,
223 const struct sockaddr *src)
224{
225 const struct sockaddr_in6 *ssin6 = (const struct sockaddr_in6 *) src;
226 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
227
228 dsin6->sin6_family = ssin6->sin6_family;
229 ipv6_addr_copy(&dsin6->sin6_addr, &ssin6->sin6_addr);
230 return true;
231}
232#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
233static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
234 const struct sockaddr *sap2)
235{
236 return false;
237}
238
239static inline bool __rpc_copy_addr6(struct sockaddr *dst,
240 const struct sockaddr *src)
241{
242 return false;
243}
244#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
245
246/**
247 * rpc_cmp_addr - compare the address portion of two sockaddrs.
248 * @sap1: first sockaddr
249 * @sap2: second sockaddr
250 *
251 * Just compares the family and address portion. Ignores port, scope, etc.
252 * Returns true if the addrs are equal, false if they aren't.
253 */
254static inline bool rpc_cmp_addr(const struct sockaddr *sap1,
255 const struct sockaddr *sap2)
256{
257 if (sap1->sa_family == sap2->sa_family) {
258 switch (sap1->sa_family) {
259 case AF_INET:
260 return __rpc_cmp_addr4(sap1, sap2);
261 case AF_INET6:
262 return __rpc_cmp_addr6(sap1, sap2);
263 }
264 }
265 return false;
266}
267
268/**
269 * rpc_copy_addr - copy the address portion of one sockaddr to another
270 * @dst: destination sockaddr
271 * @src: source sockaddr
272 *
273 * Just copies the address portion and family. Ignores port, scope, etc.
274 * Caller is responsible for making certain that dst is large enough to hold
275 * the address in src. Returns true if address family is supported. Returns
276 * false otherwise.
277 */
278static inline bool rpc_copy_addr(struct sockaddr *dst,
279 const struct sockaddr *src)
280{
281 switch (src->sa_family) {
282 case AF_INET:
283 return __rpc_copy_addr4(dst, src);
284 case AF_INET6:
285 return __rpc_copy_addr6(dst, src);
286 }
287 return false;
288}
289
290/**
291 * rpc_get_scope_id - return scopeid for a given sockaddr
292 * @sa: sockaddr to get scopeid from
293 *
294 * Returns the value of the sin6_scope_id for AF_INET6 addrs, or 0 if
295 * not an AF_INET6 address.
296 */
297static inline u32 rpc_get_scope_id(const struct sockaddr *sa)
298{
299 if (sa->sa_family != AF_INET6)
300 return 0;
301
302 return ((struct sockaddr_in6 *) sa)->sin6_scope_id;
303}
304
191#endif /* __KERNEL__ */ 305#endif /* __KERNEL__ */
192#endif /* _LINUX_SUNRPC_CLNT_H */ 306#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index ea8009695c69..52e8cb0a7569 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -94,8 +94,6 @@ struct svc_serv {
94 struct module * sv_module; /* optional module to count when 94 struct module * sv_module; /* optional module to count when
95 * adding threads */ 95 * adding threads */
96 svc_thread_fn sv_function; /* main function for threads */ 96 svc_thread_fn sv_function; /* main function for threads */
97 unsigned int sv_drc_max_pages; /* Total pages for DRC */
98 unsigned int sv_drc_pages_used;/* DRC pages used */
99#if defined(CONFIG_NFS_V4_1) 97#if defined(CONFIG_NFS_V4_1)
100 struct list_head sv_cb_list; /* queue for callback requests 98 struct list_head sv_cb_list; /* queue for callback requests
101 * that arrive over the same 99 * that arrive over the same
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 2223ae0b5ed5..5f4e18b3ce73 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -65,6 +65,7 @@ struct svc_xprt {
65 size_t xpt_locallen; /* length of address */ 65 size_t xpt_locallen; /* length of address */
66 struct sockaddr_storage xpt_remote; /* remote peer's address */ 66 struct sockaddr_storage xpt_remote; /* remote peer's address */
67 size_t xpt_remotelen; /* length of address */ 67 size_t xpt_remotelen; /* length of address */
68 struct rpc_wait_queue xpt_bc_pending; /* backchannel wait queue */
68}; 69};
69 70
70int svc_reg_xprt_class(struct svc_xprt_class *); 71int svc_reg_xprt_class(struct svc_xprt_class *);
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 04dba23c59f2..1b353a76c304 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -28,6 +28,7 @@ struct svc_sock {
28 /* private TCP part */ 28 /* private TCP part */
29 u32 sk_reclen; /* length of record */ 29 u32 sk_reclen; /* length of record */
30 u32 sk_tcplen; /* current read length */ 30 u32 sk_tcplen; /* current read length */
31 struct rpc_xprt *sk_bc_xprt; /* NFSv4.1 backchannel xprt */
31}; 32};
32 33
33/* 34/*
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 7da466ba4b0d..f5cc0898bc53 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -11,6 +11,7 @@
11 11
12#include <linux/uio.h> 12#include <linux/uio.h>
13#include <asm/byteorder.h> 13#include <asm/byteorder.h>
14#include <asm/unaligned.h>
14#include <linux/scatterlist.h> 15#include <linux/scatterlist.h>
15 16
16/* 17/*
@@ -117,14 +118,14 @@ static inline __be32 *xdr_encode_array(__be32 *p, const void *s, unsigned int le
117static inline __be32 * 118static inline __be32 *
118xdr_encode_hyper(__be32 *p, __u64 val) 119xdr_encode_hyper(__be32 *p, __u64 val)
119{ 120{
120 *(__be64 *)p = cpu_to_be64(val); 121 put_unaligned_be64(val, p);
121 return p + 2; 122 return p + 2;
122} 123}
123 124
124static inline __be32 * 125static inline __be32 *
125xdr_decode_hyper(__be32 *p, __u64 *valp) 126xdr_decode_hyper(__be32 *p, __u64 *valp)
126{ 127{
127 *valp = be64_to_cpup((__be64 *)p); 128 *valp = get_unaligned_be64(p);
128 return p + 2; 129 return p + 2;
129} 130}
130 131
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index c090df442572..6f9457a75b8f 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -124,6 +124,23 @@ struct rpc_xprt_ops {
124 void (*print_stats)(struct rpc_xprt *xprt, struct seq_file *seq); 124 void (*print_stats)(struct rpc_xprt *xprt, struct seq_file *seq);
125}; 125};
126 126
127/*
128 * RPC transport identifiers
129 *
130 * To preserve compatibility with the historical use of raw IP protocol
131 * id's for transport selection, UDP and TCP identifiers are specified
132 * with the previous values. No such restriction exists for new transports,
133 * except that they may not collide with these values (17 and 6,
134 * respectively).
135 */
136#define XPRT_TRANSPORT_BC (1 << 31)
137enum xprt_transports {
138 XPRT_TRANSPORT_UDP = IPPROTO_UDP,
139 XPRT_TRANSPORT_TCP = IPPROTO_TCP,
140 XPRT_TRANSPORT_BC_TCP = IPPROTO_TCP | XPRT_TRANSPORT_BC,
141 XPRT_TRANSPORT_RDMA = 256
142};
143
127struct rpc_xprt { 144struct rpc_xprt {
128 struct kref kref; /* Reference count */ 145 struct kref kref; /* Reference count */
129 struct rpc_xprt_ops * ops; /* transport methods */ 146 struct rpc_xprt_ops * ops; /* transport methods */
@@ -179,6 +196,7 @@ struct rpc_xprt {
179 spinlock_t reserve_lock; /* lock slot table */ 196 spinlock_t reserve_lock; /* lock slot table */
180 u32 xid; /* Next XID value to use */ 197 u32 xid; /* Next XID value to use */
181 struct rpc_task * snd_task; /* Task blocked in send */ 198 struct rpc_task * snd_task; /* Task blocked in send */
199 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
182#if defined(CONFIG_NFS_V4_1) 200#if defined(CONFIG_NFS_V4_1)
183 struct svc_serv *bc_serv; /* The RPC service which will */ 201 struct svc_serv *bc_serv; /* The RPC service which will */
184 /* process the callback */ 202 /* process the callback */
@@ -231,6 +249,7 @@ struct xprt_create {
231 struct sockaddr * srcaddr; /* optional local address */ 249 struct sockaddr * srcaddr; /* optional local address */
232 struct sockaddr * dstaddr; /* remote peer address */ 250 struct sockaddr * dstaddr; /* remote peer address */
233 size_t addrlen; 251 size_t addrlen;
252 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
234}; 253};
235 254
236struct xprt_class { 255struct xprt_class {
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h
index 54a379c9e8eb..c2f04e1ae159 100644
--- a/include/linux/sunrpc/xprtrdma.h
+++ b/include/linux/sunrpc/xprtrdma.h
@@ -41,11 +41,6 @@
41#define _LINUX_SUNRPC_XPRTRDMA_H 41#define _LINUX_SUNRPC_XPRTRDMA_H
42 42
43/* 43/*
44 * RPC transport identifier for RDMA
45 */
46#define XPRT_TRANSPORT_RDMA 256
47
48/*
49 * rpcbind (v3+) RDMA netid. 44 * rpcbind (v3+) RDMA netid.
50 */ 45 */
51#define RPCBIND_NETID_RDMA "rdma" 46#define RPCBIND_NETID_RDMA "rdma"
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h
index c2a46c45c8f7..3f14a02e9cc0 100644
--- a/include/linux/sunrpc/xprtsock.h
+++ b/include/linux/sunrpc/xprtsock.h
@@ -13,17 +13,6 @@ int init_socket_xprt(void);
13void cleanup_socket_xprt(void); 13void cleanup_socket_xprt(void);
14 14
15/* 15/*
16 * RPC transport identifiers for UDP, TCP
17 *
18 * To preserve compatibility with the historical use of raw IP protocol
19 * id's for transport selection, these are specified with the previous
20 * values. No such restriction exists for new transports, except that
21 * they may not collide with these values (17 and 6, respectively).
22 */
23#define XPRT_TRANSPORT_UDP IPPROTO_UDP
24#define XPRT_TRANSPORT_TCP IPPROTO_TCP
25
26/*
27 * RPC slot table sizes for UDP, TCP transports 16 * RPC slot table sizes for UDP, TCP transports
28 */ 17 */
29extern unsigned int xprt_udp_slot_table_entries; 18extern unsigned int xprt_udp_slot_table_entries;
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 7c15334f3ff2..4ec90019c1a4 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -34,15 +34,37 @@ static inline int current_is_kswapd(void)
34 * the type/offset into the pte as 5/27 as well. 34 * the type/offset into the pte as 5/27 as well.
35 */ 35 */
36#define MAX_SWAPFILES_SHIFT 5 36#define MAX_SWAPFILES_SHIFT 5
37#ifndef CONFIG_MIGRATION 37
38#define MAX_SWAPFILES (1 << MAX_SWAPFILES_SHIFT) 38/*
39 * Use some of the swap files numbers for other purposes. This
40 * is a convenient way to hook into the VM to trigger special
41 * actions on faults.
42 */
43
44/*
45 * NUMA node memory migration support
46 */
47#ifdef CONFIG_MIGRATION
48#define SWP_MIGRATION_NUM 2
49#define SWP_MIGRATION_READ (MAX_SWAPFILES + SWP_HWPOISON_NUM)
50#define SWP_MIGRATION_WRITE (MAX_SWAPFILES + SWP_HWPOISON_NUM + 1)
51#else
52#define SWP_MIGRATION_NUM 0
53#endif
54
55/*
56 * Handling of hardware poisoned pages with memory corruption.
57 */
58#ifdef CONFIG_MEMORY_FAILURE
59#define SWP_HWPOISON_NUM 1
60#define SWP_HWPOISON MAX_SWAPFILES
39#else 61#else
40/* Use last two entries for page migration swap entries */ 62#define SWP_HWPOISON_NUM 0
41#define MAX_SWAPFILES ((1 << MAX_SWAPFILES_SHIFT)-2)
42#define SWP_MIGRATION_READ MAX_SWAPFILES
43#define SWP_MIGRATION_WRITE (MAX_SWAPFILES + 1)
44#endif 63#endif
45 64
65#define MAX_SWAPFILES \
66 ((1 << MAX_SWAPFILES_SHIFT) - SWP_MIGRATION_NUM - SWP_HWPOISON_NUM)
67
46/* 68/*
47 * Magic header for a swap area. The first part of the union is 69 * Magic header for a swap area. The first part of the union is
48 * what the swap magic looks like for the old (limited to 128MB) 70 * what the swap magic looks like for the old (limited to 128MB)
@@ -217,6 +239,11 @@ extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
217extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 239extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
218 gfp_t gfp_mask, bool noswap, 240 gfp_t gfp_mask, bool noswap,
219 unsigned int swappiness); 241 unsigned int swappiness);
242extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
243 gfp_t gfp_mask, bool noswap,
244 unsigned int swappiness,
245 struct zone *zone,
246 int nid);
220extern int __isolate_lru_page(struct page *page, int mode, int file); 247extern int __isolate_lru_page(struct page *page, int mode, int file);
221extern unsigned long shrink_all_memory(unsigned long nr_pages); 248extern unsigned long shrink_all_memory(unsigned long nr_pages);
222extern int vm_swappiness; 249extern int vm_swappiness;
@@ -240,7 +267,7 @@ extern int page_evictable(struct page *page, struct vm_area_struct *vma);
240extern void scan_mapping_unevictable_pages(struct address_space *); 267extern void scan_mapping_unevictable_pages(struct address_space *);
241 268
242extern unsigned long scan_unevictable_pages; 269extern unsigned long scan_unevictable_pages;
243extern int scan_unevictable_handler(struct ctl_table *, int, struct file *, 270extern int scan_unevictable_handler(struct ctl_table *, int,
244 void __user *, size_t *, loff_t *); 271 void __user *, size_t *, loff_t *);
245extern int scan_unevictable_register_node(struct node *node); 272extern int scan_unevictable_register_node(struct node *node);
246extern void scan_unevictable_unregister_node(struct node *node); 273extern void scan_unevictable_unregister_node(struct node *node);
@@ -419,10 +446,22 @@ static inline swp_entry_t get_swap_page(void)
419} 446}
420 447
421/* linux/mm/thrash.c */ 448/* linux/mm/thrash.c */
422#define put_swap_token(mm) do { } while (0) 449static inline void put_swap_token(struct mm_struct *mm)
423#define grab_swap_token(mm) do { } while (0) 450{
424#define has_swap_token(mm) 0 451}
425#define disable_swap_token() do { } while (0) 452
453static inline void grab_swap_token(struct mm_struct *mm)
454{
455}
456
457static inline int has_swap_token(struct mm_struct *mm)
458{
459 return 0;
460}
461
462static inline void disable_swap_token(void)
463{
464}
426 465
427static inline void 466static inline void
428mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent) 467mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent)
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 6ec39ab27b4b..cd42e30b7c6e 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -131,3 +131,41 @@ static inline int is_write_migration_entry(swp_entry_t entry)
131 131
132#endif 132#endif
133 133
134#ifdef CONFIG_MEMORY_FAILURE
135/*
136 * Support for hardware poisoned pages
137 */
138static inline swp_entry_t make_hwpoison_entry(struct page *page)
139{
140 BUG_ON(!PageLocked(page));
141 return swp_entry(SWP_HWPOISON, page_to_pfn(page));
142}
143
144static inline int is_hwpoison_entry(swp_entry_t entry)
145{
146 return swp_type(entry) == SWP_HWPOISON;
147}
148#else
149
150static inline swp_entry_t make_hwpoison_entry(struct page *page)
151{
152 return swp_entry(0, 0);
153}
154
155static inline int is_hwpoison_entry(swp_entry_t swp)
156{
157 return 0;
158}
159#endif
160
161#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION)
162static inline int non_swap_entry(swp_entry_t entry)
163{
164 return swp_type(entry) >= MAX_SWAPFILES;
165}
166#else
167static inline int non_swap_entry(swp_entry_t entry)
168{
169 return 0;
170}
171#endif
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a8e37821cc60..a990ace1a838 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -55,7 +55,7 @@ struct compat_timeval;
55struct robust_list_head; 55struct robust_list_head;
56struct getcpu_cache; 56struct getcpu_cache;
57struct old_linux_dirent; 57struct old_linux_dirent;
58struct perf_counter_attr; 58struct perf_event_attr;
59 59
60#include <linux/types.h> 60#include <linux/types.h>
61#include <linux/aio_abi.h> 61#include <linux/aio_abi.h>
@@ -100,33 +100,25 @@ struct perf_counter_attr;
100 100
101#ifdef CONFIG_EVENT_PROFILE 101#ifdef CONFIG_EVENT_PROFILE
102#define TRACE_SYS_ENTER_PROFILE(sname) \ 102#define TRACE_SYS_ENTER_PROFILE(sname) \
103static int prof_sysenter_enable_##sname(struct ftrace_event_call *event_call) \ 103static int prof_sysenter_enable_##sname(void) \
104{ \ 104{ \
105 int ret = 0; \ 105 return reg_prof_syscall_enter("sys"#sname); \
106 if (!atomic_inc_return(&event_enter_##sname.profile_count)) \
107 ret = reg_prof_syscall_enter("sys"#sname); \
108 return ret; \
109} \ 106} \
110 \ 107 \
111static void prof_sysenter_disable_##sname(struct ftrace_event_call *event_call)\ 108static void prof_sysenter_disable_##sname(void) \
112{ \ 109{ \
113 if (atomic_add_negative(-1, &event_enter_##sname.profile_count)) \ 110 unreg_prof_syscall_enter("sys"#sname); \
114 unreg_prof_syscall_enter("sys"#sname); \
115} 111}
116 112
117#define TRACE_SYS_EXIT_PROFILE(sname) \ 113#define TRACE_SYS_EXIT_PROFILE(sname) \
118static int prof_sysexit_enable_##sname(struct ftrace_event_call *event_call) \ 114static int prof_sysexit_enable_##sname(void) \
119{ \ 115{ \
120 int ret = 0; \ 116 return reg_prof_syscall_exit("sys"#sname); \
121 if (!atomic_inc_return(&event_exit_##sname.profile_count)) \
122 ret = reg_prof_syscall_exit("sys"#sname); \
123 return ret; \
124} \ 117} \
125 \ 118 \
126static void prof_sysexit_disable_##sname(struct ftrace_event_call *event_call) \ 119static void prof_sysexit_disable_##sname(void) \
127{ \ 120{ \
128 if (atomic_add_negative(-1, &event_exit_##sname.profile_count)) \ 121 unreg_prof_syscall_exit("sys"#sname); \
129 unreg_prof_syscall_exit("sys"#sname); \
130} 122}
131 123
132#define TRACE_SYS_ENTER_PROFILE_INIT(sname) \ 124#define TRACE_SYS_ENTER_PROFILE_INIT(sname) \
@@ -468,8 +460,7 @@ asmlinkage long sys_mount(char __user *dev_name, char __user *dir_name,
468 void __user *data); 460 void __user *data);
469asmlinkage long sys_umount(char __user *name, int flags); 461asmlinkage long sys_umount(char __user *name, int flags);
470asmlinkage long sys_oldumount(char __user *name); 462asmlinkage long sys_oldumount(char __user *name);
471asmlinkage long sys_truncate(const char __user *path, 463asmlinkage long sys_truncate(const char __user *path, long length);
472 unsigned long length);
473asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); 464asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
474asmlinkage long sys_stat(char __user *filename, 465asmlinkage long sys_stat(char __user *filename,
475 struct __old_kernel_stat __user *statbuf); 466 struct __old_kernel_stat __user *statbuf);
@@ -885,7 +876,7 @@ asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
885int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 876int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
886 877
887 878
888asmlinkage long sys_perf_counter_open( 879asmlinkage long sys_perf_event_open(
889 struct perf_counter_attr __user *attr_uptr, 880 struct perf_event_attr __user *attr_uptr,
890 pid_t pid, int cpu, int group_fd, unsigned long flags); 881 pid_t pid, int cpu, int group_fd, unsigned long flags);
891#endif 882#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index e76d3b22a466..1e4743ee6831 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -29,7 +29,6 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/compiler.h> 30#include <linux/compiler.h>
31 31
32struct file;
33struct completion; 32struct completion;
34 33
35#define CTL_MAXNAME 10 /* how many path components do we allow in a 34#define CTL_MAXNAME 10 /* how many path components do we allow in a
@@ -977,25 +976,25 @@ typedef int ctl_handler (struct ctl_table *table,
977 void __user *oldval, size_t __user *oldlenp, 976 void __user *oldval, size_t __user *oldlenp,
978 void __user *newval, size_t newlen); 977 void __user *newval, size_t newlen);
979 978
980typedef int proc_handler (struct ctl_table *ctl, int write, struct file * filp, 979typedef int proc_handler (struct ctl_table *ctl, int write,
981 void __user *buffer, size_t *lenp, loff_t *ppos); 980 void __user *buffer, size_t *lenp, loff_t *ppos);
982 981
983extern int proc_dostring(struct ctl_table *, int, struct file *, 982extern int proc_dostring(struct ctl_table *, int,
984 void __user *, size_t *, loff_t *); 983 void __user *, size_t *, loff_t *);
985extern int proc_dointvec(struct ctl_table *, int, struct file *, 984extern int proc_dointvec(struct ctl_table *, int,
986 void __user *, size_t *, loff_t *); 985 void __user *, size_t *, loff_t *);
987extern int proc_dointvec_minmax(struct ctl_table *, int, struct file *, 986extern int proc_dointvec_minmax(struct ctl_table *, int,
988 void __user *, size_t *, loff_t *); 987 void __user *, size_t *, loff_t *);
989extern int proc_dointvec_jiffies(struct ctl_table *, int, struct file *, 988extern int proc_dointvec_jiffies(struct ctl_table *, int,
990 void __user *, size_t *, loff_t *); 989 void __user *, size_t *, loff_t *);
991extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int, struct file *, 990extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int,
992 void __user *, size_t *, loff_t *); 991 void __user *, size_t *, loff_t *);
993extern int proc_dointvec_ms_jiffies(struct ctl_table *, int, struct file *, 992extern int proc_dointvec_ms_jiffies(struct ctl_table *, int,
994 void __user *, size_t *, loff_t *); 993 void __user *, size_t *, loff_t *);
995extern int proc_doulongvec_minmax(struct ctl_table *, int, struct file *, 994extern int proc_doulongvec_minmax(struct ctl_table *, int,
996 void __user *, size_t *, loff_t *); 995 void __user *, size_t *, loff_t *);
997extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int, 996extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
998 struct file *, void __user *, size_t *, loff_t *); 997 void __user *, size_t *, loff_t *);
999 998
1000extern int do_sysctl (int __user *name, int nlen, 999extern int do_sysctl (int __user *name, int nlen,
1001 void __user *oldval, size_t __user *oldlenp, 1000 void __user *oldval, size_t __user *oldlenp,
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h
index 7e9680f4afdd..3398f4553269 100644
--- a/include/linux/taskstats_kern.h
+++ b/include/linux/taskstats_kern.h
@@ -9,7 +9,6 @@
9 9
10#include <linux/taskstats.h> 10#include <linux/taskstats.h>
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <net/genetlink.h>
13 12
14#ifdef CONFIG_TASKSTATS 13#ifdef CONFIG_TASKSTATS
15extern struct kmem_cache *taskstats_cache; 14extern struct kmem_cache *taskstats_cache;
diff --git a/include/linux/time.h b/include/linux/time.h
index ea16c1a01d51..fe04e5ef6a59 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -75,7 +75,7 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon,
75 const unsigned int day, const unsigned int hour, 75 const unsigned int day, const unsigned int hour,
76 const unsigned int min, const unsigned int sec); 76 const unsigned int min, const unsigned int sec);
77 77
78extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec); 78extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec);
79extern struct timespec timespec_add_safe(const struct timespec lhs, 79extern struct timespec timespec_add_safe(const struct timespec lhs,
80 const struct timespec rhs); 80 const struct timespec rhs);
81 81
@@ -101,7 +101,8 @@ extern struct timespec xtime;
101extern struct timespec wall_to_monotonic; 101extern struct timespec wall_to_monotonic;
102extern seqlock_t xtime_lock; 102extern seqlock_t xtime_lock;
103 103
104extern unsigned long read_persistent_clock(void); 104extern void read_persistent_clock(struct timespec *ts);
105extern void read_boot_clock(struct timespec *ts);
105extern int update_persistent_clock(struct timespec now); 106extern int update_persistent_clock(struct timespec now);
106extern int no_sync_cmos_clock __read_mostly; 107extern int no_sync_cmos_clock __read_mostly;
107void timekeeping_init(void); 108void timekeeping_init(void);
@@ -109,6 +110,8 @@ extern int timekeeping_suspended;
109 110
110unsigned long get_seconds(void); 111unsigned long get_seconds(void);
111struct timespec current_kernel_time(void); 112struct timespec current_kernel_time(void);
113struct timespec __current_kernel_time(void); /* does not hold xtime_lock */
114struct timespec get_monotonic_coarse(void);
112 115
113#define CURRENT_TIME (current_kernel_time()) 116#define CURRENT_TIME (current_kernel_time())
114#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) 117#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })
@@ -147,10 +150,39 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
147extern int timekeeping_valid_for_hres(void); 150extern int timekeeping_valid_for_hres(void);
148extern void update_wall_time(void); 151extern void update_wall_time(void);
149extern void update_xtime_cache(u64 nsec); 152extern void update_xtime_cache(u64 nsec);
153extern void timekeeping_leap_insert(int leapsecond);
150 154
151struct tms; 155struct tms;
152extern void do_sys_times(struct tms *); 156extern void do_sys_times(struct tms *);
153 157
158/*
159 * Similar to the struct tm in userspace <time.h>, but it needs to be here so
160 * that the kernel source is self contained.
161 */
162struct tm {
163 /*
164 * the number of seconds after the minute, normally in the range
165 * 0 to 59, but can be up to 60 to allow for leap seconds
166 */
167 int tm_sec;
168 /* the number of minutes after the hour, in the range 0 to 59*/
169 int tm_min;
170 /* the number of hours past midnight, in the range 0 to 23 */
171 int tm_hour;
172 /* the day of the month, in the range 1 to 31 */
173 int tm_mday;
174 /* the number of months since January, in the range 0 to 11 */
175 int tm_mon;
176 /* the number of years since 1900 */
177 long tm_year;
178 /* the number of days since Sunday, in the range 0 to 6 */
179 int tm_wday;
180 /* the number of days since January 1, in the range 0 to 365 */
181 int tm_yday;
182};
183
184void time_to_tm(time_t totalsecs, int offset, struct tm *result);
185
154/** 186/**
155 * timespec_to_ns - Convert timespec to nanoseconds 187 * timespec_to_ns - Convert timespec to nanoseconds
156 * @ts: pointer to the timespec variable to be converted 188 * @ts: pointer to the timespec variable to be converted
@@ -241,6 +273,8 @@ struct itimerval {
241#define CLOCK_PROCESS_CPUTIME_ID 2 273#define CLOCK_PROCESS_CPUTIME_ID 2
242#define CLOCK_THREAD_CPUTIME_ID 3 274#define CLOCK_THREAD_CPUTIME_ID 3
243#define CLOCK_MONOTONIC_RAW 4 275#define CLOCK_MONOTONIC_RAW 4
276#define CLOCK_REALTIME_COARSE 5
277#define CLOCK_MONOTONIC_COARSE 6
244 278
245/* 279/*
246 * The IDs of various hardware clocks: 280 * The IDs of various hardware clocks:
diff --git a/include/linux/timer.h b/include/linux/timer.h
index be62ec2ebea5..a2d1eb6cb3f0 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -175,11 +175,6 @@ extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires);
175 175
176/* 176/*
177 * Return when the next timer-wheel timeout occurs (in absolute jiffies), 177 * Return when the next timer-wheel timeout occurs (in absolute jiffies),
178 * locks the timer base:
179 */
180extern unsigned long next_timer_interrupt(void);
181/*
182 * Return when the next timer-wheel timeout occurs (in absolute jiffies),
183 * locks the timer base and does the comparison against the given 178 * locks the timer base and does the comparison against the given
184 * jiffie. 179 * jiffie.
185 */ 180 */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 809b26c07090..fc0bf3edeb67 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -211,12 +211,6 @@ int arch_update_cpu_topology(void);
211#ifndef topology_core_id 211#ifndef topology_core_id
212#define topology_core_id(cpu) ((void)(cpu), 0) 212#define topology_core_id(cpu) ((void)(cpu), 0)
213#endif 213#endif
214#ifndef topology_thread_siblings
215#define topology_thread_siblings(cpu) cpumask_of_cpu(cpu)
216#endif
217#ifndef topology_core_siblings
218#define topology_core_siblings(cpu) cpumask_of_cpu(cpu)
219#endif
220#ifndef topology_thread_cpumask 214#ifndef topology_thread_cpumask
221#define topology_thread_cpumask(cpu) cpumask_of(cpu) 215#define topology_thread_cpumask(cpu) cpumask_of(cpu)
222#endif 216#endif
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 17ba82efa483..1eb44a924e56 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Tracing hooks 2 * Tracing hooks
3 * 3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved. 4 * Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved.
5 * 5 *
6 * This copyrighted material is made available to anyone wishing to use, 6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions 7 * modify, copy, or redistribute it subject to the terms and conditions
@@ -463,22 +463,38 @@ static inline int tracehook_get_signal(struct task_struct *task,
463 463
464/** 464/**
465 * tracehook_notify_jctl - report about job control stop/continue 465 * tracehook_notify_jctl - report about job control stop/continue
466 * @notify: nonzero if this is the last thread in the group to stop 466 * @notify: zero, %CLD_STOPPED or %CLD_CONTINUED
467 * @why: %CLD_STOPPED or %CLD_CONTINUED 467 * @why: %CLD_STOPPED or %CLD_CONTINUED
468 * 468 *
469 * This is called when we might call do_notify_parent_cldstop(). 469 * This is called when we might call do_notify_parent_cldstop().
470 * It's called when about to stop for job control; we are already in
471 * %TASK_STOPPED state, about to call schedule(). It's also called when
472 * a delayed %CLD_STOPPED or %CLD_CONTINUED report is ready to be made.
473 * 470 *
474 * Return nonzero to generate a %SIGCHLD with @why, which is 471 * @notify is zero if we would not ordinarily send a %SIGCHLD,
475 * normal if @notify is nonzero. 472 * or is the %CLD_STOPPED or %CLD_CONTINUED .si_code for %SIGCHLD.
476 * 473 *
477 * Called with no locks held. 474 * @why is %CLD_STOPPED when about to stop for job control;
475 * we are already in %TASK_STOPPED state, about to call schedule().
476 * It might also be that we have just exited (check %PF_EXITING),
477 * but need to report that a group-wide stop is complete.
478 *
479 * @why is %CLD_CONTINUED when waking up after job control stop and
480 * ready to make a delayed @notify report.
481 *
482 * Return the %CLD_* value for %SIGCHLD, or zero to generate no signal.
483 *
484 * Called with the siglock held.
478 */ 485 */
479static inline int tracehook_notify_jctl(int notify, int why) 486static inline int tracehook_notify_jctl(int notify, int why)
480{ 487{
481 return notify || (current->ptrace & PT_PTRACED); 488 return notify ?: (current->ptrace & PT_PTRACED) ? why : 0;
489}
490
491/**
492 * tracehook_finish_jctl - report about return from job control stop
493 *
494 * This is called by do_signal_stop() after wakeup.
495 */
496static inline void tracehook_finish_jctl(void)
497{
482} 498}
483 499
484#define DEATH_REAP -1 500#define DEATH_REAP -1
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 63a3f7a80580..660a9de96f81 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -4,7 +4,7 @@
4/* 4/*
5 * Kernel Tracepoint API. 5 * Kernel Tracepoint API.
6 * 6 *
7 * See Documentation/tracepoint.txt. 7 * See Documentation/trace/tracepoints.txt.
8 * 8 *
9 * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> 9 * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
10 * 10 *
diff --git a/include/linux/tty.h b/include/linux/tty.h
index a916a318004e..f0f43d08d8b8 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -187,7 +187,12 @@ struct tty_port;
187struct tty_port_operations { 187struct tty_port_operations {
188 /* Return 1 if the carrier is raised */ 188 /* Return 1 if the carrier is raised */
189 int (*carrier_raised)(struct tty_port *port); 189 int (*carrier_raised)(struct tty_port *port);
190 /* Control the DTR line */
190 void (*dtr_rts)(struct tty_port *port, int raise); 191 void (*dtr_rts)(struct tty_port *port, int raise);
192 /* Called when the last close completes or a hangup finishes
193 IFF the port was initialized. Do not use to free resources */
194 void (*shutdown)(struct tty_port *port);
195 void (*drop)(struct tty_port *port);
191}; 196};
192 197
193struct tty_port { 198struct tty_port {
@@ -198,11 +203,12 @@ struct tty_port {
198 int count; /* Usage count */ 203 int count; /* Usage count */
199 wait_queue_head_t open_wait; /* Open waiters */ 204 wait_queue_head_t open_wait; /* Open waiters */
200 wait_queue_head_t close_wait; /* Close waiters */ 205 wait_queue_head_t close_wait; /* Close waiters */
206 wait_queue_head_t delta_msr_wait; /* Modem status change */
201 unsigned long flags; /* TTY flags ASY_*/ 207 unsigned long flags; /* TTY flags ASY_*/
202 struct mutex mutex; /* Locking */ 208 struct mutex mutex; /* Locking */
203 unsigned char *xmit_buf; /* Optional buffer */ 209 unsigned char *xmit_buf; /* Optional buffer */
204 int close_delay; /* Close port delay */ 210 unsigned int close_delay; /* Close port delay */
205 int closing_wait; /* Delay for output */ 211 unsigned int closing_wait; /* Delay for output */
206 int drain_delay; /* Set to zero if no pure time 212 int drain_delay; /* Set to zero if no pure time
207 based drain is needed else 213 based drain is needed else
208 set to size of fifo */ 214 set to size of fifo */
@@ -459,6 +465,12 @@ extern int tty_port_block_til_ready(struct tty_port *port,
459extern int tty_port_close_start(struct tty_port *port, 465extern int tty_port_close_start(struct tty_port *port,
460 struct tty_struct *tty, struct file *filp); 466 struct tty_struct *tty, struct file *filp);
461extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); 467extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty);
468extern void tty_port_close(struct tty_port *port,
469 struct tty_struct *tty, struct file *filp);
470extern inline int tty_port_users(struct tty_port *port)
471{
472 return port->count + port->blocked_open;
473}
462 474
463extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); 475extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
464extern int tty_unregister_ldisc(int disc); 476extern int tty_unregister_ldisc(int disc);
@@ -524,5 +536,8 @@ extern int pcxe_open(struct tty_struct *tty, struct file *filp);
524extern int vt_ioctl(struct tty_struct *tty, struct file *file, 536extern int vt_ioctl(struct tty_struct *tty, struct file *file,
525 unsigned int cmd, unsigned long arg); 537 unsigned int cmd, unsigned long arg);
526 538
539extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file,
540 unsigned int cmd, unsigned long arg);
541
527#endif /* __KERNEL__ */ 542#endif /* __KERNEL__ */
528#endif 543#endif
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index ae779bb8cc0f..adb44066680c 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -26,6 +26,7 @@
26#include <sound/ac97_codec.h> 26#include <sound/ac97_codec.h>
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/gpio.h>
29 30
30/* 31/*
31 * UCB1400 AC-link registers 32 * UCB1400 AC-link registers
@@ -82,6 +83,17 @@
82#define UCB_ID 0x7e 83#define UCB_ID 0x7e
83#define UCB_ID_1400 0x4304 84#define UCB_ID_1400 0x4304
84 85
86struct ucb1400_gpio_data {
87 int gpio_offset;
88 int (*gpio_setup)(struct device *dev, int ngpio);
89 int (*gpio_teardown)(struct device *dev, int ngpio);
90};
91
92struct ucb1400_gpio {
93 struct gpio_chip gc;
94 struct snd_ac97 *ac97;
95};
96
85struct ucb1400_ts { 97struct ucb1400_ts {
86 struct input_dev *ts_idev; 98 struct input_dev *ts_idev;
87 struct task_struct *ts_task; 99 struct task_struct *ts_task;
@@ -95,6 +107,7 @@ struct ucb1400_ts {
95 107
96struct ucb1400 { 108struct ucb1400 {
97 struct platform_device *ucb1400_ts; 109 struct platform_device *ucb1400_ts;
110 struct platform_device *ucb1400_gpio;
98}; 111};
99 112
100static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) 113static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg)
@@ -147,4 +160,10 @@ static inline void ucb1400_adc_disable(struct snd_ac97 *ac97)
147unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel, 160unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
148 int adcsync); 161 int adcsync);
149 162
163#ifdef CONFIG_GPIO_UCB1400
164void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data);
165#else
166static inline void ucb1400_gpio_set_data(struct ucb1400_gpio_data *data) {}
167#endif
168
150#endif 169#endif
diff --git a/include/linux/unaligned/be_byteshift.h b/include/linux/unaligned/be_byteshift.h
index 46dd12c5709e..9356b24223ac 100644
--- a/include/linux/unaligned/be_byteshift.h
+++ b/include/linux/unaligned/be_byteshift.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H 1#ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H
2#define _LINUX_UNALIGNED_BE_BYTESHIFT_H 2#define _LINUX_UNALIGNED_BE_BYTESHIFT_H
3 3
4#include <linux/kernel.h> 4#include <linux/types.h>
5 5
6static inline u16 __get_unaligned_be16(const u8 *p) 6static inline u16 __get_unaligned_be16(const u8 *p)
7{ 7{
diff --git a/include/linux/unaligned/le_byteshift.h b/include/linux/unaligned/le_byteshift.h
index 59777e951baf..be376fb79b64 100644
--- a/include/linux/unaligned/le_byteshift.h
+++ b/include/linux/unaligned/le_byteshift.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H 1#ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H
2#define _LINUX_UNALIGNED_LE_BYTESHIFT_H 2#define _LINUX_UNALIGNED_LE_BYTESHIFT_H
3 3
4#include <linux/kernel.h> 4#include <linux/types.h>
5 5
6static inline u16 __get_unaligned_le16(const u8 *p) 6static inline u16 __get_unaligned_le16(const u8 *p)
7{ 7{
diff --git a/include/linux/usb.h b/include/linux/usb.h
index b1e3c2fbfe11..a34fa89f1474 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -195,7 +195,7 @@ struct usb_interface {
195 195
196 struct device dev; /* interface specific device info */ 196 struct device dev; /* interface specific device info */
197 struct device *usb_dev; 197 struct device *usb_dev;
198 int pm_usage_cnt; /* usage counter for autosuspend */ 198 atomic_t pm_usage_cnt; /* usage counter for autosuspend */
199 struct work_struct reset_ws; /* for resets in atomic context */ 199 struct work_struct reset_ws; /* for resets in atomic context */
200}; 200};
201#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 201#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
@@ -551,13 +551,13 @@ extern void usb_autopm_put_interface_async(struct usb_interface *intf);
551 551
552static inline void usb_autopm_enable(struct usb_interface *intf) 552static inline void usb_autopm_enable(struct usb_interface *intf)
553{ 553{
554 intf->pm_usage_cnt = 0; 554 atomic_set(&intf->pm_usage_cnt, 0);
555 usb_autopm_set_interface(intf); 555 usb_autopm_set_interface(intf);
556} 556}
557 557
558static inline void usb_autopm_disable(struct usb_interface *intf) 558static inline void usb_autopm_disable(struct usb_interface *intf)
559{ 559{
560 intf->pm_usage_cnt = 1; 560 atomic_set(&intf->pm_usage_cnt, 1);
561 usb_autopm_set_interface(intf); 561 usb_autopm_set_interface(intf);
562} 562}
563 563
@@ -922,7 +922,7 @@ extern struct bus_type usb_bus_type;
922/** 922/**
923 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number 923 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number
924 * @name: the usb class device name for this driver. Will show up in sysfs. 924 * @name: the usb class device name for this driver. Will show up in sysfs.
925 * @nodename: Callback to provide a naming hint for a possible 925 * @devnode: Callback to provide a naming hint for a possible
926 * device node to create. 926 * device node to create.
927 * @fops: pointer to the struct file_operations of this driver. 927 * @fops: pointer to the struct file_operations of this driver.
928 * @minor_base: the start of the minor range for this driver. 928 * @minor_base: the start of the minor range for this driver.
@@ -933,7 +933,7 @@ extern struct bus_type usb_bus_type;
933 */ 933 */
934struct usb_class_driver { 934struct usb_class_driver {
935 char *name; 935 char *name;
936 char *(*nodename)(struct device *dev); 936 char *(*devnode)(struct device *dev, mode_t *mode);
937 const struct file_operations *fops; 937 const struct file_operations *fops;
938 int minor_base; 938 int minor_base;
939}; 939};
@@ -1036,9 +1036,10 @@ typedef void (*usb_complete_t)(struct urb *);
1036 * @transfer_flags: A variety of flags may be used to affect how URB 1036 * @transfer_flags: A variety of flags may be used to affect how URB
1037 * submission, unlinking, or operation are handled. Different 1037 * submission, unlinking, or operation are handled. Different
1038 * kinds of URB can use different flags. 1038 * kinds of URB can use different flags.
1039 * @transfer_buffer: This identifies the buffer to (or from) which 1039 * @transfer_buffer: This identifies the buffer to (or from) which the I/O
1040 * the I/O request will be performed (unless URB_NO_TRANSFER_DMA_MAP 1040 * request will be performed unless URB_NO_TRANSFER_DMA_MAP is set
1041 * is set). This buffer must be suitable for DMA; allocate it with 1041 * (however, do not leave garbage in transfer_buffer even then).
1042 * This buffer must be suitable for DMA; allocate it with
1042 * kmalloc() or equivalent. For transfers to "in" endpoints, contents 1043 * kmalloc() or equivalent. For transfers to "in" endpoints, contents
1043 * of this buffer will be modified. This buffer is used for the data 1044 * of this buffer will be modified. This buffer is used for the data
1044 * stage of control transfers. 1045 * stage of control transfers.
@@ -1071,7 +1072,7 @@ typedef void (*usb_complete_t)(struct urb *);
1071 * @start_frame: Returns the initial frame for isochronous transfers. 1072 * @start_frame: Returns the initial frame for isochronous transfers.
1072 * @number_of_packets: Lists the number of ISO transfer buffers. 1073 * @number_of_packets: Lists the number of ISO transfer buffers.
1073 * @interval: Specifies the polling interval for interrupt or isochronous 1074 * @interval: Specifies the polling interval for interrupt or isochronous
1074 * transfers. The units are frames (milliseconds) for for full and low 1075 * transfers. The units are frames (milliseconds) for full and low
1075 * speed devices, and microframes (1/8 millisecond) for highspeed ones. 1076 * speed devices, and microframes (1/8 millisecond) for highspeed ones.
1076 * @error_count: Returns the number of ISO transfers that reported errors. 1077 * @error_count: Returns the number of ISO transfers that reported errors.
1077 * @context: For use in completion functions. This normally points to 1078 * @context: For use in completion functions. This normally points to
@@ -1104,9 +1105,15 @@ typedef void (*usb_complete_t)(struct urb *);
1104 * allocate a DMA buffer with usb_buffer_alloc() or call usb_buffer_map(). 1105 * allocate a DMA buffer with usb_buffer_alloc() or call usb_buffer_map().
1105 * When these transfer flags are provided, host controller drivers will 1106 * When these transfer flags are provided, host controller drivers will
1106 * attempt to use the dma addresses found in the transfer_dma and/or 1107 * attempt to use the dma addresses found in the transfer_dma and/or
1107 * setup_dma fields rather than determining a dma address themselves. (Note 1108 * setup_dma fields rather than determining a dma address themselves.
1108 * that transfer_buffer and setup_packet must still be set because not all 1109 *
1109 * host controllers use DMA, nor do virtual root hubs). 1110 * Note that transfer_buffer must still be set if the controller
1111 * does not support DMA (as indicated by bus.uses_dma) and when talking
1112 * to root hub. If you have to trasfer between highmem zone and the device
1113 * on such controller, create a bounce buffer or bail out with an error.
1114 * If transfer_buffer cannot be set (is in highmem) and the controller is DMA
1115 * capable, assign NULL to it, so that usbmon knows not to use the value.
1116 * The setup_packet must always be set, so it cannot be located in highmem.
1110 * 1117 *
1111 * Initialization: 1118 * Initialization:
1112 * 1119 *
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index b5744bc218ab..eaf9dffe0a01 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -24,88 +24,78 @@
24#define USB_SUBCLASS_AUDIOCONTROL 0x01 24#define USB_SUBCLASS_AUDIOCONTROL 0x01
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02 25#define USB_SUBCLASS_AUDIOSTREAMING 0x02
26#define USB_SUBCLASS_MIDISTREAMING 0x03 26#define USB_SUBCLASS_MIDISTREAMING 0x03
27#define USB_SUBCLASS_VENDOR_SPEC 0xff 27
28 28/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
29/* A.5 Audio Class-Specific AC interface Descriptor Subtypes*/ 29#define UAC_HEADER 0x01
30#define HEADER 0x01 30#define UAC_INPUT_TERMINAL 0x02
31#define INPUT_TERMINAL 0x02 31#define UAC_OUTPUT_TERMINAL 0x03
32#define OUTPUT_TERMINAL 0x03 32#define UAC_MIXER_UNIT 0x04
33#define MIXER_UNIT 0x04 33#define UAC_SELECTOR_UNIT 0x05
34#define SELECTOR_UNIT 0x05 34#define UAC_FEATURE_UNIT 0x06
35#define FEATURE_UNIT 0x06 35#define UAC_PROCESSING_UNIT 0x07
36#define PROCESSING_UNIT 0x07 36#define UAC_EXTENSION_UNIT 0x08
37#define EXTENSION_UNIT 0x08 37
38 38/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
39#define AS_GENERAL 0x01 39#define UAC_AS_GENERAL 0x01
40#define FORMAT_TYPE 0x02 40#define UAC_FORMAT_TYPE 0x02
41#define FORMAT_SPECIFIC 0x03 41#define UAC_FORMAT_SPECIFIC 0x03
42 42
43#define EP_GENERAL 0x01 43/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
44 44#define UAC_EP_GENERAL 0x01
45#define MS_GENERAL 0x01 45
46#define MIDI_IN_JACK 0x02 46/* A.9 Audio Class-Specific Request Codes */
47#define MIDI_OUT_JACK 0x03 47#define UAC_SET_ 0x00
48 48#define UAC_GET_ 0x80
49/* endpoint attributes */ 49
50#define EP_ATTR_MASK 0x0c 50#define UAC__CUR 0x1
51#define EP_ATTR_ASYNC 0x04 51#define UAC__MIN 0x2
52#define EP_ATTR_ADAPTIVE 0x08 52#define UAC__MAX 0x3
53#define EP_ATTR_SYNC 0x0c 53#define UAC__RES 0x4
54 54#define UAC__MEM 0x5
55/* cs endpoint attributes */ 55
56#define EP_CS_ATTR_SAMPLE_RATE 0x01 56#define UAC_SET_CUR (UAC_SET_ | UAC__CUR)
57#define EP_CS_ATTR_PITCH_CONTROL 0x02 57#define UAC_GET_CUR (UAC_GET_ | UAC__CUR)
58#define EP_CS_ATTR_FILL_MAX 0x80 58#define UAC_SET_MIN (UAC_SET_ | UAC__MIN)
59 59#define UAC_GET_MIN (UAC_GET_ | UAC__MIN)
60/* Audio Class specific Request Codes */ 60#define UAC_SET_MAX (UAC_SET_ | UAC__MAX)
61#define USB_AUDIO_SET_INTF 0x21 61#define UAC_GET_MAX (UAC_GET_ | UAC__MAX)
62#define USB_AUDIO_SET_ENDPOINT 0x22 62#define UAC_SET_RES (UAC_SET_ | UAC__RES)
63#define USB_AUDIO_GET_INTF 0xa1 63#define UAC_GET_RES (UAC_GET_ | UAC__RES)
64#define USB_AUDIO_GET_ENDPOINT 0xa2 64#define UAC_SET_MEM (UAC_SET_ | UAC__MEM)
65 65#define UAC_GET_MEM (UAC_GET_ | UAC__MEM)
66#define SET_ 0x00 66
67#define GET_ 0x80 67#define UAC_GET_STAT 0xff
68 68
69#define _CUR 0x1 69/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
70#define _MIN 0x2 70#define UAC_MS_HEADER 0x01
71#define _MAX 0x3 71#define UAC_MIDI_IN_JACK 0x02
72#define _RES 0x4 72#define UAC_MIDI_OUT_JACK 0x03
73#define _MEM 0x5 73
74 74/* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */
75#define SET_CUR (SET_ | _CUR) 75#define UAC_MS_GENERAL 0x01
76#define GET_CUR (GET_ | _CUR) 76
77#define SET_MIN (SET_ | _MIN) 77/* Terminals - 2.1 USB Terminal Types */
78#define GET_MIN (GET_ | _MIN) 78#define UAC_TERMINAL_UNDEFINED 0x100
79#define SET_MAX (SET_ | _MAX) 79#define UAC_TERMINAL_STREAMING 0x101
80#define GET_MAX (GET_ | _MAX) 80#define UAC_TERMINAL_VENDOR_SPEC 0x1FF
81#define SET_RES (SET_ | _RES)
82#define GET_RES (GET_ | _RES)
83#define SET_MEM (SET_ | _MEM)
84#define GET_MEM (GET_ | _MEM)
85
86#define GET_STAT 0xff
87
88#define USB_AC_TERMINAL_UNDEFINED 0x100
89#define USB_AC_TERMINAL_STREAMING 0x101
90#define USB_AC_TERMINAL_VENDOR_SPEC 0x1FF
91 81
92/* Terminal Control Selectors */ 82/* Terminal Control Selectors */
93/* 4.3.2 Class-Specific AC Interface Descriptor */ 83/* 4.3.2 Class-Specific AC Interface Descriptor */
94struct usb_ac_header_descriptor { 84struct uac_ac_header_descriptor {
95 __u8 bLength; /* 8 + n */ 85 __u8 bLength; /* 8 + n */
96 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 86 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
97 __u8 bDescriptorSubtype; /* USB_MS_HEADER */ 87 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
98 __le16 bcdADC; /* 0x0100 */ 88 __le16 bcdADC; /* 0x0100 */
99 __le16 wTotalLength; /* includes Unit and Terminal desc. */ 89 __le16 wTotalLength; /* includes Unit and Terminal desc. */
100 __u8 bInCollection; /* n */ 90 __u8 bInCollection; /* n */
101 __u8 baInterfaceNr[]; /* [n] */ 91 __u8 baInterfaceNr[]; /* [n] */
102} __attribute__ ((packed)); 92} __attribute__ ((packed));
103 93
104#define USB_DT_AC_HEADER_SIZE(n) (8 + (n)) 94#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
105 95
106/* As above, but more useful for defining your own descriptors: */ 96/* As above, but more useful for defining your own descriptors: */
107#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \ 97#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
108struct usb_ac_header_descriptor_##n { \ 98struct uac_ac_header_descriptor_##n { \
109 __u8 bLength; \ 99 __u8 bLength; \
110 __u8 bDescriptorType; \ 100 __u8 bDescriptorType; \
111 __u8 bDescriptorSubtype; \ 101 __u8 bDescriptorSubtype; \
@@ -116,7 +106,7 @@ struct usb_ac_header_descriptor_##n { \
116} __attribute__ ((packed)) 106} __attribute__ ((packed))
117 107
118/* 4.3.2.1 Input Terminal Descriptor */ 108/* 4.3.2.1 Input Terminal Descriptor */
119struct usb_input_terminal_descriptor { 109struct uac_input_terminal_descriptor {
120 __u8 bLength; /* in bytes: 12 */ 110 __u8 bLength; /* in bytes: 12 */
121 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ 111 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
122 __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */ 112 __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */
@@ -129,18 +119,19 @@ struct usb_input_terminal_descriptor {
129 __u8 iTerminal; 119 __u8 iTerminal;
130} __attribute__ ((packed)); 120} __attribute__ ((packed));
131 121
132#define USB_DT_AC_INPUT_TERMINAL_SIZE 12 122#define UAC_DT_INPUT_TERMINAL_SIZE 12
133 123
134#define USB_AC_INPUT_TERMINAL_UNDEFINED 0x200 124/* Terminals - 2.2 Input Terminal Types */
135#define USB_AC_INPUT_TERMINAL_MICROPHONE 0x201 125#define UAC_INPUT_TERMINAL_UNDEFINED 0x200
136#define USB_AC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202 126#define UAC_INPUT_TERMINAL_MICROPHONE 0x201
137#define USB_AC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203 127#define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
138#define USB_AC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204 128#define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
139#define USB_AC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 129#define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
140#define USB_AC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 130#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
131#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
141 132
142/* 4.3.2.2 Output Terminal Descriptor */ 133/* 4.3.2.2 Output Terminal Descriptor */
143struct usb_output_terminal_descriptor { 134struct uac_output_terminal_descriptor {
144 __u8 bLength; /* in bytes: 9 */ 135 __u8 bLength; /* in bytes: 9 */
145 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ 136 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
146 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ 137 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
@@ -151,23 +142,24 @@ struct usb_output_terminal_descriptor {
151 __u8 iTerminal; 142 __u8 iTerminal;
152} __attribute__ ((packed)); 143} __attribute__ ((packed));
153 144
154#define USB_DT_AC_OUTPUT_TERMINAL_SIZE 9 145#define UAC_DT_OUTPUT_TERMINAL_SIZE 9
155 146
156#define USB_AC_OUTPUT_TERMINAL_UNDEFINED 0x300 147/* Terminals - 2.3 Output Terminal Types */
157#define USB_AC_OUTPUT_TERMINAL_SPEAKER 0x301 148#define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300
158#define USB_AC_OUTPUT_TERMINAL_HEADPHONES 0x302 149#define UAC_OUTPUT_TERMINAL_SPEAKER 0x301
159#define USB_AC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303 150#define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302
160#define USB_AC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304 151#define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
161#define USB_AC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305 152#define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
162#define USB_AC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306 153#define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
163#define USB_AC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307 154#define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
155#define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
164 156
165/* Set bControlSize = 2 as default setting */ 157/* Set bControlSize = 2 as default setting */
166#define USB_DT_AC_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) 158#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
167 159
168/* As above, but more useful for defining your own descriptors: */ 160/* As above, but more useful for defining your own descriptors: */
169#define DECLARE_USB_AC_FEATURE_UNIT_DESCRIPTOR(ch) \ 161#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
170struct usb_ac_feature_unit_descriptor_##ch { \ 162struct uac_feature_unit_descriptor_##ch { \
171 __u8 bLength; \ 163 __u8 bLength; \
172 __u8 bDescriptorType; \ 164 __u8 bDescriptorType; \
173 __u8 bDescriptorSubtype; \ 165 __u8 bDescriptorSubtype; \
@@ -179,7 +171,7 @@ struct usb_ac_feature_unit_descriptor_##ch { \
179} __attribute__ ((packed)) 171} __attribute__ ((packed))
180 172
181/* 4.5.2 Class-Specific AS Interface Descriptor */ 173/* 4.5.2 Class-Specific AS Interface Descriptor */
182struct usb_as_header_descriptor { 174struct uac_as_header_descriptor {
183 __u8 bLength; /* in bytes: 7 */ 175 __u8 bLength; /* in bytes: 7 */
184 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 176 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
185 __u8 bDescriptorSubtype; /* AS_GENERAL */ 177 __u8 bDescriptorSubtype; /* AS_GENERAL */
@@ -188,16 +180,17 @@ struct usb_as_header_descriptor {
188 __le16 wFormatTag; /* The Audio Data Format */ 180 __le16 wFormatTag; /* The Audio Data Format */
189} __attribute__ ((packed)); 181} __attribute__ ((packed));
190 182
191#define USB_DT_AS_HEADER_SIZE 7 183#define UAC_DT_AS_HEADER_SIZE 7
192 184
193#define USB_AS_AUDIO_FORMAT_TYPE_I_UNDEFINED 0x0 185/* Formats - A.1.1 Audio Data Format Type I Codes */
194#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM 0x1 186#define UAC_FORMAT_TYPE_I_UNDEFINED 0x0
195#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM8 0x2 187#define UAC_FORMAT_TYPE_I_PCM 0x1
196#define USB_AS_AUDIO_FORMAT_TYPE_I_IEEE_FLOAT 0x3 188#define UAC_FORMAT_TYPE_I_PCM8 0x2
197#define USB_AS_AUDIO_FORMAT_TYPE_I_ALAW 0x4 189#define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3
198#define USB_AS_AUDIO_FORMAT_TYPE_I_MULAW 0x5 190#define UAC_FORMAT_TYPE_I_ALAW 0x4
191#define UAC_FORMAT_TYPE_I_MULAW 0x5
199 192
200struct usb_as_format_type_i_continuous_descriptor { 193struct uac_format_type_i_continuous_descriptor {
201 __u8 bLength; /* in bytes: 8 + (ns * 3) */ 194 __u8 bLength; /* in bytes: 8 + (ns * 3) */
202 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 195 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
203 __u8 bDescriptorSubtype; /* FORMAT_TYPE */ 196 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
@@ -210,9 +203,9 @@ struct usb_as_format_type_i_continuous_descriptor {
210 __u8 tUpperSamFreq[3]; 203 __u8 tUpperSamFreq[3];
211} __attribute__ ((packed)); 204} __attribute__ ((packed));
212 205
213#define USB_AS_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14 206#define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14
214 207
215struct usb_as_formate_type_i_discrete_descriptor { 208struct uac_format_type_i_discrete_descriptor {
216 __u8 bLength; /* in bytes: 8 + (ns * 3) */ 209 __u8 bLength; /* in bytes: 8 + (ns * 3) */
217 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 210 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
218 __u8 bDescriptorSubtype; /* FORMAT_TYPE */ 211 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
@@ -224,8 +217,8 @@ struct usb_as_formate_type_i_discrete_descriptor {
224 __u8 tSamFreq[][3]; 217 __u8 tSamFreq[][3];
225} __attribute__ ((packed)); 218} __attribute__ ((packed));
226 219
227#define DECLARE_USB_AS_FORMAT_TYPE_I_DISCRETE_DESC(n) \ 220#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
228struct usb_as_formate_type_i_discrete_descriptor_##n { \ 221struct uac_format_type_i_discrete_descriptor_##n { \
229 __u8 bLength; \ 222 __u8 bLength; \
230 __u8 bDescriptorType; \ 223 __u8 bDescriptorType; \
231 __u8 bDescriptorSubtype; \ 224 __u8 bDescriptorSubtype; \
@@ -237,18 +230,15 @@ struct usb_as_formate_type_i_discrete_descriptor_##n { \
237 __u8 tSamFreq[n][3]; \ 230 __u8 tSamFreq[n][3]; \
238} __attribute__ ((packed)) 231} __attribute__ ((packed))
239 232
240#define USB_AS_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) 233#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
241
242#define USB_AS_FORMAT_TYPE_UNDEFINED 0x0
243#define USB_AS_FORMAT_TYPE_I 0x1
244#define USB_AS_FORMAT_TYPE_II 0x2
245#define USB_AS_FORMAT_TYPE_III 0x3
246 234
247#define USB_AS_ENDPOINT_ASYNC (1 << 2) 235/* Formats - A.2 Format Type Codes */
248#define USB_AS_ENDPOINT_ADAPTIVE (2 << 2) 236#define UAC_FORMAT_TYPE_UNDEFINED 0x0
249#define USB_AS_ENDPOINT_SYNC (3 << 2) 237#define UAC_FORMAT_TYPE_I 0x1
238#define UAC_FORMAT_TYPE_II 0x2
239#define UAC_FORMAT_TYPE_III 0x3
250 240
251struct usb_as_iso_endpoint_descriptor { 241struct uac_iso_endpoint_descriptor {
252 __u8 bLength; /* in bytes: 7 */ 242 __u8 bLength; /* in bytes: 7 */
253 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ 243 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
254 __u8 bDescriptorSubtype; /* EP_GENERAL */ 244 __u8 bDescriptorSubtype; /* EP_GENERAL */
@@ -256,30 +246,37 @@ struct usb_as_iso_endpoint_descriptor {
256 __u8 bLockDelayUnits; 246 __u8 bLockDelayUnits;
257 __le16 wLockDelay; 247 __le16 wLockDelay;
258}; 248};
259#define USB_AS_ISO_ENDPOINT_DESC_SIZE 7 249#define UAC_ISO_ENDPOINT_DESC_SIZE 7
260 250
261#define FU_CONTROL_UNDEFINED 0x00 251#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
262#define MUTE_CONTROL 0x01 252#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
263#define VOLUME_CONTROL 0x02 253#define UAC_EP_CS_ATTR_FILL_MAX 0x80
264#define BASS_CONTROL 0x03 254
265#define MID_CONTROL 0x04 255/* A.10.2 Feature Unit Control Selectors */
266#define TREBLE_CONTROL 0x05 256#define UAC_FU_CONTROL_UNDEFINED 0x00
267#define GRAPHIC_EQUALIZER_CONTROL 0x06 257#define UAC_MUTE_CONTROL 0x01
268#define AUTOMATIC_GAIN_CONTROL 0x07 258#define UAC_VOLUME_CONTROL 0x02
269#define DELAY_CONTROL 0x08 259#define UAC_BASS_CONTROL 0x03
270#define BASS_BOOST_CONTROL 0x09 260#define UAC_MID_CONTROL 0x04
271#define LOUDNESS_CONTROL 0x0a 261#define UAC_TREBLE_CONTROL 0x05
272 262#define UAC_GRAPHIC_EQUALIZER_CONTROL 0x06
273#define FU_MUTE (1 << (MUTE_CONTROL - 1)) 263#define UAC_AUTOMATIC_GAIN_CONTROL 0x07
274#define FU_VOLUME (1 << (VOLUME_CONTROL - 1)) 264#define UAC_DELAY_CONTROL 0x08
275#define FU_BASS (1 << (BASS_CONTROL - 1)) 265#define UAC_BASS_BOOST_CONTROL 0x09
276#define FU_MID (1 << (MID_CONTROL - 1)) 266#define UAC_LOUDNESS_CONTROL 0x0a
277#define FU_TREBLE (1 << (TREBLE_CONTROL - 1)) 267
278#define FU_GRAPHIC_EQ (1 << (GRAPHIC_EQUALIZER_CONTROL - 1)) 268#define UAC_FU_MUTE (1 << (UAC_MUTE_CONTROL - 1))
279#define FU_AUTO_GAIN (1 << (AUTOMATIC_GAIN_CONTROL - 1)) 269#define UAC_FU_VOLUME (1 << (UAC_VOLUME_CONTROL - 1))
280#define FU_DELAY (1 << (DELAY_CONTROL - 1)) 270#define UAC_FU_BASS (1 << (UAC_BASS_CONTROL - 1))
281#define FU_BASS_BOOST (1 << (BASS_BOOST_CONTROL - 1)) 271#define UAC_FU_MID (1 << (UAC_MID_CONTROL - 1))
282#define FU_LOUDNESS (1 << (LOUDNESS_CONTROL - 1)) 272#define UAC_FU_TREBLE (1 << (UAC_TREBLE_CONTROL - 1))
273#define UAC_FU_GRAPHIC_EQ (1 << (UAC_GRAPHIC_EQUALIZER_CONTROL - 1))
274#define UAC_FU_AUTO_GAIN (1 << (UAC_AUTOMATIC_GAIN_CONTROL - 1))
275#define UAC_FU_DELAY (1 << (UAC_DELAY_CONTROL - 1))
276#define UAC_FU_BASS_BOOST (1 << (UAC_BASS_BOOST_CONTROL - 1))
277#define UAC_FU_LOUDNESS (1 << (UAC_LOUDNESS_CONTROL - 1))
278
279#ifdef __KERNEL__
283 280
284struct usb_audio_control { 281struct usb_audio_control {
285 struct list_head list; 282 struct list_head list;
@@ -290,18 +287,6 @@ struct usb_audio_control {
290 int (*get)(struct usb_audio_control *con, u8 cmd); 287 int (*get)(struct usb_audio_control *con, u8 cmd);
291}; 288};
292 289
293static inline int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value)
294{
295 con->data[cmd] = value;
296
297 return 0;
298}
299
300static inline int generic_get_cmd(struct usb_audio_control *con, u8 cmd)
301{
302 return con->data[cmd];
303}
304
305struct usb_audio_control_selector { 290struct usb_audio_control_selector {
306 struct list_head list; 291 struct list_head list;
307 struct list_head control; 292 struct list_head control;
@@ -311,4 +296,6 @@ struct usb_audio_control_selector {
311 struct usb_descriptor_header *desc; 296 struct usb_descriptor_header *desc;
312}; 297};
313 298
299#endif /* __KERNEL__ */
300
314#endif /* __LINUX_USB_AUDIO_H */ 301#endif /* __LINUX_USB_AUDIO_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 93223638f702..94012e649d86 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -258,6 +258,8 @@ struct usb_device_descriptor {
258#define USB_CLASS_APP_SPEC 0xfe 258#define USB_CLASS_APP_SPEC 0xfe
259#define USB_CLASS_VENDOR_SPEC 0xff 259#define USB_CLASS_VENDOR_SPEC 0xff
260 260
261#define USB_SUBCLASS_VENDOR_SPEC 0xff
262
261/*-------------------------------------------------------------------------*/ 263/*-------------------------------------------------------------------------*/
262 264
263/* USB_DT_CONFIG: Configuration descriptor information. 265/* USB_DT_CONFIG: Configuration descriptor information.
@@ -348,6 +350,12 @@ struct usb_endpoint_descriptor {
348#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */ 350#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
349#define USB_ENDPOINT_DIR_MASK 0x80 351#define USB_ENDPOINT_DIR_MASK 0x80
350 352
353#define USB_ENDPOINT_SYNCTYPE 0x0c
354#define USB_ENDPOINT_SYNC_NONE (0 << 2)
355#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
356#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2)
357#define USB_ENDPOINT_SYNC_SYNC (3 << 2)
358
351#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */ 359#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
352#define USB_ENDPOINT_XFER_CONTROL 0 360#define USB_ENDPOINT_XFER_CONTROL 0
353#define USB_ENDPOINT_XFER_ISOC 1 361#define USB_ENDPOINT_XFER_ISOC 1
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index 5b88e36c9103..af4b86f3aca3 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -105,6 +105,7 @@ struct ehci_regs {
105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ 105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
106#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */ 106#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
107/* 19:16 for port testing */ 107/* 19:16 for port testing */
108#define PORT_TEST_PKT (0x4<<16) /* Port Test Control - packet test */
108#define PORT_LED_OFF (0<<14) 109#define PORT_LED_OFF (0<<14)
109#define PORT_LED_AMBER (1<<14) 110#define PORT_LED_AMBER (1<<14)
110#define PORT_LED_GREEN (2<<14) 111#define PORT_LED_GREEN (2<<14)
@@ -132,6 +133,19 @@ struct ehci_regs {
132#define USBMODE_CM_HC (3<<0) /* host controller mode */ 133#define USBMODE_CM_HC (3<<0) /* host controller mode */
133#define USBMODE_CM_IDLE (0<<0) /* idle state */ 134#define USBMODE_CM_IDLE (0<<0) /* idle state */
134 135
136/* Moorestown has some non-standard registers, partially due to the fact that
137 * its EHCI controller has both TT and LPM support. HOSTPCx are extentions to
138 * PORTSCx
139 */
140#define HOSTPC0 0x84 /* HOSTPC extension */
141#define HOSTPC_PHCD (1<<22) /* Phy clock disable */
142#define HOSTPC_PSPD (3<<25) /* Port speed detection */
143#define USBMODE_EX 0xc8 /* USB Device mode extension */
144#define USBMODE_EX_VBPS (1<<5) /* VBus Power Select On */
145#define USBMODE_EX_HC (3<<0) /* host controller mode */
146#define TXFILLTUNING 0x24 /* TX FIFO Tuning register */
147#define TXFIFO_DEFAULT (8<<16) /* FIFO burst threshold 8 */
148
135/* Appendix C, Debug port ... intended for use with special "debug devices" 149/* Appendix C, Debug port ... intended for use with special "debug devices"
136 * that can help if there's no serial console. (nonstandard enumeration.) 150 * that can help if there's no serial console. (nonstandard enumeration.)
137 */ 151 */
@@ -157,4 +171,25 @@ struct ehci_dbg_port {
157#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep)) 171#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep))
158} __attribute__ ((packed)); 172} __attribute__ ((packed));
159 173
174#ifdef CONFIG_EARLY_PRINTK_DBGP
175#include <linux/init.h>
176extern int __init early_dbgp_init(char *s);
177extern struct console early_dbgp_console;
178#endif /* CONFIG_EARLY_PRINTK_DBGP */
179
180#ifdef CONFIG_EARLY_PRINTK_DBGP
181/* Call backs from ehci host driver to ehci debug driver */
182extern int dbgp_external_startup(void);
183extern int dbgp_reset_prep(void);
184#else
185static inline int dbgp_reset_prep(void)
186{
187 return 1;
188}
189static inline int dbgp_external_startup(void)
190{
191 return -1;
192}
193#endif
194
160#endif /* __LINUX_USB_EHCI_DEF_H */ 195#endif /* __LINUX_USB_EHCI_DEF_H */
diff --git a/include/linux/usb/isp1362.h b/include/linux/usb/isp1362.h
new file mode 100644
index 000000000000..642684bb9292
--- /dev/null
+++ b/include/linux/usb/isp1362.h
@@ -0,0 +1,46 @@
1/*
2 * board initialization code should put one of these into dev->platform_data
3 * and place the isp1362 onto platform_bus.
4 */
5
6#ifndef __LINUX_USB_ISP1362_H__
7#define __LINUX_USB_ISP1362_H__
8
9struct isp1362_platform_data {
10 /* Enable internal pulldown resistors on downstream ports */
11 unsigned sel15Kres:1;
12 /* Clock cannot be stopped */
13 unsigned clknotstop:1;
14 /* On-chip overcurrent protection */
15 unsigned oc_enable:1;
16 /* INT output polarity */
17 unsigned int_act_high:1;
18 /* INT edge or level triggered */
19 unsigned int_edge_triggered:1;
20 /* DREQ output polarity */
21 unsigned dreq_act_high:1;
22 /* DACK input polarity */
23 unsigned dack_act_high:1;
24 /* chip can be resumed via H_WAKEUP pin */
25 unsigned remote_wakeup_connected:1;
26 /* Switch or not to switch (keep always powered) */
27 unsigned no_power_switching:1;
28 /* Ganged port power switching (0) or individual port power switching (1) */
29 unsigned power_switching_mode:1;
30 /* Given port_power, msec/2 after power on till power good */
31 u8 potpg;
32 /* Hardware reset set/clear */
33 void (*reset) (struct device *dev, int set);
34 /* Clock start/stop */
35 void (*clock) (struct device *dev, int start);
36 /* Inter-io delay (ns). The chip is picky about access timings; it
37 * expects at least:
38 * 110ns delay between consecutive accesses to DATA_REG,
39 * 300ns delay between access to ADDR_REG and DATA_REG (registers)
40 * 462ns delay between access to ADDR_REG and DATA_REG (buffer memory)
41 * WE MUST NOT be activated during these intervals (even without CS!)
42 */
43 void (*delay) (struct device *dev, unsigned int delay);
44};
45
46#endif
diff --git a/include/linux/usb/isp1760.h b/include/linux/usb/isp1760.h
new file mode 100644
index 000000000000..de7de53c5531
--- /dev/null
+++ b/include/linux/usb/isp1760.h
@@ -0,0 +1,18 @@
1/*
2 * board initialization should put one of these into dev->platform_data
3 * and place the isp1760 onto platform_bus named "isp1760-hcd".
4 */
5
6#ifndef __LINUX_USB_ISP1760_H
7#define __LINUX_USB_ISP1760_H
8
9struct isp1760_platform_data {
10 unsigned is_isp1761:1; /* Chip is ISP1761 */
11 unsigned bus_width_16:1; /* 16/32-bit data bus width */
12 unsigned port1_otg:1; /* Port 1 supports OTG */
13 unsigned analog_oc:1; /* Analog overcurrent */
14 unsigned dack_polarity_high:1; /* DACK active high */
15 unsigned dreq_polarity_high:1; /* DREQ active high */
16};
17
18#endif /* __LINUX_USB_ISP1760_H */
diff --git a/include/linux/usb/m66592.h b/include/linux/usb/m66592.h
new file mode 100644
index 000000000000..cda9625e7df0
--- /dev/null
+++ b/include/linux/usb/m66592.h
@@ -0,0 +1,44 @@
1/*
2 * M66592 driver platform data
3 *
4 * Copyright (C) 2009 Renesas Solutions Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 */
20
21#ifndef __LINUX_USB_M66592_H
22#define __LINUX_USB_M66592_H
23
24#define M66592_PLATDATA_XTAL_12MHZ 0x01
25#define M66592_PLATDATA_XTAL_24MHZ 0x02
26#define M66592_PLATDATA_XTAL_48MHZ 0x03
27
28struct m66592_platdata {
29 /* one = on chip controller, zero = external controller */
30 unsigned on_chip:1;
31
32 /* one = big endian, zero = little endian */
33 unsigned endian:1;
34
35 /* (external controller only) M66592_PLATDATA_XTAL_nnMHZ */
36 unsigned xtal:2;
37
38 /* (external controller only) one = 3.3V, zero = 1.5V */
39 unsigned vif:1;
40
41};
42
43#endif /* __LINUX_USB_M66592_H */
44
diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h
index e9f0384fa20c..26d216734057 100644
--- a/include/linux/usb/r8a66597.h
+++ b/include/linux/usb/r8a66597.h
@@ -28,9 +28,12 @@
28#define R8A66597_PLATDATA_XTAL_48MHZ 0x03 28#define R8A66597_PLATDATA_XTAL_48MHZ 0x03
29 29
30struct r8a66597_platdata { 30struct r8a66597_platdata {
31 /* This ops can controll port power instead of DVSTCTR register. */ 31 /* This callback can control port power instead of DVSTCTR register. */
32 void (*port_power)(int port, int power); 32 void (*port_power)(int port, int power);
33 33
34 /* set one = on chip controller, set zero = external controller */
35 unsigned on_chip:1;
36
34 /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */ 37 /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */
35 unsigned xtal:2; 38 unsigned xtal:2;
36 39
@@ -40,5 +43,373 @@ struct r8a66597_platdata {
40 /* set one = big endian, set zero = little endian */ 43 /* set one = big endian, set zero = little endian */
41 unsigned endian:1; 44 unsigned endian:1;
42}; 45};
43#endif 46
47/* Register definitions */
48#define SYSCFG0 0x00
49#define SYSCFG1 0x02
50#define SYSSTS0 0x04
51#define SYSSTS1 0x06
52#define DVSTCTR0 0x08
53#define DVSTCTR1 0x0A
54#define TESTMODE 0x0C
55#define PINCFG 0x0E
56#define DMA0CFG 0x10
57#define DMA1CFG 0x12
58#define CFIFO 0x14
59#define D0FIFO 0x18
60#define D1FIFO 0x1C
61#define CFIFOSEL 0x20
62#define CFIFOCTR 0x22
63#define CFIFOSIE 0x24
64#define D0FIFOSEL 0x28
65#define D0FIFOCTR 0x2A
66#define D1FIFOSEL 0x2C
67#define D1FIFOCTR 0x2E
68#define INTENB0 0x30
69#define INTENB1 0x32
70#define INTENB2 0x34
71#define BRDYENB 0x36
72#define NRDYENB 0x38
73#define BEMPENB 0x3A
74#define SOFCFG 0x3C
75#define INTSTS0 0x40
76#define INTSTS1 0x42
77#define INTSTS2 0x44
78#define BRDYSTS 0x46
79#define NRDYSTS 0x48
80#define BEMPSTS 0x4A
81#define FRMNUM 0x4C
82#define UFRMNUM 0x4E
83#define USBADDR 0x50
84#define USBREQ 0x54
85#define USBVAL 0x56
86#define USBINDX 0x58
87#define USBLENG 0x5A
88#define DCPCFG 0x5C
89#define DCPMAXP 0x5E
90#define DCPCTR 0x60
91#define PIPESEL 0x64
92#define PIPECFG 0x68
93#define PIPEBUF 0x6A
94#define PIPEMAXP 0x6C
95#define PIPEPERI 0x6E
96#define PIPE1CTR 0x70
97#define PIPE2CTR 0x72
98#define PIPE3CTR 0x74
99#define PIPE4CTR 0x76
100#define PIPE5CTR 0x78
101#define PIPE6CTR 0x7A
102#define PIPE7CTR 0x7C
103#define PIPE8CTR 0x7E
104#define PIPE9CTR 0x80
105#define PIPE1TRE 0x90
106#define PIPE1TRN 0x92
107#define PIPE2TRE 0x94
108#define PIPE2TRN 0x96
109#define PIPE3TRE 0x98
110#define PIPE3TRN 0x9A
111#define PIPE4TRE 0x9C
112#define PIPE4TRN 0x9E
113#define PIPE5TRE 0xA0
114#define PIPE5TRN 0xA2
115#define DEVADD0 0xD0
116#define DEVADD1 0xD2
117#define DEVADD2 0xD4
118#define DEVADD3 0xD6
119#define DEVADD4 0xD8
120#define DEVADD5 0xDA
121#define DEVADD6 0xDC
122#define DEVADD7 0xDE
123#define DEVADD8 0xE0
124#define DEVADD9 0xE2
125#define DEVADDA 0xE4
126
127/* System Configuration Control Register */
128#define XTAL 0xC000 /* b15-14: Crystal selection */
129#define XTAL48 0x8000 /* 48MHz */
130#define XTAL24 0x4000 /* 24MHz */
131#define XTAL12 0x0000 /* 12MHz */
132#define XCKE 0x2000 /* b13: External clock enable */
133#define PLLC 0x0800 /* b11: PLL control */
134#define SCKE 0x0400 /* b10: USB clock enable */
135#define PCSDIS 0x0200 /* b9: not CS wakeup */
136#define LPSME 0x0100 /* b8: Low power sleep mode */
137#define HSE 0x0080 /* b7: Hi-speed enable */
138#define DCFM 0x0040 /* b6: Controller function select */
139#define DRPD 0x0020 /* b5: D+/- pull down control */
140#define DPRPU 0x0010 /* b4: D+ pull up control */
141#define USBE 0x0001 /* b0: USB module operation enable */
142
143/* System Configuration Status Register */
144#define OVCBIT 0x8000 /* b15-14: Over-current bit */
145#define OVCMON 0xC000 /* b15-14: Over-current monitor */
146#define SOFEA 0x0020 /* b5: SOF monitor */
147#define IDMON 0x0004 /* b3: ID-pin monitor */
148#define LNST 0x0003 /* b1-0: D+, D- line status */
149#define SE1 0x0003 /* SE1 */
150#define FS_KSTS 0x0002 /* Full-Speed K State */
151#define FS_JSTS 0x0001 /* Full-Speed J State */
152#define LS_JSTS 0x0002 /* Low-Speed J State */
153#define LS_KSTS 0x0001 /* Low-Speed K State */
154#define SE0 0x0000 /* SE0 */
155
156/* Device State Control Register */
157#define EXTLP0 0x0400 /* b10: External port */
158#define VBOUT 0x0200 /* b9: VBUS output */
159#define WKUP 0x0100 /* b8: Remote wakeup */
160#define RWUPE 0x0080 /* b7: Remote wakeup sense */
161#define USBRST 0x0040 /* b6: USB reset enable */
162#define RESUME 0x0020 /* b5: Resume enable */
163#define UACT 0x0010 /* b4: USB bus enable */
164#define RHST 0x0007 /* b1-0: Reset handshake status */
165#define HSPROC 0x0004 /* HS handshake is processing */
166#define HSMODE 0x0003 /* Hi-Speed mode */
167#define FSMODE 0x0002 /* Full-Speed mode */
168#define LSMODE 0x0001 /* Low-Speed mode */
169#define UNDECID 0x0000 /* Undecided */
170
171/* Test Mode Register */
172#define UTST 0x000F /* b3-0: Test select */
173#define H_TST_PACKET 0x000C /* HOST TEST Packet */
174#define H_TST_SE0_NAK 0x000B /* HOST TEST SE0 NAK */
175#define H_TST_K 0x000A /* HOST TEST K */
176#define H_TST_J 0x0009 /* HOST TEST J */
177#define H_TST_NORMAL 0x0000 /* HOST Normal Mode */
178#define P_TST_PACKET 0x0004 /* PERI TEST Packet */
179#define P_TST_SE0_NAK 0x0003 /* PERI TEST SE0 NAK */
180#define P_TST_K 0x0002 /* PERI TEST K */
181#define P_TST_J 0x0001 /* PERI TEST J */
182#define P_TST_NORMAL 0x0000 /* PERI Normal Mode */
183
184/* Data Pin Configuration Register */
185#define LDRV 0x8000 /* b15: Drive Current Adjust */
186#define VIF1 0x0000 /* VIF = 1.8V */
187#define VIF3 0x8000 /* VIF = 3.3V */
188#define INTA 0x0001 /* b1: USB INT-pin active */
189
190/* DMAx Pin Configuration Register */
191#define DREQA 0x4000 /* b14: Dreq active select */
192#define BURST 0x2000 /* b13: Burst mode */
193#define DACKA 0x0400 /* b10: Dack active select */
194#define DFORM 0x0380 /* b9-7: DMA mode select */
195#define CPU_ADR_RD_WR 0x0000 /* Address + RD/WR mode (CPU bus) */
196#define CPU_DACK_RD_WR 0x0100 /* DACK + RD/WR mode (CPU bus) */
197#define CPU_DACK_ONLY 0x0180 /* DACK only mode (CPU bus) */
198#define SPLIT_DACK_ONLY 0x0200 /* DACK only mode (SPLIT bus) */
199#define DENDA 0x0040 /* b6: Dend active select */
200#define PKTM 0x0020 /* b5: Packet mode */
201#define DENDE 0x0010 /* b4: Dend enable */
202#define OBUS 0x0004 /* b2: OUTbus mode */
203
204/* CFIFO/DxFIFO Port Select Register */
205#define RCNT 0x8000 /* b15: Read count mode */
206#define REW 0x4000 /* b14: Buffer rewind */
207#define DCLRM 0x2000 /* b13: DMA buffer clear mode */
208#define DREQE 0x1000 /* b12: DREQ output enable */
209#define MBW_8 0x0000 /* 8bit */
210#define MBW_16 0x0400 /* 16bit */
211#define MBW_32 0x0800 /* 32bit */
212#define BIGEND 0x0100 /* b8: Big endian mode */
213#define BYTE_LITTLE 0x0000 /* little dendian */
214#define BYTE_BIG 0x0100 /* big endifan */
215#define ISEL 0x0020 /* b5: DCP FIFO port direction select */
216#define CURPIPE 0x000F /* b2-0: PIPE select */
217
218/* CFIFO/DxFIFO Port Control Register */
219#define BVAL 0x8000 /* b15: Buffer valid flag */
220#define BCLR 0x4000 /* b14: Buffer clear */
221#define FRDY 0x2000 /* b13: FIFO ready */
222#define DTLN 0x0FFF /* b11-0: FIFO received data length */
223
224/* Interrupt Enable Register 0 */
225#define VBSE 0x8000 /* b15: VBUS interrupt */
226#define RSME 0x4000 /* b14: Resume interrupt */
227#define SOFE 0x2000 /* b13: Frame update interrupt */
228#define DVSE 0x1000 /* b12: Device state transition interrupt */
229#define CTRE 0x0800 /* b11: Control transfer stage transition interrupt */
230#define BEMPE 0x0400 /* b10: Buffer empty interrupt */
231#define NRDYE 0x0200 /* b9: Buffer not ready interrupt */
232#define BRDYE 0x0100 /* b8: Buffer ready interrupt */
233
234/* Interrupt Enable Register 1 */
235#define OVRCRE 0x8000 /* b15: Over-current interrupt */
236#define BCHGE 0x4000 /* b14: USB us chenge interrupt */
237#define DTCHE 0x1000 /* b12: Detach sense interrupt */
238#define ATTCHE 0x0800 /* b11: Attach sense interrupt */
239#define EOFERRE 0x0040 /* b6: EOF error interrupt */
240#define SIGNE 0x0020 /* b5: SETUP IGNORE interrupt */
241#define SACKE 0x0010 /* b4: SETUP ACK interrupt */
242
243/* BRDY Interrupt Enable/Status Register */
244#define BRDY9 0x0200 /* b9: PIPE9 */
245#define BRDY8 0x0100 /* b8: PIPE8 */
246#define BRDY7 0x0080 /* b7: PIPE7 */
247#define BRDY6 0x0040 /* b6: PIPE6 */
248#define BRDY5 0x0020 /* b5: PIPE5 */
249#define BRDY4 0x0010 /* b4: PIPE4 */
250#define BRDY3 0x0008 /* b3: PIPE3 */
251#define BRDY2 0x0004 /* b2: PIPE2 */
252#define BRDY1 0x0002 /* b1: PIPE1 */
253#define BRDY0 0x0001 /* b1: PIPE0 */
254
255/* NRDY Interrupt Enable/Status Register */
256#define NRDY9 0x0200 /* b9: PIPE9 */
257#define NRDY8 0x0100 /* b8: PIPE8 */
258#define NRDY7 0x0080 /* b7: PIPE7 */
259#define NRDY6 0x0040 /* b6: PIPE6 */
260#define NRDY5 0x0020 /* b5: PIPE5 */
261#define NRDY4 0x0010 /* b4: PIPE4 */
262#define NRDY3 0x0008 /* b3: PIPE3 */
263#define NRDY2 0x0004 /* b2: PIPE2 */
264#define NRDY1 0x0002 /* b1: PIPE1 */
265#define NRDY0 0x0001 /* b1: PIPE0 */
266
267/* BEMP Interrupt Enable/Status Register */
268#define BEMP9 0x0200 /* b9: PIPE9 */
269#define BEMP8 0x0100 /* b8: PIPE8 */
270#define BEMP7 0x0080 /* b7: PIPE7 */
271#define BEMP6 0x0040 /* b6: PIPE6 */
272#define BEMP5 0x0020 /* b5: PIPE5 */
273#define BEMP4 0x0010 /* b4: PIPE4 */
274#define BEMP3 0x0008 /* b3: PIPE3 */
275#define BEMP2 0x0004 /* b2: PIPE2 */
276#define BEMP1 0x0002 /* b1: PIPE1 */
277#define BEMP0 0x0001 /* b0: PIPE0 */
278
279/* SOF Pin Configuration Register */
280#define TRNENSEL 0x0100 /* b8: Select transaction enable period */
281#define BRDYM 0x0040 /* b6: BRDY clear timing */
282#define INTL 0x0020 /* b5: Interrupt sense select */
283#define EDGESTS 0x0010 /* b4: */
284#define SOFMODE 0x000C /* b3-2: SOF pin select */
285#define SOF_125US 0x0008 /* SOF OUT 125us Frame Signal */
286#define SOF_1MS 0x0004 /* SOF OUT 1ms Frame Signal */
287#define SOF_DISABLE 0x0000 /* SOF OUT Disable */
288
289/* Interrupt Status Register 0 */
290#define VBINT 0x8000 /* b15: VBUS interrupt */
291#define RESM 0x4000 /* b14: Resume interrupt */
292#define SOFR 0x2000 /* b13: SOF frame update interrupt */
293#define DVST 0x1000 /* b12: Device state transition interrupt */
294#define CTRT 0x0800 /* b11: Control transfer stage transition interrupt */
295#define BEMP 0x0400 /* b10: Buffer empty interrupt */
296#define NRDY 0x0200 /* b9: Buffer not ready interrupt */
297#define BRDY 0x0100 /* b8: Buffer ready interrupt */
298#define VBSTS 0x0080 /* b7: VBUS input port */
299#define DVSQ 0x0070 /* b6-4: Device state */
300#define DS_SPD_CNFG 0x0070 /* Suspend Configured */
301#define DS_SPD_ADDR 0x0060 /* Suspend Address */
302#define DS_SPD_DFLT 0x0050 /* Suspend Default */
303#define DS_SPD_POWR 0x0040 /* Suspend Powered */
304#define DS_SUSP 0x0040 /* Suspend */
305#define DS_CNFG 0x0030 /* Configured */
306#define DS_ADDS 0x0020 /* Address */
307#define DS_DFLT 0x0010 /* Default */
308#define DS_POWR 0x0000 /* Powered */
309#define DVSQS 0x0030 /* b5-4: Device state */
310#define VALID 0x0008 /* b3: Setup packet detected flag */
311#define CTSQ 0x0007 /* b2-0: Control transfer stage */
312#define CS_SQER 0x0006 /* Sequence error */
313#define CS_WRND 0x0005 /* Control write nodata status stage */
314#define CS_WRSS 0x0004 /* Control write status stage */
315#define CS_WRDS 0x0003 /* Control write data stage */
316#define CS_RDSS 0x0002 /* Control read status stage */
317#define CS_RDDS 0x0001 /* Control read data stage */
318#define CS_IDST 0x0000 /* Idle or setup stage */
319
320/* Interrupt Status Register 1 */
321#define OVRCR 0x8000 /* b15: Over-current interrupt */
322#define BCHG 0x4000 /* b14: USB bus chenge interrupt */
323#define DTCH 0x1000 /* b12: Detach sense interrupt */
324#define ATTCH 0x0800 /* b11: Attach sense interrupt */
325#define EOFERR 0x0040 /* b6: EOF-error interrupt */
326#define SIGN 0x0020 /* b5: Setup ignore interrupt */
327#define SACK 0x0010 /* b4: Setup acknowledge interrupt */
328
329/* Frame Number Register */
330#define OVRN 0x8000 /* b15: Overrun error */
331#define CRCE 0x4000 /* b14: Received data error */
332#define FRNM 0x07FF /* b10-0: Frame number */
333
334/* Micro Frame Number Register */
335#define UFRNM 0x0007 /* b2-0: Micro frame number */
336
337/* Default Control Pipe Maxpacket Size Register */
338/* Pipe Maxpacket Size Register */
339#define DEVSEL 0xF000 /* b15-14: Device address select */
340#define MAXP 0x007F /* b6-0: Maxpacket size of default control pipe */
341
342/* Default Control Pipe Control Register */
343#define BSTS 0x8000 /* b15: Buffer status */
344#define SUREQ 0x4000 /* b14: Send USB request */
345#define CSCLR 0x2000 /* b13: complete-split status clear */
346#define CSSTS 0x1000 /* b12: complete-split status */
347#define SUREQCLR 0x0800 /* b11: stop setup request */
348#define SQCLR 0x0100 /* b8: Sequence toggle bit clear */
349#define SQSET 0x0080 /* b7: Sequence toggle bit set */
350#define SQMON 0x0040 /* b6: Sequence toggle bit monitor */
351#define PBUSY 0x0020 /* b5: pipe busy */
352#define PINGE 0x0010 /* b4: ping enable */
353#define CCPL 0x0004 /* b2: Enable control transfer complete */
354#define PID 0x0003 /* b1-0: Response PID */
355#define PID_STALL11 0x0003 /* STALL */
356#define PID_STALL 0x0002 /* STALL */
357#define PID_BUF 0x0001 /* BUF */
358#define PID_NAK 0x0000 /* NAK */
359
360/* Pipe Window Select Register */
361#define PIPENM 0x0007 /* b2-0: Pipe select */
362
363/* Pipe Configuration Register */
364#define R8A66597_TYP 0xC000 /* b15-14: Transfer type */
365#define R8A66597_ISO 0xC000 /* Isochronous */
366#define R8A66597_INT 0x8000 /* Interrupt */
367#define R8A66597_BULK 0x4000 /* Bulk */
368#define R8A66597_BFRE 0x0400 /* b10: Buffer ready interrupt mode select */
369#define R8A66597_DBLB 0x0200 /* b9: Double buffer mode select */
370#define R8A66597_CNTMD 0x0100 /* b8: Continuous transfer mode select */
371#define R8A66597_SHTNAK 0x0080 /* b7: Transfer end NAK */
372#define R8A66597_DIR 0x0010 /* b4: Transfer direction select */
373#define R8A66597_EPNUM 0x000F /* b3-0: Eendpoint number select */
374
375/* Pipe Buffer Configuration Register */
376#define BUFSIZE 0x7C00 /* b14-10: Pipe buffer size */
377#define BUFNMB 0x007F /* b6-0: Pipe buffer number */
378#define PIPE0BUF 256
379#define PIPExBUF 64
380
381/* Pipe Maxpacket Size Register */
382#define MXPS 0x07FF /* b10-0: Maxpacket size */
383
384/* Pipe Cycle Configuration Register */
385#define IFIS 0x1000 /* b12: Isochronous in-buffer flush mode select */
386#define IITV 0x0007 /* b2-0: Isochronous interval */
387
388/* Pipex Control Register */
389#define BSTS 0x8000 /* b15: Buffer status */
390#define INBUFM 0x4000 /* b14: IN buffer monitor (Only for PIPE1 to 5) */
391#define CSCLR 0x2000 /* b13: complete-split status clear */
392#define CSSTS 0x1000 /* b12: complete-split status */
393#define ATREPM 0x0400 /* b10: Auto repeat mode */
394#define ACLRM 0x0200 /* b9: Out buffer auto clear mode */
395#define SQCLR 0x0100 /* b8: Sequence toggle bit clear */
396#define SQSET 0x0080 /* b7: Sequence toggle bit set */
397#define SQMON 0x0040 /* b6: Sequence toggle bit monitor */
398#define PBUSY 0x0020 /* b5: pipe busy */
399#define PID 0x0003 /* b1-0: Response PID */
400
401/* PIPExTRE */
402#define TRENB 0x0200 /* b9: Transaction counter enable */
403#define TRCLR 0x0100 /* b8: Transaction counter clear */
404
405/* PIPExTRN */
406#define TRNCNT 0xFFFF /* b15-0: Transaction counter */
407
408/* DEVADDx */
409#define UPPHUB 0x7800
410#define HUBPORT 0x0700
411#define USBSPD 0x00C0
412#define RTPORT 0x0001
413
414#endif /* __LINUX_USB_R8A66597_H */
44 415
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 0ec50ba62139..c17eb64d7213 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -59,6 +59,7 @@ enum port_dev_state {
59 * @bulk_out_buffer: pointer to the bulk out buffer for this port. 59 * @bulk_out_buffer: pointer to the bulk out buffer for this port.
60 * @bulk_out_size: the size of the bulk_out_buffer, in bytes. 60 * @bulk_out_size: the size of the bulk_out_buffer, in bytes.
61 * @write_urb: pointer to the bulk out struct urb for this port. 61 * @write_urb: pointer to the bulk out struct urb for this port.
62 * @write_fifo: kfifo used to buffer outgoing data
62 * @write_urb_busy: port`s writing status 63 * @write_urb_busy: port`s writing status
63 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this 64 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
64 * port. 65 * port.
@@ -96,6 +97,7 @@ struct usb_serial_port {
96 unsigned char *bulk_out_buffer; 97 unsigned char *bulk_out_buffer;
97 int bulk_out_size; 98 int bulk_out_size;
98 struct urb *write_urb; 99 struct urb *write_urb;
100 struct kfifo *write_fifo;
99 int write_urb_busy; 101 int write_urb_busy;
100 __u8 bulk_out_endpointAddress; 102 __u8 bulk_out_endpointAddress;
101 103
@@ -238,9 +240,8 @@ struct usb_serial_driver {
238 int (*resume)(struct usb_serial *serial); 240 int (*resume)(struct usb_serial *serial);
239 241
240 /* serial function calls */ 242 /* serial function calls */
241 /* Called by console with tty = NULL and by tty */ 243 /* Called by console and by the tty layer */
242 int (*open)(struct tty_struct *tty, 244 int (*open)(struct tty_struct *tty, struct usb_serial_port *port);
243 struct usb_serial_port *port, struct file *filp);
244 void (*close)(struct usb_serial_port *port); 245 void (*close)(struct usb_serial_port *port);
245 int (*write)(struct tty_struct *tty, struct usb_serial_port *port, 246 int (*write)(struct tty_struct *tty, struct usb_serial_port *port,
246 const unsigned char *buf, int count); 247 const unsigned char *buf, int count);
@@ -261,6 +262,9 @@ struct usb_serial_driver {
261 be an attached tty at this point */ 262 be an attached tty at this point */
262 void (*dtr_rts)(struct usb_serial_port *port, int on); 263 void (*dtr_rts)(struct usb_serial_port *port, int on);
263 int (*carrier_raised)(struct usb_serial_port *port); 264 int (*carrier_raised)(struct usb_serial_port *port);
265 /* Called by the usb serial hooks to allow the user to rework the
266 termios state */
267 void (*init_termios)(struct tty_struct *tty);
264 /* USB events */ 268 /* USB events */
265 void (*read_int_callback)(struct urb *urb); 269 void (*read_int_callback)(struct urb *urb);
266 void (*write_int_callback)(struct urb *urb); 270 void (*write_int_callback)(struct urb *urb);
@@ -300,7 +304,7 @@ static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
300extern struct usb_serial *usb_serial_get_by_index(unsigned int minor); 304extern struct usb_serial *usb_serial_get_by_index(unsigned int minor);
301extern void usb_serial_put(struct usb_serial *serial); 305extern void usb_serial_put(struct usb_serial *serial);
302extern int usb_serial_generic_open(struct tty_struct *tty, 306extern int usb_serial_generic_open(struct tty_struct *tty,
303 struct usb_serial_port *port, struct file *filp); 307 struct usb_serial_port *port);
304extern int usb_serial_generic_write(struct tty_struct *tty, 308extern int usb_serial_generic_write(struct tty_struct *tty,
305 struct usb_serial_port *port, const unsigned char *buf, int count); 309 struct usb_serial_port *port, const unsigned char *buf, int count);
306extern void usb_serial_generic_close(struct usb_serial_port *port); 310extern void usb_serial_generic_close(struct usb_serial_port *port);
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 0044d9b4cb85..b2a7d8ba6ee3 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -77,6 +77,7 @@ struct usbdevfs_connectinfo {
77 77
78#define USBDEVFS_URB_SHORT_NOT_OK 0x01 78#define USBDEVFS_URB_SHORT_NOT_OK 0x01
79#define USBDEVFS_URB_ISO_ASAP 0x02 79#define USBDEVFS_URB_ISO_ASAP 0x02
80#define USBDEVFS_URB_BULK_CONTINUATION 0x04
80#define USBDEVFS_URB_NO_FSBR 0x20 81#define USBDEVFS_URB_NO_FSBR 0x20
81#define USBDEVFS_URB_ZERO_PACKET 0x40 82#define USBDEVFS_URB_ZERO_PACKET 0x40
82#define USBDEVFS_URB_NO_INTERRUPT 0x80 83#define USBDEVFS_URB_NO_INTERRUPT 0x80
@@ -175,4 +176,6 @@ struct usbdevfs_ioctl32 {
175#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int) 176#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)
176#define USBDEVFS_DISCONNECT _IO('U', 22) 177#define USBDEVFS_DISCONNECT _IO('U', 22)
177#define USBDEVFS_CONNECT _IO('U', 23) 178#define USBDEVFS_CONNECT _IO('U', 23)
179#define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int)
180#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int)
178#endif /* _LINUX_USBDEVICE_FS_H */ 181#endif /* _LINUX_USBDEVICE_FS_H */
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 3656b300de3a..69f39974c041 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -36,7 +36,6 @@ struct new_utsname {
36#include <linux/kref.h> 36#include <linux/kref.h>
37#include <linux/nsproxy.h> 37#include <linux/nsproxy.h>
38#include <linux/err.h> 38#include <linux/err.h>
39#include <asm/atomic.h>
40 39
41struct uts_namespace { 40struct uts_namespace {
42 struct kref kref; 41 struct kref kref;
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index e81c64af80c1..2dfaa293ae8c 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * vgaarb.c 2 * The VGA aribiter manages VGA space routing and VGA resource decode to
3 * allow multiple VGA devices to be used in a system in a safe way.
3 * 4 *
4 * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> 5 * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com> 6 * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com>
@@ -41,7 +42,7 @@
41 * interrupts at any time. 42 * interrupts at any time.
42 */ 43 */
43extern void vga_set_legacy_decoding(struct pci_dev *pdev, 44extern void vga_set_legacy_decoding(struct pci_dev *pdev,
44 unsigned int decodes); 45 unsigned int decodes);
45 46
46/** 47/**
47 * vga_get - acquire & locks VGA resources 48 * vga_get - acquire & locks VGA resources
@@ -193,8 +194,17 @@ static inline int vga_conflicts(struct pci_dev *p1, struct pci_dev *p2)
193 * They driver will get a callback when VGA arbitration is first used 194 * They driver will get a callback when VGA arbitration is first used
194 * by userspace since we some older X servers have issues. 195 * by userspace since we some older X servers have issues.
195 */ 196 */
197#if defined(CONFIG_VGA_ARB)
196int vga_client_register(struct pci_dev *pdev, void *cookie, 198int vga_client_register(struct pci_dev *pdev, void *cookie,
197 void (*irq_set_state)(void *cookie, bool state), 199 void (*irq_set_state)(void *cookie, bool state),
198 unsigned int (*set_vga_decode)(void *cookie, bool state)); 200 unsigned int (*set_vga_decode)(void *cookie, bool state));
201#else
202static inline int vga_client_register(struct pci_dev *pdev, void *cookie,
203 void (*irq_set_state)(void *cookie, bool state),
204 unsigned int (*set_vga_decode)(void *cookie, bool state))
205{
206 return 0;
207}
208#endif
199 209
200#endif /* LINUX_VGA_H */ 210#endif /* LINUX_VGA_H */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 3689d7d81fe9..b59e78c57161 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -910,9 +910,10 @@ enum v4l2_colorfx {
910 V4L2_COLORFX_SEPIA = 2, 910 V4L2_COLORFX_SEPIA = 2,
911}; 911};
912#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) 912#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
913#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
913 914
914/* last CID + 1 */ 915/* last CID + 1 */
915#define V4L2_CID_LASTP1 (V4L2_CID_BASE+33) 916#define V4L2_CID_LASTP1 (V4L2_CID_BASE+34)
916 917
917/* MPEG-class control IDs defined by V4L2 */ 918/* MPEG-class control IDs defined by V4L2 */
918#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 919#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 4fca4f5440ba..057a2e010758 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -34,7 +34,7 @@ struct virtqueue {
34 * out_num: the number of sg readable by other side 34 * out_num: the number of sg readable by other side
35 * in_num: the number of sg which are writable (after readable ones) 35 * in_num: the number of sg which are writable (after readable ones)
36 * data: the token identifying the buffer. 36 * data: the token identifying the buffer.
37 * Returns 0 or an error. 37 * Returns remaining capacity of queue (sg segments) or a negative error.
38 * @kick: update after add_buf 38 * @kick: update after add_buf
39 * vq: the struct virtqueue 39 * vq: the struct virtqueue
40 * After one or more add_buf calls, invoke this to kick the other side. 40 * After one or more add_buf calls, invoke this to kick the other side.
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h
index b3c4a60ceeb3..ea7226a45acb 100644
--- a/include/linux/virtio_9p.h
+++ b/include/linux/virtio_9p.h
@@ -4,8 +4,6 @@
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/virtio_config.h> 5#include <linux/virtio_config.h>
6 6
7/* The ID for virtio console */
8#define VIRTIO_ID_9P 9
9/* Maximum number of virtio channels per partition (1 for now) */ 7/* Maximum number of virtio channels per partition (1 for now) */
10#define MAX_9P_CHAN 1 8#define MAX_9P_CHAN 1
11 9
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h
index 8726ff77763e..09d730085060 100644
--- a/include/linux/virtio_balloon.h
+++ b/include/linux/virtio_balloon.h
@@ -4,9 +4,6 @@
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/virtio_config.h> 5#include <linux/virtio_config.h>
6 6
7/* The ID for virtio_balloon */
8#define VIRTIO_ID_BALLOON 5
9
10/* The feature bitmap for virtio balloon */ 7/* The feature bitmap for virtio balloon */
11#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ 8#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */
12 9
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index 8dab9f2b8832..15cb666581d7 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -5,9 +5,6 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
7 7
8/* The ID for virtio_block */
9#define VIRTIO_ID_BLOCK 2
10
11/* Feature bits */ 8/* Feature bits */
12#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ 9#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
13#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ 10#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
@@ -17,6 +14,7 @@
17#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ 14#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
18#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ 15#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
19#define VIRTIO_BLK_F_IDENTIFY 8 /* ATA IDENTIFY supported */ 16#define VIRTIO_BLK_F_IDENTIFY 8 /* ATA IDENTIFY supported */
17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */
20 18
21#define VIRTIO_BLK_ID_BYTES (sizeof(__u16[256])) /* IDENTIFY DATA */ 19#define VIRTIO_BLK_ID_BYTES (sizeof(__u16[256])) /* IDENTIFY DATA */
22 20
@@ -38,6 +36,17 @@ struct virtio_blk_config {
38 __u8 identify[VIRTIO_BLK_ID_BYTES]; 36 __u8 identify[VIRTIO_BLK_ID_BYTES];
39} __attribute__((packed)); 37} __attribute__((packed));
40 38
39/*
40 * Command types
41 *
42 * Usage is a bit tricky as some bits are used as flags and some are not.
43 *
44 * Rules:
45 * VIRTIO_BLK_T_OUT may be combined with VIRTIO_BLK_T_SCSI_CMD or
46 * VIRTIO_BLK_T_BARRIER. VIRTIO_BLK_T_FLUSH is a command of its own
47 * and may not be combined with any of the other flags.
48 */
49
41/* These two define direction. */ 50/* These two define direction. */
42#define VIRTIO_BLK_T_IN 0 51#define VIRTIO_BLK_T_IN 0
43#define VIRTIO_BLK_T_OUT 1 52#define VIRTIO_BLK_T_OUT 1
@@ -45,6 +54,9 @@ struct virtio_blk_config {
45/* This bit says it's a scsi command, not an actual read or write. */ 54/* This bit says it's a scsi command, not an actual read or write. */
46#define VIRTIO_BLK_T_SCSI_CMD 2 55#define VIRTIO_BLK_T_SCSI_CMD 2
47 56
57/* Cache flush command */
58#define VIRTIO_BLK_T_FLUSH 4
59
48/* Barrier before this op. */ 60/* Barrier before this op. */
49#define VIRTIO_BLK_T_BARRIER 0x80000000 61#define VIRTIO_BLK_T_BARRIER 0x80000000
50 62
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index e547e3c8ee9a..0093dd7c1d6f 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -109,8 +109,7 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
109 unsigned int fbit) 109 unsigned int fbit)
110{ 110{
111 /* Did you forget to fix assumptions on max features? */ 111 /* Did you forget to fix assumptions on max features? */
112 if (__builtin_constant_p(fbit)) 112 MAYBE_BUILD_BUG_ON(fbit >= 32);
113 BUILD_BUG_ON(fbit >= 32);
114 113
115 if (fbit < VIRTIO_TRANSPORT_F_START) 114 if (fbit < VIRTIO_TRANSPORT_F_START)
116 virtio_check_driver_offered_feature(vdev, fbit); 115 virtio_check_driver_offered_feature(vdev, fbit);
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index dc161115ae35..b5f519806014 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -5,9 +5,6 @@
5/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so 5/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
6 * anyone can use the definitions to implement compatible drivers/servers. */ 6 * anyone can use the definitions to implement compatible drivers/servers. */
7 7
8/* The ID for virtio console */
9#define VIRTIO_ID_CONSOLE 3
10
11/* Feature bits */ 8/* Feature bits */
12#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ 9#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
13 10
diff --git a/include/linux/virtio_ids.h b/include/linux/virtio_ids.h
new file mode 100644
index 000000000000..06660c0a78d7
--- /dev/null
+++ b/include/linux/virtio_ids.h
@@ -0,0 +1,17 @@
1#ifndef _LINUX_VIRTIO_IDS_H
2#define _LINUX_VIRTIO_IDS_H
3/*
4 * Virtio IDs
5 *
6 * This header is BSD licensed so anyone can use the definitions to implement
7 * compatible drivers/servers.
8 */
9
10#define VIRTIO_ID_NET 1 /* virtio net */
11#define VIRTIO_ID_BLOCK 2 /* virtio block */
12#define VIRTIO_ID_CONSOLE 3 /* virtio console */
13#define VIRTIO_ID_RNG 4 /* virtio ring */
14#define VIRTIO_ID_BALLOON 5 /* virtio balloon */
15#define VIRTIO_ID_9P 9 /* 9p virtio console */
16
17#endif /* _LINUX_VIRTIO_IDS_H */
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index d8dd539c9f48..1f41734bbb77 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -6,9 +6,6 @@
6#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
7#include <linux/if_ether.h> 7#include <linux/if_ether.h>
8 8
9/* The ID for virtio_net */
10#define VIRTIO_ID_NET 1
11
12/* The feature bitmap for virtio net */ 9/* The feature bitmap for virtio net */
13#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */ 10#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */
14#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */ 11#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */
diff --git a/include/linux/virtio_rng.h b/include/linux/virtio_rng.h
index 1a85dab8a940..48121c3c434b 100644
--- a/include/linux/virtio_rng.h
+++ b/include/linux/virtio_rng.h
@@ -4,7 +4,4 @@
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/virtio_config.h> 5#include <linux/virtio_config.h>
6 6
7/* The ID for virtio_rng */
8#define VIRTIO_ID_RNG 4
9
10#endif /* _LINUX_VIRTIO_RNG_H */ 7#endif /* _LINUX_VIRTIO_RNG_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 81a97cf8f0a0..2d0f222388a8 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -166,15 +166,8 @@ static inline unsigned long zone_page_state(struct zone *zone,
166 return x; 166 return x;
167} 167}
168 168
169extern unsigned long global_lru_pages(void); 169extern unsigned long global_reclaimable_pages(void);
170 170extern unsigned long zone_reclaimable_pages(struct zone *zone);
171static inline unsigned long zone_lru_pages(struct zone *zone)
172{
173 return (zone_page_state(zone, NR_ACTIVE_ANON)
174 + zone_page_state(zone, NR_ACTIVE_FILE)
175 + zone_page_state(zone, NR_INACTIVE_ANON)
176 + zone_page_state(zone, NR_INACTIVE_FILE));
177}
178 171
179#ifdef CONFIG_NUMA 172#ifdef CONFIG_NUMA
180/* 173/*
@@ -210,11 +203,6 @@ extern void zone_statistics(struct zone *, struct zone *);
210 203
211#endif /* CONFIG_NUMA */ 204#endif /* CONFIG_NUMA */
212 205
213#define __add_zone_page_state(__z, __i, __d) \
214 __mod_zone_page_state(__z, __i, __d)
215#define __sub_zone_page_state(__z, __i, __d) \
216 __mod_zone_page_state(__z, __i,-(__d))
217
218#define add_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, __d) 206#define add_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, __d)
219#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d)) 207#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d))
220 208
diff --git a/include/linux/vt.h b/include/linux/vt.h
index 02c1c0288770..7afca0d72139 100644
--- a/include/linux/vt.h
+++ b/include/linux/vt.h
@@ -1,17 +1,6 @@
1#ifndef _LINUX_VT_H 1#ifndef _LINUX_VT_H
2#define _LINUX_VT_H 2#define _LINUX_VT_H
3 3
4#ifdef __KERNEL__
5struct notifier_block;
6
7struct vt_notifier_param {
8 struct vc_data *vc; /* VC on which the update happened */
9 unsigned int c; /* Printed char */
10};
11
12extern int register_vt_notifier(struct notifier_block *nb);
13extern int unregister_vt_notifier(struct notifier_block *nb);
14#endif
15 4
16/* 5/*
17 * These constants are also useful for user-level apps (e.g., VC 6 * These constants are also useful for user-level apps (e.g., VC
@@ -74,4 +63,25 @@ struct vt_consize {
74#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */ 63#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */
75#define VT_GETHIFONTMASK 0x560D /* return hi font mask */ 64#define VT_GETHIFONTMASK 0x560D /* return hi font mask */
76 65
66struct vt_event {
67 unsigned int event;
68#define VT_EVENT_SWITCH 0x0001 /* Console switch */
69#define VT_EVENT_BLANK 0x0002 /* Screen blank */
70#define VT_EVENT_UNBLANK 0x0004 /* Screen unblank */
71#define VT_EVENT_RESIZE 0x0008 /* Resize display */
72#define VT_MAX_EVENT 0x000F
73 unsigned int old; /* Old console */
74 unsigned int new; /* New console (if changing) */
75 unsigned int pad[4]; /* Padding for expansion */
76};
77
78#define VT_WAITEVENT 0x560E /* Wait for an event */
79
80struct vt_setactivate {
81 unsigned int console;
82 struct vt_mode mode;
83};
84
85#define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */
86
77#endif /* _LINUX_VT_H */ 87#endif /* _LINUX_VT_H */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 2f1113467f70..c0c4e1103a73 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -13,6 +13,7 @@
13#include <linux/console_struct.h> 13#include <linux/console_struct.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/consolemap.h> 15#include <linux/consolemap.h>
16#include <linux/notifier.h>
16 17
17/* 18/*
18 * Presently, a lot of graphics programs do not restore the contents of 19 * Presently, a lot of graphics programs do not restore the contents of
@@ -91,7 +92,8 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
91#endif 92#endif
92 93
93/* vt.c */ 94/* vt.c */
94int vt_waitactive(int vt); 95void vt_event_post(unsigned int event, unsigned int old, unsigned int new);
96int vt_waitactive(int n);
95void change_console(struct vc_data *new_vc); 97void change_console(struct vc_data *new_vc);
96void reset_vc(struct vc_data *vc); 98void reset_vc(struct vc_data *vc);
97extern int unbind_con_driver(const struct consw *csw, int first, int last, 99extern int unbind_con_driver(const struct consw *csw, int first, int last,
@@ -116,4 +118,16 @@ struct vt_spawn_console {
116}; 118};
117extern struct vt_spawn_console vt_spawn_con; 119extern struct vt_spawn_console vt_spawn_con;
118 120
121extern int vt_move_to_console(unsigned int vt, int alloc);
122
123/* Interfaces for VC notification of character events (for accessibility etc) */
124
125struct vt_notifier_param {
126 struct vc_data *vc; /* VC on which the update happened */
127 unsigned int c; /* Printed char */
128};
129
130extern int register_vt_notifier(struct notifier_block *nb);
131extern int unregister_vt_notifier(struct notifier_block *nb);
132
119#endif /* _VT_KERN_H */ 133#endif /* _VT_KERN_H */
diff --git a/include/linux/wm97xx.h b/include/linux/wm97xx.h
index 0c9878123d5f..38e8c4d9289e 100644
--- a/include/linux/wm97xx.h
+++ b/include/linux/wm97xx.h
@@ -293,6 +293,24 @@ struct wm97xx {
293 u16 suspend_mode; /* PRP in suspend mode */ 293 u16 suspend_mode; /* PRP in suspend mode */
294}; 294};
295 295
296struct wm97xx_batt_pdata {
297 int batt_aux;
298 int temp_aux;
299 int charge_gpio;
300 int min_voltage;
301 int max_voltage;
302 int batt_div;
303 int batt_mult;
304 int temp_div;
305 int temp_mult;
306 int batt_tech;
307 char *batt_name;
308};
309
310struct wm97xx_pdata {
311 struct wm97xx_batt_pdata *batt_pdata; /* battery data */
312};
313
296/* 314/*
297 * Codec GPIO access (not supported on WM9705) 315 * Codec GPIO access (not supported on WM9705)
298 * This can be used to set/get codec GPIO and Virtual GPIO status. 316 * This can be used to set/get codec GPIO and Virtual GPIO status.
diff --git a/include/linux/wm97xx_batt.h b/include/linux/wm97xx_batt.h
index 9681d1ab0e4f..a1d6419c2ff8 100644
--- a/include/linux/wm97xx_batt.h
+++ b/include/linux/wm97xx_batt.h
@@ -3,22 +3,12 @@
3 3
4#include <linux/wm97xx.h> 4#include <linux/wm97xx.h>
5 5
6struct wm97xx_batt_info { 6#warning This file will be removed soon, use wm97xx.h instead!
7 int batt_aux; 7
8 int temp_aux; 8#define wm97xx_batt_info wm97xx_batt_pdata
9 int charge_gpio;
10 int min_voltage;
11 int max_voltage;
12 int batt_div;
13 int batt_mult;
14 int temp_div;
15 int temp_mult;
16 int batt_tech;
17 char *batt_name;
18};
19 9
20#ifdef CONFIG_BATTERY_WM97XX 10#ifdef CONFIG_BATTERY_WM97XX
21void __init wm97xx_bat_set_pdata(struct wm97xx_batt_info *data); 11void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data);
22#else 12#else
23static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {} 13static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {}
24#endif 14#endif
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 6273fa97b527..7ef0c7b94f31 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -94,7 +94,7 @@ struct execute_work {
94/* 94/*
95 * initialize all of a work item in one go 95 * initialize all of a work item in one go
96 * 96 *
97 * NOTE! No point in using "atomic_long_set()": useing a direct 97 * NOTE! No point in using "atomic_long_set()": using a direct
98 * assignment of the work data initializer allows the compiler 98 * assignment of the work data initializer allows the compiler
99 * to generate better code. 99 * to generate better code.
100 */ 100 */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 75cf58666ff9..66ebddcff664 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -110,21 +110,20 @@ extern int laptop_mode;
110extern unsigned long determine_dirtyable_memory(void); 110extern unsigned long determine_dirtyable_memory(void);
111 111
112extern int dirty_background_ratio_handler(struct ctl_table *table, int write, 112extern int dirty_background_ratio_handler(struct ctl_table *table, int write,
113 struct file *filp, void __user *buffer, size_t *lenp, 113 void __user *buffer, size_t *lenp,
114 loff_t *ppos); 114 loff_t *ppos);
115extern int dirty_background_bytes_handler(struct ctl_table *table, int write, 115extern int dirty_background_bytes_handler(struct ctl_table *table, int write,
116 struct file *filp, void __user *buffer, size_t *lenp, 116 void __user *buffer, size_t *lenp,
117 loff_t *ppos); 117 loff_t *ppos);
118extern int dirty_ratio_handler(struct ctl_table *table, int write, 118extern int dirty_ratio_handler(struct ctl_table *table, int write,
119 struct file *filp, void __user *buffer, size_t *lenp, 119 void __user *buffer, size_t *lenp,
120 loff_t *ppos); 120 loff_t *ppos);
121extern int dirty_bytes_handler(struct ctl_table *table, int write, 121extern int dirty_bytes_handler(struct ctl_table *table, int write,
122 struct file *filp, void __user *buffer, size_t *lenp, 122 void __user *buffer, size_t *lenp,
123 loff_t *ppos); 123 loff_t *ppos);
124 124
125struct ctl_table; 125struct ctl_table;
126struct file; 126int dirty_writeback_centisecs_handler(struct ctl_table *, int,
127int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
128 void __user *, size_t *, loff_t *); 127 void __user *, size_t *, loff_t *);
129 128
130void get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty, 129void get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty,