aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-10-19 13:04:47 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-19 13:04:47 -0400
commit3e10e879a8c334a5927d800a3663a24d562cfa31 (patch)
tree5d18bc7e38c986a044e99aa0d0a4aff4931ec7d0 /include
parent98d9c66ab07471006fd7910cb16453581c41a3e7 (diff)
parent0cfd81031a26717fe14380d18275f8e217571615 (diff)
Merge branch 'linus' into tracing-v28-for-linus-v3
Conflicts: init/main.c kernel/module.c scripts/bootgraph.pl
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acmacros.h6
-rw-r--r--include/acpi/platform/acgcc.h2
-rw-r--r--include/asm-arm/plat-s3c/debug-macro.S75
-rw-r--r--include/asm-arm/plat-s3c/map.h40
-rw-r--r--include/asm-arm/plat-s3c/regs-adc.h60
-rw-r--r--include/asm-arm/plat-s3c/regs-serial.h232
-rw-r--r--include/asm-arm/plat-s3c/regs-timer.h115
-rw-r--r--include/asm-arm/plat-s3c/uncompress.h155
-rw-r--r--include/asm-arm/plat-s3c24xx/clock.h64
-rw-r--r--include/asm-arm/plat-s3c24xx/common-smdk.h15
-rw-r--r--include/asm-arm/plat-s3c24xx/cpu.h54
-rw-r--r--include/asm-arm/plat-s3c24xx/devs.h49
-rw-r--r--include/asm-arm/plat-s3c24xx/dma.h82
-rw-r--r--include/asm-arm/plat-s3c24xx/irq.h109
-rw-r--r--include/asm-arm/plat-s3c24xx/pm.h73
-rw-r--r--include/asm-arm/plat-s3c24xx/s3c2400.h31
-rw-r--r--include/asm-arm/plat-s3c24xx/s3c2410.h31
-rw-r--r--include/asm-arm/plat-s3c24xx/s3c2412.h29
-rw-r--r--include/asm-arm/plat-s3c24xx/s3c2440.h17
-rw-r--r--include/asm-arm/plat-s3c24xx/s3c2442.h17
-rw-r--r--include/asm-arm/plat-s3c24xx/s3c2443.h32
-rw-r--r--include/asm-cris/a.out.h26
-rw-r--r--include/asm-cris/elf.h2
-rw-r--r--include/asm-frv/elf.h2
-rw-r--r--include/asm-frv/unaligned.h2
-rw-r--r--include/asm-generic/bug.h2
-rw-r--r--include/asm-generic/gpio.h18
-rw-r--r--include/asm-generic/statfs.h65
-rw-r--r--include/asm-generic/vmlinux.lds.h10
-rw-r--r--include/asm-h8300/timer.h25
-rw-r--r--include/asm-m32r/a.out.h20
-rw-r--r--include/asm-m32r/elf.h2
-rw-r--r--include/asm-m68k/atarihw.h1
-rw-r--r--include/asm-m68k/dma-mapping.h16
-rw-r--r--include/asm-m68k/dma.h4
-rw-r--r--include/asm-m68k/elf.h2
-rw-r--r--include/asm-m68k/entry.h2
-rw-r--r--include/asm-m68k/io.h66
-rw-r--r--include/asm-m68k/pci.h47
-rw-r--r--include/asm-m68k/virtconvert.h6
-rw-r--r--include/asm-mips/cevt-r4k.h46
-rw-r--r--include/asm-mn10300/elf.h2
-rw-r--r--include/asm-parisc/a.out.h20
-rw-r--r--include/asm-parisc/elf.h2
-rw-r--r--include/asm-parisc/statfs.h55
-rw-r--r--include/asm-um/elf-i386.h2
-rw-r--r--include/asm-um/elf-ppc.h2
-rw-r--r--include/asm-um/elf-x86_64.h2
-rw-r--r--include/asm-x86/elf.h4
-rw-r--r--include/asm-x86/es7000/apic.h2
-rw-r--r--include/asm-x86/iommu.h2
-rw-r--r--include/asm-x86/kvm.h22
-rw-r--r--include/asm-x86/kvm_host.h82
-rw-r--r--include/asm-x86/msr-index.h3
-rw-r--r--include/asm-x86/page_32.h2
-rw-r--r--include/asm-x86/page_64.h1
-rw-r--r--include/asm-x86/pgtable.h7
-rw-r--r--include/asm-x86/pvclock.h1
-rw-r--r--include/asm-x86/statfs.h61
-rw-r--r--include/asm-x86/summit/apic.h2
-rw-r--r--include/asm-x86/xen/page.h4
-rw-r--r--include/asm-xtensa/a.out.h29
-rw-r--r--include/asm-xtensa/elf.h2
-rw-r--r--include/drm/drm.h63
-rw-r--r--include/drm/drmP.h249
-rw-r--r--include/drm/drm_pciids.h54
-rw-r--r--include/drm/i915_drm.h333
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/aio.h9
-rw-r--r--include/linux/auto_dev-ioctl.h157
-rw-r--r--include/linux/auto_fs4.h7
-rw-r--r--include/linux/binfmts.h5
-rw-r--r--include/linux/bio.h33
-rw-r--r--include/linux/blkdev.h16
-rw-r--r--include/linux/blktrace_api.h32
-rw-r--r--include/linux/cgroup.h3
-rw-r--r--include/linux/clk.h4
-rw-r--r--include/linux/compat.h6
-rw-r--r--include/linux/console_struct.h1
-rw-r--r--include/linux/device.h18
-rw-r--r--include/linux/dma_remapping.h157
-rw-r--r--include/linux/dmi.h41
-rw-r--r--include/linux/ds1286.h2
-rw-r--r--include/linux/dvb/frontend.h112
-rw-r--r--include/linux/dvb/version.h4
-rw-r--r--include/linux/dynamic_printk.h93
-rw-r--r--include/linux/ext2_fs.h2
-rw-r--r--include/linux/ext3_fs.h4
-rw-r--r--include/linux/ext3_jbd.h14
-rw-r--r--include/linux/firewire-cdev.h9
-rw-r--r--include/linux/fs.h65
-rw-r--r--include/linux/gameport.h7
-rw-r--r--include/linux/gpio.h3
-rw-r--r--include/linux/hid.h373
-rw-r--r--include/linux/hiddev.h46
-rw-r--r--include/linux/i2c-id.h3
-rw-r--r--include/linux/i2o.h292
-rw-r--r--include/linux/icmpv6.h6
-rw-r--r--include/linux/ide.h653
-rw-r--r--include/linux/if_ether.h2
-rw-r--r--include/linux/if_fddi.h2
-rw-r--r--include/linux/if_hippi.h2
-rw-r--r--include/linux/igmp.h2
-rw-r--r--include/linux/init.h4
-rw-r--r--include/linux/input.h15
-rw-r--r--include/linux/intel-iommu.h327
-rw-r--r--include/linux/interrupt.h23
-rw-r--r--include/linux/iommu-helper.h3
-rw-r--r--include/linux/ioport.h8
-rw-r--r--include/linux/iova.h52
-rw-r--r--include/linux/ivtv.h1
-rw-r--r--include/linux/jbd.h4
-rw-r--r--include/linux/jbd2.h13
-rw-r--r--include/linux/journal-head.h2
-rw-r--r--include/linux/kallsyms.h8
-rw-r--r--include/linux/kernel.h36
-rw-r--r--include/linux/kmod.h3
-rw-r--r--include/linux/kvm.h72
-rw-r--r--include/linux/kvm_host.h82
-rw-r--r--include/linux/lockd/bind.h11
-rw-r--r--include/linux/lockd/lockd.h137
-rw-r--r--include/linux/lockd/xdr.h2
-rw-r--r--include/linux/magic.h4
-rw-r--r--include/linux/map_to_7segment.h187
-rw-r--r--include/linux/mfd/tmio.h19
-rw-r--r--include/linux/mfd/wm8350/audio.h598
-rw-r--r--include/linux/mfd/wm8350/comparator.h167
-rw-r--r--include/linux/mfd/wm8350/core.h631
-rw-r--r--include/linux/mfd/wm8350/gpio.h342
-rw-r--r--include/linux/mfd/wm8350/pmic.h741
-rw-r--r--include/linux/mfd/wm8350/rtc.h266
-rw-r--r--include/linux/mfd/wm8350/supply.h111
-rw-r--r--include/linux/mfd/wm8350/wdt.h28
-rw-r--r--include/linux/mfd/wm8400-audio.h1186
-rw-r--r--include/linux/mfd/wm8400-private.h936
-rw-r--r--include/linux/mfd/wm8400.h40
-rw-r--r--include/linux/mod_devicetable.h59
-rw-r--r--include/linux/module.h1
-rw-r--r--include/linux/mount.h2
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/netfilter/nfnetlink.h3
-rw-r--r--include/linux/nfs_fs.h19
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/nfs_mount.h4
-rw-r--r--include/linux/nfs_xdr.h11
-rw-r--r--include/linux/nfsd/nfsd.h3
-rw-r--r--include/linux/of.h3
-rw-r--r--include/linux/parport.h2
-rw-r--r--include/linux/parser.h2
-rw-r--r--include/linux/pci_ids.h5
-rw-r--r--include/linux/pfn.h6
-rw-r--r--include/linux/pid_namespace.h6
-rw-r--r--include/linux/platform_device.h2
-rw-r--r--include/linux/pm.h2
-rw-r--r--include/linux/pnp.h6
-rw-r--r--include/linux/proc_fs.h1
-rw-r--r--include/linux/profile.h8
-rw-r--r--include/linux/quota.h2
-rw-r--r--include/linux/quotaops.h3
-rw-r--r--include/linux/raid/linear.h10
-rw-r--r--include/linux/raid/md.h32
-rw-r--r--include/linux/regulator/driver.h10
-rw-r--r--include/linux/regulator/machine.h30
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/rtmutex.h2
-rw-r--r--include/linux/smp.h4
-rw-r--r--include/linux/spi/orion_spi.h1
-rw-r--r--include/linux/sunrpc/clnt.h5
-rw-r--r--include/linux/sunrpc/svc.h19
-rw-r--r--include/linux/sunrpc/svc_rdma.h27
-rw-r--r--include/linux/sunrpc/svcsock.h5
-rw-r--r--include/linux/sunrpc/xprtrdma.h4
-rw-r--r--include/linux/swiotlb.h83
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/sysfs.h36
-rw-r--r--include/linux/task_io_accounting.h2
-rw-r--r--include/linux/telephony.h4
-rw-r--r--include/linux/time.h2
-rw-r--r--include/linux/types.h8
-rw-r--r--include/linux/usb.h7
-rw-r--r--include/linux/usb/Kbuild3
-rw-r--r--include/linux/usb/cdc.h9
-rw-r--r--include/linux/usb/composite.h11
-rw-r--r--include/linux/usb/serial.h2
-rw-r--r--include/linux/usb/tmc.h43
-rw-r--r--include/linux/usb/vstusb.h71
-rw-r--r--include/linux/videodev2.h30
-rw-r--r--include/linux/wait.h9
-rw-r--r--include/linux/writeback.h10
-rw-r--r--include/math-emu/op-2.h2
-rw-r--r--include/math-emu/op-common.h12
-rw-r--r--include/math-emu/soft-fp.h19
-rw-r--r--include/media/ir-common.h11
-rw-r--r--include/media/saa7115.h19
-rw-r--r--include/media/saa7146.h4
-rw-r--r--include/media/sh_mobile_ceu.h2
-rw-r--r--include/media/soc_camera.h3
-rw-r--r--include/media/soc_camera_platform.h11
-rw-r--r--include/media/tuner.h4
-rw-r--r--include/media/v4l2-chip-ident.h5
-rw-r--r--include/media/v4l2-common.h15
-rw-r--r--include/media/v4l2-dev.h75
-rw-r--r--include/media/v4l2-i2c-drv-legacy.h11
-rw-r--r--include/media/v4l2-i2c-drv.h11
-rw-r--r--include/media/v4l2-ioctl.h5
-rw-r--r--include/media/videobuf-dvb.h29
-rw-r--r--include/net/9p/9p.h4
-rw-r--r--include/net/bluetooth/bluetooth.h4
-rw-r--r--include/net/cipso_ipv4.h55
-rw-r--r--include/net/ieee80211.h2
-rw-r--r--include/net/ip.h2
-rw-r--r--include/net/ip_vs.h4
-rw-r--r--include/net/irda/irda.h2
-rw-r--r--include/net/mac80211.h3
-rw-r--r--include/net/ndisc.h5
-rw-r--r--include/net/netfilter/nf_nat_core.h8
-rw-r--r--include/net/netlabel.h51
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--include/pcmcia/ciscode.h2
-rw-r--r--include/pcmcia/cistpl.h38
-rw-r--r--include/pcmcia/cs.h165
-rw-r--r--include/pcmcia/cs_types.h8
-rw-r--r--include/pcmcia/device_id.h18
-rw-r--r--include/pcmcia/ds.h411
-rw-r--r--include/pcmcia/ss.h202
-rw-r--r--include/scsi/iscsi_if.h2
-rw-r--r--include/scsi/libiscsi.h15
-rw-r--r--include/scsi/scsi.h6
-rw-r--r--include/scsi/scsi_device.h10
-rw-r--r--include/scsi/scsi_transport_fc.h8
-rw-r--r--include/scsi/scsi_transport_iscsi.h5
-rw-r--r--include/sound/soc-dapm.h1
-rw-r--r--include/sound/tea575x-tuner.h1
-rw-r--r--include/video/cyblafb.h2
-rw-r--r--include/video/neomagic.h1
-rw-r--r--include/video/radeon.h23
-rw-r--r--include/video/s1d13xxxfb.h3
237 files changed, 9528 insertions, 3314 deletions
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index 57ab9e9d7593..74a9617776a8 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -467,7 +467,7 @@ struct acpi_integer_overlay {
467/* 467/*
468 * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, 468 * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
469 * define it now. This is the case where there the compiler does not support 469 * define it now. This is the case where there the compiler does not support
470 * a __FUNCTION__ macro or equivalent. 470 * a __func__ macro or equivalent.
471 */ 471 */
472#ifndef ACPI_GET_FUNCTION_NAME 472#ifndef ACPI_GET_FUNCTION_NAME
473#define ACPI_GET_FUNCTION_NAME _acpi_function_name 473#define ACPI_GET_FUNCTION_NAME _acpi_function_name
@@ -475,12 +475,12 @@ struct acpi_integer_overlay {
475 * The Name parameter should be the procedure name as a quoted string. 475 * The Name parameter should be the procedure name as a quoted string.
476 * The function name is also used by the function exit macros below. 476 * The function name is also used by the function exit macros below.
477 * Note: (const char) is used to be compatible with the debug interfaces 477 * Note: (const char) is used to be compatible with the debug interfaces
478 * and macros such as __FUNCTION__. 478 * and macros such as __func__.
479 */ 479 */
480#define ACPI_FUNCTION_NAME(name) static const char _acpi_function_name[] = #name; 480#define ACPI_FUNCTION_NAME(name) static const char _acpi_function_name[] = #name;
481 481
482#else 482#else
483/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ 483/* Compiler supports __func__ (or equivalent) -- Ignore this macro */
484 484
485#define ACPI_FUNCTION_NAME(name) 485#define ACPI_FUNCTION_NAME(name)
486#endif 486#endif
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 8996dba90cd9..8e2cdc57b197 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -46,7 +46,7 @@
46 46
47/* Function name is used for debug output. Non-ANSI, compiler-dependent */ 47/* Function name is used for debug output. Non-ANSI, compiler-dependent */
48 48
49#define ACPI_GET_FUNCTION_NAME __FUNCTION__ 49#define ACPI_GET_FUNCTION_NAME __func__
50 50
51/* 51/*
52 * This macro is used to tag functions as "printf-like" because 52 * This macro is used to tag functions as "printf-like" because
diff --git a/include/asm-arm/plat-s3c/debug-macro.S b/include/asm-arm/plat-s3c/debug-macro.S
deleted file mode 100644
index 84c40b847da8..000000000000
--- a/include/asm-arm/plat-s3c/debug-macro.S
+++ /dev/null
@@ -1,75 +0,0 @@
1/* linux/include/asm-arm/plat-s3c/debug-macro.S
2 *
3 * Copyright 2005, 2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
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 version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <asm/plat-s3c/regs-serial.h>
13
14/* The S3C2440 implementations are used by default as they are the
15 * most widely re-used */
16
17 .macro fifo_level_s3c2440 rd, rx
18 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
19 and \rd, \rd, #S3C2440_UFSTAT_TXMASK
20 .endm
21
22#ifndef fifo_level
23#define fifo_level fifo_level_s3c2410
24#endif
25
26 .macro fifo_full_s3c2440 rd, rx
27 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
28 tst \rd, #S3C2440_UFSTAT_TXFULL
29 .endm
30
31#ifndef fifo_full
32#define fifo_full fifo_full_s3c2440
33#endif
34
35 .macro senduart,rd,rx
36 strb \rd, [\rx, # S3C2410_UTXH ]
37 .endm
38
39 .macro busyuart, rd, rx
40 ldr \rd, [ \rx, # S3C2410_UFCON ]
41 tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
42 beq 1001f @
43 @ FIFO enabled...
441003:
45 fifo_full \rd, \rx
46 bne 1003b
47 b 1002f
48
491001:
50 @ busy waiting for non fifo
51 ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
52 tst \rd, #S3C2410_UTRSTAT_TXFE
53 beq 1001b
54
551002: @ exit busyuart
56 .endm
57
58 .macro waituart,rd,rx
59 ldr \rd, [ \rx, # S3C2410_UFCON ]
60 tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
61 beq 1001f @
62 @ FIFO enabled...
631003:
64 fifo_level \rd, \rx
65 teq \rd, #0
66 bne 1003b
67 b 1002f
681001:
69 @ idle waiting for non fifo
70 ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
71 tst \rd, #S3C2410_UTRSTAT_TXFE
72 beq 1001b
73
741002: @ exit busyuart
75 .endm
diff --git a/include/asm-arm/plat-s3c/map.h b/include/asm-arm/plat-s3c/map.h
deleted file mode 100644
index b84289d32a54..000000000000
--- a/include/asm-arm/plat-s3c/map.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/* linux/include/asm-arm/plat-s3c/map.h
2 *
3 * Copyright 2003, 2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C - Memory map definitions (virtual addresses)
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_PLAT_MAP_H
15#define __ASM_PLAT_MAP_H __FILE__
16
17/* Fit all our registers in at 0xF4000000 upwards, trying to use as
18 * little of the VA space as possible so vmalloc and friends have a
19 * better chance of getting memory.
20 *
21 * we try to ensure stuff like the IRQ registers are available for
22 * an single MOVS instruction (ie, only 8 bits of set data)
23 */
24
25#define S3C_ADDR_BASE (0xF4000000)
26
27#ifndef __ASSEMBLY__
28#define S3C_ADDR(x) ((void __iomem __force *)S3C_ADDR_BASE + (x))
29#else
30#define S3C_ADDR(x) (S3C_ADDR_BASE + (x))
31#endif
32
33#define S3C_VA_IRQ S3C_ADDR(0x00000000) /* irq controller(s) */
34#define S3C_VA_SYS S3C_ADDR(0x00100000) /* system control */
35#define S3C_VA_MEM S3C_ADDR(0x00200000) /* system control */
36#define S3C_VA_TIMER S3C_ADDR(0x00300000) /* timer block */
37#define S3C_VA_WATCHDOG S3C_ADDR(0x00400000) /* watchdog */
38#define S3C_VA_UART S3C_ADDR(0x01000000) /* UART */
39
40#endif /* __ASM_PLAT_MAP_H */
diff --git a/include/asm-arm/plat-s3c/regs-adc.h b/include/asm-arm/plat-s3c/regs-adc.h
deleted file mode 100644
index 4323cccc86cd..000000000000
--- a/include/asm-arm/plat-s3c/regs-adc.h
+++ /dev/null
@@ -1,60 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-adc.h
2 *
3 * Copyright (c) 2004 Shannon Holland <holland@loser.net>
4 *
5 * This program is free software; yosu can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * S3C2410 ADC registers
10*/
11
12#ifndef __ASM_ARCH_REGS_ADC_H
13#define __ASM_ARCH_REGS_ADC_H "regs-adc.h"
14
15#define S3C2410_ADCREG(x) (x)
16
17#define S3C2410_ADCCON S3C2410_ADCREG(0x00)
18#define S3C2410_ADCTSC S3C2410_ADCREG(0x04)
19#define S3C2410_ADCDLY S3C2410_ADCREG(0x08)
20#define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C)
21#define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10)
22
23
24/* ADCCON Register Bits */
25#define S3C2410_ADCCON_ECFLG (1<<15)
26#define S3C2410_ADCCON_PRSCEN (1<<14)
27#define S3C2410_ADCCON_PRSCVL(x) (((x)&0xFF)<<6)
28#define S3C2410_ADCCON_PRSCVLMASK (0xFF<<6)
29#define S3C2410_ADCCON_SELMUX(x) (((x)&0x7)<<3)
30#define S3C2410_ADCCON_MUXMASK (0x7<<3)
31#define S3C2410_ADCCON_STDBM (1<<2)
32#define S3C2410_ADCCON_READ_START (1<<1)
33#define S3C2410_ADCCON_ENABLE_START (1<<0)
34#define S3C2410_ADCCON_STARTMASK (0x3<<0)
35
36
37/* ADCTSC Register Bits */
38#define S3C2410_ADCTSC_YM_SEN (1<<7)
39#define S3C2410_ADCTSC_YP_SEN (1<<6)
40#define S3C2410_ADCTSC_XM_SEN (1<<5)
41#define S3C2410_ADCTSC_XP_SEN (1<<4)
42#define S3C2410_ADCTSC_PULL_UP_DISABLE (1<<3)
43#define S3C2410_ADCTSC_AUTO_PST (1<<2)
44#define S3C2410_ADCTSC_XY_PST(x) (((x)&0x3)<<0)
45
46/* ADCDAT0 Bits */
47#define S3C2410_ADCDAT0_UPDOWN (1<<15)
48#define S3C2410_ADCDAT0_AUTO_PST (1<<14)
49#define S3C2410_ADCDAT0_XY_PST (0x3<<12)
50#define S3C2410_ADCDAT0_XPDATA_MASK (0x03FF)
51
52/* ADCDAT1 Bits */
53#define S3C2410_ADCDAT1_UPDOWN (1<<15)
54#define S3C2410_ADCDAT1_AUTO_PST (1<<14)
55#define S3C2410_ADCDAT1_XY_PST (0x3<<12)
56#define S3C2410_ADCDAT1_YPDATA_MASK (0x03FF)
57
58#endif /* __ASM_ARCH_REGS_ADC_H */
59
60
diff --git a/include/asm-arm/plat-s3c/regs-serial.h b/include/asm-arm/plat-s3c/regs-serial.h
deleted file mode 100644
index a0daa647b92c..000000000000
--- a/include/asm-arm/plat-s3c/regs-serial.h
+++ /dev/null
@@ -1,232 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-serial.h
2 *
3 * From linux/include/asm-arm/hardware/serial_s3c2410.h
4 *
5 * Internal header file for Samsung S3C2410 serial ports (UART0-2)
6 *
7 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
8 *
9 * Additional defines, (c) 2003 Simtec Electronics (linux@simtec.co.uk)
10 *
11 * Adapted from:
12 *
13 * Internal header file for MX1ADS serial ports (UART1 & 2)
14 *
15 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30*/
31
32#ifndef __ASM_ARM_REGS_SERIAL_H
33#define __ASM_ARM_REGS_SERIAL_H
34
35#define S3C24XX_VA_UART0 (S3C_VA_UART)
36#define S3C24XX_VA_UART1 (S3C_VA_UART + 0x4000 )
37#define S3C24XX_VA_UART2 (S3C_VA_UART + 0x8000 )
38#define S3C24XX_VA_UART3 (S3C_VA_UART + 0xC000 )
39
40#define S3C2410_PA_UART0 (S3C24XX_PA_UART)
41#define S3C2410_PA_UART1 (S3C24XX_PA_UART + 0x4000 )
42#define S3C2410_PA_UART2 (S3C24XX_PA_UART + 0x8000 )
43#define S3C2443_PA_UART3 (S3C24XX_PA_UART + 0xC000 )
44
45#define S3C2410_URXH (0x24)
46#define S3C2410_UTXH (0x20)
47#define S3C2410_ULCON (0x00)
48#define S3C2410_UCON (0x04)
49#define S3C2410_UFCON (0x08)
50#define S3C2410_UMCON (0x0C)
51#define S3C2410_UBRDIV (0x28)
52#define S3C2410_UTRSTAT (0x10)
53#define S3C2410_UERSTAT (0x14)
54#define S3C2410_UFSTAT (0x18)
55#define S3C2410_UMSTAT (0x1C)
56
57#define S3C2410_LCON_CFGMASK ((0xF<<3)|(0x3))
58
59#define S3C2410_LCON_CS5 (0x0)
60#define S3C2410_LCON_CS6 (0x1)
61#define S3C2410_LCON_CS7 (0x2)
62#define S3C2410_LCON_CS8 (0x3)
63#define S3C2410_LCON_CSMASK (0x3)
64
65#define S3C2410_LCON_PNONE (0x0)
66#define S3C2410_LCON_PEVEN (0x5 << 3)
67#define S3C2410_LCON_PODD (0x4 << 3)
68#define S3C2410_LCON_PMASK (0x7 << 3)
69
70#define S3C2410_LCON_STOPB (1<<2)
71#define S3C2410_LCON_IRM (1<<6)
72
73#define S3C2440_UCON_CLKMASK (3<<10)
74#define S3C2440_UCON_PCLK (0<<10)
75#define S3C2440_UCON_UCLK (1<<10)
76#define S3C2440_UCON_PCLK2 (2<<10)
77#define S3C2440_UCON_FCLK (3<<10)
78#define S3C2443_UCON_EPLL (3<<10)
79
80#define S3C2440_UCON2_FCLK_EN (1<<15)
81#define S3C2440_UCON0_DIVMASK (15 << 12)
82#define S3C2440_UCON1_DIVMASK (15 << 12)
83#define S3C2440_UCON2_DIVMASK (7 << 12)
84#define S3C2440_UCON_DIVSHIFT (12)
85
86#define S3C2412_UCON_CLKMASK (3<<10)
87#define S3C2412_UCON_UCLK (1<<10)
88#define S3C2412_UCON_USYSCLK (3<<10)
89#define S3C2412_UCON_PCLK (0<<10)
90#define S3C2412_UCON_PCLK2 (2<<10)
91
92#define S3C2410_UCON_UCLK (1<<10)
93#define S3C2410_UCON_SBREAK (1<<4)
94
95#define S3C2410_UCON_TXILEVEL (1<<9)
96#define S3C2410_UCON_RXILEVEL (1<<8)
97#define S3C2410_UCON_TXIRQMODE (1<<2)
98#define S3C2410_UCON_RXIRQMODE (1<<0)
99#define S3C2410_UCON_RXFIFO_TOI (1<<7)
100#define S3C2443_UCON_RXERR_IRQEN (1<<6)
101#define S3C2443_UCON_LOOPBACK (1<<5)
102
103#define S3C2410_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
104 S3C2410_UCON_RXILEVEL | \
105 S3C2410_UCON_TXIRQMODE | \
106 S3C2410_UCON_RXIRQMODE | \
107 S3C2410_UCON_RXFIFO_TOI)
108
109#define S3C2410_UFCON_FIFOMODE (1<<0)
110#define S3C2410_UFCON_TXTRIG0 (0<<6)
111#define S3C2410_UFCON_RXTRIG8 (1<<4)
112#define S3C2410_UFCON_RXTRIG12 (2<<4)
113
114/* S3C2440 FIFO trigger levels */
115#define S3C2440_UFCON_RXTRIG1 (0<<4)
116#define S3C2440_UFCON_RXTRIG8 (1<<4)
117#define S3C2440_UFCON_RXTRIG16 (2<<4)
118#define S3C2440_UFCON_RXTRIG32 (3<<4)
119
120#define S3C2440_UFCON_TXTRIG0 (0<<6)
121#define S3C2440_UFCON_TXTRIG16 (1<<6)
122#define S3C2440_UFCON_TXTRIG32 (2<<6)
123#define S3C2440_UFCON_TXTRIG48 (3<<6)
124
125#define S3C2410_UFCON_RESETBOTH (3<<1)
126#define S3C2410_UFCON_RESETTX (1<<2)
127#define S3C2410_UFCON_RESETRX (1<<1)
128
129#define S3C2410_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
130 S3C2410_UFCON_TXTRIG0 | \
131 S3C2410_UFCON_RXTRIG8 )
132
133#define S3C2410_UMCOM_AFC (1<<4)
134#define S3C2410_UMCOM_RTS_LOW (1<<0)
135
136#define S3C2412_UMCON_AFC_63 (0<<5) /* same as s3c2443 */
137#define S3C2412_UMCON_AFC_56 (1<<5)
138#define S3C2412_UMCON_AFC_48 (2<<5)
139#define S3C2412_UMCON_AFC_40 (3<<5)
140#define S3C2412_UMCON_AFC_32 (4<<5)
141#define S3C2412_UMCON_AFC_24 (5<<5)
142#define S3C2412_UMCON_AFC_16 (6<<5)
143#define S3C2412_UMCON_AFC_8 (7<<5)
144
145#define S3C2410_UFSTAT_TXFULL (1<<9)
146#define S3C2410_UFSTAT_RXFULL (1<<8)
147#define S3C2410_UFSTAT_TXMASK (15<<4)
148#define S3C2410_UFSTAT_TXSHIFT (4)
149#define S3C2410_UFSTAT_RXMASK (15<<0)
150#define S3C2410_UFSTAT_RXSHIFT (0)
151
152/* UFSTAT S3C2443 same as S3C2440 */
153#define S3C2440_UFSTAT_TXFULL (1<<14)
154#define S3C2440_UFSTAT_RXFULL (1<<6)
155#define S3C2440_UFSTAT_TXSHIFT (8)
156#define S3C2440_UFSTAT_RXSHIFT (0)
157#define S3C2440_UFSTAT_TXMASK (63<<8)
158#define S3C2440_UFSTAT_RXMASK (63)
159
160#define S3C2410_UTRSTAT_TXE (1<<2)
161#define S3C2410_UTRSTAT_TXFE (1<<1)
162#define S3C2410_UTRSTAT_RXDR (1<<0)
163
164#define S3C2410_UERSTAT_OVERRUN (1<<0)
165#define S3C2410_UERSTAT_FRAME (1<<2)
166#define S3C2410_UERSTAT_BREAK (1<<3)
167#define S3C2443_UERSTAT_PARITY (1<<1)
168
169#define S3C2410_UERSTAT_ANY (S3C2410_UERSTAT_OVERRUN | \
170 S3C2410_UERSTAT_FRAME | \
171 S3C2410_UERSTAT_BREAK)
172
173#define S3C2410_UMSTAT_CTS (1<<0)
174#define S3C2410_UMSTAT_DeltaCTS (1<<2)
175
176#define S3C2443_DIVSLOT (0x2C)
177
178#ifndef __ASSEMBLY__
179
180/* struct s3c24xx_uart_clksrc
181 *
182 * this structure defines a named clock source that can be used for the
183 * uart, so that the best clock can be selected for the requested baud
184 * rate.
185 *
186 * min_baud and max_baud define the range of baud-rates this clock is
187 * acceptable for, if they are both zero, it is assumed any baud rate that
188 * can be generated from this clock will be used.
189 *
190 * divisor gives the divisor from the clock to the one seen by the uart
191*/
192
193struct s3c24xx_uart_clksrc {
194 const char *name;
195 unsigned int divisor;
196 unsigned int min_baud;
197 unsigned int max_baud;
198};
199
200/* configuration structure for per-machine configurations for the
201 * serial port
202 *
203 * the pointer is setup by the machine specific initialisation from the
204 * arch/arm/mach-s3c2410/ directory.
205*/
206
207struct s3c2410_uartcfg {
208 unsigned char hwport; /* hardware port number */
209 unsigned char unused;
210 unsigned short flags;
211 upf_t uart_flags; /* default uart flags */
212
213 unsigned long ucon; /* value of ucon for port */
214 unsigned long ulcon; /* value of ulcon for port */
215 unsigned long ufcon; /* value of ufcon for port */
216
217 struct s3c24xx_uart_clksrc *clocks;
218 unsigned int clocks_size;
219};
220
221/* s3c24xx_uart_devs
222 *
223 * this is exported from the core as we cannot use driver_register(),
224 * or platform_add_device() before the console_initcall()
225*/
226
227extern struct platform_device *s3c24xx_uart_devs[3];
228
229#endif /* __ASSEMBLY__ */
230
231#endif /* __ASM_ARM_REGS_SERIAL_H */
232
diff --git a/include/asm-arm/plat-s3c/regs-timer.h b/include/asm-arm/plat-s3c/regs-timer.h
deleted file mode 100644
index cc0eedd53e38..000000000000
--- a/include/asm-arm/plat-s3c/regs-timer.h
+++ /dev/null
@@ -1,115 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-timer.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * S3C2410 Timer configuration
11*/
12
13
14#ifndef __ASM_ARCH_REGS_TIMER_H
15#define __ASM_ARCH_REGS_TIMER_H
16
17#define S3C_TIMERREG(x) (S3C_VA_TIMER + (x))
18#define S3C_TIMERREG2(tmr,reg) S3C_TIMERREG((reg)+0x0c+((tmr)*0x0c))
19
20#define S3C2410_TCFG0 S3C_TIMERREG(0x00)
21#define S3C2410_TCFG1 S3C_TIMERREG(0x04)
22#define S3C2410_TCON S3C_TIMERREG(0x08)
23
24#define S3C2410_TCFG_PRESCALER0_MASK (255<<0)
25#define S3C2410_TCFG_PRESCALER1_MASK (255<<8)
26#define S3C2410_TCFG_PRESCALER1_SHIFT (8)
27#define S3C2410_TCFG_DEADZONE_MASK (255<<16)
28#define S3C2410_TCFG_DEADZONE_SHIFT (16)
29
30#define S3C2410_TCFG1_MUX4_DIV2 (0<<16)
31#define S3C2410_TCFG1_MUX4_DIV4 (1<<16)
32#define S3C2410_TCFG1_MUX4_DIV8 (2<<16)
33#define S3C2410_TCFG1_MUX4_DIV16 (3<<16)
34#define S3C2410_TCFG1_MUX4_TCLK1 (4<<16)
35#define S3C2410_TCFG1_MUX4_MASK (15<<16)
36#define S3C2410_TCFG1_MUX4_SHIFT (16)
37
38#define S3C2410_TCFG1_MUX3_DIV2 (0<<12)
39#define S3C2410_TCFG1_MUX3_DIV4 (1<<12)
40#define S3C2410_TCFG1_MUX3_DIV8 (2<<12)
41#define S3C2410_TCFG1_MUX3_DIV16 (3<<12)
42#define S3C2410_TCFG1_MUX3_TCLK1 (4<<12)
43#define S3C2410_TCFG1_MUX3_MASK (15<<12)
44
45
46#define S3C2410_TCFG1_MUX2_DIV2 (0<<8)
47#define S3C2410_TCFG1_MUX2_DIV4 (1<<8)
48#define S3C2410_TCFG1_MUX2_DIV8 (2<<8)
49#define S3C2410_TCFG1_MUX2_DIV16 (3<<8)
50#define S3C2410_TCFG1_MUX2_TCLK1 (4<<8)
51#define S3C2410_TCFG1_MUX2_MASK (15<<8)
52
53
54#define S3C2410_TCFG1_MUX1_DIV2 (0<<4)
55#define S3C2410_TCFG1_MUX1_DIV4 (1<<4)
56#define S3C2410_TCFG1_MUX1_DIV8 (2<<4)
57#define S3C2410_TCFG1_MUX1_DIV16 (3<<4)
58#define S3C2410_TCFG1_MUX1_TCLK0 (4<<4)
59#define S3C2410_TCFG1_MUX1_MASK (15<<4)
60
61#define S3C2410_TCFG1_MUX0_DIV2 (0<<0)
62#define S3C2410_TCFG1_MUX0_DIV4 (1<<0)
63#define S3C2410_TCFG1_MUX0_DIV8 (2<<0)
64#define S3C2410_TCFG1_MUX0_DIV16 (3<<0)
65#define S3C2410_TCFG1_MUX0_TCLK0 (4<<0)
66#define S3C2410_TCFG1_MUX0_MASK (15<<0)
67
68#define S3C2410_TCFG1_MUX_DIV2 (0<<0)
69#define S3C2410_TCFG1_MUX_DIV4 (1<<0)
70#define S3C2410_TCFG1_MUX_DIV8 (2<<0)
71#define S3C2410_TCFG1_MUX_DIV16 (3<<0)
72#define S3C2410_TCFG1_MUX_TCLK (4<<0)
73#define S3C2410_TCFG1_MUX_MASK (15<<0)
74
75#define S3C2410_TCFG1_SHIFT(x) ((x) * 4)
76
77/* for each timer, we have an count buffer, an compare buffer and
78 * an observation buffer
79*/
80
81/* WARNING - timer 4 has no buffer reg, and it's observation is at +4 */
82
83#define S3C2410_TCNTB(tmr) S3C_TIMERREG2(tmr, 0x00)
84#define S3C2410_TCMPB(tmr) S3C_TIMERREG2(tmr, 0x04)
85#define S3C2410_TCNTO(tmr) S3C_TIMERREG2(tmr, (((tmr) == 4) ? 0x04 : 0x08))
86
87#define S3C2410_TCON_T4RELOAD (1<<22)
88#define S3C2410_TCON_T4MANUALUPD (1<<21)
89#define S3C2410_TCON_T4START (1<<20)
90
91#define S3C2410_TCON_T3RELOAD (1<<19)
92#define S3C2410_TCON_T3INVERT (1<<18)
93#define S3C2410_TCON_T3MANUALUPD (1<<17)
94#define S3C2410_TCON_T3START (1<<16)
95
96#define S3C2410_TCON_T2RELOAD (1<<15)
97#define S3C2410_TCON_T2INVERT (1<<14)
98#define S3C2410_TCON_T2MANUALUPD (1<<13)
99#define S3C2410_TCON_T2START (1<<12)
100
101#define S3C2410_TCON_T1RELOAD (1<<11)
102#define S3C2410_TCON_T1INVERT (1<<10)
103#define S3C2410_TCON_T1MANUALUPD (1<<9)
104#define S3C2410_TCON_T1START (1<<8)
105
106#define S3C2410_TCON_T0DEADZONE (1<<4)
107#define S3C2410_TCON_T0RELOAD (1<<3)
108#define S3C2410_TCON_T0INVERT (1<<2)
109#define S3C2410_TCON_T0MANUALUPD (1<<1)
110#define S3C2410_TCON_T0START (1<<0)
111
112#endif /* __ASM_ARCH_REGS_TIMER_H */
113
114
115
diff --git a/include/asm-arm/plat-s3c/uncompress.h b/include/asm-arm/plat-s3c/uncompress.h
deleted file mode 100644
index 19b9eda39485..000000000000
--- a/include/asm-arm/plat-s3c/uncompress.h
+++ /dev/null
@@ -1,155 +0,0 @@
1/* linux/include/asm-arm/plat-s3c/uncompress.h
2 *
3 * Copyright 2003, 2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C - uncompress code
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_PLAT_UNCOMPRESS_H
15#define __ASM_PLAT_UNCOMPRESS_H
16
17typedef unsigned int upf_t; /* cannot include linux/serial_core.h */
18
19/* uart setup */
20
21static unsigned int fifo_mask;
22static unsigned int fifo_max;
23
24/* forward declerations */
25
26static void arch_detect_cpu(void);
27
28/* defines for UART registers */
29
30#include <asm/plat-s3c/regs-serial.h>
31#include <asm/plat-s3c/regs-watchdog.h>
32
33/* working in physical space... */
34#undef S3C2410_WDOGREG
35#define S3C2410_WDOGREG(x) ((S3C24XX_PA_WATCHDOG + (x)))
36
37/* how many bytes we allow into the FIFO at a time in FIFO mode */
38#define FIFO_MAX (14)
39
40#define uart_base S3C24XX_PA_UART + (0x4000*CONFIG_S3C_LOWLEVEL_UART_PORT)
41
42static __inline__ void
43uart_wr(unsigned int reg, unsigned int val)
44{
45 volatile unsigned int *ptr;
46
47 ptr = (volatile unsigned int *)(reg + uart_base);
48 *ptr = val;
49}
50
51static __inline__ unsigned int
52uart_rd(unsigned int reg)
53{
54 volatile unsigned int *ptr;
55
56 ptr = (volatile unsigned int *)(reg + uart_base);
57 return *ptr;
58}
59
60/* we can deal with the case the UARTs are being run
61 * in FIFO mode, so that we don't hold up our execution
62 * waiting for tx to happen...
63*/
64
65static void putc(int ch)
66{
67 if (uart_rd(S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) {
68 int level;
69
70 while (1) {
71 level = uart_rd(S3C2410_UFSTAT);
72 level &= fifo_mask;
73
74 if (level < fifo_max)
75 break;
76 }
77
78 } else {
79 /* not using fifos */
80
81 while ((uart_rd(S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE) != S3C2410_UTRSTAT_TXE)
82 barrier();
83 }
84
85 /* write byte to transmission register */
86 uart_wr(S3C2410_UTXH, ch);
87}
88
89static inline void flush(void)
90{
91}
92
93#define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0)
94
95/* CONFIG_S3C_BOOT_WATCHDOG
96 *
97 * Simple boot-time watchdog setup, to reboot the system if there is
98 * any problem with the boot process
99*/
100
101#ifdef CONFIG_S3C_BOOT_WATCHDOG
102
103#define WDOG_COUNT (0xff00)
104
105static inline void arch_decomp_wdog(void)
106{
107 __raw_writel(WDOG_COUNT, S3C2410_WTCNT);
108}
109
110static void arch_decomp_wdog_start(void)
111{
112 __raw_writel(WDOG_COUNT, S3C2410_WTDAT);
113 __raw_writel(WDOG_COUNT, S3C2410_WTCNT);
114 __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x80), S3C2410_WTCON);
115}
116
117#else
118#define arch_decomp_wdog_start()
119#define arch_decomp_wdog()
120#endif
121
122#ifdef CONFIG_S3C_BOOT_ERROR_RESET
123
124static void arch_decomp_error(const char *x)
125{
126 putstr("\n\n");
127 putstr(x);
128 putstr("\n\n -- System resetting\n");
129
130 __raw_writel(0x4000, S3C2410_WTDAT);
131 __raw_writel(0x4000, S3C2410_WTCNT);
132 __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x40), S3C2410_WTCON);
133
134 while(1);
135}
136
137#define arch_error arch_decomp_error
138#endif
139
140static void error(char *err);
141
142static void
143arch_decomp_setup(void)
144{
145 /* we may need to setup the uart(s) here if we are not running
146 * on an BAST... the BAST will have left the uarts configured
147 * after calling linux.
148 */
149
150 arch_detect_cpu();
151 arch_decomp_wdog_start();
152}
153
154
155#endif /* __ASM_PLAT_UNCOMPRESS_H */
diff --git a/include/asm-arm/plat-s3c24xx/clock.h b/include/asm-arm/plat-s3c24xx/clock.h
deleted file mode 100644
index 235b753cd877..000000000000
--- a/include/asm-arm/plat-s3c24xx/clock.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/clock.h
2 * linux/arch/arm/mach-s3c2410/clock.h
3 *
4 * Copyright (c) 2004-2005 Simtec Electronics
5 * http://www.simtec.co.uk/products/SWLINUX/
6 * Written by Ben Dooks, <ben@simtec.co.uk>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13struct clk {
14 struct list_head list;
15 struct module *owner;
16 struct clk *parent;
17 const char *name;
18 int id;
19 int usage;
20 unsigned long rate;
21 unsigned long ctrlbit;
22
23 int (*enable)(struct clk *, int enable);
24 int (*set_rate)(struct clk *c, unsigned long rate);
25 unsigned long (*get_rate)(struct clk *c);
26 unsigned long (*round_rate)(struct clk *c, unsigned long rate);
27 int (*set_parent)(struct clk *c, struct clk *parent);
28};
29
30/* other clocks which may be registered by board support */
31
32extern struct clk s3c24xx_dclk0;
33extern struct clk s3c24xx_dclk1;
34extern struct clk s3c24xx_clkout0;
35extern struct clk s3c24xx_clkout1;
36extern struct clk s3c24xx_uclk;
37
38extern struct clk clk_usb_bus;
39
40/* core clock support */
41
42extern struct clk clk_f;
43extern struct clk clk_h;
44extern struct clk clk_p;
45extern struct clk clk_mpll;
46extern struct clk clk_upll;
47extern struct clk clk_xtal;
48
49/* exports for arch/arm/mach-s3c2410
50 *
51 * Please DO NOT use these outside of arch/arm/mach-s3c2410
52*/
53
54extern struct mutex clocks_mutex;
55
56extern int s3c2410_clkcon_enable(struct clk *clk, int enable);
57
58extern int s3c24xx_register_clock(struct clk *clk);
59extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks);
60
61extern int s3c24xx_setup_clocks(unsigned long xtal,
62 unsigned long fclk,
63 unsigned long hclk,
64 unsigned long pclk);
diff --git a/include/asm-arm/plat-s3c24xx/common-smdk.h b/include/asm-arm/plat-s3c24xx/common-smdk.h
deleted file mode 100644
index 58d9094c935c..000000000000
--- a/include/asm-arm/plat-s3c24xx/common-smdk.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/common-smdk.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Common code for SMDK2410 and SMDK2440 boards
7 *
8 * http://www.fluff.org/ben/smdk2440/
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15extern void smdk_machine_init(void);
diff --git a/include/asm-arm/plat-s3c24xx/cpu.h b/include/asm-arm/plat-s3c24xx/cpu.h
deleted file mode 100644
index 23e420e8bd5b..000000000000
--- a/include/asm-arm/plat-s3c24xx/cpu.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/cpu.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for S3C24XX CPU support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13/* todo - fix when rmk changes iodescs to use `void __iomem *` */
14
15#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
16
17#ifndef MHZ
18#define MHZ (1000*1000)
19#endif
20
21#define print_mhz(m) ((m) / MHZ), ((m / 1000) % 1000)
22
23/* forward declaration */
24struct s3c24xx_uart_resources;
25struct platform_device;
26struct s3c2410_uartcfg;
27struct map_desc;
28
29/* core initialisation functions */
30
31extern void s3c24xx_init_irq(void);
32
33extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
34
35extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
36
37extern void s3c24xx_init_clocks(int xtal);
38
39extern void s3c24xx_init_uartdevs(char *name,
40 struct s3c24xx_uart_resources *res,
41 struct s3c2410_uartcfg *cfg, int no);
42
43/* timer for 2410/2440 */
44
45struct sys_timer;
46extern struct sys_timer s3c24xx_timer;
47
48/* system device classes */
49
50extern struct sysdev_class s3c2410_sysclass;
51extern struct sysdev_class s3c2412_sysclass;
52extern struct sysdev_class s3c2440_sysclass;
53extern struct sysdev_class s3c2442_sysclass;
54extern struct sysdev_class s3c2443_sysclass;
diff --git a/include/asm-arm/plat-s3c24xx/devs.h b/include/asm-arm/plat-s3c24xx/devs.h
deleted file mode 100644
index badaac9d64a8..000000000000
--- a/include/asm-arm/plat-s3c24xx/devs.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/devs.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2410 standard platform devices
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12#include <linux/platform_device.h>
13
14struct s3c24xx_uart_resources {
15 struct resource *resources;
16 unsigned long nr_resources;
17};
18
19extern struct s3c24xx_uart_resources s3c2410_uart_resources[];
20
21extern struct platform_device *s3c24xx_uart_devs[];
22extern struct platform_device *s3c24xx_uart_src[];
23
24extern struct platform_device s3c_device_timer[];
25
26extern struct platform_device s3c_device_usb;
27extern struct platform_device s3c_device_lcd;
28extern struct platform_device s3c_device_wdt;
29extern struct platform_device s3c_device_i2c;
30extern struct platform_device s3c_device_iis;
31extern struct platform_device s3c_device_rtc;
32extern struct platform_device s3c_device_adc;
33extern struct platform_device s3c_device_sdi;
34extern struct platform_device s3c_device_hsmmc;
35
36extern struct platform_device s3c_device_spi0;
37extern struct platform_device s3c_device_spi1;
38
39extern struct platform_device s3c_device_nand;
40
41extern struct platform_device s3c_device_usbgadget;
42
43/* s3c2440 specific devices */
44
45#ifdef CONFIG_CPU_S3C2440
46
47extern struct platform_device s3c_device_camif;
48
49#endif
diff --git a/include/asm-arm/plat-s3c24xx/dma.h b/include/asm-arm/plat-s3c24xx/dma.h
deleted file mode 100644
index c78efe316fc8..000000000000
--- a/include/asm-arm/plat-s3c24xx/dma.h
+++ /dev/null
@@ -1,82 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/dma.h
2 *
3 * Copyright (C) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Samsung S3C24XX DMA support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13extern struct sysdev_class dma_sysclass;
14extern struct s3c2410_dma_chan s3c2410_chans[S3C2410_DMA_CHANNELS];
15
16#define DMA_CH_VALID (1<<31)
17#define DMA_CH_NEVER (1<<30)
18
19struct s3c24xx_dma_addr {
20 unsigned long from;
21 unsigned long to;
22};
23
24/* struct s3c24xx_dma_map
25 *
26 * this holds the mapping information for the channel selected
27 * to be connected to the specified device
28*/
29
30struct s3c24xx_dma_map {
31 const char *name;
32 struct s3c24xx_dma_addr hw_addr;
33
34 unsigned long channels[S3C2410_DMA_CHANNELS];
35 unsigned long channels_rx[S3C2410_DMA_CHANNELS];
36};
37
38struct s3c24xx_dma_selection {
39 struct s3c24xx_dma_map *map;
40 unsigned long map_size;
41 unsigned long dcon_mask;
42
43 void (*select)(struct s3c2410_dma_chan *chan,
44 struct s3c24xx_dma_map *map);
45
46 void (*direction)(struct s3c2410_dma_chan *chan,
47 struct s3c24xx_dma_map *map,
48 enum s3c2410_dmasrc dir);
49};
50
51extern int s3c24xx_dma_init_map(struct s3c24xx_dma_selection *sel);
52
53/* struct s3c24xx_dma_order_ch
54 *
55 * channel map for one of the `enum dma_ch` dma channels. the list
56 * entry contains a set of low-level channel numbers, orred with
57 * DMA_CH_VALID, which are checked in the order in the array.
58*/
59
60struct s3c24xx_dma_order_ch {
61 unsigned int list[S3C2410_DMA_CHANNELS]; /* list of channels */
62 unsigned int flags; /* flags */
63};
64
65/* struct s3c24xx_dma_order
66 *
67 * information provided by either the core or the board to give the
68 * dma system a hint on how to allocate channels
69*/
70
71struct s3c24xx_dma_order {
72 struct s3c24xx_dma_order_ch channels[DMACH_MAX];
73};
74
75extern int s3c24xx_dma_order_set(struct s3c24xx_dma_order *map);
76
77/* DMA init code, called from the cpu support code */
78
79extern int s3c2410_dma_init(void);
80
81extern int s3c24xx_dma_init(unsigned int channels, unsigned int irq,
82 unsigned int stride);
diff --git a/include/asm-arm/plat-s3c24xx/irq.h b/include/asm-arm/plat-s3c24xx/irq.h
deleted file mode 100644
index 45746a995343..000000000000
--- a/include/asm-arm/plat-s3c24xx/irq.h
+++ /dev/null
@@ -1,109 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/irq.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for S3C24XX CPU IRQ support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#define irqdbf(x...)
14#define irqdbf2(x...)
15
16#define EXTINT_OFF (IRQ_EINT4 - 4)
17
18/* these are exported for arch/arm/mach-* usage */
19extern struct irq_chip s3c_irq_level_chip;
20extern struct irq_chip s3c_irq_chip;
21
22static inline void
23s3c_irqsub_mask(unsigned int irqno, unsigned int parentbit,
24 int subcheck)
25{
26 unsigned long mask;
27 unsigned long submask;
28
29 submask = __raw_readl(S3C2410_INTSUBMSK);
30 mask = __raw_readl(S3C2410_INTMSK);
31
32 submask |= (1UL << (irqno - IRQ_S3CUART_RX0));
33
34 /* check to see if we need to mask the parent IRQ */
35
36 if ((submask & subcheck) == subcheck) {
37 __raw_writel(mask | parentbit, S3C2410_INTMSK);
38 }
39
40 /* write back masks */
41 __raw_writel(submask, S3C2410_INTSUBMSK);
42
43}
44
45static inline void
46s3c_irqsub_unmask(unsigned int irqno, unsigned int parentbit)
47{
48 unsigned long mask;
49 unsigned long submask;
50
51 submask = __raw_readl(S3C2410_INTSUBMSK);
52 mask = __raw_readl(S3C2410_INTMSK);
53
54 submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0));
55 mask &= ~parentbit;
56
57 /* write back masks */
58 __raw_writel(submask, S3C2410_INTSUBMSK);
59 __raw_writel(mask, S3C2410_INTMSK);
60}
61
62
63static inline void
64s3c_irqsub_maskack(unsigned int irqno, unsigned int parentmask, unsigned int group)
65{
66 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
67
68 s3c_irqsub_mask(irqno, parentmask, group);
69
70 __raw_writel(bit, S3C2410_SUBSRCPND);
71
72 /* only ack parent if we've got all the irqs (seems we must
73 * ack, all and hope that the irq system retriggers ok when
74 * the interrupt goes off again)
75 */
76
77 if (1) {
78 __raw_writel(parentmask, S3C2410_SRCPND);
79 __raw_writel(parentmask, S3C2410_INTPND);
80 }
81}
82
83static inline void
84s3c_irqsub_ack(unsigned int irqno, unsigned int parentmask, unsigned int group)
85{
86 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
87
88 __raw_writel(bit, S3C2410_SUBSRCPND);
89
90 /* only ack parent if we've got all the irqs (seems we must
91 * ack, all and hope that the irq system retriggers ok when
92 * the interrupt goes off again)
93 */
94
95 if (1) {
96 __raw_writel(parentmask, S3C2410_SRCPND);
97 __raw_writel(parentmask, S3C2410_INTPND);
98 }
99}
100
101/* exported for use in arch/arm/mach-s3c2410 */
102
103#ifdef CONFIG_PM
104extern int s3c_irq_wake(unsigned int irqno, unsigned int state);
105#else
106#define s3c_irq_wake NULL
107#endif
108
109extern int s3c_irqext_type(unsigned int irq, unsigned int type);
diff --git a/include/asm-arm/plat-s3c24xx/pm.h b/include/asm-arm/plat-s3c24xx/pm.h
deleted file mode 100644
index cc623667e48a..000000000000
--- a/include/asm-arm/plat-s3c24xx/pm.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/pm.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Written by Ben Dooks, <ben@simtec.co.uk>
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 version 2 as
8 * published by the Free Software Foundation.
9*/
10
11/* s3c2410_pm_init
12 *
13 * called from board at initialisation time to setup the power
14 * management
15*/
16
17#ifdef CONFIG_PM
18
19extern __init int s3c2410_pm_init(void);
20
21#else
22
23static inline int s3c2410_pm_init(void)
24{
25 return 0;
26}
27#endif
28
29/* configuration for the IRQ mask over sleep */
30extern unsigned long s3c_irqwake_intmask;
31extern unsigned long s3c_irqwake_eintmask;
32
33/* IRQ masks for IRQs allowed to go to sleep (see irq.c) */
34extern unsigned long s3c_irqwake_intallow;
35extern unsigned long s3c_irqwake_eintallow;
36
37/* per-cpu sleep functions */
38
39extern void (*pm_cpu_prep)(void);
40extern void (*pm_cpu_sleep)(void);
41
42/* Flags for PM Control */
43
44extern unsigned long s3c_pm_flags;
45
46/* from sleep.S */
47
48extern int s3c2410_cpu_save(unsigned long *saveblk);
49extern void s3c2410_cpu_suspend(void);
50extern void s3c2410_cpu_resume(void);
51
52extern unsigned long s3c2410_sleep_save_phys;
53
54/* sleep save info */
55
56struct sleep_save {
57 void __iomem *reg;
58 unsigned long val;
59};
60
61#define SAVE_ITEM(x) \
62 { .reg = (x) }
63
64extern void s3c2410_pm_do_save(struct sleep_save *ptr, int count);
65extern void s3c2410_pm_do_restore(struct sleep_save *ptr, int count);
66
67#ifdef CONFIG_PM
68extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state);
69extern int s3c24xx_irq_resume(struct sys_device *dev);
70#else
71#define s3c24xx_irq_suspend NULL
72#define s3c24xx_irq_resume NULL
73#endif
diff --git a/include/asm-arm/plat-s3c24xx/s3c2400.h b/include/asm-arm/plat-s3c24xx/s3c2400.h
deleted file mode 100644
index 3a5a16821af8..000000000000
--- a/include/asm-arm/plat-s3c24xx/s3c2400.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/s3c2400.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for S3C2400 cpu support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * Modifications:
13 * 09-Fev-2006 LCVR First version, based on s3c2410.h
14*/
15
16#ifdef CONFIG_CPU_S3C2400
17
18extern int s3c2400_init(void);
19
20extern void s3c2400_map_io(struct map_desc *mach_desc, int size);
21
22extern void s3c2400_init_uarts(struct s3c2410_uartcfg *cfg, int no);
23
24extern void s3c2400_init_clocks(int xtal);
25
26#else
27#define s3c2400_init_clocks NULL
28#define s3c2400_init_uarts NULL
29#define s3c2400_map_io NULL
30#define s3c2400_init NULL
31#endif
diff --git a/include/asm-arm/plat-s3c24xx/s3c2410.h b/include/asm-arm/plat-s3c24xx/s3c2410.h
deleted file mode 100644
index 3cd1ec677b3f..000000000000
--- a/include/asm-arm/plat-s3c24xx/s3c2410.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/s3c2410.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2410 machine directory
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14#ifdef CONFIG_CPU_S3C2410
15
16extern int s3c2410_init(void);
17
18extern void s3c2410_map_io(struct map_desc *mach_desc, int size);
19
20extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no);
21
22extern void s3c2410_init_clocks(int xtal);
23
24#else
25#define s3c2410_init_clocks NULL
26#define s3c2410_init_uarts NULL
27#define s3c2410_map_io NULL
28#define s3c2410_init NULL
29#endif
30
31extern int s3c2410_baseclk_add(void);
diff --git a/include/asm-arm/plat-s3c24xx/s3c2412.h b/include/asm-arm/plat-s3c24xx/s3c2412.h
deleted file mode 100644
index 3ec97685e781..000000000000
--- a/include/asm-arm/plat-s3c24xx/s3c2412.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/s3c2412.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2412 cpu support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifdef CONFIG_CPU_S3C2412
14
15extern int s3c2412_init(void);
16
17extern void s3c2412_map_io(struct map_desc *mach_desc, int size);
18
19extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no);
20
21extern void s3c2412_init_clocks(int xtal);
22
23extern int s3c2412_baseclk_add(void);
24#else
25#define s3c2412_init_clocks NULL
26#define s3c2412_init_uarts NULL
27#define s3c2412_map_io NULL
28#define s3c2412_init NULL
29#endif
diff --git a/include/asm-arm/plat-s3c24xx/s3c2440.h b/include/asm-arm/plat-s3c24xx/s3c2440.h
deleted file mode 100644
index 107853bf9481..000000000000
--- a/include/asm-arm/plat-s3c24xx/s3c2440.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/s3c2440.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2440 cpu support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifdef CONFIG_CPU_S3C2440
14extern int s3c2440_init(void);
15#else
16#define s3c2440_init NULL
17#endif
diff --git a/include/asm-arm/plat-s3c24xx/s3c2442.h b/include/asm-arm/plat-s3c24xx/s3c2442.h
deleted file mode 100644
index 451a23a2092a..000000000000
--- a/include/asm-arm/plat-s3c24xx/s3c2442.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/s3c2442.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2442 cpu support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifdef CONFIG_CPU_S3C2442
14extern int s3c2442_init(void);
15#else
16#define s3c2442_init NULL
17#endif
diff --git a/include/asm-arm/plat-s3c24xx/s3c2443.h b/include/asm-arm/plat-s3c24xx/s3c2443.h
deleted file mode 100644
index 11d83b5c84e6..000000000000
--- a/include/asm-arm/plat-s3c24xx/s3c2443.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/s3c2443.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2443 cpu support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifdef CONFIG_CPU_S3C2443
14
15struct s3c2410_uartcfg;
16
17extern int s3c2443_init(void);
18
19extern void s3c2443_map_io(struct map_desc *mach_desc, int size);
20
21extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no);
22
23extern void s3c2443_init_clocks(int xtal);
24
25extern int s3c2443_baseclk_add(void);
26
27#else
28#define s3c2443_init_clocks NULL
29#define s3c2443_init_uarts NULL
30#define s3c2443_map_io NULL
31#define s3c2443_init NULL
32#endif
diff --git a/include/asm-cris/a.out.h b/include/asm-cris/a.out.h
deleted file mode 100644
index c82e9f9b75f6..000000000000
--- a/include/asm-cris/a.out.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef __CRIS_A_OUT_H__
2#define __CRIS_A_OUT_H__
3
4/* we don't support a.out binaries on Linux/CRIS anyway, so this is
5 * not really used but still needed because binfmt_elf.c for some reason
6 * wants to know about a.out even if there is no interpreter available...
7 */
8
9struct exec
10{
11 unsigned long a_info; /* Use macros N_MAGIC, etc for access */
12 unsigned a_text; /* length of text, in bytes */
13 unsigned a_data; /* length of data, in bytes */
14 unsigned a_bss; /* length of uninitialized data area for file, in bytes */
15 unsigned a_syms; /* length of symbol table data in file, in bytes */
16 unsigned a_entry; /* start address */
17 unsigned a_trsize; /* length of relocation info for text, in bytes */
18 unsigned a_drsize; /* length of relocation info for data, in bytes */
19};
20
21
22#define N_TRSIZE(a) ((a).a_trsize)
23#define N_DRSIZE(a) ((a).a_drsize)
24#define N_SYMSIZE(a) ((a).a_syms)
25
26#endif
diff --git a/include/asm-cris/elf.h b/include/asm-cris/elf.h
index 001f64ad11e8..f0d17fbc81ba 100644
--- a/include/asm-cris/elf.h
+++ b/include/asm-cris/elf.h
@@ -88,6 +88,6 @@ typedef unsigned long elf_fpregset_t;
88 88
89#define ELF_PLATFORM (NULL) 89#define ELF_PLATFORM (NULL)
90 90
91#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 91#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
92 92
93#endif 93#endif
diff --git a/include/asm-frv/elf.h b/include/asm-frv/elf.h
index 9fb946bb7dc9..7279ec07d62e 100644
--- a/include/asm-frv/elf.h
+++ b/include/asm-frv/elf.h
@@ -137,6 +137,6 @@ do { \
137 137
138#define ELF_PLATFORM (NULL) 138#define ELF_PLATFORM (NULL)
139 139
140#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 140#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
141 141
142#endif 142#endif
diff --git a/include/asm-frv/unaligned.h b/include/asm-frv/unaligned.h
index 839a2fbffa0f..6c61c05b2e0c 100644
--- a/include/asm-frv/unaligned.h
+++ b/include/asm-frv/unaligned.h
@@ -13,7 +13,7 @@
13#define _ASM_UNALIGNED_H 13#define _ASM_UNALIGNED_H
14 14
15#include <linux/unaligned/le_byteshift.h> 15#include <linux/unaligned/le_byteshift.h>
16#include <linux/unaligned/be_byteshift.h> 16#include <linux/unaligned/be_struct.h>
17#include <linux/unaligned/generic.h> 17#include <linux/unaligned/generic.h>
18 18
19#define get_unaligned __get_unaligned_be 19#define get_unaligned __get_unaligned_be
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index edc6ba82e090..0f6dabd4b517 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -22,7 +22,7 @@ struct bug_entry {
22 22
23#ifndef HAVE_ARCH_BUG 23#ifndef HAVE_ARCH_BUG
24#define BUG() do { \ 24#define BUG() do { \
25 printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \ 25 printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
26 panic("BUG!"); \ 26 panic("BUG!"); \
27} while (0) 27} while (0)
28#endif 28#endif
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 0f99ad38b012..81797ec9ab29 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -35,11 +35,17 @@ struct module;
35 * @label: for diagnostics 35 * @label: for diagnostics
36 * @dev: optional device providing the GPIOs 36 * @dev: optional device providing the GPIOs
37 * @owner: helps prevent removal of modules exporting active GPIOs 37 * @owner: helps prevent removal of modules exporting active GPIOs
38 * @request: optional hook for chip-specific activation, such as
39 * enabling module power and clock; may sleep
40 * @free: optional hook for chip-specific deactivation, such as
41 * disabling module power and clock; may sleep
38 * @direction_input: configures signal "offset" as input, or returns error 42 * @direction_input: configures signal "offset" as input, or returns error
39 * @get: returns value for signal "offset"; for output signals this 43 * @get: returns value for signal "offset"; for output signals this
40 * returns either the value actually sensed, or zero 44 * returns either the value actually sensed, or zero
41 * @direction_output: configures signal "offset" as output, or returns error 45 * @direction_output: configures signal "offset" as output, or returns error
42 * @set: assigns output value for signal "offset" 46 * @set: assigns output value for signal "offset"
47 * @to_irq: optional hook supporting non-static gpio_to_irq() mappings;
48 * implementation may not sleep
43 * @dbg_show: optional routine to show contents in debugfs; default code 49 * @dbg_show: optional routine to show contents in debugfs; default code
44 * will be used when this is omitted, but custom code can show extra 50 * will be used when this is omitted, but custom code can show extra
45 * state (such as pullup/pulldown configuration). 51 * state (such as pullup/pulldown configuration).
@@ -61,10 +67,15 @@ struct module;
61 * is calculated by subtracting @base from the gpio number. 67 * is calculated by subtracting @base from the gpio number.
62 */ 68 */
63struct gpio_chip { 69struct gpio_chip {
64 char *label; 70 const char *label;
65 struct device *dev; 71 struct device *dev;
66 struct module *owner; 72 struct module *owner;
67 73
74 int (*request)(struct gpio_chip *chip,
75 unsigned offset);
76 void (*free)(struct gpio_chip *chip,
77 unsigned offset);
78
68 int (*direction_input)(struct gpio_chip *chip, 79 int (*direction_input)(struct gpio_chip *chip,
69 unsigned offset); 80 unsigned offset);
70 int (*get)(struct gpio_chip *chip, 81 int (*get)(struct gpio_chip *chip,
@@ -73,6 +84,10 @@ struct gpio_chip {
73 unsigned offset, int value); 84 unsigned offset, int value);
74 void (*set)(struct gpio_chip *chip, 85 void (*set)(struct gpio_chip *chip,
75 unsigned offset, int value); 86 unsigned offset, int value);
87
88 int (*to_irq)(struct gpio_chip *chip,
89 unsigned offset);
90
76 void (*dbg_show)(struct seq_file *s, 91 void (*dbg_show)(struct seq_file *s,
77 struct gpio_chip *chip); 92 struct gpio_chip *chip);
78 int base; 93 int base;
@@ -112,6 +127,7 @@ extern void __gpio_set_value(unsigned gpio, int value);
112 127
113extern int __gpio_cansleep(unsigned gpio); 128extern int __gpio_cansleep(unsigned gpio);
114 129
130extern int __gpio_to_irq(unsigned gpio);
115 131
116#ifdef CONFIG_GPIO_SYSFS 132#ifdef CONFIG_GPIO_SYSFS
117 133
diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h
index 1d01043e797d..6129d6802149 100644
--- a/include/asm-generic/statfs.h
+++ b/include/asm-generic/statfs.h
@@ -6,33 +6,64 @@
6typedef __kernel_fsid_t fsid_t; 6typedef __kernel_fsid_t fsid_t;
7#endif 7#endif
8 8
9/*
10 * Most 64-bit platforms use 'long', while most 32-bit platforms use '__u32'.
11 * Yes, they differ in signedness as well as size.
12 * Special cases can override it for themselves -- except for S390x, which
13 * is just a little too special for us. And MIPS, which I'm not touching
14 * with a 10' pole.
15 */
16#ifndef __statfs_word
17#if BITS_PER_LONG == 64
18#define __statfs_word long
19#else
20#define __statfs_word __u32
21#endif
22#endif
23
9struct statfs { 24struct statfs {
10 __u32 f_type; 25 __statfs_word f_type;
11 __u32 f_bsize; 26 __statfs_word f_bsize;
12 __u32 f_blocks; 27 __statfs_word f_blocks;
13 __u32 f_bfree; 28 __statfs_word f_bfree;
14 __u32 f_bavail; 29 __statfs_word f_bavail;
15 __u32 f_files; 30 __statfs_word f_files;
16 __u32 f_ffree; 31 __statfs_word f_ffree;
17 __kernel_fsid_t f_fsid; 32 __kernel_fsid_t f_fsid;
18 __u32 f_namelen; 33 __statfs_word f_namelen;
19 __u32 f_frsize; 34 __statfs_word f_frsize;
20 __u32 f_spare[5]; 35 __statfs_word f_spare[5];
21}; 36};
22 37
38/*
39 * ARM needs to avoid the 32-bit padding at the end, for consistency
40 * between EABI and OABI
41 */
42#ifndef ARCH_PACK_STATFS64
43#define ARCH_PACK_STATFS64
44#endif
45
23struct statfs64 { 46struct statfs64 {
24 __u32 f_type; 47 __statfs_word f_type;
25 __u32 f_bsize; 48 __statfs_word f_bsize;
26 __u64 f_blocks; 49 __u64 f_blocks;
27 __u64 f_bfree; 50 __u64 f_bfree;
28 __u64 f_bavail; 51 __u64 f_bavail;
29 __u64 f_files; 52 __u64 f_files;
30 __u64 f_ffree; 53 __u64 f_ffree;
31 __kernel_fsid_t f_fsid; 54 __kernel_fsid_t f_fsid;
32 __u32 f_namelen; 55 __statfs_word f_namelen;
33 __u32 f_frsize; 56 __statfs_word f_frsize;
34 __u32 f_spare[5]; 57 __statfs_word f_spare[5];
35}; 58} ARCH_PACK_STATFS64;
59
60/*
61 * IA64 and x86_64 need to avoid the 32-bit padding at the end,
62 * to be compatible with the i386 ABI
63 */
64#ifndef ARCH_PACK_COMPAT_STATFS64
65#define ARCH_PACK_COMPAT_STATFS64
66#endif
36 67
37struct compat_statfs64 { 68struct compat_statfs64 {
38 __u32 f_type; 69 __u32 f_type;
@@ -46,6 +77,6 @@ struct compat_statfs64 {
46 __u32 f_namelen; 77 __u32 f_namelen;
47 __u32 f_frsize; 78 __u32 f_frsize;
48 __u32 f_spare[5]; 79 __u32 f_spare[5];
49}; 80} ARCH_PACK_COMPAT_STATFS64;
50 81
51#endif 82#endif
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 838d9b2a0da1..80744606bad1 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -280,7 +280,15 @@
280 CPU_DISCARD(init.data) \ 280 CPU_DISCARD(init.data) \
281 CPU_DISCARD(init.rodata) \ 281 CPU_DISCARD(init.rodata) \
282 MEM_DISCARD(init.data) \ 282 MEM_DISCARD(init.data) \
283 MEM_DISCARD(init.rodata) 283 MEM_DISCARD(init.rodata) \
284 /* implement dynamic printk debug */ \
285 VMLINUX_SYMBOL(__start___verbose_strings) = .; \
286 *(__verbose_strings) \
287 VMLINUX_SYMBOL(__stop___verbose_strings) = .; \
288 . = ALIGN(8); \
289 VMLINUX_SYMBOL(__start___verbose) = .; \
290 *(__verbose) \
291 VMLINUX_SYMBOL(__stop___verbose) = .;
284 292
285#define INIT_TEXT \ 293#define INIT_TEXT \
286 *(.init.text) \ 294 *(.init.text) \
diff --git a/include/asm-h8300/timer.h b/include/asm-h8300/timer.h
new file mode 100644
index 000000000000..def80464d38f
--- /dev/null
+++ b/include/asm-h8300/timer.h
@@ -0,0 +1,25 @@
1#ifndef __H8300_TIMER_H
2#define __H8300_TIMER_H
3
4void h8300_timer_tick(void);
5void h8300_timer_setup(void);
6void h8300_gettod(unsigned int *year, unsigned int *mon, unsigned int *day,
7 unsigned int *hour, unsigned int *min, unsigned int *sec);
8
9#define TIMER_FREQ (CONFIG_CPU_CLOCK*10000) /* Timer input freq. */
10
11#define calc_param(cnt, div, rate, limit) \
12do { \
13 cnt = TIMER_FREQ / HZ; \
14 for (div = 0; div < ARRAY_SIZE(divide_rate); div++) { \
15 if (rate[div] == 0) \
16 continue; \
17 if ((cnt / rate[div]) > limit) \
18 break; \
19 } \
20 if (div == ARRAY_SIZE(divide_rate)) \
21 panic("Timer counter overflow"); \
22 cnt /= divide_rate[div]; \
23} while(0)
24
25#endif
diff --git a/include/asm-m32r/a.out.h b/include/asm-m32r/a.out.h
deleted file mode 100644
index ab150f5c1666..000000000000
--- a/include/asm-m32r/a.out.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_M32R_A_OUT_H
2#define _ASM_M32R_A_OUT_H
3
4struct exec
5{
6 unsigned long a_info; /* Use macros N_MAGIC, etc for access */
7 unsigned a_text; /* length of text, in bytes */
8 unsigned a_data; /* length of data, in bytes */
9 unsigned a_bss; /* length of uninitialized data area for file, in bytes */
10 unsigned a_syms; /* length of symbol table data in file, in bytes */
11 unsigned a_entry; /* start address */
12 unsigned a_trsize; /* length of relocation info for text, in bytes */
13 unsigned a_drsize; /* length of relocation info for data, in bytes */
14};
15
16#define N_TRSIZE(a) ((a).a_trsize)
17#define N_DRSIZE(a) ((a).a_drsize)
18#define N_SYMSIZE(a) ((a).a_syms)
19
20#endif /* _ASM_M32R_A_OUT_H */
diff --git a/include/asm-m32r/elf.h b/include/asm-m32r/elf.h
index 67bcd77494a5..0cc34c94bf2b 100644
--- a/include/asm-m32r/elf.h
+++ b/include/asm-m32r/elf.h
@@ -129,6 +129,6 @@ typedef elf_fpreg_t elf_fpregset_t;
129 intent than poking at uname or /proc/cpuinfo. */ 129 intent than poking at uname or /proc/cpuinfo. */
130#define ELF_PLATFORM (NULL) 130#define ELF_PLATFORM (NULL)
131 131
132#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) 132#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
133 133
134#endif /* _ASM_M32R__ELF_H */ 134#endif /* _ASM_M32R__ELF_H */
diff --git a/include/asm-m68k/atarihw.h b/include/asm-m68k/atarihw.h
index ecf007df7743..1412b4ab202f 100644
--- a/include/asm-m68k/atarihw.h
+++ b/include/asm-m68k/atarihw.h
@@ -39,7 +39,6 @@ extern int atari_dont_touch_floppy_select;
39#define MACH_IS_TT ((atari_mch_cookie >> 16) == ATARI_MCH_TT) 39#define MACH_IS_TT ((atari_mch_cookie >> 16) == ATARI_MCH_TT)
40#define MACH_IS_FALCON ((atari_mch_cookie >> 16) == ATARI_MCH_FALCON) 40#define MACH_IS_FALCON ((atari_mch_cookie >> 16) == ATARI_MCH_FALCON)
41#define MACH_IS_MEDUSA (atari_mch_type == ATARI_MACH_MEDUSA) 41#define MACH_IS_MEDUSA (atari_mch_type == ATARI_MACH_MEDUSA)
42#define MACH_IS_HADES (atari_mch_type == ATARI_MACH_HADES)
43#define MACH_IS_AB40 (atari_mch_type == ATARI_MACH_AB40) 42#define MACH_IS_AB40 (atari_mch_type == ATARI_MACH_AB40)
44 43
45/* values for atari_switches */ 44/* values for atari_switches */
diff --git a/include/asm-m68k/dma-mapping.h b/include/asm-m68k/dma-mapping.h
index 91f7944333d4..26f505488c11 100644
--- a/include/asm-m68k/dma-mapping.h
+++ b/include/asm-m68k/dma-mapping.h
@@ -74,6 +74,14 @@ extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
74extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int, 74extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int,
75 enum dma_data_direction); 75 enum dma_data_direction);
76 76
77static inline void dma_sync_single_range_for_device(struct device *dev,
78 dma_addr_t dma_handle, unsigned long offset, size_t size,
79 enum dma_data_direction direction)
80{
81 /* just sync everything for now */
82 dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
83}
84
77static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle, 85static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
78 size_t size, enum dma_data_direction dir) 86 size_t size, enum dma_data_direction dir)
79{ 87{
@@ -84,6 +92,14 @@ static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *s
84{ 92{
85} 93}
86 94
95static inline void dma_sync_single_range_for_cpu(struct device *dev,
96 dma_addr_t dma_handle, unsigned long offset, size_t size,
97 enum dma_data_direction direction)
98{
99 /* just sync everything for now */
100 dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
101}
102
87static inline int dma_mapping_error(struct device *dev, dma_addr_t handle) 103static inline int dma_mapping_error(struct device *dev, dma_addr_t handle)
88{ 104{
89 return 0; 105 return 0;
diff --git a/include/asm-m68k/dma.h b/include/asm-m68k/dma.h
index d0c9e61e57b4..4240fbc946f8 100644
--- a/include/asm-m68k/dma.h
+++ b/include/asm-m68k/dma.h
@@ -11,10 +11,6 @@
11extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */ 11extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
12extern void free_dma(unsigned int dmanr); /* release it again */ 12extern void free_dma(unsigned int dmanr); /* release it again */
13 13
14#ifdef CONFIG_PCI
15extern int isa_dma_bridge_buggy;
16#else
17#define isa_dma_bridge_buggy (0) 14#define isa_dma_bridge_buggy (0)
18#endif
19 15
20#endif /* _M68K_DMA_H */ 16#endif /* _M68K_DMA_H */
diff --git a/include/asm-m68k/elf.h b/include/asm-m68k/elf.h
index 14ea42152b97..0b0f49eb876b 100644
--- a/include/asm-m68k/elf.h
+++ b/include/asm-m68k/elf.h
@@ -114,6 +114,6 @@ typedef struct user_m68kfp_struct elf_fpregset_t;
114 114
115#define ELF_PLATFORM (NULL) 115#define ELF_PLATFORM (NULL)
116 116
117#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 117#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
118 118
119#endif 119#endif
diff --git a/include/asm-m68k/entry.h b/include/asm-m68k/entry.h
index f8f6b185d793..5202f5a5b420 100644
--- a/include/asm-m68k/entry.h
+++ b/include/asm-m68k/entry.h
@@ -31,7 +31,7 @@
31 */ 31 */
32 32
33/* the following macro is used when enabling interrupts */ 33/* the following macro is used when enabling interrupts */
34#if defined(MACH_ATARI_ONLY) && !defined(CONFIG_HADES) 34#if defined(MACH_ATARI_ONLY)
35 /* block out HSYNC on the atari */ 35 /* block out HSYNC on the atari */
36#define ALLOWINT (~0x400) 36#define ALLOWINT (~0x400)
37#define MAX_NOINT_IPL 3 37#define MAX_NOINT_IPL 3
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h
index 657187f0c7c2..9e673e3bd434 100644
--- a/include/asm-m68k/io.h
+++ b/include/asm-m68k/io.h
@@ -7,15 +7,12 @@
7 * - added skeleton for GG-II and Amiga PCMCIA 7 * - added skeleton for GG-II and Amiga PCMCIA
8 * 2/3/01 RZ: - moved a few more defs into raw_io.h 8 * 2/3/01 RZ: - moved a few more defs into raw_io.h
9 * 9 *
10 * inX/outX/readX/writeX should not be used by any driver unless it does 10 * inX/outX should not be used by any driver unless it does
11 * ISA or PCI access. Other drivers should use function defined in raw_io.h 11 * ISA access. Other drivers should use function defined in raw_io.h
12 * or define its own macros on top of these. 12 * or define its own macros on top of these.
13 * 13 *
14 * inX(),outX() are for PCI and ISA I/O 14 * inX(),outX() are for ISA I/O
15 * readX(),writeX() are for PCI memory
16 * isa_readX(),isa_writeX() are for ISA memory 15 * isa_readX(),isa_writeX() are for ISA memory
17 *
18 * moved mem{cpy,set}_*io inside CONFIG_PCI
19 */ 16 */
20 17
21#ifndef _IO_H 18#ifndef _IO_H
@@ -256,10 +253,7 @@ static inline void isa_delay(void)
256 (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) : \ 253 (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) : \
257 raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) 254 raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
258 255
259#endif /* CONFIG_ISA */
260
261 256
262#if defined(CONFIG_ISA) && !defined(CONFIG_PCI)
263#define inb isa_inb 257#define inb isa_inb
264#define inb_p isa_inb_p 258#define inb_p isa_inb_p
265#define outb isa_outb 259#define outb isa_outb
@@ -282,55 +276,9 @@ static inline void isa_delay(void)
282#define readw isa_readw 276#define readw isa_readw
283#define writeb isa_writeb 277#define writeb isa_writeb
284#define writew isa_writew 278#define writew isa_writew
285#endif /* CONFIG_ISA */
286
287#if defined(CONFIG_PCI)
288
289#define readl(addr) in_le32(addr)
290#define writel(val,addr) out_le32((addr),(val))
291
292/* those can be defined for both ISA and PCI - it won't work though */
293#define readb(addr) in_8(addr)
294#define readw(addr) in_le16(addr)
295#define writeb(val,addr) out_8((addr),(val))
296#define writew(val,addr) out_le16((addr),(val))
297 279
298#define readb_relaxed(addr) readb(addr) 280#else /* CONFIG_ISA */
299#define readw_relaxed(addr) readw(addr)
300#define readl_relaxed(addr) readl(addr)
301 281
302#ifndef CONFIG_ISA
303#define inb(port) in_8(port)
304#define outb(val,port) out_8((port),(val))
305#define inw(port) in_le16(port)
306#define outw(val,port) out_le16((port),(val))
307#define inl(port) in_le32(port)
308#define outl(val,port) out_le32((port),(val))
309
310#else
311/*
312 * kernel with both ISA and PCI compiled in, those have
313 * conflicting defs for in/out. Simply consider port < 1024
314 * ISA and everything else PCI. read,write not defined
315 * in this case
316 */
317#define inb(port) ((port)<1024 ? isa_inb(port) : in_8(port))
318#define inb_p(port) ((port)<1024 ? isa_inb_p(port) : in_8(port))
319#define inw(port) ((port)<1024 ? isa_inw(port) : in_le16(port))
320#define inw_p(port) ((port)<1024 ? isa_inw_p(port) : in_le16(port))
321#define inl(port) ((port)<1024 ? isa_inl(port) : in_le32(port))
322#define inl_p(port) ((port)<1024 ? isa_inl_p(port) : in_le32(port))
323
324#define outb(val,port) ((port)<1024 ? isa_outb((val),(port)) : out_8((port),(val)))
325#define outb_p(val,port) ((port)<1024 ? isa_outb_p((val),(port)) : out_8((port),(val)))
326#define outw(val,port) ((port)<1024 ? isa_outw((val),(port)) : out_le16((port),(val)))
327#define outw_p(val,port) ((port)<1024 ? isa_outw_p((val),(port)) : out_le16((port),(val)))
328#define outl(val,port) ((port)<1024 ? isa_outl((val),(port)) : out_le32((port),(val)))
329#define outl_p(val,port) ((port)<1024 ? isa_outl_p((val),(port)) : out_le32((port),(val)))
330#endif
331#endif /* CONFIG_PCI */
332
333#if !defined(CONFIG_ISA) && !defined(CONFIG_PCI)
334/* 282/*
335 * We need to define dummy functions for GENERIC_IOMAP support. 283 * We need to define dummy functions for GENERIC_IOMAP support.
336 */ 284 */
@@ -357,11 +305,11 @@ static inline void isa_delay(void)
357#define writeb(val,addr) out_8((addr),(val)) 305#define writeb(val,addr) out_8((addr),(val))
358#define readw(addr) in_le16(addr) 306#define readw(addr) in_le16(addr)
359#define writew(val,addr) out_le16((addr),(val)) 307#define writew(val,addr) out_le16((addr),(val))
360#endif 308
361#if !defined(CONFIG_PCI) 309#endif /* CONFIG_ISA */
310
362#define readl(addr) in_le32(addr) 311#define readl(addr) in_le32(addr)
363#define writel(val,addr) out_le32((addr),(val)) 312#define writel(val,addr) out_le32((addr),(val))
364#endif
365 313
366#define mmiowb() 314#define mmiowb()
367 315
diff --git a/include/asm-m68k/pci.h b/include/asm-m68k/pci.h
index 678cb0b52314..4ad0aea48ab4 100644
--- a/include/asm-m68k/pci.h
+++ b/include/asm-m68k/pci.h
@@ -1,52 +1,7 @@
1#ifndef _ASM_M68K_PCI_H 1#ifndef _ASM_M68K_PCI_H
2#define _ASM_M68K_PCI_H 2#define _ASM_M68K_PCI_H
3 3
4/* 4#include <asm-generic/pci-dma-compat.h>
5 * asm-m68k/pci_m68k.h - m68k specific PCI declarations.
6 *
7 * Written by Wout Klaren.
8 */
9
10#include <asm/scatterlist.h>
11
12struct pci_ops;
13
14/*
15 * Structure with hardware dependent information and functions of the
16 * PCI bus.
17 */
18
19struct pci_bus_info
20{
21 /*
22 * Resources of the PCI bus.
23 */
24
25 struct resource mem_space;
26 struct resource io_space;
27
28 /*
29 * System dependent functions.
30 */
31
32 struct pci_ops *m68k_pci_ops;
33
34 void (*fixup)(int pci_modify);
35 void (*conf_device)(struct pci_dev *dev);
36};
37
38#define pcibios_assign_all_busses() 0
39#define pcibios_scan_all_fns(a, b) 0
40
41static inline void pcibios_set_master(struct pci_dev *dev)
42{
43 /* No special bus mastering setup handling */
44}
45
46static inline void pcibios_penalize_isa_irq(int irq, int active)
47{
48 /* We don't do dynamic PCI IRQ allocation */
49}
50 5
51/* The PCI address space does equal the physical memory 6/* The PCI address space does equal the physical memory
52 * address space. The networking and block device layers use 7 * address space. The networking and block device layers use
diff --git a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h
index dea32fbc7e51..22ab05c9c52b 100644
--- a/include/asm-m68k/virtconvert.h
+++ b/include/asm-m68k/virtconvert.h
@@ -40,15 +40,9 @@ static inline void *phys_to_virt(unsigned long address)
40 40
41/* 41/*
42 * IO bus memory addresses are 1:1 with the physical address, 42 * IO bus memory addresses are 1:1 with the physical address,
43 * except on the PCI bus of the Hades.
44 */ 43 */
45#ifdef CONFIG_HADES
46#define virt_to_bus(a) (virt_to_phys(a) + (MACH_IS_HADES ? 0x80000000 : 0))
47#define bus_to_virt(a) (phys_to_virt((a) - (MACH_IS_HADES ? 0x80000000 : 0)))
48#else
49#define virt_to_bus virt_to_phys 44#define virt_to_bus virt_to_phys
50#define bus_to_virt phys_to_virt 45#define bus_to_virt phys_to_virt
51#endif
52 46
53#endif 47#endif
54#endif 48#endif
diff --git a/include/asm-mips/cevt-r4k.h b/include/asm-mips/cevt-r4k.h
deleted file mode 100644
index fa4328f9124f..000000000000
--- a/include/asm-mips/cevt-r4k.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2008 Kevin D. Kissell
7 */
8
9/*
10 * Definitions used for common event timer implementation
11 * for MIPS 4K-type processors and their MIPS MT variants.
12 * Avoids unsightly extern declarations in C files.
13 */
14#ifndef __ASM_CEVT_R4K_H
15#define __ASM_CEVT_R4K_H
16
17DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device);
18
19void mips_event_handler(struct clock_event_device *dev);
20int c0_compare_int_usable(void);
21void mips_set_clock_mode(enum clock_event_mode, struct clock_event_device *);
22irqreturn_t c0_compare_interrupt(int, void *);
23
24extern struct irqaction c0_compare_irqaction;
25extern int cp0_timer_irq_installed;
26
27/*
28 * Possibly handle a performance counter interrupt.
29 * Return true if the timer interrupt should not be checked
30 */
31
32static inline int handle_perf_irq(int r2)
33{
34 /*
35 * The performance counter overflow interrupt may be shared with the
36 * timer interrupt (cp0_perfcount_irq < 0). If it is and a
37 * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
38 * and we can't reliably determine if a counter interrupt has also
39 * happened (!r2) then don't check for a timer interrupt.
40 */
41 return (cp0_perfcount_irq < 0) &&
42 perf_irq() == IRQ_HANDLED &&
43 !r2;
44}
45
46#endif /* __ASM_CEVT_R4K_H */
diff --git a/include/asm-mn10300/elf.h b/include/asm-mn10300/elf.h
index 256a70466ca4..bf09f8bb392e 100644
--- a/include/asm-mn10300/elf.h
+++ b/include/asm-mn10300/elf.h
@@ -141,7 +141,7 @@ do { \
141#define ELF_PLATFORM (NULL) 141#define ELF_PLATFORM (NULL)
142 142
143#ifdef __KERNEL__ 143#ifdef __KERNEL__
144#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) 144#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
145#endif 145#endif
146 146
147#endif /* _ASM_ELF_H */ 147#endif /* _ASM_ELF_H */
diff --git a/include/asm-parisc/a.out.h b/include/asm-parisc/a.out.h
deleted file mode 100644
index eb04e34c5bb1..000000000000
--- a/include/asm-parisc/a.out.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef __PARISC_A_OUT_H__
2#define __PARISC_A_OUT_H__
3
4struct exec
5{
6 unsigned int a_info; /* Use macros N_MAGIC, etc for access */
7 unsigned a_text; /* length of text, in bytes */
8 unsigned a_data; /* length of data, in bytes */
9 unsigned a_bss; /* length of uninitialized data area for file, in bytes */
10 unsigned a_syms; /* length of symbol table data in file, in bytes */
11 unsigned a_entry; /* start address */
12 unsigned a_trsize; /* length of relocation info for text, in bytes */
13 unsigned a_drsize; /* length of relocation info for data, in bytes */
14};
15
16#define N_TRSIZE(a) ((a).a_trsize)
17#define N_DRSIZE(a) ((a).a_drsize)
18#define N_SYMSIZE(a) ((a).a_syms)
19
20#endif /* __A_OUT_GNU_H__ */
diff --git a/include/asm-parisc/elf.h b/include/asm-parisc/elf.h
index d0a4a8262818..7fa675799e6d 100644
--- a/include/asm-parisc/elf.h
+++ b/include/asm-parisc/elf.h
@@ -236,7 +236,7 @@ typedef unsigned long elf_greg_t;
236 236
237#define ELF_PLATFORM ("PARISC\0") 237#define ELF_PLATFORM ("PARISC\0")
238 238
239#define SET_PERSONALITY(ex, ibcs2) \ 239#define SET_PERSONALITY(ex) \
240 current->personality = PER_LINUX; \ 240 current->personality = PER_LINUX; \
241 current->thread.map_base = DEFAULT_MAP_BASE; \ 241 current->thread.map_base = DEFAULT_MAP_BASE; \
242 current->thread.task_size = DEFAULT_TASK_SIZE \ 242 current->thread.task_size = DEFAULT_TASK_SIZE \
diff --git a/include/asm-parisc/statfs.h b/include/asm-parisc/statfs.h
index 1d2b8130b23d..324bea905dc6 100644
--- a/include/asm-parisc/statfs.h
+++ b/include/asm-parisc/statfs.h
@@ -1,58 +1,7 @@
1#ifndef _PARISC_STATFS_H 1#ifndef _PARISC_STATFS_H
2#define _PARISC_STATFS_H 2#define _PARISC_STATFS_H
3 3
4#ifndef __KERNEL_STRICT_NAMES 4#define __statfs_word long
5 5#include <asm-generic/statfs.h>
6#include <linux/types.h>
7
8typedef __kernel_fsid_t fsid_t;
9
10#endif
11
12/*
13 * It appears that PARISC could be 64 _or_ 32 bit.
14 * 64-bit fields must be explicitly 64-bit in statfs64.
15 */
16struct statfs {
17 long f_type;
18 long f_bsize;
19 long f_blocks;
20 long f_bfree;
21 long f_bavail;
22 long f_files;
23 long f_ffree;
24 __kernel_fsid_t f_fsid;
25 long f_namelen;
26 long f_frsize;
27 long f_spare[5];
28};
29
30struct statfs64 {
31 long f_type;
32 long f_bsize;
33 __u64 f_blocks;
34 __u64 f_bfree;
35 __u64 f_bavail;
36 __u64 f_files;
37 __u64 f_ffree;
38 __kernel_fsid_t f_fsid;
39 long f_namelen;
40 long f_frsize;
41 long f_spare[5];
42};
43
44struct compat_statfs64 {
45 __u32 f_type;
46 __u32 f_bsize;
47 __u64 f_blocks;
48 __u64 f_bfree;
49 __u64 f_bavail;
50 __u64 f_files;
51 __u64 f_ffree;
52 __kernel_fsid_t f_fsid;
53 __u32 f_namelen;
54 __u32 f_frsize;
55 __u32 f_spare[5];
56};
57 6
58#endif 7#endif
diff --git a/include/asm-um/elf-i386.h b/include/asm-um/elf-i386.h
index 23d6893e8617..d0da9d7c5371 100644
--- a/include/asm-um/elf-i386.h
+++ b/include/asm-um/elf-i386.h
@@ -86,7 +86,7 @@ extern long elf_aux_hwcap;
86extern char * elf_aux_platform; 86extern char * elf_aux_platform;
87#define ELF_PLATFORM (elf_aux_platform) 87#define ELF_PLATFORM (elf_aux_platform)
88 88
89#define SET_PERSONALITY(ex, ibcs2) do { } while (0) 89#define SET_PERSONALITY(ex) do { } while (0)
90 90
91extern unsigned long vsyscall_ehdr; 91extern unsigned long vsyscall_ehdr;
92extern unsigned long vsyscall_end; 92extern unsigned long vsyscall_end;
diff --git a/include/asm-um/elf-ppc.h b/include/asm-um/elf-ppc.h
index d3b90b7ac3e9..af9463cd8ce5 100644
--- a/include/asm-um/elf-ppc.h
+++ b/include/asm-um/elf-ppc.h
@@ -5,7 +5,7 @@
5extern long elf_aux_hwcap; 5extern long elf_aux_hwcap;
6#define ELF_HWCAP (elf_aux_hwcap) 6#define ELF_HWCAP (elf_aux_hwcap)
7 7
8#define SET_PERSONALITY(ex, ibcs2) do ; while(0) 8#define SET_PERSONALITY(ex) do ; while(0)
9 9
10#define ELF_EXEC_PAGESIZE 4096 10#define ELF_EXEC_PAGESIZE 4096
11 11
diff --git a/include/asm-um/elf-x86_64.h b/include/asm-um/elf-x86_64.h
index 3b2d5224a7e1..6e8a9195e952 100644
--- a/include/asm-um/elf-x86_64.h
+++ b/include/asm-um/elf-x86_64.h
@@ -114,6 +114,6 @@ extern long elf_aux_hwcap;
114 114
115#define ELF_PLATFORM "x86_64" 115#define ELF_PLATFORM "x86_64"
116 116
117#define SET_PERSONALITY(ex, ibcs2) do ; while(0) 117#define SET_PERSONALITY(ex) do ; while(0)
118 118
119#endif 119#endif
diff --git a/include/asm-x86/elf.h b/include/asm-x86/elf.h
index 5c4745bec906..26bc15f01e78 100644
--- a/include/asm-x86/elf.h
+++ b/include/asm-x86/elf.h
@@ -186,7 +186,7 @@ do { \
186 set_fs(USER_DS); \ 186 set_fs(USER_DS); \
187} while (0) 187} while (0)
188 188
189#define COMPAT_SET_PERSONALITY(ex, ibcs2) \ 189#define COMPAT_SET_PERSONALITY(ex) \
190do { \ 190do { \
191 if (test_thread_flag(TIF_IA32)) \ 191 if (test_thread_flag(TIF_IA32)) \
192 clear_thread_flag(TIF_ABI_PENDING); \ 192 clear_thread_flag(TIF_ABI_PENDING); \
@@ -267,7 +267,7 @@ extern int force_personality32;
267 For the moment, we have only optimizations for the Intel generations, 267 For the moment, we have only optimizations for the Intel generations,
268 but that could change... */ 268 but that could change... */
269 269
270#define SET_PERSONALITY(ex, ibcs2) set_personality_64bit() 270#define SET_PERSONALITY(ex) set_personality_64bit()
271 271
272/* 272/*
273 * An executable for which elf_read_implies_exec() returns TRUE will 273 * An executable for which elf_read_implies_exec() returns TRUE will
diff --git a/include/asm-x86/es7000/apic.h b/include/asm-x86/es7000/apic.h
index bd2c44d1f7ac..aae50c2fb303 100644
--- a/include/asm-x86/es7000/apic.h
+++ b/include/asm-x86/es7000/apic.h
@@ -171,7 +171,7 @@ static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
171 int new_apicid = cpu_to_logical_apicid(cpu); 171 int new_apicid = cpu_to_logical_apicid(cpu);
172 if (apicid_cluster(apicid) != 172 if (apicid_cluster(apicid) !=
173 apicid_cluster(new_apicid)){ 173 apicid_cluster(new_apicid)){
174 printk ("%s: Not a valid mask!\n",__FUNCTION__); 174 printk ("%s: Not a valid mask!\n", __func__);
175#if defined CONFIG_ES7000_CLUSTERED_APIC 175#if defined CONFIG_ES7000_CLUSTERED_APIC
176 return 0xFF; 176 return 0xFF;
177#else 177#else
diff --git a/include/asm-x86/iommu.h b/include/asm-x86/iommu.h
index 546ad3110fea..961e746da977 100644
--- a/include/asm-x86/iommu.h
+++ b/include/asm-x86/iommu.h
@@ -8,7 +8,7 @@ extern int force_iommu, no_iommu;
8extern int iommu_detected; 8extern int iommu_detected;
9extern int dmar_disabled; 9extern int dmar_disabled;
10 10
11extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len); 11extern unsigned long iommu_nr_pages(unsigned long addr, unsigned long len);
12 12
13#ifdef CONFIG_GART_IOMMU 13#ifdef CONFIG_GART_IOMMU
14extern int gart_iommu_aperture; 14extern int gart_iommu_aperture;
diff --git a/include/asm-x86/kvm.h b/include/asm-x86/kvm.h
index 78e954db1e7f..ba0dd791fadf 100644
--- a/include/asm-x86/kvm.h
+++ b/include/asm-x86/kvm.h
@@ -208,26 +208,4 @@ struct kvm_pit_channel_state {
208struct kvm_pit_state { 208struct kvm_pit_state {
209 struct kvm_pit_channel_state channels[3]; 209 struct kvm_pit_channel_state channels[3];
210}; 210};
211
212#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
213#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
214#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04)
215#define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05)
216#define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06)
217#define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07)
218#define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08)
219#define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09)
220#define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A)
221#define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B)
222#define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C)
223#define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D)
224#define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E)
225#define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F)
226#define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10)
227#define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11)
228#define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12)
229#define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13)
230#define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14)
231#define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15)
232
233#endif /* ASM_X86__KVM_H */ 211#endif /* ASM_X86__KVM_H */
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h
index 69794547f514..411fb8cfb24e 100644
--- a/include/asm-x86/kvm_host.h
+++ b/include/asm-x86/kvm_host.h
@@ -57,6 +57,10 @@
57#define KVM_PAGES_PER_HPAGE (KVM_HPAGE_SIZE / PAGE_SIZE) 57#define KVM_PAGES_PER_HPAGE (KVM_HPAGE_SIZE / PAGE_SIZE)
58 58
59#define DE_VECTOR 0 59#define DE_VECTOR 0
60#define DB_VECTOR 1
61#define BP_VECTOR 3
62#define OF_VECTOR 4
63#define BR_VECTOR 5
60#define UD_VECTOR 6 64#define UD_VECTOR 6
61#define NM_VECTOR 7 65#define NM_VECTOR 7
62#define DF_VECTOR 8 66#define DF_VECTOR 8
@@ -65,6 +69,7 @@
65#define SS_VECTOR 12 69#define SS_VECTOR 12
66#define GP_VECTOR 13 70#define GP_VECTOR 13
67#define PF_VECTOR 14 71#define PF_VECTOR 14
72#define MF_VECTOR 16
68#define MC_VECTOR 18 73#define MC_VECTOR 18
69 74
70#define SELECTOR_TI_MASK (1 << 2) 75#define SELECTOR_TI_MASK (1 << 2)
@@ -89,7 +94,7 @@ extern struct list_head vm_list;
89struct kvm_vcpu; 94struct kvm_vcpu;
90struct kvm; 95struct kvm;
91 96
92enum { 97enum kvm_reg {
93 VCPU_REGS_RAX = 0, 98 VCPU_REGS_RAX = 0,
94 VCPU_REGS_RCX = 1, 99 VCPU_REGS_RCX = 1,
95 VCPU_REGS_RDX = 2, 100 VCPU_REGS_RDX = 2,
@@ -108,6 +113,7 @@ enum {
108 VCPU_REGS_R14 = 14, 113 VCPU_REGS_R14 = 14,
109 VCPU_REGS_R15 = 15, 114 VCPU_REGS_R15 = 15,
110#endif 115#endif
116 VCPU_REGS_RIP,
111 NR_VCPU_REGS 117 NR_VCPU_REGS
112}; 118};
113 119
@@ -189,10 +195,20 @@ struct kvm_mmu_page {
189 */ 195 */
190 int multimapped; /* More than one parent_pte? */ 196 int multimapped; /* More than one parent_pte? */
191 int root_count; /* Currently serving as active root */ 197 int root_count; /* Currently serving as active root */
198 bool unsync;
199 bool unsync_children;
192 union { 200 union {
193 u64 *parent_pte; /* !multimapped */ 201 u64 *parent_pte; /* !multimapped */
194 struct hlist_head parent_ptes; /* multimapped, kvm_pte_chain */ 202 struct hlist_head parent_ptes; /* multimapped, kvm_pte_chain */
195 }; 203 };
204 DECLARE_BITMAP(unsync_child_bitmap, 512);
205};
206
207struct kvm_pv_mmu_op_buffer {
208 void *ptr;
209 unsigned len;
210 unsigned processed;
211 char buf[512] __aligned(sizeof(long));
196}; 212};
197 213
198/* 214/*
@@ -207,6 +223,9 @@ struct kvm_mmu {
207 gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva); 223 gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva);
208 void (*prefetch_page)(struct kvm_vcpu *vcpu, 224 void (*prefetch_page)(struct kvm_vcpu *vcpu,
209 struct kvm_mmu_page *page); 225 struct kvm_mmu_page *page);
226 int (*sync_page)(struct kvm_vcpu *vcpu,
227 struct kvm_mmu_page *sp);
228 void (*invlpg)(struct kvm_vcpu *vcpu, gva_t gva);
210 hpa_t root_hpa; 229 hpa_t root_hpa;
211 int root_level; 230 int root_level;
212 int shadow_root_level; 231 int shadow_root_level;
@@ -219,8 +238,13 @@ struct kvm_vcpu_arch {
219 int interrupt_window_open; 238 int interrupt_window_open;
220 unsigned long irq_summary; /* bit vector: 1 per word in irq_pending */ 239 unsigned long irq_summary; /* bit vector: 1 per word in irq_pending */
221 DECLARE_BITMAP(irq_pending, KVM_NR_INTERRUPTS); 240 DECLARE_BITMAP(irq_pending, KVM_NR_INTERRUPTS);
222 unsigned long regs[NR_VCPU_REGS]; /* for rsp: vcpu_load_rsp_rip() */ 241 /*
223 unsigned long rip; /* needs vcpu_load_rsp_rip() */ 242 * rip and regs accesses must go through
243 * kvm_{register,rip}_{read,write} functions.
244 */
245 unsigned long regs[NR_VCPU_REGS];
246 u32 regs_avail;
247 u32 regs_dirty;
224 248
225 unsigned long cr0; 249 unsigned long cr0;
226 unsigned long cr2; 250 unsigned long cr2;
@@ -237,6 +261,9 @@ struct kvm_vcpu_arch {
237 bool tpr_access_reporting; 261 bool tpr_access_reporting;
238 262
239 struct kvm_mmu mmu; 263 struct kvm_mmu mmu;
264 /* only needed in kvm_pv_mmu_op() path, but it's hot so
265 * put it here to avoid allocation */
266 struct kvm_pv_mmu_op_buffer mmu_op_buffer;
240 267
241 struct kvm_mmu_memory_cache mmu_pte_chain_cache; 268 struct kvm_mmu_memory_cache mmu_pte_chain_cache;
242 struct kvm_mmu_memory_cache mmu_rmap_desc_cache; 269 struct kvm_mmu_memory_cache mmu_rmap_desc_cache;
@@ -269,6 +296,11 @@ struct kvm_vcpu_arch {
269 u32 error_code; 296 u32 error_code;
270 } exception; 297 } exception;
271 298
299 struct kvm_queued_interrupt {
300 bool pending;
301 u8 nr;
302 } interrupt;
303
272 struct { 304 struct {
273 int active; 305 int active;
274 u8 save_iopl; 306 u8 save_iopl;
@@ -294,6 +326,7 @@ struct kvm_vcpu_arch {
294 struct page *time_page; 326 struct page *time_page;
295 327
296 bool nmi_pending; 328 bool nmi_pending;
329 bool nmi_injected;
297 330
298 u64 mtrr[0x100]; 331 u64 mtrr[0x100];
299}; 332};
@@ -316,9 +349,12 @@ struct kvm_arch{
316 * Hash table of struct kvm_mmu_page. 349 * Hash table of struct kvm_mmu_page.
317 */ 350 */
318 struct list_head active_mmu_pages; 351 struct list_head active_mmu_pages;
352 struct list_head assigned_dev_head;
353 struct dmar_domain *intel_iommu_domain;
319 struct kvm_pic *vpic; 354 struct kvm_pic *vpic;
320 struct kvm_ioapic *vioapic; 355 struct kvm_ioapic *vioapic;
321 struct kvm_pit *vpit; 356 struct kvm_pit *vpit;
357 struct hlist_head irq_ack_notifier_list;
322 358
323 int round_robin_prev_vcpu; 359 int round_robin_prev_vcpu;
324 unsigned int tss_addr; 360 unsigned int tss_addr;
@@ -338,6 +374,7 @@ struct kvm_vm_stat {
338 u32 mmu_flooded; 374 u32 mmu_flooded;
339 u32 mmu_recycled; 375 u32 mmu_recycled;
340 u32 mmu_cache_miss; 376 u32 mmu_cache_miss;
377 u32 mmu_unsync;
341 u32 remote_tlb_flush; 378 u32 remote_tlb_flush;
342 u32 lpages; 379 u32 lpages;
343}; 380};
@@ -364,6 +401,7 @@ struct kvm_vcpu_stat {
364 u32 insn_emulation; 401 u32 insn_emulation;
365 u32 insn_emulation_fail; 402 u32 insn_emulation_fail;
366 u32 hypercalls; 403 u32 hypercalls;
404 u32 irq_injections;
367}; 405};
368 406
369struct descriptor_table { 407struct descriptor_table {
@@ -414,8 +452,7 @@ struct kvm_x86_ops {
414 unsigned long (*get_dr)(struct kvm_vcpu *vcpu, int dr); 452 unsigned long (*get_dr)(struct kvm_vcpu *vcpu, int dr);
415 void (*set_dr)(struct kvm_vcpu *vcpu, int dr, unsigned long value, 453 void (*set_dr)(struct kvm_vcpu *vcpu, int dr, unsigned long value,
416 int *exception); 454 int *exception);
417 void (*cache_regs)(struct kvm_vcpu *vcpu); 455 void (*cache_reg)(struct kvm_vcpu *vcpu, enum kvm_reg reg);
418 void (*decache_regs)(struct kvm_vcpu *vcpu);
419 unsigned long (*get_rflags)(struct kvm_vcpu *vcpu); 456 unsigned long (*get_rflags)(struct kvm_vcpu *vcpu);
420 void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags); 457 void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags);
421 458
@@ -528,6 +565,8 @@ void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code);
528void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long cr2, 565void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long cr2,
529 u32 error_code); 566 u32 error_code);
530 567
568void kvm_pic_set_irq(void *opaque, int irq, int level);
569
531void kvm_inject_nmi(struct kvm_vcpu *vcpu); 570void kvm_inject_nmi(struct kvm_vcpu *vcpu);
532 571
533void fx_init(struct kvm_vcpu *vcpu); 572void fx_init(struct kvm_vcpu *vcpu);
@@ -550,12 +589,14 @@ int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva);
550void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu); 589void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu);
551int kvm_mmu_load(struct kvm_vcpu *vcpu); 590int kvm_mmu_load(struct kvm_vcpu *vcpu);
552void kvm_mmu_unload(struct kvm_vcpu *vcpu); 591void kvm_mmu_unload(struct kvm_vcpu *vcpu);
592void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu);
553 593
554int kvm_emulate_hypercall(struct kvm_vcpu *vcpu); 594int kvm_emulate_hypercall(struct kvm_vcpu *vcpu);
555 595
556int kvm_fix_hypercall(struct kvm_vcpu *vcpu); 596int kvm_fix_hypercall(struct kvm_vcpu *vcpu);
557 597
558int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code); 598int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code);
599void kvm_mmu_invlpg(struct kvm_vcpu *vcpu, gva_t gva);
559 600
560void kvm_enable_tdp(void); 601void kvm_enable_tdp(void);
561void kvm_disable_tdp(void); 602void kvm_disable_tdp(void);
@@ -686,33 +727,6 @@ enum {
686 TASK_SWITCH_GATE = 3, 727 TASK_SWITCH_GATE = 3,
687}; 728};
688 729
689#define KVMTRACE_5D(evt, vcpu, d1, d2, d3, d4, d5, name) \
690 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
691 vcpu, 5, d1, d2, d3, d4, d5)
692#define KVMTRACE_4D(evt, vcpu, d1, d2, d3, d4, name) \
693 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
694 vcpu, 4, d1, d2, d3, d4, 0)
695#define KVMTRACE_3D(evt, vcpu, d1, d2, d3, name) \
696 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
697 vcpu, 3, d1, d2, d3, 0, 0)
698#define KVMTRACE_2D(evt, vcpu, d1, d2, name) \
699 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
700 vcpu, 2, d1, d2, 0, 0, 0)
701#define KVMTRACE_1D(evt, vcpu, d1, name) \
702 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
703 vcpu, 1, d1, 0, 0, 0, 0)
704#define KVMTRACE_0D(evt, vcpu, name) \
705 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
706 vcpu, 0, 0, 0, 0, 0, 0)
707
708#ifdef CONFIG_64BIT
709# define KVM_EX_ENTRY ".quad"
710# define KVM_EX_PUSH "pushq"
711#else
712# define KVM_EX_ENTRY ".long"
713# define KVM_EX_PUSH "pushl"
714#endif
715
716/* 730/*
717 * Hardware virtualization extension instructions may fault if a 731 * Hardware virtualization extension instructions may fault if a
718 * reboot turns off virtualization while processes are running. 732 * reboot turns off virtualization while processes are running.
@@ -724,11 +738,11 @@ asmlinkage void kvm_handle_fault_on_reboot(void);
724 "666: " insn "\n\t" \ 738 "666: " insn "\n\t" \
725 ".pushsection .fixup, \"ax\" \n" \ 739 ".pushsection .fixup, \"ax\" \n" \
726 "667: \n\t" \ 740 "667: \n\t" \
727 KVM_EX_PUSH " $666b \n\t" \ 741 __ASM_SIZE(push) " $666b \n\t" \
728 "jmp kvm_handle_fault_on_reboot \n\t" \ 742 "jmp kvm_handle_fault_on_reboot \n\t" \
729 ".popsection \n\t" \ 743 ".popsection \n\t" \
730 ".pushsection __ex_table, \"a\" \n\t" \ 744 ".pushsection __ex_table, \"a\" \n\t" \
731 KVM_EX_ENTRY " 666b, 667b \n\t" \ 745 _ASM_PTR " 666b, 667b \n\t" \
732 ".popsection" 746 ".popsection"
733 747
734#define KVM_ARCH_WANT_MMU_NOTIFIER 748#define KVM_ARCH_WANT_MMU_NOTIFIER
diff --git a/include/asm-x86/msr-index.h b/include/asm-x86/msr-index.h
index 0bb43301a202..dabd10f0bbee 100644
--- a/include/asm-x86/msr-index.h
+++ b/include/asm-x86/msr-index.h
@@ -178,6 +178,9 @@
178#define MSR_IA32_EBL_CR_POWERON 0x0000002a 178#define MSR_IA32_EBL_CR_POWERON 0x0000002a
179#define MSR_IA32_FEATURE_CONTROL 0x0000003a 179#define MSR_IA32_FEATURE_CONTROL 0x0000003a
180 180
181#define FEATURE_CONTROL_LOCKED (1<<0)
182#define FEATURE_CONTROL_VMXON_ENABLED (1<<2)
183
181#define MSR_IA32_APICBASE 0x0000001b 184#define MSR_IA32_APICBASE 0x0000001b
182#define MSR_IA32_APICBASE_BSP (1<<8) 185#define MSR_IA32_APICBASE_BSP (1<<8)
183#define MSR_IA32_APICBASE_ENABLE (1<<11) 186#define MSR_IA32_APICBASE_ENABLE (1<<11)
diff --git a/include/asm-x86/page_32.h b/include/asm-x86/page_32.h
index e8d80d1de237..bdf5dba4cfb0 100644
--- a/include/asm-x86/page_32.h
+++ b/include/asm-x86/page_32.h
@@ -39,7 +39,6 @@ typedef u64 pmdval_t;
39typedef u64 pudval_t; 39typedef u64 pudval_t;
40typedef u64 pgdval_t; 40typedef u64 pgdval_t;
41typedef u64 pgprotval_t; 41typedef u64 pgprotval_t;
42typedef u64 phys_addr_t;
43 42
44typedef union { 43typedef union {
45 struct { 44 struct {
@@ -60,7 +59,6 @@ typedef unsigned long pmdval_t;
60typedef unsigned long pudval_t; 59typedef unsigned long pudval_t;
61typedef unsigned long pgdval_t; 60typedef unsigned long pgdval_t;
62typedef unsigned long pgprotval_t; 61typedef unsigned long pgprotval_t;
63typedef unsigned long phys_addr_t;
64 62
65typedef union { 63typedef union {
66 pteval_t pte; 64 pteval_t pte;
diff --git a/include/asm-x86/page_64.h b/include/asm-x86/page_64.h
index 5e64acfed0a4..49380b8c7e25 100644
--- a/include/asm-x86/page_64.h
+++ b/include/asm-x86/page_64.h
@@ -79,7 +79,6 @@ typedef unsigned long pmdval_t;
79typedef unsigned long pudval_t; 79typedef unsigned long pudval_t;
80typedef unsigned long pgdval_t; 80typedef unsigned long pgdval_t;
81typedef unsigned long pgprotval_t; 81typedef unsigned long pgprotval_t;
82typedef unsigned long phys_addr_t;
83 82
84typedef struct page *pgtable_t; 83typedef struct page *pgtable_t;
85 84
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
index 182f9d4c570f..88a53b1a17f0 100644
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -148,8 +148,13 @@
148#ifdef CONFIG_X86_64 148#ifdef CONFIG_X86_64
149#define __PAGE_KERNEL_IDENT_LARGE_EXEC __PAGE_KERNEL_LARGE_EXEC 149#define __PAGE_KERNEL_IDENT_LARGE_EXEC __PAGE_KERNEL_LARGE_EXEC
150#else 150#else
151/*
152 * For PDE_IDENT_ATTR include USER bit. As the PDE and PTE protection
153 * bits are combined, this will alow user to access the high address mapped
154 * VDSO in the presence of CONFIG_COMPAT_VDSO
155 */
151#define PTE_IDENT_ATTR 0x003 /* PRESENT+RW */ 156#define PTE_IDENT_ATTR 0x003 /* PRESENT+RW */
152#define PDE_IDENT_ATTR 0x063 /* PRESENT+RW+DIRTY+ACCESSED */ 157#define PDE_IDENT_ATTR 0x067 /* PRESENT+RW+USER+DIRTY+ACCESSED */
153#define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */ 158#define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */
154#endif 159#endif
155 160
diff --git a/include/asm-x86/pvclock.h b/include/asm-x86/pvclock.h
index 1a38f6834800..ad29e277fd6d 100644
--- a/include/asm-x86/pvclock.h
+++ b/include/asm-x86/pvclock.h
@@ -6,6 +6,7 @@
6 6
7/* some helper functions for xen and kvm pv clock sources */ 7/* some helper functions for xen and kvm pv clock sources */
8cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src); 8cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src);
9unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src);
9void pvclock_read_wallclock(struct pvclock_wall_clock *wall, 10void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
10 struct pvclock_vcpu_time_info *vcpu, 11 struct pvclock_vcpu_time_info *vcpu,
11 struct timespec *ts); 12 struct timespec *ts);
diff --git a/include/asm-x86/statfs.h b/include/asm-x86/statfs.h
index 3f005bc3aa5b..ca5dc19dd461 100644
--- a/include/asm-x86/statfs.h
+++ b/include/asm-x86/statfs.h
@@ -1,63 +1,12 @@
1#ifndef ASM_X86__STATFS_H 1#ifndef ASM_X86__STATFS_H
2#define ASM_X86__STATFS_H 2#define ASM_X86__STATFS_H
3 3
4#ifdef __i386__
5#include <asm-generic/statfs.h>
6#else
7
8#ifndef __KERNEL_STRICT_NAMES
9
10#include <linux/types.h>
11
12typedef __kernel_fsid_t fsid_t;
13
14#endif
15
16/* 4/*
17 * This is ugly -- we're already 64-bit clean, so just duplicate the 5 * We need compat_statfs64 to be packed, because the i386 ABI won't
18 * definitions. 6 * add padding at the end to bring it to a multiple of 8 bytes, but
7 * the x86_64 ABI will.
19 */ 8 */
20struct statfs { 9#define ARCH_PACK_COMPAT_STATFS64 __attribute__((packed,aligned(4)))
21 long f_type;
22 long f_bsize;
23 long f_blocks;
24 long f_bfree;
25 long f_bavail;
26 long f_files;
27 long f_ffree;
28 __kernel_fsid_t f_fsid;
29 long f_namelen;
30 long f_frsize;
31 long f_spare[5];
32};
33
34struct statfs64 {
35 long f_type;
36 long f_bsize;
37 long f_blocks;
38 long f_bfree;
39 long f_bavail;
40 long f_files;
41 long f_ffree;
42 __kernel_fsid_t f_fsid;
43 long f_namelen;
44 long f_frsize;
45 long f_spare[5];
46};
47 10
48struct compat_statfs64 { 11#include <asm-generic/statfs.h>
49 __u32 f_type;
50 __u32 f_bsize;
51 __u64 f_blocks;
52 __u64 f_bfree;
53 __u64 f_bavail;
54 __u64 f_files;
55 __u64 f_ffree;
56 __kernel_fsid_t f_fsid;
57 __u32 f_namelen;
58 __u32 f_frsize;
59 __u32 f_spare[5];
60} __attribute__((packed));
61
62#endif /* !__i386__ */
63#endif /* ASM_X86__STATFS_H */ 12#endif /* ASM_X86__STATFS_H */
diff --git a/include/asm-x86/summit/apic.h b/include/asm-x86/summit/apic.h
index c5b2e4b10358..394b00bb5e72 100644
--- a/include/asm-x86/summit/apic.h
+++ b/include/asm-x86/summit/apic.h
@@ -160,7 +160,7 @@ static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
160 int new_apicid = cpu_to_logical_apicid(cpu); 160 int new_apicid = cpu_to_logical_apicid(cpu);
161 if (apicid_cluster(apicid) != 161 if (apicid_cluster(apicid) !=
162 apicid_cluster(new_apicid)){ 162 apicid_cluster(new_apicid)){
163 printk ("%s: Not a valid mask!\n",__FUNCTION__); 163 printk ("%s: Not a valid mask!\n", __func__);
164 return 0xFF; 164 return 0xFF;
165 } 165 }
166 apicid = apicid | new_apicid; 166 apicid = apicid | new_apicid;
diff --git a/include/asm-x86/xen/page.h b/include/asm-x86/xen/page.h
index c50185dccec1..d5eada0a48d9 100644
--- a/include/asm-x86/xen/page.h
+++ b/include/asm-x86/xen/page.h
@@ -76,13 +76,13 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
76static inline xmaddr_t phys_to_machine(xpaddr_t phys) 76static inline xmaddr_t phys_to_machine(xpaddr_t phys)
77{ 77{
78 unsigned offset = phys.paddr & ~PAGE_MASK; 78 unsigned offset = phys.paddr & ~PAGE_MASK;
79 return XMADDR(PFN_PHYS((u64)pfn_to_mfn(PFN_DOWN(phys.paddr))) | offset); 79 return XMADDR(PFN_PHYS(pfn_to_mfn(PFN_DOWN(phys.paddr))) | offset);
80} 80}
81 81
82static inline xpaddr_t machine_to_phys(xmaddr_t machine) 82static inline xpaddr_t machine_to_phys(xmaddr_t machine)
83{ 83{
84 unsigned offset = machine.maddr & ~PAGE_MASK; 84 unsigned offset = machine.maddr & ~PAGE_MASK;
85 return XPADDR(PFN_PHYS((u64)mfn_to_pfn(PFN_DOWN(machine.maddr))) | offset); 85 return XPADDR(PFN_PHYS(mfn_to_pfn(PFN_DOWN(machine.maddr))) | offset);
86} 86}
87 87
88/* 88/*
diff --git a/include/asm-xtensa/a.out.h b/include/asm-xtensa/a.out.h
deleted file mode 100644
index fdf13702924a..000000000000
--- a/include/asm-xtensa/a.out.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * include/asm-xtensa/a.out.h
3 *
4 * Dummy a.out file. Xtensa does not support the a.out format, but the kernel
5 * seems to depend on it.
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * Copyright (C) 2001 - 2005 Tensilica Inc.
12 */
13
14#ifndef _XTENSA_A_OUT_H
15#define _XTENSA_A_OUT_H
16
17struct exec
18{
19 unsigned long a_info;
20 unsigned a_text;
21 unsigned a_data;
22 unsigned a_bss;
23 unsigned a_syms;
24 unsigned a_entry;
25 unsigned a_trsize;
26 unsigned a_drsize;
27};
28
29#endif /* _XTENSA_A_OUT_H */
diff --git a/include/asm-xtensa/elf.h b/include/asm-xtensa/elf.h
index ca6e5101a2cb..c3f53e755ca5 100644
--- a/include/asm-xtensa/elf.h
+++ b/include/asm-xtensa/elf.h
@@ -189,7 +189,7 @@ typedef struct {
189#endif 189#endif
190} elf_xtregs_t; 190} elf_xtregs_t;
191 191
192#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) 192#define SET_PERSONALITY(ex) set_personality(PER_LINUX_32BIT)
193 193
194struct task_struct; 194struct task_struct;
195 195
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 38d3c6b8276a..f46ba4b57da4 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -36,7 +36,6 @@
36#ifndef _DRM_H_ 36#ifndef _DRM_H_
37#define _DRM_H_ 37#define _DRM_H_
38 38
39#if defined(__linux__)
40#if defined(__KERNEL__) 39#if defined(__KERNEL__)
41#endif 40#endif
42#include <asm/ioctl.h> /* For _IO* macros */ 41#include <asm/ioctl.h> /* For _IO* macros */
@@ -46,22 +45,6 @@
46#define DRM_IOC_WRITE _IOC_WRITE 45#define DRM_IOC_WRITE _IOC_WRITE
47#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE 46#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE
48#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) 47#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
49#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
50#if defined(__FreeBSD__) && defined(IN_MODULE)
51/* Prevent name collision when including sys/ioccom.h */
52#undef ioctl
53#include <sys/ioccom.h>
54#define ioctl(a,b,c) xf86ioctl(a,b,c)
55#else
56#include <sys/ioccom.h>
57#endif /* __FreeBSD__ && xf86ioctl */
58#define DRM_IOCTL_NR(n) ((n) & 0xff)
59#define DRM_IOC_VOID IOC_VOID
60#define DRM_IOC_READ IOC_OUT
61#define DRM_IOC_WRITE IOC_IN
62#define DRM_IOC_READWRITE IOC_INOUT
63#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
64#endif
65 48
66#define DRM_MAJOR 226 49#define DRM_MAJOR 226
67#define DRM_MAX_MINOR 15 50#define DRM_MAX_MINOR 15
@@ -471,6 +454,7 @@ struct drm_irq_busid {
471enum drm_vblank_seq_type { 454enum drm_vblank_seq_type {
472 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 455 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */
473 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 456 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */
457 _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */
474 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 458 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */
475 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 459 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */
476 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */ 460 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */
@@ -503,6 +487,19 @@ union drm_wait_vblank {
503 struct drm_wait_vblank_reply reply; 487 struct drm_wait_vblank_reply reply;
504}; 488};
505 489
490#define _DRM_PRE_MODESET 1
491#define _DRM_POST_MODESET 2
492
493/**
494 * DRM_IOCTL_MODESET_CTL ioctl argument type
495 *
496 * \sa drmModesetCtl().
497 */
498struct drm_modeset_ctl {
499 uint32_t crtc;
500 uint32_t cmd;
501};
502
506/** 503/**
507 * DRM_IOCTL_AGP_ENABLE ioctl argument type. 504 * DRM_IOCTL_AGP_ENABLE ioctl argument type.
508 * 505 *
@@ -573,6 +570,34 @@ struct drm_set_version {
573 int drm_dd_minor; 570 int drm_dd_minor;
574}; 571};
575 572
573/** DRM_IOCTL_GEM_CLOSE ioctl argument type */
574struct drm_gem_close {
575 /** Handle of the object to be closed. */
576 uint32_t handle;
577 uint32_t pad;
578};
579
580/** DRM_IOCTL_GEM_FLINK ioctl argument type */
581struct drm_gem_flink {
582 /** Handle for the object being named */
583 uint32_t handle;
584
585 /** Returned global name */
586 uint32_t name;
587};
588
589/** DRM_IOCTL_GEM_OPEN ioctl argument type */
590struct drm_gem_open {
591 /** Name of object being opened */
592 uint32_t name;
593
594 /** Returned handle for the object */
595 uint32_t handle;
596
597 /** Returned size of the object */
598 uint64_t size;
599};
600
576#define DRM_IOCTL_BASE 'd' 601#define DRM_IOCTL_BASE 'd'
577#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) 602#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
578#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) 603#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type)
@@ -587,6 +612,10 @@ struct drm_set_version {
587#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) 612#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client)
588#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) 613#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats)
589#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) 614#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version)
615#define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl)
616#define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close)
617#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink)
618#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open)
590 619
591#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) 620#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique)
592#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) 621#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth)
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 1c1b13e29223..59c796b46ee7 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -104,6 +104,7 @@ struct drm_device;
104#define DRIVER_DMA_QUEUE 0x200 104#define DRIVER_DMA_QUEUE 0x200
105#define DRIVER_FB_DMA 0x400 105#define DRIVER_FB_DMA 0x400
106#define DRIVER_IRQ_VBL2 0x800 106#define DRIVER_IRQ_VBL2 0x800
107#define DRIVER_GEM 0x1000
107 108
108/***********************************************************************/ 109/***********************************************************************/
109/** \name Begin the DRM... */ 110/** \name Begin the DRM... */
@@ -387,6 +388,10 @@ struct drm_file {
387 struct drm_minor *minor; 388 struct drm_minor *minor;
388 int remove_auth_on_close; 389 int remove_auth_on_close;
389 unsigned long lock_count; 390 unsigned long lock_count;
391 /** Mapping of mm object handles to object pointers. */
392 struct idr object_idr;
393 /** Lock for synchronization of access to object_idr. */
394 spinlock_t table_lock;
390 struct file *filp; 395 struct file *filp;
391 void *driver_priv; 396 void *driver_priv;
392}; 397};
@@ -558,6 +563,56 @@ struct drm_ati_pcigart_info {
558}; 563};
559 564
560/** 565/**
566 * This structure defines the drm_mm memory object, which will be used by the
567 * DRM for its buffer objects.
568 */
569struct drm_gem_object {
570 /** Reference count of this object */
571 struct kref refcount;
572
573 /** Handle count of this object. Each handle also holds a reference */
574 struct kref handlecount;
575
576 /** Related drm device */
577 struct drm_device *dev;
578
579 /** File representing the shmem storage */
580 struct file *filp;
581
582 /**
583 * Size of the object, in bytes. Immutable over the object's
584 * lifetime.
585 */
586 size_t size;
587
588 /**
589 * Global name for this object, starts at 1. 0 means unnamed.
590 * Access is covered by the object_name_lock in the related drm_device
591 */
592 int name;
593
594 /**
595 * Memory domains. These monitor which caches contain read/write data
596 * related to the object. When transitioning from one set of domains
597 * to another, the driver is called to ensure that caches are suitably
598 * flushed and invalidated
599 */
600 uint32_t read_domains;
601 uint32_t write_domain;
602
603 /**
604 * While validating an exec operation, the
605 * new read/write domain values are computed here.
606 * They will be transferred to the above values
607 * at the point that any cache flushing occurs
608 */
609 uint32_t pending_read_domains;
610 uint32_t pending_write_domain;
611
612 void *driver_private;
613};
614
615/**
561 * DRM driver structure. This structure represent the common code for 616 * DRM driver structure. This structure represent the common code for
562 * a family of cards. There will one drm_device for each card present 617 * a family of cards. There will one drm_device for each card present
563 * in this family 618 * in this family
@@ -580,11 +635,54 @@ struct drm_driver {
580 int (*kernel_context_switch) (struct drm_device *dev, int old, 635 int (*kernel_context_switch) (struct drm_device *dev, int old,
581 int new); 636 int new);
582 void (*kernel_context_switch_unlock) (struct drm_device *dev); 637 void (*kernel_context_switch_unlock) (struct drm_device *dev);
583 int (*vblank_wait) (struct drm_device *dev, unsigned int *sequence);
584 int (*vblank_wait2) (struct drm_device *dev, unsigned int *sequence);
585 int (*dri_library_name) (struct drm_device *dev, char *buf); 638 int (*dri_library_name) (struct drm_device *dev, char *buf);
586 639
587 /** 640 /**
641 * get_vblank_counter - get raw hardware vblank counter
642 * @dev: DRM device
643 * @crtc: counter to fetch
644 *
645 * Driver callback for fetching a raw hardware vblank counter
646 * for @crtc. If a device doesn't have a hardware counter, the
647 * driver can simply return the value of drm_vblank_count and
648 * make the enable_vblank() and disable_vblank() hooks into no-ops,
649 * leaving interrupts enabled at all times.
650 *
651 * Wraparound handling and loss of events due to modesetting is dealt
652 * with in the DRM core code.
653 *
654 * RETURNS
655 * Raw vblank counter value.
656 */
657 u32 (*get_vblank_counter) (struct drm_device *dev, int crtc);
658
659 /**
660 * enable_vblank - enable vblank interrupt events
661 * @dev: DRM device
662 * @crtc: which irq to enable
663 *
664 * Enable vblank interrupts for @crtc. If the device doesn't have
665 * a hardware vblank counter, this routine should be a no-op, since
666 * interrupts will have to stay on to keep the count accurate.
667 *
668 * RETURNS
669 * Zero on success, appropriate errno if the given @crtc's vblank
670 * interrupt cannot be enabled.
671 */
672 int (*enable_vblank) (struct drm_device *dev, int crtc);
673
674 /**
675 * disable_vblank - disable vblank interrupt events
676 * @dev: DRM device
677 * @crtc: which irq to enable
678 *
679 * Disable vblank interrupts for @crtc. If the device doesn't have
680 * a hardware vblank counter, this routine should be a no-op, since
681 * interrupts will have to stay on to keep the count accurate.
682 */
683 void (*disable_vblank) (struct drm_device *dev, int crtc);
684
685 /**
588 * Called by \c drm_device_is_agp. Typically used to determine if a 686 * Called by \c drm_device_is_agp. Typically used to determine if a
589 * card is really attached to AGP or not. 687 * card is really attached to AGP or not.
590 * 688 *
@@ -601,7 +699,7 @@ struct drm_driver {
601 699
602 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); 700 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS);
603 void (*irq_preinstall) (struct drm_device *dev); 701 void (*irq_preinstall) (struct drm_device *dev);
604 void (*irq_postinstall) (struct drm_device *dev); 702 int (*irq_postinstall) (struct drm_device *dev);
605 void (*irq_uninstall) (struct drm_device *dev); 703 void (*irq_uninstall) (struct drm_device *dev);
606 void (*reclaim_buffers) (struct drm_device *dev, 704 void (*reclaim_buffers) (struct drm_device *dev,
607 struct drm_file * file_priv); 705 struct drm_file * file_priv);
@@ -614,6 +712,18 @@ struct drm_driver {
614 void (*set_version) (struct drm_device *dev, 712 void (*set_version) (struct drm_device *dev,
615 struct drm_set_version *sv); 713 struct drm_set_version *sv);
616 714
715 int (*proc_init)(struct drm_minor *minor);
716 void (*proc_cleanup)(struct drm_minor *minor);
717
718 /**
719 * Driver-specific constructor for drm_gem_objects, to set up
720 * obj->driver_private.
721 *
722 * Returns 0 on success.
723 */
724 int (*gem_init_object) (struct drm_gem_object *obj);
725 void (*gem_free_object) (struct drm_gem_object *obj);
726
617 int major; 727 int major;
618 int minor; 728 int minor;
619 int patchlevel; 729 int patchlevel;
@@ -714,7 +824,6 @@ struct drm_device {
714 824
715 /** \name Context support */ 825 /** \name Context support */
716 /*@{ */ 826 /*@{ */
717 int irq; /**< Interrupt used by board */
718 int irq_enabled; /**< True if irq handler is enabled */ 827 int irq_enabled; /**< True if irq handler is enabled */
719 __volatile__ long context_flag; /**< Context swapping flag */ 828 __volatile__ long context_flag; /**< Context swapping flag */
720 __volatile__ long interrupt_flag; /**< Interruption handler flag */ 829 __volatile__ long interrupt_flag; /**< Interruption handler flag */
@@ -730,13 +839,28 @@ struct drm_device {
730 /** \name VBLANK IRQ support */ 839 /** \name VBLANK IRQ support */
731 /*@{ */ 840 /*@{ */
732 841
733 wait_queue_head_t vbl_queue; /**< VBLANK wait queue */ 842 /*
734 atomic_t vbl_received; 843 * At load time, disabling the vblank interrupt won't be allowed since
735 atomic_t vbl_received2; /**< number of secondary VBLANK interrupts */ 844 * old clients may not call the modeset ioctl and therefore misbehave.
845 * Once the modeset ioctl *has* been called though, we can safely
846 * disable them when unused.
847 */
848 int vblank_disable_allowed;
849
850 wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */
851 atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */
736 spinlock_t vbl_lock; 852 spinlock_t vbl_lock;
737 struct list_head vbl_sigs; /**< signal list to send on VBLANK */ 853 struct list_head *vbl_sigs; /**< signal list to send on VBLANK */
738 struct list_head vbl_sigs2; /**< signals to send on secondary VBLANK */ 854 atomic_t vbl_signal_pending; /* number of signals pending on all crtcs*/
739 unsigned int vbl_pending; 855 atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */
856 u32 *last_vblank; /* protected by dev->vbl_lock, used */
857 /* for wraparound handling */
858 int *vblank_enabled; /* so we don't call enable more than
859 once per disable */
860 int *vblank_inmodeset; /* Display driver is setting mode */
861 struct timer_list vblank_disable_timer;
862
863 u32 max_vblank_count; /**< size of vblank counter register */
740 spinlock_t tasklet_lock; /**< For drm_locked_tasklet */ 864 spinlock_t tasklet_lock; /**< For drm_locked_tasklet */
741 void (*locked_tasklet_func)(struct drm_device *dev); 865 void (*locked_tasklet_func)(struct drm_device *dev);
742 866
@@ -757,6 +881,7 @@ struct drm_device {
757 struct pci_controller *hose; 881 struct pci_controller *hose;
758#endif 882#endif
759 struct drm_sg_mem *sg; /**< Scatter gather memory */ 883 struct drm_sg_mem *sg; /**< Scatter gather memory */
884 int num_crtcs; /**< Number of CRTCs on this device */
760 void *dev_private; /**< device private data */ 885 void *dev_private; /**< device private data */
761 struct drm_sigdata sigdata; /**< For block_all_signals */ 886 struct drm_sigdata sigdata; /**< For block_all_signals */
762 sigset_t sigmask; 887 sigset_t sigmask;
@@ -771,8 +896,29 @@ struct drm_device {
771 spinlock_t drw_lock; 896 spinlock_t drw_lock;
772 struct idr drw_idr; 897 struct idr drw_idr;
773 /*@} */ 898 /*@} */
899
900 /** \name GEM information */
901 /*@{ */
902 spinlock_t object_name_lock;
903 struct idr object_name_idr;
904 atomic_t object_count;
905 atomic_t object_memory;
906 atomic_t pin_count;
907 atomic_t pin_memory;
908 atomic_t gtt_count;
909 atomic_t gtt_memory;
910 uint32_t gtt_total;
911 uint32_t invalidate_domains; /* domains pending invalidation */
912 uint32_t flush_domains; /* domains pending flush */
913 /*@} */
914
774}; 915};
775 916
917static inline int drm_dev_to_irq(struct drm_device *dev)
918{
919 return dev->pdev->irq;
920}
921
776static __inline__ int drm_core_check_feature(struct drm_device *dev, 922static __inline__ int drm_core_check_feature(struct drm_device *dev,
777 int feature) 923 int feature)
778{ 924{
@@ -867,6 +1013,11 @@ extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
867extern DRM_AGP_MEM *drm_alloc_agp(struct drm_device *dev, int pages, u32 type); 1013extern DRM_AGP_MEM *drm_alloc_agp(struct drm_device *dev, int pages, u32 type);
868extern int drm_free_agp(DRM_AGP_MEM * handle, int pages); 1014extern int drm_free_agp(DRM_AGP_MEM * handle, int pages);
869extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); 1015extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
1016extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
1017 struct page **pages,
1018 unsigned long num_pages,
1019 uint32_t gtt_offset,
1020 uint32_t type);
870extern int drm_unbind_agp(DRM_AGP_MEM * handle); 1021extern int drm_unbind_agp(DRM_AGP_MEM * handle);
871 1022
872 /* Misc. IOCTL support (drm_ioctl.h) */ 1023 /* Misc. IOCTL support (drm_ioctl.h) */
@@ -929,6 +1080,9 @@ extern int drm_getmagic(struct drm_device *dev, void *data,
929extern int drm_authmagic(struct drm_device *dev, void *data, 1080extern int drm_authmagic(struct drm_device *dev, void *data,
930 struct drm_file *file_priv); 1081 struct drm_file *file_priv);
931 1082
1083/* Cache management (drm_cache.c) */
1084void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
1085
932 /* Locking IOCTL support (drm_lock.h) */ 1086 /* Locking IOCTL support (drm_lock.h) */
933extern int drm_lock(struct drm_device *dev, void *data, 1087extern int drm_lock(struct drm_device *dev, void *data,
934 struct drm_file *file_priv); 1088 struct drm_file *file_priv);
@@ -985,15 +1139,25 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev,
985extern int drm_control(struct drm_device *dev, void *data, 1139extern int drm_control(struct drm_device *dev, void *data,
986 struct drm_file *file_priv); 1140 struct drm_file *file_priv);
987extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS); 1141extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
1142extern int drm_irq_install(struct drm_device *dev);
988extern int drm_irq_uninstall(struct drm_device *dev); 1143extern int drm_irq_uninstall(struct drm_device *dev);
989extern void drm_driver_irq_preinstall(struct drm_device *dev); 1144extern void drm_driver_irq_preinstall(struct drm_device *dev);
990extern void drm_driver_irq_postinstall(struct drm_device *dev); 1145extern void drm_driver_irq_postinstall(struct drm_device *dev);
991extern void drm_driver_irq_uninstall(struct drm_device *dev); 1146extern void drm_driver_irq_uninstall(struct drm_device *dev);
992 1147
1148extern int drm_vblank_init(struct drm_device *dev, int num_crtcs);
993extern int drm_wait_vblank(struct drm_device *dev, void *data, 1149extern int drm_wait_vblank(struct drm_device *dev, void *data,
994 struct drm_file *file_priv); 1150 struct drm_file *filp);
995extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); 1151extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
996extern void drm_vbl_send_signals(struct drm_device *dev); 1152extern void drm_locked_tasklet(struct drm_device *dev,
1153 void(*func)(struct drm_device *));
1154extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
1155extern void drm_handle_vblank(struct drm_device *dev, int crtc);
1156extern int drm_vblank_get(struct drm_device *dev, int crtc);
1157extern void drm_vblank_put(struct drm_device *dev, int crtc);
1158/* Modesetting support */
1159extern int drm_modeset_ctl(struct drm_device *dev, void *data,
1160 struct drm_file *file_priv);
997extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*)); 1161extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*));
998 1162
999 /* AGP/GART support (drm_agpsupport.h) */ 1163 /* AGP/GART support (drm_agpsupport.h) */
@@ -1026,6 +1190,7 @@ extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size
1026extern int drm_agp_free_memory(DRM_AGP_MEM * handle); 1190extern int drm_agp_free_memory(DRM_AGP_MEM * handle);
1027extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start); 1191extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start);
1028extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle); 1192extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
1193extern void drm_agp_chipset_flush(struct drm_device *dev);
1029 1194
1030 /* Stub support (drm_stub.h) */ 1195 /* Stub support (drm_stub.h) */
1031extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1196extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
@@ -1088,6 +1253,66 @@ extern unsigned long drm_mm_tail_space(struct drm_mm *mm);
1088extern int drm_mm_remove_space_from_tail(struct drm_mm *mm, unsigned long size); 1253extern int drm_mm_remove_space_from_tail(struct drm_mm *mm, unsigned long size);
1089extern int drm_mm_add_space_to_tail(struct drm_mm *mm, unsigned long size); 1254extern int drm_mm_add_space_to_tail(struct drm_mm *mm, unsigned long size);
1090 1255
1256/* Graphics Execution Manager library functions (drm_gem.c) */
1257int drm_gem_init(struct drm_device *dev);
1258void drm_gem_object_free(struct kref *kref);
1259struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1260 size_t size);
1261void drm_gem_object_handle_free(struct kref *kref);
1262
1263static inline void
1264drm_gem_object_reference(struct drm_gem_object *obj)
1265{
1266 kref_get(&obj->refcount);
1267}
1268
1269static inline void
1270drm_gem_object_unreference(struct drm_gem_object *obj)
1271{
1272 if (obj == NULL)
1273 return;
1274
1275 kref_put(&obj->refcount, drm_gem_object_free);
1276}
1277
1278int drm_gem_handle_create(struct drm_file *file_priv,
1279 struct drm_gem_object *obj,
1280 int *handlep);
1281
1282static inline void
1283drm_gem_object_handle_reference(struct drm_gem_object *obj)
1284{
1285 drm_gem_object_reference(obj);
1286 kref_get(&obj->handlecount);
1287}
1288
1289static inline void
1290drm_gem_object_handle_unreference(struct drm_gem_object *obj)
1291{
1292 if (obj == NULL)
1293 return;
1294
1295 /*
1296 * Must bump handle count first as this may be the last
1297 * ref, in which case the object would disappear before we
1298 * checked for a name
1299 */
1300 kref_put(&obj->handlecount, drm_gem_object_handle_free);
1301 drm_gem_object_unreference(obj);
1302}
1303
1304struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev,
1305 struct drm_file *filp,
1306 int handle);
1307int drm_gem_close_ioctl(struct drm_device *dev, void *data,
1308 struct drm_file *file_priv);
1309int drm_gem_flink_ioctl(struct drm_device *dev, void *data,
1310 struct drm_file *file_priv);
1311int drm_gem_open_ioctl(struct drm_device *dev, void *data,
1312 struct drm_file *file_priv);
1313void drm_gem_open(struct drm_device *dev, struct drm_file *file_private);
1314void drm_gem_release(struct drm_device *dev, struct drm_file *file_private);
1315
1091extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev); 1316extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev);
1092extern void drm_core_ioremap_wc(struct drm_map *map, struct drm_device *dev); 1317extern void drm_core_ioremap_wc(struct drm_map *map, struct drm_device *dev);
1093extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev); 1318extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev);
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 135bd19499fc..da04109741e8 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -84,18 +84,18 @@
84 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 84 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
85 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 85 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
86 {0x1002, 0x5657, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 86 {0x1002, 0x5657, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
87 {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 87 {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
88 {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 88 {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
89 {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 89 {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
90 {0x1002, 0x554B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 90 {0x1002, 0x554B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
91 {0x1002, 0x554C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 91 {0x1002, 0x554C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
92 {0x1002, 0x554D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 92 {0x1002, 0x554D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
93 {0x1002, 0x554E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 93 {0x1002, 0x554E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
94 {0x1002, 0x554F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 94 {0x1002, 0x554F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
95 {0x1002, 0x5550, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 95 {0x1002, 0x5550, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
96 {0x1002, 0x5551, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 96 {0x1002, 0x5551, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
97 {0x1002, 0x5552, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 97 {0x1002, 0x5552, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
98 {0x1002, 0x5554, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 98 {0x1002, 0x5554, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
99 {0x1002, 0x564A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 99 {0x1002, 0x564A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
100 {0x1002, 0x564B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 100 {0x1002, 0x564B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
101 {0x1002, 0x564F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 101 {0x1002, 0x564F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -113,8 +113,10 @@
113 {0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 113 {0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
114 {0x1002, 0x5965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 114 {0x1002, 0x5965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
115 {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ 115 {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \
116 {0x1002, 0x5a61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ 116 {0x1002, 0x5a41, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_IGPGART}, \
117 {0x1002, 0x5a62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ 117 {0x1002, 0x5a42, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
118 {0x1002, 0x5a61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_IGPGART}, \
119 {0x1002, 0x5a62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
118 {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 120 {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
119 {0x1002, 0x5b62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 121 {0x1002, 0x5b62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
120 {0x1002, 0x5b63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 122 {0x1002, 0x5b63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
@@ -122,16 +124,16 @@
122 {0x1002, 0x5b65, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 124 {0x1002, 0x5b65, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
123 {0x1002, 0x5c61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|RADEON_IS_MOBILITY}, \ 125 {0x1002, 0x5c61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|RADEON_IS_MOBILITY}, \
124 {0x1002, 0x5c63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|RADEON_IS_MOBILITY}, \ 126 {0x1002, 0x5c63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|RADEON_IS_MOBILITY}, \
125 {0x1002, 0x5d48, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 127 {0x1002, 0x5d48, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
126 {0x1002, 0x5d49, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 128 {0x1002, 0x5d49, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
127 {0x1002, 0x5d4a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 129 {0x1002, 0x5d4a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
128 {0x1002, 0x5d4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 130 {0x1002, 0x5d4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
129 {0x1002, 0x5d4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 131 {0x1002, 0x5d4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
130 {0x1002, 0x5d4e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 132 {0x1002, 0x5d4e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
131 {0x1002, 0x5d4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 133 {0x1002, 0x5d4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
132 {0x1002, 0x5d50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 134 {0x1002, 0x5d50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
133 {0x1002, 0x5d52, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 135 {0x1002, 0x5d52, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
134 {0x1002, 0x5d57, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 136 {0x1002, 0x5d57, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
135 {0x1002, 0x5e48, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 137 {0x1002, 0x5e48, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
136 {0x1002, 0x5e4a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 138 {0x1002, 0x5e4a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
137 {0x1002, 0x5e4b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 139 {0x1002, 0x5e4b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
@@ -237,6 +239,10 @@
237 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 239 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
238 {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 240 {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
239 {0x1002, 0x791f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 241 {0x1002, 0x791f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
242 {0x1002, 0x796c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
243 {0x1002, 0x796d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
244 {0x1002, 0x796e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
245 {0x1002, 0x796f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
240 {0, 0, 0} 246 {0, 0, 0}
241 247
242#define r128_PCI_IDS \ 248#define r128_PCI_IDS \
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 05c66cf03a9e..eb4b35031a55 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -143,6 +143,22 @@ typedef struct _drm_i915_sarea {
143#define DRM_I915_GET_VBLANK_PIPE 0x0e 143#define DRM_I915_GET_VBLANK_PIPE 0x0e
144#define DRM_I915_VBLANK_SWAP 0x0f 144#define DRM_I915_VBLANK_SWAP 0x0f
145#define DRM_I915_HWS_ADDR 0x11 145#define DRM_I915_HWS_ADDR 0x11
146#define DRM_I915_GEM_INIT 0x13
147#define DRM_I915_GEM_EXECBUFFER 0x14
148#define DRM_I915_GEM_PIN 0x15
149#define DRM_I915_GEM_UNPIN 0x16
150#define DRM_I915_GEM_BUSY 0x17
151#define DRM_I915_GEM_THROTTLE 0x18
152#define DRM_I915_GEM_ENTERVT 0x19
153#define DRM_I915_GEM_LEAVEVT 0x1a
154#define DRM_I915_GEM_CREATE 0x1b
155#define DRM_I915_GEM_PREAD 0x1c
156#define DRM_I915_GEM_PWRITE 0x1d
157#define DRM_I915_GEM_MMAP 0x1e
158#define DRM_I915_GEM_SET_DOMAIN 0x1f
159#define DRM_I915_GEM_SW_FINISH 0x20
160#define DRM_I915_GEM_SET_TILING 0x21
161#define DRM_I915_GEM_GET_TILING 0x22
146 162
147#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 163#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
148#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 164#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -160,6 +176,20 @@ typedef struct _drm_i915_sarea {
160#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 176#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
161#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 177#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
162#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) 178#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
179#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
180#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
181#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
182#define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE)
183#define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT)
184#define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT)
185#define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create)
186#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)
187#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
188#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
189#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
190#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
191#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
192#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
163 193
164/* Allow drivers to submit batchbuffers directly to hardware, relying 194/* Allow drivers to submit batchbuffers directly to hardware, relying
165 * on the security mechanisms provided by hardware. 195 * on the security mechanisms provided by hardware.
@@ -200,6 +230,8 @@ typedef struct drm_i915_irq_wait {
200#define I915_PARAM_IRQ_ACTIVE 1 230#define I915_PARAM_IRQ_ACTIVE 1
201#define I915_PARAM_ALLOW_BATCHBUFFER 2 231#define I915_PARAM_ALLOW_BATCHBUFFER 2
202#define I915_PARAM_LAST_DISPATCH 3 232#define I915_PARAM_LAST_DISPATCH 3
233#define I915_PARAM_CHIPSET_ID 4
234#define I915_PARAM_HAS_GEM 5
203 235
204typedef struct drm_i915_getparam { 236typedef struct drm_i915_getparam {
205 int param; 237 int param;
@@ -267,4 +299,305 @@ typedef struct drm_i915_hws_addr {
267 uint64_t addr; 299 uint64_t addr;
268} drm_i915_hws_addr_t; 300} drm_i915_hws_addr_t;
269 301
302struct drm_i915_gem_init {
303 /**
304 * Beginning offset in the GTT to be managed by the DRM memory
305 * manager.
306 */
307 uint64_t gtt_start;
308 /**
309 * Ending offset in the GTT to be managed by the DRM memory
310 * manager.
311 */
312 uint64_t gtt_end;
313};
314
315struct drm_i915_gem_create {
316 /**
317 * Requested size for the object.
318 *
319 * The (page-aligned) allocated size for the object will be returned.
320 */
321 uint64_t size;
322 /**
323 * Returned handle for the object.
324 *
325 * Object handles are nonzero.
326 */
327 uint32_t handle;
328 uint32_t pad;
329};
330
331struct drm_i915_gem_pread {
332 /** Handle for the object being read. */
333 uint32_t handle;
334 uint32_t pad;
335 /** Offset into the object to read from */
336 uint64_t offset;
337 /** Length of data to read */
338 uint64_t size;
339 /**
340 * Pointer to write the data into.
341 *
342 * This is a fixed-size type for 32/64 compatibility.
343 */
344 uint64_t data_ptr;
345};
346
347struct drm_i915_gem_pwrite {
348 /** Handle for the object being written to. */
349 uint32_t handle;
350 uint32_t pad;
351 /** Offset into the object to write to */
352 uint64_t offset;
353 /** Length of data to write */
354 uint64_t size;
355 /**
356 * Pointer to read the data from.
357 *
358 * This is a fixed-size type for 32/64 compatibility.
359 */
360 uint64_t data_ptr;
361};
362
363struct drm_i915_gem_mmap {
364 /** Handle for the object being mapped. */
365 uint32_t handle;
366 uint32_t pad;
367 /** Offset in the object to map. */
368 uint64_t offset;
369 /**
370 * Length of data to map.
371 *
372 * The value will be page-aligned.
373 */
374 uint64_t size;
375 /**
376 * Returned pointer the data was mapped at.
377 *
378 * This is a fixed-size type for 32/64 compatibility.
379 */
380 uint64_t addr_ptr;
381};
382
383struct drm_i915_gem_set_domain {
384 /** Handle for the object */
385 uint32_t handle;
386
387 /** New read domains */
388 uint32_t read_domains;
389
390 /** New write domain */
391 uint32_t write_domain;
392};
393
394struct drm_i915_gem_sw_finish {
395 /** Handle for the object */
396 uint32_t handle;
397};
398
399struct drm_i915_gem_relocation_entry {
400 /**
401 * Handle of the buffer being pointed to by this relocation entry.
402 *
403 * It's appealing to make this be an index into the mm_validate_entry
404 * list to refer to the buffer, but this allows the driver to create
405 * a relocation list for state buffers and not re-write it per
406 * exec using the buffer.
407 */
408 uint32_t target_handle;
409
410 /**
411 * Value to be added to the offset of the target buffer to make up
412 * the relocation entry.
413 */
414 uint32_t delta;
415
416 /** Offset in the buffer the relocation entry will be written into */
417 uint64_t offset;
418
419 /**
420 * Offset value of the target buffer that the relocation entry was last
421 * written as.
422 *
423 * If the buffer has the same offset as last time, we can skip syncing
424 * and writing the relocation. This value is written back out by
425 * the execbuffer ioctl when the relocation is written.
426 */
427 uint64_t presumed_offset;
428
429 /**
430 * Target memory domains read by this operation.
431 */
432 uint32_t read_domains;
433
434 /**
435 * Target memory domains written by this operation.
436 *
437 * Note that only one domain may be written by the whole
438 * execbuffer operation, so that where there are conflicts,
439 * the application will get -EINVAL back.
440 */
441 uint32_t write_domain;
442};
443
444/** @{
445 * Intel memory domains
446 *
447 * Most of these just align with the various caches in
448 * the system and are used to flush and invalidate as
449 * objects end up cached in different domains.
450 */
451/** CPU cache */
452#define I915_GEM_DOMAIN_CPU 0x00000001
453/** Render cache, used by 2D and 3D drawing */
454#define I915_GEM_DOMAIN_RENDER 0x00000002
455/** Sampler cache, used by texture engine */
456#define I915_GEM_DOMAIN_SAMPLER 0x00000004
457/** Command queue, used to load batch buffers */
458#define I915_GEM_DOMAIN_COMMAND 0x00000008
459/** Instruction cache, used by shader programs */
460#define I915_GEM_DOMAIN_INSTRUCTION 0x00000010
461/** Vertex address cache */
462#define I915_GEM_DOMAIN_VERTEX 0x00000020
463/** GTT domain - aperture and scanout */
464#define I915_GEM_DOMAIN_GTT 0x00000040
465/** @} */
466
467struct drm_i915_gem_exec_object {
468 /**
469 * User's handle for a buffer to be bound into the GTT for this
470 * operation.
471 */
472 uint32_t handle;
473
474 /** Number of relocations to be performed on this buffer */
475 uint32_t relocation_count;
476 /**
477 * Pointer to array of struct drm_i915_gem_relocation_entry containing
478 * the relocations to be performed in this buffer.
479 */
480 uint64_t relocs_ptr;
481
482 /** Required alignment in graphics aperture */
483 uint64_t alignment;
484
485 /**
486 * Returned value of the updated offset of the object, for future
487 * presumed_offset writes.
488 */
489 uint64_t offset;
490};
491
492struct drm_i915_gem_execbuffer {
493 /**
494 * List of buffers to be validated with their relocations to be
495 * performend on them.
496 *
497 * This is a pointer to an array of struct drm_i915_gem_validate_entry.
498 *
499 * These buffers must be listed in an order such that all relocations
500 * a buffer is performing refer to buffers that have already appeared
501 * in the validate list.
502 */
503 uint64_t buffers_ptr;
504 uint32_t buffer_count;
505
506 /** Offset in the batchbuffer to start execution from. */
507 uint32_t batch_start_offset;
508 /** Bytes used in batchbuffer from batch_start_offset */
509 uint32_t batch_len;
510 uint32_t DR1;
511 uint32_t DR4;
512 uint32_t num_cliprects;
513 /** This is a struct drm_clip_rect *cliprects */
514 uint64_t cliprects_ptr;
515};
516
517struct drm_i915_gem_pin {
518 /** Handle of the buffer to be pinned. */
519 uint32_t handle;
520 uint32_t pad;
521
522 /** alignment required within the aperture */
523 uint64_t alignment;
524
525 /** Returned GTT offset of the buffer. */
526 uint64_t offset;
527};
528
529struct drm_i915_gem_unpin {
530 /** Handle of the buffer to be unpinned. */
531 uint32_t handle;
532 uint32_t pad;
533};
534
535struct drm_i915_gem_busy {
536 /** Handle of the buffer to check for busy */
537 uint32_t handle;
538
539 /** Return busy status (1 if busy, 0 if idle) */
540 uint32_t busy;
541};
542
543#define I915_TILING_NONE 0
544#define I915_TILING_X 1
545#define I915_TILING_Y 2
546
547#define I915_BIT_6_SWIZZLE_NONE 0
548#define I915_BIT_6_SWIZZLE_9 1
549#define I915_BIT_6_SWIZZLE_9_10 2
550#define I915_BIT_6_SWIZZLE_9_11 3
551#define I915_BIT_6_SWIZZLE_9_10_11 4
552/* Not seen by userland */
553#define I915_BIT_6_SWIZZLE_UNKNOWN 5
554
555struct drm_i915_gem_set_tiling {
556 /** Handle of the buffer to have its tiling state updated */
557 uint32_t handle;
558
559 /**
560 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
561 * I915_TILING_Y).
562 *
563 * This value is to be set on request, and will be updated by the
564 * kernel on successful return with the actual chosen tiling layout.
565 *
566 * The tiling mode may be demoted to I915_TILING_NONE when the system
567 * has bit 6 swizzling that can't be managed correctly by GEM.
568 *
569 * Buffer contents become undefined when changing tiling_mode.
570 */
571 uint32_t tiling_mode;
572
573 /**
574 * Stride in bytes for the object when in I915_TILING_X or
575 * I915_TILING_Y.
576 */
577 uint32_t stride;
578
579 /**
580 * Returned address bit 6 swizzling required for CPU access through
581 * mmap mapping.
582 */
583 uint32_t swizzle_mode;
584};
585
586struct drm_i915_gem_get_tiling {
587 /** Handle of the buffer to get tiling state for. */
588 uint32_t handle;
589
590 /**
591 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
592 * I915_TILING_Y).
593 */
594 uint32_t tiling_mode;
595
596 /**
597 * Returned address bit 6 swizzling required for CPU access through
598 * mmap mapping.
599 */
600 uint32_t swizzle_mode;
601};
602
270#endif /* _I915_DRM_H_ */ 603#endif /* _I915_DRM_H_ */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 282a504bd1db..bf9aca548f14 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -107,6 +107,7 @@ header-y += keyctl.h
107header-y += limits.h 107header-y += limits.h
108header-y += magic.h 108header-y += magic.h
109header-y += major.h 109header-y += major.h
110header-y += map_to_7segment.h
110header-y += matroxfb.h 111header-y += matroxfb.h
111header-y += meye.h 112header-y += meye.h
112header-y += minix_fs.h 113header-y += minix_fs.h
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 09b276c35227..f6b8cf99b596 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -204,12 +204,21 @@ struct kioctx {
204/* prototypes */ 204/* prototypes */
205extern unsigned aio_max_size; 205extern unsigned aio_max_size;
206 206
207#ifdef CONFIG_AIO
207extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb); 208extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
208extern int aio_put_req(struct kiocb *iocb); 209extern int aio_put_req(struct kiocb *iocb);
209extern void kick_iocb(struct kiocb *iocb); 210extern void kick_iocb(struct kiocb *iocb);
210extern int aio_complete(struct kiocb *iocb, long res, long res2); 211extern int aio_complete(struct kiocb *iocb, long res, long res2);
211struct mm_struct; 212struct mm_struct;
212extern void exit_aio(struct mm_struct *mm); 213extern void exit_aio(struct mm_struct *mm);
214#else
215static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
216static inline int aio_put_req(struct kiocb *iocb) { return 0; }
217static inline void kick_iocb(struct kiocb *iocb) { }
218static inline int aio_complete(struct kiocb *iocb, long res, long res2) { return 0; }
219struct mm_struct;
220static inline void exit_aio(struct mm_struct *mm) { }
221#endif /* CONFIG_AIO */
213 222
214#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) 223#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
215 224
diff --git a/include/linux/auto_dev-ioctl.h b/include/linux/auto_dev-ioctl.h
new file mode 100644
index 000000000000..f4d05ccd731f
--- /dev/null
+++ b/include/linux/auto_dev-ioctl.h
@@ -0,0 +1,157 @@
1/*
2 * Copyright 2008 Red Hat, Inc. All rights reserved.
3 * Copyright 2008 Ian Kent <raven@themaw.net>
4 *
5 * This file is part of the Linux kernel and is made available under
6 * the terms of the GNU General Public License, version 2, or at your
7 * option, any later version, incorporated herein by reference.
8 */
9
10#ifndef _LINUX_AUTO_DEV_IOCTL_H
11#define _LINUX_AUTO_DEV_IOCTL_H
12
13#include <linux/types.h>
14
15#define AUTOFS_DEVICE_NAME "autofs"
16
17#define AUTOFS_DEV_IOCTL_VERSION_MAJOR 1
18#define AUTOFS_DEV_IOCTL_VERSION_MINOR 0
19
20#define AUTOFS_DEVID_LEN 16
21
22#define AUTOFS_DEV_IOCTL_SIZE sizeof(struct autofs_dev_ioctl)
23
24/*
25 * An ioctl interface for autofs mount point control.
26 */
27
28/*
29 * All the ioctls use this structure.
30 * When sending a path size must account for the total length
31 * of the chunk of memory otherwise is is the size of the
32 * structure.
33 */
34
35struct autofs_dev_ioctl {
36 __u32 ver_major;
37 __u32 ver_minor;
38 __u32 size; /* total size of data passed in
39 * including this struct */
40 __s32 ioctlfd; /* automount command fd */
41
42 __u32 arg1; /* Command parameters */
43 __u32 arg2;
44
45 char path[0];
46};
47
48static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in)
49{
50 in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR;
51 in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR;
52 in->size = sizeof(struct autofs_dev_ioctl);
53 in->ioctlfd = -1;
54 in->arg1 = 0;
55 in->arg2 = 0;
56 return;
57}
58
59/*
60 * If you change this make sure you make the corresponding change
61 * to autofs-dev-ioctl.c:lookup_ioctl()
62 */
63enum {
64 /* Get various version info */
65 AUTOFS_DEV_IOCTL_VERSION_CMD = 0x71,
66 AUTOFS_DEV_IOCTL_PROTOVER_CMD,
67 AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD,
68
69 /* Open mount ioctl fd */
70 AUTOFS_DEV_IOCTL_OPENMOUNT_CMD,
71
72 /* Close mount ioctl fd */
73 AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD,
74
75 /* Mount/expire status returns */
76 AUTOFS_DEV_IOCTL_READY_CMD,
77 AUTOFS_DEV_IOCTL_FAIL_CMD,
78
79 /* Activate/deactivate autofs mount */
80 AUTOFS_DEV_IOCTL_SETPIPEFD_CMD,
81 AUTOFS_DEV_IOCTL_CATATONIC_CMD,
82
83 /* Expiry timeout */
84 AUTOFS_DEV_IOCTL_TIMEOUT_CMD,
85
86 /* Get mount last requesting uid and gid */
87 AUTOFS_DEV_IOCTL_REQUESTER_CMD,
88
89 /* Check for eligible expire candidates */
90 AUTOFS_DEV_IOCTL_EXPIRE_CMD,
91
92 /* Request busy status */
93 AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD,
94
95 /* Check if path is a mountpoint */
96 AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD,
97};
98
99#define AUTOFS_IOCTL 0x93
100
101#define AUTOFS_DEV_IOCTL_VERSION \
102 _IOWR(AUTOFS_IOCTL, \
103 AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl)
104
105#define AUTOFS_DEV_IOCTL_PROTOVER \
106 _IOWR(AUTOFS_IOCTL, \
107 AUTOFS_DEV_IOCTL_PROTOVER_CMD, struct autofs_dev_ioctl)
108
109#define AUTOFS_DEV_IOCTL_PROTOSUBVER \
110 _IOWR(AUTOFS_IOCTL, \
111 AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, struct autofs_dev_ioctl)
112
113#define AUTOFS_DEV_IOCTL_OPENMOUNT \
114 _IOWR(AUTOFS_IOCTL, \
115 AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, struct autofs_dev_ioctl)
116
117#define AUTOFS_DEV_IOCTL_CLOSEMOUNT \
118 _IOWR(AUTOFS_IOCTL, \
119 AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, struct autofs_dev_ioctl)
120
121#define AUTOFS_DEV_IOCTL_READY \
122 _IOWR(AUTOFS_IOCTL, \
123 AUTOFS_DEV_IOCTL_READY_CMD, struct autofs_dev_ioctl)
124
125#define AUTOFS_DEV_IOCTL_FAIL \
126 _IOWR(AUTOFS_IOCTL, \
127 AUTOFS_DEV_IOCTL_FAIL_CMD, struct autofs_dev_ioctl)
128
129#define AUTOFS_DEV_IOCTL_SETPIPEFD \
130 _IOWR(AUTOFS_IOCTL, \
131 AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, struct autofs_dev_ioctl)
132
133#define AUTOFS_DEV_IOCTL_CATATONIC \
134 _IOWR(AUTOFS_IOCTL, \
135 AUTOFS_DEV_IOCTL_CATATONIC_CMD, struct autofs_dev_ioctl)
136
137#define AUTOFS_DEV_IOCTL_TIMEOUT \
138 _IOWR(AUTOFS_IOCTL, \
139 AUTOFS_DEV_IOCTL_TIMEOUT_CMD, struct autofs_dev_ioctl)
140
141#define AUTOFS_DEV_IOCTL_REQUESTER \
142 _IOWR(AUTOFS_IOCTL, \
143 AUTOFS_DEV_IOCTL_REQUESTER_CMD, struct autofs_dev_ioctl)
144
145#define AUTOFS_DEV_IOCTL_EXPIRE \
146 _IOWR(AUTOFS_IOCTL, \
147 AUTOFS_DEV_IOCTL_EXPIRE_CMD, struct autofs_dev_ioctl)
148
149#define AUTOFS_DEV_IOCTL_ASKUMOUNT \
150 _IOWR(AUTOFS_IOCTL, \
151 AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, struct autofs_dev_ioctl)
152
153#define AUTOFS_DEV_IOCTL_ISMOUNTPOINT \
154 _IOWR(AUTOFS_IOCTL, \
155 AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, struct autofs_dev_ioctl)
156
157#endif /* _LINUX_AUTO_DEV_IOCTL_H */
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
index b785c6f8644d..2253716d4b92 100644
--- a/include/linux/auto_fs4.h
+++ b/include/linux/auto_fs4.h
@@ -23,12 +23,17 @@
23#define AUTOFS_MIN_PROTO_VERSION 3 23#define AUTOFS_MIN_PROTO_VERSION 3
24#define AUTOFS_MAX_PROTO_VERSION 5 24#define AUTOFS_MAX_PROTO_VERSION 5
25 25
26#define AUTOFS_PROTO_SUBVERSION 0 26#define AUTOFS_PROTO_SUBVERSION 1
27 27
28/* Mask for expire behaviour */ 28/* Mask for expire behaviour */
29#define AUTOFS_EXP_IMMEDIATE 1 29#define AUTOFS_EXP_IMMEDIATE 1
30#define AUTOFS_EXP_LEAVES 2 30#define AUTOFS_EXP_LEAVES 2
31 31
32#define AUTOFS_TYPE_ANY 0x0000
33#define AUTOFS_TYPE_INDIRECT 0x0001
34#define AUTOFS_TYPE_DIRECT 0x0002
35#define AUTOFS_TYPE_OFFSET 0x0004
36
32/* Daemon notification packet types */ 37/* Daemon notification packet types */
33enum autofs_notify { 38enum autofs_notify {
34 NFY_NONE, 39 NFY_NONE,
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 826f62350805..7394b5b349ff 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -36,6 +36,10 @@ struct linux_binprm{
36 unsigned long p; /* current top of mem */ 36 unsigned long p; /* current top of mem */
37 unsigned int sh_bang:1, 37 unsigned int sh_bang:1,
38 misc_bang:1; 38 misc_bang:1;
39#ifdef __alpha__
40 unsigned int taso:1;
41#endif
42 unsigned int recursion_depth;
39 struct file * file; 43 struct file * file;
40 int e_uid, e_gid; 44 int e_uid, e_gid;
41 kernel_cap_t cap_post_exec_permitted; 45 kernel_cap_t cap_post_exec_permitted;
@@ -58,6 +62,7 @@ struct linux_binprm{
58#define BINPRM_FLAGS_EXECFD_BIT 1 62#define BINPRM_FLAGS_EXECFD_BIT 1
59#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT) 63#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT)
60 64
65#define BINPRM_MAX_RECURSION 4
61 66
62/* 67/*
63 * This structure defines the functions that are used to load the binary formats that 68 * This structure defines the functions that are used to load the binary formats that
diff --git a/include/linux/bio.h b/include/linux/bio.h
index ff5b4cf9e2da..1c91a176b9ae 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -79,6 +79,13 @@ struct bio {
79 79
80 unsigned int bi_size; /* residual I/O count */ 80 unsigned int bi_size; /* residual I/O count */
81 81
82 /*
83 * To keep track of the max segment size, we account for the
84 * sizes of the first and last mergeable segments in this bio.
85 */
86 unsigned int bi_seg_front_size;
87 unsigned int bi_seg_back_size;
88
82 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ 89 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
83 90
84 unsigned int bi_comp_cpu; /* completion CPU */ 91 unsigned int bi_comp_cpu; /* completion CPU */
@@ -129,25 +136,30 @@ struct bio {
129 * bit 2 -- barrier 136 * bit 2 -- barrier
130 * Insert a serialization point in the IO queue, forcing previously 137 * Insert a serialization point in the IO queue, forcing previously
131 * submitted IO to be completed before this oen is issued. 138 * submitted IO to be completed before this oen is issued.
132 * bit 3 -- fail fast, don't want low level driver retries 139 * bit 3 -- synchronous I/O hint: the block layer will unplug immediately
133 * bit 4 -- synchronous I/O hint: the block layer will unplug immediately
134 * Note that this does NOT indicate that the IO itself is sync, just 140 * Note that this does NOT indicate that the IO itself is sync, just
135 * that the block layer will not postpone issue of this IO by plugging. 141 * that the block layer will not postpone issue of this IO by plugging.
136 * bit 5 -- metadata request 142 * bit 4 -- metadata request
137 * Used for tracing to differentiate metadata and data IO. May also 143 * Used for tracing to differentiate metadata and data IO. May also
138 * get some preferential treatment in the IO scheduler 144 * get some preferential treatment in the IO scheduler
139 * bit 6 -- discard sectors 145 * bit 5 -- discard sectors
140 * Informs the lower level device that this range of sectors is no longer 146 * Informs the lower level device that this range of sectors is no longer
141 * used by the file system and may thus be freed by the device. Used 147 * used by the file system and may thus be freed by the device. Used
142 * for flash based storage. 148 * for flash based storage.
149 * bit 6 -- fail fast device errors
150 * bit 7 -- fail fast transport errors
151 * bit 8 -- fail fast driver errors
152 * Don't want driver retries for any fast fail whatever the reason.
143 */ 153 */
144#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ 154#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */
145#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ 155#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */
146#define BIO_RW_BARRIER 2 156#define BIO_RW_BARRIER 2
147#define BIO_RW_FAILFAST 3 157#define BIO_RW_SYNC 3
148#define BIO_RW_SYNC 4 158#define BIO_RW_META 4
149#define BIO_RW_META 5 159#define BIO_RW_DISCARD 5
150#define BIO_RW_DISCARD 6 160#define BIO_RW_FAILFAST_DEV 6
161#define BIO_RW_FAILFAST_TRANSPORT 7
162#define BIO_RW_FAILFAST_DRIVER 8
151 163
152/* 164/*
153 * upper 16 bits of bi_rw define the io priority of this bio 165 * upper 16 bits of bi_rw define the io priority of this bio
@@ -174,7 +186,10 @@ struct bio {
174#define bio_sectors(bio) ((bio)->bi_size >> 9) 186#define bio_sectors(bio) ((bio)->bi_size >> 9)
175#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) 187#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER))
176#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) 188#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC))
177#define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST)) 189#define bio_failfast_dev(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DEV))
190#define bio_failfast_transport(bio) \
191 ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_TRANSPORT))
192#define bio_failfast_driver(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DRIVER))
178#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) 193#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
179#define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) 194#define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META))
180#define bio_discard(bio) ((bio)->bi_rw & (1 << BIO_RW_DISCARD)) 195#define bio_discard(bio) ((bio)->bi_rw & (1 << BIO_RW_DISCARD))
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index a92d9e4ea96e..b4fe68fe3a57 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -87,7 +87,9 @@ enum {
87 */ 87 */
88enum rq_flag_bits { 88enum rq_flag_bits {
89 __REQ_RW, /* not set, read. set, write */ 89 __REQ_RW, /* not set, read. set, write */
90 __REQ_FAILFAST, /* no low level driver retries */ 90 __REQ_FAILFAST_DEV, /* no driver retries of device errors */
91 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
92 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */
91 __REQ_DISCARD, /* request to discard sectors */ 93 __REQ_DISCARD, /* request to discard sectors */
92 __REQ_SORTED, /* elevator knows about this request */ 94 __REQ_SORTED, /* elevator knows about this request */
93 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ 95 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
@@ -111,8 +113,10 @@ enum rq_flag_bits {
111}; 113};
112 114
113#define REQ_RW (1 << __REQ_RW) 115#define REQ_RW (1 << __REQ_RW)
116#define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV)
117#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT)
118#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER)
114#define REQ_DISCARD (1 << __REQ_DISCARD) 119#define REQ_DISCARD (1 << __REQ_DISCARD)
115#define REQ_FAILFAST (1 << __REQ_FAILFAST)
116#define REQ_SORTED (1 << __REQ_SORTED) 120#define REQ_SORTED (1 << __REQ_SORTED)
117#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) 121#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
118#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) 122#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
@@ -560,7 +564,12 @@ enum {
560#define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL) 564#define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL)
561#define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE) 565#define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE)
562 566
563#define blk_noretry_request(rq) ((rq)->cmd_flags & REQ_FAILFAST) 567#define blk_failfast_dev(rq) ((rq)->cmd_flags & REQ_FAILFAST_DEV)
568#define blk_failfast_transport(rq) ((rq)->cmd_flags & REQ_FAILFAST_TRANSPORT)
569#define blk_failfast_driver(rq) ((rq)->cmd_flags & REQ_FAILFAST_DRIVER)
570#define blk_noretry_request(rq) (blk_failfast_dev(rq) || \
571 blk_failfast_transport(rq) || \
572 blk_failfast_driver(rq))
564#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) 573#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED)
565 574
566#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq))) 575#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
@@ -856,7 +865,6 @@ extern void blk_ordered_complete_seq(struct request_queue *, unsigned, int);
856extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); 865extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
857extern void blk_dump_rq_flags(struct request *, char *); 866extern void blk_dump_rq_flags(struct request *, char *);
858extern void generic_unplug_device(struct request_queue *); 867extern void generic_unplug_device(struct request_queue *);
859extern void __generic_unplug_device(struct request_queue *);
860extern long nr_blockdev_pages(void); 868extern long nr_blockdev_pages(void);
861 869
862int blk_get_queue(struct request_queue *); 870int blk_get_queue(struct request_queue *);
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 3a31eb506164..bdf505d33e77 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -24,6 +24,7 @@ enum blktrace_cat {
24 BLK_TC_AHEAD = 1 << 11, /* readahead */ 24 BLK_TC_AHEAD = 1 << 11, /* readahead */
25 BLK_TC_META = 1 << 12, /* metadata */ 25 BLK_TC_META = 1 << 12, /* metadata */
26 BLK_TC_DISCARD = 1 << 13, /* discard requests */ 26 BLK_TC_DISCARD = 1 << 13, /* discard requests */
27 BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */
27 28
28 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ 29 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */
29}; 30};
@@ -51,6 +52,7 @@ enum blktrace_act {
51 __BLK_TA_BOUNCE, /* bio was bounced */ 52 __BLK_TA_BOUNCE, /* bio was bounced */
52 __BLK_TA_REMAP, /* bio was remapped */ 53 __BLK_TA_REMAP, /* bio was remapped */
53 __BLK_TA_ABORT, /* request aborted */ 54 __BLK_TA_ABORT, /* request aborted */
55 __BLK_TA_DRV_DATA, /* driver-specific binary data */
54}; 56};
55 57
56/* 58/*
@@ -82,6 +84,7 @@ enum blktrace_notify {
82#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) 84#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE)
83#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) 85#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE))
84#define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE)) 86#define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE))
87#define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA))
85 88
86#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) 89#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
87#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) 90#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
@@ -317,6 +320,34 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
317 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r); 320 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
318} 321}
319 322
323/**
324 * blk_add_driver_data - Add binary message with driver-specific data
325 * @q: queue the io is for
326 * @rq: io request
327 * @data: driver-specific data
328 * @len: length of driver-specific data
329 *
330 * Description:
331 * Some drivers might want to write driver-specific data per request.
332 *
333 **/
334static inline void blk_add_driver_data(struct request_queue *q,
335 struct request *rq,
336 void *data, size_t len)
337{
338 struct blk_trace *bt = q->blk_trace;
339
340 if (likely(!bt))
341 return;
342
343 if (blk_pc_request(rq))
344 __blk_add_trace(bt, 0, rq->data_len, 0, BLK_TA_DRV_DATA,
345 rq->errors, len, data);
346 else
347 __blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9,
348 0, BLK_TA_DRV_DATA, rq->errors, len, data);
349}
350
320extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, 351extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
321 char __user *arg); 352 char __user *arg);
322extern int blk_trace_startstop(struct request_queue *q, int start); 353extern int blk_trace_startstop(struct request_queue *q, int start);
@@ -330,6 +361,7 @@ extern int blk_trace_remove(struct request_queue *q);
330#define blk_add_trace_generic(q, rq, rw, what) do { } while (0) 361#define blk_add_trace_generic(q, rq, rw, what) do { } while (0)
331#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0) 362#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0)
332#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0) 363#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0)
364#define blk_add_driver_data(q, rq, data, len) do {} while (0)
333#define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY) 365#define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY)
334#define blk_trace_setup(q, name, dev, arg) (-ENOTTY) 366#define blk_trace_setup(q, name, dev, arg) (-ENOTTY)
335#define blk_trace_startstop(q, start) (-ENOTTY) 367#define blk_trace_startstop(q, start) (-ENOTTY)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index c98dd7cb7076..30934e4bfaab 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -326,7 +326,8 @@ struct cgroup_subsys {
326 */ 326 */
327 void (*mm_owner_changed)(struct cgroup_subsys *ss, 327 void (*mm_owner_changed)(struct cgroup_subsys *ss,
328 struct cgroup *old, 328 struct cgroup *old,
329 struct cgroup *new); 329 struct cgroup *new,
330 struct task_struct *p);
330 int subsys_id; 331 int subsys_id;
331 int active; 332 int active;
332 int disabled; 333 int disabled;
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 5ca8c6fddb56..778777316ea4 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -35,6 +35,8 @@ struct clk;
35 * clk_get may return different clock producers depending on @dev.) 35 * clk_get may return different clock producers depending on @dev.)
36 * 36 *
37 * Drivers must assume that the clock source is not enabled. 37 * Drivers must assume that the clock source is not enabled.
38 *
39 * clk_get should not be called from within interrupt context.
38 */ 40 */
39struct clk *clk_get(struct device *dev, const char *id); 41struct clk *clk_get(struct device *dev, const char *id);
40 42
@@ -76,6 +78,8 @@ unsigned long clk_get_rate(struct clk *clk);
76 * Note: drivers must ensure that all clk_enable calls made on this 78 * Note: drivers must ensure that all clk_enable calls made on this
77 * clock source are balanced by clk_disable calls prior to calling 79 * clock source are balanced by clk_disable calls prior to calling
78 * this function. 80 * this function.
81 *
82 * clk_put should not be called from within interrupt context.
79 */ 83 */
80void clk_put(struct clk *clk); 84void clk_put(struct clk *clk);
81 85
diff --git a/include/linux/compat.h b/include/linux/compat.h
index cf8d11cad5ae..f061a1ea1b74 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -78,7 +78,6 @@ typedef struct {
78 compat_sigset_word sig[_COMPAT_NSIG_WORDS]; 78 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
79} compat_sigset_t; 79} compat_sigset_t;
80 80
81extern int cp_compat_stat(struct kstat *, struct compat_stat __user *);
82extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *); 81extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *);
83extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *); 82extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *);
84 83
@@ -235,6 +234,11 @@ extern int get_compat_itimerspec(struct itimerspec *dst,
235extern int put_compat_itimerspec(struct compat_itimerspec __user *dst, 234extern int put_compat_itimerspec(struct compat_itimerspec __user *dst,
236 const struct itimerspec *src); 235 const struct itimerspec *src);
237 236
237asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv,
238 struct timezone __user *tz);
239asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
240 struct timezone __user *tz);
241
238asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); 242asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
239 243
240extern int compat_printk(const char *fmt, ...); 244extern int compat_printk(const char *fmt, ...);
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index b03f80a078be..d71f7c0f931b 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -53,7 +53,6 @@ struct vc_data {
53 unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ 53 unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */
54 struct console_font vc_font; /* Current VC font set */ 54 struct console_font vc_font; /* Current VC font set */
55 unsigned short vc_video_erase_char; /* Background erase character */ 55 unsigned short vc_video_erase_char; /* Background erase character */
56 unsigned short vc_scrl_erase_char; /* Erase character for scroll */
57 /* VT terminal data */ 56 /* VT terminal data */
58 unsigned int vc_state; /* Escape sequence parser state */ 57 unsigned int vc_state; /* Escape sequence parser state */
59 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ 58 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
diff --git a/include/linux/device.h b/include/linux/device.h
index 246937c9cbc7..987f5912720a 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -90,6 +90,9 @@ int __must_check bus_for_each_drv(struct bus_type *bus,
90 struct device_driver *start, void *data, 90 struct device_driver *start, void *data,
91 int (*fn)(struct device_driver *, void *)); 91 int (*fn)(struct device_driver *, void *));
92 92
93void bus_sort_breadthfirst(struct bus_type *bus,
94 int (*compare)(const struct device *a,
95 const struct device *b));
93/* 96/*
94 * Bus notifiers: Get notified of addition/removal of devices 97 * Bus notifiers: Get notified of addition/removal of devices
95 * and binding/unbinding of drivers to devices. 98 * and binding/unbinding of drivers to devices.
@@ -502,7 +505,6 @@ extern struct device *device_create(struct class *cls, struct device *parent,
502 dev_t devt, void *drvdata, 505 dev_t devt, void *drvdata,
503 const char *fmt, ...) 506 const char *fmt, ...)
504 __attribute__((format(printf, 5, 6))); 507 __attribute__((format(printf, 5, 6)));
505#define device_create_drvdata device_create
506extern void device_destroy(struct class *cls, dev_t devt); 508extern void device_destroy(struct class *cls, dev_t devt);
507 509
508/* 510/*
@@ -551,7 +553,11 @@ extern const char *dev_driver_string(const struct device *dev);
551#define dev_info(dev, format, arg...) \ 553#define dev_info(dev, format, arg...) \
552 dev_printk(KERN_INFO , dev , format , ## arg) 554 dev_printk(KERN_INFO , dev , format , ## arg)
553 555
554#ifdef DEBUG 556#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
557#define dev_dbg(dev, format, ...) do { \
558 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
559 } while (0)
560#elif defined(DEBUG)
555#define dev_dbg(dev, format, arg...) \ 561#define dev_dbg(dev, format, arg...) \
556 dev_printk(KERN_DEBUG , dev , format , ## arg) 562 dev_printk(KERN_DEBUG , dev , format , ## arg)
557#else 563#else
@@ -567,6 +573,14 @@ extern const char *dev_driver_string(const struct device *dev);
567 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) 573 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
568#endif 574#endif
569 575
576/*
577 * dev_WARN() acts like dev_printk(), but with the key difference
578 * of using a WARN/WARN_ON to get the message out, including the
579 * file/line information and a backtrace.
580 */
581#define dev_WARN(dev, format, arg...) \
582 WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg);
583
570/* Create alias, so I can be autoloaded. */ 584/* Create alias, so I can be autoloaded. */
571#define MODULE_ALIAS_CHARDEV(major,minor) \ 585#define MODULE_ALIAS_CHARDEV(major,minor) \
572 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) 586 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
new file mode 100644
index 000000000000..bff5c65f81dc
--- /dev/null
+++ b/include/linux/dma_remapping.h
@@ -0,0 +1,157 @@
1#ifndef _DMA_REMAPPING_H
2#define _DMA_REMAPPING_H
3
4/*
5 * We need a fixed PAGE_SIZE of 4K irrespective of
6 * arch PAGE_SIZE for IOMMU page tables.
7 */
8#define PAGE_SHIFT_4K (12)
9#define PAGE_SIZE_4K (1UL << PAGE_SHIFT_4K)
10#define PAGE_MASK_4K (((u64)-1) << PAGE_SHIFT_4K)
11#define PAGE_ALIGN_4K(addr) (((addr) + PAGE_SIZE_4K - 1) & PAGE_MASK_4K)
12
13#define IOVA_PFN(addr) ((addr) >> PAGE_SHIFT_4K)
14#define DMA_32BIT_PFN IOVA_PFN(DMA_32BIT_MASK)
15#define DMA_64BIT_PFN IOVA_PFN(DMA_64BIT_MASK)
16
17
18/*
19 * 0: Present
20 * 1-11: Reserved
21 * 12-63: Context Ptr (12 - (haw-1))
22 * 64-127: Reserved
23 */
24struct root_entry {
25 u64 val;
26 u64 rsvd1;
27};
28#define ROOT_ENTRY_NR (PAGE_SIZE_4K/sizeof(struct root_entry))
29static inline bool root_present(struct root_entry *root)
30{
31 return (root->val & 1);
32}
33static inline void set_root_present(struct root_entry *root)
34{
35 root->val |= 1;
36}
37static inline void set_root_value(struct root_entry *root, unsigned long value)
38{
39 root->val |= value & PAGE_MASK_4K;
40}
41
42struct context_entry;
43static inline struct context_entry *
44get_context_addr_from_root(struct root_entry *root)
45{
46 return (struct context_entry *)
47 (root_present(root)?phys_to_virt(
48 root->val & PAGE_MASK_4K):
49 NULL);
50}
51
52/*
53 * low 64 bits:
54 * 0: present
55 * 1: fault processing disable
56 * 2-3: translation type
57 * 12-63: address space root
58 * high 64 bits:
59 * 0-2: address width
60 * 3-6: aval
61 * 8-23: domain id
62 */
63struct context_entry {
64 u64 lo;
65 u64 hi;
66};
67#define context_present(c) ((c).lo & 1)
68#define context_fault_disable(c) (((c).lo >> 1) & 1)
69#define context_translation_type(c) (((c).lo >> 2) & 3)
70#define context_address_root(c) ((c).lo & PAGE_MASK_4K)
71#define context_address_width(c) ((c).hi & 7)
72#define context_domain_id(c) (((c).hi >> 8) & ((1 << 16) - 1))
73
74#define context_set_present(c) do {(c).lo |= 1;} while (0)
75#define context_set_fault_enable(c) \
76 do {(c).lo &= (((u64)-1) << 2) | 1;} while (0)
77#define context_set_translation_type(c, val) \
78 do { \
79 (c).lo &= (((u64)-1) << 4) | 3; \
80 (c).lo |= ((val) & 3) << 2; \
81 } while (0)
82#define CONTEXT_TT_MULTI_LEVEL 0
83#define context_set_address_root(c, val) \
84 do {(c).lo |= (val) & PAGE_MASK_4K;} while (0)
85#define context_set_address_width(c, val) do {(c).hi |= (val) & 7;} while (0)
86#define context_set_domain_id(c, val) \
87 do {(c).hi |= ((val) & ((1 << 16) - 1)) << 8;} while (0)
88#define context_clear_entry(c) do {(c).lo = 0; (c).hi = 0;} while (0)
89
90/*
91 * 0: readable
92 * 1: writable
93 * 2-6: reserved
94 * 7: super page
95 * 8-11: available
96 * 12-63: Host physcial address
97 */
98struct dma_pte {
99 u64 val;
100};
101#define dma_clear_pte(p) do {(p).val = 0;} while (0)
102
103#define DMA_PTE_READ (1)
104#define DMA_PTE_WRITE (2)
105
106#define dma_set_pte_readable(p) do {(p).val |= DMA_PTE_READ;} while (0)
107#define dma_set_pte_writable(p) do {(p).val |= DMA_PTE_WRITE;} while (0)
108#define dma_set_pte_prot(p, prot) \
109 do {(p).val = ((p).val & ~3) | ((prot) & 3); } while (0)
110#define dma_pte_addr(p) ((p).val & PAGE_MASK_4K)
111#define dma_set_pte_addr(p, addr) do {\
112 (p).val |= ((addr) & PAGE_MASK_4K); } while (0)
113#define dma_pte_present(p) (((p).val & 3) != 0)
114
115struct intel_iommu;
116
117struct dmar_domain {
118 int id; /* domain id */
119 struct intel_iommu *iommu; /* back pointer to owning iommu */
120
121 struct list_head devices; /* all devices' list */
122 struct iova_domain iovad; /* iova's that belong to this domain */
123
124 struct dma_pte *pgd; /* virtual address */
125 spinlock_t mapping_lock; /* page table lock */
126 int gaw; /* max guest address width */
127
128 /* adjusted guest address width, 0 is level 2 30-bit */
129 int agaw;
130
131#define DOMAIN_FLAG_MULTIPLE_DEVICES 1
132 int flags;
133};
134
135/* PCI domain-device relationship */
136struct device_domain_info {
137 struct list_head link; /* link to domain siblings */
138 struct list_head global; /* link to global list */
139 u8 bus; /* PCI bus numer */
140 u8 devfn; /* PCI devfn number */
141 struct pci_dev *dev; /* it's NULL for PCIE-to-PCI bridge */
142 struct dmar_domain *domain; /* pointer to domain */
143};
144
145extern int init_dmars(void);
146extern void free_dmar_iommu(struct intel_iommu *iommu);
147
148extern int dmar_disabled;
149
150#ifndef CONFIG_DMAR_GFX_WA
151static inline void iommu_prepare_gfx_mapping(void)
152{
153 return;
154}
155#endif /* !CONFIG_DMAR_GFX_WA */
156
157#endif
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 2a063b64133f..e5084eb5943a 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -2,29 +2,9 @@
2#define __DMI_H__ 2#define __DMI_H__
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/mod_devicetable.h>
5 6
6enum dmi_field { 7/* enum dmi_field is in mod_devicetable.h */
7 DMI_NONE,
8 DMI_BIOS_VENDOR,
9 DMI_BIOS_VERSION,
10 DMI_BIOS_DATE,
11 DMI_SYS_VENDOR,
12 DMI_PRODUCT_NAME,
13 DMI_PRODUCT_VERSION,
14 DMI_PRODUCT_SERIAL,
15 DMI_PRODUCT_UUID,
16 DMI_BOARD_VENDOR,
17 DMI_BOARD_NAME,
18 DMI_BOARD_VERSION,
19 DMI_BOARD_SERIAL,
20 DMI_BOARD_ASSET_TAG,
21 DMI_CHASSIS_VENDOR,
22 DMI_CHASSIS_TYPE,
23 DMI_CHASSIS_VERSION,
24 DMI_CHASSIS_SERIAL,
25 DMI_CHASSIS_ASSET_TAG,
26 DMI_STRING_MAX,
27};
28 8
29enum dmi_device_type { 9enum dmi_device_type {
30 DMI_DEV_TYPE_ANY = 0, 10 DMI_DEV_TYPE_ANY = 0,
@@ -48,23 +28,6 @@ struct dmi_header {
48 u16 handle; 28 u16 handle;
49}; 29};
50 30
51/*
52 * DMI callbacks for problem boards
53 */
54struct dmi_strmatch {
55 u8 slot;
56 char *substr;
57};
58
59struct dmi_system_id {
60 int (*callback)(const struct dmi_system_id *);
61 const char *ident;
62 struct dmi_strmatch matches[4];
63 void *driver_data;
64};
65
66#define DMI_MATCH(a, b) { a, b }
67
68struct dmi_device { 31struct dmi_device {
69 struct list_head list; 32 struct list_head list;
70 int type; 33 int type;
diff --git a/include/linux/ds1286.h b/include/linux/ds1286.h
index d8989860e4ce..45ea0aa0aeb9 100644
--- a/include/linux/ds1286.h
+++ b/include/linux/ds1286.h
@@ -8,8 +8,6 @@
8#ifndef __LINUX_DS1286_H 8#ifndef __LINUX_DS1286_H
9#define __LINUX_DS1286_H 9#define __LINUX_DS1286_H
10 10
11#include <asm/ds1286.h>
12
13/********************************************************************** 11/**********************************************************************
14 * register summary 12 * register summary
15 **********************************************************************/ 13 **********************************************************************/
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index c8cbd90ba375..79a8ed8e6a7d 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -62,6 +62,7 @@ typedef enum fe_caps {
62 FE_CAN_HIERARCHY_AUTO = 0x100000, 62 FE_CAN_HIERARCHY_AUTO = 0x100000,
63 FE_CAN_8VSB = 0x200000, 63 FE_CAN_8VSB = 0x200000,
64 FE_CAN_16VSB = 0x400000, 64 FE_CAN_16VSB = 0x400000,
65 FE_HAS_EXTENDED_CAPS = 0x800000, // We need more bitspace for newer APIs, indicate this.
65 FE_NEEDS_BENDING = 0x20000000, // not supported anymore, don't use (frontend requires frequency bending) 66 FE_NEEDS_BENDING = 0x20000000, // not supported anymore, don't use (frontend requires frequency bending)
66 FE_CAN_RECOVER = 0x40000000, // frontend can recover from a cable unplug automatically 67 FE_CAN_RECOVER = 0x40000000, // frontend can recover from a cable unplug automatically
67 FE_CAN_MUTE_TS = 0x80000000 // frontend can stop spurious TS data output 68 FE_CAN_MUTE_TS = 0x80000000 // frontend can stop spurious TS data output
@@ -147,7 +148,9 @@ typedef enum fe_code_rate {
147 FEC_6_7, 148 FEC_6_7,
148 FEC_7_8, 149 FEC_7_8,
149 FEC_8_9, 150 FEC_8_9,
150 FEC_AUTO 151 FEC_AUTO,
152 FEC_3_5,
153 FEC_9_10,
151} fe_code_rate_t; 154} fe_code_rate_t;
152 155
153 156
@@ -160,7 +163,11 @@ typedef enum fe_modulation {
160 QAM_256, 163 QAM_256,
161 QAM_AUTO, 164 QAM_AUTO,
162 VSB_8, 165 VSB_8,
163 VSB_16 166 VSB_16,
167 PSK_8,
168 APSK_16,
169 APSK_32,
170 DQPSK,
164} fe_modulation_t; 171} fe_modulation_t;
165 172
166typedef enum fe_transmit_mode { 173typedef enum fe_transmit_mode {
@@ -239,6 +246,107 @@ struct dvb_frontend_event {
239 struct dvb_frontend_parameters parameters; 246 struct dvb_frontend_parameters parameters;
240}; 247};
241 248
249/* S2API Commands */
250#define DTV_UNDEFINED 0
251#define DTV_TUNE 1
252#define DTV_CLEAR 2
253#define DTV_FREQUENCY 3
254#define DTV_MODULATION 4
255#define DTV_BANDWIDTH_HZ 5
256#define DTV_INVERSION 6
257#define DTV_DISEQC_MASTER 7
258#define DTV_SYMBOL_RATE 8
259#define DTV_INNER_FEC 9
260#define DTV_VOLTAGE 10
261#define DTV_TONE 11
262#define DTV_PILOT 12
263#define DTV_ROLLOFF 13
264#define DTV_DISEQC_SLAVE_REPLY 14
265
266/* Basic enumeration set for querying unlimited capabilities */
267#define DTV_FE_CAPABILITY_COUNT 15
268#define DTV_FE_CAPABILITY 16
269#define DTV_DELIVERY_SYSTEM 17
270
271#define DTV_API_VERSION 35
272#define DTV_API_VERSION 35
273#define DTV_CODE_RATE_HP 36
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
279#define DTV_MAX_COMMAND DTV_HIERARCHY
280
281typedef enum fe_pilot {
282 PILOT_ON,
283 PILOT_OFF,
284 PILOT_AUTO,
285} fe_pilot_t;
286
287typedef enum fe_rolloff {
288 ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */
289 ROLLOFF_20,
290 ROLLOFF_25,
291 ROLLOFF_AUTO,
292} fe_rolloff_t;
293
294typedef enum fe_delivery_system {
295 SYS_UNDEFINED,
296 SYS_DVBC_ANNEX_AC,
297 SYS_DVBC_ANNEX_B,
298 SYS_DVBT,
299 SYS_DSS,
300 SYS_DVBS,
301 SYS_DVBS2,
302 SYS_DVBH,
303 SYS_ISDBT,
304 SYS_ISDBS,
305 SYS_ISDBC,
306 SYS_ATSC,
307 SYS_ATSCMH,
308 SYS_DMBTH,
309 SYS_CMMB,
310 SYS_DAB,
311} fe_delivery_system_t;
312
313struct dtv_cmds_h {
314 char *name; /* A display name for debugging purposes */
315
316 __u32 cmd; /* A unique ID */
317
318 /* Flags */
319 __u32 set:1; /* Either a set or get property */
320 __u32 buffer:1; /* Does this property use the buffer? */
321 __u32 reserved:30; /* Align */
322};
323
324struct dtv_property {
325 __u32 cmd;
326 __u32 reserved[3];
327 union {
328 __u32 data;
329 struct {
330 __u8 data[32];
331 __u32 len;
332 __u32 reserved1[3];
333 void *reserved2;
334 } buffer;
335 } u;
336 int result;
337} __attribute__ ((packed));
338
339/* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */
340#define DTV_IOCTL_MAX_MSGS 64
341
342struct dtv_properties {
343 __u32 num;
344 struct dtv_property *props;
345};
346
347#define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties)
348#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties)
349
242 350
243/** 351/**
244 * When set, this flag will disable any zigzagging or other "normal" tuning 352 * When set, this flag will disable any zigzagging or other "normal" tuning
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 126e0c26cb09..25b823b81734 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -23,7 +23,7 @@
23#ifndef _DVBVERSION_H_ 23#ifndef _DVBVERSION_H_
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 3 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 2 27#define DVB_API_VERSION_MINOR 0
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/dynamic_printk.h b/include/linux/dynamic_printk.h
new file mode 100644
index 000000000000..2d528d009074
--- /dev/null
+++ b/include/linux/dynamic_printk.h
@@ -0,0 +1,93 @@
1#ifndef _DYNAMIC_PRINTK_H
2#define _DYNAMIC_PRINTK_H
3
4#define DYNAMIC_DEBUG_HASH_BITS 6
5#define DEBUG_HASH_TABLE_SIZE (1 << DYNAMIC_DEBUG_HASH_BITS)
6
7#define TYPE_BOOLEAN 1
8
9#define DYNAMIC_ENABLED_ALL 0
10#define DYNAMIC_ENABLED_NONE 1
11#define DYNAMIC_ENABLED_SOME 2
12
13extern int dynamic_enabled;
14
15/* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which
16 * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They
17 * use independent hash functions, to reduce the chance of false positives.
18 */
19extern long long dynamic_printk_enabled;
20extern long long dynamic_printk_enabled2;
21
22struct mod_debug {
23 char *modname;
24 char *logical_modname;
25 char *flag_names;
26 int type;
27 int hash;
28 int hash2;
29} __attribute__((aligned(8)));
30
31int register_dynamic_debug_module(char *mod_name, int type, char *share_name,
32 char *flags, int hash, int hash2);
33
34#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
35extern int unregister_dynamic_debug_module(char *mod_name);
36extern int __dynamic_dbg_enabled_helper(char *modname, int type,
37 int value, int hash);
38
39#define __dynamic_dbg_enabled(module, type, value, level, hash) ({ \
40 int __ret = 0; \
41 if (unlikely((dynamic_printk_enabled & (1LL << DEBUG_HASH)) && \
42 (dynamic_printk_enabled2 & (1LL << DEBUG_HASH2)))) \
43 __ret = __dynamic_dbg_enabled_helper(module, type, \
44 value, hash);\
45 __ret; })
46
47#define dynamic_pr_debug(fmt, ...) do { \
48 static char mod_name[] \
49 __attribute__((section("__verbose_strings"))) \
50 = KBUILD_MODNAME; \
51 static struct mod_debug descriptor \
52 __used \
53 __attribute__((section("__verbose"), aligned(8))) = \
54 { mod_name, mod_name, NULL, TYPE_BOOLEAN, DEBUG_HASH, DEBUG_HASH2 };\
55 if (__dynamic_dbg_enabled(KBUILD_MODNAME, TYPE_BOOLEAN, \
56 0, 0, DEBUG_HASH)) \
57 printk(KERN_DEBUG KBUILD_MODNAME ":" fmt, \
58 ##__VA_ARGS__); \
59 } while (0)
60
61#define dynamic_dev_dbg(dev, format, ...) do { \
62 static char mod_name[] \
63 __attribute__((section("__verbose_strings"))) \
64 = KBUILD_MODNAME; \
65 static struct mod_debug descriptor \
66 __used \
67 __attribute__((section("__verbose"), aligned(8))) = \
68 { mod_name, mod_name, NULL, TYPE_BOOLEAN, DEBUG_HASH, DEBUG_HASH2 };\
69 if (__dynamic_dbg_enabled(KBUILD_MODNAME, TYPE_BOOLEAN, \
70 0, 0, DEBUG_HASH)) \
71 dev_printk(KERN_DEBUG, dev, \
72 KBUILD_MODNAME ": " format, \
73 ##__VA_ARGS__); \
74 } while (0)
75
76#else
77
78static inline int unregister_dynamic_debug_module(const char *mod_name)
79{
80 return 0;
81}
82static inline int __dynamic_dbg_enabled_helper(char *modname, int type,
83 int value, int hash)
84{
85 return 0;
86}
87
88#define __dynamic_dbg_enabled(module, type, value, level, hash) ({ 0; })
89#define dynamic_pr_debug(fmt, ...) do { } while (0)
90#define dynamic_dev_dbg(dev, format, ...) do { } while (0)
91#endif
92
93#endif
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 2efe7b863cff..78c775a83f7c 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -47,7 +47,7 @@
47#ifdef EXT2FS_DEBUG 47#ifdef EXT2FS_DEBUG
48# define ext2_debug(f, a...) { \ 48# define ext2_debug(f, a...) { \
49 printk ("EXT2-fs DEBUG (%s, %d): %s:", \ 49 printk ("EXT2-fs DEBUG (%s, %d): %s:", \
50 __FILE__, __LINE__, __FUNCTION__); \ 50 __FILE__, __LINE__, __func__); \
51 printk (f, ## a); \ 51 printk (f, ## a); \
52 } 52 }
53#else 53#else
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 8120fa1bc235..159d9b476cd7 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -43,7 +43,7 @@
43#define ext3_debug(f, a...) \ 43#define ext3_debug(f, a...) \
44 do { \ 44 do { \
45 printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \ 45 printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \
46 __FILE__, __LINE__, __FUNCTION__); \ 46 __FILE__, __LINE__, __func__); \
47 printk (KERN_DEBUG f, ## a); \ 47 printk (KERN_DEBUG f, ## a); \
48 } while (0) 48 } while (0)
49#else 49#else
@@ -871,7 +871,7 @@ extern void ext3_update_dynamic_rev (struct super_block *sb);
871#define ext3_std_error(sb, errno) \ 871#define ext3_std_error(sb, errno) \
872do { \ 872do { \
873 if ((errno)) \ 873 if ((errno)) \
874 __ext3_std_error((sb), __FUNCTION__, (errno)); \ 874 __ext3_std_error((sb), __func__, (errno)); \
875} while (0) 875} while (0)
876 876
877/* 877/*
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
index 8c43b13a02fe..cf82d519be40 100644
--- a/include/linux/ext3_jbd.h
+++ b/include/linux/ext3_jbd.h
@@ -137,17 +137,17 @@ int __ext3_journal_dirty_metadata(const char *where,
137 handle_t *handle, struct buffer_head *bh); 137 handle_t *handle, struct buffer_head *bh);
138 138
139#define ext3_journal_get_undo_access(handle, bh) \ 139#define ext3_journal_get_undo_access(handle, bh) \
140 __ext3_journal_get_undo_access(__FUNCTION__, (handle), (bh)) 140 __ext3_journal_get_undo_access(__func__, (handle), (bh))
141#define ext3_journal_get_write_access(handle, bh) \ 141#define ext3_journal_get_write_access(handle, bh) \
142 __ext3_journal_get_write_access(__FUNCTION__, (handle), (bh)) 142 __ext3_journal_get_write_access(__func__, (handle), (bh))
143#define ext3_journal_revoke(handle, blocknr, bh) \ 143#define ext3_journal_revoke(handle, blocknr, bh) \
144 __ext3_journal_revoke(__FUNCTION__, (handle), (blocknr), (bh)) 144 __ext3_journal_revoke(__func__, (handle), (blocknr), (bh))
145#define ext3_journal_get_create_access(handle, bh) \ 145#define ext3_journal_get_create_access(handle, bh) \
146 __ext3_journal_get_create_access(__FUNCTION__, (handle), (bh)) 146 __ext3_journal_get_create_access(__func__, (handle), (bh))
147#define ext3_journal_dirty_metadata(handle, bh) \ 147#define ext3_journal_dirty_metadata(handle, bh) \
148 __ext3_journal_dirty_metadata(__FUNCTION__, (handle), (bh)) 148 __ext3_journal_dirty_metadata(__func__, (handle), (bh))
149#define ext3_journal_forget(handle, bh) \ 149#define ext3_journal_forget(handle, bh) \
150 __ext3_journal_forget(__FUNCTION__, (handle), (bh)) 150 __ext3_journal_forget(__func__, (handle), (bh))
151 151
152int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh); 152int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh);
153 153
@@ -160,7 +160,7 @@ static inline handle_t *ext3_journal_start(struct inode *inode, int nblocks)
160} 160}
161 161
162#define ext3_journal_stop(handle) \ 162#define ext3_journal_stop(handle) \
163 __ext3_journal_stop(__FUNCTION__, (handle)) 163 __ext3_journal_stop(__func__, (handle))
164 164
165static inline handle_t *ext3_journal_current_handle(void) 165static inline handle_t *ext3_journal_current_handle(void)
166{ 166{
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index 0f0e271f97fa..4d078e99c017 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -154,8 +154,13 @@ struct fw_cdev_event_iso_interrupt {
154 * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST 154 * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST
155 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT 155 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT
156 * 156 *
157 * Convenience union for userspace use. Events could be read(2) into a char 157 * Convenience union for userspace use. Events could be read(2) into an
158 * buffer and then cast to this union for further processing. 158 * appropriately aligned char buffer and then cast to this union for further
159 * processing. Note that for a request, response or iso_interrupt event,
160 * the data[] or header[] may make the size of the full event larger than
161 * sizeof(union fw_cdev_event). Also note that if you attempt to read(2)
162 * an event into a buffer that is not large enough for it, the data that does
163 * not fit will be discarded so that the next read(2) will return a new event.
159 */ 164 */
160union fw_cdev_event { 165union fw_cdev_event {
161 struct fw_cdev_event_common common; 166 struct fw_cdev_event_common common;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 44e3cb2f1966..a6a625be13fc 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -947,6 +947,14 @@ struct lock_manager_operations {
947 int (*fl_change)(struct file_lock **, int); 947 int (*fl_change)(struct file_lock **, int);
948}; 948};
949 949
950struct lock_manager {
951 struct list_head list;
952};
953
954void locks_start_grace(struct lock_manager *);
955void locks_end_grace(struct lock_manager *);
956int locks_in_grace(void);
957
950/* that will die - we need it for nfs_lock_info */ 958/* that will die - we need it for nfs_lock_info */
951#include <linux/nfs_fs_i.h> 959#include <linux/nfs_fs_i.h>
952 960
@@ -988,6 +996,13 @@ struct file_lock {
988 996
989#include <linux/fcntl.h> 997#include <linux/fcntl.h>
990 998
999extern void send_sigio(struct fown_struct *fown, int fd, int band);
1000
1001/* fs/sync.c */
1002extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
1003 loff_t endbyte, unsigned int flags);
1004
1005#ifdef CONFIG_FILE_LOCKING
991extern int fcntl_getlk(struct file *, struct flock __user *); 1006extern int fcntl_getlk(struct file *, struct flock __user *);
992extern int fcntl_setlk(unsigned int, struct file *, unsigned int, 1007extern int fcntl_setlk(unsigned int, struct file *, unsigned int,
993 struct flock __user *); 1008 struct flock __user *);
@@ -998,14 +1013,9 @@ extern int fcntl_setlk64(unsigned int, struct file *, unsigned int,
998 struct flock64 __user *); 1013 struct flock64 __user *);
999#endif 1014#endif
1000 1015
1001extern void send_sigio(struct fown_struct *fown, int fd, int band);
1002extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); 1016extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
1003extern int fcntl_getlease(struct file *filp); 1017extern int fcntl_getlease(struct file *filp);
1004 1018
1005/* fs/sync.c */
1006extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
1007 loff_t endbyte, unsigned int flags);
1008
1009/* fs/locks.c */ 1019/* fs/locks.c */
1010extern void locks_init_lock(struct file_lock *); 1020extern void locks_init_lock(struct file_lock *);
1011extern void locks_copy_lock(struct file_lock *, struct file_lock *); 1021extern void locks_copy_lock(struct file_lock *, struct file_lock *);
@@ -1028,6 +1038,37 @@ extern int lease_modify(struct file_lock **, int);
1028extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 1038extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1029extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 1039extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1030extern struct seq_operations locks_seq_operations; 1040extern struct seq_operations locks_seq_operations;
1041#else /* !CONFIG_FILE_LOCKING */
1042#define fcntl_getlk(a, b) ({ -EINVAL; })
1043#define fcntl_setlk(a, b, c, d) ({ -EACCES; })
1044#if BITS_PER_LONG == 32
1045#define fcntl_getlk64(a, b) ({ -EINVAL; })
1046#define fcntl_setlk64(a, b, c, d) ({ -EACCES; })
1047#endif
1048#define fcntl_setlease(a, b, c) ({ 0; })
1049#define fcntl_getlease(a) ({ 0; })
1050#define locks_init_lock(a) ({ })
1051#define __locks_copy_lock(a, b) ({ })
1052#define locks_copy_lock(a, b) ({ })
1053#define locks_remove_posix(a, b) ({ })
1054#define locks_remove_flock(a) ({ })
1055#define posix_test_lock(a, b) ({ 0; })
1056#define posix_lock_file(a, b, c) ({ -ENOLCK; })
1057#define posix_lock_file_wait(a, b) ({ -ENOLCK; })
1058#define posix_unblock_lock(a, b) (-ENOENT)
1059#define vfs_test_lock(a, b) ({ 0; })
1060#define vfs_lock_file(a, b, c, d) (-ENOLCK)
1061#define vfs_cancel_lock(a, b) ({ 0; })
1062#define flock_lock_file_wait(a, b) ({ -ENOLCK; })
1063#define __break_lease(a, b) ({ 0; })
1064#define lease_get_mtime(a, b) ({ })
1065#define generic_setlease(a, b, c) ({ -EINVAL; })
1066#define vfs_setlease(a, b, c) ({ -EINVAL; })
1067#define lease_modify(a, b) ({ -EINVAL; })
1068#define lock_may_read(a, b, c) ({ 1; })
1069#define lock_may_write(a, b, c) ({ 1; })
1070#endif /* !CONFIG_FILE_LOCKING */
1071
1031 1072
1032struct fasync_struct { 1073struct fasync_struct {
1033 int magic; 1074 int magic;
@@ -1575,9 +1616,12 @@ extern int vfs_statfs(struct dentry *, struct kstatfs *);
1575/* /sys/fs */ 1616/* /sys/fs */
1576extern struct kobject *fs_kobj; 1617extern struct kobject *fs_kobj;
1577 1618
1619extern int rw_verify_area(int, struct file *, loff_t *, size_t);
1620
1578#define FLOCK_VERIFY_READ 1 1621#define FLOCK_VERIFY_READ 1
1579#define FLOCK_VERIFY_WRITE 2 1622#define FLOCK_VERIFY_WRITE 2
1580 1623
1624#ifdef CONFIG_FILE_LOCKING
1581extern int locks_mandatory_locked(struct inode *); 1625extern int locks_mandatory_locked(struct inode *);
1582extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); 1626extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
1583 1627
@@ -1608,8 +1652,6 @@ static inline int locks_verify_locked(struct inode *inode)
1608 return 0; 1652 return 0;
1609} 1653}
1610 1654
1611extern int rw_verify_area(int, struct file *, loff_t *, size_t);
1612
1613static inline int locks_verify_truncate(struct inode *inode, 1655static inline int locks_verify_truncate(struct inode *inode,
1614 struct file *filp, 1656 struct file *filp,
1615 loff_t size) 1657 loff_t size)
@@ -1630,6 +1672,15 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1630 return __break_lease(inode, mode); 1672 return __break_lease(inode, mode);
1631 return 0; 1673 return 0;
1632} 1674}
1675#else /* !CONFIG_FILE_LOCKING */
1676#define locks_mandatory_locked(a) ({ 0; })
1677#define locks_mandatory_area(a, b, c, d, e) ({ 0; })
1678#define __mandatory_lock(a) ({ 0; })
1679#define mandatory_lock(a) ({ 0; })
1680#define locks_verify_locked(a) ({ 0; })
1681#define locks_verify_truncate(a, b, c) ({ 0; })
1682#define break_lease(a, b) ({ 0; })
1683#endif /* CONFIG_FILE_LOCKING */
1633 1684
1634/* fs/open.c */ 1685/* fs/open.c */
1635 1686
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index f64e29c0ef3f..0cd825f7363a 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -146,10 +146,11 @@ static inline void gameport_unpin_driver(struct gameport *gameport)
146 mutex_unlock(&gameport->drv_mutex); 146 mutex_unlock(&gameport->drv_mutex);
147} 147}
148 148
149void __gameport_register_driver(struct gameport_driver *drv, struct module *owner); 149int __gameport_register_driver(struct gameport_driver *drv,
150static inline void gameport_register_driver(struct gameport_driver *drv) 150 struct module *owner, const char *mod_name);
151static inline int __must_check gameport_register_driver(struct gameport_driver *drv)
151{ 152{
152 __gameport_register_driver(drv, THIS_MODULE); 153 return __gameport_register_driver(drv, THIS_MODULE, KBUILD_MODNAME);
153} 154}
154 155
155void gameport_unregister_driver(struct gameport_driver *drv); 156void gameport_unregister_driver(struct gameport_driver *drv);
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 730a20b83576..e10c49a5b96e 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -8,6 +8,7 @@
8 8
9#else 9#else
10 10
11#include <linux/kernel.h>
11#include <linux/types.h> 12#include <linux/types.h>
12#include <linux/errno.h> 13#include <linux/errno.h>
13 14
@@ -32,6 +33,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
32 33
33static inline void gpio_free(unsigned gpio) 34static inline void gpio_free(unsigned gpio)
34{ 35{
36 might_sleep();
37
35 /* GPIO can never have been requested */ 38 /* GPIO can never have been requested */
36 WARN_ON(1); 39 WARN_ON(1);
37} 40}
diff --git a/include/linux/hid.h b/include/linux/hid.h
index ac4e678a04ed..f13bca2dd53b 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -67,6 +67,7 @@
67#include <linux/types.h> 67#include <linux/types.h>
68#include <linux/slab.h> 68#include <linux/slab.h>
69#include <linux/list.h> 69#include <linux/list.h>
70#include <linux/mod_devicetable.h> /* hid_device_id */
70#include <linux/timer.h> 71#include <linux/timer.h>
71#include <linux/workqueue.h> 72#include <linux/workqueue.h>
72#include <linux/input.h> 73#include <linux/input.h>
@@ -246,6 +247,19 @@ struct hid_item {
246#define HID_FEATURE_REPORT 2 247#define HID_FEATURE_REPORT 2
247 248
248/* 249/*
250 * HID connect requests
251 */
252
253#define HID_CONNECT_HIDINPUT 0x01
254#define HID_CONNECT_HIDINPUT_FORCE 0x02
255#define HID_CONNECT_HIDRAW 0x04
256#define HID_CONNECT_HIDDEV 0x08
257#define HID_CONNECT_HIDDEV_FORCE 0x10
258#define HID_CONNECT_FF 0x20
259#define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| \
260 HID_CONNECT_HIDDEV|HID_CONNECT_FF)
261
262/*
249 * HID device quirks. 263 * HID device quirks.
250 */ 264 */
251 265
@@ -256,48 +270,11 @@ struct hid_item {
256 270
257#define HID_QUIRK_INVERT 0x00000001 271#define HID_QUIRK_INVERT 0x00000001
258#define HID_QUIRK_NOTOUCH 0x00000002 272#define HID_QUIRK_NOTOUCH 0x00000002
259#define HID_QUIRK_IGNORE 0x00000004
260#define HID_QUIRK_NOGET 0x00000008 273#define HID_QUIRK_NOGET 0x00000008
261#define HID_QUIRK_HIDDEV 0x00000010
262#define HID_QUIRK_BADPAD 0x00000020 274#define HID_QUIRK_BADPAD 0x00000020
263#define HID_QUIRK_MULTI_INPUT 0x00000040 275#define HID_QUIRK_MULTI_INPUT 0x00000040
264#define HID_QUIRK_2WHEEL_MOUSE_HACK_7 0x00000080
265#define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x00000100
266#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x00000200
267#define HID_QUIRK_MIGHTYMOUSE 0x00000400
268#define HID_QUIRK_APPLE_HAS_FN 0x00000800
269#define HID_QUIRK_APPLE_FN_ON 0x00001000
270#define HID_QUIRK_INVERT_HWHEEL 0x00002000
271#define HID_QUIRK_APPLE_ISO_KEYBOARD 0x00004000
272#define HID_QUIRK_BAD_RELATIVE_KEYS 0x00008000
273#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 276#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
274#define HID_QUIRK_IGNORE_MOUSE 0x00020000
275#define HID_QUIRK_SONY_PS3_CONTROLLER 0x00040000
276#define HID_QUIRK_DUPLICATE_USAGES 0x00080000
277#define HID_QUIRK_RESET_LEDS 0x00100000
278#define HID_QUIRK_HIDINPUT 0x00200000
279#define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000
280#define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000
281#define HID_QUIRK_IGNORE_HIDINPUT 0x01000000
282#define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000
283#define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000
284#define HID_QUIRK_MICROSOFT_KEYS 0x08000000
285#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 277#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
286#define HID_QUIRK_APPLE_NUMLOCK_EMULATION 0x20000000
287
288/*
289 * Separate quirks for runtime report descriptor fixup
290 */
291
292#define HID_QUIRK_RDESC_CYMOTION 0x00000001
293#define HID_QUIRK_RDESC_LOGITECH 0x00000002
294#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004
295#define HID_QUIRK_RDESC_PETALYNX 0x00000008
296#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010
297#define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020
298#define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040
299#define HID_QUIRK_RDESC_MICROSOFT_RECV_1028 0x00000080
300#define HID_QUIRK_RDESC_SUNPLUS_WDESKTOP 0x00000100
301 278
302/* 279/*
303 * This is the global environment of the parser. This information is 280 * This is the global environment of the parser. This information is
@@ -411,12 +388,21 @@ struct hid_report_enum {
411struct hid_control_fifo { 388struct hid_control_fifo {
412 unsigned char dir; 389 unsigned char dir;
413 struct hid_report *report; 390 struct hid_report *report;
391 char *raw_report;
392};
393
394struct hid_output_fifo {
395 struct hid_report *report;
396 char *raw_report;
414}; 397};
415 398
416#define HID_CLAIMED_INPUT 1 399#define HID_CLAIMED_INPUT 1
417#define HID_CLAIMED_HIDDEV 2 400#define HID_CLAIMED_HIDDEV 2
418#define HID_CLAIMED_HIDRAW 4 401#define HID_CLAIMED_HIDRAW 4
419 402
403#define HID_STAT_ADDED 1
404#define HID_STAT_PARSED 2
405
420#define HID_CTRL_RUNNING 1 406#define HID_CTRL_RUNNING 1
421#define HID_OUT_RUNNING 2 407#define HID_OUT_RUNNING 2
422#define HID_IN_RUNNING 3 408#define HID_IN_RUNNING 3
@@ -431,22 +417,28 @@ struct hid_input {
431 struct input_dev *input; 417 struct input_dev *input;
432}; 418};
433 419
420struct hid_driver;
421struct hid_ll_driver;
422
434struct hid_device { /* device report descriptor */ 423struct hid_device { /* device report descriptor */
435 __u8 *rdesc; 424 __u8 *rdesc;
436 unsigned rsize; 425 unsigned rsize;
437 struct hid_collection *collection; /* List of HID collections */ 426 struct hid_collection *collection; /* List of HID collections */
438 unsigned collection_size; /* Number of allocated hid_collections */ 427 unsigned collection_size; /* Number of allocated hid_collections */
439 unsigned maxcollection; /* Number of parsed collections */ 428 unsigned maxcollection; /* Number of parsed collections */
440 unsigned maxapplication; /* Number of applications */ 429 unsigned maxapplication; /* Number of applications */
441 unsigned short bus; /* BUS ID */ 430 __u16 bus; /* BUS ID */
442 unsigned short vendor; /* Vendor ID */ 431 __u32 vendor; /* Vendor ID */
443 unsigned short product; /* Product ID */ 432 __u32 product; /* Product ID */
444 unsigned version; /* HID version */ 433 __u32 version; /* HID version */
445 unsigned country; /* HID country */ 434 unsigned country; /* HID country */
446 struct hid_report_enum report_enum[HID_REPORT_TYPES]; 435 struct hid_report_enum report_enum[HID_REPORT_TYPES];
447 436
448 struct device *dev; /* device */ 437 struct device dev; /* device */
438 struct hid_driver *driver;
439 struct hid_ll_driver *ll_driver;
449 440
441 unsigned int status; /* see STAT flags above */
450 unsigned claimed; /* Claimed by hidinput, hiddev? */ 442 unsigned claimed; /* Claimed by hidinput, hiddev? */
451 unsigned quirks; /* Various quirks the device can pull on us */ 443 unsigned quirks; /* Various quirks the device can pull on us */
452 444
@@ -462,26 +454,29 @@ struct hid_device { /* device report descriptor */
462 454
463 void *driver_data; 455 void *driver_data;
464 456
465 __s32 delayed_value; /* For A4 Tech mice hwheel quirk */ 457 /* temporary hid_ff handling (until moved to the drivers) */
466 458 int (*ff_init)(struct hid_device *);
467 /* device-specific function pointers */
468 int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int);
469 int (*hid_open) (struct hid_device *);
470 void (*hid_close) (struct hid_device *);
471 459
472 /* hiddev event handler */ 460 /* hiddev event handler */
461 int (*hiddev_connect)(struct hid_device *, unsigned int);
473 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, 462 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
474 struct hid_usage *, __s32); 463 struct hid_usage *, __s32);
475 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 464 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
476 465
477 /* handler for raw output data, used by hidraw */ 466 /* handler for raw output data, used by hidraw */
478 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); 467 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t);
479#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
480 unsigned long apple_pressed_fn[BITS_TO_LONGS(KEY_CNT)];
481 unsigned long pb_pressed_numlock[BITS_TO_LONGS(KEY_CNT)];
482#endif
483}; 468};
484 469
470static inline void *hid_get_drvdata(struct hid_device *hdev)
471{
472 return dev_get_drvdata(&hdev->dev);
473}
474
475static inline void hid_set_drvdata(struct hid_device *hdev, void *data)
476{
477 dev_set_drvdata(&hdev->dev, data);
478}
479
485#define HID_GLOBAL_STACK_SIZE 4 480#define HID_GLOBAL_STACK_SIZE 4
486#define HID_COLLECTION_STACK_SIZE 4 481#define HID_COLLECTION_STACK_SIZE 4
487 482
@@ -510,6 +505,107 @@ struct hid_descriptor {
510 struct hid_class_descriptor desc[1]; 505 struct hid_class_descriptor desc[1];
511} __attribute__ ((packed)); 506} __attribute__ ((packed));
512 507
508#define HID_DEVICE(b, ven, prod) \
509 .bus = (b), \
510 .vendor = (ven), .product = (prod)
511
512#define HID_USB_DEVICE(ven, prod) HID_DEVICE(BUS_USB, ven, prod)
513#define HID_BLUETOOTH_DEVICE(ven, prod) HID_DEVICE(BUS_BLUETOOTH, ven, prod)
514
515#define HID_REPORT_ID(rep) \
516 .report_type = (rep)
517#define HID_USAGE_ID(uhid, utype, ucode) \
518 .usage_hid = (uhid), .usage_type = (utype), .usage_code = (ucode)
519/* we don't want to catch types and codes equal to 0 */
520#define HID_TERMINATOR (HID_ANY_ID - 1)
521
522struct hid_report_id {
523 __u32 report_type;
524};
525struct hid_usage_id {
526 __u32 usage_hid;
527 __u32 usage_type;
528 __u32 usage_code;
529};
530
531/**
532 * struct hid_driver
533 * @name: driver name (e.g. "Footech_bar-wheel")
534 * @id_table: which devices is this driver for (must be non-NULL for probe
535 * to be called)
536 * @probe: new device inserted
537 * @remove: device removed (NULL if not a hot-plug capable driver)
538 * @report_table: on which reports to call raw_event (NULL means all)
539 * @raw_event: if report in report_table, this hook is called (NULL means nop)
540 * @usage_table: on which events to call event (NULL means all)
541 * @event: if usage in usage_table, this hook is called (NULL means nop)
542 * @report_fixup: called before report descriptor parsing (NULL means nop)
543 * @input_mapping: invoked on input registering before mapping an usage
544 * @input_mapped: invoked on input registering after mapping an usage
545 *
546 * raw_event and event should return 0 on no action performed, 1 when no
547 * further processing should be done and negative on error
548 *
549 * input_mapping shall return a negative value to completely ignore this usage
550 * (e.g. doubled or invalid usage), zero to continue with parsing of this
551 * usage by generic code (no special handling needed) or positive to skip
552 * generic parsing (needed special handling which was done in the hook already)
553 * input_mapped shall return negative to inform the layer that this usage
554 * should not be considered for further processing or zero to notify that
555 * no processing was performed and should be done in a generic manner
556 * Both these functions may be NULL which means the same behavior as returning
557 * zero from them.
558 */
559struct hid_driver {
560 char *name;
561 const struct hid_device_id *id_table;
562
563 int (*probe)(struct hid_device *dev, const struct hid_device_id *id);
564 void (*remove)(struct hid_device *dev);
565
566 const struct hid_report_id *report_table;
567 int (*raw_event)(struct hid_device *hdev, struct hid_report *report,
568 u8 *data, int size);
569 const struct hid_usage_id *usage_table;
570 int (*event)(struct hid_device *hdev, struct hid_field *field,
571 struct hid_usage *usage, __s32 value);
572
573 void (*report_fixup)(struct hid_device *hdev, __u8 *buf,
574 unsigned int size);
575
576 int (*input_mapping)(struct hid_device *hdev,
577 struct hid_input *hidinput, struct hid_field *field,
578 struct hid_usage *usage, unsigned long **bit, int *max);
579 int (*input_mapped)(struct hid_device *hdev,
580 struct hid_input *hidinput, struct hid_field *field,
581 struct hid_usage *usage, unsigned long **bit, int *max);
582/* private: */
583 struct device_driver driver;
584};
585
586/**
587 * hid_ll_driver - low level driver callbacks
588 * @start: called on probe to start the device
589 * @stop: called on remove
590 * @open: called by input layer on open
591 * @close: called by input layer on close
592 * @hidinput_input_event: event input event (e.g. ff or leds)
593 * @parse: this method is called only once to parse the device data,
594 * shouldn't allocate anything to not leak memory
595 */
596struct hid_ll_driver {
597 int (*start)(struct hid_device *hdev);
598 void (*stop)(struct hid_device *hdev);
599
600 int (*open)(struct hid_device *hdev);
601 void (*close)(struct hid_device *hdev);
602
603 int (*hidinput_input_event) (struct input_dev *idev, unsigned int type,
604 unsigned int code, int value);
605
606 int (*parse)(struct hid_device *hdev);
607};
608
513/* Applications from HID Usage Tables 4/8/99 Version 1.1 */ 609/* Applications from HID Usage Tables 4/8/99 Version 1.1 */
514/* We ignore a few input applications that are not widely used */ 610/* We ignore a few input applications that are not widely used */
515#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) 611#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002))
@@ -520,43 +616,157 @@ struct hid_descriptor {
520extern int hid_debug; 616extern int hid_debug;
521#endif 617#endif
522 618
619extern int hid_add_device(struct hid_device *);
620extern void hid_destroy_device(struct hid_device *);
621
622extern int __must_check __hid_register_driver(struct hid_driver *,
623 struct module *, const char *mod_name);
624static inline int __must_check hid_register_driver(struct hid_driver *driver)
625{
626 return __hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
627}
628extern void hid_unregister_driver(struct hid_driver *);
629
523extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); 630extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
524extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); 631extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report);
525extern int hidinput_connect(struct hid_device *); 632extern int hidinput_connect(struct hid_device *hid, unsigned int force);
526extern void hidinput_disconnect(struct hid_device *); 633extern void hidinput_disconnect(struct hid_device *);
527 634
528int hid_set_field(struct hid_field *, unsigned, __s32); 635int hid_set_field(struct hid_field *, unsigned, __s32);
529int hid_input_report(struct hid_device *, int type, u8 *, int, int); 636int hid_input_report(struct hid_device *, int type, u8 *, int, int);
530int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 637int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
531int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *);
532int hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
533int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32);
534void hid_output_report(struct hid_report *report, __u8 *data); 638void hid_output_report(struct hid_report *report, __u8 *data);
535void hid_free_device(struct hid_device *device); 639struct hid_device *hid_allocate_device(void);
536struct hid_device *hid_parse_report(__u8 *start, unsigned size); 640int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
641int hid_connect(struct hid_device *hid, unsigned int connect_mask);
642
643/**
644 * hid_map_usage - map usage input bits
645 *
646 * @hidinput: hidinput which we are interested in
647 * @usage: usage to fill in
648 * @bit: pointer to input->{}bit (out parameter)
649 * @max: maximal valid usage->code to consider later (out parameter)
650 * @type: input event type (EV_KEY, EV_REL, ...)
651 * @c: code which corresponds to this usage and type
652 */
653static inline void hid_map_usage(struct hid_input *hidinput,
654 struct hid_usage *usage, unsigned long **bit, int *max,
655 __u8 type, __u16 c)
656{
657 struct input_dev *input = hidinput->input;
658
659 usage->type = type;
660 usage->code = c;
661
662 switch (type) {
663 case EV_ABS:
664 *bit = input->absbit;
665 *max = ABS_MAX;
666 break;
667 case EV_REL:
668 *bit = input->relbit;
669 *max = REL_MAX;
670 break;
671 case EV_KEY:
672 *bit = input->keybit;
673 *max = KEY_MAX;
674 break;
675 case EV_LED:
676 *bit = input->ledbit;
677 *max = LED_MAX;
678 break;
679 }
680}
681
682/**
683 * hid_map_usage_clear - map usage input bits and clear the input bit
684 *
685 * The same as hid_map_usage, except the @c bit is also cleared in supported
686 * bits (@bit).
687 */
688static inline void hid_map_usage_clear(struct hid_input *hidinput,
689 struct hid_usage *usage, unsigned long **bit, int *max,
690 __u8 type, __u16 c)
691{
692 hid_map_usage(hidinput, usage, bit, max, type, c);
693 clear_bit(c, *bit);
694}
695
696/**
697 * hid_parse - parse HW reports
698 *
699 * @hdev: hid device
700 *
701 * Call this from probe after you set up the device (if needed). Your
702 * report_fixup will be called (if non-NULL) after reading raw report from
703 * device before passing it to hid layer for real parsing.
704 */
705static inline int __must_check hid_parse(struct hid_device *hdev)
706{
707 int ret;
708
709 if (hdev->status & HID_STAT_PARSED)
710 return 0;
711
712 ret = hdev->ll_driver->parse(hdev);
713 if (!ret)
714 hdev->status |= HID_STAT_PARSED;
715
716 return ret;
717}
718
719/**
720 * hid_hw_start - start underlaying HW
721 *
722 * @hdev: hid device
723 * @connect_mask: which outputs to connect, see HID_CONNECT_*
724 *
725 * Call this in probe function *after* hid_parse. This will setup HW buffers
726 * and start the device (if not deffered to device open). hid_hw_stop must be
727 * called if this was successfull.
728 */
729static inline int __must_check hid_hw_start(struct hid_device *hdev,
730 unsigned int connect_mask)
731{
732 int ret = hdev->ll_driver->start(hdev);
733 if (ret || !connect_mask)
734 return ret;
735 ret = hid_connect(hdev, connect_mask);
736 if (ret)
737 hdev->ll_driver->stop(hdev);
738 return ret;
739}
740
741/**
742 * hid_hw_stop - stop underlaying HW
743 *
744 * @hdev: hid device
745 *
746 * This is usually called from remove function or from probe when something
747 * failed and hid_hw_start was called already.
748 */
749static inline void hid_hw_stop(struct hid_device *hdev)
750{
751 hdev->ll_driver->stop(hdev);
752}
753
754void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
755 int interrupt);
756
757extern int hid_generic_init(void);
758extern void hid_generic_exit(void);
537 759
538/* HID quirks API */ 760/* HID quirks API */
539u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); 761u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct);
540int usbhid_quirks_init(char **quirks_param); 762int usbhid_quirks_init(char **quirks_param);
541void usbhid_quirks_exit(void); 763void usbhid_quirks_exit(void);
542void usbhid_fixup_report_descriptor(const u16, const u16, char *, unsigned, char **); 764void usbhid_set_leds(struct hid_device *hid);
543
544#ifdef CONFIG_HID_FF
545int hid_ff_init(struct hid_device *hid);
546 765
547int hid_lgff_init(struct hid_device *hid);
548int hid_lg2ff_init(struct hid_device *hid);
549int hid_plff_init(struct hid_device *hid);
550int hid_tmff_init(struct hid_device *hid);
551int hid_zpff_init(struct hid_device *hid);
552#ifdef CONFIG_HID_PID 766#ifdef CONFIG_HID_PID
553int hid_pidff_init(struct hid_device *hid); 767int hid_pidff_init(struct hid_device *hid);
554#else 768#else
555static inline int hid_pidff_init(struct hid_device *hid) { return -ENODEV; } 769#define hid_pidff_init NULL
556#endif
557
558#else
559static inline int hid_ff_init(struct hid_device *hid) { return -1; }
560#endif 770#endif
561 771
562#ifdef CONFIG_HID_DEBUG 772#ifdef CONFIG_HID_DEBUG
@@ -572,10 +782,23 @@ dbg_hid(const char *fmt, ...)
572 return 0; 782 return 0;
573} 783}
574#define dbg_hid_line dbg_hid 784#define dbg_hid_line dbg_hid
575#endif 785#endif /* HID_DEBUG */
576 786
577#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ 787#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \
578 __FILE__ , ## arg) 788 __FILE__ , ## arg)
579#endif 789#endif /* HID_FF */
790
791#ifdef CONFIG_HID_COMPAT
792#define HID_COMPAT_LOAD_DRIVER(name) \
793void hid_compat_##name(void) { } \
794EXPORT_SYMBOL(hid_compat_##name)
795#else
796#define HID_COMPAT_LOAD_DRIVER(name)
797#endif /* HID_COMPAT */
798#define HID_COMPAT_CALL_DRIVER(name) do { \
799 extern void hid_compat_##name(void); \
800 hid_compat_##name(); \
801} while (0)
802
580#endif 803#endif
581 804
diff --git a/include/linux/hiddev.h b/include/linux/hiddev.h
index a416b904ba90..c760ae0eb6a1 100644
--- a/include/linux/hiddev.h
+++ b/include/linux/hiddev.h
@@ -182,26 +182,28 @@ struct hiddev_usage_ref_multi {
182/* To traverse the input report descriptor info for a HID device, perform the 182/* To traverse the input report descriptor info for a HID device, perform the
183 * following: 183 * following:
184 * 184 *
185 * rinfo.report_type = HID_REPORT_TYPE_INPUT; 185 * rinfo.report_type = HID_REPORT_TYPE_INPUT;
186 * rinfo.report_id = HID_REPORT_ID_FIRST; 186 * rinfo.report_id = HID_REPORT_ID_FIRST;
187 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); 187 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo);
188 * 188 *
189 * while (ret >= 0) { 189 * while (ret >= 0) {
190 * for (i = 0; i < rinfo.num_fields; i++) { 190 * for (i = 0; i < rinfo.num_fields; i++) {
191 * finfo.report_type = rinfo.report_type; 191 * finfo.report_type = rinfo.report_type;
192 * finfo.report_id = rinfo.report_id; 192 * finfo.report_id = rinfo.report_id;
193 * finfo.field_index = i; 193 * finfo.field_index = i;
194 * ioctl(fd, HIDIOCGFIELDINFO, &finfo); 194 * ioctl(fd, HIDIOCGFIELDINFO, &finfo);
195 * for (j = 0; j < finfo.maxusage; j++) { 195 * for (j = 0; j < finfo.maxusage; j++) {
196 * uref.field_index = i; 196 * uref.report_type = rinfo.report_type;
197 * uref.usage_index = j; 197 * uref.report_id = rinfo.report_id;
198 * ioctl(fd, HIDIOCGUCODE, &uref); 198 * uref.field_index = i;
199 * ioctl(fd, HIDIOCGUSAGE, &uref); 199 * uref.usage_index = j;
200 * } 200 * ioctl(fd, HIDIOCGUCODE, &uref);
201 * } 201 * ioctl(fd, HIDIOCGUSAGE, &uref);
202 * rinfo.report_id |= HID_REPORT_ID_NEXT; 202 * }
203 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); 203 * }
204 * } 204 * rinfo.report_id |= HID_REPORT_ID_NEXT;
205 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo);
206 * }
205 */ 207 */
206 208
207 209
@@ -217,7 +219,7 @@ struct hid_field;
217struct hid_report; 219struct hid_report;
218 220
219#ifdef CONFIG_USB_HIDDEV 221#ifdef CONFIG_USB_HIDDEV
220int hiddev_connect(struct hid_device *); 222int hiddev_connect(struct hid_device *hid, unsigned int force);
221void hiddev_disconnect(struct hid_device *); 223void hiddev_disconnect(struct hid_device *);
222void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, 224void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
223 struct hid_usage *usage, __s32 value); 225 struct hid_usage *usage, __s32 value);
@@ -225,7 +227,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report);
225int __init hiddev_init(void); 227int __init hiddev_init(void);
226void hiddev_exit(void); 228void hiddev_exit(void);
227#else 229#else
228static inline int hiddev_connect(struct hid_device *hid) { return -1; } 230static inline int hiddev_connect(struct hid_device *hid,
231 unsigned int force)
232{ return -1; }
229static inline void hiddev_disconnect(struct hid_device *hid) { } 233static inline void hiddev_disconnect(struct hid_device *hid) { }
230static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, 234static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
231 struct hid_usage *usage, __s32 value) { } 235 struct hid_usage *usage, __s32 value) { }
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index bf34c5f4c051..01d67ba9e985 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -41,7 +41,6 @@
41#define I2C_DRIVERID_SAA7110 22 /* video decoder */ 41#define I2C_DRIVERID_SAA7110 22 /* video decoder */
42#define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */ 42#define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */
43#define I2C_DRIVERID_PCF8583 25 /* real time clock */ 43#define I2C_DRIVERID_PCF8583 25 /* real time clock */
44#define I2C_DRIVERID_SAB3036 26 /* SAB3036 tuner */
45#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ 44#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */
46#define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */ 45#define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */
47#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ 46#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */
@@ -61,7 +60,7 @@
61#define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */ 60#define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */
62#define I2C_DRIVERID_CS53L32A 70 /* cs53l32a audio processor */ 61#define I2C_DRIVERID_CS53L32A 70 /* cs53l32a audio processor */
63#define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */ 62#define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */
64#define I2C_DRIVERID_SAA7127 72 /* saa7124 video encoder */ 63#define I2C_DRIVERID_SAA7127 72 /* saa7127 video encoder */
65#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ 64#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
66#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ 65#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */
67#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ 66#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 75ae6d8aba4f..4c4e57d1f19d 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -570,7 +570,6 @@ struct i2o_controller {
570#endif 570#endif
571 spinlock_t lock; /* lock for controller 571 spinlock_t lock; /* lock for controller
572 configuration */ 572 configuration */
573
574 void *driver_data[I2O_MAX_DRIVERS]; /* storage for drivers */ 573 void *driver_data[I2O_MAX_DRIVERS]; /* storage for drivers */
575}; 574};
576 575
@@ -691,289 +690,22 @@ static inline u32 i2o_dma_high(dma_addr_t dma_addr)
691}; 690};
692#endif 691#endif
693 692
694/** 693extern u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size);
695 * i2o_sg_tablesize - Calculate the maximum number of elements in a SGL 694extern dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
696 * @c: I2O controller for which the calculation should be done
697 * @body_size: maximum body size used for message in 32-bit words.
698 *
699 * Return the maximum number of SG elements in a SG list.
700 */
701static inline u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size)
702{
703 i2o_status_block *sb = c->status_block.virt;
704 u16 sg_count =
705 (sb->inbound_frame_size - sizeof(struct i2o_message) / 4) -
706 body_size;
707
708 if (c->pae_support) {
709 /*
710 * for 64-bit a SG attribute element must be added and each
711 * SG element needs 12 bytes instead of 8.
712 */
713 sg_count -= 2;
714 sg_count /= 3;
715 } else
716 sg_count /= 2;
717
718 if (c->short_req && (sg_count > 8))
719 sg_count = 8;
720
721 return sg_count;
722};
723
724/**
725 * i2o_dma_map_single - Map pointer to controller and fill in I2O message.
726 * @c: I2O controller
727 * @ptr: pointer to the data which should be mapped
728 * @size: size of data in bytes
729 * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE
730 * @sg_ptr: pointer to the SG list inside the I2O message
731 *
732 * This function does all necessary DMA handling and also writes the I2O
733 * SGL elements into the I2O message. For details on DMA handling see also
734 * dma_map_single(). The pointer sg_ptr will only be set to the end of the
735 * SG list if the allocation was successful.
736 *
737 * Returns DMA address which must be checked for failures using
738 * dma_mapping_error().
739 */
740static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
741 size_t size, 695 size_t size,
742 enum dma_data_direction direction, 696 enum dma_data_direction direction,
743 u32 ** sg_ptr) 697 u32 ** sg_ptr);
744{ 698extern int i2o_dma_map_sg(struct i2o_controller *c,
745 u32 sg_flags;
746 u32 *mptr = *sg_ptr;
747 dma_addr_t dma_addr;
748
749 switch (direction) {
750 case DMA_TO_DEVICE:
751 sg_flags = 0xd4000000;
752 break;
753 case DMA_FROM_DEVICE:
754 sg_flags = 0xd0000000;
755 break;
756 default:
757 return 0;
758 }
759
760 dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction);
761 if (!dma_mapping_error(&c->pdev->dev, dma_addr)) {
762#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
763 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
764 *mptr++ = cpu_to_le32(0x7C020002);
765 *mptr++ = cpu_to_le32(PAGE_SIZE);
766 }
767#endif
768
769 *mptr++ = cpu_to_le32(sg_flags | size);
770 *mptr++ = cpu_to_le32(i2o_dma_low(dma_addr));
771#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
772 if ((sizeof(dma_addr_t) > 4) && c->pae_support)
773 *mptr++ = cpu_to_le32(i2o_dma_high(dma_addr));
774#endif
775 *sg_ptr = mptr;
776 }
777 return dma_addr;
778};
779
780/**
781 * i2o_dma_map_sg - Map a SG List to controller and fill in I2O message.
782 * @c: I2O controller
783 * @sg: SG list to be mapped
784 * @sg_count: number of elements in the SG list
785 * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE
786 * @sg_ptr: pointer to the SG list inside the I2O message
787 *
788 * This function does all necessary DMA handling and also writes the I2O
789 * SGL elements into the I2O message. For details on DMA handling see also
790 * dma_map_sg(). The pointer sg_ptr will only be set to the end of the SG
791 * list if the allocation was successful.
792 *
793 * Returns 0 on failure or 1 on success.
794 */
795static inline int i2o_dma_map_sg(struct i2o_controller *c,
796 struct scatterlist *sg, int sg_count, 699 struct scatterlist *sg, int sg_count,
797 enum dma_data_direction direction, 700 enum dma_data_direction direction,
798 u32 ** sg_ptr) 701 u32 ** sg_ptr);
799{ 702extern int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr, size_t len);
800 u32 sg_flags; 703extern void i2o_dma_free(struct device *dev, struct i2o_dma *addr);
801 u32 *mptr = *sg_ptr; 704extern int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr,
802 705 size_t len);
803 switch (direction) { 706extern int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
804 case DMA_TO_DEVICE: 707 size_t size, int min_nr);
805 sg_flags = 0x14000000; 708extern void i2o_pool_free(struct i2o_pool *pool);
806 break;
807 case DMA_FROM_DEVICE:
808 sg_flags = 0x10000000;
809 break;
810 default:
811 return 0;
812 }
813
814 sg_count = dma_map_sg(&c->pdev->dev, sg, sg_count, direction);
815 if (!sg_count)
816 return 0;
817
818#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
819 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
820 *mptr++ = cpu_to_le32(0x7C020002);
821 *mptr++ = cpu_to_le32(PAGE_SIZE);
822 }
823#endif
824
825 while (sg_count-- > 0) {
826 if (!sg_count)
827 sg_flags |= 0xC0000000;
828 *mptr++ = cpu_to_le32(sg_flags | sg_dma_len(sg));
829 *mptr++ = cpu_to_le32(i2o_dma_low(sg_dma_address(sg)));
830#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
831 if ((sizeof(dma_addr_t) > 4) && c->pae_support)
832 *mptr++ = cpu_to_le32(i2o_dma_high(sg_dma_address(sg)));
833#endif
834 sg = sg_next(sg);
835 }
836 *sg_ptr = mptr;
837
838 return 1;
839};
840
841/**
842 * i2o_dma_alloc - Allocate DMA memory
843 * @dev: struct device pointer to the PCI device of the I2O controller
844 * @addr: i2o_dma struct which should get the DMA buffer
845 * @len: length of the new DMA memory
846 * @gfp_mask: GFP mask
847 *
848 * Allocate a coherent DMA memory and write the pointers into addr.
849 *
850 * Returns 0 on success or -ENOMEM on failure.
851 */
852static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr,
853 size_t len, gfp_t gfp_mask)
854{
855 struct pci_dev *pdev = to_pci_dev(dev);
856 int dma_64 = 0;
857
858 if ((sizeof(dma_addr_t) > 4) && (pdev->dma_mask == DMA_64BIT_MASK)) {
859 dma_64 = 1;
860 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK))
861 return -ENOMEM;
862 }
863
864 addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask);
865
866 if ((sizeof(dma_addr_t) > 4) && dma_64)
867 if (pci_set_dma_mask(pdev, DMA_64BIT_MASK))
868 printk(KERN_WARNING "i2o: unable to set 64-bit DMA");
869
870 if (!addr->virt)
871 return -ENOMEM;
872
873 memset(addr->virt, 0, len);
874 addr->len = len;
875
876 return 0;
877};
878
879/**
880 * i2o_dma_free - Free DMA memory
881 * @dev: struct device pointer to the PCI device of the I2O controller
882 * @addr: i2o_dma struct which contains the DMA buffer
883 *
884 * Free a coherent DMA memory and set virtual address of addr to NULL.
885 */
886static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr)
887{
888 if (addr->virt) {
889 if (addr->phys)
890 dma_free_coherent(dev, addr->len, addr->virt,
891 addr->phys);
892 else
893 kfree(addr->virt);
894 addr->virt = NULL;
895 }
896};
897
898/**
899 * i2o_dma_realloc - Realloc DMA memory
900 * @dev: struct device pointer to the PCI device of the I2O controller
901 * @addr: pointer to a i2o_dma struct DMA buffer
902 * @len: new length of memory
903 * @gfp_mask: GFP mask
904 *
905 * If there was something allocated in the addr, free it first. If len > 0
906 * than try to allocate it and write the addresses back to the addr
907 * structure. If len == 0 set the virtual address to NULL.
908 *
909 * Returns the 0 on success or negative error code on failure.
910 */
911static inline int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr,
912 size_t len, gfp_t gfp_mask)
913{
914 i2o_dma_free(dev, addr);
915
916 if (len)
917 return i2o_dma_alloc(dev, addr, len, gfp_mask);
918
919 return 0;
920};
921
922/*
923 * i2o_pool_alloc - Allocate an slab cache and mempool
924 * @mempool: pointer to struct i2o_pool to write data into.
925 * @name: name which is used to identify cache
926 * @size: size of each object
927 * @min_nr: minimum number of objects
928 *
929 * First allocates a slab cache with name and size. Then allocates a
930 * mempool which uses the slab cache for allocation and freeing.
931 *
932 * Returns 0 on success or negative error code on failure.
933 */
934static inline int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
935 size_t size, int min_nr)
936{
937 pool->name = kmalloc(strlen(name) + 1, GFP_KERNEL);
938 if (!pool->name)
939 goto exit;
940 strcpy(pool->name, name);
941
942 pool->slab =
943 kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL);
944 if (!pool->slab)
945 goto free_name;
946
947 pool->mempool = mempool_create_slab_pool(min_nr, pool->slab);
948 if (!pool->mempool)
949 goto free_slab;
950
951 return 0;
952
953 free_slab:
954 kmem_cache_destroy(pool->slab);
955
956 free_name:
957 kfree(pool->name);
958
959 exit:
960 return -ENOMEM;
961};
962
963/*
964 * i2o_pool_free - Free slab cache and mempool again
965 * @mempool: pointer to struct i2o_pool which should be freed
966 *
967 * Note that you have to return all objects to the mempool again before
968 * calling i2o_pool_free().
969 */
970static inline void i2o_pool_free(struct i2o_pool *pool)
971{
972 mempool_destroy(pool->mempool);
973 kmem_cache_destroy(pool->slab);
974 kfree(pool->name);
975};
976
977/* I2O driver (OSM) functions */ 709/* I2O driver (OSM) functions */
978extern int i2o_driver_register(struct i2o_driver *); 710extern int i2o_driver_register(struct i2o_driver *);
979extern void i2o_driver_unregister(struct i2o_driver *); 711extern void i2o_driver_unregister(struct i2o_driver *);
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 03067443198a..a93a8dd33118 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -40,16 +40,18 @@ struct icmp6hdr {
40 struct icmpv6_nd_ra { 40 struct icmpv6_nd_ra {
41 __u8 hop_limit; 41 __u8 hop_limit;
42#if defined(__LITTLE_ENDIAN_BITFIELD) 42#if defined(__LITTLE_ENDIAN_BITFIELD)
43 __u8 reserved:4, 43 __u8 reserved:3,
44 router_pref:2, 44 router_pref:2,
45 home_agent:1,
45 other:1, 46 other:1,
46 managed:1; 47 managed:1;
47 48
48#elif defined(__BIG_ENDIAN_BITFIELD) 49#elif defined(__BIG_ENDIAN_BITFIELD)
49 __u8 managed:1, 50 __u8 managed:1,
50 other:1, 51 other:1,
52 home_agent:1,
51 router_pref:2, 53 router_pref:2,
52 reserved:4; 54 reserved:3;
53#else 55#else
54#error "Please fix <asm/byteorder.h>" 56#error "Please fix <asm/byteorder.h>"
55#endif 57#endif
diff --git a/include/linux/ide.h b/include/linux/ide.h
index a9d82d6e6bdd..c47e371554c1 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -48,12 +48,6 @@ typedef unsigned char byte; /* used everywhere */
48#define ERROR_RESET 3 /* Reset controller every 4th retry */ 48#define ERROR_RESET 3 /* Reset controller every 4th retry */
49#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ 49#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
50 50
51/*
52 * state flags
53 */
54
55#define DMA_PIO_RETRY 1 /* retrying in PIO */
56
57#define HWIF(drive) ((ide_hwif_t *)((drive)->hwif)) 51#define HWIF(drive) ((ide_hwif_t *)((drive)->hwif))
58#define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup)) 52#define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup))
59 53
@@ -162,6 +156,8 @@ enum {
162 */ 156 */
163#define REQ_DRIVE_RESET 0x20 157#define REQ_DRIVE_RESET 0x20
164#define REQ_DEVSET_EXEC 0x21 158#define REQ_DEVSET_EXEC 0x21
159#define REQ_PARK_HEADS 0x22
160#define REQ_UNPARK_HEADS 0x23
165 161
166/* 162/*
167 * Check for an interrupt and acknowledge the interrupt status 163 * Check for an interrupt and acknowledge the interrupt status
@@ -268,8 +264,6 @@ static inline int __ide_default_irq(unsigned long base)
268 * set_geometry : respecify drive geometry 264 * set_geometry : respecify drive geometry
269 * recalibrate : seek to cyl 0 265 * recalibrate : seek to cyl 0
270 * set_multmode : set multmode count 266 * set_multmode : set multmode count
271 * set_tune : tune interface for drive
272 * serviced : service command
273 * reserved : unused 267 * reserved : unused
274 */ 268 */
275typedef union { 269typedef union {
@@ -278,43 +272,11 @@ typedef union {
278 unsigned set_geometry : 1; 272 unsigned set_geometry : 1;
279 unsigned recalibrate : 1; 273 unsigned recalibrate : 1;
280 unsigned set_multmode : 1; 274 unsigned set_multmode : 1;
281 unsigned set_tune : 1; 275 unsigned reserved : 5;
282 unsigned serviced : 1;
283 unsigned reserved : 3;
284 } b; 276 } b;
285} special_t; 277} special_t;
286 278
287/* 279/*
288 * ATA-IDE Select Register, aka Device-Head
289 *
290 * head : always zeros here
291 * unit : drive select number: 0/1
292 * bit5 : always 1
293 * lba : using LBA instead of CHS
294 * bit7 : always 1
295 */
296typedef union {
297 unsigned all : 8;
298 struct {
299#if defined(__LITTLE_ENDIAN_BITFIELD)
300 unsigned head : 4;
301 unsigned unit : 1;
302 unsigned bit5 : 1;
303 unsigned lba : 1;
304 unsigned bit7 : 1;
305#elif defined(__BIG_ENDIAN_BITFIELD)
306 unsigned bit7 : 1;
307 unsigned lba : 1;
308 unsigned bit5 : 1;
309 unsigned unit : 1;
310 unsigned head : 4;
311#else
312#error "Please fix <asm/byteorder.h>"
313#endif
314 } b;
315} select_t, ata_select_t;
316
317/*
318 * Status returned from various ide_ functions 280 * Status returned from various ide_ functions
319 */ 281 */
320typedef enum { 282typedef enum {
@@ -322,6 +284,175 @@ typedef enum {
322 ide_started, /* a drive operation was started, handler was set */ 284 ide_started, /* a drive operation was started, handler was set */
323} ide_startstop_t; 285} ide_startstop_t;
324 286
287enum {
288 IDE_TFLAG_LBA48 = (1 << 0),
289 IDE_TFLAG_FLAGGED = (1 << 2),
290 IDE_TFLAG_OUT_DATA = (1 << 3),
291 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4),
292 IDE_TFLAG_OUT_HOB_NSECT = (1 << 5),
293 IDE_TFLAG_OUT_HOB_LBAL = (1 << 6),
294 IDE_TFLAG_OUT_HOB_LBAM = (1 << 7),
295 IDE_TFLAG_OUT_HOB_LBAH = (1 << 8),
296 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
297 IDE_TFLAG_OUT_HOB_NSECT |
298 IDE_TFLAG_OUT_HOB_LBAL |
299 IDE_TFLAG_OUT_HOB_LBAM |
300 IDE_TFLAG_OUT_HOB_LBAH,
301 IDE_TFLAG_OUT_FEATURE = (1 << 9),
302 IDE_TFLAG_OUT_NSECT = (1 << 10),
303 IDE_TFLAG_OUT_LBAL = (1 << 11),
304 IDE_TFLAG_OUT_LBAM = (1 << 12),
305 IDE_TFLAG_OUT_LBAH = (1 << 13),
306 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
307 IDE_TFLAG_OUT_NSECT |
308 IDE_TFLAG_OUT_LBAL |
309 IDE_TFLAG_OUT_LBAM |
310 IDE_TFLAG_OUT_LBAH,
311 IDE_TFLAG_OUT_DEVICE = (1 << 14),
312 IDE_TFLAG_WRITE = (1 << 15),
313 IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16),
314 IDE_TFLAG_IN_DATA = (1 << 17),
315 IDE_TFLAG_CUSTOM_HANDLER = (1 << 18),
316 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19),
317 IDE_TFLAG_IN_HOB_FEATURE = (1 << 20),
318 IDE_TFLAG_IN_HOB_NSECT = (1 << 21),
319 IDE_TFLAG_IN_HOB_LBAL = (1 << 22),
320 IDE_TFLAG_IN_HOB_LBAM = (1 << 23),
321 IDE_TFLAG_IN_HOB_LBAH = (1 << 24),
322 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
323 IDE_TFLAG_IN_HOB_LBAM |
324 IDE_TFLAG_IN_HOB_LBAH,
325 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE |
326 IDE_TFLAG_IN_HOB_NSECT |
327 IDE_TFLAG_IN_HOB_LBA,
328 IDE_TFLAG_IN_FEATURE = (1 << 1),
329 IDE_TFLAG_IN_NSECT = (1 << 25),
330 IDE_TFLAG_IN_LBAL = (1 << 26),
331 IDE_TFLAG_IN_LBAM = (1 << 27),
332 IDE_TFLAG_IN_LBAH = (1 << 28),
333 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
334 IDE_TFLAG_IN_LBAM |
335 IDE_TFLAG_IN_LBAH,
336 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
337 IDE_TFLAG_IN_LBA,
338 IDE_TFLAG_IN_DEVICE = (1 << 29),
339 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
340 IDE_TFLAG_IN_HOB,
341 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
342 IDE_TFLAG_IN_TF,
343 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
344 IDE_TFLAG_IN_DEVICE,
345 /* force 16-bit I/O operations */
346 IDE_TFLAG_IO_16BIT = (1 << 30),
347 /* ide_task_t was allocated using kmalloc() */
348 IDE_TFLAG_DYN = (1 << 31),
349};
350
351struct ide_taskfile {
352 u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */
353
354 u8 hob_feature; /* 1-5: additional data to support LBA48 */
355 u8 hob_nsect;
356 u8 hob_lbal;
357 u8 hob_lbam;
358 u8 hob_lbah;
359
360 u8 data; /* 6: low data byte (for TASKFILE IOCTL) */
361
362 union { /*  7: */
363 u8 error; /* read: error */
364 u8 feature; /* write: feature */
365 };
366
367 u8 nsect; /* 8: number of sectors */
368 u8 lbal; /* 9: LBA low */
369 u8 lbam; /* 10: LBA mid */
370 u8 lbah; /* 11: LBA high */
371
372 u8 device; /* 12: device select */
373
374 union { /* 13: */
375 u8 status; /*  read: status  */
376 u8 command; /* write: command */
377 };
378};
379
380typedef struct ide_task_s {
381 union {
382 struct ide_taskfile tf;
383 u8 tf_array[14];
384 };
385 u32 tf_flags;
386 int data_phase;
387 struct request *rq; /* copy of request */
388 void *special; /* valid_t generally */
389} ide_task_t;
390
391/* ATAPI packet command flags */
392enum {
393 /* set when an error is considered normal - no retry (ide-tape) */
394 PC_FLAG_ABORT = (1 << 0),
395 PC_FLAG_SUPPRESS_ERROR = (1 << 1),
396 PC_FLAG_WAIT_FOR_DSC = (1 << 2),
397 PC_FLAG_DMA_OK = (1 << 3),
398 PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
399 PC_FLAG_DMA_ERROR = (1 << 5),
400 PC_FLAG_WRITING = (1 << 6),
401 /* command timed out */
402 PC_FLAG_TIMEDOUT = (1 << 7),
403};
404
405/*
406 * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes.
407 * This is used for several packet commands (not for READ/WRITE commands).
408 */
409#define IDE_PC_BUFFER_SIZE 256
410
411struct ide_atapi_pc {
412 /* actual packet bytes */
413 u8 c[12];
414 /* incremented on each retry */
415 int retries;
416 int error;
417
418 /* bytes to transfer */
419 int req_xfer;
420 /* bytes actually transferred */
421 int xferred;
422
423 /* data buffer */
424 u8 *buf;
425 /* current buffer position */
426 u8 *cur_pos;
427 int buf_size;
428 /* missing/available data on the current buffer */
429 int b_count;
430
431 /* the corresponding request */
432 struct request *rq;
433
434 unsigned long flags;
435
436 /*
437 * those are more or less driver-specific and some of them are subject
438 * to change/removal later.
439 */
440 u8 pc_buf[IDE_PC_BUFFER_SIZE];
441
442 /* idetape only */
443 struct idetape_bh *bh;
444 char *b_data;
445
446 /* idescsi only for now */
447 struct scatterlist *sg;
448 unsigned int sg_cnt;
449
450 struct scsi_cmnd *scsi_cmd;
451 void (*done) (struct scsi_cmnd *);
452
453 unsigned long timeout;
454};
455
325struct ide_devset; 456struct ide_devset;
326struct ide_driver_s; 457struct ide_driver_s;
327 458
@@ -394,6 +525,62 @@ enum {
394 IDE_AFLAG_NO_AUTOCLOSE = (1 << 29), 525 IDE_AFLAG_NO_AUTOCLOSE = (1 << 29),
395}; 526};
396 527
528/* device flags */
529enum {
530 /* restore settings after device reset */
531 IDE_DFLAG_KEEP_SETTINGS = (1 << 0),
532 /* device is using DMA for read/write */
533 IDE_DFLAG_USING_DMA = (1 << 1),
534 /* okay to unmask other IRQs */
535 IDE_DFLAG_UNMASK = (1 << 2),
536 /* don't attempt flushes */
537 IDE_DFLAG_NOFLUSH = (1 << 3),
538 /* DSC overlap */
539 IDE_DFLAG_DSC_OVERLAP = (1 << 4),
540 /* give potential excess bandwidth */
541 IDE_DFLAG_NICE1 = (1 << 5),
542 /* device is physically present */
543 IDE_DFLAG_PRESENT = (1 << 6),
544 /* device ejected hint */
545 IDE_DFLAG_DEAD = (1 << 7),
546 /* id read from device (synthetic if not set) */
547 IDE_DFLAG_ID_READ = (1 << 8),
548 IDE_DFLAG_NOPROBE = (1 << 9),
549 /* need to do check_media_change() */
550 IDE_DFLAG_REMOVABLE = (1 << 10),
551 /* needed for removable devices */
552 IDE_DFLAG_ATTACH = (1 << 11),
553 IDE_DFLAG_FORCED_GEOM = (1 << 12),
554 /* disallow setting unmask bit */
555 IDE_DFLAG_NO_UNMASK = (1 << 13),
556 /* disallow enabling 32-bit I/O */
557 IDE_DFLAG_NO_IO_32BIT = (1 << 14),
558 /* for removable only: door lock/unlock works */
559 IDE_DFLAG_DOORLOCKING = (1 << 15),
560 /* disallow DMA */
561 IDE_DFLAG_NODMA = (1 << 16),
562 /* powermanagment told us not to do anything, so sleep nicely */
563 IDE_DFLAG_BLOCKED = (1 << 17),
564 /* ide-scsi emulation */
565 IDE_DFLAG_SCSI = (1 << 18),
566 /* sleeping & sleep field valid */
567 IDE_DFLAG_SLEEPING = (1 << 19),
568 IDE_DFLAG_POST_RESET = (1 << 20),
569 IDE_DFLAG_UDMA33_WARNED = (1 << 21),
570 IDE_DFLAG_LBA48 = (1 << 22),
571 /* status of write cache */
572 IDE_DFLAG_WCACHE = (1 << 23),
573 /* used for ignoring ATA_DF */
574 IDE_DFLAG_NOWERR = (1 << 24),
575 /* retrying in PIO */
576 IDE_DFLAG_DMA_PIO_RETRY = (1 << 25),
577 IDE_DFLAG_LBA = (1 << 26),
578 /* don't unload heads */
579 IDE_DFLAG_NO_UNLOAD = (1 << 27),
580 /* heads unloaded, please don't reset port */
581 IDE_DFLAG_PARKED = (1 << 28)
582};
583
397struct ide_drive_s { 584struct ide_drive_s {
398 char name[4]; /* drive name, such as "hda" */ 585 char name[4]; /* drive name, such as "hda" */
399 char driver_req[10]; /* requests specific driver */ 586 char driver_req[10]; /* requests specific driver */
@@ -410,43 +597,19 @@ struct ide_drive_s {
410#endif 597#endif
411 struct hwif_s *hwif; /* actually (ide_hwif_t *) */ 598 struct hwif_s *hwif; /* actually (ide_hwif_t *) */
412 599
600 unsigned long dev_flags;
601
413 unsigned long sleep; /* sleep until this time */ 602 unsigned long sleep; /* sleep until this time */
414 unsigned long service_start; /* time we started last request */ 603 unsigned long service_start; /* time we started last request */
415 unsigned long service_time; /* service time of last request */ 604 unsigned long service_time; /* service time of last request */
416 unsigned long timeout; /* max time to wait for irq */ 605 unsigned long timeout; /* max time to wait for irq */
417 606
418 special_t special; /* special action flags */ 607 special_t special; /* special action flags */
419 select_t select; /* basic drive/head select reg value */
420 608
609 u8 select; /* basic drive/head select reg value */
421 u8 retry_pio; /* retrying dma capable host in pio */ 610 u8 retry_pio; /* retrying dma capable host in pio */
422 u8 state; /* retry state */
423 u8 waiting_for_dma; /* dma currently in progress */ 611 u8 waiting_for_dma; /* dma currently in progress */
424 612 u8 dma; /* atapi dma flag */
425 unsigned keep_settings : 1; /* restore settings after drive reset */
426 unsigned using_dma : 1; /* disk is using dma for read/write */
427 unsigned unmask : 1; /* okay to unmask other irqs */
428 unsigned noflush : 1; /* don't attempt flushes */
429 unsigned dsc_overlap : 1; /* DSC overlap */
430 unsigned nice1 : 1; /* give potential excess bandwidth */
431 unsigned present : 1; /* drive is physically present */
432 unsigned dead : 1; /* device ejected hint */
433 unsigned id_read : 1; /* 1=id read from disk 0 = synthetic */
434 unsigned noprobe : 1; /* from: hdx=noprobe */
435 unsigned removable : 1; /* 1 if need to do check_media_change */
436 unsigned attach : 1; /* needed for removable devices */
437 unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */
438 unsigned no_unmask : 1; /* disallow setting unmask bit */
439 unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */
440 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */
441 unsigned nodma : 1; /* disallow DMA */
442 unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */
443 unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */
444 unsigned sleeping : 1; /* 1=sleeping & sleep field valid */
445 unsigned post_reset : 1;
446 unsigned udma33_warned : 1;
447 unsigned addressing : 2; /* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */
448 unsigned wcache : 1; /* status of write cache */
449 unsigned nowerr : 1; /* used for ignoring ATA_DF */
450 613
451 u8 quirk_list; /* considered quirky, set for a specific host */ 614 u8 quirk_list; /* considered quirky, set for a specific host */
452 u8 init_speed; /* transfer rate set at boot */ 615 u8 init_speed; /* transfer rate set at boot */
@@ -458,7 +621,6 @@ struct ide_drive_s {
458 u8 ready_stat; /* min status value for drive ready */ 621 u8 ready_stat; /* min status value for drive ready */
459 u8 mult_count; /* current multiple sector setting */ 622 u8 mult_count; /* current multiple sector setting */
460 u8 mult_req; /* requested multiple sector setting */ 623 u8 mult_req; /* requested multiple sector setting */
461 u8 tune_req; /* requested drive tuning setting */
462 u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ 624 u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
463 u8 bad_wstat; /* used for ignoring ATA_DF */ 625 u8 bad_wstat; /* used for ignoring ATA_DF */
464 u8 head; /* "real" number of heads */ 626 u8 head; /* "real" number of heads */
@@ -466,6 +628,9 @@ struct ide_drive_s {
466 u8 bios_head; /* BIOS/fdisk/LILO number of heads */ 628 u8 bios_head; /* BIOS/fdisk/LILO number of heads */
467 u8 bios_sect; /* BIOS/fdisk/LILO sectors per track */ 629 u8 bios_sect; /* BIOS/fdisk/LILO sectors per track */
468 630
631 /* delay this long before sending packet command */
632 u8 pc_delay;
633
469 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ 634 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */
470 unsigned int cyl; /* "real" number of cyls */ 635 unsigned int cyl; /* "real" number of cyls */
471 unsigned int drive_data; /* used by set_pio_mode/selectproc */ 636 unsigned int drive_data; /* used by set_pio_mode/selectproc */
@@ -477,6 +642,9 @@ struct ide_drive_s {
477 642
478 int lun; /* logical unit */ 643 int lun; /* logical unit */
479 int crc_count; /* crc counter to reduce drive speed */ 644 int crc_count; /* crc counter to reduce drive speed */
645
646 unsigned long debug_mask; /* debugging levels switch */
647
480#ifdef CONFIG_BLK_DEV_IDEACPI 648#ifdef CONFIG_BLK_DEV_IDEACPI
481 struct ide_acpi_drive_link *acpidata; 649 struct ide_acpi_drive_link *acpidata;
482#endif 650#endif
@@ -484,17 +652,32 @@ struct ide_drive_s {
484 struct device gendev; 652 struct device gendev;
485 struct completion gendev_rel_comp; /* to deal with device release() */ 653 struct completion gendev_rel_comp; /* to deal with device release() */
486 654
655 /* current packet command */
656 struct ide_atapi_pc *pc;
657
487 /* callback for packet commands */ 658 /* callback for packet commands */
488 void (*pc_callback)(struct ide_drive_s *); 659 void (*pc_callback)(struct ide_drive_s *, int);
660
661 void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
662 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,
663 unsigned int, int);
489 664
490 unsigned long atapi_flags; 665 unsigned long atapi_flags;
666
667 struct ide_atapi_pc request_sense_pc;
668 struct request request_sense_rq;
491}; 669};
492 670
493typedef struct ide_drive_s ide_drive_t; 671typedef struct ide_drive_s ide_drive_t;
494 672
495#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) 673#define to_ide_device(dev) container_of(dev, ide_drive_t, gendev)
674
675#define to_ide_drv(obj, cont_type) \
676 container_of(obj, struct cont_type, kref)
677
678#define ide_drv_g(disk, cont_type) \
679 container_of((disk)->private_data, struct cont_type, driver)
496 680
497struct ide_task_s;
498struct ide_port_info; 681struct ide_port_info;
499 682
500struct ide_tp_ops { 683struct ide_tp_ops {
@@ -528,6 +711,7 @@ extern const struct ide_tp_ops default_tp_ops;
528 * @resetproc: routine to reset controller after a disk reset 711 * @resetproc: routine to reset controller after a disk reset
529 * @maskproc: special host masking for drive selection 712 * @maskproc: special host masking for drive selection
530 * @quirkproc: check host's drive quirk list 713 * @quirkproc: check host's drive quirk list
714 * @clear_irq: clear IRQ
531 * 715 *
532 * @mdma_filter: filter MDMA modes 716 * @mdma_filter: filter MDMA modes
533 * @udma_filter: filter UDMA modes 717 * @udma_filter: filter UDMA modes
@@ -544,6 +728,7 @@ struct ide_port_ops {
544 void (*resetproc)(ide_drive_t *); 728 void (*resetproc)(ide_drive_t *);
545 void (*maskproc)(ide_drive_t *, int); 729 void (*maskproc)(ide_drive_t *, int);
546 void (*quirkproc)(ide_drive_t *); 730 void (*quirkproc)(ide_drive_t *);
731 void (*clear_irq)(ide_drive_t *);
547 732
548 u8 (*mdma_filter)(ide_drive_t *); 733 u8 (*mdma_filter)(ide_drive_t *);
549 u8 (*udma_filter)(ide_drive_t *); 734 u8 (*udma_filter)(ide_drive_t *);
@@ -606,12 +791,16 @@ typedef struct hwif_s {
606 const struct ide_port_ops *port_ops; 791 const struct ide_port_ops *port_ops;
607 const struct ide_dma_ops *dma_ops; 792 const struct ide_dma_ops *dma_ops;
608 793
609 void (*ide_dma_clear_irq)(ide_drive_t *drive);
610
611 /* dma physical region descriptor table (cpu view) */ 794 /* dma physical region descriptor table (cpu view) */
612 unsigned int *dmatable_cpu; 795 unsigned int *dmatable_cpu;
613 /* dma physical region descriptor table (dma view) */ 796 /* dma physical region descriptor table (dma view) */
614 dma_addr_t dmatable_dma; 797 dma_addr_t dmatable_dma;
798
799 /* maximum number of PRD table entries */
800 int prd_max_nents;
801 /* PRD entry size in bytes */
802 int prd_ent_size;
803
615 /* Scatter-gather list used to build the above */ 804 /* Scatter-gather list used to build the above */
616 struct scatterlist *sg_table; 805 struct scatterlist *sg_table;
617 int sg_max_nents; /* Maximum number of entries in it */ 806 int sg_max_nents; /* Maximum number of entries in it */
@@ -621,6 +810,8 @@ typedef struct hwif_s {
621 /* data phase of the active command (currently only valid for PIO/DMA) */ 810 /* data phase of the active command (currently only valid for PIO/DMA) */
622 int data_phase; 811 int data_phase;
623 812
813 struct ide_task_s task; /* current command */
814
624 unsigned int nsect; 815 unsigned int nsect;
625 unsigned int nleft; 816 unsigned int nleft;
626 struct scatterlist *cursg; 817 struct scatterlist *cursg;
@@ -649,15 +840,15 @@ typedef struct hwif_s {
649 840
650 void *hwif_data; /* extra hwif data */ 841 void *hwif_data; /* extra hwif data */
651 842
652 unsigned dma;
653
654#ifdef CONFIG_BLK_DEV_IDEACPI 843#ifdef CONFIG_BLK_DEV_IDEACPI
655 struct ide_acpi_hwif_link *acpidata; 844 struct ide_acpi_hwif_link *acpidata;
656#endif 845#endif
657} ____cacheline_internodealigned_in_smp ide_hwif_t; 846} ____cacheline_internodealigned_in_smp ide_hwif_t;
658 847
848#define MAX_HOST_PORTS 4
849
659struct ide_host { 850struct ide_host {
660 ide_hwif_t *ports[MAX_HWIFS]; 851 ide_hwif_t *ports[MAX_HOST_PORTS];
661 unsigned int n_ports; 852 unsigned int n_ports;
662 struct device *dev[2]; 853 struct device *dev[2];
663 unsigned int (*init_chipset)(struct pci_dev *); 854 unsigned int (*init_chipset)(struct pci_dev *);
@@ -739,6 +930,22 @@ static int set_##name(ide_drive_t *drive, int arg) \
739 return 0; \ 930 return 0; \
740} 931}
741 932
933#define ide_devset_get_flag(name, flag) \
934static int get_##name(ide_drive_t *drive) \
935{ \
936 return !!(drive->dev_flags & flag); \
937}
938
939#define ide_devset_set_flag(name, flag) \
940static int set_##name(ide_drive_t *drive, int arg) \
941{ \
942 if (arg) \
943 drive->dev_flags |= flag; \
944 else \
945 drive->dev_flags &= ~flag; \
946 return 0; \
947}
948
742#define __IDE_DEVSET(_name, _flags, _get, _set) \ 949#define __IDE_DEVSET(_name, _flags, _get, _set) \
743const struct ide_devset ide_devset_##_name = \ 950const struct ide_devset ide_devset_##_name = \
744 __DEVSET(_flags, _get, _set) 951 __DEVSET(_flags, _get, _set)
@@ -752,8 +959,11 @@ IDE_DEVSET(_name, 0, get_##_func, set_##_func)
752#define ide_devset_w(_name, _func) \ 959#define ide_devset_w(_name, _func) \
753IDE_DEVSET(_name, 0, NULL, set_##_func) 960IDE_DEVSET(_name, 0, NULL, set_##_func)
754 961
755#define ide_devset_rw_sync(_name, _func) \ 962#define ide_ext_devset_rw(_name, _func) \
756IDE_DEVSET(_name, DS_SYNC, get_##_func, set_##_func) 963__IDE_DEVSET(_name, 0, get_##_func, set_##_func)
964
965#define ide_ext_devset_rw_sync(_name, _func) \
966__IDE_DEVSET(_name, DS_SYNC, get_##_func, set_##_func)
757 967
758#define ide_decl_devset(_name) \ 968#define ide_decl_devset(_name) \
759extern const struct ide_devset ide_devset_##_name 969extern const struct ide_devset ide_devset_##_name
@@ -764,71 +974,6 @@ ide_decl_devset(pio_mode);
764ide_decl_devset(unmaskirq); 974ide_decl_devset(unmaskirq);
765ide_decl_devset(using_dma); 975ide_decl_devset(using_dma);
766 976
767/* ATAPI packet command flags */
768enum {
769 /* set when an error is considered normal - no retry (ide-tape) */
770 PC_FLAG_ABORT = (1 << 0),
771 PC_FLAG_SUPPRESS_ERROR = (1 << 1),
772 PC_FLAG_WAIT_FOR_DSC = (1 << 2),
773 PC_FLAG_DMA_OK = (1 << 3),
774 PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
775 PC_FLAG_DMA_ERROR = (1 << 5),
776 PC_FLAG_WRITING = (1 << 6),
777 /* command timed out */
778 PC_FLAG_TIMEDOUT = (1 << 7),
779};
780
781/*
782 * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes.
783 * This is used for several packet commands (not for READ/WRITE commands).
784 */
785#define IDE_PC_BUFFER_SIZE 256
786
787struct ide_atapi_pc {
788 /* actual packet bytes */
789 u8 c[12];
790 /* incremented on each retry */
791 int retries;
792 int error;
793
794 /* bytes to transfer */
795 int req_xfer;
796 /* bytes actually transferred */
797 int xferred;
798
799 /* data buffer */
800 u8 *buf;
801 /* current buffer position */
802 u8 *cur_pos;
803 int buf_size;
804 /* missing/available data on the current buffer */
805 int b_count;
806
807 /* the corresponding request */
808 struct request *rq;
809
810 unsigned long flags;
811
812 /*
813 * those are more or less driver-specific and some of them are subject
814 * to change/removal later.
815 */
816 u8 pc_buf[IDE_PC_BUFFER_SIZE];
817
818 /* idetape only */
819 struct idetape_bh *bh;
820 char *b_data;
821
822 /* idescsi only for now */
823 struct scatterlist *sg;
824 unsigned int sg_cnt;
825
826 struct scsi_cmnd *scsi_cmd;
827 void (*done) (struct scsi_cmnd *);
828
829 unsigned long timeout;
830};
831
832#ifdef CONFIG_IDE_PROC_FS 977#ifdef CONFIG_IDE_PROC_FS
833/* 978/*
834 * /proc/ide interface 979 * /proc/ide interface
@@ -839,6 +984,11 @@ ide_devset_get(_name, _field); \
839ide_devset_set(_name, _field); \ 984ide_devset_set(_name, _field); \
840IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 985IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name)
841 986
987#define ide_devset_rw_flag(_name, _field) \
988ide_devset_get_flag(_name, _field); \
989ide_devset_set_flag(_name, _field); \
990IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name)
991
842struct ide_proc_devset { 992struct ide_proc_devset {
843 const char *name; 993 const char *name;
844 const struct ide_devset *setting; 994 const struct ide_devset *setting;
@@ -905,37 +1055,55 @@ static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *
905#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; 1055#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
906#endif 1056#endif
907 1057
1058enum {
1059 /* enter/exit functions */
1060 IDE_DBG_FUNC = (1 << 0),
1061 /* sense key/asc handling */
1062 IDE_DBG_SENSE = (1 << 1),
1063 /* packet commands handling */
1064 IDE_DBG_PC = (1 << 2),
1065 /* request handling */
1066 IDE_DBG_RQ = (1 << 3),
1067 /* driver probing/setup */
1068 IDE_DBG_PROBE = (1 << 4),
1069};
1070
1071/* DRV_NAME has to be defined in the driver before using the macro below */
1072#define __ide_debug_log(lvl, fmt, args...) \
1073{ \
1074 if (unlikely(drive->debug_mask & lvl)) \
1075 printk(KERN_INFO DRV_NAME ": " fmt, ## args); \
1076}
1077
908/* 1078/*
909 * Power Management step value (rq->pm->pm_step). 1079 * Power Management state machine (rq->pm->pm_step).
910 *
911 * The step value starts at 0 (ide_pm_state_start_suspend) for a
912 * suspend operation or 1000 (ide_pm_state_start_resume) for a
913 * resume operation.
914 * 1080 *
915 * For each step, the core calls the subdriver start_power_step() first. 1081 * For each step, the core calls ide_start_power_step() first.
916 * This can return: 1082 * This can return:
917 * - ide_stopped : In this case, the core calls us back again unless 1083 * - ide_stopped : In this case, the core calls us back again unless
918 * step have been set to ide_power_state_completed. 1084 * step have been set to ide_power_state_completed.
919 * - ide_started : In this case, the channel is left busy until an 1085 * - ide_started : In this case, the channel is left busy until an
920 * async event (interrupt) occurs. 1086 * async event (interrupt) occurs.
921 * Typically, start_power_step() will issue a taskfile request with 1087 * Typically, ide_start_power_step() will issue a taskfile request with
922 * do_rw_taskfile(). 1088 * do_rw_taskfile().
923 * 1089 *
924 * Upon reception of the interrupt, the core will call complete_power_step() 1090 * Upon reception of the interrupt, the core will call ide_complete_power_step()
925 * with the error code if any. This routine should update the step value 1091 * with the error code if any. This routine should update the step value
926 * and return. It should not start a new request. The core will call 1092 * and return. It should not start a new request. The core will call
927 * start_power_step for the new step value, unless step have been set to 1093 * ide_start_power_step() for the new step value, unless step have been
928 * ide_power_state_completed. 1094 * set to IDE_PM_COMPLETED.
929 *
930 * Subdrivers are expected to define their own additional power
931 * steps from 1..999 for suspend and from 1001..1999 for resume,
932 * other values are reserved for future use.
933 */ 1095 */
934
935enum { 1096enum {
936 ide_pm_state_completed = -1, 1097 IDE_PM_START_SUSPEND,
937 ide_pm_state_start_suspend = 0, 1098 IDE_PM_FLUSH_CACHE = IDE_PM_START_SUSPEND,
938 ide_pm_state_start_resume = 1000, 1099 IDE_PM_STANDBY,
1100
1101 IDE_PM_START_RESUME,
1102 IDE_PM_RESTORE_PIO = IDE_PM_START_RESUME,
1103 IDE_PM_IDLE,
1104 IDE_PM_RESTORE_DMA,
1105
1106 IDE_PM_COMPLETED,
939}; 1107};
940 1108
941/* 1109/*
@@ -946,7 +1114,6 @@ enum {
946 */ 1114 */
947struct ide_driver_s { 1115struct ide_driver_s {
948 const char *version; 1116 const char *version;
949 u8 media;
950 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); 1117 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
951 int (*end_request)(ide_drive_t *, int, int); 1118 int (*end_request)(ide_drive_t *, int, int);
952 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); 1119 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8);
@@ -1015,110 +1182,6 @@ extern void ide_do_drive_cmd(ide_drive_t *, struct request *);
1015 1182
1016extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 1183extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
1017 1184
1018enum {
1019 IDE_TFLAG_LBA48 = (1 << 0),
1020 IDE_TFLAG_FLAGGED = (1 << 2),
1021 IDE_TFLAG_OUT_DATA = (1 << 3),
1022 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4),
1023 IDE_TFLAG_OUT_HOB_NSECT = (1 << 5),
1024 IDE_TFLAG_OUT_HOB_LBAL = (1 << 6),
1025 IDE_TFLAG_OUT_HOB_LBAM = (1 << 7),
1026 IDE_TFLAG_OUT_HOB_LBAH = (1 << 8),
1027 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
1028 IDE_TFLAG_OUT_HOB_NSECT |
1029 IDE_TFLAG_OUT_HOB_LBAL |
1030 IDE_TFLAG_OUT_HOB_LBAM |
1031 IDE_TFLAG_OUT_HOB_LBAH,
1032 IDE_TFLAG_OUT_FEATURE = (1 << 9),
1033 IDE_TFLAG_OUT_NSECT = (1 << 10),
1034 IDE_TFLAG_OUT_LBAL = (1 << 11),
1035 IDE_TFLAG_OUT_LBAM = (1 << 12),
1036 IDE_TFLAG_OUT_LBAH = (1 << 13),
1037 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
1038 IDE_TFLAG_OUT_NSECT |
1039 IDE_TFLAG_OUT_LBAL |
1040 IDE_TFLAG_OUT_LBAM |
1041 IDE_TFLAG_OUT_LBAH,
1042 IDE_TFLAG_OUT_DEVICE = (1 << 14),
1043 IDE_TFLAG_WRITE = (1 << 15),
1044 IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16),
1045 IDE_TFLAG_IN_DATA = (1 << 17),
1046 IDE_TFLAG_CUSTOM_HANDLER = (1 << 18),
1047 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19),
1048 IDE_TFLAG_IN_HOB_FEATURE = (1 << 20),
1049 IDE_TFLAG_IN_HOB_NSECT = (1 << 21),
1050 IDE_TFLAG_IN_HOB_LBAL = (1 << 22),
1051 IDE_TFLAG_IN_HOB_LBAM = (1 << 23),
1052 IDE_TFLAG_IN_HOB_LBAH = (1 << 24),
1053 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
1054 IDE_TFLAG_IN_HOB_LBAM |
1055 IDE_TFLAG_IN_HOB_LBAH,
1056 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE |
1057 IDE_TFLAG_IN_HOB_NSECT |
1058 IDE_TFLAG_IN_HOB_LBA,
1059 IDE_TFLAG_IN_FEATURE = (1 << 1),
1060 IDE_TFLAG_IN_NSECT = (1 << 25),
1061 IDE_TFLAG_IN_LBAL = (1 << 26),
1062 IDE_TFLAG_IN_LBAM = (1 << 27),
1063 IDE_TFLAG_IN_LBAH = (1 << 28),
1064 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
1065 IDE_TFLAG_IN_LBAM |
1066 IDE_TFLAG_IN_LBAH,
1067 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
1068 IDE_TFLAG_IN_LBA,
1069 IDE_TFLAG_IN_DEVICE = (1 << 29),
1070 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
1071 IDE_TFLAG_IN_HOB,
1072 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
1073 IDE_TFLAG_IN_TF,
1074 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
1075 IDE_TFLAG_IN_DEVICE,
1076 /* force 16-bit I/O operations */
1077 IDE_TFLAG_IO_16BIT = (1 << 30),
1078 /* ide_task_t was allocated using kmalloc() */
1079 IDE_TFLAG_DYN = (1 << 31),
1080};
1081
1082struct ide_taskfile {
1083 u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */
1084
1085 u8 hob_feature; /* 1-5: additional data to support LBA48 */
1086 u8 hob_nsect;
1087 u8 hob_lbal;
1088 u8 hob_lbam;
1089 u8 hob_lbah;
1090
1091 u8 data; /* 6: low data byte (for TASKFILE IOCTL) */
1092
1093 union { /*  7: */
1094 u8 error; /* read: error */
1095 u8 feature; /* write: feature */
1096 };
1097
1098 u8 nsect; /* 8: number of sectors */
1099 u8 lbal; /* 9: LBA low */
1100 u8 lbam; /* 10: LBA mid */
1101 u8 lbah; /* 11: LBA high */
1102
1103 u8 device; /* 12: device select */
1104
1105 union { /* 13: */
1106 u8 status; /*  read: status  */
1107 u8 command; /* write: command */
1108 };
1109};
1110
1111typedef struct ide_task_s {
1112 union {
1113 struct ide_taskfile tf;
1114 u8 tf_array[14];
1115 };
1116 u32 tf_flags;
1117 int data_phase;
1118 struct request *rq; /* copy of request */
1119 void *special; /* valid_t generally */
1120} ide_task_t;
1121
1122void ide_tf_dump(const char *, struct ide_taskfile *); 1185void ide_tf_dump(const char *, struct ide_taskfile *);
1123 1186
1124void ide_exec_command(ide_hwif_t *, u8); 1187void ide_exec_command(ide_hwif_t *, u8);
@@ -1150,6 +1213,13 @@ int ide_check_atapi_device(ide_drive_t *, const char *);
1150 1213
1151void ide_init_pc(struct ide_atapi_pc *); 1214void ide_init_pc(struct ide_atapi_pc *);
1152 1215
1216/* Disk head parking */
1217extern wait_queue_head_t ide_park_wq;
1218ssize_t ide_park_show(struct device *dev, struct device_attribute *attr,
1219 char *buf);
1220ssize_t ide_park_store(struct device *dev, struct device_attribute *attr,
1221 const char *buf, size_t len);
1222
1153/* 1223/*
1154 * Special requests for ide-tape block device strategy routine. 1224 * Special requests for ide-tape block device strategy routine.
1155 * 1225 *
@@ -1163,24 +1233,22 @@ enum {
1163 REQ_IDETAPE_WRITE = (1 << 3), 1233 REQ_IDETAPE_WRITE = (1 << 3),
1164}; 1234};
1165 1235
1166void ide_queue_pc_head(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *,
1167 struct request *);
1168int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *); 1236int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *);
1169 1237
1170int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *); 1238int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *);
1171int ide_do_start_stop(ide_drive_t *, struct gendisk *, int); 1239int ide_do_start_stop(ide_drive_t *, struct gendisk *, int);
1172int ide_set_media_lock(ide_drive_t *, struct gendisk *, int); 1240int ide_set_media_lock(ide_drive_t *, struct gendisk *, int);
1241void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *);
1242void ide_retry_pc(ide_drive_t *, struct gendisk *);
1243
1244static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc)
1245{
1246 return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies);
1247}
1248
1249int ide_scsi_expiry(ide_drive_t *);
1173 1250
1174ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, 1251ide_startstop_t ide_issue_pc(ide_drive_t *, unsigned int, ide_expiry_t *);
1175 ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry,
1176 void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
1177 void (*retry_pc)(ide_drive_t *), void (*dsc_handle)(ide_drive_t *),
1178 int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int,
1179 int));
1180ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *,
1181 ide_handler_t *, unsigned int, ide_expiry_t *);
1182ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_atapi_pc *,
1183 ide_handler_t *, unsigned int, ide_expiry_t *);
1184 1252
1185ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); 1253ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
1186 1254
@@ -1358,6 +1426,7 @@ struct drive_list_entry {
1358int ide_in_drive_list(u16 *, const struct drive_list_entry *); 1426int ide_in_drive_list(u16 *, const struct drive_list_entry *);
1359 1427
1360#ifdef CONFIG_BLK_DEV_IDEDMA 1428#ifdef CONFIG_BLK_DEV_IDEDMA
1429int ide_dma_good_drive(ide_drive_t *);
1361int __ide_dma_bad_drive(ide_drive_t *); 1430int __ide_dma_bad_drive(ide_drive_t *);
1362int ide_id_dma_bug(ide_drive_t *); 1431int ide_id_dma_bug(ide_drive_t *);
1363 1432
@@ -1375,25 +1444,29 @@ int ide_set_dma(ide_drive_t *);
1375void ide_check_dma_crc(ide_drive_t *); 1444void ide_check_dma_crc(ide_drive_t *);
1376ide_startstop_t ide_dma_intr(ide_drive_t *); 1445ide_startstop_t ide_dma_intr(ide_drive_t *);
1377 1446
1447int ide_allocate_dma_engine(ide_hwif_t *);
1448void ide_release_dma_engine(ide_hwif_t *);
1449
1378int ide_build_sglist(ide_drive_t *, struct request *); 1450int ide_build_sglist(ide_drive_t *, struct request *);
1379void ide_destroy_dmatable(ide_drive_t *); 1451void ide_destroy_dmatable(ide_drive_t *);
1380 1452
1381#ifdef CONFIG_BLK_DEV_IDEDMA_SFF 1453#ifdef CONFIG_BLK_DEV_IDEDMA_SFF
1454int config_drive_for_dma(ide_drive_t *);
1382extern int ide_build_dmatable(ide_drive_t *, struct request *); 1455extern int ide_build_dmatable(ide_drive_t *, struct request *);
1383int ide_allocate_dma_engine(ide_hwif_t *);
1384void ide_release_dma_engine(ide_hwif_t *);
1385
1386void ide_dma_host_set(ide_drive_t *, int); 1456void ide_dma_host_set(ide_drive_t *, int);
1387extern int ide_dma_setup(ide_drive_t *); 1457extern int ide_dma_setup(ide_drive_t *);
1388void ide_dma_exec_cmd(ide_drive_t *, u8); 1458void ide_dma_exec_cmd(ide_drive_t *, u8);
1389extern void ide_dma_start(ide_drive_t *); 1459extern void ide_dma_start(ide_drive_t *);
1390extern int __ide_dma_end(ide_drive_t *); 1460int ide_dma_end(ide_drive_t *);
1391int ide_dma_test_irq(ide_drive_t *); 1461int ide_dma_test_irq(ide_drive_t *);
1392extern void ide_dma_lost_irq(ide_drive_t *);
1393extern void ide_dma_timeout(ide_drive_t *);
1394extern const struct ide_dma_ops sff_dma_ops; 1462extern const struct ide_dma_ops sff_dma_ops;
1463#else
1464static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
1395#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ 1465#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */
1396 1466
1467void ide_dma_lost_irq(ide_drive_t *);
1468void ide_dma_timeout(ide_drive_t *);
1469
1397#else 1470#else
1398static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } 1471static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
1399static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } 1472static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
@@ -1404,11 +1477,8 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; }
1404static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1477static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1405static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1478static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1406static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } 1479static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
1407#endif /* CONFIG_BLK_DEV_IDEDMA */
1408
1409#ifndef CONFIG_BLK_DEV_IDEDMA_SFF
1410static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } 1480static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; }
1411#endif 1481#endif /* CONFIG_BLK_DEV_IDEDMA */
1412 1482
1413#ifdef CONFIG_BLK_DEV_IDEACPI 1483#ifdef CONFIG_BLK_DEV_IDEACPI
1414extern int ide_acpi_exec_tfs(ide_drive_t *drive); 1484extern int ide_acpi_exec_tfs(ide_drive_t *drive);
@@ -1436,7 +1506,6 @@ void ide_undecoded_slave(ide_drive_t *);
1436 1506
1437void ide_port_apply_params(ide_hwif_t *); 1507void ide_port_apply_params(ide_hwif_t *);
1438 1508
1439struct ide_host *ide_host_alloc_all(const struct ide_port_info *, hw_regs_t **);
1440struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **); 1509struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **);
1441void ide_host_free(struct ide_host *); 1510void ide_host_free(struct ide_host *);
1442int ide_host_register(struct ide_host *, const struct ide_port_info *, 1511int ide_host_register(struct ide_host *, const struct ide_port_info *,
@@ -1547,6 +1616,6 @@ static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1547{ 1616{
1548 ide_drive_t *peer = &drive->hwif->drives[(drive->dn ^ 1) & 1]; 1617 ide_drive_t *peer = &drive->hwif->drives[(drive->dn ^ 1) & 1];
1549 1618
1550 return peer->present ? peer : NULL; 1619 return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL;
1551} 1620}
1552#endif /* _IDE_H */ 1621#endif /* _IDE_H */
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index bf1a53b2682e..7f3c735f422b 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 * Donald Becker, <becker@super.org> 11 * Donald Becker, <becker@super.org>
12 * Alan Cox, <alan@redhat.com> 12 * Alan Cox, <alan@lxorguk.ukuu.org.uk>
13 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> 13 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
14 * 14 *
15 * This program is free software; you can redistribute it and/or 15 * This program is free software; you can redistribute it and/or
diff --git a/include/linux/if_fddi.h b/include/linux/if_fddi.h
index ae77daed6c2f..45de1046dbbf 100644
--- a/include/linux/if_fddi.h
+++ b/include/linux/if_fddi.h
@@ -12,7 +12,7 @@
12 * if_fddi.h is based on previous if_ether.h and if_tr.h work by 12 * if_fddi.h is based on previous if_ether.h and if_tr.h work by
13 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 13 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
14 * Donald Becker, <becker@super.org> 14 * Donald Becker, <becker@super.org>
15 * Alan Cox, <alan@redhat.com> 15 * Alan Cox, <alan@lxorguk.ukuu.org.uk>
16 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> 16 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
17 * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> 17 * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be>
18 * 18 *
diff --git a/include/linux/if_hippi.h b/include/linux/if_hippi.h
index 94d31ca7d71a..f0f23516bb59 100644
--- a/include/linux/if_hippi.h
+++ b/include/linux/if_hippi.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 * Donald Becker, <becker@super.org> 11 * Donald Becker, <becker@super.org>
12 * Alan Cox, <alan@redhat.com> 12 * Alan Cox, <alan@lxorguk.ukuu.org.uk>
13 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> 13 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
14 * Jes Sorensen, <Jes.Sorensen@cern.ch> 14 * Jes Sorensen, <Jes.Sorensen@cern.ch>
15 * 15 *
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 7bb3c095c15b..f734a0ba0698 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -2,7 +2,7 @@
2 * Linux NET3: Internet Group Management Protocol [IGMP] 2 * Linux NET3: Internet Group Management Protocol [IGMP]
3 * 3 *
4 * Authors: 4 * Authors:
5 * Alan Cox <Alan.Cox@linux.org> 5 * Alan Cox <alan@lxorguk.ukuu.org.uk>
6 * 6 *
7 * Extended to talk the BSD extended IGMP protocol of mrouted 3.6 7 * Extended to talk the BSD extended IGMP protocol of mrouted 3.6
8 * 8 *
diff --git a/include/linux/init.h b/include/linux/init.h
index 27f61f6b3cb9..0c1264668be0 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -233,9 +233,6 @@ struct obs_kernel_param {
233 __attribute__((aligned((sizeof(long))))) \ 233 __attribute__((aligned((sizeof(long))))) \
234 = { __setup_str_##unique_id, fn, early } 234 = { __setup_str_##unique_id, fn, early }
235 235
236#define __setup_null_param(str, unique_id) \
237 __setup_param(str, unique_id, NULL, 0)
238
239#define __setup(str, fn) \ 236#define __setup(str, fn) \
240 __setup_param(str, fn, fn, 0) 237 __setup_param(str, fn, fn, 0)
241 238
@@ -296,7 +293,6 @@ void __init parse_early_param(void);
296 void cleanup_module(void) __attribute__((alias(#exitfn))); 293 void cleanup_module(void) __attribute__((alias(#exitfn)));
297 294
298#define __setup_param(str, unique_id, fn) /* nothing */ 295#define __setup_param(str, unique_id, fn) /* nothing */
299#define __setup_null_param(str, unique_id) /* nothing */
300#define __setup(str, func) /* nothing */ 296#define __setup(str, func) /* nothing */
301#endif 297#endif
302 298
diff --git a/include/linux/input.h b/include/linux/input.h
index a5802c9c81a4..b86fb5581ce6 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -577,9 +577,22 @@ struct input_absinfo {
577#define KEY_BRL_DOT9 0x1f9 577#define KEY_BRL_DOT9 0x1f9
578#define KEY_BRL_DOT10 0x1fa 578#define KEY_BRL_DOT10 0x1fa
579 579
580#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */
581#define KEY_NUMERIC_1 0x201 /* and other keypads */
582#define KEY_NUMERIC_2 0x202
583#define KEY_NUMERIC_3 0x203
584#define KEY_NUMERIC_4 0x204
585#define KEY_NUMERIC_5 0x205
586#define KEY_NUMERIC_6 0x206
587#define KEY_NUMERIC_7 0x207
588#define KEY_NUMERIC_8 0x208
589#define KEY_NUMERIC_9 0x209
590#define KEY_NUMERIC_STAR 0x20a
591#define KEY_NUMERIC_POUND 0x20b
592
580/* We avoid low common keys in module aliases so they don't get huge. */ 593/* We avoid low common keys in module aliases so they don't get huge. */
581#define KEY_MIN_INTERESTING KEY_MUTE 594#define KEY_MIN_INTERESTING KEY_MUTE
582#define KEY_MAX 0x1ff 595#define KEY_MAX 0x2ff
583#define KEY_CNT (KEY_MAX+1) 596#define KEY_CNT (KEY_MAX+1)
584 597
585/* 598/*
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
new file mode 100644
index 000000000000..2e117f30a76c
--- /dev/null
+++ b/include/linux/intel-iommu.h
@@ -0,0 +1,327 @@
1/*
2 * Copyright (c) 2006, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Copyright (C) 2006-2008 Intel Corporation
18 * Author: Ashok Raj <ashok.raj@intel.com>
19 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
20 */
21
22#ifndef _INTEL_IOMMU_H_
23#define _INTEL_IOMMU_H_
24
25#include <linux/types.h>
26#include <linux/msi.h>
27#include <linux/sysdev.h>
28#include <linux/iova.h>
29#include <linux/io.h>
30#include <linux/dma_remapping.h>
31#include <asm/cacheflush.h>
32
33/*
34 * Intel IOMMU register specification per version 1.0 public spec.
35 */
36
37#define DMAR_VER_REG 0x0 /* Arch version supported by this IOMMU */
38#define DMAR_CAP_REG 0x8 /* Hardware supported capabilities */
39#define DMAR_ECAP_REG 0x10 /* Extended capabilities supported */
40#define DMAR_GCMD_REG 0x18 /* Global command register */
41#define DMAR_GSTS_REG 0x1c /* Global status register */
42#define DMAR_RTADDR_REG 0x20 /* Root entry table */
43#define DMAR_CCMD_REG 0x28 /* Context command reg */
44#define DMAR_FSTS_REG 0x34 /* Fault Status register */
45#define DMAR_FECTL_REG 0x38 /* Fault control register */
46#define DMAR_FEDATA_REG 0x3c /* Fault event interrupt data register */
47#define DMAR_FEADDR_REG 0x40 /* Fault event interrupt addr register */
48#define DMAR_FEUADDR_REG 0x44 /* Upper address register */
49#define DMAR_AFLOG_REG 0x58 /* Advanced Fault control */
50#define DMAR_PMEN_REG 0x64 /* Enable Protected Memory Region */
51#define DMAR_PLMBASE_REG 0x68 /* PMRR Low addr */
52#define DMAR_PLMLIMIT_REG 0x6c /* PMRR low limit */
53#define DMAR_PHMBASE_REG 0x70 /* pmrr high base addr */
54#define DMAR_PHMLIMIT_REG 0x78 /* pmrr high limit */
55#define DMAR_IQH_REG 0x80 /* Invalidation queue head register */
56#define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */
57#define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */
58#define DMAR_ICS_REG 0x98 /* Invalidation complete status register */
59#define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */
60
61#define OFFSET_STRIDE (9)
62/*
63#define dmar_readl(dmar, reg) readl(dmar + reg)
64#define dmar_readq(dmar, reg) ({ \
65 u32 lo, hi; \
66 lo = readl(dmar + reg); \
67 hi = readl(dmar + reg + 4); \
68 (((u64) hi) << 32) + lo; })
69*/
70static inline u64 dmar_readq(void __iomem *addr)
71{
72 u32 lo, hi;
73 lo = readl(addr);
74 hi = readl(addr + 4);
75 return (((u64) hi) << 32) + lo;
76}
77
78static inline void dmar_writeq(void __iomem *addr, u64 val)
79{
80 writel((u32)val, addr);
81 writel((u32)(val >> 32), addr + 4);
82}
83
84#define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4)
85#define DMAR_VER_MINOR(v) ((v) & 0x0f)
86
87/*
88 * Decoding Capability Register
89 */
90#define cap_read_drain(c) (((c) >> 55) & 1)
91#define cap_write_drain(c) (((c) >> 54) & 1)
92#define cap_max_amask_val(c) (((c) >> 48) & 0x3f)
93#define cap_num_fault_regs(c) ((((c) >> 40) & 0xff) + 1)
94#define cap_pgsel_inv(c) (((c) >> 39) & 1)
95
96#define cap_super_page_val(c) (((c) >> 34) & 0xf)
97#define cap_super_offset(c) (((find_first_bit(&cap_super_page_val(c), 4)) \
98 * OFFSET_STRIDE) + 21)
99
100#define cap_fault_reg_offset(c) ((((c) >> 24) & 0x3ff) * 16)
101#define cap_max_fault_reg_offset(c) \
102 (cap_fault_reg_offset(c) + cap_num_fault_regs(c) * 16)
103
104#define cap_zlr(c) (((c) >> 22) & 1)
105#define cap_isoch(c) (((c) >> 23) & 1)
106#define cap_mgaw(c) ((((c) >> 16) & 0x3f) + 1)
107#define cap_sagaw(c) (((c) >> 8) & 0x1f)
108#define cap_caching_mode(c) (((c) >> 7) & 1)
109#define cap_phmr(c) (((c) >> 6) & 1)
110#define cap_plmr(c) (((c) >> 5) & 1)
111#define cap_rwbf(c) (((c) >> 4) & 1)
112#define cap_afl(c) (((c) >> 3) & 1)
113#define cap_ndoms(c) (((unsigned long)1) << (4 + 2 * ((c) & 0x7)))
114/*
115 * Extended Capability Register
116 */
117
118#define ecap_niotlb_iunits(e) ((((e) >> 24) & 0xff) + 1)
119#define ecap_iotlb_offset(e) ((((e) >> 8) & 0x3ff) * 16)
120#define ecap_max_iotlb_offset(e) \
121 (ecap_iotlb_offset(e) + ecap_niotlb_iunits(e) * 16)
122#define ecap_coherent(e) ((e) & 0x1)
123#define ecap_qis(e) ((e) & 0x2)
124#define ecap_eim_support(e) ((e >> 4) & 0x1)
125#define ecap_ir_support(e) ((e >> 3) & 0x1)
126#define ecap_max_handle_mask(e) ((e >> 20) & 0xf)
127
128
129/* IOTLB_REG */
130#define DMA_TLB_GLOBAL_FLUSH (((u64)1) << 60)
131#define DMA_TLB_DSI_FLUSH (((u64)2) << 60)
132#define DMA_TLB_PSI_FLUSH (((u64)3) << 60)
133#define DMA_TLB_IIRG(type) ((type >> 60) & 7)
134#define DMA_TLB_IAIG(val) (((val) >> 57) & 7)
135#define DMA_TLB_READ_DRAIN (((u64)1) << 49)
136#define DMA_TLB_WRITE_DRAIN (((u64)1) << 48)
137#define DMA_TLB_DID(id) (((u64)((id) & 0xffff)) << 32)
138#define DMA_TLB_IVT (((u64)1) << 63)
139#define DMA_TLB_IH_NONLEAF (((u64)1) << 6)
140#define DMA_TLB_MAX_SIZE (0x3f)
141
142/* INVALID_DESC */
143#define DMA_ID_TLB_GLOBAL_FLUSH (((u64)1) << 3)
144#define DMA_ID_TLB_DSI_FLUSH (((u64)2) << 3)
145#define DMA_ID_TLB_PSI_FLUSH (((u64)3) << 3)
146#define DMA_ID_TLB_READ_DRAIN (((u64)1) << 7)
147#define DMA_ID_TLB_WRITE_DRAIN (((u64)1) << 6)
148#define DMA_ID_TLB_DID(id) (((u64)((id & 0xffff) << 16)))
149#define DMA_ID_TLB_IH_NONLEAF (((u64)1) << 6)
150#define DMA_ID_TLB_ADDR(addr) (addr)
151#define DMA_ID_TLB_ADDR_MASK(mask) (mask)
152
153/* PMEN_REG */
154#define DMA_PMEN_EPM (((u32)1)<<31)
155#define DMA_PMEN_PRS (((u32)1)<<0)
156
157/* GCMD_REG */
158#define DMA_GCMD_TE (((u32)1) << 31)
159#define DMA_GCMD_SRTP (((u32)1) << 30)
160#define DMA_GCMD_SFL (((u32)1) << 29)
161#define DMA_GCMD_EAFL (((u32)1) << 28)
162#define DMA_GCMD_WBF (((u32)1) << 27)
163#define DMA_GCMD_QIE (((u32)1) << 26)
164#define DMA_GCMD_SIRTP (((u32)1) << 24)
165#define DMA_GCMD_IRE (((u32) 1) << 25)
166
167/* GSTS_REG */
168#define DMA_GSTS_TES (((u32)1) << 31)
169#define DMA_GSTS_RTPS (((u32)1) << 30)
170#define DMA_GSTS_FLS (((u32)1) << 29)
171#define DMA_GSTS_AFLS (((u32)1) << 28)
172#define DMA_GSTS_WBFS (((u32)1) << 27)
173#define DMA_GSTS_QIES (((u32)1) << 26)
174#define DMA_GSTS_IRTPS (((u32)1) << 24)
175#define DMA_GSTS_IRES (((u32)1) << 25)
176
177/* CCMD_REG */
178#define DMA_CCMD_ICC (((u64)1) << 63)
179#define DMA_CCMD_GLOBAL_INVL (((u64)1) << 61)
180#define DMA_CCMD_DOMAIN_INVL (((u64)2) << 61)
181#define DMA_CCMD_DEVICE_INVL (((u64)3) << 61)
182#define DMA_CCMD_FM(m) (((u64)((m) & 0x3)) << 32)
183#define DMA_CCMD_MASK_NOBIT 0
184#define DMA_CCMD_MASK_1BIT 1
185#define DMA_CCMD_MASK_2BIT 2
186#define DMA_CCMD_MASK_3BIT 3
187#define DMA_CCMD_SID(s) (((u64)((s) & 0xffff)) << 16)
188#define DMA_CCMD_DID(d) ((u64)((d) & 0xffff))
189
190/* FECTL_REG */
191#define DMA_FECTL_IM (((u32)1) << 31)
192
193/* FSTS_REG */
194#define DMA_FSTS_PPF ((u32)2)
195#define DMA_FSTS_PFO ((u32)1)
196#define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff)
197
198/* FRCD_REG, 32 bits access */
199#define DMA_FRCD_F (((u32)1) << 31)
200#define dma_frcd_type(d) ((d >> 30) & 1)
201#define dma_frcd_fault_reason(c) (c & 0xff)
202#define dma_frcd_source_id(c) (c & 0xffff)
203#define dma_frcd_page_addr(d) (d & (((u64)-1) << 12)) /* low 64 bit */
204
205#define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000) /* 10sec */
206
207#define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \
208{\
209 cycles_t start_time = get_cycles();\
210 while (1) {\
211 sts = op (iommu->reg + offset);\
212 if (cond)\
213 break;\
214 if (DMAR_OPERATION_TIMEOUT < (get_cycles() - start_time))\
215 panic("DMAR hardware is malfunctioning\n");\
216 cpu_relax();\
217 }\
218}
219
220#define QI_LENGTH 256 /* queue length */
221
222enum {
223 QI_FREE,
224 QI_IN_USE,
225 QI_DONE
226};
227
228#define QI_CC_TYPE 0x1
229#define QI_IOTLB_TYPE 0x2
230#define QI_DIOTLB_TYPE 0x3
231#define QI_IEC_TYPE 0x4
232#define QI_IWD_TYPE 0x5
233
234#define QI_IEC_SELECTIVE (((u64)1) << 4)
235#define QI_IEC_IIDEX(idx) (((u64)(idx & 0xffff) << 32))
236#define QI_IEC_IM(m) (((u64)(m & 0x1f) << 27))
237
238#define QI_IWD_STATUS_DATA(d) (((u64)d) << 32)
239#define QI_IWD_STATUS_WRITE (((u64)1) << 5)
240
241struct qi_desc {
242 u64 low, high;
243};
244
245struct q_inval {
246 spinlock_t q_lock;
247 struct qi_desc *desc; /* invalidation queue */
248 int *desc_status; /* desc status */
249 int free_head; /* first free entry */
250 int free_tail; /* last free entry */
251 int free_cnt;
252};
253
254#ifdef CONFIG_INTR_REMAP
255/* 1MB - maximum possible interrupt remapping table size */
256#define INTR_REMAP_PAGE_ORDER 8
257#define INTR_REMAP_TABLE_REG_SIZE 0xf
258
259#define INTR_REMAP_TABLE_ENTRIES 65536
260
261struct ir_table {
262 struct irte *base;
263};
264#endif
265
266struct intel_iommu {
267 void __iomem *reg; /* Pointer to hardware regs, virtual addr */
268 u64 cap;
269 u64 ecap;
270 int seg;
271 u32 gcmd; /* Holds TE, EAFL. Don't need SRTP, SFL, WBF */
272 spinlock_t register_lock; /* protect register handling */
273 int seq_id; /* sequence id of the iommu */
274
275#ifdef CONFIG_DMAR
276 unsigned long *domain_ids; /* bitmap of domains */
277 struct dmar_domain **domains; /* ptr to domains */
278 spinlock_t lock; /* protect context, domain ids */
279 struct root_entry *root_entry; /* virtual address */
280
281 unsigned int irq;
282 unsigned char name[7]; /* Device Name */
283 struct msi_msg saved_msg;
284 struct sys_device sysdev;
285#endif
286 struct q_inval *qi; /* Queued invalidation info */
287#ifdef CONFIG_INTR_REMAP
288 struct ir_table *ir_table; /* Interrupt remapping info */
289#endif
290};
291
292static inline void __iommu_flush_cache(
293 struct intel_iommu *iommu, void *addr, int size)
294{
295 if (!ecap_coherent(iommu->ecap))
296 clflush_cache_range(addr, size);
297}
298
299extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct pci_dev *dev);
300
301extern int alloc_iommu(struct dmar_drhd_unit *drhd);
302extern void free_iommu(struct intel_iommu *iommu);
303extern int dmar_enable_qi(struct intel_iommu *iommu);
304extern void qi_global_iec(struct intel_iommu *iommu);
305
306extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
307
308void intel_iommu_domain_exit(struct dmar_domain *domain);
309struct dmar_domain *intel_iommu_domain_alloc(struct pci_dev *pdev);
310int intel_iommu_context_mapping(struct dmar_domain *domain,
311 struct pci_dev *pdev);
312int intel_iommu_page_mapping(struct dmar_domain *domain, dma_addr_t iova,
313 u64 hpa, size_t size, int prot);
314void intel_iommu_detach_dev(struct dmar_domain *domain, u8 bus, u8 devfn);
315struct dmar_domain *intel_iommu_find_domain(struct pci_dev *pdev);
316u64 intel_iommu_iova_to_pfn(struct dmar_domain *domain, u64 iova);
317
318#ifdef CONFIG_DMAR
319int intel_iommu_found(void);
320#else /* CONFIG_DMAR */
321static inline int intel_iommu_found(void)
322{
323 return 0;
324}
325#endif /* CONFIG_DMAR */
326
327#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 58ff4e74b2f3..35a61dc60d51 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -11,6 +11,8 @@
11#include <linux/hardirq.h> 11#include <linux/hardirq.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/irqflags.h> 13#include <linux/irqflags.h>
14#include <linux/smp.h>
15#include <linux/percpu.h>
14#include <asm/atomic.h> 16#include <asm/atomic.h>
15#include <asm/ptrace.h> 17#include <asm/ptrace.h>
16#include <asm/system.h> 18#include <asm/system.h>
@@ -252,6 +254,8 @@ enum
252 HRTIMER_SOFTIRQ, 254 HRTIMER_SOFTIRQ,
253#endif 255#endif
254 RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */ 256 RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
257
258 NR_SOFTIRQS
255}; 259};
256 260
257/* softirq mask and active fields moved to irq_cpustat_t in 261/* softirq mask and active fields moved to irq_cpustat_t in
@@ -271,6 +275,25 @@ extern void softirq_init(void);
271extern void raise_softirq_irqoff(unsigned int nr); 275extern void raise_softirq_irqoff(unsigned int nr);
272extern void raise_softirq(unsigned int nr); 276extern void raise_softirq(unsigned int nr);
273 277
278/* This is the worklist that queues up per-cpu softirq work.
279 *
280 * send_remote_sendirq() adds work to these lists, and
281 * the softirq handler itself dequeues from them. The queues
282 * are protected by disabling local cpu interrupts and they must
283 * only be accessed by the local cpu that they are for.
284 */
285DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list);
286
287/* Try to send a softirq to a remote cpu. If this cannot be done, the
288 * work will be queued to the local cpu.
289 */
290extern void send_remote_softirq(struct call_single_data *cp, int cpu, int softirq);
291
292/* Like send_remote_softirq(), but the caller must disable local cpu interrupts
293 * and compute the current cpu, passed in as 'this_cpu'.
294 */
295extern void __send_remote_softirq(struct call_single_data *cp, int cpu,
296 int this_cpu, int softirq);
274 297
275/* Tasklets --- multithreaded analogue of BHs. 298/* Tasklets --- multithreaded analogue of BHs.
276 299
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
index a6d0586e2bf7..3b068e5b5671 100644
--- a/include/linux/iommu-helper.h
+++ b/include/linux/iommu-helper.h
@@ -23,4 +23,7 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
23extern void iommu_area_free(unsigned long *map, unsigned long start, 23extern void iommu_area_free(unsigned long *map, unsigned long start,
24 unsigned int nr); 24 unsigned int nr);
25 25
26extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len,
27 unsigned long io_page_size);
28
26#endif 29#endif
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index ee9bcc6f32b6..041e95aac2bf 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -34,7 +34,8 @@ struct resource_list {
34 */ 34 */
35#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ 35#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */
36 36
37#define IORESOURCE_IO 0x00000100 /* Resource type */ 37#define IORESOURCE_TYPE_BITS 0x00000f00 /* Resource type */
38#define IORESOURCE_IO 0x00000100
38#define IORESOURCE_MEM 0x00000200 39#define IORESOURCE_MEM 0x00000200
39#define IORESOURCE_IRQ 0x00000400 40#define IORESOURCE_IRQ 0x00000400
40#define IORESOURCE_DMA 0x00000800 41#define IORESOURCE_DMA 0x00000800
@@ -126,6 +127,10 @@ static inline resource_size_t resource_size(struct resource *res)
126{ 127{
127 return res->end - res->start + 1; 128 return res->end - res->start + 1;
128} 129}
130static inline unsigned long resource_type(struct resource *res)
131{
132 return res->flags & IORESOURCE_TYPE_BITS;
133}
129 134
130/* Convenience shorthand with allocation */ 135/* Convenience shorthand with allocation */
131#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) 136#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
@@ -169,6 +174,7 @@ extern struct resource * __devm_request_region(struct device *dev,
169 174
170extern void __devm_release_region(struct device *dev, struct resource *parent, 175extern void __devm_release_region(struct device *dev, struct resource *parent,
171 resource_size_t start, resource_size_t n); 176 resource_size_t start, resource_size_t n);
177extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size);
172 178
173#endif /* __ASSEMBLY__ */ 179#endif /* __ASSEMBLY__ */
174#endif /* _LINUX_IOPORT_H */ 180#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/iova.h b/include/linux/iova.h
new file mode 100644
index 000000000000..228f6c94b69c
--- /dev/null
+++ b/include/linux/iova.h
@@ -0,0 +1,52 @@
1/*
2 * Copyright (c) 2006, Intel Corporation.
3 *
4 * This file is released under the GPLv2.
5 *
6 * Copyright (C) 2006-2008 Intel Corporation
7 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
8 *
9 */
10
11#ifndef _IOVA_H_
12#define _IOVA_H_
13
14#include <linux/types.h>
15#include <linux/kernel.h>
16#include <linux/rbtree.h>
17#include <linux/dma-mapping.h>
18
19/* IO virtual address start page frame number */
20#define IOVA_START_PFN (1)
21
22/* iova structure */
23struct iova {
24 struct rb_node node;
25 unsigned long pfn_hi; /* IOMMU dish out addr hi */
26 unsigned long pfn_lo; /* IOMMU dish out addr lo */
27};
28
29/* holds all the iova translations for a 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 */
33 struct rb_root rbroot; /* iova domain rbtree root */
34 struct rb_node *cached32_node; /* Save last alloced node */
35 unsigned long dma_32bit_pfn;
36};
37
38struct iova *alloc_iova_mem(void);
39void free_iova_mem(struct iova *iova);
40void free_iova(struct iova_domain *iovad, unsigned long pfn);
41void __free_iova(struct iova_domain *iovad, struct iova *iova);
42struct iova *alloc_iova(struct iova_domain *iovad, unsigned long size,
43 unsigned long limit_pfn,
44 bool size_aligned);
45struct iova *reserve_iova(struct iova_domain *iovad, unsigned long pfn_lo,
46 unsigned long pfn_hi);
47void copy_reserved_iova(struct iova_domain *from, struct iova_domain *to);
48void init_iova_domain(struct iova_domain *iovad, unsigned long pfn_32bit);
49struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn);
50void put_iova_domain(struct iova_domain *iovad);
51
52#endif
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h
index 17ca64b5a66c..f2720280b9ec 100644
--- a/include/linux/ivtv.h
+++ b/include/linux/ivtv.h
@@ -23,6 +23,7 @@
23 23
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/videodev2.h>
26 27
27/* ivtv knows several distinct output modes: MPEG streaming, 28/* ivtv knows several distinct output modes: MPEG streaming,
28 YUV streaming, YUV updates through user DMA and the passthrough 29 YUV streaming, YUV updates through user DMA and the passthrough
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 07a9b52a2654..7ebbcb1c9ba4 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -61,7 +61,7 @@ extern u8 journal_enable_debug;
61 do { \ 61 do { \
62 if ((n) <= journal_enable_debug) { \ 62 if ((n) <= journal_enable_debug) { \
63 printk (KERN_DEBUG "(%s, %d): %s: ", \ 63 printk (KERN_DEBUG "(%s, %d): %s: ", \
64 __FILE__, __LINE__, __FUNCTION__); \ 64 __FILE__, __LINE__, __func__); \
65 printk (f, ## a); \ 65 printk (f, ## a); \
66 } \ 66 } \
67 } while (0) 67 } while (0)
@@ -984,7 +984,7 @@ extern int cleanup_journal_tail(journal_t *);
984 984
985#define jbd_ENOSYS() \ 985#define jbd_ENOSYS() \
986do { \ 986do { \
987 printk (KERN_ERR "JBD unimplemented function %s\n", __FUNCTION__); \ 987 printk (KERN_ERR "JBD unimplemented function %s\n", __func__); \
988 current->state = TASK_UNINTERRUPTIBLE; \ 988 current->state = TASK_UNINTERRUPTIBLE; \
989 schedule(); \ 989 schedule(); \
990} while (1) 990} while (1)
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index d2e91ea998fd..c7d106ef22e2 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -61,7 +61,7 @@ extern u8 jbd2_journal_enable_debug;
61 do { \ 61 do { \
62 if ((n) <= jbd2_journal_enable_debug) { \ 62 if ((n) <= jbd2_journal_enable_debug) { \
63 printk (KERN_DEBUG "(%s, %d): %s: ", \ 63 printk (KERN_DEBUG "(%s, %d): %s: ", \
64 __FILE__, __LINE__, __FUNCTION__); \ 64 __FILE__, __LINE__, __func__); \
65 printk (f, ## a); \ 65 printk (f, ## a); \
66 } \ 66 } \
67 } while (0) 67 } while (0)
@@ -641,6 +641,11 @@ struct transaction_s
641 */ 641 */
642 int t_handle_count; 642 int t_handle_count;
643 643
644 /*
645 * For use by the filesystem to store fs-specific data
646 * structures associated with the transaction
647 */
648 struct list_head t_private_list;
644}; 649};
645 650
646struct transaction_run_stats_s { 651struct transaction_run_stats_s {
@@ -935,6 +940,10 @@ struct journal_s
935 940
936 pid_t j_last_sync_writer; 941 pid_t j_last_sync_writer;
937 942
943 /* This function is called when a transaction is closed */
944 void (*j_commit_callback)(journal_t *,
945 transaction_t *);
946
938 /* 947 /*
939 * Journal statistics 948 * Journal statistics
940 */ 949 */
@@ -1143,7 +1152,7 @@ extern int jbd2_cleanup_journal_tail(journal_t *);
1143 1152
1144#define jbd_ENOSYS() \ 1153#define jbd_ENOSYS() \
1145do { \ 1154do { \
1146 printk (KERN_ERR "JBD unimplemented function %s\n", __FUNCTION__); \ 1155 printk (KERN_ERR "JBD unimplemented function %s\n", __func__); \
1147 current->state = TASK_UNINTERRUPTIBLE; \ 1156 current->state = TASK_UNINTERRUPTIBLE; \
1148 schedule(); \ 1157 schedule(); \
1149} while (1) 1158} while (1)
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index 8a62d1e84b9b..bb70ebb6a2d5 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * buffer_head fields for JBD 4 * buffer_head fields for JBD
5 * 5 *
6 * 27 May 2001 Andrew Morton <akpm@digeo.com> 6 * 27 May 2001 Andrew Morton
7 * Created - pulled out of fs.h 7 * Created - pulled out of fs.h
8 */ 8 */
9 9
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index b96144887444..f3fe34391d8e 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -93,12 +93,10 @@ static inline void print_symbol(const char *fmt, unsigned long addr)
93} 93}
94 94
95/* 95/*
96 * Pretty-print a function pointer. 96 * Pretty-print a function pointer. This function is deprecated.
97 * 97 * Please use the "%pF" vsprintf format instead.
98 * ia64 and ppc64 function pointers are really function descriptors,
99 * which contain a pointer the real address.
100 */ 98 */
101static inline void print_fn_descriptor_symbol(const char *fmt, void *addr) 99static inline void __deprecated print_fn_descriptor_symbol(const char *fmt, void *addr)
102{ 100{
103#if defined(CONFIG_IA64) || defined(CONFIG_PPC64) 101#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
104 addr = *(void **)addr; 102 addr = *(void **)addr;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index ecce4a4ccd5f..94d17ff64c5a 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -16,6 +16,7 @@
16#include <linux/log2.h> 16#include <linux/log2.h>
17#include <linux/typecheck.h> 17#include <linux/typecheck.h>
18#include <linux/ratelimit.h> 18#include <linux/ratelimit.h>
19#include <linux/dynamic_printk.h>
19#include <asm/byteorder.h> 20#include <asm/byteorder.h>
20#include <asm/bug.h> 21#include <asm/bug.h>
21 22
@@ -213,6 +214,9 @@ static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
213 { return false; } 214 { return false; }
214#endif 215#endif
215 216
217extern int printk_needs_cpu(int cpu);
218extern void printk_tick(void);
219
216extern void asmlinkage __attribute__((format(printf, 1, 2))) 220extern void asmlinkage __attribute__((format(printf, 1, 2)))
217 early_printk(const char *fmt, ...); 221 early_printk(const char *fmt, ...);
218 222
@@ -235,9 +239,10 @@ extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in
235extern int panic_timeout; 239extern int panic_timeout;
236extern int panic_on_oops; 240extern int panic_on_oops;
237extern int panic_on_unrecovered_nmi; 241extern int panic_on_unrecovered_nmi;
238extern int tainted;
239extern const char *print_tainted(void); 242extern const char *print_tainted(void);
240extern void add_taint(unsigned); 243extern void add_taint(unsigned flag);
244extern int test_taint(unsigned flag);
245extern unsigned long get_taint(void);
241extern int root_mountflags; 246extern int root_mountflags;
242 247
243/* Values used for system_state */ 248/* Values used for system_state */
@@ -250,16 +255,17 @@ extern enum system_states {
250 SYSTEM_SUSPEND_DISK, 255 SYSTEM_SUSPEND_DISK,
251} system_state; 256} system_state;
252 257
253#define TAINT_PROPRIETARY_MODULE (1<<0) 258#define TAINT_PROPRIETARY_MODULE 0
254#define TAINT_FORCED_MODULE (1<<1) 259#define TAINT_FORCED_MODULE 1
255#define TAINT_UNSAFE_SMP (1<<2) 260#define TAINT_UNSAFE_SMP 2
256#define TAINT_FORCED_RMMOD (1<<3) 261#define TAINT_FORCED_RMMOD 3
257#define TAINT_MACHINE_CHECK (1<<4) 262#define TAINT_MACHINE_CHECK 4
258#define TAINT_BAD_PAGE (1<<5) 263#define TAINT_BAD_PAGE 5
259#define TAINT_USER (1<<6) 264#define TAINT_USER 6
260#define TAINT_DIE (1<<7) 265#define TAINT_DIE 7
261#define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8) 266#define TAINT_OVERRIDDEN_ACPI_TABLE 8
262#define TAINT_WARN (1<<9) 267#define TAINT_WARN 9
268#define TAINT_CRAP 10
263 269
264extern void dump_stack(void) __cold; 270extern void dump_stack(void) __cold;
265 271
@@ -303,8 +309,12 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
303#define pr_info(fmt, arg...) \ 309#define pr_info(fmt, arg...) \
304 printk(KERN_INFO fmt, ##arg) 310 printk(KERN_INFO fmt, ##arg)
305 311
306#ifdef DEBUG
307/* If you are writing a driver, please use dev_dbg instead */ 312/* If you are writing a driver, please use dev_dbg instead */
313#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
314#define pr_debug(fmt, ...) do { \
315 dynamic_pr_debug(fmt, ##__VA_ARGS__); \
316 } while (0)
317#elif defined(DEBUG)
308#define pr_debug(fmt, arg...) \ 318#define pr_debug(fmt, arg...) \
309 printk(KERN_DEBUG fmt, ##arg) 319 printk(KERN_DEBUG fmt, ##arg)
310#else 320#else
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index a1a91577813c..92213a9194e1 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -99,4 +99,7 @@ struct file;
99extern int call_usermodehelper_pipe(char *path, char *argv[], char *envp[], 99extern int call_usermodehelper_pipe(char *path, char *argv[], char *envp[],
100 struct file **filp); 100 struct file **filp);
101 101
102extern int usermodehelper_disable(void);
103extern void usermodehelper_enable(void);
104
102#endif /* __LINUX_KMOD_H__ */ 105#endif /* __LINUX_KMOD_H__ */
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 70a30651cd12..797fcd781242 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -311,22 +311,33 @@ struct kvm_s390_interrupt {
311 311
312/* This structure represents a single trace buffer record. */ 312/* This structure represents a single trace buffer record. */
313struct kvm_trace_rec { 313struct kvm_trace_rec {
314 __u32 event:28; 314 /* variable rec_val
315 __u32 extra_u32:3; 315 * is split into:
316 __u32 cycle_in:1; 316 * bits 0 - 27 -> event id
317 * bits 28 -30 -> number of extra data args of size u32
318 * bits 31 -> binary indicator for if tsc is in record
319 */
320 __u32 rec_val;
317 __u32 pid; 321 __u32 pid;
318 __u32 vcpu_id; 322 __u32 vcpu_id;
319 union { 323 union {
320 struct { 324 struct {
321 __u64 cycle_u64; 325 __u64 timestamp;
322 __u32 extra_u32[KVM_TRC_EXTRA_MAX]; 326 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
323 } __attribute__((packed)) cycle; 327 } __attribute__((packed)) timestamp;
324 struct { 328 struct {
325 __u32 extra_u32[KVM_TRC_EXTRA_MAX]; 329 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
326 } nocycle; 330 } notimestamp;
327 } u; 331 } u;
328}; 332};
329 333
334#define TRACE_REC_EVENT_ID(val) \
335 (0x0fffffff & (val))
336#define TRACE_REC_NUM_DATA_ARGS(val) \
337 (0x70000000 & ((val) << 28))
338#define TRACE_REC_TCS(val) \
339 (0x80000000 & ((val) << 31))
340
330#define KVMIO 0xAE 341#define KVMIO 0xAE
331 342
332/* 343/*
@@ -372,6 +383,10 @@ struct kvm_trace_rec {
372#define KVM_CAP_MP_STATE 14 383#define KVM_CAP_MP_STATE 14
373#define KVM_CAP_COALESCED_MMIO 15 384#define KVM_CAP_COALESCED_MMIO 15
374#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ 385#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */
386#if defined(CONFIG_X86)||defined(CONFIG_IA64)
387#define KVM_CAP_DEVICE_ASSIGNMENT 17
388#endif
389#define KVM_CAP_IOMMU 18
375 390
376/* 391/*
377 * ioctls for VM fds 392 * ioctls for VM fds
@@ -401,6 +416,10 @@ struct kvm_trace_rec {
401 _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) 416 _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone)
402#define KVM_UNREGISTER_COALESCED_MMIO \ 417#define KVM_UNREGISTER_COALESCED_MMIO \
403 _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) 418 _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone)
419#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \
420 struct kvm_assigned_pci_dev)
421#define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \
422 struct kvm_assigned_irq)
404 423
405/* 424/*
406 * ioctls for vcpu fds 425 * ioctls for vcpu fds
@@ -440,4 +459,45 @@ struct kvm_trace_rec {
440#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) 459#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state)
441#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) 460#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state)
442 461
462#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
463#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
464#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04)
465#define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05)
466#define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06)
467#define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07)
468#define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08)
469#define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09)
470#define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A)
471#define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B)
472#define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C)
473#define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D)
474#define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E)
475#define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F)
476#define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10)
477#define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11)
478#define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12)
479#define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13)
480#define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14)
481#define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15)
482#define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16)
483#define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17)
484#define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18)
485#define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19)
486
487struct kvm_assigned_pci_dev {
488 __u32 assigned_dev_id;
489 __u32 busnr;
490 __u32 devfn;
491 __u32 flags;
492};
493
494struct kvm_assigned_irq {
495 __u32 assigned_dev_id;
496 __u32 host_irq;
497 __u32 guest_irq;
498 __u32 flags;
499};
500
501#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
502
443#endif 503#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 8525afc53107..3833c48fae3a 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -34,6 +34,8 @@
34#define KVM_REQ_MMU_RELOAD 3 34#define KVM_REQ_MMU_RELOAD 3
35#define KVM_REQ_TRIPLE_FAULT 4 35#define KVM_REQ_TRIPLE_FAULT 4
36#define KVM_REQ_PENDING_TIMER 5 36#define KVM_REQ_PENDING_TIMER 5
37#define KVM_REQ_UNHALT 6
38#define KVM_REQ_MMU_SYNC 7
37 39
38struct kvm_vcpu; 40struct kvm_vcpu;
39extern struct kmem_cache *kvm_vcpu_cache; 41extern struct kmem_cache *kvm_vcpu_cache;
@@ -279,12 +281,68 @@ void kvm_free_physmem(struct kvm *kvm);
279 281
280struct kvm *kvm_arch_create_vm(void); 282struct kvm *kvm_arch_create_vm(void);
281void kvm_arch_destroy_vm(struct kvm *kvm); 283void kvm_arch_destroy_vm(struct kvm *kvm);
284void kvm_free_all_assigned_devices(struct kvm *kvm);
282 285
283int kvm_cpu_get_interrupt(struct kvm_vcpu *v); 286int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
284int kvm_cpu_has_interrupt(struct kvm_vcpu *v); 287int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
285int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); 288int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu);
286void kvm_vcpu_kick(struct kvm_vcpu *vcpu); 289void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
287 290
291int kvm_is_mmio_pfn(pfn_t pfn);
292
293struct kvm_irq_ack_notifier {
294 struct hlist_node link;
295 unsigned gsi;
296 void (*irq_acked)(struct kvm_irq_ack_notifier *kian);
297};
298
299struct kvm_assigned_dev_kernel {
300 struct kvm_irq_ack_notifier ack_notifier;
301 struct work_struct interrupt_work;
302 struct list_head list;
303 int assigned_dev_id;
304 int host_busnr;
305 int host_devfn;
306 int host_irq;
307 int guest_irq;
308 int irq_requested;
309 struct pci_dev *dev;
310 struct kvm *kvm;
311};
312void kvm_set_irq(struct kvm *kvm, int irq, int level);
313void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi);
314void kvm_register_irq_ack_notifier(struct kvm *kvm,
315 struct kvm_irq_ack_notifier *kian);
316void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
317 struct kvm_irq_ack_notifier *kian);
318
319#ifdef CONFIG_DMAR
320int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn,
321 unsigned long npages);
322int kvm_iommu_map_guest(struct kvm *kvm,
323 struct kvm_assigned_dev_kernel *assigned_dev);
324int kvm_iommu_unmap_guest(struct kvm *kvm);
325#else /* CONFIG_DMAR */
326static inline int kvm_iommu_map_pages(struct kvm *kvm,
327 gfn_t base_gfn,
328 unsigned long npages)
329{
330 return 0;
331}
332
333static inline int kvm_iommu_map_guest(struct kvm *kvm,
334 struct kvm_assigned_dev_kernel
335 *assigned_dev)
336{
337 return -ENODEV;
338}
339
340static inline int kvm_iommu_unmap_guest(struct kvm *kvm)
341{
342 return 0;
343}
344#endif /* CONFIG_DMAR */
345
288static inline void kvm_guest_enter(void) 346static inline void kvm_guest_enter(void)
289{ 347{
290 account_system_vtime(current); 348 account_system_vtime(current);
@@ -307,6 +365,11 @@ static inline gpa_t gfn_to_gpa(gfn_t gfn)
307 return (gpa_t)gfn << PAGE_SHIFT; 365 return (gpa_t)gfn << PAGE_SHIFT;
308} 366}
309 367
368static inline hpa_t pfn_to_hpa(pfn_t pfn)
369{
370 return (hpa_t)pfn << PAGE_SHIFT;
371}
372
310static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu) 373static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu)
311{ 374{
312 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests); 375 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests);
@@ -326,6 +389,25 @@ struct kvm_stats_debugfs_item {
326extern struct kvm_stats_debugfs_item debugfs_entries[]; 389extern struct kvm_stats_debugfs_item debugfs_entries[];
327extern struct dentry *kvm_debugfs_dir; 390extern struct dentry *kvm_debugfs_dir;
328 391
392#define KVMTRACE_5D(evt, vcpu, d1, d2, d3, d4, d5, name) \
393 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
394 vcpu, 5, d1, d2, d3, d4, d5)
395#define KVMTRACE_4D(evt, vcpu, d1, d2, d3, d4, name) \
396 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
397 vcpu, 4, d1, d2, d3, d4, 0)
398#define KVMTRACE_3D(evt, vcpu, d1, d2, d3, name) \
399 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
400 vcpu, 3, d1, d2, d3, 0, 0)
401#define KVMTRACE_2D(evt, vcpu, d1, d2, name) \
402 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
403 vcpu, 2, d1, d2, 0, 0, 0)
404#define KVMTRACE_1D(evt, vcpu, d1, name) \
405 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
406 vcpu, 1, d1, 0, 0, 0, 0)
407#define KVMTRACE_0D(evt, vcpu, name) \
408 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
409 vcpu, 0, 0, 0, 0, 0, 0)
410
329#ifdef CONFIG_KVM_TRACE 411#ifdef CONFIG_KVM_TRACE
330int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg); 412int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg);
331void kvm_trace_cleanup(void); 413void kvm_trace_cleanup(void);
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 3d25bcd139d1..e5872dc994c0 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -27,7 +27,6 @@ struct nlmsvc_binding {
27 struct nfs_fh *, 27 struct nfs_fh *,
28 struct file **); 28 struct file **);
29 void (*fclose)(struct file *); 29 void (*fclose)(struct file *);
30 unsigned long (*get_grace_period)(void);
31}; 30};
32 31
33extern struct nlmsvc_binding * nlmsvc_ops; 32extern struct nlmsvc_binding * nlmsvc_ops;
@@ -53,15 +52,7 @@ extern void nlmclnt_done(struct nlm_host *host);
53 52
54extern int nlmclnt_proc(struct nlm_host *host, int cmd, 53extern int nlmclnt_proc(struct nlm_host *host, int cmd,
55 struct file_lock *fl); 54 struct file_lock *fl);
56extern int lockd_up(int proto); 55extern int lockd_up(void);
57extern void lockd_down(void); 56extern void lockd_down(void);
58 57
59unsigned long get_nfs_grace_period(void);
60
61#ifdef CONFIG_NFSD_V4
62unsigned long get_nfs4_grace_period(void);
63#else
64static inline unsigned long get_nfs4_grace_period(void) {return 0;}
65#endif
66
67#endif /* LINUX_LOCKD_BIND_H */ 58#endif /* LINUX_LOCKD_BIND_H */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index dbb87ab282e8..b56d5aa9b194 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -12,6 +12,8 @@
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13 13
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/in6.h>
16#include <net/ipv6.h>
15#include <linux/fs.h> 17#include <linux/fs.h>
16#include <linux/kref.h> 18#include <linux/kref.h>
17#include <linux/utsname.h> 19#include <linux/utsname.h>
@@ -38,8 +40,9 @@
38 */ 40 */
39struct nlm_host { 41struct nlm_host {
40 struct hlist_node h_hash; /* doubly linked list */ 42 struct hlist_node h_hash; /* doubly linked list */
41 struct sockaddr_in h_addr; /* peer address */ 43 struct sockaddr_storage h_addr; /* peer address */
42 struct sockaddr_in h_saddr; /* our address (optional) */ 44 size_t h_addrlen;
45 struct sockaddr_storage h_srcaddr; /* our address (optional) */
43 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ 46 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */
44 char * h_name; /* remote hostname */ 47 char * h_name; /* remote hostname */
45 u32 h_version; /* interface version */ 48 u32 h_version; /* interface version */
@@ -61,18 +64,56 @@ struct nlm_host {
61 struct list_head h_granted; /* Locks in GRANTED state */ 64 struct list_head h_granted; /* Locks in GRANTED state */
62 struct list_head h_reclaim; /* Locks in RECLAIM state */ 65 struct list_head h_reclaim; /* Locks in RECLAIM state */
63 struct nsm_handle * h_nsmhandle; /* NSM status handle */ 66 struct nsm_handle * h_nsmhandle; /* NSM status handle */
67
68 char h_addrbuf[48], /* address eyecatchers */
69 h_srcaddrbuf[48];
64}; 70};
65 71
66struct nsm_handle { 72struct nsm_handle {
67 struct list_head sm_link; 73 struct list_head sm_link;
68 atomic_t sm_count; 74 atomic_t sm_count;
69 char * sm_name; 75 char * sm_name;
70 struct sockaddr_in sm_addr; 76 struct sockaddr_storage sm_addr;
77 size_t sm_addrlen;
71 unsigned int sm_monitored : 1, 78 unsigned int sm_monitored : 1,
72 sm_sticky : 1; /* don't unmonitor */ 79 sm_sticky : 1; /* don't unmonitor */
80 char sm_addrbuf[48]; /* address eyecatcher */
73}; 81};
74 82
75/* 83/*
84 * Rigorous type checking on sockaddr type conversions
85 */
86static inline struct sockaddr_in *nlm_addr_in(const struct nlm_host *host)
87{
88 return (struct sockaddr_in *)&host->h_addr;
89}
90
91static inline struct sockaddr *nlm_addr(const struct nlm_host *host)
92{
93 return (struct sockaddr *)&host->h_addr;
94}
95
96static inline struct sockaddr_in *nlm_srcaddr_in(const struct nlm_host *host)
97{
98 return (struct sockaddr_in *)&host->h_srcaddr;
99}
100
101static inline struct sockaddr *nlm_srcaddr(const struct nlm_host *host)
102{
103 return (struct sockaddr *)&host->h_srcaddr;
104}
105
106static inline struct sockaddr_in *nsm_addr_in(const struct nsm_handle *handle)
107{
108 return (struct sockaddr_in *)&handle->sm_addr;
109}
110
111static inline struct sockaddr *nsm_addr(const struct nsm_handle *handle)
112{
113 return (struct sockaddr *)&handle->sm_addr;
114}
115
116/*
76 * Map an fl_owner_t into a unique 32-bit "pid" 117 * Map an fl_owner_t into a unique 32-bit "pid"
77 */ 118 */
78struct nlm_lockowner { 119struct nlm_lockowner {
@@ -166,7 +207,8 @@ int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *);
166struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); 207struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl);
167void nlmclnt_finish_block(struct nlm_wait *block); 208void nlmclnt_finish_block(struct nlm_wait *block);
168int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); 209int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout);
169__be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *); 210__be32 nlmclnt_grant(const struct sockaddr *addr,
211 const struct nlm_lock *lock);
170void nlmclnt_recovery(struct nlm_host *); 212void nlmclnt_recovery(struct nlm_host *);
171int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 213int nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
172void nlmclnt_next_cookie(struct nlm_cookie *); 214void nlmclnt_next_cookie(struct nlm_cookie *);
@@ -174,12 +216,14 @@ void nlmclnt_next_cookie(struct nlm_cookie *);
174/* 216/*
175 * Host cache 217 * Host cache
176 */ 218 */
177struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *sin, 219struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap,
178 int proto, u32 version, 220 const size_t salen,
221 const unsigned short protocol,
222 const u32 version,
223 const char *hostname);
224struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
179 const char *hostname, 225 const char *hostname,
180 unsigned int hostname_len); 226 const size_t hostname_len);
181struct nlm_host *nlmsvc_lookup_host(struct svc_rqst *, const char *,
182 unsigned int);
183struct rpc_clnt * nlm_bind_host(struct nlm_host *); 227struct rpc_clnt * nlm_bind_host(struct nlm_host *);
184void nlm_rebind_host(struct nlm_host *); 228void nlm_rebind_host(struct nlm_host *);
185struct nlm_host * nlm_get_host(struct nlm_host *); 229struct nlm_host * nlm_get_host(struct nlm_host *);
@@ -201,7 +245,7 @@ typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref);
201 */ 245 */
202__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 246__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
203 struct nlm_host *, struct nlm_lock *, int, 247 struct nlm_host *, struct nlm_lock *, int,
204 struct nlm_cookie *); 248 struct nlm_cookie *, int);
205__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 249__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
206__be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *, 250__be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *,
207 struct nlm_host *, struct nlm_lock *, 251 struct nlm_host *, struct nlm_lock *,
@@ -233,15 +277,82 @@ static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
233 return file->f_file->f_path.dentry->d_inode; 277 return file->f_file->f_path.dentry->d_inode;
234} 278}
235 279
280static inline int __nlm_privileged_request4(const struct sockaddr *sap)
281{
282 const struct sockaddr_in *sin = (struct sockaddr_in *)sap;
283 return (sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) &&
284 (ntohs(sin->sin_port) < 1024);
285}
286
287#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
288static inline int __nlm_privileged_request6(const struct sockaddr *sap)
289{
290 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
291 return (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK) &&
292 (ntohs(sin6->sin6_port) < 1024);
293}
294#else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
295static inline int __nlm_privileged_request6(const struct sockaddr *sap)
296{
297 return 0;
298}
299#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
300
236/* 301/*
237 * Compare two host addresses (needs modifying for ipv6) 302 * Ensure incoming requests are from local privileged callers.
303 *
304 * Return TRUE if sender is local and is connecting via a privileged port;
305 * otherwise return FALSE.
238 */ 306 */
239static inline int nlm_cmp_addr(const struct sockaddr_in *sin1, 307static inline int nlm_privileged_requester(const struct svc_rqst *rqstp)
240 const struct sockaddr_in *sin2)
241{ 308{
309 const struct sockaddr *sap = svc_addr(rqstp);
310
311 switch (sap->sa_family) {
312 case AF_INET:
313 return __nlm_privileged_request4(sap);
314 case AF_INET6:
315 return __nlm_privileged_request6(sap);
316 default:
317 return 0;
318 }
319}
320
321static inline int __nlm_cmp_addr4(const struct sockaddr *sap1,
322 const struct sockaddr *sap2)
323{
324 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
325 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
242 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; 326 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
243} 327}
244 328
329static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
330 const struct sockaddr *sap2)
331{
332 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
333 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
334 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
335}
336
337/*
338 * Compare two host addresses
339 *
340 * Return TRUE if the addresses are the same; otherwise FALSE.
341 */
342static inline int nlm_cmp_addr(const struct sockaddr *sap1,
343 const struct sockaddr *sap2)
344{
345 if (sap1->sa_family == sap2->sa_family) {
346 switch (sap1->sa_family) {
347 case AF_INET:
348 return __nlm_cmp_addr4(sap1, sap2);
349 case AF_INET6:
350 return __nlm_cmp_addr6(sap1, sap2);
351 }
352 }
353 return 0;
354}
355
245/* 356/*
246 * Compare two NLM locks. 357 * Compare two NLM locks.
247 * When the second lock is of type F_UNLCK, this acts like a wildcard. 358 * When the second lock is of type F_UNLCK, this acts like a wildcard.
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index df18fa053bcd..d6b3a802c046 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -81,8 +81,6 @@ struct nlm_reboot {
81 unsigned int len; 81 unsigned int len;
82 u32 state; 82 u32 state;
83 __be32 addr; 83 __be32 addr;
84 __be32 vers;
85 __be32 proto;
86}; 84};
87 85
88/* 86/*
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 1fa0c2ce4dec..f7f3fdddbef0 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -6,6 +6,10 @@
6#define AFS_SUPER_MAGIC 0x5346414F 6#define AFS_SUPER_MAGIC 0x5346414F
7#define AUTOFS_SUPER_MAGIC 0x0187 7#define AUTOFS_SUPER_MAGIC 0x0187
8#define CODA_SUPER_MAGIC 0x73757245 8#define CODA_SUPER_MAGIC 0x73757245
9#define DEBUGFS_MAGIC 0x64626720
10#define SYSFS_MAGIC 0x62656572
11#define SECURITYFS_MAGIC 0x73636673
12#define TMPFS_MAGIC 0x01021994
9#define EFS_SUPER_MAGIC 0x414A53 13#define EFS_SUPER_MAGIC 0x414A53
10#define EXT2_SUPER_MAGIC 0xEF53 14#define EXT2_SUPER_MAGIC 0xEF53
11#define EXT3_SUPER_MAGIC 0xEF53 15#define EXT3_SUPER_MAGIC 0xEF53
diff --git a/include/linux/map_to_7segment.h b/include/linux/map_to_7segment.h
new file mode 100644
index 000000000000..7df8432c4402
--- /dev/null
+++ b/include/linux/map_to_7segment.h
@@ -0,0 +1,187 @@
1/*
2 * Copyright (c) 2005 Henk Vergonet <Henk.Vergonet@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef MAP_TO_7SEGMENT_H
20#define MAP_TO_7SEGMENT_H
21
22/* This file provides translation primitives and tables for the conversion
23 * of (ASCII) characters to a 7-segments notation.
24 *
25 * The 7 segment's wikipedia notation below is used as standard.
26 * See: http://en.wikipedia.org/wiki/Seven_segment_display
27 *
28 * Notation: +-a-+
29 * f b
30 * +-g-+
31 * e c
32 * +-d-+
33 *
34 * Usage:
35 *
36 * Register a map variable, and fill it with a character set:
37 * static SEG7_DEFAULT_MAP(map_seg7);
38 *
39 *
40 * Then use for conversion:
41 * seg7 = map_to_seg7(&map_seg7, some_char);
42 * ...
43 *
44 * In device drivers it is recommended, if required, to make the char map
45 * accessible via the sysfs interface using the following scheme:
46 *
47 * static ssize_t show_map(struct device *dev, char *buf) {
48 * memcpy(buf, &map_seg7, sizeof(map_seg7));
49 * return sizeof(map_seg7);
50 * }
51 * static ssize_t store_map(struct device *dev, const char *buf, size_t cnt) {
52 * if(cnt != sizeof(map_seg7))
53 * return -EINVAL;
54 * memcpy(&map_seg7, buf, cnt);
55 * return cnt;
56 * }
57 * static DEVICE_ATTR(map_seg7, PERMS_RW, show_map, store_map);
58 *
59 * History:
60 * 2005-05-31 RFC linux-kernel@vger.kernel.org
61 */
62#include <linux/errno.h>
63
64
65#define BIT_SEG7_A 0
66#define BIT_SEG7_B 1
67#define BIT_SEG7_C 2
68#define BIT_SEG7_D 3
69#define BIT_SEG7_E 4
70#define BIT_SEG7_F 5
71#define BIT_SEG7_G 6
72#define BIT_SEG7_RESERVED 7
73
74struct seg7_conversion_map {
75 unsigned char table[128];
76};
77
78static inline int map_to_seg7(struct seg7_conversion_map *map, int c)
79{
80 return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL;
81}
82
83#define SEG7_CONVERSION_MAP(_name, _map) \
84 struct seg7_conversion_map _name = { .table = { _map } }
85
86/*
87 * It is recommended to use a facility that allows user space to redefine
88 * custom character sets for LCD devices. Please use a sysfs interface
89 * as described above.
90 */
91#define MAP_TO_SEG7_SYSFS_FILE "map_seg7"
92
93/*******************************************************************************
94 * ASCII conversion table
95 ******************************************************************************/
96
97#define _SEG7(l,a,b,c,d,e,f,g) \
98 ( a<<BIT_SEG7_A | b<<BIT_SEG7_B | c<<BIT_SEG7_C | d<<BIT_SEG7_D | \
99 e<<BIT_SEG7_E | f<<BIT_SEG7_F | g<<BIT_SEG7_G )
100
101#define _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \
102 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
103
104#define _MAP_33_47_ASCII_SEG7_SYMBOL \
105 _SEG7('!',0,0,0,0,1,1,0), _SEG7('"',0,1,0,0,0,1,0), _SEG7('#',0,1,1,0,1,1,0),\
106 _SEG7('$',1,0,1,1,0,1,1), _SEG7('%',0,0,1,0,0,1,0), _SEG7('&',1,0,1,1,1,1,1),\
107 _SEG7('\'',0,0,0,0,0,1,0),_SEG7('(',1,0,0,1,1,1,0), _SEG7(')',1,1,1,1,0,0,0),\
108 _SEG7('*',0,1,1,0,1,1,1), _SEG7('+',0,1,1,0,0,0,1), _SEG7(',',0,0,0,0,1,0,0),\
109 _SEG7('-',0,0,0,0,0,0,1), _SEG7('.',0,0,0,0,1,0,0), _SEG7('/',0,1,0,0,1,0,1),
110
111#define _MAP_48_57_ASCII_SEG7_NUMERIC \
112 _SEG7('0',1,1,1,1,1,1,0), _SEG7('1',0,1,1,0,0,0,0), _SEG7('2',1,1,0,1,1,0,1),\
113 _SEG7('3',1,1,1,1,0,0,1), _SEG7('4',0,1,1,0,0,1,1), _SEG7('5',1,0,1,1,0,1,1),\
114 _SEG7('6',1,0,1,1,1,1,1), _SEG7('7',1,1,1,0,0,0,0), _SEG7('8',1,1,1,1,1,1,1),\
115 _SEG7('9',1,1,1,1,0,1,1),
116
117#define _MAP_58_64_ASCII_SEG7_SYMBOL \
118 _SEG7(':',0,0,0,1,0,0,1), _SEG7(';',0,0,0,1,0,0,1), _SEG7('<',1,0,0,0,0,1,1),\
119 _SEG7('=',0,0,0,1,0,0,1), _SEG7('>',1,1,0,0,0,0,1), _SEG7('?',1,1,1,0,0,1,0),\
120 _SEG7('@',1,1,0,1,1,1,1),
121
122#define _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \
123 _SEG7('A',1,1,1,0,1,1,1), _SEG7('B',1,1,1,1,1,1,1), _SEG7('C',1,0,0,1,1,1,0),\
124 _SEG7('D',1,1,1,1,1,1,0), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\
125 _SEG7('G',1,1,1,1,0,1,1), _SEG7('H',0,1,1,0,1,1,1), _SEG7('I',0,1,1,0,0,0,0),\
126 _SEG7('J',0,1,1,1,0,0,0), _SEG7('K',0,1,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\
127 _SEG7('M',1,1,1,0,1,1,0), _SEG7('N',1,1,1,0,1,1,0), _SEG7('O',1,1,1,1,1,1,0),\
128 _SEG7('P',1,1,0,0,1,1,1), _SEG7('Q',1,1,1,1,1,1,0), _SEG7('R',1,1,1,0,1,1,1),\
129 _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('U',0,1,1,1,1,1,0),\
130 _SEG7('V',0,1,1,1,1,1,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\
131 _SEG7('Y',0,1,1,0,0,1,1), _SEG7('Z',1,1,0,1,1,0,1),
132
133#define _MAP_91_96_ASCII_SEG7_SYMBOL \
134 _SEG7('[',1,0,0,1,1,1,0), _SEG7('\\',0,0,1,0,0,1,1),_SEG7(']',1,1,1,1,0,0,0),\
135 _SEG7('^',1,1,0,0,0,1,0), _SEG7('_',0,0,0,1,0,0,0), _SEG7('`',0,1,0,0,0,0,0),
136
137#define _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
138 _SEG7('A',1,1,1,0,1,1,1), _SEG7('b',0,0,1,1,1,1,1), _SEG7('c',0,0,0,1,1,0,1),\
139 _SEG7('d',0,1,1,1,1,0,1), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\
140 _SEG7('G',1,1,1,1,0,1,1), _SEG7('h',0,0,1,0,1,1,1), _SEG7('i',0,0,1,0,0,0,0),\
141 _SEG7('j',0,0,1,1,0,0,0), _SEG7('k',0,0,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\
142 _SEG7('M',1,1,1,0,1,1,0), _SEG7('n',0,0,1,0,1,0,1), _SEG7('o',0,0,1,1,1,0,1),\
143 _SEG7('P',1,1,0,0,1,1,1), _SEG7('q',1,1,1,0,0,1,1), _SEG7('r',0,0,0,0,1,0,1),\
144 _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('u',0,0,1,1,1,0,0),\
145 _SEG7('v',0,0,1,1,1,0,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\
146 _SEG7('y',0,1,1,1,0,1,1), _SEG7('Z',1,1,0,1,1,0,1),
147
148#define _MAP_123_126_ASCII_SEG7_SYMBOL \
149 _SEG7('{',1,0,0,1,1,1,0), _SEG7('|',0,0,0,0,1,1,0), _SEG7('}',1,1,1,1,0,0,0),\
150 _SEG7('~',1,0,0,0,0,0,0),
151
152/* Maps */
153
154/* This set tries to map as close as possible to the visible characteristics
155 * of the ASCII symbol, lowercase and uppercase letters may differ in
156 * presentation on the display.
157 */
158#define MAP_ASCII7SEG_ALPHANUM \
159 _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \
160 _MAP_33_47_ASCII_SEG7_SYMBOL \
161 _MAP_48_57_ASCII_SEG7_NUMERIC \
162 _MAP_58_64_ASCII_SEG7_SYMBOL \
163 _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \
164 _MAP_91_96_ASCII_SEG7_SYMBOL \
165 _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
166 _MAP_123_126_ASCII_SEG7_SYMBOL
167
168/* This set tries to map as close as possible to the symbolic characteristics
169 * of the ASCII character for maximum discrimination.
170 * For now this means all alpha chars are in lower case representations.
171 * (This for example facilitates the use of hex numbers with uppercase input.)
172 */
173#define MAP_ASCII7SEG_ALPHANUM_LC \
174 _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \
175 _MAP_33_47_ASCII_SEG7_SYMBOL \
176 _MAP_48_57_ASCII_SEG7_NUMERIC \
177 _MAP_58_64_ASCII_SEG7_SYMBOL \
178 _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
179 _MAP_91_96_ASCII_SEG7_SYMBOL \
180 _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
181 _MAP_123_126_ASCII_SEG7_SYMBOL
182
183#define SEG7_DEFAULT_MAP(_name) \
184 SEG7_CONVERSION_MAP(_name,MAP_ASCII7SEG_ALPHANUM)
185
186#endif /* MAP_TO_7SEGMENT_H */
187
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index ec612e66391c..516d955ab8a1 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -1,6 +1,8 @@
1#ifndef MFD_TMIO_H 1#ifndef MFD_TMIO_H
2#define MFD_TMIO_H 2#define MFD_TMIO_H
3 3
4#include <linux/fb.h>
5
4#define tmio_ioread8(addr) readb(addr) 6#define tmio_ioread8(addr) readb(addr)
5#define tmio_ioread16(addr) readw(addr) 7#define tmio_ioread16(addr) readw(addr)
6#define tmio_ioread16_rep(r, b, l) readsw(r, b, l) 8#define tmio_ioread16_rep(r, b, l) readsw(r, b, l)
@@ -25,4 +27,21 @@ struct tmio_nand_data {
25 unsigned int num_partitions; 27 unsigned int num_partitions;
26}; 28};
27 29
30#define FBIO_TMIO_ACC_WRITE 0x7C639300
31#define FBIO_TMIO_ACC_SYNC 0x7C639301
32
33struct tmio_fb_data {
34 int (*lcd_set_power)(struct platform_device *fb_dev,
35 bool on);
36 int (*lcd_mode)(struct platform_device *fb_dev,
37 const struct fb_videomode *mode);
38 int num_modes;
39 struct fb_videomode *modes;
40
41 /* in mm: size of screen */
42 int height;
43 int width;
44};
45
46
28#endif 47#endif
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h
new file mode 100644
index 000000000000..217bb22ebb8e
--- /dev/null
+++ b/include/linux/mfd/wm8350/audio.h
@@ -0,0 +1,598 @@
1/*
2 * audio.h -- Audio Driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __LINUX_MFD_WM8350_AUDIO_H_
14#define __LINUX_MFD_WM8350_AUDIO_H_
15
16#include <linux/platform_device.h>
17
18#define WM8350_CLOCK_CONTROL_1 0x28
19#define WM8350_CLOCK_CONTROL_2 0x29
20#define WM8350_FLL_CONTROL_1 0x2A
21#define WM8350_FLL_CONTROL_2 0x2B
22#define WM8350_FLL_CONTROL_3 0x2C
23#define WM8350_FLL_CONTROL_4 0x2D
24#define WM8350_DAC_CONTROL 0x30
25#define WM8350_DAC_DIGITAL_VOLUME_L 0x32
26#define WM8350_DAC_DIGITAL_VOLUME_R 0x33
27#define WM8350_DAC_LR_RATE 0x35
28#define WM8350_DAC_CLOCK_CONTROL 0x36
29#define WM8350_DAC_MUTE 0x3A
30#define WM8350_DAC_MUTE_VOLUME 0x3B
31#define WM8350_DAC_SIDE 0x3C
32#define WM8350_ADC_CONTROL 0x40
33#define WM8350_ADC_DIGITAL_VOLUME_L 0x42
34#define WM8350_ADC_DIGITAL_VOLUME_R 0x43
35#define WM8350_ADC_DIVIDER 0x44
36#define WM8350_ADC_LR_RATE 0x46
37#define WM8350_INPUT_CONTROL 0x48
38#define WM8350_IN3_INPUT_CONTROL 0x49
39#define WM8350_MIC_BIAS_CONTROL 0x4A
40#define WM8350_OUTPUT_CONTROL 0x4C
41#define WM8350_JACK_DETECT 0x4D
42#define WM8350_ANTI_POP_CONTROL 0x4E
43#define WM8350_LEFT_INPUT_VOLUME 0x50
44#define WM8350_RIGHT_INPUT_VOLUME 0x51
45#define WM8350_LEFT_MIXER_CONTROL 0x58
46#define WM8350_RIGHT_MIXER_CONTROL 0x59
47#define WM8350_OUT3_MIXER_CONTROL 0x5C
48#define WM8350_OUT4_MIXER_CONTROL 0x5D
49#define WM8350_OUTPUT_LEFT_MIXER_VOLUME 0x60
50#define WM8350_OUTPUT_RIGHT_MIXER_VOLUME 0x61
51#define WM8350_INPUT_MIXER_VOLUME_L 0x62
52#define WM8350_INPUT_MIXER_VOLUME_R 0x63
53#define WM8350_INPUT_MIXER_VOLUME 0x64
54#define WM8350_LOUT1_VOLUME 0x68
55#define WM8350_ROUT1_VOLUME 0x69
56#define WM8350_LOUT2_VOLUME 0x6A
57#define WM8350_ROUT2_VOLUME 0x6B
58#define WM8350_BEEP_VOLUME 0x6F
59#define WM8350_AI_FORMATING 0x70
60#define WM8350_ADC_DAC_COMP 0x71
61#define WM8350_AI_ADC_CONTROL 0x72
62#define WM8350_AI_DAC_CONTROL 0x73
63#define WM8350_AIF_TEST 0x74
64#define WM8350_JACK_PIN_STATUS 0xE7
65
66/* Bit values for R08 (0x08) */
67#define WM8350_CODEC_ISEL_1_5 0 /* x1.5 */
68#define WM8350_CODEC_ISEL_1_0 1 /* x1.0 */
69#define WM8350_CODEC_ISEL_0_75 2 /* x0.75 */
70#define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */
71
72#define WM8350_VMID_OFF 0
73#define WM8350_VMID_500K 1
74#define WM8350_VMID_100K 2
75#define WM8350_VMID_10K 3
76
77/*
78 * R40 (0x28) - Clock Control 1
79 */
80#define WM8350_TOCLK_RATE 0x4000
81#define WM8350_MCLK_SEL 0x0800
82#define WM8350_MCLK_DIV_MASK 0x0100
83#define WM8350_BCLK_DIV_MASK 0x00F0
84#define WM8350_OPCLK_DIV_MASK 0x0007
85
86/*
87 * R41 (0x29) - Clock Control 2
88 */
89#define WM8350_LRC_ADC_SEL 0x8000
90#define WM8350_MCLK_DIR 0x0001
91
92/*
93 * R42 (0x2A) - FLL Control 1
94 */
95#define WM8350_FLL_DITHER_WIDTH_MASK 0x3000
96#define WM8350_FLL_DITHER_HP 0x0800
97#define WM8350_FLL_OUTDIV_MASK 0x0700
98#define WM8350_FLL_RSP_RATE_MASK 0x00F0
99#define WM8350_FLL_RATE_MASK 0x0007
100
101/*
102 * R43 (0x2B) - FLL Control 2
103 */
104#define WM8350_FLL_RATIO_MASK 0xF800
105#define WM8350_FLL_N_MASK 0x03FF
106
107/*
108 * R44 (0x2C) - FLL Control 3
109 */
110#define WM8350_FLL_K_MASK 0xFFFF
111
112/*
113 * R45 (0x2D) - FLL Control 4
114 */
115#define WM8350_FLL_FRAC 0x0020
116#define WM8350_FLL_SLOW_LOCK_REF 0x0010
117#define WM8350_FLL_CLK_SRC_MASK 0x0003
118
119/*
120 * R48 (0x30) - DAC Control
121 */
122#define WM8350_DAC_MONO 0x2000
123#define WM8350_AIF_LRCLKRATE 0x1000
124#define WM8350_DEEMP_MASK 0x0030
125#define WM8350_DACL_DATINV 0x0002
126#define WM8350_DACR_DATINV 0x0001
127
128/*
129 * R50 (0x32) - DAC Digital Volume L
130 */
131#define WM8350_DAC_VU 0x0100
132#define WM8350_DACL_VOL_MASK 0x00FF
133
134/*
135 * R51 (0x33) - DAC Digital Volume R
136 */
137#define WM8350_DAC_VU 0x0100
138#define WM8350_DACR_VOL_MASK 0x00FF
139
140/*
141 * R53 (0x35) - DAC LR Rate
142 */
143#define WM8350_DACLRC_ENA 0x0800
144#define WM8350_DACLRC_RATE_MASK 0x07FF
145
146/*
147 * R54 (0x36) - DAC Clock Control
148 */
149#define WM8350_DACCLK_POL 0x0010
150#define WM8350_DAC_CLKDIV_MASK 0x0007
151
152/*
153 * R58 (0x3A) - DAC Mute
154 */
155#define WM8350_DAC_MUTE_ENA 0x4000
156
157/*
158 * R59 (0x3B) - DAC Mute Volume
159 */
160#define WM8350_DAC_MUTEMODE 0x4000
161#define WM8350_DAC_MUTERATE 0x2000
162#define WM8350_DAC_SB_FILT 0x1000
163
164/*
165 * R60 (0x3C) - DAC Side
166 */
167#define WM8350_ADC_TO_DACL_MASK 0x3000
168#define WM8350_ADC_TO_DACR_MASK 0x0C00
169
170/*
171 * R64 (0x40) - ADC Control
172 */
173#define WM8350_ADC_HPF_CUT_MASK 0x0300
174#define WM8350_ADCL_DATINV 0x0002
175#define WM8350_ADCR_DATINV 0x0001
176
177/*
178 * R66 (0x42) - ADC Digital Volume L
179 */
180#define WM8350_ADC_VU 0x0100
181#define WM8350_ADCL_VOL_MASK 0x00FF
182
183/*
184 * R67 (0x43) - ADC Digital Volume R
185 */
186#define WM8350_ADC_VU 0x0100
187#define WM8350_ADCR_VOL_MASK 0x00FF
188
189/*
190 * R68 (0x44) - ADC Divider
191 */
192#define WM8350_ADCL_DAC_SVOL_MASK 0x0F00
193#define WM8350_ADCR_DAC_SVOL_MASK 0x00F0
194#define WM8350_ADCCLK_POL 0x0008
195#define WM8350_ADC_CLKDIV_MASK 0x0007
196
197/*
198 * R70 (0x46) - ADC LR Rate
199 */
200#define WM8350_ADCLRC_ENA 0x0800
201#define WM8350_ADCLRC_RATE_MASK 0x07FF
202
203/*
204 * R72 (0x48) - Input Control
205 */
206#define WM8350_IN2R_ENA 0x0400
207#define WM8350_IN1RN_ENA 0x0200
208#define WM8350_IN1RP_ENA 0x0100
209#define WM8350_IN2L_ENA 0x0004
210#define WM8350_IN1LN_ENA 0x0002
211#define WM8350_IN1LP_ENA 0x0001
212
213/*
214 * R73 (0x49) - IN3 Input Control
215 */
216#define WM8350_IN3R_SHORT 0x4000
217#define WM8350_IN3L_SHORT 0x0040
218
219/*
220 * R74 (0x4A) - Mic Bias Control
221 */
222#define WM8350_MICBSEL 0x4000
223#define WM8350_MCDTHR_MASK 0x001C
224#define WM8350_MCDSCTHR_MASK 0x0003
225
226/*
227 * R76 (0x4C) - Output Control
228 */
229#define WM8350_OUT4_VROI 0x0800
230#define WM8350_OUT3_VROI 0x0400
231#define WM8350_OUT2_VROI 0x0200
232#define WM8350_OUT1_VROI 0x0100
233#define WM8350_OUT2_FB 0x0004
234#define WM8350_OUT1_FB 0x0001
235
236/*
237 * R77 (0x4D) - Jack Detect
238 */
239#define WM8350_JDL_ENA 0x8000
240#define WM8350_JDR_ENA 0x4000
241
242/*
243 * R78 (0x4E) - Anti Pop Control
244 */
245#define WM8350_ANTI_POP_MASK 0x0300
246#define WM8350_DIS_OP_LN4_MASK 0x00C0
247#define WM8350_DIS_OP_LN3_MASK 0x0030
248#define WM8350_DIS_OP_OUT2_MASK 0x000C
249#define WM8350_DIS_OP_OUT1_MASK 0x0003
250
251/*
252 * R80 (0x50) - Left Input Volume
253 */
254#define WM8350_INL_MUTE 0x4000
255#define WM8350_INL_ZC 0x2000
256#define WM8350_IN_VU 0x0100
257#define WM8350_INL_VOL_MASK 0x00FC
258
259/*
260 * R81 (0x51) - Right Input Volume
261 */
262#define WM8350_INR_MUTE 0x4000
263#define WM8350_INR_ZC 0x2000
264#define WM8350_IN_VU 0x0100
265#define WM8350_INR_VOL_MASK 0x00FC
266
267/*
268 * R88 (0x58) - Left Mixer Control
269 */
270#define WM8350_DACR_TO_MIXOUTL 0x1000
271#define WM8350_DACL_TO_MIXOUTL 0x0800
272#define WM8350_IN3L_TO_MIXOUTL 0x0004
273#define WM8350_INR_TO_MIXOUTL 0x0002
274#define WM8350_INL_TO_MIXOUTL 0x0001
275
276/*
277 * R89 (0x59) - Right Mixer Control
278 */
279#define WM8350_DACR_TO_MIXOUTR 0x1000
280#define WM8350_DACL_TO_MIXOUTR 0x0800
281#define WM8350_IN3R_TO_MIXOUTR 0x0008
282#define WM8350_INR_TO_MIXOUTR 0x0002
283#define WM8350_INL_TO_MIXOUTR 0x0001
284
285/*
286 * R92 (0x5C) - OUT3 Mixer Control
287 */
288#define WM8350_DACL_TO_OUT3 0x0800
289#define WM8350_MIXINL_TO_OUT3 0x0100
290#define WM8350_OUT4_TO_OUT3 0x0008
291#define WM8350_MIXOUTL_TO_OUT3 0x0001
292
293/*
294 * R93 (0x5D) - OUT4 Mixer Control
295 */
296#define WM8350_DACR_TO_OUT4 0x1000
297#define WM8350_DACL_TO_OUT4 0x0800
298#define WM8350_OUT4_ATTN 0x0400
299#define WM8350_MIXINR_TO_OUT4 0x0200
300#define WM8350_OUT3_TO_OUT4 0x0004
301#define WM8350_MIXOUTR_TO_OUT4 0x0002
302#define WM8350_MIXOUTL_TO_OUT4 0x0001
303
304/*
305 * R96 (0x60) - Output Left Mixer Volume
306 */
307#define WM8350_IN3L_MIXOUTL_VOL_MASK 0x0E00
308#define WM8350_IN3L_MIXOUTL_VOL_SHIFT 9
309#define WM8350_INR_MIXOUTL_VOL_MASK 0x00E0
310#define WM8350_INR_MIXOUTL_VOL_SHIFT 5
311#define WM8350_INL_MIXOUTL_VOL_MASK 0x000E
312#define WM8350_INL_MIXOUTL_VOL_SHIFT 1
313
314/* Bit values for R96 (0x60) */
315#define WM8350_IN3L_MIXOUTL_VOL_OFF 0
316#define WM8350_IN3L_MIXOUTL_VOL_M12DB 1
317#define WM8350_IN3L_MIXOUTL_VOL_M9DB 2
318#define WM8350_IN3L_MIXOUTL_VOL_M6DB 3
319#define WM8350_IN3L_MIXOUTL_VOL_M3DB 4
320#define WM8350_IN3L_MIXOUTL_VOL_0DB 5
321#define WM8350_IN3L_MIXOUTL_VOL_3DB 6
322#define WM8350_IN3L_MIXOUTL_VOL_6DB 7
323
324#define WM8350_INR_MIXOUTL_VOL_OFF 0
325#define WM8350_INR_MIXOUTL_VOL_M12DB 1
326#define WM8350_INR_MIXOUTL_VOL_M9DB 2
327#define WM8350_INR_MIXOUTL_VOL_M6DB 3
328#define WM8350_INR_MIXOUTL_VOL_M3DB 4
329#define WM8350_INR_MIXOUTL_VOL_0DB 5
330#define WM8350_INR_MIXOUTL_VOL_3DB 6
331#define WM8350_INR_MIXOUTL_VOL_6DB 7
332
333#define WM8350_INL_MIXOUTL_VOL_OFF 0
334#define WM8350_INL_MIXOUTL_VOL_M12DB 1
335#define WM8350_INL_MIXOUTL_VOL_M9DB 2
336#define WM8350_INL_MIXOUTL_VOL_M6DB 3
337#define WM8350_INL_MIXOUTL_VOL_M3DB 4
338#define WM8350_INL_MIXOUTL_VOL_0DB 5
339#define WM8350_INL_MIXOUTL_VOL_3DB 6
340#define WM8350_INL_MIXOUTL_VOL_6DB 7
341
342/*
343 * R97 (0x61) - Output Right Mixer Volume
344 */
345#define WM8350_IN3R_MIXOUTR_VOL_MASK 0xE000
346#define WM8350_IN3R_MIXOUTR_VOL_SHIFT 13
347#define WM8350_INR_MIXOUTR_VOL_MASK 0x00E0
348#define WM8350_INR_MIXOUTR_VOL_SHIFT 5
349#define WM8350_INL_MIXOUTR_VOL_MASK 0x000E
350#define WM8350_INL_MIXOUTR_VOL_SHIFT 1
351
352/* Bit values for R96 (0x60) */
353#define WM8350_IN3R_MIXOUTR_VOL_OFF 0
354#define WM8350_IN3R_MIXOUTR_VOL_M12DB 1
355#define WM8350_IN3R_MIXOUTR_VOL_M9DB 2
356#define WM8350_IN3R_MIXOUTR_VOL_M6DB 3
357#define WM8350_IN3R_MIXOUTR_VOL_M3DB 4
358#define WM8350_IN3R_MIXOUTR_VOL_0DB 5
359#define WM8350_IN3R_MIXOUTR_VOL_3DB 6
360#define WM8350_IN3R_MIXOUTR_VOL_6DB 7
361
362#define WM8350_INR_MIXOUTR_VOL_OFF 0
363#define WM8350_INR_MIXOUTR_VOL_M12DB 1
364#define WM8350_INR_MIXOUTR_VOL_M9DB 2
365#define WM8350_INR_MIXOUTR_VOL_M6DB 3
366#define WM8350_INR_MIXOUTR_VOL_M3DB 4
367#define WM8350_INR_MIXOUTR_VOL_0DB 5
368#define WM8350_INR_MIXOUTR_VOL_3DB 6
369#define WM8350_INR_MIXOUTR_VOL_6DB 7
370
371#define WM8350_INL_MIXOUTR_VOL_OFF 0
372#define WM8350_INL_MIXOUTR_VOL_M12DB 1
373#define WM8350_INL_MIXOUTR_VOL_M9DB 2
374#define WM8350_INL_MIXOUTR_VOL_M6DB 3
375#define WM8350_INL_MIXOUTR_VOL_M3DB 4
376#define WM8350_INL_MIXOUTR_VOL_0DB 5
377#define WM8350_INL_MIXOUTR_VOL_3DB 6
378#define WM8350_INL_MIXOUTR_VOL_6DB 7
379
380/*
381 * R98 (0x62) - Input Mixer Volume L
382 */
383#define WM8350_IN3L_MIXINL_VOL_MASK 0x0E00
384#define WM8350_IN2L_MIXINL_VOL_MASK 0x000E
385#define WM8350_INL_MIXINL_VOL 0x0001
386
387/*
388 * R99 (0x63) - Input Mixer Volume R
389 */
390#define WM8350_IN3R_MIXINR_VOL_MASK 0xE000
391#define WM8350_IN2R_MIXINR_VOL_MASK 0x00E0
392#define WM8350_INR_MIXINR_VOL 0x0001
393
394/*
395 * R100 (0x64) - Input Mixer Volume
396 */
397#define WM8350_OUT4_MIXIN_DST 0x8000
398#define WM8350_OUT4_MIXIN_VOL_MASK 0x000E
399
400/*
401 * R104 (0x68) - LOUT1 Volume
402 */
403#define WM8350_OUT1L_MUTE 0x4000
404#define WM8350_OUT1L_ZC 0x2000
405#define WM8350_OUT1_VU 0x0100
406#define WM8350_OUT1L_VOL_MASK 0x00FC
407#define WM8350_OUT1L_VOL_SHIFT 2
408
409/*
410 * R105 (0x69) - ROUT1 Volume
411 */
412#define WM8350_OUT1R_MUTE 0x4000
413#define WM8350_OUT1R_ZC 0x2000
414#define WM8350_OUT1_VU 0x0100
415#define WM8350_OUT1R_VOL_MASK 0x00FC
416#define WM8350_OUT1R_VOL_SHIFT 2
417
418/*
419 * R106 (0x6A) - LOUT2 Volume
420 */
421#define WM8350_OUT2L_MUTE 0x4000
422#define WM8350_OUT2L_ZC 0x2000
423#define WM8350_OUT2_VU 0x0100
424#define WM8350_OUT2L_VOL_MASK 0x00FC
425
426/*
427 * R107 (0x6B) - ROUT2 Volume
428 */
429#define WM8350_OUT2R_MUTE 0x4000
430#define WM8350_OUT2R_ZC 0x2000
431#define WM8350_OUT2R_INV 0x0400
432#define WM8350_OUT2R_INV_MUTE 0x0200
433#define WM8350_OUT2_VU 0x0100
434#define WM8350_OUT2R_VOL_MASK 0x00FC
435
436/*
437 * R111 (0x6F) - BEEP Volume
438 */
439#define WM8350_IN3R_OUT2R_VOL_MASK 0x00E0
440
441/*
442 * R112 (0x70) - AI Formating
443 */
444#define WM8350_AIF_BCLK_INV 0x8000
445#define WM8350_AIF_TRI 0x2000
446#define WM8350_AIF_LRCLK_INV 0x1000
447#define WM8350_AIF_WL_MASK 0x0C00
448#define WM8350_AIF_FMT_MASK 0x0300
449
450/*
451 * R113 (0x71) - ADC DAC COMP
452 */
453#define WM8350_DAC_COMP 0x0080
454#define WM8350_DAC_COMPMODE 0x0040
455#define WM8350_ADC_COMP 0x0020
456#define WM8350_ADC_COMPMODE 0x0010
457#define WM8350_LOOPBACK 0x0001
458
459/*
460 * R114 (0x72) - AI ADC Control
461 */
462#define WM8350_AIFADC_PD 0x0080
463#define WM8350_AIFADCL_SRC 0x0040
464#define WM8350_AIFADCR_SRC 0x0020
465#define WM8350_AIFADC_TDM_CHAN 0x0010
466#define WM8350_AIFADC_TDM 0x0008
467
468/*
469 * R115 (0x73) - AI DAC Control
470 */
471#define WM8350_BCLK_MSTR 0x4000
472#define WM8350_AIFDAC_PD 0x0080
473#define WM8350_DACL_SRC 0x0040
474#define WM8350_DACR_SRC 0x0020
475#define WM8350_AIFDAC_TDM_CHAN 0x0010
476#define WM8350_AIFDAC_TDM 0x0008
477#define WM8350_DAC_BOOST_MASK 0x0003
478
479/*
480 * R116 (0x74) - AIF Test
481 */
482#define WM8350_CODEC_BYP 0x4000
483#define WM8350_AIFADC_WR_TST 0x2000
484#define WM8350_AIFADC_RD_TST 0x1000
485#define WM8350_AIFDAC_WR_TST 0x0800
486#define WM8350_AIFDAC_RD_TST 0x0400
487#define WM8350_AIFADC_ASYN 0x0020
488#define WM8350_AIFDAC_ASYN 0x0010
489
490/*
491 * R231 (0xE7) - Jack Status
492 */
493#define WM8350_JACK_R_LVL 0x0400
494
495/*
496 * WM8350 Platform setup
497 */
498#define WM8350_S_CURVE_NONE 0x0
499#define WM8350_S_CURVE_FAST 0x1
500#define WM8350_S_CURVE_MEDIUM 0x2
501#define WM8350_S_CURVE_SLOW 0x3
502
503#define WM8350_DISCHARGE_OFF 0x0
504#define WM8350_DISCHARGE_FAST 0x1
505#define WM8350_DISCHARGE_MEDIUM 0x2
506#define WM8350_DISCHARGE_SLOW 0x3
507
508#define WM8350_TIE_OFF_500R 0x0
509#define WM8350_TIE_OFF_30K 0x1
510
511/*
512 * Clock sources & directions
513 */
514#define WM8350_SYSCLK 0
515
516#define WM8350_MCLK_SEL_PLL_MCLK 0
517#define WM8350_MCLK_SEL_PLL_DAC 1
518#define WM8350_MCLK_SEL_PLL_ADC 2
519#define WM8350_MCLK_SEL_PLL_32K 3
520#define WM8350_MCLK_SEL_MCLK 5
521
522#define WM8350_MCLK_DIR_OUT 0
523#define WM8350_MCLK_DIR_IN 1
524
525/* clock divider id's */
526#define WM8350_ADC_CLKDIV 0
527#define WM8350_DAC_CLKDIV 1
528#define WM8350_BCLK_CLKDIV 2
529#define WM8350_OPCLK_CLKDIV 3
530#define WM8350_TO_CLKDIV 4
531#define WM8350_SYS_CLKDIV 5
532#define WM8350_DACLR_CLKDIV 6
533#define WM8350_ADCLR_CLKDIV 7
534
535/* ADC clock dividers */
536#define WM8350_ADCDIV_1 0x0
537#define WM8350_ADCDIV_1_5 0x1
538#define WM8350_ADCDIV_2 0x2
539#define WM8350_ADCDIV_3 0x3
540#define WM8350_ADCDIV_4 0x4
541#define WM8350_ADCDIV_5_5 0x5
542#define WM8350_ADCDIV_6 0x6
543
544/* ADC clock dividers */
545#define WM8350_DACDIV_1 0x0
546#define WM8350_DACDIV_1_5 0x1
547#define WM8350_DACDIV_2 0x2
548#define WM8350_DACDIV_3 0x3
549#define WM8350_DACDIV_4 0x4
550#define WM8350_DACDIV_5_5 0x5
551#define WM8350_DACDIV_6 0x6
552
553/* BCLK clock dividers */
554#define WM8350_BCLK_DIV_1 (0x0 << 4)
555#define WM8350_BCLK_DIV_1_5 (0x1 << 4)
556#define WM8350_BCLK_DIV_2 (0x2 << 4)
557#define WM8350_BCLK_DIV_3 (0x3 << 4)
558#define WM8350_BCLK_DIV_4 (0x4 << 4)
559#define WM8350_BCLK_DIV_5_5 (0x5 << 4)
560#define WM8350_BCLK_DIV_6 (0x6 << 4)
561#define WM8350_BCLK_DIV_8 (0x7 << 4)
562#define WM8350_BCLK_DIV_11 (0x8 << 4)
563#define WM8350_BCLK_DIV_12 (0x9 << 4)
564#define WM8350_BCLK_DIV_16 (0xa << 4)
565#define WM8350_BCLK_DIV_22 (0xb << 4)
566#define WM8350_BCLK_DIV_24 (0xc << 4)
567#define WM8350_BCLK_DIV_32 (0xd << 4)
568#define WM8350_BCLK_DIV_44 (0xe << 4)
569#define WM8350_BCLK_DIV_48 (0xf << 4)
570
571/* Sys (MCLK) clock dividers */
572#define WM8350_MCLK_DIV_1 (0x0 << 8)
573#define WM8350_MCLK_DIV_2 (0x1 << 8)
574
575/* OP clock dividers */
576#define WM8350_OPCLK_DIV_1 0x0
577#define WM8350_OPCLK_DIV_2 0x1
578#define WM8350_OPCLK_DIV_3 0x2
579#define WM8350_OPCLK_DIV_4 0x3
580#define WM8350_OPCLK_DIV_5_5 0x4
581#define WM8350_OPCLK_DIV_6 0x5
582
583/* DAI ID */
584#define WM8350_HIFI_DAI 0
585
586/*
587 * Audio interrupts.
588 */
589#define WM8350_IRQ_CODEC_JCK_DET_L 39
590#define WM8350_IRQ_CODEC_JCK_DET_R 40
591#define WM8350_IRQ_CODEC_MICSCD 41
592#define WM8350_IRQ_CODEC_MICD 42
593
594struct wm8350_codec {
595 struct platform_device *pdev;
596};
597
598#endif
diff --git a/include/linux/mfd/wm8350/comparator.h b/include/linux/mfd/wm8350/comparator.h
new file mode 100644
index 000000000000..053788649452
--- /dev/null
+++ b/include/linux/mfd/wm8350/comparator.h
@@ -0,0 +1,167 @@
1/*
2 * comparator.h -- Comparator Aux ADC for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef __LINUX_MFD_WM8350_COMPARATOR_H_
13#define __LINUX_MFD_WM8350_COMPARATOR_H_
14
15/*
16 * Registers
17 */
18
19#define WM8350_DIGITISER_CONTROL_1 0x90
20#define WM8350_DIGITISER_CONTROL_2 0x91
21#define WM8350_AUX1_READBACK 0x98
22#define WM8350_AUX2_READBACK 0x99
23#define WM8350_AUX3_READBACK 0x9A
24#define WM8350_AUX4_READBACK 0x9B
25#define WM8350_CHIP_TEMP_READBACK 0x9F
26#define WM8350_GENERIC_COMPARATOR_CONTROL 0xA3
27#define WM8350_GENERIC_COMPARATOR_1 0xA4
28#define WM8350_GENERIC_COMPARATOR_2 0xA5
29#define WM8350_GENERIC_COMPARATOR_3 0xA6
30#define WM8350_GENERIC_COMPARATOR_4 0xA7
31
32/*
33 * R144 (0x90) - Digitiser Control (1)
34 */
35#define WM8350_AUXADC_CTC 0x4000
36#define WM8350_AUXADC_POLL 0x2000
37#define WM8350_AUXADC_HIB_MODE 0x1000
38#define WM8350_AUXADC_SEL8 0x0080
39#define WM8350_AUXADC_SEL7 0x0040
40#define WM8350_AUXADC_SEL6 0x0020
41#define WM8350_AUXADC_SEL5 0x0010
42#define WM8350_AUXADC_SEL4 0x0008
43#define WM8350_AUXADC_SEL3 0x0004
44#define WM8350_AUXADC_SEL2 0x0002
45#define WM8350_AUXADC_SEL1 0x0001
46
47/*
48 * R145 (0x91) - Digitiser Control (2)
49 */
50#define WM8350_AUXADC_MASKMODE_MASK 0x3000
51#define WM8350_AUXADC_CRATE_MASK 0x0700
52#define WM8350_AUXADC_CAL 0x0004
53#define WM8350_AUX_RBMODE 0x0002
54#define WM8350_AUXADC_WAIT 0x0001
55
56/*
57 * R152 (0x98) - AUX1 Readback
58 */
59#define WM8350_AUXADC_SCALE1_MASK 0x6000
60#define WM8350_AUXADC_REF1 0x1000
61#define WM8350_AUXADC_DATA1_MASK 0x0FFF
62
63/*
64 * R153 (0x99) - AUX2 Readback
65 */
66#define WM8350_AUXADC_SCALE2_MASK 0x6000
67#define WM8350_AUXADC_REF2 0x1000
68#define WM8350_AUXADC_DATA2_MASK 0x0FFF
69
70/*
71 * R154 (0x9A) - AUX3 Readback
72 */
73#define WM8350_AUXADC_SCALE3_MASK 0x6000
74#define WM8350_AUXADC_REF3 0x1000
75#define WM8350_AUXADC_DATA3_MASK 0x0FFF
76
77/*
78 * R155 (0x9B) - AUX4 Readback
79 */
80#define WM8350_AUXADC_SCALE4_MASK 0x6000
81#define WM8350_AUXADC_REF4 0x1000
82#define WM8350_AUXADC_DATA4_MASK 0x0FFF
83
84/*
85 * R156 (0x9C) - USB Voltage Readback
86 */
87#define WM8350_AUXADC_DATA_USB_MASK 0x0FFF
88
89/*
90 * R157 (0x9D) - LINE Voltage Readback
91 */
92#define WM8350_AUXADC_DATA_LINE_MASK 0x0FFF
93
94/*
95 * R158 (0x9E) - BATT Voltage Readback
96 */
97#define WM8350_AUXADC_DATA_BATT_MASK 0x0FFF
98
99/*
100 * R159 (0x9F) - Chip Temp Readback
101 */
102#define WM8350_AUXADC_DATA_CHIPTEMP_MASK 0x0FFF
103
104/*
105 * R163 (0xA3) - Generic Comparator Control
106 */
107#define WM8350_DCMP4_ENA 0x0008
108#define WM8350_DCMP3_ENA 0x0004
109#define WM8350_DCMP2_ENA 0x0002
110#define WM8350_DCMP1_ENA 0x0001
111
112/*
113 * R164 (0xA4) - Generic comparator 1
114 */
115#define WM8350_DCMP1_SRCSEL_MASK 0xE000
116#define WM8350_DCMP1_GT 0x1000
117#define WM8350_DCMP1_THR_MASK 0x0FFF
118
119/*
120 * R165 (0xA5) - Generic comparator 2
121 */
122#define WM8350_DCMP2_SRCSEL_MASK 0xE000
123#define WM8350_DCMP2_GT 0x1000
124#define WM8350_DCMP2_THR_MASK 0x0FFF
125
126/*
127 * R166 (0xA6) - Generic comparator 3
128 */
129#define WM8350_DCMP3_SRCSEL_MASK 0xE000
130#define WM8350_DCMP3_GT 0x1000
131#define WM8350_DCMP3_THR_MASK 0x0FFF
132
133/*
134 * R167 (0xA7) - Generic comparator 4
135 */
136#define WM8350_DCMP4_SRCSEL_MASK 0xE000
137#define WM8350_DCMP4_GT 0x1000
138#define WM8350_DCMP4_THR_MASK 0x0FFF
139
140/*
141 * Interrupts.
142 */
143#define WM8350_IRQ_AUXADC_DATARDY 16
144#define WM8350_IRQ_AUXADC_DCOMP4 17
145#define WM8350_IRQ_AUXADC_DCOMP3 18
146#define WM8350_IRQ_AUXADC_DCOMP2 19
147#define WM8350_IRQ_AUXADC_DCOMP1 20
148#define WM8350_IRQ_SYS_HYST_COMP_FAIL 21
149#define WM8350_IRQ_SYS_CHIP_GT115 22
150#define WM8350_IRQ_SYS_CHIP_GT140 23
151
152/*
153 * USB/2, LINE & BATT = ((VRTC * 2) / 4095)) * 10e6 uV
154 * Where VRTC = 2.7 V
155 */
156#define WM8350_AUX_COEFF 1319
157
158#define WM8350_AUXADC_AUX1 0
159#define WM8350_AUXADC_AUX2 1
160#define WM8350_AUXADC_AUX3 2
161#define WM8350_AUXADC_AUX4 3
162#define WM8350_AUXADC_USB 4
163#define WM8350_AUXADC_LINE 5
164#define WM8350_AUXADC_BATT 6
165#define WM8350_AUXADC_TEMP 7
166
167#endif
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
new file mode 100644
index 000000000000..6ebf97f2a475
--- /dev/null
+++ b/include/linux/mfd/wm8350/core.h
@@ -0,0 +1,631 @@
1/*
2 * core.h -- Core Driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __LINUX_MFD_WM8350_CORE_H_
14#define __LINUX_MFD_WM8350_CORE_H_
15
16#include <linux/kernel.h>
17#include <linux/mutex.h>
18#include <linux/workqueue.h>
19
20#include <linux/mfd/wm8350/audio.h>
21#include <linux/mfd/wm8350/gpio.h>
22#include <linux/mfd/wm8350/pmic.h>
23#include <linux/mfd/wm8350/rtc.h>
24#include <linux/mfd/wm8350/supply.h>
25#include <linux/mfd/wm8350/wdt.h>
26
27/*
28 * Register values.
29 */
30#define WM8350_RESET_ID 0x00
31#define WM8350_ID 0x01
32#define WM8350_SYSTEM_CONTROL_1 0x03
33#define WM8350_SYSTEM_CONTROL_2 0x04
34#define WM8350_SYSTEM_HIBERNATE 0x05
35#define WM8350_INTERFACE_CONTROL 0x06
36#define WM8350_POWER_MGMT_1 0x08
37#define WM8350_POWER_MGMT_2 0x09
38#define WM8350_POWER_MGMT_3 0x0A
39#define WM8350_POWER_MGMT_4 0x0B
40#define WM8350_POWER_MGMT_5 0x0C
41#define WM8350_POWER_MGMT_6 0x0D
42#define WM8350_POWER_MGMT_7 0x0E
43
44#define WM8350_SYSTEM_INTERRUPTS 0x18
45#define WM8350_INT_STATUS_1 0x19
46#define WM8350_INT_STATUS_2 0x1A
47#define WM8350_POWER_UP_INT_STATUS 0x1B
48#define WM8350_UNDER_VOLTAGE_INT_STATUS 0x1C
49#define WM8350_OVER_CURRENT_INT_STATUS 0x1D
50#define WM8350_GPIO_INT_STATUS 0x1E
51#define WM8350_COMPARATOR_INT_STATUS 0x1F
52#define WM8350_SYSTEM_INTERRUPTS_MASK 0x20
53#define WM8350_INT_STATUS_1_MASK 0x21
54#define WM8350_INT_STATUS_2_MASK 0x22
55#define WM8350_POWER_UP_INT_STATUS_MASK 0x23
56#define WM8350_UNDER_VOLTAGE_INT_STATUS_MASK 0x24
57#define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25
58#define WM8350_GPIO_INT_STATUS_MASK 0x26
59#define WM8350_COMPARATOR_INT_STATUS_MASK 0x27
60
61#define WM8350_MAX_REGISTER 0xFF
62
63/*
64 * Field Definitions.
65 */
66
67/*
68 * R0 (0x00) - Reset/ID
69 */
70#define WM8350_SW_RESET_CHIP_ID_MASK 0xFFFF
71
72/*
73 * R1 (0x01) - ID
74 */
75#define WM8350_CHIP_REV_MASK 0x7000
76#define WM8350_CONF_STS_MASK 0x0C00
77#define WM8350_CUST_ID_MASK 0x00FF
78
79/*
80 * R3 (0x03) - System Control 1
81 */
82#define WM8350_CHIP_ON 0x8000
83#define WM8350_POWERCYCLE 0x2000
84#define WM8350_VCC_FAULT_OV 0x1000
85#define WM8350_REG_RSTB_TIME_MASK 0x0C00
86#define WM8350_BG_SLEEP 0x0200
87#define WM8350_MEM_VALID 0x0020
88#define WM8350_CHIP_SET_UP 0x0010
89#define WM8350_ON_DEB_T 0x0008
90#define WM8350_ON_POL 0x0002
91#define WM8350_IRQ_POL 0x0001
92
93/*
94 * R4 (0x04) - System Control 2
95 */
96#define WM8350_USB_SUSPEND_8MA 0x8000
97#define WM8350_USB_SUSPEND 0x4000
98#define WM8350_USB_MSTR 0x2000
99#define WM8350_USB_MSTR_SRC 0x1000
100#define WM8350_USB_500MA 0x0800
101#define WM8350_USB_NOLIM 0x0400
102
103/*
104 * R5 (0x05) - System Hibernate
105 */
106#define WM8350_HIBERNATE 0x8000
107#define WM8350_WDOG_HIB_MODE 0x0080
108#define WM8350_REG_HIB_STARTUP_SEQ 0x0040
109#define WM8350_REG_RESET_HIB_MODE 0x0020
110#define WM8350_RST_HIB_MODE 0x0010
111#define WM8350_IRQ_HIB_MODE 0x0008
112#define WM8350_MEMRST_HIB_MODE 0x0004
113#define WM8350_PCCOMP_HIB_MODE 0x0002
114#define WM8350_TEMPMON_HIB_MODE 0x0001
115
116/*
117 * R6 (0x06) - Interface Control
118 */
119#define WM8350_USE_DEV_PINS 0x8000
120#define WM8350_USE_DEV_PINS_MASK 0x8000
121#define WM8350_USE_DEV_PINS_SHIFT 15
122#define WM8350_DEV_ADDR_MASK 0x6000
123#define WM8350_DEV_ADDR_SHIFT 13
124#define WM8350_CONFIG_DONE 0x1000
125#define WM8350_CONFIG_DONE_MASK 0x1000
126#define WM8350_CONFIG_DONE_SHIFT 12
127#define WM8350_RECONFIG_AT_ON 0x0800
128#define WM8350_RECONFIG_AT_ON_MASK 0x0800
129#define WM8350_RECONFIG_AT_ON_SHIFT 11
130#define WM8350_AUTOINC 0x0200
131#define WM8350_AUTOINC_MASK 0x0200
132#define WM8350_AUTOINC_SHIFT 9
133#define WM8350_ARA 0x0100
134#define WM8350_ARA_MASK 0x0100
135#define WM8350_ARA_SHIFT 8
136#define WM8350_SPI_CFG 0x0008
137#define WM8350_SPI_CFG_MASK 0x0008
138#define WM8350_SPI_CFG_SHIFT 3
139#define WM8350_SPI_4WIRE 0x0004
140#define WM8350_SPI_4WIRE_MASK 0x0004
141#define WM8350_SPI_4WIRE_SHIFT 2
142#define WM8350_SPI_3WIRE 0x0002
143#define WM8350_SPI_3WIRE_MASK 0x0002
144#define WM8350_SPI_3WIRE_SHIFT 1
145
146/* Bit values for R06 (0x06) */
147#define WM8350_USE_DEV_PINS_PRIMARY 0
148#define WM8350_USE_DEV_PINS_DEV 1
149
150#define WM8350_DEV_ADDR_34 0
151#define WM8350_DEV_ADDR_36 1
152#define WM8350_DEV_ADDR_3C 2
153#define WM8350_DEV_ADDR_3E 3
154
155#define WM8350_CONFIG_DONE_OFF 0
156#define WM8350_CONFIG_DONE_DONE 1
157
158#define WM8350_RECONFIG_AT_ON_OFF 0
159#define WM8350_RECONFIG_AT_ON_ON 1
160
161#define WM8350_AUTOINC_OFF 0
162#define WM8350_AUTOINC_ON 1
163
164#define WM8350_ARA_OFF 0
165#define WM8350_ARA_ON 1
166
167#define WM8350_SPI_CFG_CMOS 0
168#define WM8350_SPI_CFG_OD 1
169
170#define WM8350_SPI_4WIRE_3WIRE 0
171#define WM8350_SPI_4WIRE_4WIRE 1
172
173#define WM8350_SPI_3WIRE_I2C 0
174#define WM8350_SPI_3WIRE_SPI 1
175
176/*
177 * R8 (0x08) - Power mgmt (1)
178 */
179#define WM8350_CODEC_ISEL_MASK 0xC000
180#define WM8350_VBUFEN 0x2000
181#define WM8350_OUTPUT_DRAIN_EN 0x0400
182#define WM8350_MIC_DET_ENA 0x0100
183#define WM8350_BIASEN 0x0020
184#define WM8350_MICBEN 0x0010
185#define WM8350_VMIDEN 0x0004
186#define WM8350_VMID_MASK 0x0003
187#define WM8350_VMID_SHIFT 0
188
189/*
190 * R9 (0x09) - Power mgmt (2)
191 */
192#define WM8350_IN3R_ENA 0x0800
193#define WM8350_IN3L_ENA 0x0400
194#define WM8350_INR_ENA 0x0200
195#define WM8350_INL_ENA 0x0100
196#define WM8350_MIXINR_ENA 0x0080
197#define WM8350_MIXINL_ENA 0x0040
198#define WM8350_OUT4_ENA 0x0020
199#define WM8350_OUT3_ENA 0x0010
200#define WM8350_MIXOUTR_ENA 0x0002
201#define WM8350_MIXOUTL_ENA 0x0001
202
203/*
204 * R10 (0x0A) - Power mgmt (3)
205 */
206#define WM8350_IN3R_TO_OUT2R 0x0080
207#define WM8350_OUT2R_ENA 0x0008
208#define WM8350_OUT2L_ENA 0x0004
209#define WM8350_OUT1R_ENA 0x0002
210#define WM8350_OUT1L_ENA 0x0001
211
212/*
213 * R11 (0x0B) - Power mgmt (4)
214 */
215#define WM8350_SYSCLK_ENA 0x4000
216#define WM8350_ADC_HPF_ENA 0x2000
217#define WM8350_FLL_ENA 0x0800
218#define WM8350_FLL_OSC_ENA 0x0400
219#define WM8350_TOCLK_ENA 0x0100
220#define WM8350_DACR_ENA 0x0020
221#define WM8350_DACL_ENA 0x0010
222#define WM8350_ADCR_ENA 0x0008
223#define WM8350_ADCL_ENA 0x0004
224
225/*
226 * R12 (0x0C) - Power mgmt (5)
227 */
228#define WM8350_CODEC_ENA 0x1000
229#define WM8350_RTC_TICK_ENA 0x0800
230#define WM8350_OSC32K_ENA 0x0400
231#define WM8350_CHG_ENA 0x0200
232#define WM8350_ACC_DET_ENA 0x0100
233#define WM8350_AUXADC_ENA 0x0080
234#define WM8350_DCMP4_ENA 0x0008
235#define WM8350_DCMP3_ENA 0x0004
236#define WM8350_DCMP2_ENA 0x0002
237#define WM8350_DCMP1_ENA 0x0001
238
239/*
240 * R13 (0x0D) - Power mgmt (6)
241 */
242#define WM8350_LS_ENA 0x8000
243#define WM8350_LDO4_ENA 0x0800
244#define WM8350_LDO3_ENA 0x0400
245#define WM8350_LDO2_ENA 0x0200
246#define WM8350_LDO1_ENA 0x0100
247#define WM8350_DC6_ENA 0x0020
248#define WM8350_DC5_ENA 0x0010
249#define WM8350_DC4_ENA 0x0008
250#define WM8350_DC3_ENA 0x0004
251#define WM8350_DC2_ENA 0x0002
252#define WM8350_DC1_ENA 0x0001
253
254/*
255 * R14 (0x0E) - Power mgmt (7)
256 */
257#define WM8350_CS2_ENA 0x0002
258#define WM8350_CS1_ENA 0x0001
259
260/*
261 * R24 (0x18) - System Interrupts
262 */
263#define WM8350_OC_INT 0x2000
264#define WM8350_UV_INT 0x1000
265#define WM8350_PUTO_INT 0x0800
266#define WM8350_CS_INT 0x0200
267#define WM8350_EXT_INT 0x0100
268#define WM8350_CODEC_INT 0x0080
269#define WM8350_GP_INT 0x0040
270#define WM8350_AUXADC_INT 0x0020
271#define WM8350_RTC_INT 0x0010
272#define WM8350_SYS_INT 0x0008
273#define WM8350_CHG_INT 0x0004
274#define WM8350_USB_INT 0x0002
275#define WM8350_WKUP_INT 0x0001
276
277/*
278 * R25 (0x19) - Interrupt Status 1
279 */
280#define WM8350_CHG_BAT_HOT_EINT 0x8000
281#define WM8350_CHG_BAT_COLD_EINT 0x4000
282#define WM8350_CHG_BAT_FAIL_EINT 0x2000
283#define WM8350_CHG_TO_EINT 0x1000
284#define WM8350_CHG_END_EINT 0x0800
285#define WM8350_CHG_START_EINT 0x0400
286#define WM8350_CHG_FAST_RDY_EINT 0x0200
287#define WM8350_RTC_PER_EINT 0x0080
288#define WM8350_RTC_SEC_EINT 0x0040
289#define WM8350_RTC_ALM_EINT 0x0020
290#define WM8350_CHG_VBATT_LT_3P9_EINT 0x0004
291#define WM8350_CHG_VBATT_LT_3P1_EINT 0x0002
292#define WM8350_CHG_VBATT_LT_2P85_EINT 0x0001
293
294/*
295 * R26 (0x1A) - Interrupt Status 2
296 */
297#define WM8350_CS1_EINT 0x2000
298#define WM8350_CS2_EINT 0x1000
299#define WM8350_USB_LIMIT_EINT 0x0400
300#define WM8350_AUXADC_DATARDY_EINT 0x0100
301#define WM8350_AUXADC_DCOMP4_EINT 0x0080
302#define WM8350_AUXADC_DCOMP3_EINT 0x0040
303#define WM8350_AUXADC_DCOMP2_EINT 0x0020
304#define WM8350_AUXADC_DCOMP1_EINT 0x0010
305#define WM8350_SYS_HYST_COMP_FAIL_EINT 0x0008
306#define WM8350_SYS_CHIP_GT115_EINT 0x0004
307#define WM8350_SYS_CHIP_GT140_EINT 0x0002
308#define WM8350_SYS_WDOG_TO_EINT 0x0001
309
310/*
311 * R27 (0x1B) - Power Up Interrupt Status
312 */
313#define WM8350_PUTO_LDO4_EINT 0x0800
314#define WM8350_PUTO_LDO3_EINT 0x0400
315#define WM8350_PUTO_LDO2_EINT 0x0200
316#define WM8350_PUTO_LDO1_EINT 0x0100
317#define WM8350_PUTO_DC6_EINT 0x0020
318#define WM8350_PUTO_DC5_EINT 0x0010
319#define WM8350_PUTO_DC4_EINT 0x0008
320#define WM8350_PUTO_DC3_EINT 0x0004
321#define WM8350_PUTO_DC2_EINT 0x0002
322#define WM8350_PUTO_DC1_EINT 0x0001
323
324/*
325 * R28 (0x1C) - Under Voltage Interrupt status
326 */
327#define WM8350_UV_LDO4_EINT 0x0800
328#define WM8350_UV_LDO3_EINT 0x0400
329#define WM8350_UV_LDO2_EINT 0x0200
330#define WM8350_UV_LDO1_EINT 0x0100
331#define WM8350_UV_DC6_EINT 0x0020
332#define WM8350_UV_DC5_EINT 0x0010
333#define WM8350_UV_DC4_EINT 0x0008
334#define WM8350_UV_DC3_EINT 0x0004
335#define WM8350_UV_DC2_EINT 0x0002
336#define WM8350_UV_DC1_EINT 0x0001
337
338/*
339 * R29 (0x1D) - Over Current Interrupt status
340 */
341#define WM8350_OC_LS_EINT 0x8000
342
343/*
344 * R30 (0x1E) - GPIO Interrupt Status
345 */
346#define WM8350_GP12_EINT 0x1000
347#define WM8350_GP11_EINT 0x0800
348#define WM8350_GP10_EINT 0x0400
349#define WM8350_GP9_EINT 0x0200
350#define WM8350_GP8_EINT 0x0100
351#define WM8350_GP7_EINT 0x0080
352#define WM8350_GP6_EINT 0x0040
353#define WM8350_GP5_EINT 0x0020
354#define WM8350_GP4_EINT 0x0010
355#define WM8350_GP3_EINT 0x0008
356#define WM8350_GP2_EINT 0x0004
357#define WM8350_GP1_EINT 0x0002
358#define WM8350_GP0_EINT 0x0001
359
360/*
361 * R31 (0x1F) - Comparator Interrupt Status
362 */
363#define WM8350_EXT_USB_FB_EINT 0x8000
364#define WM8350_EXT_WALL_FB_EINT 0x4000
365#define WM8350_EXT_BAT_FB_EINT 0x2000
366#define WM8350_CODEC_JCK_DET_L_EINT 0x0800
367#define WM8350_CODEC_JCK_DET_R_EINT 0x0400
368#define WM8350_CODEC_MICSCD_EINT 0x0200
369#define WM8350_CODEC_MICD_EINT 0x0100
370#define WM8350_WKUP_OFF_STATE_EINT 0x0040
371#define WM8350_WKUP_HIB_STATE_EINT 0x0020
372#define WM8350_WKUP_CONV_FAULT_EINT 0x0010
373#define WM8350_WKUP_WDOG_RST_EINT 0x0008
374#define WM8350_WKUP_GP_PWR_ON_EINT 0x0004
375#define WM8350_WKUP_ONKEY_EINT 0x0002
376#define WM8350_WKUP_GP_WAKEUP_EINT 0x0001
377
378/*
379 * R32 (0x20) - System Interrupts Mask
380 */
381#define WM8350_IM_OC_INT 0x2000
382#define WM8350_IM_UV_INT 0x1000
383#define WM8350_IM_PUTO_INT 0x0800
384#define WM8350_IM_SPARE_INT 0x0400
385#define WM8350_IM_CS_INT 0x0200
386#define WM8350_IM_EXT_INT 0x0100
387#define WM8350_IM_CODEC_INT 0x0080
388#define WM8350_IM_GP_INT 0x0040
389#define WM8350_IM_AUXADC_INT 0x0020
390#define WM8350_IM_RTC_INT 0x0010
391#define WM8350_IM_SYS_INT 0x0008
392#define WM8350_IM_CHG_INT 0x0004
393#define WM8350_IM_USB_INT 0x0002
394#define WM8350_IM_WKUP_INT 0x0001
395
396/*
397 * R33 (0x21) - Interrupt Status 1 Mask
398 */
399#define WM8350_IM_CHG_BAT_HOT_EINT 0x8000
400#define WM8350_IM_CHG_BAT_COLD_EINT 0x4000
401#define WM8350_IM_CHG_BAT_FAIL_EINT 0x2000
402#define WM8350_IM_CHG_TO_EINT 0x1000
403#define WM8350_IM_CHG_END_EINT 0x0800
404#define WM8350_IM_CHG_START_EINT 0x0400
405#define WM8350_IM_CHG_FAST_RDY_EINT 0x0200
406#define WM8350_IM_RTC_PER_EINT 0x0080
407#define WM8350_IM_RTC_SEC_EINT 0x0040
408#define WM8350_IM_RTC_ALM_EINT 0x0020
409#define WM8350_IM_CHG_VBATT_LT_3P9_EINT 0x0004
410#define WM8350_IM_CHG_VBATT_LT_3P1_EINT 0x0002
411#define WM8350_IM_CHG_VBATT_LT_2P85_EINT 0x0001
412
413/*
414 * R34 (0x22) - Interrupt Status 2 Mask
415 */
416#define WM8350_IM_SPARE2_EINT 0x8000
417#define WM8350_IM_SPARE1_EINT 0x4000
418#define WM8350_IM_CS1_EINT 0x2000
419#define WM8350_IM_CS2_EINT 0x1000
420#define WM8350_IM_USB_LIMIT_EINT 0x0400
421#define WM8350_IM_AUXADC_DATARDY_EINT 0x0100
422#define WM8350_IM_AUXADC_DCOMP4_EINT 0x0080
423#define WM8350_IM_AUXADC_DCOMP3_EINT 0x0040
424#define WM8350_IM_AUXADC_DCOMP2_EINT 0x0020
425#define WM8350_IM_AUXADC_DCOMP1_EINT 0x0010
426#define WM8350_IM_SYS_HYST_COMP_FAIL_EINT 0x0008
427#define WM8350_IM_SYS_CHIP_GT115_EINT 0x0004
428#define WM8350_IM_SYS_CHIP_GT140_EINT 0x0002
429#define WM8350_IM_SYS_WDOG_TO_EINT 0x0001
430
431/*
432 * R35 (0x23) - Power Up Interrupt Status Mask
433 */
434#define WM8350_IM_PUTO_LDO4_EINT 0x0800
435#define WM8350_IM_PUTO_LDO3_EINT 0x0400
436#define WM8350_IM_PUTO_LDO2_EINT 0x0200
437#define WM8350_IM_PUTO_LDO1_EINT 0x0100
438#define WM8350_IM_PUTO_DC6_EINT 0x0020
439#define WM8350_IM_PUTO_DC5_EINT 0x0010
440#define WM8350_IM_PUTO_DC4_EINT 0x0008
441#define WM8350_IM_PUTO_DC3_EINT 0x0004
442#define WM8350_IM_PUTO_DC2_EINT 0x0002
443#define WM8350_IM_PUTO_DC1_EINT 0x0001
444
445/*
446 * R36 (0x24) - Under Voltage Interrupt status Mask
447 */
448#define WM8350_IM_UV_LDO4_EINT 0x0800
449#define WM8350_IM_UV_LDO3_EINT 0x0400
450#define WM8350_IM_UV_LDO2_EINT 0x0200
451#define WM8350_IM_UV_LDO1_EINT 0x0100
452#define WM8350_IM_UV_DC6_EINT 0x0020
453#define WM8350_IM_UV_DC5_EINT 0x0010
454#define WM8350_IM_UV_DC4_EINT 0x0008
455#define WM8350_IM_UV_DC3_EINT 0x0004
456#define WM8350_IM_UV_DC2_EINT 0x0002
457#define WM8350_IM_UV_DC1_EINT 0x0001
458
459/*
460 * R37 (0x25) - Over Current Interrupt status Mask
461 */
462#define WM8350_IM_OC_LS_EINT 0x8000
463
464/*
465 * R38 (0x26) - GPIO Interrupt Status Mask
466 */
467#define WM8350_IM_GP12_EINT 0x1000
468#define WM8350_IM_GP11_EINT 0x0800
469#define WM8350_IM_GP10_EINT 0x0400
470#define WM8350_IM_GP9_EINT 0x0200
471#define WM8350_IM_GP8_EINT 0x0100
472#define WM8350_IM_GP7_EINT 0x0080
473#define WM8350_IM_GP6_EINT 0x0040
474#define WM8350_IM_GP5_EINT 0x0020
475#define WM8350_IM_GP4_EINT 0x0010
476#define WM8350_IM_GP3_EINT 0x0008
477#define WM8350_IM_GP2_EINT 0x0004
478#define WM8350_IM_GP1_EINT 0x0002
479#define WM8350_IM_GP0_EINT 0x0001
480
481/*
482 * R39 (0x27) - Comparator Interrupt Status Mask
483 */
484#define WM8350_IM_EXT_USB_FB_EINT 0x8000
485#define WM8350_IM_EXT_WALL_FB_EINT 0x4000
486#define WM8350_IM_EXT_BAT_FB_EINT 0x2000
487#define WM8350_IM_CODEC_JCK_DET_L_EINT 0x0800
488#define WM8350_IM_CODEC_JCK_DET_R_EINT 0x0400
489#define WM8350_IM_CODEC_MICSCD_EINT 0x0200
490#define WM8350_IM_CODEC_MICD_EINT 0x0100
491#define WM8350_IM_WKUP_OFF_STATE_EINT 0x0040
492#define WM8350_IM_WKUP_HIB_STATE_EINT 0x0020
493#define WM8350_IM_WKUP_CONV_FAULT_EINT 0x0010
494#define WM8350_IM_WKUP_WDOG_RST_EINT 0x0008
495#define WM8350_IM_WKUP_GP_PWR_ON_EINT 0x0004
496#define WM8350_IM_WKUP_ONKEY_EINT 0x0002
497#define WM8350_IM_WKUP_GP_WAKEUP_EINT 0x0001
498
499/*
500 * R220 (0xDC) - RAM BIST 1
501 */
502#define WM8350_READ_STATUS 0x0800
503#define WM8350_TSTRAM_CLK 0x0100
504#define WM8350_TSTRAM_CLK_ENA 0x0080
505#define WM8350_STARTSEQ 0x0040
506#define WM8350_READ_SRC 0x0020
507#define WM8350_COUNT_DIR 0x0010
508#define WM8350_TSTRAM_MODE_MASK 0x000E
509#define WM8350_TSTRAM_ENA 0x0001
510
511/*
512 * R225 (0xE1) - DCDC/LDO status
513 */
514#define WM8350_LS_STS 0x8000
515#define WM8350_LDO4_STS 0x0800
516#define WM8350_LDO3_STS 0x0400
517#define WM8350_LDO2_STS 0x0200
518#define WM8350_LDO1_STS 0x0100
519#define WM8350_DC6_STS 0x0020
520#define WM8350_DC5_STS 0x0010
521#define WM8350_DC4_STS 0x0008
522#define WM8350_DC3_STS 0x0004
523#define WM8350_DC2_STS 0x0002
524#define WM8350_DC1_STS 0x0001
525
526/* WM8350 wake up conditions */
527#define WM8350_IRQ_WKUP_OFF_STATE 43
528#define WM8350_IRQ_WKUP_HIB_STATE 44
529#define WM8350_IRQ_WKUP_CONV_FAULT 45
530#define WM8350_IRQ_WKUP_WDOG_RST 46
531#define WM8350_IRQ_WKUP_GP_PWR_ON 47
532#define WM8350_IRQ_WKUP_ONKEY 48
533#define WM8350_IRQ_WKUP_GP_WAKEUP 49
534
535/* wm8350 chip revisions */
536#define WM8350_REV_E 0x4
537#define WM8350_REV_F 0x5
538#define WM8350_REV_G 0x6
539
540#define WM8350_NUM_IRQ 63
541
542struct wm8350_reg_access {
543 u16 readable; /* Mask of readable bits */
544 u16 writable; /* Mask of writable bits */
545 u16 vol; /* Mask of volatile bits */
546};
547extern const struct wm8350_reg_access wm8350_reg_io_map[];
548extern const u16 wm8350_mode0_defaults[];
549extern const u16 wm8350_mode1_defaults[];
550extern const u16 wm8350_mode2_defaults[];
551extern const u16 wm8350_mode3_defaults[];
552
553struct wm8350;
554
555struct wm8350_irq {
556 void (*handler) (struct wm8350 *, int, void *);
557 void *data;
558};
559
560struct wm8350 {
561 int rev; /* chip revision */
562
563 struct device *dev;
564
565 /* device IO */
566 union {
567 struct i2c_client *i2c_client;
568 struct spi_device *spi_device;
569 };
570 int (*read_dev)(struct wm8350 *wm8350, char reg, int size, void *dest);
571 int (*write_dev)(struct wm8350 *wm8350, char reg, int size,
572 void *src);
573 u16 *reg_cache;
574
575 /* Interrupt handling */
576 struct work_struct irq_work;
577 struct mutex irq_mutex; /* IRQ table mutex */
578 struct wm8350_irq irq[WM8350_NUM_IRQ];
579 int chip_irq;
580
581 /* Client devices */
582 struct wm8350_codec codec;
583 struct wm8350_gpio gpio;
584 struct wm8350_pmic pmic;
585 struct wm8350_power power;
586 struct wm8350_rtc rtc;
587 struct wm8350_wdt wdt;
588};
589
590/**
591 * Data to be supplied by the platform to initialise the WM8350.
592 *
593 * @init: Function called during driver initialisation. Should be
594 * used by the platform to configure GPIO functions and similar.
595 */
596struct wm8350_platform_data {
597 int (*init)(struct wm8350 *wm8350);
598};
599
600
601/*
602 * WM8350 device initialisation and exit.
603 */
604int wm8350_device_init(struct wm8350 *wm8350, int irq,
605 struct wm8350_platform_data *pdata);
606void wm8350_device_exit(struct wm8350 *wm8350);
607
608/*
609 * WM8350 device IO
610 */
611int wm8350_clear_bits(struct wm8350 *wm8350, u16 reg, u16 mask);
612int wm8350_set_bits(struct wm8350 *wm8350, u16 reg, u16 mask);
613u16 wm8350_reg_read(struct wm8350 *wm8350, int reg);
614int wm8350_reg_write(struct wm8350 *wm8350, int reg, u16 val);
615int wm8350_reg_lock(struct wm8350 *wm8350);
616int wm8350_reg_unlock(struct wm8350 *wm8350);
617int wm8350_block_read(struct wm8350 *wm8350, int reg, int size, u16 *dest);
618int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src);
619
620/*
621 * WM8350 internal interrupts
622 */
623int wm8350_register_irq(struct wm8350 *wm8350, int irq,
624 void (*handler) (struct wm8350 *, int, void *),
625 void *data);
626int wm8350_free_irq(struct wm8350 *wm8350, int irq);
627int wm8350_mask_irq(struct wm8350 *wm8350, int irq);
628int wm8350_unmask_irq(struct wm8350 *wm8350, int irq);
629
630
631#endif
diff --git a/include/linux/mfd/wm8350/gpio.h b/include/linux/mfd/wm8350/gpio.h
new file mode 100644
index 000000000000..ed91e8f5d298
--- /dev/null
+++ b/include/linux/mfd/wm8350/gpio.h
@@ -0,0 +1,342 @@
1/*
2 * gpio.h -- GPIO Driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __LINUX_MFD_WM8350_GPIO_H_
14#define __LINUX_MFD_WM8350_GPIO_H_
15
16#include <linux/platform_device.h>
17
18/*
19 * GPIO Registers.
20 */
21#define WM8350_GPIO_DEBOUNCE 0x80
22#define WM8350_GPIO_PIN_PULL_UP_CONTROL 0x81
23#define WM8350_GPIO_PULL_DOWN_CONTROL 0x82
24#define WM8350_GPIO_INT_MODE 0x83
25#define WM8350_GPIO_CONTROL 0x85
26#define WM8350_GPIO_CONFIGURATION_I_O 0x86
27#define WM8350_GPIO_PIN_POLARITY_TYPE 0x87
28#define WM8350_GPIO_FUNCTION_SELECT_1 0x8C
29#define WM8350_GPIO_FUNCTION_SELECT_2 0x8D
30#define WM8350_GPIO_FUNCTION_SELECT_3 0x8E
31#define WM8350_GPIO_FUNCTION_SELECT_4 0x8F
32
33/*
34 * GPIO Functions
35 */
36#define WM8350_GPIO0_GPIO_IN 0x0
37#define WM8350_GPIO0_GPIO_OUT 0x0
38#define WM8350_GPIO0_PWR_ON_IN 0x1
39#define WM8350_GPIO0_PWR_ON_OUT 0x1
40#define WM8350_GPIO0_LDO_EN_IN 0x2
41#define WM8350_GPIO0_VRTC_OUT 0x2
42#define WM8350_GPIO0_LPWR1_IN 0x3
43#define WM8350_GPIO0_POR_B_OUT 0x3
44
45#define WM8350_GPIO1_GPIO_IN 0x0
46#define WM8350_GPIO1_GPIO_OUT 0x0
47#define WM8350_GPIO1_PWR_ON_IN 0x1
48#define WM8350_GPIO1_DO_CONF_OUT 0x1
49#define WM8350_GPIO1_LDO_EN_IN 0x2
50#define WM8350_GPIO1_RESET_OUT 0x2
51#define WM8350_GPIO1_LPWR2_IN 0x3
52#define WM8350_GPIO1_MEMRST_OUT 0x3
53
54#define WM8350_GPIO2_GPIO_IN 0x0
55#define WM8350_GPIO2_GPIO_OUT 0x0
56#define WM8350_GPIO2_PWR_ON_IN 0x1
57#define WM8350_GPIO2_PWR_ON_OUT 0x1
58#define WM8350_GPIO2_WAKE_UP_IN 0x2
59#define WM8350_GPIO2_VRTC_OUT 0x2
60#define WM8350_GPIO2_32KHZ_IN 0x3
61#define WM8350_GPIO2_32KHZ_OUT 0x3
62
63#define WM8350_GPIO3_GPIO_IN 0x0
64#define WM8350_GPIO3_GPIO_OUT 0x0
65#define WM8350_GPIO3_PWR_ON_IN 0x1
66#define WM8350_GPIO3_P_CLK_OUT 0x1
67#define WM8350_GPIO3_LDO_EN_IN 0x2
68#define WM8350_GPIO3_VRTC_OUT 0x2
69#define WM8350_GPIO3_PWR_OFF_IN 0x3
70#define WM8350_GPIO3_32KHZ_OUT 0x3
71
72#define WM8350_GPIO4_GPIO_IN 0x0
73#define WM8350_GPIO4_GPIO_OUT 0x0
74#define WM8350_GPIO4_MR_IN 0x1
75#define WM8350_GPIO4_MEM_RST_OUT 0x1
76#define WM8350_GPIO4_FLASH_IN 0x2
77#define WM8350_GPIO4_ADA_OUT 0x2
78#define WM8350_GPIO4_HIBERNATE_IN 0x3
79#define WM8350_GPIO4_FLASH_OUT 0x3
80#define WM8350_GPIO4_MICDET_OUT 0x4
81#define WM8350_GPIO4_MICSHT_OUT 0x5
82
83#define WM8350_GPIO5_GPIO_IN 0x0
84#define WM8350_GPIO5_GPIO_OUT 0x0
85#define WM8350_GPIO5_LPWR1_IN 0x1
86#define WM8350_GPIO5_P_CLK_OUT 0x1
87#define WM8350_GPIO5_ADCLRCLK_IN 0x2
88#define WM8350_GPIO5_ADCLRCLK_OUT 0x2
89#define WM8350_GPIO5_HIBERNATE_IN 0x3
90#define WM8350_GPIO5_32KHZ_OUT 0x3
91#define WM8350_GPIO5_MICDET_OUT 0x4
92#define WM8350_GPIO5_MICSHT_OUT 0x5
93#define WM8350_GPIO5_ADA_OUT 0x6
94#define WM8350_GPIO5_OPCLK_OUT 0x7
95
96#define WM8350_GPIO6_GPIO_IN 0x0
97#define WM8350_GPIO6_GPIO_OUT 0x0
98#define WM8350_GPIO6_LPWR2_IN 0x1
99#define WM8350_GPIO6_MEMRST_OUT 0x1
100#define WM8350_GPIO6_FLASH_IN 0x2
101#define WM8350_GPIO6_ADA_OUT 0x2
102#define WM8350_GPIO6_HIBERNATE_IN 0x3
103#define WM8350_GPIO6_RTC_OUT 0x3
104#define WM8350_GPIO6_MICDET_OUT 0x4
105#define WM8350_GPIO6_MICSHT_OUT 0x5
106#define WM8350_GPIO6_ADCLRCLKB_OUT 0x6
107#define WM8350_GPIO6_SDOUT_OUT 0x7
108
109#define WM8350_GPIO7_GPIO_IN 0x0
110#define WM8350_GPIO7_GPIO_OUT 0x0
111#define WM8350_GPIO7_LPWR3_IN 0x1
112#define WM8350_GPIO7_P_CLK_OUT 0x1
113#define WM8350_GPIO7_MASK_IN 0x2
114#define WM8350_GPIO7_VCC_FAULT_OUT 0x2
115#define WM8350_GPIO7_HIBERNATE_IN 0x3
116#define WM8350_GPIO7_BATT_FAULT_OUT 0x3
117#define WM8350_GPIO7_MICDET_OUT 0x4
118#define WM8350_GPIO7_MICSHT_OUT 0x5
119#define WM8350_GPIO7_ADA_OUT 0x6
120#define WM8350_GPIO7_CSB_IN 0x7
121
122#define WM8350_GPIO8_GPIO_IN 0x0
123#define WM8350_GPIO8_GPIO_OUT 0x0
124#define WM8350_GPIO8_MR_IN 0x1
125#define WM8350_GPIO8_VCC_FAULT_OUT 0x1
126#define WM8350_GPIO8_ADCBCLK_IN 0x2
127#define WM8350_GPIO8_ADCBCLK_OUT 0x2
128#define WM8350_GPIO8_PWR_OFF_IN 0x3
129#define WM8350_GPIO8_BATT_FAULT_OUT 0x3
130#define WM8350_GPIO8_ALTSCL_IN 0xf
131
132#define WM8350_GPIO9_GPIO_IN 0x0
133#define WM8350_GPIO9_GPIO_OUT 0x0
134#define WM8350_GPIO9_HEARTBEAT_IN 0x1
135#define WM8350_GPIO9_VCC_FAULT_OUT 0x1
136#define WM8350_GPIO9_MASK_IN 0x2
137#define WM8350_GPIO9_LINE_GT_BATT_OUT 0x2
138#define WM8350_GPIO9_PWR_OFF_IN 0x3
139#define WM8350_GPIO9_BATT_FAULT_OUT 0x3
140#define WM8350_GPIO9_ALTSDA_OUT 0xf
141
142#define WM8350_GPIO10_GPIO_IN 0x0
143#define WM8350_GPIO10_GPIO_OUT 0x0
144#define WM8350_GPIO10_ISINKC_OUT 0x1
145#define WM8350_GPIO10_PWR_OFF_IN 0x2
146#define WM8350_GPIO10_LINE_GT_BATT_OUT 0x2
147#define WM8350_GPIO10_CHD_IND_IN 0x3
148
149#define WM8350_GPIO11_GPIO_IN 0x0
150#define WM8350_GPIO11_GPIO_OUT 0x0
151#define WM8350_GPIO11_ISINKD_OUT 0x1
152#define WM8350_GPIO11_WAKEUP_IN 0x2
153#define WM8350_GPIO11_LINE_GT_BATT_OUT 0x2
154#define WM8350_GPIO11_CHD_IND_IN 0x3
155
156#define WM8350_GPIO12_GPIO_IN 0x0
157#define WM8350_GPIO12_GPIO_OUT 0x0
158#define WM8350_GPIO12_ISINKE_OUT 0x1
159#define WM8350_GPIO12_LINE_GT_BATT_OUT 0x2
160#define WM8350_GPIO12_LINE_EN_OUT 0x3
161#define WM8350_GPIO12_32KHZ_OUT 0x4
162
163#define WM8350_GPIO_DIR_IN 0
164#define WM8350_GPIO_DIR_OUT 1
165#define WM8350_GPIO_ACTIVE_LOW 0
166#define WM8350_GPIO_ACTIVE_HIGH 1
167#define WM8350_GPIO_PULL_NONE 0
168#define WM8350_GPIO_PULL_UP 1
169#define WM8350_GPIO_PULL_DOWN 2
170#define WM8350_GPIO_INVERT_OFF 0
171#define WM8350_GPIO_INVERT_ON 1
172#define WM8350_GPIO_DEBOUNCE_OFF 0
173#define WM8350_GPIO_DEBOUNCE_ON 1
174
175/*
176 * R128 (0x80) - GPIO Debounce
177 */
178#define WM8350_GP12_DB 0x1000
179#define WM8350_GP11_DB 0x0800
180#define WM8350_GP10_DB 0x0400
181#define WM8350_GP9_DB 0x0200
182#define WM8350_GP8_DB 0x0100
183#define WM8350_GP7_DB 0x0080
184#define WM8350_GP6_DB 0x0040
185#define WM8350_GP5_DB 0x0020
186#define WM8350_GP4_DB 0x0010
187#define WM8350_GP3_DB 0x0008
188#define WM8350_GP2_DB 0x0004
189#define WM8350_GP1_DB 0x0002
190#define WM8350_GP0_DB 0x0001
191
192/*
193 * R129 (0x81) - GPIO Pin pull up Control
194 */
195#define WM8350_GP12_PU 0x1000
196#define WM8350_GP11_PU 0x0800
197#define WM8350_GP10_PU 0x0400
198#define WM8350_GP9_PU 0x0200
199#define WM8350_GP8_PU 0x0100
200#define WM8350_GP7_PU 0x0080
201#define WM8350_GP6_PU 0x0040
202#define WM8350_GP5_PU 0x0020
203#define WM8350_GP4_PU 0x0010
204#define WM8350_GP3_PU 0x0008
205#define WM8350_GP2_PU 0x0004
206#define WM8350_GP1_PU 0x0002
207#define WM8350_GP0_PU 0x0001
208
209/*
210 * R130 (0x82) - GPIO Pull down Control
211 */
212#define WM8350_GP12_PD 0x1000
213#define WM8350_GP11_PD 0x0800
214#define WM8350_GP10_PD 0x0400
215#define WM8350_GP9_PD 0x0200
216#define WM8350_GP8_PD 0x0100
217#define WM8350_GP7_PD 0x0080
218#define WM8350_GP6_PD 0x0040
219#define WM8350_GP5_PD 0x0020
220#define WM8350_GP4_PD 0x0010
221#define WM8350_GP3_PD 0x0008
222#define WM8350_GP2_PD 0x0004
223#define WM8350_GP1_PD 0x0002
224#define WM8350_GP0_PD 0x0001
225
226/*
227 * R131 (0x83) - GPIO Interrupt Mode
228 */
229#define WM8350_GP12_INTMODE 0x1000
230#define WM8350_GP11_INTMODE 0x0800
231#define WM8350_GP10_INTMODE 0x0400
232#define WM8350_GP9_INTMODE 0x0200
233#define WM8350_GP8_INTMODE 0x0100
234#define WM8350_GP7_INTMODE 0x0080
235#define WM8350_GP6_INTMODE 0x0040
236#define WM8350_GP5_INTMODE 0x0020
237#define WM8350_GP4_INTMODE 0x0010
238#define WM8350_GP3_INTMODE 0x0008
239#define WM8350_GP2_INTMODE 0x0004
240#define WM8350_GP1_INTMODE 0x0002
241#define WM8350_GP0_INTMODE 0x0001
242
243/*
244 * R133 (0x85) - GPIO Control
245 */
246#define WM8350_GP_DBTIME_MASK 0x00C0
247
248/*
249 * R134 (0x86) - GPIO Configuration (i/o)
250 */
251#define WM8350_GP12_DIR 0x1000
252#define WM8350_GP11_DIR 0x0800
253#define WM8350_GP10_DIR 0x0400
254#define WM8350_GP9_DIR 0x0200
255#define WM8350_GP8_DIR 0x0100
256#define WM8350_GP7_DIR 0x0080
257#define WM8350_GP6_DIR 0x0040
258#define WM8350_GP5_DIR 0x0020
259#define WM8350_GP4_DIR 0x0010
260#define WM8350_GP3_DIR 0x0008
261#define WM8350_GP2_DIR 0x0004
262#define WM8350_GP1_DIR 0x0002
263#define WM8350_GP0_DIR 0x0001
264
265/*
266 * R135 (0x87) - GPIO Pin Polarity / Type
267 */
268#define WM8350_GP12_CFG 0x1000
269#define WM8350_GP11_CFG 0x0800
270#define WM8350_GP10_CFG 0x0400
271#define WM8350_GP9_CFG 0x0200
272#define WM8350_GP8_CFG 0x0100
273#define WM8350_GP7_CFG 0x0080
274#define WM8350_GP6_CFG 0x0040
275#define WM8350_GP5_CFG 0x0020
276#define WM8350_GP4_CFG 0x0010
277#define WM8350_GP3_CFG 0x0008
278#define WM8350_GP2_CFG 0x0004
279#define WM8350_GP1_CFG 0x0002
280#define WM8350_GP0_CFG 0x0001
281
282/*
283 * R140 (0x8C) - GPIO Function Select 1
284 */
285#define WM8350_GP3_FN_MASK 0xF000
286#define WM8350_GP2_FN_MASK 0x0F00
287#define WM8350_GP1_FN_MASK 0x00F0
288#define WM8350_GP0_FN_MASK 0x000F
289
290/*
291 * R141 (0x8D) - GPIO Function Select 2
292 */
293#define WM8350_GP7_FN_MASK 0xF000
294#define WM8350_GP6_FN_MASK 0x0F00
295#define WM8350_GP5_FN_MASK 0x00F0
296#define WM8350_GP4_FN_MASK 0x000F
297
298/*
299 * R142 (0x8E) - GPIO Function Select 3
300 */
301#define WM8350_GP11_FN_MASK 0xF000
302#define WM8350_GP10_FN_MASK 0x0F00
303#define WM8350_GP9_FN_MASK 0x00F0
304#define WM8350_GP8_FN_MASK 0x000F
305
306/*
307 * R143 (0x8F) - GPIO Function Select 4
308 */
309#define WM8350_GP12_FN_MASK 0x000F
310
311/*
312 * R230 (0xE6) - GPIO Pin Status
313 */
314#define WM8350_GP12_LVL 0x1000
315#define WM8350_GP11_LVL 0x0800
316#define WM8350_GP10_LVL 0x0400
317#define WM8350_GP9_LVL 0x0200
318#define WM8350_GP8_LVL 0x0100
319#define WM8350_GP7_LVL 0x0080
320#define WM8350_GP6_LVL 0x0040
321#define WM8350_GP5_LVL 0x0020
322#define WM8350_GP4_LVL 0x0010
323#define WM8350_GP3_LVL 0x0008
324#define WM8350_GP2_LVL 0x0004
325#define WM8350_GP1_LVL 0x0002
326#define WM8350_GP0_LVL 0x0001
327
328struct wm8350;
329
330int wm8350_gpio_config(struct wm8350 *wm8350, int gpio, int dir, int func,
331 int pol, int pull, int invert, int debounce);
332
333struct wm8350_gpio {
334 struct platform_device *pdev;
335};
336
337/*
338 * GPIO Interrupts
339 */
340#define WM8350_IRQ_GPIO(x) (50 + x)
341
342#endif
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h
new file mode 100644
index 000000000000..69b69e07f62f
--- /dev/null
+++ b/include/linux/mfd/wm8350/pmic.h
@@ -0,0 +1,741 @@
1/*
2 * pmic.h -- Power Managment Driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __LINUX_MFD_WM8350_PMIC_H
14#define __LINUX_MFD_WM8350_PMIC_H
15
16/*
17 * Register values.
18 */
19
20#define WM8350_CURRENT_SINK_DRIVER_A 0xAC
21#define WM8350_CSA_FLASH_CONTROL 0xAD
22#define WM8350_CURRENT_SINK_DRIVER_B 0xAE
23#define WM8350_CSB_FLASH_CONTROL 0xAF
24#define WM8350_DCDC_LDO_REQUESTED 0xB0
25#define WM8350_DCDC_ACTIVE_OPTIONS 0xB1
26#define WM8350_DCDC_SLEEP_OPTIONS 0xB2
27#define WM8350_POWER_CHECK_COMPARATOR 0xB3
28#define WM8350_DCDC1_CONTROL 0xB4
29#define WM8350_DCDC1_TIMEOUTS 0xB5
30#define WM8350_DCDC1_LOW_POWER 0xB6
31#define WM8350_DCDC2_CONTROL 0xB7
32#define WM8350_DCDC2_TIMEOUTS 0xB8
33#define WM8350_DCDC3_CONTROL 0xBA
34#define WM8350_DCDC3_TIMEOUTS 0xBB
35#define WM8350_DCDC3_LOW_POWER 0xBC
36#define WM8350_DCDC4_CONTROL 0xBD
37#define WM8350_DCDC4_TIMEOUTS 0xBE
38#define WM8350_DCDC4_LOW_POWER 0xBF
39#define WM8350_DCDC5_CONTROL 0xC0
40#define WM8350_DCDC5_TIMEOUTS 0xC1
41#define WM8350_DCDC6_CONTROL 0xC3
42#define WM8350_DCDC6_TIMEOUTS 0xC4
43#define WM8350_DCDC6_LOW_POWER 0xC5
44#define WM8350_LIMIT_SWITCH_CONTROL 0xC7
45#define WM8350_LDO1_CONTROL 0xC8
46#define WM8350_LDO1_TIMEOUTS 0xC9
47#define WM8350_LDO1_LOW_POWER 0xCA
48#define WM8350_LDO2_CONTROL 0xCB
49#define WM8350_LDO2_TIMEOUTS 0xCC
50#define WM8350_LDO2_LOW_POWER 0xCD
51#define WM8350_LDO3_CONTROL 0xCE
52#define WM8350_LDO3_TIMEOUTS 0xCF
53#define WM8350_LDO3_LOW_POWER 0xD0
54#define WM8350_LDO4_CONTROL 0xD1
55#define WM8350_LDO4_TIMEOUTS 0xD2
56#define WM8350_LDO4_LOW_POWER 0xD3
57#define WM8350_VCC_FAULT_MASKS 0xD7
58#define WM8350_MAIN_BANDGAP_CONTROL 0xD8
59#define WM8350_OSC_CONTROL 0xD9
60#define WM8350_RTC_TICK_CONTROL 0xDA
61#define WM8350_SECURITY 0xDB
62#define WM8350_RAM_BIST_1 0xDC
63#define WM8350_DCDC_LDO_STATUS 0xE1
64#define WM8350_GPIO_PIN_STATUS 0xE6
65
66#define WM8350_DCDC1_FORCE_PWM 0xF8
67#define WM8350_DCDC3_FORCE_PWM 0xFA
68#define WM8350_DCDC4_FORCE_PWM 0xFB
69#define WM8350_DCDC6_FORCE_PWM 0xFD
70
71/*
72 * R172 (0xAC) - Current Sink Driver A
73 */
74#define WM8350_CS1_HIB_MODE 0x1000
75#define WM8350_CS1_HIB_MODE_MASK 0x1000
76#define WM8350_CS1_HIB_MODE_SHIFT 12
77#define WM8350_CS1_ISEL_MASK 0x003F
78#define WM8350_CS1_ISEL_SHIFT 0
79
80/* Bit values for R172 (0xAC) */
81#define WM8350_CS1_HIB_MODE_DISABLE 0
82#define WM8350_CS1_HIB_MODE_LEAVE 1
83
84#define WM8350_CS1_ISEL_220M 0x3F
85
86/*
87 * R173 (0xAD) - CSA Flash control
88 */
89#define WM8350_CS1_FLASH_MODE 0x8000
90#define WM8350_CS1_TRIGSRC 0x4000
91#define WM8350_CS1_DRIVE 0x2000
92#define WM8350_CS1_FLASH_DUR_MASK 0x0300
93#define WM8350_CS1_OFF_RAMP_MASK 0x0030
94#define WM8350_CS1_ON_RAMP_MASK 0x0003
95
96/*
97 * R174 (0xAE) - Current Sink Driver B
98 */
99#define WM8350_CS2_HIB_MODE 0x1000
100#define WM8350_CS2_ISEL_MASK 0x003F
101
102/*
103 * R175 (0xAF) - CSB Flash control
104 */
105#define WM8350_CS2_FLASH_MODE 0x8000
106#define WM8350_CS2_TRIGSRC 0x4000
107#define WM8350_CS2_DRIVE 0x2000
108#define WM8350_CS2_FLASH_DUR_MASK 0x0300
109#define WM8350_CS2_OFF_RAMP_MASK 0x0030
110#define WM8350_CS2_ON_RAMP_MASK 0x0003
111
112/*
113 * R176 (0xB0) - DCDC/LDO requested
114 */
115#define WM8350_LS_ENA 0x8000
116#define WM8350_LDO4_ENA 0x0800
117#define WM8350_LDO3_ENA 0x0400
118#define WM8350_LDO2_ENA 0x0200
119#define WM8350_LDO1_ENA 0x0100
120#define WM8350_DC6_ENA 0x0020
121#define WM8350_DC5_ENA 0x0010
122#define WM8350_DC4_ENA 0x0008
123#define WM8350_DC3_ENA 0x0004
124#define WM8350_DC2_ENA 0x0002
125#define WM8350_DC1_ENA 0x0001
126
127/*
128 * R177 (0xB1) - DCDC Active options
129 */
130#define WM8350_PUTO_MASK 0x3000
131#define WM8350_PWRUP_DELAY_MASK 0x0300
132#define WM8350_DC6_ACTIVE 0x0020
133#define WM8350_DC4_ACTIVE 0x0008
134#define WM8350_DC3_ACTIVE 0x0004
135#define WM8350_DC1_ACTIVE 0x0001
136
137/*
138 * R178 (0xB2) - DCDC Sleep options
139 */
140#define WM8350_DC6_SLEEP 0x0020
141#define WM8350_DC4_SLEEP 0x0008
142#define WM8350_DC3_SLEEP 0x0004
143#define WM8350_DC1_SLEEP 0x0001
144
145/*
146 * R179 (0xB3) - Power-check comparator
147 */
148#define WM8350_PCCMP_ERRACT 0x4000
149#define WM8350_PCCMP_RAIL 0x0100
150#define WM8350_PCCMP_OFF_THR_MASK 0x0070
151#define WM8350_PCCMP_ON_THR_MASK 0x0007
152
153/*
154 * R180 (0xB4) - DCDC1 Control
155 */
156#define WM8350_DC1_OPFLT 0x0400
157#define WM8350_DC1_VSEL_MASK 0x007F
158#define WM8350_DC1_VSEL_SHIFT 0
159
160/*
161 * R181 (0xB5) - DCDC1 Timeouts
162 */
163#define WM8350_DC1_ERRACT_MASK 0xC000
164#define WM8350_DC1_ERRACT_SHIFT 14
165#define WM8350_DC1_ENSLOT_MASK 0x3C00
166#define WM8350_DC1_ENSLOT_SHIFT 10
167#define WM8350_DC1_SDSLOT_MASK 0x03C0
168#define WM8350_DC1_UVTO_MASK 0x0030
169#define WM8350_DC1_SDSLOT_SHIFT 6
170
171/* Bit values for R181 (0xB5) */
172#define WM8350_DC1_ERRACT_NONE 0
173#define WM8350_DC1_ERRACT_SHUTDOWN_CONV 1
174#define WM8350_DC1_ERRACT_SHUTDOWN_SYS 2
175
176/*
177 * R182 (0xB6) - DCDC1 Low Power
178 */
179#define WM8350_DC1_HIB_MODE_MASK 0x7000
180#define WM8350_DC1_HIB_TRIG_MASK 0x0300
181#define WM8350_DC1_VIMG_MASK 0x007F
182
183/*
184 * R183 (0xB7) - DCDC2 Control
185 */
186#define WM8350_DC2_MODE 0x4000
187#define WM8350_DC2_MODE_MASK 0x4000
188#define WM8350_DC2_MODE_SHIFT 14
189#define WM8350_DC2_HIB_MODE 0x1000
190#define WM8350_DC2_HIB_MODE_MASK 0x1000
191#define WM8350_DC2_HIB_MODE_SHIFT 12
192#define WM8350_DC2_HIB_TRIG_MASK 0x0300
193#define WM8350_DC2_HIB_TRIG_SHIFT 8
194#define WM8350_DC2_ILIM 0x0040
195#define WM8350_DC2_ILIM_MASK 0x0040
196#define WM8350_DC2_ILIM_SHIFT 6
197#define WM8350_DC2_RMP_MASK 0x0018
198#define WM8350_DC2_RMP_SHIFT 3
199#define WM8350_DC2_FBSRC_MASK 0x0003
200#define WM8350_DC2_FBSRC_SHIFT 0
201
202/* Bit values for R183 (0xB7) */
203#define WM8350_DC2_MODE_BOOST 0
204#define WM8350_DC2_MODE_SWITCH 1
205
206#define WM8350_DC2_HIB_MODE_ACTIVE 1
207#define WM8350_DC2_HIB_MODE_DISABLE 0
208
209#define WM8350_DC2_HIB_TRIG_NONE 0
210#define WM8350_DC2_HIB_TRIG_LPWR1 1
211#define WM8350_DC2_HIB_TRIG_LPWR2 2
212#define WM8350_DC2_HIB_TRIG_LPWR3 3
213
214#define WM8350_DC2_ILIM_HIGH 0
215#define WM8350_DC2_ILIM_LOW 1
216
217#define WM8350_DC2_RMP_30V 0
218#define WM8350_DC2_RMP_20V 1
219#define WM8350_DC2_RMP_10V 2
220#define WM8350_DC2_RMP_5V 3
221
222#define WM8350_DC2_FBSRC_FB2 0
223#define WM8350_DC2_FBSRC_ISINKA 1
224#define WM8350_DC2_FBSRC_ISINKB 2
225#define WM8350_DC2_FBSRC_USB 3
226
227/*
228 * R184 (0xB8) - DCDC2 Timeouts
229 */
230#define WM8350_DC2_ERRACT_MASK 0xC000
231#define WM8350_DC2_ERRACT_SHIFT 14
232#define WM8350_DC2_ENSLOT_MASK 0x3C00
233#define WM8350_DC2_ENSLOT_SHIFT 10
234#define WM8350_DC2_SDSLOT_MASK 0x03C0
235#define WM8350_DC2_UVTO_MASK 0x0030
236
237/* Bit values for R184 (0xB8) */
238#define WM8350_DC2_ERRACT_NONE 0
239#define WM8350_DC2_ERRACT_SHUTDOWN_CONV 1
240#define WM8350_DC2_ERRACT_SHUTDOWN_SYS 2
241
242/*
243 * R186 (0xBA) - DCDC3 Control
244 */
245#define WM8350_DC3_OPFLT 0x0400
246#define WM8350_DC3_VSEL_MASK 0x007F
247#define WM8350_DC3_VSEL_SHIFT 0
248
249/*
250 * R187 (0xBB) - DCDC3 Timeouts
251 */
252#define WM8350_DC3_ERRACT_MASK 0xC000
253#define WM8350_DC3_ERRACT_SHIFT 14
254#define WM8350_DC3_ENSLOT_MASK 0x3C00
255#define WM8350_DC3_ENSLOT_SHIFT 10
256#define WM8350_DC3_SDSLOT_MASK 0x03C0
257#define WM8350_DC3_UVTO_MASK 0x0030
258#define WM8350_DC3_SDSLOT_SHIFT 6
259
260/* Bit values for R187 (0xBB) */
261#define WM8350_DC3_ERRACT_NONE 0
262#define WM8350_DC3_ERRACT_SHUTDOWN_CONV 1
263#define WM8350_DC3_ERRACT_SHUTDOWN_SYS 2
264/*
265 * R188 (0xBC) - DCDC3 Low Power
266 */
267#define WM8350_DC3_HIB_MODE_MASK 0x7000
268#define WM8350_DC3_HIB_TRIG_MASK 0x0300
269#define WM8350_DC3_VIMG_MASK 0x007F
270
271/*
272 * R189 (0xBD) - DCDC4 Control
273 */
274#define WM8350_DC4_OPFLT 0x0400
275#define WM8350_DC4_VSEL_MASK 0x007F
276#define WM8350_DC4_VSEL_SHIFT 0
277
278/*
279 * R190 (0xBE) - DCDC4 Timeouts
280 */
281#define WM8350_DC4_ERRACT_MASK 0xC000
282#define WM8350_DC4_ERRACT_SHIFT 14
283#define WM8350_DC4_ENSLOT_MASK 0x3C00
284#define WM8350_DC4_ENSLOT_SHIFT 10
285#define WM8350_DC4_SDSLOT_MASK 0x03C0
286#define WM8350_DC4_UVTO_MASK 0x0030
287#define WM8350_DC4_SDSLOT_SHIFT 6
288
289/* Bit values for R190 (0xBE) */
290#define WM8350_DC4_ERRACT_NONE 0
291#define WM8350_DC4_ERRACT_SHUTDOWN_CONV 1
292#define WM8350_DC4_ERRACT_SHUTDOWN_SYS 2
293
294/*
295 * R191 (0xBF) - DCDC4 Low Power
296 */
297#define WM8350_DC4_HIB_MODE_MASK 0x7000
298#define WM8350_DC4_HIB_TRIG_MASK 0x0300
299#define WM8350_DC4_VIMG_MASK 0x007F
300
301/*
302 * R192 (0xC0) - DCDC5 Control
303 */
304#define WM8350_DC5_MODE 0x4000
305#define WM8350_DC5_MODE_MASK 0x4000
306#define WM8350_DC5_MODE_SHIFT 14
307#define WM8350_DC5_HIB_MODE 0x1000
308#define WM8350_DC5_HIB_MODE_MASK 0x1000
309#define WM8350_DC5_HIB_MODE_SHIFT 12
310#define WM8350_DC5_HIB_TRIG_MASK 0x0300
311#define WM8350_DC5_HIB_TRIG_SHIFT 8
312#define WM8350_DC5_ILIM 0x0040
313#define WM8350_DC5_ILIM_MASK 0x0040
314#define WM8350_DC5_ILIM_SHIFT 6
315#define WM8350_DC5_RMP_MASK 0x0018
316#define WM8350_DC5_RMP_SHIFT 3
317#define WM8350_DC5_FBSRC_MASK 0x0003
318#define WM8350_DC5_FBSRC_SHIFT 0
319
320/* Bit values for R192 (0xC0) */
321#define WM8350_DC5_MODE_BOOST 0
322#define WM8350_DC5_MODE_SWITCH 1
323
324#define WM8350_DC5_HIB_MODE_ACTIVE 1
325#define WM8350_DC5_HIB_MODE_DISABLE 0
326
327#define WM8350_DC5_HIB_TRIG_NONE 0
328#define WM8350_DC5_HIB_TRIG_LPWR1 1
329#define WM8350_DC5_HIB_TRIG_LPWR2 2
330#define WM8350_DC5_HIB_TRIG_LPWR3 3
331
332#define WM8350_DC5_ILIM_HIGH 0
333#define WM8350_DC5_ILIM_LOW 1
334
335#define WM8350_DC5_RMP_30V 0
336#define WM8350_DC5_RMP_20V 1
337#define WM8350_DC5_RMP_10V 2
338#define WM8350_DC5_RMP_5V 3
339
340#define WM8350_DC5_FBSRC_FB2 0
341#define WM8350_DC5_FBSRC_ISINKA 1
342#define WM8350_DC5_FBSRC_ISINKB 2
343#define WM8350_DC5_FBSRC_USB 3
344
345/*
346 * R193 (0xC1) - DCDC5 Timeouts
347 */
348#define WM8350_DC5_ERRACT_MASK 0xC000
349#define WM8350_DC5_ERRACT_SHIFT 14
350#define WM8350_DC5_ENSLOT_MASK 0x3C00
351#define WM8350_DC5_ENSLOT_SHIFT 10
352#define WM8350_DC5_SDSLOT_MASK 0x03C0
353#define WM8350_DC5_UVTO_MASK 0x0030
354#define WM8350_DC5_SDSLOT_SHIFT 6
355
356/* Bit values for R193 (0xC1) */
357#define WM8350_DC5_ERRACT_NONE 0
358#define WM8350_DC5_ERRACT_SHUTDOWN_CONV 1
359#define WM8350_DC5_ERRACT_SHUTDOWN_SYS 2
360
361/*
362 * R195 (0xC3) - DCDC6 Control
363 */
364#define WM8350_DC6_OPFLT 0x0400
365#define WM8350_DC6_VSEL_MASK 0x007F
366#define WM8350_DC6_VSEL_SHIFT 0
367
368/*
369 * R196 (0xC4) - DCDC6 Timeouts
370 */
371#define WM8350_DC6_ERRACT_MASK 0xC000
372#define WM8350_DC6_ERRACT_SHIFT 14
373#define WM8350_DC6_ENSLOT_MASK 0x3C00
374#define WM8350_DC6_ENSLOT_SHIFT 10
375#define WM8350_DC6_SDSLOT_MASK 0x03C0
376#define WM8350_DC6_UVTO_MASK 0x0030
377#define WM8350_DC6_SDSLOT_SHIFT 6
378
379/* Bit values for R196 (0xC4) */
380#define WM8350_DC6_ERRACT_NONE 0
381#define WM8350_DC6_ERRACT_SHUTDOWN_CONV 1
382#define WM8350_DC6_ERRACT_SHUTDOWN_SYS 2
383
384/*
385 * R197 (0xC5) - DCDC6 Low Power
386 */
387#define WM8350_DC6_HIB_MODE_MASK 0x7000
388#define WM8350_DC6_HIB_TRIG_MASK 0x0300
389#define WM8350_DC6_VIMG_MASK 0x007F
390
391/*
392 * R199 (0xC7) - Limit Switch Control
393 */
394#define WM8350_LS_ERRACT_MASK 0xC000
395#define WM8350_LS_ERRACT_SHIFT 14
396#define WM8350_LS_ENSLOT_MASK 0x3C00
397#define WM8350_LS_ENSLOT_SHIFT 10
398#define WM8350_LS_SDSLOT_MASK 0x03C0
399#define WM8350_LS_SDSLOT_SHIFT 6
400#define WM8350_LS_HIB_MODE 0x0010
401#define WM8350_LS_HIB_MODE_MASK 0x0010
402#define WM8350_LS_HIB_MODE_SHIFT 4
403#define WM8350_LS_HIB_PROT 0x0002
404#define WM8350_LS_HIB_PROT_MASK 0x0002
405#define WM8350_LS_HIB_PROT_SHIFT 1
406#define WM8350_LS_PROT 0x0001
407#define WM8350_LS_PROT_MASK 0x0001
408#define WM8350_LS_PROT_SHIFT 0
409
410/* Bit values for R199 (0xC7) */
411#define WM8350_LS_ERRACT_NONE 0
412#define WM8350_LS_ERRACT_SHUTDOWN_CONV 1
413#define WM8350_LS_ERRACT_SHUTDOWN_SYS 2
414
415/*
416 * R200 (0xC8) - LDO1 Control
417 */
418#define WM8350_LDO1_SWI 0x4000
419#define WM8350_LDO1_OPFLT 0x0400
420#define WM8350_LDO1_VSEL_MASK 0x001F
421#define WM8350_LDO1_VSEL_SHIFT 0
422
423/*
424 * R201 (0xC9) - LDO1 Timeouts
425 */
426#define WM8350_LDO1_ERRACT_MASK 0xC000
427#define WM8350_LDO1_ERRACT_SHIFT 14
428#define WM8350_LDO1_ENSLOT_MASK 0x3C00
429#define WM8350_LDO1_ENSLOT_SHIFT 10
430#define WM8350_LDO1_SDSLOT_MASK 0x03C0
431#define WM8350_LDO1_UVTO_MASK 0x0030
432#define WM8350_LDO1_SDSLOT_SHIFT 6
433
434/* Bit values for R201 (0xC9) */
435#define WM8350_LDO1_ERRACT_NONE 0
436#define WM8350_LDO1_ERRACT_SHUTDOWN_CONV 1
437#define WM8350_LDO1_ERRACT_SHUTDOWN_SYS 2
438
439/*
440 * R202 (0xCA) - LDO1 Low Power
441 */
442#define WM8350_LDO1_HIB_MODE_MASK 0x3000
443#define WM8350_LDO1_HIB_TRIG_MASK 0x0300
444#define WM8350_LDO1_VIMG_MASK 0x001F
445#define WM8350_LDO1_HIB_MODE_DIS (0x1 << 12)
446
447
448/*
449 * R203 (0xCB) - LDO2 Control
450 */
451#define WM8350_LDO2_SWI 0x4000
452#define WM8350_LDO2_OPFLT 0x0400
453#define WM8350_LDO2_VSEL_MASK 0x001F
454#define WM8350_LDO2_VSEL_SHIFT 0
455
456/*
457 * R204 (0xCC) - LDO2 Timeouts
458 */
459#define WM8350_LDO2_ERRACT_MASK 0xC000
460#define WM8350_LDO2_ERRACT_SHIFT 14
461#define WM8350_LDO2_ENSLOT_MASK 0x3C00
462#define WM8350_LDO2_ENSLOT_SHIFT 10
463#define WM8350_LDO2_SDSLOT_MASK 0x03C0
464#define WM8350_LDO2_SDSLOT_SHIFT 6
465
466/* Bit values for R204 (0xCC) */
467#define WM8350_LDO2_ERRACT_NONE 0
468#define WM8350_LDO2_ERRACT_SHUTDOWN_CONV 1
469#define WM8350_LDO2_ERRACT_SHUTDOWN_SYS 2
470
471/*
472 * R205 (0xCD) - LDO2 Low Power
473 */
474#define WM8350_LDO2_HIB_MODE_MASK 0x3000
475#define WM8350_LDO2_HIB_TRIG_MASK 0x0300
476#define WM8350_LDO2_VIMG_MASK 0x001F
477
478/*
479 * R206 (0xCE) - LDO3 Control
480 */
481#define WM8350_LDO3_SWI 0x4000
482#define WM8350_LDO3_OPFLT 0x0400
483#define WM8350_LDO3_VSEL_MASK 0x001F
484#define WM8350_LDO3_VSEL_SHIFT 0
485
486/*
487 * R207 (0xCF) - LDO3 Timeouts
488 */
489#define WM8350_LDO3_ERRACT_MASK 0xC000
490#define WM8350_LDO3_ERRACT_SHIFT 14
491#define WM8350_LDO3_ENSLOT_MASK 0x3C00
492#define WM8350_LDO3_ENSLOT_SHIFT 10
493#define WM8350_LDO3_SDSLOT_MASK 0x03C0
494#define WM8350_LDO3_UVTO_MASK 0x0030
495#define WM8350_LDO3_SDSLOT_SHIFT 6
496
497/* Bit values for R207 (0xCF) */
498#define WM8350_LDO3_ERRACT_NONE 0
499#define WM8350_LDO3_ERRACT_SHUTDOWN_CONV 1
500#define WM8350_LDO3_ERRACT_SHUTDOWN_SYS 2
501
502/*
503 * R208 (0xD0) - LDO3 Low Power
504 */
505#define WM8350_LDO3_HIB_MODE_MASK 0x3000
506#define WM8350_LDO3_HIB_TRIG_MASK 0x0300
507#define WM8350_LDO3_VIMG_MASK 0x001F
508
509/*
510 * R209 (0xD1) - LDO4 Control
511 */
512#define WM8350_LDO4_SWI 0x4000
513#define WM8350_LDO4_OPFLT 0x0400
514#define WM8350_LDO4_VSEL_MASK 0x001F
515#define WM8350_LDO4_VSEL_SHIFT 0
516
517/*
518 * R210 (0xD2) - LDO4 Timeouts
519 */
520#define WM8350_LDO4_ERRACT_MASK 0xC000
521#define WM8350_LDO4_ERRACT_SHIFT 14
522#define WM8350_LDO4_ENSLOT_MASK 0x3C00
523#define WM8350_LDO4_ENSLOT_SHIFT 10
524#define WM8350_LDO4_SDSLOT_MASK 0x03C0
525#define WM8350_LDO4_UVTO_MASK 0x0030
526#define WM8350_LDO4_SDSLOT_SHIFT 6
527
528/* Bit values for R210 (0xD2) */
529#define WM8350_LDO4_ERRACT_NONE 0
530#define WM8350_LDO4_ERRACT_SHUTDOWN_CONV 1
531#define WM8350_LDO4_ERRACT_SHUTDOWN_SYS 2
532
533/*
534 * R211 (0xD3) - LDO4 Low Power
535 */
536#define WM8350_LDO4_HIB_MODE_MASK 0x3000
537#define WM8350_LDO4_HIB_TRIG_MASK 0x0300
538#define WM8350_LDO4_VIMG_MASK 0x001F
539
540/*
541 * R215 (0xD7) - VCC_FAULT Masks
542 */
543#define WM8350_LS_FAULT 0x8000
544#define WM8350_LDO4_FAULT 0x0800
545#define WM8350_LDO3_FAULT 0x0400
546#define WM8350_LDO2_FAULT 0x0200
547#define WM8350_LDO1_FAULT 0x0100
548#define WM8350_DC6_FAULT 0x0020
549#define WM8350_DC5_FAULT 0x0010
550#define WM8350_DC4_FAULT 0x0008
551#define WM8350_DC3_FAULT 0x0004
552#define WM8350_DC2_FAULT 0x0002
553#define WM8350_DC1_FAULT 0x0001
554
555/*
556 * R216 (0xD8) - Main Bandgap Control
557 */
558#define WM8350_MBG_LOAD_FUSES 0x8000
559#define WM8350_MBG_FUSE_WPREP 0x4000
560#define WM8350_MBG_FUSE_WRITE 0x2000
561#define WM8350_MBG_FUSE_TRIM_MASK 0x1F00
562#define WM8350_MBG_TRIM_SRC 0x0020
563#define WM8350_MBG_USER_TRIM_MASK 0x001F
564
565/*
566 * R217 (0xD9) - OSC Control
567 */
568#define WM8350_OSC_LOAD_FUSES 0x8000
569#define WM8350_OSC_FUSE_WPREP 0x4000
570#define WM8350_OSC_FUSE_WRITE 0x2000
571#define WM8350_OSC_FUSE_TRIM_MASK 0x0F00
572#define WM8350_OSC_TRIM_SRC 0x0020
573#define WM8350_OSC_USER_TRIM_MASK 0x000F
574
575/*
576 * R248 (0xF8) - DCDC1 Force PWM
577 */
578#define WM8350_DCDC1_FORCE_PWM_ENA 0x0010
579
580/*
581 * R250 (0xFA) - DCDC3 Force PWM
582 */
583#define WM8350_DCDC3_FORCE_PWM_ENA 0x0010
584
585/*
586 * R251 (0xFB) - DCDC4 Force PWM
587 */
588#define WM8350_DCDC4_FORCE_PWM_ENA 0x0010
589
590/*
591 * R253 (0xFD) - DCDC1 Force PWM
592 */
593#define WM8350_DCDC6_FORCE_PWM_ENA 0x0010
594
595/*
596 * DCDC's
597 */
598#define WM8350_DCDC_1 0
599#define WM8350_DCDC_2 1
600#define WM8350_DCDC_3 2
601#define WM8350_DCDC_4 3
602#define WM8350_DCDC_5 4
603#define WM8350_DCDC_6 5
604
605/* DCDC modes */
606#define WM8350_DCDC_ACTIVE_STANDBY 0
607#define WM8350_DCDC_ACTIVE_PULSE 1
608#define WM8350_DCDC_SLEEP_NORMAL 0
609#define WM8350_DCDC_SLEEP_LOW 1
610
611/* DCDC Low power (Hibernate) mode */
612#define WM8350_DCDC_HIB_MODE_CUR (0 << 12)
613#define WM8350_DCDC_HIB_MODE_IMAGE (1 << 12)
614#define WM8350_DCDC_HIB_MODE_STANDBY (2 << 12)
615#define WM8350_DCDC_HIB_MODE_LDO (4 << 12)
616#define WM8350_DCDC_HIB_MODE_LDO_IM (5 << 12)
617#define WM8350_DCDC_HIB_MODE_DIS (7 << 12)
618#define WM8350_DCDC_HIB_MODE_MASK (7 << 12)
619
620/* DCDC Low Power (Hibernate) signal */
621#define WM8350_DCDC_HIB_SIG_REG (0 << 8)
622#define WM8350_DCDC_HIB_SIG_LPWR1 (1 << 8)
623#define WM8350_DCDC_HIB_SIG_LPWR2 (2 << 8)
624#define WM8350_DCDC_HIB_SIG_LPWR3 (3 << 8)
625
626/* LDO Low power (Hibernate) mode */
627#define WM8350_LDO_HIB_MODE_IMAGE (0 << 0)
628#define WM8350_LDO_HIB_MODE_DIS (1 << 0)
629
630/* LDO Low Power (Hibernate) signal */
631#define WM8350_LDO_HIB_SIG_REG (0 << 8)
632#define WM8350_LDO_HIB_SIG_LPWR1 (1 << 8)
633#define WM8350_LDO_HIB_SIG_LPWR2 (2 << 8)
634#define WM8350_LDO_HIB_SIG_LPWR3 (3 << 8)
635
636/*
637 * LDOs
638 */
639#define WM8350_LDO_1 6
640#define WM8350_LDO_2 7
641#define WM8350_LDO_3 8
642#define WM8350_LDO_4 9
643
644/*
645 * ISINKs
646 */
647#define WM8350_ISINK_A 10
648#define WM8350_ISINK_B 11
649
650#define WM8350_ISINK_MODE_BOOST 0
651#define WM8350_ISINK_MODE_SWITCH 1
652#define WM8350_ISINK_ILIM_NORMAL 0
653#define WM8350_ISINK_ILIM_LOW 1
654
655#define WM8350_ISINK_FLASH_DISABLE 0
656#define WM8350_ISINK_FLASH_ENABLE 1
657#define WM8350_ISINK_FLASH_TRIG_BIT 0
658#define WM8350_ISINK_FLASH_TRIG_GPIO 1
659#define WM8350_ISINK_FLASH_MODE_EN (1 << 13)
660#define WM8350_ISINK_FLASH_MODE_DIS (0 << 13)
661#define WM8350_ISINK_FLASH_DUR_32MS (0 << 8)
662#define WM8350_ISINK_FLASH_DUR_64MS (1 << 8)
663#define WM8350_ISINK_FLASH_DUR_96MS (2 << 8)
664#define WM8350_ISINK_FLASH_DUR_1024MS (3 << 8)
665#define WM8350_ISINK_FLASH_ON_INSTANT (0 << 4)
666#define WM8350_ISINK_FLASH_ON_0_25S (1 << 4)
667#define WM8350_ISINK_FLASH_ON_0_50S (2 << 4)
668#define WM8350_ISINK_FLASH_ON_1_00S (3 << 4)
669#define WM8350_ISINK_FLASH_ON_1_95S (1 << 4)
670#define WM8350_ISINK_FLASH_ON_3_91S (2 << 4)
671#define WM8350_ISINK_FLASH_ON_7_80S (3 << 4)
672#define WM8350_ISINK_FLASH_OFF_INSTANT (0 << 0)
673#define WM8350_ISINK_FLASH_OFF_0_25S (1 << 0)
674#define WM8350_ISINK_FLASH_OFF_0_50S (2 << 0)
675#define WM8350_ISINK_FLASH_OFF_1_00S (3 << 0)
676#define WM8350_ISINK_FLASH_OFF_1_95S (1 << 0)
677#define WM8350_ISINK_FLASH_OFF_3_91S (2 << 0)
678#define WM8350_ISINK_FLASH_OFF_7_80S (3 << 0)
679
680/*
681 * Regulator Interrupts.
682 */
683#define WM8350_IRQ_CS1 13
684#define WM8350_IRQ_CS2 14
685#define WM8350_IRQ_UV_LDO4 25
686#define WM8350_IRQ_UV_LDO3 26
687#define WM8350_IRQ_UV_LDO2 27
688#define WM8350_IRQ_UV_LDO1 28
689#define WM8350_IRQ_UV_DC6 29
690#define WM8350_IRQ_UV_DC5 30
691#define WM8350_IRQ_UV_DC4 31
692#define WM8350_IRQ_UV_DC3 32
693#define WM8350_IRQ_UV_DC2 33
694#define WM8350_IRQ_UV_DC1 34
695#define WM8350_IRQ_OC_LS 35
696
697#define NUM_WM8350_REGULATORS 12
698
699struct wm8350;
700struct platform_device;
701struct regulator_init_data;
702
703struct wm8350_pmic {
704 /* ISINK to DCDC mapping */
705 int isink_A_dcdc;
706 int isink_B_dcdc;
707
708 /* hibernate configs */
709 u16 dcdc1_hib_mode;
710 u16 dcdc3_hib_mode;
711 u16 dcdc4_hib_mode;
712 u16 dcdc6_hib_mode;
713
714 /* regulator devices */
715 struct platform_device *pdev[NUM_WM8350_REGULATORS];
716};
717
718int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
719 struct regulator_init_data *initdata);
720
721/*
722 * Additional DCDC control not supported via regulator API
723 */
724int wm8350_dcdc_set_slot(struct wm8350 *wm8350, int dcdc, u16 start,
725 u16 stop, u16 fault);
726int wm8350_dcdc25_set_mode(struct wm8350 *wm8350, int dcdc, u16 mode,
727 u16 ilim, u16 ramp, u16 feedback);
728
729/*
730 * Additional LDO control not supported via regulator API
731 */
732int wm8350_ldo_set_slot(struct wm8350 *wm8350, int ldo, u16 start, u16 stop);
733
734/*
735 * Additional ISINK control not supported via regulator API
736 */
737int wm8350_isink_set_flash(struct wm8350 *wm8350, int isink, u16 mode,
738 u16 trigger, u16 duration, u16 on_ramp,
739 u16 off_ramp, u16 drive);
740
741#endif
diff --git a/include/linux/mfd/wm8350/rtc.h b/include/linux/mfd/wm8350/rtc.h
new file mode 100644
index 000000000000..dfda69e9f440
--- /dev/null
+++ b/include/linux/mfd/wm8350/rtc.h
@@ -0,0 +1,266 @@
1/*
2 * rtc.h -- RTC driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef __LINUX_MFD_WM8350_RTC_H
13#define __LINUX_MFD_WM8350_RTC_H
14
15#include <linux/platform_device.h>
16
17/*
18 * Register values.
19 */
20#define WM8350_RTC_SECONDS_MINUTES 0x10
21#define WM8350_RTC_HOURS_DAY 0x11
22#define WM8350_RTC_DATE_MONTH 0x12
23#define WM8350_RTC_YEAR 0x13
24#define WM8350_ALARM_SECONDS_MINUTES 0x14
25#define WM8350_ALARM_HOURS_DAY 0x15
26#define WM8350_ALARM_DATE_MONTH 0x16
27#define WM8350_RTC_TIME_CONTROL 0x17
28
29/*
30 * R16 (0x10) - RTC Seconds/Minutes
31 */
32#define WM8350_RTC_MINS_MASK 0x7F00
33#define WM8350_RTC_MINS_SHIFT 8
34#define WM8350_RTC_SECS_MASK 0x007F
35#define WM8350_RTC_SECS_SHIFT 0
36
37/*
38 * R17 (0x11) - RTC Hours/Day
39 */
40#define WM8350_RTC_DAY_MASK 0x0700
41#define WM8350_RTC_DAY_SHIFT 8
42#define WM8350_RTC_HPM_MASK 0x0020
43#define WM8350_RTC_HPM_SHIFT 5
44#define WM8350_RTC_HRS_MASK 0x001F
45#define WM8350_RTC_HRS_SHIFT 0
46
47/* Bit values for R21 (0x15) */
48#define WM8350_RTC_DAY_SUN 1
49#define WM8350_RTC_DAY_MON 2
50#define WM8350_RTC_DAY_TUE 3
51#define WM8350_RTC_DAY_WED 4
52#define WM8350_RTC_DAY_THU 5
53#define WM8350_RTC_DAY_FRI 6
54#define WM8350_RTC_DAY_SAT 7
55
56#define WM8350_RTC_HPM_AM 0
57#define WM8350_RTC_HPM_PM 1
58
59/*
60 * R18 (0x12) - RTC Date/Month
61 */
62#define WM8350_RTC_MTH_MASK 0x1F00
63#define WM8350_RTC_MTH_SHIFT 8
64#define WM8350_RTC_DATE_MASK 0x003F
65#define WM8350_RTC_DATE_SHIFT 0
66
67/* Bit values for R22 (0x16) */
68#define WM8350_RTC_MTH_JAN 1
69#define WM8350_RTC_MTH_FEB 2
70#define WM8350_RTC_MTH_MAR 3
71#define WM8350_RTC_MTH_APR 4
72#define WM8350_RTC_MTH_MAY 5
73#define WM8350_RTC_MTH_JUN 6
74#define WM8350_RTC_MTH_JUL 7
75#define WM8350_RTC_MTH_AUG 8
76#define WM8350_RTC_MTH_SEP 9
77#define WM8350_RTC_MTH_OCT 10
78#define WM8350_RTC_MTH_NOV 11
79#define WM8350_RTC_MTH_DEC 12
80#define WM8350_RTC_MTH_JAN_BCD 0x01
81#define WM8350_RTC_MTH_FEB_BCD 0x02
82#define WM8350_RTC_MTH_MAR_BCD 0x03
83#define WM8350_RTC_MTH_APR_BCD 0x04
84#define WM8350_RTC_MTH_MAY_BCD 0x05
85#define WM8350_RTC_MTH_JUN_BCD 0x06
86#define WM8350_RTC_MTH_JUL_BCD 0x07
87#define WM8350_RTC_MTH_AUG_BCD 0x08
88#define WM8350_RTC_MTH_SEP_BCD 0x09
89#define WM8350_RTC_MTH_OCT_BCD 0x10
90#define WM8350_RTC_MTH_NOV_BCD 0x11
91#define WM8350_RTC_MTH_DEC_BCD 0x12
92
93/*
94 * R19 (0x13) - RTC Year
95 */
96#define WM8350_RTC_YHUNDREDS_MASK 0x3F00
97#define WM8350_RTC_YHUNDREDS_SHIFT 8
98#define WM8350_RTC_YUNITS_MASK 0x00FF
99#define WM8350_RTC_YUNITS_SHIFT 0
100
101/*
102 * R20 (0x14) - Alarm Seconds/Minutes
103 */
104#define WM8350_RTC_ALMMINS_MASK 0x7F00
105#define WM8350_RTC_ALMMINS_SHIFT 8
106#define WM8350_RTC_ALMSECS_MASK 0x007F
107#define WM8350_RTC_ALMSECS_SHIFT 0
108
109/* Bit values for R20 (0x14) */
110#define WM8350_RTC_ALMMINS_DONT_CARE -1
111#define WM8350_RTC_ALMSECS_DONT_CARE -1
112
113/*
114 * R21 (0x15) - Alarm Hours/Day
115 */
116#define WM8350_RTC_ALMDAY_MASK 0x0F00
117#define WM8350_RTC_ALMDAY_SHIFT 8
118#define WM8350_RTC_ALMHPM_MASK 0x0020
119#define WM8350_RTC_ALMHPM_SHIFT 5
120#define WM8350_RTC_ALMHRS_MASK 0x001F
121#define WM8350_RTC_ALMHRS_SHIFT 0
122
123/* Bit values for R21 (0x15) */
124#define WM8350_RTC_ALMDAY_DONT_CARE -1
125#define WM8350_RTC_ALMDAY_SUN 1
126#define WM8350_RTC_ALMDAY_MON 2
127#define WM8350_RTC_ALMDAY_TUE 3
128#define WM8350_RTC_ALMDAY_WED 4
129#define WM8350_RTC_ALMDAY_THU 5
130#define WM8350_RTC_ALMDAY_FRI 6
131#define WM8350_RTC_ALMDAY_SAT 7
132
133#define WM8350_RTC_ALMHPM_AM 0
134#define WM8350_RTC_ALMHPM_PM 1
135
136#define WM8350_RTC_ALMHRS_DONT_CARE -1
137
138/*
139 * R22 (0x16) - Alarm Date/Month
140 */
141#define WM8350_RTC_ALMMTH_MASK 0x1F00
142#define WM8350_RTC_ALMMTH_SHIFT 8
143#define WM8350_RTC_ALMDATE_MASK 0x003F
144#define WM8350_RTC_ALMDATE_SHIFT 0
145
146/* Bit values for R22 (0x16) */
147#define WM8350_RTC_ALMDATE_DONT_CARE -1
148
149#define WM8350_RTC_ALMMTH_DONT_CARE -1
150#define WM8350_RTC_ALMMTH_JAN 1
151#define WM8350_RTC_ALMMTH_FEB 2
152#define WM8350_RTC_ALMMTH_MAR 3
153#define WM8350_RTC_ALMMTH_APR 4
154#define WM8350_RTC_ALMMTH_MAY 5
155#define WM8350_RTC_ALMMTH_JUN 6
156#define WM8350_RTC_ALMMTH_JUL 7
157#define WM8350_RTC_ALMMTH_AUG 8
158#define WM8350_RTC_ALMMTH_SEP 9
159#define WM8350_RTC_ALMMTH_OCT 10
160#define WM8350_RTC_ALMMTH_NOV 11
161#define WM8350_RTC_ALMMTH_DEC 12
162#define WM8350_RTC_ALMMTH_JAN_BCD 0x01
163#define WM8350_RTC_ALMMTH_FEB_BCD 0x02
164#define WM8350_RTC_ALMMTH_MAR_BCD 0x03
165#define WM8350_RTC_ALMMTH_APR_BCD 0x04
166#define WM8350_RTC_ALMMTH_MAY_BCD 0x05
167#define WM8350_RTC_ALMMTH_JUN_BCD 0x06
168#define WM8350_RTC_ALMMTH_JUL_BCD 0x07
169#define WM8350_RTC_ALMMTH_AUG_BCD 0x08
170#define WM8350_RTC_ALMMTH_SEP_BCD 0x09
171#define WM8350_RTC_ALMMTH_OCT_BCD 0x10
172#define WM8350_RTC_ALMMTH_NOV_BCD 0x11
173#define WM8350_RTC_ALMMTH_DEC_BCD 0x12
174
175/*
176 * R23 (0x17) - RTC Time Control
177 */
178#define WM8350_RTC_BCD 0x8000
179#define WM8350_RTC_BCD_MASK 0x8000
180#define WM8350_RTC_BCD_SHIFT 15
181#define WM8350_RTC_12HR 0x4000
182#define WM8350_RTC_12HR_MASK 0x4000
183#define WM8350_RTC_12HR_SHIFT 14
184#define WM8350_RTC_DST 0x2000
185#define WM8350_RTC_DST_MASK 0x2000
186#define WM8350_RTC_DST_SHIFT 13
187#define WM8350_RTC_SET 0x0800
188#define WM8350_RTC_SET_MASK 0x0800
189#define WM8350_RTC_SET_SHIFT 11
190#define WM8350_RTC_STS 0x0400
191#define WM8350_RTC_STS_MASK 0x0400
192#define WM8350_RTC_STS_SHIFT 10
193#define WM8350_RTC_ALMSET 0x0200
194#define WM8350_RTC_ALMSET_MASK 0x0200
195#define WM8350_RTC_ALMSET_SHIFT 9
196#define WM8350_RTC_ALMSTS 0x0100
197#define WM8350_RTC_ALMSTS_MASK 0x0100
198#define WM8350_RTC_ALMSTS_SHIFT 8
199#define WM8350_RTC_PINT 0x0070
200#define WM8350_RTC_PINT_MASK 0x0070
201#define WM8350_RTC_PINT_SHIFT 4
202#define WM8350_RTC_DSW 0x000F
203#define WM8350_RTC_DSW_MASK 0x000F
204#define WM8350_RTC_DSW_SHIFT 0
205
206/* Bit values for R23 (0x17) */
207#define WM8350_RTC_BCD_BINARY 0
208#define WM8350_RTC_BCD_BCD 1
209
210#define WM8350_RTC_12HR_24HR 0
211#define WM8350_RTC_12HR_12HR 1
212
213#define WM8350_RTC_DST_DISABLED 0
214#define WM8350_RTC_DST_ENABLED 1
215
216#define WM8350_RTC_SET_RUN 0
217#define WM8350_RTC_SET_SET 1
218
219#define WM8350_RTC_STS_RUNNING 0
220#define WM8350_RTC_STS_STOPPED 1
221
222#define WM8350_RTC_ALMSET_RUN 0
223#define WM8350_RTC_ALMSET_SET 1
224
225#define WM8350_RTC_ALMSTS_RUNNING 0
226#define WM8350_RTC_ALMSTS_STOPPED 1
227
228#define WM8350_RTC_PINT_DISABLED 0
229#define WM8350_RTC_PINT_SECS 1
230#define WM8350_RTC_PINT_MINS 2
231#define WM8350_RTC_PINT_HRS 3
232#define WM8350_RTC_PINT_DAYS 4
233#define WM8350_RTC_PINT_MTHS 5
234
235#define WM8350_RTC_DSW_DISABLED 0
236#define WM8350_RTC_DSW_1HZ 1
237#define WM8350_RTC_DSW_2HZ 2
238#define WM8350_RTC_DSW_4HZ 3
239#define WM8350_RTC_DSW_8HZ 4
240#define WM8350_RTC_DSW_16HZ 5
241#define WM8350_RTC_DSW_32HZ 6
242#define WM8350_RTC_DSW_64HZ 7
243#define WM8350_RTC_DSW_128HZ 8
244#define WM8350_RTC_DSW_256HZ 9
245#define WM8350_RTC_DSW_512HZ 10
246#define WM8350_RTC_DSW_1024HZ 11
247
248/*
249 * R218 (0xDA) - RTC Tick Control
250 */
251#define WM8350_RTC_TICKSTS 0x4000
252#define WM8350_RTC_CLKSRC 0x2000
253#define WM8350_RTC_TRIM_MASK 0x03FF
254
255/*
256 * RTC Interrupts.
257 */
258#define WM8350_IRQ_RTC_PER 7
259#define WM8350_IRQ_RTC_SEC 8
260#define WM8350_IRQ_RTC_ALM 9
261
262struct wm8350_rtc {
263 struct platform_device *pdev;
264};
265
266#endif
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h
new file mode 100644
index 000000000000..1c8f3cde79b0
--- /dev/null
+++ b/include/linux/mfd/wm8350/supply.h
@@ -0,0 +1,111 @@
1/*
2 * supply.h -- Power Supply Driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __LINUX_MFD_WM8350_SUPPLY_H_
14#define __LINUX_MFD_WM8350_SUPPLY_H_
15
16#include <linux/platform_device.h>
17
18/*
19 * Charger registers
20 */
21#define WM8350_BATTERY_CHARGER_CONTROL_1 0xA8
22#define WM8350_BATTERY_CHARGER_CONTROL_2 0xA9
23#define WM8350_BATTERY_CHARGER_CONTROL_3 0xAA
24
25/*
26 * R168 (0xA8) - Battery Charger Control 1
27 */
28#define WM8350_CHG_ENA_R168 0x8000
29#define WM8350_CHG_THR 0x2000
30#define WM8350_CHG_EOC_SEL_MASK 0x1C00
31#define WM8350_CHG_TRICKLE_TEMP_CHOKE 0x0200
32#define WM8350_CHG_TRICKLE_USB_CHOKE 0x0100
33#define WM8350_CHG_RECOVER_T 0x0080
34#define WM8350_CHG_END_ACT 0x0040
35#define WM8350_CHG_FAST 0x0020
36#define WM8350_CHG_FAST_USB_THROTTLE 0x0010
37#define WM8350_CHG_NTC_MON 0x0008
38#define WM8350_CHG_BATT_HOT_MON 0x0004
39#define WM8350_CHG_BATT_COLD_MON 0x0002
40#define WM8350_CHG_CHIP_TEMP_MON 0x0001
41
42/*
43 * R169 (0xA9) - Battery Charger Control 2
44 */
45#define WM8350_CHG_ACTIVE 0x8000
46#define WM8350_CHG_PAUSE 0x4000
47#define WM8350_CHG_STS_MASK 0x3000
48#define WM8350_CHG_TIME_MASK 0x0F00
49#define WM8350_CHG_MASK_WALL_FB 0x0080
50#define WM8350_CHG_TRICKLE_SEL 0x0040
51#define WM8350_CHG_VSEL_MASK 0x0030
52#define WM8350_CHG_ISEL_MASK 0x000F
53#define WM8350_CHG_STS_OFF 0x0000
54#define WM8350_CHG_STS_TRICKLE 0x1000
55#define WM8350_CHG_STS_FAST 0x2000
56
57/*
58 * R170 (0xAA) - Battery Charger Control 3
59 */
60#define WM8350_CHG_THROTTLE_T_MASK 0x0060
61#define WM8350_CHG_SMART 0x0010
62#define WM8350_CHG_TIMER_ADJT_MASK 0x000F
63
64/*
65 * Charger Interrupts
66 */
67#define WM8350_IRQ_CHG_BAT_HOT 0
68#define WM8350_IRQ_CHG_BAT_COLD 1
69#define WM8350_IRQ_CHG_BAT_FAIL 2
70#define WM8350_IRQ_CHG_TO 3
71#define WM8350_IRQ_CHG_END 4
72#define WM8350_IRQ_CHG_START 5
73#define WM8350_IRQ_CHG_FAST_RDY 6
74#define WM8350_IRQ_CHG_VBATT_LT_3P9 10
75#define WM8350_IRQ_CHG_VBATT_LT_3P1 11
76#define WM8350_IRQ_CHG_VBATT_LT_2P85 12
77
78/*
79 * Charger Policy
80 */
81#define WM8350_CHG_TRICKLE_50mA (0 << 6)
82#define WM8350_CHG_TRICKLE_100mA (1 << 6)
83#define WM8350_CHG_4_05V (0 << 4)
84#define WM8350_CHG_4_10V (1 << 4)
85#define WM8350_CHG_4_15V (2 << 4)
86#define WM8350_CHG_4_20V (3 << 4)
87#define WM8350_CHG_FAST_LIMIT_mA(x) ((x / 50) & 0xf)
88#define WM8350_CHG_EOC_mA(x) (((x - 10) & 0x7) << 10)
89#define WM8350_CHG_TRICKLE_3_1V (0 << 13)
90#define WM8350_CHG_TRICKLE_3_9V (1 << 13)
91
92/*
93 * Supply Registers.
94 */
95#define WM8350_USB_VOLTAGE_READBACK 0x9C
96#define WM8350_LINE_VOLTAGE_READBACK 0x9D
97#define WM8350_BATT_VOLTAGE_READBACK 0x9E
98
99/*
100 * Supply Interrupts.
101 */
102#define WM8350_IRQ_USB_LIMIT 15
103#define WM8350_IRQ_EXT_USB_FB 36
104#define WM8350_IRQ_EXT_WALL_FB 37
105#define WM8350_IRQ_EXT_BAT_FB 38
106
107struct wm8350_power {
108 struct platform_device *pdev;
109};
110
111#endif
diff --git a/include/linux/mfd/wm8350/wdt.h b/include/linux/mfd/wm8350/wdt.h
new file mode 100644
index 000000000000..f6135b5e5ef4
--- /dev/null
+++ b/include/linux/mfd/wm8350/wdt.h
@@ -0,0 +1,28 @@
1/*
2 * wdt.h -- Watchdog Driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007, 2008 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef __LINUX_MFD_WM8350_WDT_H_
13#define __LINUX_MFD_WM8350_WDT_H_
14
15#include <linux/platform_device.h>
16
17#define WM8350_WDOG_HIB_MODE 0x0080
18#define WM8350_WDOG_DEBUG 0x0040
19#define WM8350_WDOG_MODE_MASK 0x0030
20#define WM8350_WDOG_TO_MASK 0x0007
21
22#define WM8350_IRQ_SYS_WDOG_TO 24
23
24struct wm8350_wdt {
25 struct platform_device *pdev;
26};
27
28#endif
diff --git a/include/linux/mfd/wm8400-audio.h b/include/linux/mfd/wm8400-audio.h
new file mode 100644
index 000000000000..b6640e018046
--- /dev/null
+++ b/include/linux/mfd/wm8400-audio.h
@@ -0,0 +1,1186 @@
1/*
2 * wm8400 private definitions for audio
3 *
4 * Copyright 2008 Wolfson Microelectronics plc
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; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef __LINUX_MFD_WM8400_AUDIO_H
22#define __LINUX_MFD_WM8400_AUDIO_H
23
24#include <linux/mfd/wm8400-audio.h>
25
26/*
27 * R2 (0x02) - Power Management (1)
28 */
29#define WM8400_CODEC_ENA 0x8000 /* CODEC_ENA */
30#define WM8400_CODEC_ENA_MASK 0x8000 /* CODEC_ENA */
31#define WM8400_CODEC_ENA_SHIFT 15 /* CODEC_ENA */
32#define WM8400_CODEC_ENA_WIDTH 1 /* CODEC_ENA */
33#define WM8400_SYSCLK_ENA 0x4000 /* SYSCLK_ENA */
34#define WM8400_SYSCLK_ENA_MASK 0x4000 /* SYSCLK_ENA */
35#define WM8400_SYSCLK_ENA_SHIFT 14 /* SYSCLK_ENA */
36#define WM8400_SYSCLK_ENA_WIDTH 1 /* SYSCLK_ENA */
37#define WM8400_SPK_MIX_ENA 0x2000 /* SPK_MIX_ENA */
38#define WM8400_SPK_MIX_ENA_MASK 0x2000 /* SPK_MIX_ENA */
39#define WM8400_SPK_MIX_ENA_SHIFT 13 /* SPK_MIX_ENA */
40#define WM8400_SPK_MIX_ENA_WIDTH 1 /* SPK_MIX_ENA */
41#define WM8400_SPK_ENA 0x1000 /* SPK_ENA */
42#define WM8400_SPK_ENA_MASK 0x1000 /* SPK_ENA */
43#define WM8400_SPK_ENA_SHIFT 12 /* SPK_ENA */
44#define WM8400_SPK_ENA_WIDTH 1 /* SPK_ENA */
45#define WM8400_OUT3_ENA 0x0800 /* OUT3_ENA */
46#define WM8400_OUT3_ENA_MASK 0x0800 /* OUT3_ENA */
47#define WM8400_OUT3_ENA_SHIFT 11 /* OUT3_ENA */
48#define WM8400_OUT3_ENA_WIDTH 1 /* OUT3_ENA */
49#define WM8400_OUT4_ENA 0x0400 /* OUT4_ENA */
50#define WM8400_OUT4_ENA_MASK 0x0400 /* OUT4_ENA */
51#define WM8400_OUT4_ENA_SHIFT 10 /* OUT4_ENA */
52#define WM8400_OUT4_ENA_WIDTH 1 /* OUT4_ENA */
53#define WM8400_LOUT_ENA 0x0200 /* LOUT_ENA */
54#define WM8400_LOUT_ENA_MASK 0x0200 /* LOUT_ENA */
55#define WM8400_LOUT_ENA_SHIFT 9 /* LOUT_ENA */
56#define WM8400_LOUT_ENA_WIDTH 1 /* LOUT_ENA */
57#define WM8400_ROUT_ENA 0x0100 /* ROUT_ENA */
58#define WM8400_ROUT_ENA_MASK 0x0100 /* ROUT_ENA */
59#define WM8400_ROUT_ENA_SHIFT 8 /* ROUT_ENA */
60#define WM8400_ROUT_ENA_WIDTH 1 /* ROUT_ENA */
61#define WM8400_MIC1BIAS_ENA 0x0010 /* MIC1BIAS_ENA */
62#define WM8400_MIC1BIAS_ENA_MASK 0x0010 /* MIC1BIAS_ENA */
63#define WM8400_MIC1BIAS_ENA_SHIFT 4 /* MIC1BIAS_ENA */
64#define WM8400_MIC1BIAS_ENA_WIDTH 1 /* MIC1BIAS_ENA */
65#define WM8400_VMID_MODE_MASK 0x0006 /* VMID_MODE - [2:1] */
66#define WM8400_VMID_MODE_SHIFT 1 /* VMID_MODE - [2:1] */
67#define WM8400_VMID_MODE_WIDTH 2 /* VMID_MODE - [2:1] */
68#define WM8400_VREF_ENA 0x0001 /* VREF_ENA */
69#define WM8400_VREF_ENA_MASK 0x0001 /* VREF_ENA */
70#define WM8400_VREF_ENA_SHIFT 0 /* VREF_ENA */
71#define WM8400_VREF_ENA_WIDTH 1 /* VREF_ENA */
72
73/*
74 * R3 (0x03) - Power Management (2)
75 */
76#define WM8400_FLL_ENA 0x8000 /* FLL_ENA */
77#define WM8400_FLL_ENA_MASK 0x8000 /* FLL_ENA */
78#define WM8400_FLL_ENA_SHIFT 15 /* FLL_ENA */
79#define WM8400_FLL_ENA_WIDTH 1 /* FLL_ENA */
80#define WM8400_TSHUT_ENA 0x4000 /* TSHUT_ENA */
81#define WM8400_TSHUT_ENA_MASK 0x4000 /* TSHUT_ENA */
82#define WM8400_TSHUT_ENA_SHIFT 14 /* TSHUT_ENA */
83#define WM8400_TSHUT_ENA_WIDTH 1 /* TSHUT_ENA */
84#define WM8400_TSHUT_OPDIS 0x2000 /* TSHUT_OPDIS */
85#define WM8400_TSHUT_OPDIS_MASK 0x2000 /* TSHUT_OPDIS */
86#define WM8400_TSHUT_OPDIS_SHIFT 13 /* TSHUT_OPDIS */
87#define WM8400_TSHUT_OPDIS_WIDTH 1 /* TSHUT_OPDIS */
88#define WM8400_OPCLK_ENA 0x0800 /* OPCLK_ENA */
89#define WM8400_OPCLK_ENA_MASK 0x0800 /* OPCLK_ENA */
90#define WM8400_OPCLK_ENA_SHIFT 11 /* OPCLK_ENA */
91#define WM8400_OPCLK_ENA_WIDTH 1 /* OPCLK_ENA */
92#define WM8400_AINL_ENA 0x0200 /* AINL_ENA */
93#define WM8400_AINL_ENA_MASK 0x0200 /* AINL_ENA */
94#define WM8400_AINL_ENA_SHIFT 9 /* AINL_ENA */
95#define WM8400_AINL_ENA_WIDTH 1 /* AINL_ENA */
96#define WM8400_AINR_ENA 0x0100 /* AINR_ENA */
97#define WM8400_AINR_ENA_MASK 0x0100 /* AINR_ENA */
98#define WM8400_AINR_ENA_SHIFT 8 /* AINR_ENA */
99#define WM8400_AINR_ENA_WIDTH 1 /* AINR_ENA */
100#define WM8400_LIN34_ENA 0x0080 /* LIN34_ENA */
101#define WM8400_LIN34_ENA_MASK 0x0080 /* LIN34_ENA */
102#define WM8400_LIN34_ENA_SHIFT 7 /* LIN34_ENA */
103#define WM8400_LIN34_ENA_WIDTH 1 /* LIN34_ENA */
104#define WM8400_LIN12_ENA 0x0040 /* LIN12_ENA */
105#define WM8400_LIN12_ENA_MASK 0x0040 /* LIN12_ENA */
106#define WM8400_LIN12_ENA_SHIFT 6 /* LIN12_ENA */
107#define WM8400_LIN12_ENA_WIDTH 1 /* LIN12_ENA */
108#define WM8400_RIN34_ENA 0x0020 /* RIN34_ENA */
109#define WM8400_RIN34_ENA_MASK 0x0020 /* RIN34_ENA */
110#define WM8400_RIN34_ENA_SHIFT 5 /* RIN34_ENA */
111#define WM8400_RIN34_ENA_WIDTH 1 /* RIN34_ENA */
112#define WM8400_RIN12_ENA 0x0010 /* RIN12_ENA */
113#define WM8400_RIN12_ENA_MASK 0x0010 /* RIN12_ENA */
114#define WM8400_RIN12_ENA_SHIFT 4 /* RIN12_ENA */
115#define WM8400_RIN12_ENA_WIDTH 1 /* RIN12_ENA */
116#define WM8400_ADCL_ENA 0x0002 /* ADCL_ENA */
117#define WM8400_ADCL_ENA_MASK 0x0002 /* ADCL_ENA */
118#define WM8400_ADCL_ENA_SHIFT 1 /* ADCL_ENA */
119#define WM8400_ADCL_ENA_WIDTH 1 /* ADCL_ENA */
120#define WM8400_ADCR_ENA 0x0001 /* ADCR_ENA */
121#define WM8400_ADCR_ENA_MASK 0x0001 /* ADCR_ENA */
122#define WM8400_ADCR_ENA_SHIFT 0 /* ADCR_ENA */
123#define WM8400_ADCR_ENA_WIDTH 1 /* ADCR_ENA */
124
125/*
126 * R4 (0x04) - Power Management (3)
127 */
128#define WM8400_LON_ENA 0x2000 /* LON_ENA */
129#define WM8400_LON_ENA_MASK 0x2000 /* LON_ENA */
130#define WM8400_LON_ENA_SHIFT 13 /* LON_ENA */
131#define WM8400_LON_ENA_WIDTH 1 /* LON_ENA */
132#define WM8400_LOP_ENA 0x1000 /* LOP_ENA */
133#define WM8400_LOP_ENA_MASK 0x1000 /* LOP_ENA */
134#define WM8400_LOP_ENA_SHIFT 12 /* LOP_ENA */
135#define WM8400_LOP_ENA_WIDTH 1 /* LOP_ENA */
136#define WM8400_RON_ENA 0x0800 /* RON_ENA */
137#define WM8400_RON_ENA_MASK 0x0800 /* RON_ENA */
138#define WM8400_RON_ENA_SHIFT 11 /* RON_ENA */
139#define WM8400_RON_ENA_WIDTH 1 /* RON_ENA */
140#define WM8400_ROP_ENA 0x0400 /* ROP_ENA */
141#define WM8400_ROP_ENA_MASK 0x0400 /* ROP_ENA */
142#define WM8400_ROP_ENA_SHIFT 10 /* ROP_ENA */
143#define WM8400_ROP_ENA_WIDTH 1 /* ROP_ENA */
144#define WM8400_LOPGA_ENA 0x0080 /* LOPGA_ENA */
145#define WM8400_LOPGA_ENA_MASK 0x0080 /* LOPGA_ENA */
146#define WM8400_LOPGA_ENA_SHIFT 7 /* LOPGA_ENA */
147#define WM8400_LOPGA_ENA_WIDTH 1 /* LOPGA_ENA */
148#define WM8400_ROPGA_ENA 0x0040 /* ROPGA_ENA */
149#define WM8400_ROPGA_ENA_MASK 0x0040 /* ROPGA_ENA */
150#define WM8400_ROPGA_ENA_SHIFT 6 /* ROPGA_ENA */
151#define WM8400_ROPGA_ENA_WIDTH 1 /* ROPGA_ENA */
152#define WM8400_LOMIX_ENA 0x0020 /* LOMIX_ENA */
153#define WM8400_LOMIX_ENA_MASK 0x0020 /* LOMIX_ENA */
154#define WM8400_LOMIX_ENA_SHIFT 5 /* LOMIX_ENA */
155#define WM8400_LOMIX_ENA_WIDTH 1 /* LOMIX_ENA */
156#define WM8400_ROMIX_ENA 0x0010 /* ROMIX_ENA */
157#define WM8400_ROMIX_ENA_MASK 0x0010 /* ROMIX_ENA */
158#define WM8400_ROMIX_ENA_SHIFT 4 /* ROMIX_ENA */
159#define WM8400_ROMIX_ENA_WIDTH 1 /* ROMIX_ENA */
160#define WM8400_DACL_ENA 0x0002 /* DACL_ENA */
161#define WM8400_DACL_ENA_MASK 0x0002 /* DACL_ENA */
162#define WM8400_DACL_ENA_SHIFT 1 /* DACL_ENA */
163#define WM8400_DACL_ENA_WIDTH 1 /* DACL_ENA */
164#define WM8400_DACR_ENA 0x0001 /* DACR_ENA */
165#define WM8400_DACR_ENA_MASK 0x0001 /* DACR_ENA */
166#define WM8400_DACR_ENA_SHIFT 0 /* DACR_ENA */
167#define WM8400_DACR_ENA_WIDTH 1 /* DACR_ENA */
168
169/*
170 * R5 (0x05) - Audio Interface (1)
171 */
172#define WM8400_AIFADCL_SRC 0x8000 /* AIFADCL_SRC */
173#define WM8400_AIFADCL_SRC_MASK 0x8000 /* AIFADCL_SRC */
174#define WM8400_AIFADCL_SRC_SHIFT 15 /* AIFADCL_SRC */
175#define WM8400_AIFADCL_SRC_WIDTH 1 /* AIFADCL_SRC */
176#define WM8400_AIFADCR_SRC 0x4000 /* AIFADCR_SRC */
177#define WM8400_AIFADCR_SRC_MASK 0x4000 /* AIFADCR_SRC */
178#define WM8400_AIFADCR_SRC_SHIFT 14 /* AIFADCR_SRC */
179#define WM8400_AIFADCR_SRC_WIDTH 1 /* AIFADCR_SRC */
180#define WM8400_AIFADC_TDM 0x2000 /* AIFADC_TDM */
181#define WM8400_AIFADC_TDM_MASK 0x2000 /* AIFADC_TDM */
182#define WM8400_AIFADC_TDM_SHIFT 13 /* AIFADC_TDM */
183#define WM8400_AIFADC_TDM_WIDTH 1 /* AIFADC_TDM */
184#define WM8400_AIFADC_TDM_CHAN 0x1000 /* AIFADC_TDM_CHAN */
185#define WM8400_AIFADC_TDM_CHAN_MASK 0x1000 /* AIFADC_TDM_CHAN */
186#define WM8400_AIFADC_TDM_CHAN_SHIFT 12 /* AIFADC_TDM_CHAN */
187#define WM8400_AIFADC_TDM_CHAN_WIDTH 1 /* AIFADC_TDM_CHAN */
188#define WM8400_AIF_BCLK_INV 0x0100 /* AIF_BCLK_INV */
189#define WM8400_AIF_BCLK_INV_MASK 0x0100 /* AIF_BCLK_INV */
190#define WM8400_AIF_BCLK_INV_SHIFT 8 /* AIF_BCLK_INV */
191#define WM8400_AIF_BCLK_INV_WIDTH 1 /* AIF_BCLK_INV */
192#define WM8400_AIF_LRCLK_INV 0x0080 /* AIF_LRCLK_INV */
193#define WM8400_AIF_LRCLK_INV_MASK 0x0080 /* AIF_LRCLK_INV */
194#define WM8400_AIF_LRCLK_INV_SHIFT 7 /* AIF_LRCLK_INV */
195#define WM8400_AIF_LRCLK_INV_WIDTH 1 /* AIF_LRCLK_INV */
196#define WM8400_AIF_WL_MASK 0x0060 /* AIF_WL - [6:5] */
197#define WM8400_AIF_WL_SHIFT 5 /* AIF_WL - [6:5] */
198#define WM8400_AIF_WL_WIDTH 2 /* AIF_WL - [6:5] */
199#define WM8400_AIF_WL_16BITS (0 << 5)
200#define WM8400_AIF_WL_20BITS (1 << 5)
201#define WM8400_AIF_WL_24BITS (2 << 5)
202#define WM8400_AIF_WL_32BITS (3 << 5)
203#define WM8400_AIF_FMT_MASK 0x0018 /* AIF_FMT - [4:3] */
204#define WM8400_AIF_FMT_SHIFT 3 /* AIF_FMT - [4:3] */
205#define WM8400_AIF_FMT_WIDTH 2 /* AIF_FMT - [4:3] */
206#define WM8400_AIF_FMT_RIGHTJ (0 << 3)
207#define WM8400_AIF_FMT_LEFTJ (1 << 3)
208#define WM8400_AIF_FMT_I2S (2 << 3)
209#define WM8400_AIF_FMT_DSP (3 << 3)
210
211/*
212 * R6 (0x06) - Audio Interface (2)
213 */
214#define WM8400_DACL_SRC 0x8000 /* DACL_SRC */
215#define WM8400_DACL_SRC_MASK 0x8000 /* DACL_SRC */
216#define WM8400_DACL_SRC_SHIFT 15 /* DACL_SRC */
217#define WM8400_DACL_SRC_WIDTH 1 /* DACL_SRC */
218#define WM8400_DACR_SRC 0x4000 /* DACR_SRC */
219#define WM8400_DACR_SRC_MASK 0x4000 /* DACR_SRC */
220#define WM8400_DACR_SRC_SHIFT 14 /* DACR_SRC */
221#define WM8400_DACR_SRC_WIDTH 1 /* DACR_SRC */
222#define WM8400_AIFDAC_TDM 0x2000 /* AIFDAC_TDM */
223#define WM8400_AIFDAC_TDM_MASK 0x2000 /* AIFDAC_TDM */
224#define WM8400_AIFDAC_TDM_SHIFT 13 /* AIFDAC_TDM */
225#define WM8400_AIFDAC_TDM_WIDTH 1 /* AIFDAC_TDM */
226#define WM8400_AIFDAC_TDM_CHAN 0x1000 /* AIFDAC_TDM_CHAN */
227#define WM8400_AIFDAC_TDM_CHAN_MASK 0x1000 /* AIFDAC_TDM_CHAN */
228#define WM8400_AIFDAC_TDM_CHAN_SHIFT 12 /* AIFDAC_TDM_CHAN */
229#define WM8400_AIFDAC_TDM_CHAN_WIDTH 1 /* AIFDAC_TDM_CHAN */
230#define WM8400_DAC_BOOST_MASK 0x0C00 /* DAC_BOOST - [11:10] */
231#define WM8400_DAC_BOOST_SHIFT 10 /* DAC_BOOST - [11:10] */
232#define WM8400_DAC_BOOST_WIDTH 2 /* DAC_BOOST - [11:10] */
233#define WM8400_DAC_COMP 0x0010 /* DAC_COMP */
234#define WM8400_DAC_COMP_MASK 0x0010 /* DAC_COMP */
235#define WM8400_DAC_COMP_SHIFT 4 /* DAC_COMP */
236#define WM8400_DAC_COMP_WIDTH 1 /* DAC_COMP */
237#define WM8400_DAC_COMPMODE 0x0008 /* DAC_COMPMODE */
238#define WM8400_DAC_COMPMODE_MASK 0x0008 /* DAC_COMPMODE */
239#define WM8400_DAC_COMPMODE_SHIFT 3 /* DAC_COMPMODE */
240#define WM8400_DAC_COMPMODE_WIDTH 1 /* DAC_COMPMODE */
241#define WM8400_ADC_COMP 0x0004 /* ADC_COMP */
242#define WM8400_ADC_COMP_MASK 0x0004 /* ADC_COMP */
243#define WM8400_ADC_COMP_SHIFT 2 /* ADC_COMP */
244#define WM8400_ADC_COMP_WIDTH 1 /* ADC_COMP */
245#define WM8400_ADC_COMPMODE 0x0002 /* ADC_COMPMODE */
246#define WM8400_ADC_COMPMODE_MASK 0x0002 /* ADC_COMPMODE */
247#define WM8400_ADC_COMPMODE_SHIFT 1 /* ADC_COMPMODE */
248#define WM8400_ADC_COMPMODE_WIDTH 1 /* ADC_COMPMODE */
249#define WM8400_LOOPBACK 0x0001 /* LOOPBACK */
250#define WM8400_LOOPBACK_MASK 0x0001 /* LOOPBACK */
251#define WM8400_LOOPBACK_SHIFT 0 /* LOOPBACK */
252#define WM8400_LOOPBACK_WIDTH 1 /* LOOPBACK */
253
254/*
255 * R7 (0x07) - Clocking (1)
256 */
257#define WM8400_TOCLK_RATE 0x8000 /* TOCLK_RATE */
258#define WM8400_TOCLK_RATE_MASK 0x8000 /* TOCLK_RATE */
259#define WM8400_TOCLK_RATE_SHIFT 15 /* TOCLK_RATE */
260#define WM8400_TOCLK_RATE_WIDTH 1 /* TOCLK_RATE */
261#define WM8400_TOCLK_ENA 0x4000 /* TOCLK_ENA */
262#define WM8400_TOCLK_ENA_MASK 0x4000 /* TOCLK_ENA */
263#define WM8400_TOCLK_ENA_SHIFT 14 /* TOCLK_ENA */
264#define WM8400_TOCLK_ENA_WIDTH 1 /* TOCLK_ENA */
265#define WM8400_OPCLKDIV_MASK 0x1E00 /* OPCLKDIV - [12:9] */
266#define WM8400_OPCLKDIV_SHIFT 9 /* OPCLKDIV - [12:9] */
267#define WM8400_OPCLKDIV_WIDTH 4 /* OPCLKDIV - [12:9] */
268#define WM8400_DCLKDIV_MASK 0x01C0 /* DCLKDIV - [8:6] */
269#define WM8400_DCLKDIV_SHIFT 6 /* DCLKDIV - [8:6] */
270#define WM8400_DCLKDIV_WIDTH 3 /* DCLKDIV - [8:6] */
271#define WM8400_BCLK_DIV_MASK 0x001E /* BCLK_DIV - [4:1] */
272#define WM8400_BCLK_DIV_SHIFT 1 /* BCLK_DIV - [4:1] */
273#define WM8400_BCLK_DIV_WIDTH 4 /* BCLK_DIV - [4:1] */
274
275/*
276 * R8 (0x08) - Clocking (2)
277 */
278#define WM8400_MCLK_SRC 0x8000 /* MCLK_SRC */
279#define WM8400_MCLK_SRC_MASK 0x8000 /* MCLK_SRC */
280#define WM8400_MCLK_SRC_SHIFT 15 /* MCLK_SRC */
281#define WM8400_MCLK_SRC_WIDTH 1 /* MCLK_SRC */
282#define WM8400_SYSCLK_SRC 0x4000 /* SYSCLK_SRC */
283#define WM8400_SYSCLK_SRC_MASK 0x4000 /* SYSCLK_SRC */
284#define WM8400_SYSCLK_SRC_SHIFT 14 /* SYSCLK_SRC */
285#define WM8400_SYSCLK_SRC_WIDTH 1 /* SYSCLK_SRC */
286#define WM8400_CLK_FORCE 0x2000 /* CLK_FORCE */
287#define WM8400_CLK_FORCE_MASK 0x2000 /* CLK_FORCE */
288#define WM8400_CLK_FORCE_SHIFT 13 /* CLK_FORCE */
289#define WM8400_CLK_FORCE_WIDTH 1 /* CLK_FORCE */
290#define WM8400_MCLK_DIV_MASK 0x1800 /* MCLK_DIV - [12:11] */
291#define WM8400_MCLK_DIV_SHIFT 11 /* MCLK_DIV - [12:11] */
292#define WM8400_MCLK_DIV_WIDTH 2 /* MCLK_DIV - [12:11] */
293#define WM8400_MCLK_INV 0x0400 /* MCLK_INV */
294#define WM8400_MCLK_INV_MASK 0x0400 /* MCLK_INV */
295#define WM8400_MCLK_INV_SHIFT 10 /* MCLK_INV */
296#define WM8400_MCLK_INV_WIDTH 1 /* MCLK_INV */
297#define WM8400_ADC_CLKDIV_MASK 0x00E0 /* ADC_CLKDIV - [7:5] */
298#define WM8400_ADC_CLKDIV_SHIFT 5 /* ADC_CLKDIV - [7:5] */
299#define WM8400_ADC_CLKDIV_WIDTH 3 /* ADC_CLKDIV - [7:5] */
300#define WM8400_DAC_CLKDIV_MASK 0x001C /* DAC_CLKDIV - [4:2] */
301#define WM8400_DAC_CLKDIV_SHIFT 2 /* DAC_CLKDIV - [4:2] */
302#define WM8400_DAC_CLKDIV_WIDTH 3 /* DAC_CLKDIV - [4:2] */
303
304/*
305 * R9 (0x09) - Audio Interface (3)
306 */
307#define WM8400_AIF_MSTR1 0x8000 /* AIF_MSTR1 */
308#define WM8400_AIF_MSTR1_MASK 0x8000 /* AIF_MSTR1 */
309#define WM8400_AIF_MSTR1_SHIFT 15 /* AIF_MSTR1 */
310#define WM8400_AIF_MSTR1_WIDTH 1 /* AIF_MSTR1 */
311#define WM8400_AIF_MSTR2 0x4000 /* AIF_MSTR2 */
312#define WM8400_AIF_MSTR2_MASK 0x4000 /* AIF_MSTR2 */
313#define WM8400_AIF_MSTR2_SHIFT 14 /* AIF_MSTR2 */
314#define WM8400_AIF_MSTR2_WIDTH 1 /* AIF_MSTR2 */
315#define WM8400_AIF_SEL 0x2000 /* AIF_SEL */
316#define WM8400_AIF_SEL_MASK 0x2000 /* AIF_SEL */
317#define WM8400_AIF_SEL_SHIFT 13 /* AIF_SEL */
318#define WM8400_AIF_SEL_WIDTH 1 /* AIF_SEL */
319#define WM8400_ADCLRC_DIR 0x0800 /* ADCLRC_DIR */
320#define WM8400_ADCLRC_DIR_MASK 0x0800 /* ADCLRC_DIR */
321#define WM8400_ADCLRC_DIR_SHIFT 11 /* ADCLRC_DIR */
322#define WM8400_ADCLRC_DIR_WIDTH 1 /* ADCLRC_DIR */
323#define WM8400_ADCLRC_RATE_MASK 0x07FF /* ADCLRC_RATE - [10:0] */
324#define WM8400_ADCLRC_RATE_SHIFT 0 /* ADCLRC_RATE - [10:0] */
325#define WM8400_ADCLRC_RATE_WIDTH 11 /* ADCLRC_RATE - [10:0] */
326
327/*
328 * R10 (0x0A) - Audio Interface (4)
329 */
330#define WM8400_ALRCGPIO1 0x8000 /* ALRCGPIO1 */
331#define WM8400_ALRCGPIO1_MASK 0x8000 /* ALRCGPIO1 */
332#define WM8400_ALRCGPIO1_SHIFT 15 /* ALRCGPIO1 */
333#define WM8400_ALRCGPIO1_WIDTH 1 /* ALRCGPIO1 */
334#define WM8400_ALRCBGPIO6 0x4000 /* ALRCBGPIO6 */
335#define WM8400_ALRCBGPIO6_MASK 0x4000 /* ALRCBGPIO6 */
336#define WM8400_ALRCBGPIO6_SHIFT 14 /* ALRCBGPIO6 */
337#define WM8400_ALRCBGPIO6_WIDTH 1 /* ALRCBGPIO6 */
338#define WM8400_AIF_TRIS 0x2000 /* AIF_TRIS */
339#define WM8400_AIF_TRIS_MASK 0x2000 /* AIF_TRIS */
340#define WM8400_AIF_TRIS_SHIFT 13 /* AIF_TRIS */
341#define WM8400_AIF_TRIS_WIDTH 1 /* AIF_TRIS */
342#define WM8400_DACLRC_DIR 0x0800 /* DACLRC_DIR */
343#define WM8400_DACLRC_DIR_MASK 0x0800 /* DACLRC_DIR */
344#define WM8400_DACLRC_DIR_SHIFT 11 /* DACLRC_DIR */
345#define WM8400_DACLRC_DIR_WIDTH 1 /* DACLRC_DIR */
346#define WM8400_DACLRC_RATE_MASK 0x07FF /* DACLRC_RATE - [10:0] */
347#define WM8400_DACLRC_RATE_SHIFT 0 /* DACLRC_RATE - [10:0] */
348#define WM8400_DACLRC_RATE_WIDTH 11 /* DACLRC_RATE - [10:0] */
349
350/*
351 * R11 (0x0B) - DAC CTRL
352 */
353#define WM8400_DAC_SDMCLK_RATE 0x2000 /* DAC_SDMCLK_RATE */
354#define WM8400_DAC_SDMCLK_RATE_MASK 0x2000 /* DAC_SDMCLK_RATE */
355#define WM8400_DAC_SDMCLK_RATE_SHIFT 13 /* DAC_SDMCLK_RATE */
356#define WM8400_DAC_SDMCLK_RATE_WIDTH 1 /* DAC_SDMCLK_RATE */
357#define WM8400_AIF_LRCLKRATE 0x0400 /* AIF_LRCLKRATE */
358#define WM8400_AIF_LRCLKRATE_MASK 0x0400 /* AIF_LRCLKRATE */
359#define WM8400_AIF_LRCLKRATE_SHIFT 10 /* AIF_LRCLKRATE */
360#define WM8400_AIF_LRCLKRATE_WIDTH 1 /* AIF_LRCLKRATE */
361#define WM8400_DAC_MONO 0x0200 /* DAC_MONO */
362#define WM8400_DAC_MONO_MASK 0x0200 /* DAC_MONO */
363#define WM8400_DAC_MONO_SHIFT 9 /* DAC_MONO */
364#define WM8400_DAC_MONO_WIDTH 1 /* DAC_MONO */
365#define WM8400_DAC_SB_FILT 0x0100 /* DAC_SB_FILT */
366#define WM8400_DAC_SB_FILT_MASK 0x0100 /* DAC_SB_FILT */
367#define WM8400_DAC_SB_FILT_SHIFT 8 /* DAC_SB_FILT */
368#define WM8400_DAC_SB_FILT_WIDTH 1 /* DAC_SB_FILT */
369#define WM8400_DAC_MUTERATE 0x0080 /* DAC_MUTERATE */
370#define WM8400_DAC_MUTERATE_MASK 0x0080 /* DAC_MUTERATE */
371#define WM8400_DAC_MUTERATE_SHIFT 7 /* DAC_MUTERATE */
372#define WM8400_DAC_MUTERATE_WIDTH 1 /* DAC_MUTERATE */
373#define WM8400_DAC_MUTEMODE 0x0040 /* DAC_MUTEMODE */
374#define WM8400_DAC_MUTEMODE_MASK 0x0040 /* DAC_MUTEMODE */
375#define WM8400_DAC_MUTEMODE_SHIFT 6 /* DAC_MUTEMODE */
376#define WM8400_DAC_MUTEMODE_WIDTH 1 /* DAC_MUTEMODE */
377#define WM8400_DEEMP_MASK 0x0030 /* DEEMP - [5:4] */
378#define WM8400_DEEMP_SHIFT 4 /* DEEMP - [5:4] */
379#define WM8400_DEEMP_WIDTH 2 /* DEEMP - [5:4] */
380#define WM8400_DAC_MUTE 0x0004 /* DAC_MUTE */
381#define WM8400_DAC_MUTE_MASK 0x0004 /* DAC_MUTE */
382#define WM8400_DAC_MUTE_SHIFT 2 /* DAC_MUTE */
383#define WM8400_DAC_MUTE_WIDTH 1 /* DAC_MUTE */
384#define WM8400_DACL_DATINV 0x0002 /* DACL_DATINV */
385#define WM8400_DACL_DATINV_MASK 0x0002 /* DACL_DATINV */
386#define WM8400_DACL_DATINV_SHIFT 1 /* DACL_DATINV */
387#define WM8400_DACL_DATINV_WIDTH 1 /* DACL_DATINV */
388#define WM8400_DACR_DATINV 0x0001 /* DACR_DATINV */
389#define WM8400_DACR_DATINV_MASK 0x0001 /* DACR_DATINV */
390#define WM8400_DACR_DATINV_SHIFT 0 /* DACR_DATINV */
391#define WM8400_DACR_DATINV_WIDTH 1 /* DACR_DATINV */
392
393/*
394 * R12 (0x0C) - Left DAC Digital Volume
395 */
396#define WM8400_DAC_VU 0x0100 /* DAC_VU */
397#define WM8400_DAC_VU_MASK 0x0100 /* DAC_VU */
398#define WM8400_DAC_VU_SHIFT 8 /* DAC_VU */
399#define WM8400_DAC_VU_WIDTH 1 /* DAC_VU */
400#define WM8400_DACL_VOL_MASK 0x00FF /* DACL_VOL - [7:0] */
401#define WM8400_DACL_VOL_SHIFT 0 /* DACL_VOL - [7:0] */
402#define WM8400_DACL_VOL_WIDTH 8 /* DACL_VOL - [7:0] */
403
404/*
405 * R13 (0x0D) - Right DAC Digital Volume
406 */
407#define WM8400_DAC_VU 0x0100 /* DAC_VU */
408#define WM8400_DAC_VU_MASK 0x0100 /* DAC_VU */
409#define WM8400_DAC_VU_SHIFT 8 /* DAC_VU */
410#define WM8400_DAC_VU_WIDTH 1 /* DAC_VU */
411#define WM8400_DACR_VOL_MASK 0x00FF /* DACR_VOL - [7:0] */
412#define WM8400_DACR_VOL_SHIFT 0 /* DACR_VOL - [7:0] */
413#define WM8400_DACR_VOL_WIDTH 8 /* DACR_VOL - [7:0] */
414
415/*
416 * R14 (0x0E) - Digital Side Tone
417 */
418#define WM8400_ADCL_DAC_SVOL_MASK 0x1E00 /* ADCL_DAC_SVOL - [12:9] */
419#define WM8400_ADCL_DAC_SVOL_SHIFT 9 /* ADCL_DAC_SVOL - [12:9] */
420#define WM8400_ADCL_DAC_SVOL_WIDTH 4 /* ADCL_DAC_SVOL - [12:9] */
421#define WM8400_ADCR_DAC_SVOL_MASK 0x01E0 /* ADCR_DAC_SVOL - [8:5] */
422#define WM8400_ADCR_DAC_SVOL_SHIFT 5 /* ADCR_DAC_SVOL - [8:5] */
423#define WM8400_ADCR_DAC_SVOL_WIDTH 4 /* ADCR_DAC_SVOL - [8:5] */
424#define WM8400_ADC_TO_DACL_MASK 0x000C /* ADC_TO_DACL - [3:2] */
425#define WM8400_ADC_TO_DACL_SHIFT 2 /* ADC_TO_DACL - [3:2] */
426#define WM8400_ADC_TO_DACL_WIDTH 2 /* ADC_TO_DACL - [3:2] */
427#define WM8400_ADC_TO_DACR_MASK 0x0003 /* ADC_TO_DACR - [1:0] */
428#define WM8400_ADC_TO_DACR_SHIFT 0 /* ADC_TO_DACR - [1:0] */
429#define WM8400_ADC_TO_DACR_WIDTH 2 /* ADC_TO_DACR - [1:0] */
430
431/*
432 * R15 (0x0F) - ADC CTRL
433 */
434#define WM8400_ADC_HPF_ENA 0x0100 /* ADC_HPF_ENA */
435#define WM8400_ADC_HPF_ENA_MASK 0x0100 /* ADC_HPF_ENA */
436#define WM8400_ADC_HPF_ENA_SHIFT 8 /* ADC_HPF_ENA */
437#define WM8400_ADC_HPF_ENA_WIDTH 1 /* ADC_HPF_ENA */
438#define WM8400_ADC_HPF_CUT_MASK 0x0060 /* ADC_HPF_CUT - [6:5] */
439#define WM8400_ADC_HPF_CUT_SHIFT 5 /* ADC_HPF_CUT - [6:5] */
440#define WM8400_ADC_HPF_CUT_WIDTH 2 /* ADC_HPF_CUT - [6:5] */
441#define WM8400_ADCL_DATINV 0x0002 /* ADCL_DATINV */
442#define WM8400_ADCL_DATINV_MASK 0x0002 /* ADCL_DATINV */
443#define WM8400_ADCL_DATINV_SHIFT 1 /* ADCL_DATINV */
444#define WM8400_ADCL_DATINV_WIDTH 1 /* ADCL_DATINV */
445#define WM8400_ADCR_DATINV 0x0001 /* ADCR_DATINV */
446#define WM8400_ADCR_DATINV_MASK 0x0001 /* ADCR_DATINV */
447#define WM8400_ADCR_DATINV_SHIFT 0 /* ADCR_DATINV */
448#define WM8400_ADCR_DATINV_WIDTH 1 /* ADCR_DATINV */
449
450/*
451 * R16 (0x10) - Left ADC Digital Volume
452 */
453#define WM8400_ADC_VU 0x0100 /* ADC_VU */
454#define WM8400_ADC_VU_MASK 0x0100 /* ADC_VU */
455#define WM8400_ADC_VU_SHIFT 8 /* ADC_VU */
456#define WM8400_ADC_VU_WIDTH 1 /* ADC_VU */
457#define WM8400_ADCL_VOL_MASK 0x00FF /* ADCL_VOL - [7:0] */
458#define WM8400_ADCL_VOL_SHIFT 0 /* ADCL_VOL - [7:0] */
459#define WM8400_ADCL_VOL_WIDTH 8 /* ADCL_VOL - [7:0] */
460
461/*
462 * R17 (0x11) - Right ADC Digital Volume
463 */
464#define WM8400_ADC_VU 0x0100 /* ADC_VU */
465#define WM8400_ADC_VU_MASK 0x0100 /* ADC_VU */
466#define WM8400_ADC_VU_SHIFT 8 /* ADC_VU */
467#define WM8400_ADC_VU_WIDTH 1 /* ADC_VU */
468#define WM8400_ADCR_VOL_MASK 0x00FF /* ADCR_VOL - [7:0] */
469#define WM8400_ADCR_VOL_SHIFT 0 /* ADCR_VOL - [7:0] */
470#define WM8400_ADCR_VOL_WIDTH 8 /* ADCR_VOL - [7:0] */
471
472/*
473 * R24 (0x18) - Left Line Input 1&2 Volume
474 */
475#define WM8400_IPVU 0x0100 /* IPVU */
476#define WM8400_IPVU_MASK 0x0100 /* IPVU */
477#define WM8400_IPVU_SHIFT 8 /* IPVU */
478#define WM8400_IPVU_WIDTH 1 /* IPVU */
479#define WM8400_LI12MUTE 0x0080 /* LI12MUTE */
480#define WM8400_LI12MUTE_MASK 0x0080 /* LI12MUTE */
481#define WM8400_LI12MUTE_SHIFT 7 /* LI12MUTE */
482#define WM8400_LI12MUTE_WIDTH 1 /* LI12MUTE */
483#define WM8400_LI12ZC 0x0040 /* LI12ZC */
484#define WM8400_LI12ZC_MASK 0x0040 /* LI12ZC */
485#define WM8400_LI12ZC_SHIFT 6 /* LI12ZC */
486#define WM8400_LI12ZC_WIDTH 1 /* LI12ZC */
487#define WM8400_LIN12VOL_MASK 0x001F /* LIN12VOL - [4:0] */
488#define WM8400_LIN12VOL_SHIFT 0 /* LIN12VOL - [4:0] */
489#define WM8400_LIN12VOL_WIDTH 5 /* LIN12VOL - [4:0] */
490
491/*
492 * R25 (0x19) - Left Line Input 3&4 Volume
493 */
494#define WM8400_IPVU 0x0100 /* IPVU */
495#define WM8400_IPVU_MASK 0x0100 /* IPVU */
496#define WM8400_IPVU_SHIFT 8 /* IPVU */
497#define WM8400_IPVU_WIDTH 1 /* IPVU */
498#define WM8400_LI34MUTE 0x0080 /* LI34MUTE */
499#define WM8400_LI34MUTE_MASK 0x0080 /* LI34MUTE */
500#define WM8400_LI34MUTE_SHIFT 7 /* LI34MUTE */
501#define WM8400_LI34MUTE_WIDTH 1 /* LI34MUTE */
502#define WM8400_LI34ZC 0x0040 /* LI34ZC */
503#define WM8400_LI34ZC_MASK 0x0040 /* LI34ZC */
504#define WM8400_LI34ZC_SHIFT 6 /* LI34ZC */
505#define WM8400_LI34ZC_WIDTH 1 /* LI34ZC */
506#define WM8400_LIN34VOL_MASK 0x001F /* LIN34VOL - [4:0] */
507#define WM8400_LIN34VOL_SHIFT 0 /* LIN34VOL - [4:0] */
508#define WM8400_LIN34VOL_WIDTH 5 /* LIN34VOL - [4:0] */
509
510/*
511 * R26 (0x1A) - Right Line Input 1&2 Volume
512 */
513#define WM8400_IPVU 0x0100 /* IPVU */
514#define WM8400_IPVU_MASK 0x0100 /* IPVU */
515#define WM8400_IPVU_SHIFT 8 /* IPVU */
516#define WM8400_IPVU_WIDTH 1 /* IPVU */
517#define WM8400_RI12MUTE 0x0080 /* RI12MUTE */
518#define WM8400_RI12MUTE_MASK 0x0080 /* RI12MUTE */
519#define WM8400_RI12MUTE_SHIFT 7 /* RI12MUTE */
520#define WM8400_RI12MUTE_WIDTH 1 /* RI12MUTE */
521#define WM8400_RI12ZC 0x0040 /* RI12ZC */
522#define WM8400_RI12ZC_MASK 0x0040 /* RI12ZC */
523#define WM8400_RI12ZC_SHIFT 6 /* RI12ZC */
524#define WM8400_RI12ZC_WIDTH 1 /* RI12ZC */
525#define WM8400_RIN12VOL_MASK 0x001F /* RIN12VOL - [4:0] */
526#define WM8400_RIN12VOL_SHIFT 0 /* RIN12VOL - [4:0] */
527#define WM8400_RIN12VOL_WIDTH 5 /* RIN12VOL - [4:0] */
528
529/*
530 * R27 (0x1B) - Right Line Input 3&4 Volume
531 */
532#define WM8400_IPVU 0x0100 /* IPVU */
533#define WM8400_IPVU_MASK 0x0100 /* IPVU */
534#define WM8400_IPVU_SHIFT 8 /* IPVU */
535#define WM8400_IPVU_WIDTH 1 /* IPVU */
536#define WM8400_RI34MUTE 0x0080 /* RI34MUTE */
537#define WM8400_RI34MUTE_MASK 0x0080 /* RI34MUTE */
538#define WM8400_RI34MUTE_SHIFT 7 /* RI34MUTE */
539#define WM8400_RI34MUTE_WIDTH 1 /* RI34MUTE */
540#define WM8400_RI34ZC 0x0040 /* RI34ZC */
541#define WM8400_RI34ZC_MASK 0x0040 /* RI34ZC */
542#define WM8400_RI34ZC_SHIFT 6 /* RI34ZC */
543#define WM8400_RI34ZC_WIDTH 1 /* RI34ZC */
544#define WM8400_RIN34VOL_MASK 0x001F /* RIN34VOL - [4:0] */
545#define WM8400_RIN34VOL_SHIFT 0 /* RIN34VOL - [4:0] */
546#define WM8400_RIN34VOL_WIDTH 5 /* RIN34VOL - [4:0] */
547
548/*
549 * R28 (0x1C) - Left Output Volume
550 */
551#define WM8400_OPVU 0x0100 /* OPVU */
552#define WM8400_OPVU_MASK 0x0100 /* OPVU */
553#define WM8400_OPVU_SHIFT 8 /* OPVU */
554#define WM8400_OPVU_WIDTH 1 /* OPVU */
555#define WM8400_LOZC 0x0080 /* LOZC */
556#define WM8400_LOZC_MASK 0x0080 /* LOZC */
557#define WM8400_LOZC_SHIFT 7 /* LOZC */
558#define WM8400_LOZC_WIDTH 1 /* LOZC */
559#define WM8400_LOUTVOL_MASK 0x007F /* LOUTVOL - [6:0] */
560#define WM8400_LOUTVOL_SHIFT 0 /* LOUTVOL - [6:0] */
561#define WM8400_LOUTVOL_WIDTH 7 /* LOUTVOL - [6:0] */
562
563/*
564 * R29 (0x1D) - Right Output Volume
565 */
566#define WM8400_OPVU 0x0100 /* OPVU */
567#define WM8400_OPVU_MASK 0x0100 /* OPVU */
568#define WM8400_OPVU_SHIFT 8 /* OPVU */
569#define WM8400_OPVU_WIDTH 1 /* OPVU */
570#define WM8400_ROZC 0x0080 /* ROZC */
571#define WM8400_ROZC_MASK 0x0080 /* ROZC */
572#define WM8400_ROZC_SHIFT 7 /* ROZC */
573#define WM8400_ROZC_WIDTH 1 /* ROZC */
574#define WM8400_ROUTVOL_MASK 0x007F /* ROUTVOL - [6:0] */
575#define WM8400_ROUTVOL_SHIFT 0 /* ROUTVOL - [6:0] */
576#define WM8400_ROUTVOL_WIDTH 7 /* ROUTVOL - [6:0] */
577
578/*
579 * R30 (0x1E) - Line Outputs Volume
580 */
581#define WM8400_LONMUTE 0x0040 /* LONMUTE */
582#define WM8400_LONMUTE_MASK 0x0040 /* LONMUTE */
583#define WM8400_LONMUTE_SHIFT 6 /* LONMUTE */
584#define WM8400_LONMUTE_WIDTH 1 /* LONMUTE */
585#define WM8400_LOPMUTE 0x0020 /* LOPMUTE */
586#define WM8400_LOPMUTE_MASK 0x0020 /* LOPMUTE */
587#define WM8400_LOPMUTE_SHIFT 5 /* LOPMUTE */
588#define WM8400_LOPMUTE_WIDTH 1 /* LOPMUTE */
589#define WM8400_LOATTN 0x0010 /* LOATTN */
590#define WM8400_LOATTN_MASK 0x0010 /* LOATTN */
591#define WM8400_LOATTN_SHIFT 4 /* LOATTN */
592#define WM8400_LOATTN_WIDTH 1 /* LOATTN */
593#define WM8400_RONMUTE 0x0004 /* RONMUTE */
594#define WM8400_RONMUTE_MASK 0x0004 /* RONMUTE */
595#define WM8400_RONMUTE_SHIFT 2 /* RONMUTE */
596#define WM8400_RONMUTE_WIDTH 1 /* RONMUTE */
597#define WM8400_ROPMUTE 0x0002 /* ROPMUTE */
598#define WM8400_ROPMUTE_MASK 0x0002 /* ROPMUTE */
599#define WM8400_ROPMUTE_SHIFT 1 /* ROPMUTE */
600#define WM8400_ROPMUTE_WIDTH 1 /* ROPMUTE */
601#define WM8400_ROATTN 0x0001 /* ROATTN */
602#define WM8400_ROATTN_MASK 0x0001 /* ROATTN */
603#define WM8400_ROATTN_SHIFT 0 /* ROATTN */
604#define WM8400_ROATTN_WIDTH 1 /* ROATTN */
605
606/*
607 * R31 (0x1F) - Out3/4 Volume
608 */
609#define WM8400_OUT3MUTE 0x0020 /* OUT3MUTE */
610#define WM8400_OUT3MUTE_MASK 0x0020 /* OUT3MUTE */
611#define WM8400_OUT3MUTE_SHIFT 5 /* OUT3MUTE */
612#define WM8400_OUT3MUTE_WIDTH 1 /* OUT3MUTE */
613#define WM8400_OUT3ATTN 0x0010 /* OUT3ATTN */
614#define WM8400_OUT3ATTN_MASK 0x0010 /* OUT3ATTN */
615#define WM8400_OUT3ATTN_SHIFT 4 /* OUT3ATTN */
616#define WM8400_OUT3ATTN_WIDTH 1 /* OUT3ATTN */
617#define WM8400_OUT4MUTE 0x0002 /* OUT4MUTE */
618#define WM8400_OUT4MUTE_MASK 0x0002 /* OUT4MUTE */
619#define WM8400_OUT4MUTE_SHIFT 1 /* OUT4MUTE */
620#define WM8400_OUT4MUTE_WIDTH 1 /* OUT4MUTE */
621#define WM8400_OUT4ATTN 0x0001 /* OUT4ATTN */
622#define WM8400_OUT4ATTN_MASK 0x0001 /* OUT4ATTN */
623#define WM8400_OUT4ATTN_SHIFT 0 /* OUT4ATTN */
624#define WM8400_OUT4ATTN_WIDTH 1 /* OUT4ATTN */
625
626/*
627 * R32 (0x20) - Left OPGA Volume
628 */
629#define WM8400_OPVU 0x0100 /* OPVU */
630#define WM8400_OPVU_MASK 0x0100 /* OPVU */
631#define WM8400_OPVU_SHIFT 8 /* OPVU */
632#define WM8400_OPVU_WIDTH 1 /* OPVU */
633#define WM8400_LOPGAZC 0x0080 /* LOPGAZC */
634#define WM8400_LOPGAZC_MASK 0x0080 /* LOPGAZC */
635#define WM8400_LOPGAZC_SHIFT 7 /* LOPGAZC */
636#define WM8400_LOPGAZC_WIDTH 1 /* LOPGAZC */
637#define WM8400_LOPGAVOL_MASK 0x007F /* LOPGAVOL - [6:0] */
638#define WM8400_LOPGAVOL_SHIFT 0 /* LOPGAVOL - [6:0] */
639#define WM8400_LOPGAVOL_WIDTH 7 /* LOPGAVOL - [6:0] */
640
641/*
642 * R33 (0x21) - Right OPGA Volume
643 */
644#define WM8400_OPVU 0x0100 /* OPVU */
645#define WM8400_OPVU_MASK 0x0100 /* OPVU */
646#define WM8400_OPVU_SHIFT 8 /* OPVU */
647#define WM8400_OPVU_WIDTH 1 /* OPVU */
648#define WM8400_ROPGAZC 0x0080 /* ROPGAZC */
649#define WM8400_ROPGAZC_MASK 0x0080 /* ROPGAZC */
650#define WM8400_ROPGAZC_SHIFT 7 /* ROPGAZC */
651#define WM8400_ROPGAZC_WIDTH 1 /* ROPGAZC */
652#define WM8400_ROPGAVOL_MASK 0x007F /* ROPGAVOL - [6:0] */
653#define WM8400_ROPGAVOL_SHIFT 0 /* ROPGAVOL - [6:0] */
654#define WM8400_ROPGAVOL_WIDTH 7 /* ROPGAVOL - [6:0] */
655
656/*
657 * R34 (0x22) - Speaker Volume
658 */
659#define WM8400_SPKATTN_MASK 0x0003 /* SPKATTN - [1:0] */
660#define WM8400_SPKATTN_SHIFT 0 /* SPKATTN - [1:0] */
661#define WM8400_SPKATTN_WIDTH 2 /* SPKATTN - [1:0] */
662
663/*
664 * R35 (0x23) - ClassD1
665 */
666#define WM8400_CDMODE 0x0100 /* CDMODE */
667#define WM8400_CDMODE_MASK 0x0100 /* CDMODE */
668#define WM8400_CDMODE_SHIFT 8 /* CDMODE */
669#define WM8400_CDMODE_WIDTH 1 /* CDMODE */
670#define WM8400_CLASSD_CLK_SEL 0x0080 /* CLASSD_CLK_SEL */
671#define WM8400_CLASSD_CLK_SEL_MASK 0x0080 /* CLASSD_CLK_SEL */
672#define WM8400_CLASSD_CLK_SEL_SHIFT 7 /* CLASSD_CLK_SEL */
673#define WM8400_CLASSD_CLK_SEL_WIDTH 1 /* CLASSD_CLK_SEL */
674#define WM8400_CD_SRCTRL 0x0040 /* CD_SRCTRL */
675#define WM8400_CD_SRCTRL_MASK 0x0040 /* CD_SRCTRL */
676#define WM8400_CD_SRCTRL_SHIFT 6 /* CD_SRCTRL */
677#define WM8400_CD_SRCTRL_WIDTH 1 /* CD_SRCTRL */
678#define WM8400_SPKNOPOP 0x0020 /* SPKNOPOP */
679#define WM8400_SPKNOPOP_MASK 0x0020 /* SPKNOPOP */
680#define WM8400_SPKNOPOP_SHIFT 5 /* SPKNOPOP */
681#define WM8400_SPKNOPOP_WIDTH 1 /* SPKNOPOP */
682#define WM8400_DBLERATE 0x0010 /* DBLERATE */
683#define WM8400_DBLERATE_MASK 0x0010 /* DBLERATE */
684#define WM8400_DBLERATE_SHIFT 4 /* DBLERATE */
685#define WM8400_DBLERATE_WIDTH 1 /* DBLERATE */
686#define WM8400_LOOPTEST 0x0008 /* LOOPTEST */
687#define WM8400_LOOPTEST_MASK 0x0008 /* LOOPTEST */
688#define WM8400_LOOPTEST_SHIFT 3 /* LOOPTEST */
689#define WM8400_LOOPTEST_WIDTH 1 /* LOOPTEST */
690#define WM8400_HALFABBIAS 0x0004 /* HALFABBIAS */
691#define WM8400_HALFABBIAS_MASK 0x0004 /* HALFABBIAS */
692#define WM8400_HALFABBIAS_SHIFT 2 /* HALFABBIAS */
693#define WM8400_HALFABBIAS_WIDTH 1 /* HALFABBIAS */
694#define WM8400_TRIDEL_MASK 0x0003 /* TRIDEL - [1:0] */
695#define WM8400_TRIDEL_SHIFT 0 /* TRIDEL - [1:0] */
696#define WM8400_TRIDEL_WIDTH 2 /* TRIDEL - [1:0] */
697
698/*
699 * R37 (0x25) - ClassD3
700 */
701#define WM8400_DCGAIN_MASK 0x0038 /* DCGAIN - [5:3] */
702#define WM8400_DCGAIN_SHIFT 3 /* DCGAIN - [5:3] */
703#define WM8400_DCGAIN_WIDTH 3 /* DCGAIN - [5:3] */
704#define WM8400_ACGAIN_MASK 0x0007 /* ACGAIN - [2:0] */
705#define WM8400_ACGAIN_SHIFT 0 /* ACGAIN - [2:0] */
706#define WM8400_ACGAIN_WIDTH 3 /* ACGAIN - [2:0] */
707
708/*
709 * R39 (0x27) - Input Mixer1
710 */
711#define WM8400_AINLMODE_MASK 0x000C /* AINLMODE - [3:2] */
712#define WM8400_AINLMODE_SHIFT 2 /* AINLMODE - [3:2] */
713#define WM8400_AINLMODE_WIDTH 2 /* AINLMODE - [3:2] */
714#define WM8400_AINRMODE_MASK 0x0003 /* AINRMODE - [1:0] */
715#define WM8400_AINRMODE_SHIFT 0 /* AINRMODE - [1:0] */
716#define WM8400_AINRMODE_WIDTH 2 /* AINRMODE - [1:0] */
717
718/*
719 * R40 (0x28) - Input Mixer2
720 */
721#define WM8400_LMP4 0x0080 /* LMP4 */
722#define WM8400_LMP4_MASK 0x0080 /* LMP4 */
723#define WM8400_LMP4_SHIFT 7 /* LMP4 */
724#define WM8400_LMP4_WIDTH 1 /* LMP4 */
725#define WM8400_LMN3 0x0040 /* LMN3 */
726#define WM8400_LMN3_MASK 0x0040 /* LMN3 */
727#define WM8400_LMN3_SHIFT 6 /* LMN3 */
728#define WM8400_LMN3_WIDTH 1 /* LMN3 */
729#define WM8400_LMP2 0x0020 /* LMP2 */
730#define WM8400_LMP2_MASK 0x0020 /* LMP2 */
731#define WM8400_LMP2_SHIFT 5 /* LMP2 */
732#define WM8400_LMP2_WIDTH 1 /* LMP2 */
733#define WM8400_LMN1 0x0010 /* LMN1 */
734#define WM8400_LMN1_MASK 0x0010 /* LMN1 */
735#define WM8400_LMN1_SHIFT 4 /* LMN1 */
736#define WM8400_LMN1_WIDTH 1 /* LMN1 */
737#define WM8400_RMP4 0x0008 /* RMP4 */
738#define WM8400_RMP4_MASK 0x0008 /* RMP4 */
739#define WM8400_RMP4_SHIFT 3 /* RMP4 */
740#define WM8400_RMP4_WIDTH 1 /* RMP4 */
741#define WM8400_RMN3 0x0004 /* RMN3 */
742#define WM8400_RMN3_MASK 0x0004 /* RMN3 */
743#define WM8400_RMN3_SHIFT 2 /* RMN3 */
744#define WM8400_RMN3_WIDTH 1 /* RMN3 */
745#define WM8400_RMP2 0x0002 /* RMP2 */
746#define WM8400_RMP2_MASK 0x0002 /* RMP2 */
747#define WM8400_RMP2_SHIFT 1 /* RMP2 */
748#define WM8400_RMP2_WIDTH 1 /* RMP2 */
749#define WM8400_RMN1 0x0001 /* RMN1 */
750#define WM8400_RMN1_MASK 0x0001 /* RMN1 */
751#define WM8400_RMN1_SHIFT 0 /* RMN1 */
752#define WM8400_RMN1_WIDTH 1 /* RMN1 */
753
754/*
755 * R41 (0x29) - Input Mixer3
756 */
757#define WM8400_L34MNB 0x0100 /* L34MNB */
758#define WM8400_L34MNB_MASK 0x0100 /* L34MNB */
759#define WM8400_L34MNB_SHIFT 8 /* L34MNB */
760#define WM8400_L34MNB_WIDTH 1 /* L34MNB */
761#define WM8400_L34MNBST 0x0080 /* L34MNBST */
762#define WM8400_L34MNBST_MASK 0x0080 /* L34MNBST */
763#define WM8400_L34MNBST_SHIFT 7 /* L34MNBST */
764#define WM8400_L34MNBST_WIDTH 1 /* L34MNBST */
765#define WM8400_L12MNB 0x0020 /* L12MNB */
766#define WM8400_L12MNB_MASK 0x0020 /* L12MNB */
767#define WM8400_L12MNB_SHIFT 5 /* L12MNB */
768#define WM8400_L12MNB_WIDTH 1 /* L12MNB */
769#define WM8400_L12MNBST 0x0010 /* L12MNBST */
770#define WM8400_L12MNBST_MASK 0x0010 /* L12MNBST */
771#define WM8400_L12MNBST_SHIFT 4 /* L12MNBST */
772#define WM8400_L12MNBST_WIDTH 1 /* L12MNBST */
773#define WM8400_LDBVOL_MASK 0x0007 /* LDBVOL - [2:0] */
774#define WM8400_LDBVOL_SHIFT 0 /* LDBVOL - [2:0] */
775#define WM8400_LDBVOL_WIDTH 3 /* LDBVOL - [2:0] */
776
777/*
778 * R42 (0x2A) - Input Mixer4
779 */
780#define WM8400_R34MNB 0x0100 /* R34MNB */
781#define WM8400_R34MNB_MASK 0x0100 /* R34MNB */
782#define WM8400_R34MNB_SHIFT 8 /* R34MNB */
783#define WM8400_R34MNB_WIDTH 1 /* R34MNB */
784#define WM8400_R34MNBST 0x0080 /* R34MNBST */
785#define WM8400_R34MNBST_MASK 0x0080 /* R34MNBST */
786#define WM8400_R34MNBST_SHIFT 7 /* R34MNBST */
787#define WM8400_R34MNBST_WIDTH 1 /* R34MNBST */
788#define WM8400_R12MNB 0x0020 /* R12MNB */
789#define WM8400_R12MNB_MASK 0x0020 /* R12MNB */
790#define WM8400_R12MNB_SHIFT 5 /* R12MNB */
791#define WM8400_R12MNB_WIDTH 1 /* R12MNB */
792#define WM8400_R12MNBST 0x0010 /* R12MNBST */
793#define WM8400_R12MNBST_MASK 0x0010 /* R12MNBST */
794#define WM8400_R12MNBST_SHIFT 4 /* R12MNBST */
795#define WM8400_R12MNBST_WIDTH 1 /* R12MNBST */
796#define WM8400_RDBVOL_MASK 0x0007 /* RDBVOL - [2:0] */
797#define WM8400_RDBVOL_SHIFT 0 /* RDBVOL - [2:0] */
798#define WM8400_RDBVOL_WIDTH 3 /* RDBVOL - [2:0] */
799
800/*
801 * R43 (0x2B) - Input Mixer5
802 */
803#define WM8400_LI2BVOL_MASK 0x01C0 /* LI2BVOL - [8:6] */
804#define WM8400_LI2BVOL_SHIFT 6 /* LI2BVOL - [8:6] */
805#define WM8400_LI2BVOL_WIDTH 3 /* LI2BVOL - [8:6] */
806#define WM8400_LR4BVOL_MASK 0x0038 /* LR4BVOL - [5:3] */
807#define WM8400_LR4BVOL_SHIFT 3 /* LR4BVOL - [5:3] */
808#define WM8400_LR4BVOL_WIDTH 3 /* LR4BVOL - [5:3] */
809#define WM8400_LL4BVOL_MASK 0x0007 /* LL4BVOL - [2:0] */
810#define WM8400_LL4BVOL_SHIFT 0 /* LL4BVOL - [2:0] */
811#define WM8400_LL4BVOL_WIDTH 3 /* LL4BVOL - [2:0] */
812
813/*
814 * R44 (0x2C) - Input Mixer6
815 */
816#define WM8400_RI2BVOL_MASK 0x01C0 /* RI2BVOL - [8:6] */
817#define WM8400_RI2BVOL_SHIFT 6 /* RI2BVOL - [8:6] */
818#define WM8400_RI2BVOL_WIDTH 3 /* RI2BVOL - [8:6] */
819#define WM8400_RL4BVOL_MASK 0x0038 /* RL4BVOL - [5:3] */
820#define WM8400_RL4BVOL_SHIFT 3 /* RL4BVOL - [5:3] */
821#define WM8400_RL4BVOL_WIDTH 3 /* RL4BVOL - [5:3] */
822#define WM8400_RR4BVOL_MASK 0x0007 /* RR4BVOL - [2:0] */
823#define WM8400_RR4BVOL_SHIFT 0 /* RR4BVOL - [2:0] */
824#define WM8400_RR4BVOL_WIDTH 3 /* RR4BVOL - [2:0] */
825
826/*
827 * R45 (0x2D) - Output Mixer1
828 */
829#define WM8400_LRBLO 0x0080 /* LRBLO */
830#define WM8400_LRBLO_MASK 0x0080 /* LRBLO */
831#define WM8400_LRBLO_SHIFT 7 /* LRBLO */
832#define WM8400_LRBLO_WIDTH 1 /* LRBLO */
833#define WM8400_LLBLO 0x0040 /* LLBLO */
834#define WM8400_LLBLO_MASK 0x0040 /* LLBLO */
835#define WM8400_LLBLO_SHIFT 6 /* LLBLO */
836#define WM8400_LLBLO_WIDTH 1 /* LLBLO */
837#define WM8400_LRI3LO 0x0020 /* LRI3LO */
838#define WM8400_LRI3LO_MASK 0x0020 /* LRI3LO */
839#define WM8400_LRI3LO_SHIFT 5 /* LRI3LO */
840#define WM8400_LRI3LO_WIDTH 1 /* LRI3LO */
841#define WM8400_LLI3LO 0x0010 /* LLI3LO */
842#define WM8400_LLI3LO_MASK 0x0010 /* LLI3LO */
843#define WM8400_LLI3LO_SHIFT 4 /* LLI3LO */
844#define WM8400_LLI3LO_WIDTH 1 /* LLI3LO */
845#define WM8400_LR12LO 0x0008 /* LR12LO */
846#define WM8400_LR12LO_MASK 0x0008 /* LR12LO */
847#define WM8400_LR12LO_SHIFT 3 /* LR12LO */
848#define WM8400_LR12LO_WIDTH 1 /* LR12LO */
849#define WM8400_LL12LO 0x0004 /* LL12LO */
850#define WM8400_LL12LO_MASK 0x0004 /* LL12LO */
851#define WM8400_LL12LO_SHIFT 2 /* LL12LO */
852#define WM8400_LL12LO_WIDTH 1 /* LL12LO */
853#define WM8400_LDLO 0x0001 /* LDLO */
854#define WM8400_LDLO_MASK 0x0001 /* LDLO */
855#define WM8400_LDLO_SHIFT 0 /* LDLO */
856#define WM8400_LDLO_WIDTH 1 /* LDLO */
857
858/*
859 * R46 (0x2E) - Output Mixer2
860 */
861#define WM8400_RLBRO 0x0080 /* RLBRO */
862#define WM8400_RLBRO_MASK 0x0080 /* RLBRO */
863#define WM8400_RLBRO_SHIFT 7 /* RLBRO */
864#define WM8400_RLBRO_WIDTH 1 /* RLBRO */
865#define WM8400_RRBRO 0x0040 /* RRBRO */
866#define WM8400_RRBRO_MASK 0x0040 /* RRBRO */
867#define WM8400_RRBRO_SHIFT 6 /* RRBRO */
868#define WM8400_RRBRO_WIDTH 1 /* RRBRO */
869#define WM8400_RLI3RO 0x0020 /* RLI3RO */
870#define WM8400_RLI3RO_MASK 0x0020 /* RLI3RO */
871#define WM8400_RLI3RO_SHIFT 5 /* RLI3RO */
872#define WM8400_RLI3RO_WIDTH 1 /* RLI3RO */
873#define WM8400_RRI3RO 0x0010 /* RRI3RO */
874#define WM8400_RRI3RO_MASK 0x0010 /* RRI3RO */
875#define WM8400_RRI3RO_SHIFT 4 /* RRI3RO */
876#define WM8400_RRI3RO_WIDTH 1 /* RRI3RO */
877#define WM8400_RL12RO 0x0008 /* RL12RO */
878#define WM8400_RL12RO_MASK 0x0008 /* RL12RO */
879#define WM8400_RL12RO_SHIFT 3 /* RL12RO */
880#define WM8400_RL12RO_WIDTH 1 /* RL12RO */
881#define WM8400_RR12RO 0x0004 /* RR12RO */
882#define WM8400_RR12RO_MASK 0x0004 /* RR12RO */
883#define WM8400_RR12RO_SHIFT 2 /* RR12RO */
884#define WM8400_RR12RO_WIDTH 1 /* RR12RO */
885#define WM8400_RDRO 0x0001 /* RDRO */
886#define WM8400_RDRO_MASK 0x0001 /* RDRO */
887#define WM8400_RDRO_SHIFT 0 /* RDRO */
888#define WM8400_RDRO_WIDTH 1 /* RDRO */
889
890/*
891 * R47 (0x2F) - Output Mixer3
892 */
893#define WM8400_LLI3LOVOL_MASK 0x01C0 /* LLI3LOVOL - [8:6] */
894#define WM8400_LLI3LOVOL_SHIFT 6 /* LLI3LOVOL - [8:6] */
895#define WM8400_LLI3LOVOL_WIDTH 3 /* LLI3LOVOL - [8:6] */
896#define WM8400_LR12LOVOL_MASK 0x0038 /* LR12LOVOL - [5:3] */
897#define WM8400_LR12LOVOL_SHIFT 3 /* LR12LOVOL - [5:3] */
898#define WM8400_LR12LOVOL_WIDTH 3 /* LR12LOVOL - [5:3] */
899#define WM8400_LL12LOVOL_MASK 0x0007 /* LL12LOVOL - [2:0] */
900#define WM8400_LL12LOVOL_SHIFT 0 /* LL12LOVOL - [2:0] */
901#define WM8400_LL12LOVOL_WIDTH 3 /* LL12LOVOL - [2:0] */
902
903/*
904 * R48 (0x30) - Output Mixer4
905 */
906#define WM8400_RRI3ROVOL_MASK 0x01C0 /* RRI3ROVOL - [8:6] */
907#define WM8400_RRI3ROVOL_SHIFT 6 /* RRI3ROVOL - [8:6] */
908#define WM8400_RRI3ROVOL_WIDTH 3 /* RRI3ROVOL - [8:6] */
909#define WM8400_RL12ROVOL_MASK 0x0038 /* RL12ROVOL - [5:3] */
910#define WM8400_RL12ROVOL_SHIFT 3 /* RL12ROVOL - [5:3] */
911#define WM8400_RL12ROVOL_WIDTH 3 /* RL12ROVOL - [5:3] */
912#define WM8400_RR12ROVOL_MASK 0x0007 /* RR12ROVOL - [2:0] */
913#define WM8400_RR12ROVOL_SHIFT 0 /* RR12ROVOL - [2:0] */
914#define WM8400_RR12ROVOL_WIDTH 3 /* RR12ROVOL - [2:0] */
915
916/*
917 * R49 (0x31) - Output Mixer5
918 */
919#define WM8400_LRI3LOVOL_MASK 0x01C0 /* LRI3LOVOL - [8:6] */
920#define WM8400_LRI3LOVOL_SHIFT 6 /* LRI3LOVOL - [8:6] */
921#define WM8400_LRI3LOVOL_WIDTH 3 /* LRI3LOVOL - [8:6] */
922#define WM8400_LRBLOVOL_MASK 0x0038 /* LRBLOVOL - [5:3] */
923#define WM8400_LRBLOVOL_SHIFT 3 /* LRBLOVOL - [5:3] */
924#define WM8400_LRBLOVOL_WIDTH 3 /* LRBLOVOL - [5:3] */
925#define WM8400_LLBLOVOL_MASK 0x0007 /* LLBLOVOL - [2:0] */
926#define WM8400_LLBLOVOL_SHIFT 0 /* LLBLOVOL - [2:0] */
927#define WM8400_LLBLOVOL_WIDTH 3 /* LLBLOVOL - [2:0] */
928
929/*
930 * R50 (0x32) - Output Mixer6
931 */
932#define WM8400_RLI3ROVOL_MASK 0x01C0 /* RLI3ROVOL - [8:6] */
933#define WM8400_RLI3ROVOL_SHIFT 6 /* RLI3ROVOL - [8:6] */
934#define WM8400_RLI3ROVOL_WIDTH 3 /* RLI3ROVOL - [8:6] */
935#define WM8400_RLBROVOL_MASK 0x0038 /* RLBROVOL - [5:3] */
936#define WM8400_RLBROVOL_SHIFT 3 /* RLBROVOL - [5:3] */
937#define WM8400_RLBROVOL_WIDTH 3 /* RLBROVOL - [5:3] */
938#define WM8400_RRBROVOL_MASK 0x0007 /* RRBROVOL - [2:0] */
939#define WM8400_RRBROVOL_SHIFT 0 /* RRBROVOL - [2:0] */
940#define WM8400_RRBROVOL_WIDTH 3 /* RRBROVOL - [2:0] */
941
942/*
943 * R51 (0x33) - Out3/4 Mixer
944 */
945#define WM8400_VSEL_MASK 0x0180 /* VSEL - [8:7] */
946#define WM8400_VSEL_SHIFT 7 /* VSEL - [8:7] */
947#define WM8400_VSEL_WIDTH 2 /* VSEL - [8:7] */
948#define WM8400_LI4O3 0x0020 /* LI4O3 */
949#define WM8400_LI4O3_MASK 0x0020 /* LI4O3 */
950#define WM8400_LI4O3_SHIFT 5 /* LI4O3 */
951#define WM8400_LI4O3_WIDTH 1 /* LI4O3 */
952#define WM8400_LPGAO3 0x0010 /* LPGAO3 */
953#define WM8400_LPGAO3_MASK 0x0010 /* LPGAO3 */
954#define WM8400_LPGAO3_SHIFT 4 /* LPGAO3 */
955#define WM8400_LPGAO3_WIDTH 1 /* LPGAO3 */
956#define WM8400_RI4O4 0x0002 /* RI4O4 */
957#define WM8400_RI4O4_MASK 0x0002 /* RI4O4 */
958#define WM8400_RI4O4_SHIFT 1 /* RI4O4 */
959#define WM8400_RI4O4_WIDTH 1 /* RI4O4 */
960#define WM8400_RPGAO4 0x0001 /* RPGAO4 */
961#define WM8400_RPGAO4_MASK 0x0001 /* RPGAO4 */
962#define WM8400_RPGAO4_SHIFT 0 /* RPGAO4 */
963#define WM8400_RPGAO4_WIDTH 1 /* RPGAO4 */
964
965/*
966 * R52 (0x34) - Line Mixer1
967 */
968#define WM8400_LLOPGALON 0x0040 /* LLOPGALON */
969#define WM8400_LLOPGALON_MASK 0x0040 /* LLOPGALON */
970#define WM8400_LLOPGALON_SHIFT 6 /* LLOPGALON */
971#define WM8400_LLOPGALON_WIDTH 1 /* LLOPGALON */
972#define WM8400_LROPGALON 0x0020 /* LROPGALON */
973#define WM8400_LROPGALON_MASK 0x0020 /* LROPGALON */
974#define WM8400_LROPGALON_SHIFT 5 /* LROPGALON */
975#define WM8400_LROPGALON_WIDTH 1 /* LROPGALON */
976#define WM8400_LOPLON 0x0010 /* LOPLON */
977#define WM8400_LOPLON_MASK 0x0010 /* LOPLON */
978#define WM8400_LOPLON_SHIFT 4 /* LOPLON */
979#define WM8400_LOPLON_WIDTH 1 /* LOPLON */
980#define WM8400_LR12LOP 0x0004 /* LR12LOP */
981#define WM8400_LR12LOP_MASK 0x0004 /* LR12LOP */
982#define WM8400_LR12LOP_SHIFT 2 /* LR12LOP */
983#define WM8400_LR12LOP_WIDTH 1 /* LR12LOP */
984#define WM8400_LL12LOP 0x0002 /* LL12LOP */
985#define WM8400_LL12LOP_MASK 0x0002 /* LL12LOP */
986#define WM8400_LL12LOP_SHIFT 1 /* LL12LOP */
987#define WM8400_LL12LOP_WIDTH 1 /* LL12LOP */
988#define WM8400_LLOPGALOP 0x0001 /* LLOPGALOP */
989#define WM8400_LLOPGALOP_MASK 0x0001 /* LLOPGALOP */
990#define WM8400_LLOPGALOP_SHIFT 0 /* LLOPGALOP */
991#define WM8400_LLOPGALOP_WIDTH 1 /* LLOPGALOP */
992
993/*
994 * R53 (0x35) - Line Mixer2
995 */
996#define WM8400_RROPGARON 0x0040 /* RROPGARON */
997#define WM8400_RROPGARON_MASK 0x0040 /* RROPGARON */
998#define WM8400_RROPGARON_SHIFT 6 /* RROPGARON */
999#define WM8400_RROPGARON_WIDTH 1 /* RROPGARON */
1000#define WM8400_RLOPGARON 0x0020 /* RLOPGARON */
1001#define WM8400_RLOPGARON_MASK 0x0020 /* RLOPGARON */
1002#define WM8400_RLOPGARON_SHIFT 5 /* RLOPGARON */
1003#define WM8400_RLOPGARON_WIDTH 1 /* RLOPGARON */
1004#define WM8400_ROPRON 0x0010 /* ROPRON */
1005#define WM8400_ROPRON_MASK 0x0010 /* ROPRON */
1006#define WM8400_ROPRON_SHIFT 4 /* ROPRON */
1007#define WM8400_ROPRON_WIDTH 1 /* ROPRON */
1008#define WM8400_RL12ROP 0x0004 /* RL12ROP */
1009#define WM8400_RL12ROP_MASK 0x0004 /* RL12ROP */
1010#define WM8400_RL12ROP_SHIFT 2 /* RL12ROP */
1011#define WM8400_RL12ROP_WIDTH 1 /* RL12ROP */
1012#define WM8400_RR12ROP 0x0002 /* RR12ROP */
1013#define WM8400_RR12ROP_MASK 0x0002 /* RR12ROP */
1014#define WM8400_RR12ROP_SHIFT 1 /* RR12ROP */
1015#define WM8400_RR12ROP_WIDTH 1 /* RR12ROP */
1016#define WM8400_RROPGAROP 0x0001 /* RROPGAROP */
1017#define WM8400_RROPGAROP_MASK 0x0001 /* RROPGAROP */
1018#define WM8400_RROPGAROP_SHIFT 0 /* RROPGAROP */
1019#define WM8400_RROPGAROP_WIDTH 1 /* RROPGAROP */
1020
1021/*
1022 * R54 (0x36) - Speaker Mixer
1023 */
1024#define WM8400_LB2SPK 0x0080 /* LB2SPK */
1025#define WM8400_LB2SPK_MASK 0x0080 /* LB2SPK */
1026#define WM8400_LB2SPK_SHIFT 7 /* LB2SPK */
1027#define WM8400_LB2SPK_WIDTH 1 /* LB2SPK */
1028#define WM8400_RB2SPK 0x0040 /* RB2SPK */
1029#define WM8400_RB2SPK_MASK 0x0040 /* RB2SPK */
1030#define WM8400_RB2SPK_SHIFT 6 /* RB2SPK */
1031#define WM8400_RB2SPK_WIDTH 1 /* RB2SPK */
1032#define WM8400_LI2SPK 0x0020 /* LI2SPK */
1033#define WM8400_LI2SPK_MASK 0x0020 /* LI2SPK */
1034#define WM8400_LI2SPK_SHIFT 5 /* LI2SPK */
1035#define WM8400_LI2SPK_WIDTH 1 /* LI2SPK */
1036#define WM8400_RI2SPK 0x0010 /* RI2SPK */
1037#define WM8400_RI2SPK_MASK 0x0010 /* RI2SPK */
1038#define WM8400_RI2SPK_SHIFT 4 /* RI2SPK */
1039#define WM8400_RI2SPK_WIDTH 1 /* RI2SPK */
1040#define WM8400_LOPGASPK 0x0008 /* LOPGASPK */
1041#define WM8400_LOPGASPK_MASK 0x0008 /* LOPGASPK */
1042#define WM8400_LOPGASPK_SHIFT 3 /* LOPGASPK */
1043#define WM8400_LOPGASPK_WIDTH 1 /* LOPGASPK */
1044#define WM8400_ROPGASPK 0x0004 /* ROPGASPK */
1045#define WM8400_ROPGASPK_MASK 0x0004 /* ROPGASPK */
1046#define WM8400_ROPGASPK_SHIFT 2 /* ROPGASPK */
1047#define WM8400_ROPGASPK_WIDTH 1 /* ROPGASPK */
1048#define WM8400_LDSPK 0x0002 /* LDSPK */
1049#define WM8400_LDSPK_MASK 0x0002 /* LDSPK */
1050#define WM8400_LDSPK_SHIFT 1 /* LDSPK */
1051#define WM8400_LDSPK_WIDTH 1 /* LDSPK */
1052#define WM8400_RDSPK 0x0001 /* RDSPK */
1053#define WM8400_RDSPK_MASK 0x0001 /* RDSPK */
1054#define WM8400_RDSPK_SHIFT 0 /* RDSPK */
1055#define WM8400_RDSPK_WIDTH 1 /* RDSPK */
1056
1057/*
1058 * R55 (0x37) - Additional Control
1059 */
1060#define WM8400_VROI 0x0001 /* VROI */
1061#define WM8400_VROI_MASK 0x0001 /* VROI */
1062#define WM8400_VROI_SHIFT 0 /* VROI */
1063#define WM8400_VROI_WIDTH 1 /* VROI */
1064
1065/*
1066 * R56 (0x38) - AntiPOP1
1067 */
1068#define WM8400_DIS_LLINE 0x0020 /* DIS_LLINE */
1069#define WM8400_DIS_LLINE_MASK 0x0020 /* DIS_LLINE */
1070#define WM8400_DIS_LLINE_SHIFT 5 /* DIS_LLINE */
1071#define WM8400_DIS_LLINE_WIDTH 1 /* DIS_LLINE */
1072#define WM8400_DIS_RLINE 0x0010 /* DIS_RLINE */
1073#define WM8400_DIS_RLINE_MASK 0x0010 /* DIS_RLINE */
1074#define WM8400_DIS_RLINE_SHIFT 4 /* DIS_RLINE */
1075#define WM8400_DIS_RLINE_WIDTH 1 /* DIS_RLINE */
1076#define WM8400_DIS_OUT3 0x0008 /* DIS_OUT3 */
1077#define WM8400_DIS_OUT3_MASK 0x0008 /* DIS_OUT3 */
1078#define WM8400_DIS_OUT3_SHIFT 3 /* DIS_OUT3 */
1079#define WM8400_DIS_OUT3_WIDTH 1 /* DIS_OUT3 */
1080#define WM8400_DIS_OUT4 0x0004 /* DIS_OUT4 */
1081#define WM8400_DIS_OUT4_MASK 0x0004 /* DIS_OUT4 */
1082#define WM8400_DIS_OUT4_SHIFT 2 /* DIS_OUT4 */
1083#define WM8400_DIS_OUT4_WIDTH 1 /* DIS_OUT4 */
1084#define WM8400_DIS_LOUT 0x0002 /* DIS_LOUT */
1085#define WM8400_DIS_LOUT_MASK 0x0002 /* DIS_LOUT */
1086#define WM8400_DIS_LOUT_SHIFT 1 /* DIS_LOUT */
1087#define WM8400_DIS_LOUT_WIDTH 1 /* DIS_LOUT */
1088#define WM8400_DIS_ROUT 0x0001 /* DIS_ROUT */
1089#define WM8400_DIS_ROUT_MASK 0x0001 /* DIS_ROUT */
1090#define WM8400_DIS_ROUT_SHIFT 0 /* DIS_ROUT */
1091#define WM8400_DIS_ROUT_WIDTH 1 /* DIS_ROUT */
1092
1093/*
1094 * R57 (0x39) - AntiPOP2
1095 */
1096#define WM8400_SOFTST 0x0040 /* SOFTST */
1097#define WM8400_SOFTST_MASK 0x0040 /* SOFTST */
1098#define WM8400_SOFTST_SHIFT 6 /* SOFTST */
1099#define WM8400_SOFTST_WIDTH 1 /* SOFTST */
1100#define WM8400_BUFIOEN 0x0008 /* BUFIOEN */
1101#define WM8400_BUFIOEN_MASK 0x0008 /* BUFIOEN */
1102#define WM8400_BUFIOEN_SHIFT 3 /* BUFIOEN */
1103#define WM8400_BUFIOEN_WIDTH 1 /* BUFIOEN */
1104#define WM8400_BUFDCOPEN 0x0004 /* BUFDCOPEN */
1105#define WM8400_BUFDCOPEN_MASK 0x0004 /* BUFDCOPEN */
1106#define WM8400_BUFDCOPEN_SHIFT 2 /* BUFDCOPEN */
1107#define WM8400_BUFDCOPEN_WIDTH 1 /* BUFDCOPEN */
1108#define WM8400_POBCTRL 0x0002 /* POBCTRL */
1109#define WM8400_POBCTRL_MASK 0x0002 /* POBCTRL */
1110#define WM8400_POBCTRL_SHIFT 1 /* POBCTRL */
1111#define WM8400_POBCTRL_WIDTH 1 /* POBCTRL */
1112#define WM8400_VMIDTOG 0x0001 /* VMIDTOG */
1113#define WM8400_VMIDTOG_MASK 0x0001 /* VMIDTOG */
1114#define WM8400_VMIDTOG_SHIFT 0 /* VMIDTOG */
1115#define WM8400_VMIDTOG_WIDTH 1 /* VMIDTOG */
1116
1117/*
1118 * R58 (0x3A) - MICBIAS
1119 */
1120#define WM8400_MCDSCTH_MASK 0x00C0 /* MCDSCTH - [7:6] */
1121#define WM8400_MCDSCTH_SHIFT 6 /* MCDSCTH - [7:6] */
1122#define WM8400_MCDSCTH_WIDTH 2 /* MCDSCTH - [7:6] */
1123#define WM8400_MCDTHR_MASK 0x0038 /* MCDTHR - [5:3] */
1124#define WM8400_MCDTHR_SHIFT 3 /* MCDTHR - [5:3] */
1125#define WM8400_MCDTHR_WIDTH 3 /* MCDTHR - [5:3] */
1126#define WM8400_MCD 0x0004 /* MCD */
1127#define WM8400_MCD_MASK 0x0004 /* MCD */
1128#define WM8400_MCD_SHIFT 2 /* MCD */
1129#define WM8400_MCD_WIDTH 1 /* MCD */
1130#define WM8400_MBSEL 0x0001 /* MBSEL */
1131#define WM8400_MBSEL_MASK 0x0001 /* MBSEL */
1132#define WM8400_MBSEL_SHIFT 0 /* MBSEL */
1133#define WM8400_MBSEL_WIDTH 1 /* MBSEL */
1134
1135/*
1136 * R60 (0x3C) - FLL Control 1
1137 */
1138#define WM8400_FLL_REF_FREQ 0x1000 /* FLL_REF_FREQ */
1139#define WM8400_FLL_REF_FREQ_MASK 0x1000 /* FLL_REF_FREQ */
1140#define WM8400_FLL_REF_FREQ_SHIFT 12 /* FLL_REF_FREQ */
1141#define WM8400_FLL_REF_FREQ_WIDTH 1 /* FLL_REF_FREQ */
1142#define WM8400_FLL_CLK_SRC_MASK 0x0C00 /* FLL_CLK_SRC - [11:10] */
1143#define WM8400_FLL_CLK_SRC_SHIFT 10 /* FLL_CLK_SRC - [11:10] */
1144#define WM8400_FLL_CLK_SRC_WIDTH 2 /* FLL_CLK_SRC - [11:10] */
1145#define WM8400_FLL_FRAC 0x0200 /* FLL_FRAC */
1146#define WM8400_FLL_FRAC_MASK 0x0200 /* FLL_FRAC */
1147#define WM8400_FLL_FRAC_SHIFT 9 /* FLL_FRAC */
1148#define WM8400_FLL_FRAC_WIDTH 1 /* FLL_FRAC */
1149#define WM8400_FLL_OSC_ENA 0x0100 /* FLL_OSC_ENA */
1150#define WM8400_FLL_OSC_ENA_MASK 0x0100 /* FLL_OSC_ENA */
1151#define WM8400_FLL_OSC_ENA_SHIFT 8 /* FLL_OSC_ENA */
1152#define WM8400_FLL_OSC_ENA_WIDTH 1 /* FLL_OSC_ENA */
1153#define WM8400_FLL_CTRL_RATE_MASK 0x00E0 /* FLL_CTRL_RATE - [7:5] */
1154#define WM8400_FLL_CTRL_RATE_SHIFT 5 /* FLL_CTRL_RATE - [7:5] */
1155#define WM8400_FLL_CTRL_RATE_WIDTH 3 /* FLL_CTRL_RATE - [7:5] */
1156#define WM8400_FLL_FRATIO_MASK 0x001F /* FLL_FRATIO - [4:0] */
1157#define WM8400_FLL_FRATIO_SHIFT 0 /* FLL_FRATIO - [4:0] */
1158#define WM8400_FLL_FRATIO_WIDTH 5 /* FLL_FRATIO - [4:0] */
1159
1160/*
1161 * R61 (0x3D) - FLL Control 2
1162 */
1163#define WM8400_FLL_K_MASK 0xFFFF /* FLL_K - [15:0] */
1164#define WM8400_FLL_K_SHIFT 0 /* FLL_K - [15:0] */
1165#define WM8400_FLL_K_WIDTH 16 /* FLL_K - [15:0] */
1166
1167/*
1168 * R62 (0x3E) - FLL Control 3
1169 */
1170#define WM8400_FLL_N_MASK 0x03FF /* FLL_N - [9:0] */
1171#define WM8400_FLL_N_SHIFT 0 /* FLL_N - [9:0] */
1172#define WM8400_FLL_N_WIDTH 10 /* FLL_N - [9:0] */
1173
1174/*
1175 * R63 (0x3F) - FLL Control 4
1176 */
1177#define WM8400_FLL_TRK_GAIN_MASK 0x0078 /* FLL_TRK_GAIN - [6:3] */
1178#define WM8400_FLL_TRK_GAIN_SHIFT 3 /* FLL_TRK_GAIN - [6:3] */
1179#define WM8400_FLL_TRK_GAIN_WIDTH 4 /* FLL_TRK_GAIN - [6:3] */
1180#define WM8400_FLL_OUTDIV_MASK 0x0007 /* FLL_OUTDIV - [2:0] */
1181#define WM8400_FLL_OUTDIV_SHIFT 0 /* FLL_OUTDIV - [2:0] */
1182#define WM8400_FLL_OUTDIV_WIDTH 3 /* FLL_OUTDIV - [2:0] */
1183
1184void wm8400_reset_codec_reg_cache(struct wm8400 *wm8400);
1185
1186#endif
diff --git a/include/linux/mfd/wm8400-private.h b/include/linux/mfd/wm8400-private.h
new file mode 100644
index 000000000000..2aab4e93a5c9
--- /dev/null
+++ b/include/linux/mfd/wm8400-private.h
@@ -0,0 +1,936 @@
1/*
2 * wm8400 private definitions.
3 *
4 * Copyright 2008 Wolfson Microelectronics plc
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; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef __LINUX_MFD_WM8400_PRIV_H
22#define __LINUX_MFD_WM8400_PRIV_H
23
24#include <linux/mfd/wm8400.h>
25#include <linux/mutex.h>
26#include <linux/platform_device.h>
27
28#define WM8400_REGISTER_COUNT 0x55
29
30struct wm8400 {
31 struct device *dev;
32
33 int (*read_dev)(void *data, char reg, int count, u16 *dst);
34 int (*write_dev)(void *data, char reg, int count, const u16 *src);
35
36 struct mutex io_lock;
37 void *io_data;
38
39 u16 reg_cache[WM8400_REGISTER_COUNT];
40
41 struct platform_device regulators[6];
42};
43
44/*
45 * Register values.
46 */
47#define WM8400_RESET_ID 0x00
48#define WM8400_ID 0x01
49#define WM8400_POWER_MANAGEMENT_1 0x02
50#define WM8400_POWER_MANAGEMENT_2 0x03
51#define WM8400_POWER_MANAGEMENT_3 0x04
52#define WM8400_AUDIO_INTERFACE_1 0x05
53#define WM8400_AUDIO_INTERFACE_2 0x06
54#define WM8400_CLOCKING_1 0x07
55#define WM8400_CLOCKING_2 0x08
56#define WM8400_AUDIO_INTERFACE_3 0x09
57#define WM8400_AUDIO_INTERFACE_4 0x0A
58#define WM8400_DAC_CTRL 0x0B
59#define WM8400_LEFT_DAC_DIGITAL_VOLUME 0x0C
60#define WM8400_RIGHT_DAC_DIGITAL_VOLUME 0x0D
61#define WM8400_DIGITAL_SIDE_TONE 0x0E
62#define WM8400_ADC_CTRL 0x0F
63#define WM8400_LEFT_ADC_DIGITAL_VOLUME 0x10
64#define WM8400_RIGHT_ADC_DIGITAL_VOLUME 0x11
65#define WM8400_GPIO_CTRL_1 0x12
66#define WM8400_GPIO1_GPIO2 0x13
67#define WM8400_GPIO3_GPIO4 0x14
68#define WM8400_GPIO5_GPIO6 0x15
69#define WM8400_GPIOCTRL_2 0x16
70#define WM8400_GPIO_POL 0x17
71#define WM8400_LEFT_LINE_INPUT_1_2_VOLUME 0x18
72#define WM8400_LEFT_LINE_INPUT_3_4_VOLUME 0x19
73#define WM8400_RIGHT_LINE_INPUT_1_2_VOLUME 0x1A
74#define WM8400_RIGHT_LINE_INPUT_3_4_VOLUME 0x1B
75#define WM8400_LEFT_OUTPUT_VOLUME 0x1C
76#define WM8400_RIGHT_OUTPUT_VOLUME 0x1D
77#define WM8400_LINE_OUTPUTS_VOLUME 0x1E
78#define WM8400_OUT3_4_VOLUME 0x1F
79#define WM8400_LEFT_OPGA_VOLUME 0x20
80#define WM8400_RIGHT_OPGA_VOLUME 0x21
81#define WM8400_SPEAKER_VOLUME 0x22
82#define WM8400_CLASSD1 0x23
83#define WM8400_CLASSD3 0x25
84#define WM8400_INPUT_MIXER1 0x27
85#define WM8400_INPUT_MIXER2 0x28
86#define WM8400_INPUT_MIXER3 0x29
87#define WM8400_INPUT_MIXER4 0x2A
88#define WM8400_INPUT_MIXER5 0x2B
89#define WM8400_INPUT_MIXER6 0x2C
90#define WM8400_OUTPUT_MIXER1 0x2D
91#define WM8400_OUTPUT_MIXER2 0x2E
92#define WM8400_OUTPUT_MIXER3 0x2F
93#define WM8400_OUTPUT_MIXER4 0x30
94#define WM8400_OUTPUT_MIXER5 0x31
95#define WM8400_OUTPUT_MIXER6 0x32
96#define WM8400_OUT3_4_MIXER 0x33
97#define WM8400_LINE_MIXER1 0x34
98#define WM8400_LINE_MIXER2 0x35
99#define WM8400_SPEAKER_MIXER 0x36
100#define WM8400_ADDITIONAL_CONTROL 0x37
101#define WM8400_ANTIPOP1 0x38
102#define WM8400_ANTIPOP2 0x39
103#define WM8400_MICBIAS 0x3A
104#define WM8400_FLL_CONTROL_1 0x3C
105#define WM8400_FLL_CONTROL_2 0x3D
106#define WM8400_FLL_CONTROL_3 0x3E
107#define WM8400_FLL_CONTROL_4 0x3F
108#define WM8400_LDO1_CONTROL 0x41
109#define WM8400_LDO2_CONTROL 0x42
110#define WM8400_LDO3_CONTROL 0x43
111#define WM8400_LDO4_CONTROL 0x44
112#define WM8400_DCDC1_CONTROL_1 0x46
113#define WM8400_DCDC1_CONTROL_2 0x47
114#define WM8400_DCDC2_CONTROL_1 0x48
115#define WM8400_DCDC2_CONTROL_2 0x49
116#define WM8400_INTERFACE 0x4B
117#define WM8400_PM_GENERAL 0x4C
118#define WM8400_PM_SHUTDOWN_CONTROL 0x4E
119#define WM8400_INTERRUPT_STATUS_1 0x4F
120#define WM8400_INTERRUPT_STATUS_1_MASK 0x50
121#define WM8400_INTERRUPT_LEVELS 0x51
122#define WM8400_SHUTDOWN_REASON 0x52
123#define WM8400_LINE_CIRCUITS 0x54
124
125/*
126 * Field Definitions.
127 */
128
129/*
130 * R0 (0x00) - Reset/ID
131 */
132#define WM8400_SW_RESET_CHIP_ID_MASK 0xFFFF /* SW_RESET/CHIP_ID - [15:0] */
133#define WM8400_SW_RESET_CHIP_ID_SHIFT 0 /* SW_RESET/CHIP_ID - [15:0] */
134#define WM8400_SW_RESET_CHIP_ID_WIDTH 16 /* SW_RESET/CHIP_ID - [15:0] */
135
136/*
137 * R1 (0x01) - ID
138 */
139#define WM8400_CHIP_REV_MASK 0x7000 /* CHIP_REV - [14:12] */
140#define WM8400_CHIP_REV_SHIFT 12 /* CHIP_REV - [14:12] */
141#define WM8400_CHIP_REV_WIDTH 3 /* CHIP_REV - [14:12] */
142
143/*
144 * R18 (0x12) - GPIO CTRL 1
145 */
146#define WM8400_IRQ 0x1000 /* IRQ */
147#define WM8400_IRQ_MASK 0x1000 /* IRQ */
148#define WM8400_IRQ_SHIFT 12 /* IRQ */
149#define WM8400_IRQ_WIDTH 1 /* IRQ */
150#define WM8400_TEMPOK 0x0800 /* TEMPOK */
151#define WM8400_TEMPOK_MASK 0x0800 /* TEMPOK */
152#define WM8400_TEMPOK_SHIFT 11 /* TEMPOK */
153#define WM8400_TEMPOK_WIDTH 1 /* TEMPOK */
154#define WM8400_MIC1SHRT 0x0400 /* MIC1SHRT */
155#define WM8400_MIC1SHRT_MASK 0x0400 /* MIC1SHRT */
156#define WM8400_MIC1SHRT_SHIFT 10 /* MIC1SHRT */
157#define WM8400_MIC1SHRT_WIDTH 1 /* MIC1SHRT */
158#define WM8400_MIC1DET 0x0200 /* MIC1DET */
159#define WM8400_MIC1DET_MASK 0x0200 /* MIC1DET */
160#define WM8400_MIC1DET_SHIFT 9 /* MIC1DET */
161#define WM8400_MIC1DET_WIDTH 1 /* MIC1DET */
162#define WM8400_FLL_LCK 0x0100 /* FLL_LCK */
163#define WM8400_FLL_LCK_MASK 0x0100 /* FLL_LCK */
164#define WM8400_FLL_LCK_SHIFT 8 /* FLL_LCK */
165#define WM8400_FLL_LCK_WIDTH 1 /* FLL_LCK */
166#define WM8400_GPIO_STATUS_MASK 0x00FF /* GPIO_STATUS - [7:0] */
167#define WM8400_GPIO_STATUS_SHIFT 0 /* GPIO_STATUS - [7:0] */
168#define WM8400_GPIO_STATUS_WIDTH 8 /* GPIO_STATUS - [7:0] */
169
170/*
171 * R19 (0x13) - GPIO1 & GPIO2
172 */
173#define WM8400_GPIO2_DEB_ENA 0x8000 /* GPIO2_DEB_ENA */
174#define WM8400_GPIO2_DEB_ENA_MASK 0x8000 /* GPIO2_DEB_ENA */
175#define WM8400_GPIO2_DEB_ENA_SHIFT 15 /* GPIO2_DEB_ENA */
176#define WM8400_GPIO2_DEB_ENA_WIDTH 1 /* GPIO2_DEB_ENA */
177#define WM8400_GPIO2_IRQ_ENA 0x4000 /* GPIO2_IRQ_ENA */
178#define WM8400_GPIO2_IRQ_ENA_MASK 0x4000 /* GPIO2_IRQ_ENA */
179#define WM8400_GPIO2_IRQ_ENA_SHIFT 14 /* GPIO2_IRQ_ENA */
180#define WM8400_GPIO2_IRQ_ENA_WIDTH 1 /* GPIO2_IRQ_ENA */
181#define WM8400_GPIO2_PU 0x2000 /* GPIO2_PU */
182#define WM8400_GPIO2_PU_MASK 0x2000 /* GPIO2_PU */
183#define WM8400_GPIO2_PU_SHIFT 13 /* GPIO2_PU */
184#define WM8400_GPIO2_PU_WIDTH 1 /* GPIO2_PU */
185#define WM8400_GPIO2_PD 0x1000 /* GPIO2_PD */
186#define WM8400_GPIO2_PD_MASK 0x1000 /* GPIO2_PD */
187#define WM8400_GPIO2_PD_SHIFT 12 /* GPIO2_PD */
188#define WM8400_GPIO2_PD_WIDTH 1 /* GPIO2_PD */
189#define WM8400_GPIO2_SEL_MASK 0x0F00 /* GPIO2_SEL - [11:8] */
190#define WM8400_GPIO2_SEL_SHIFT 8 /* GPIO2_SEL - [11:8] */
191#define WM8400_GPIO2_SEL_WIDTH 4 /* GPIO2_SEL - [11:8] */
192#define WM8400_GPIO1_DEB_ENA 0x0080 /* GPIO1_DEB_ENA */
193#define WM8400_GPIO1_DEB_ENA_MASK 0x0080 /* GPIO1_DEB_ENA */
194#define WM8400_GPIO1_DEB_ENA_SHIFT 7 /* GPIO1_DEB_ENA */
195#define WM8400_GPIO1_DEB_ENA_WIDTH 1 /* GPIO1_DEB_ENA */
196#define WM8400_GPIO1_IRQ_ENA 0x0040 /* GPIO1_IRQ_ENA */
197#define WM8400_GPIO1_IRQ_ENA_MASK 0x0040 /* GPIO1_IRQ_ENA */
198#define WM8400_GPIO1_IRQ_ENA_SHIFT 6 /* GPIO1_IRQ_ENA */
199#define WM8400_GPIO1_IRQ_ENA_WIDTH 1 /* GPIO1_IRQ_ENA */
200#define WM8400_GPIO1_PU 0x0020 /* GPIO1_PU */
201#define WM8400_GPIO1_PU_MASK 0x0020 /* GPIO1_PU */
202#define WM8400_GPIO1_PU_SHIFT 5 /* GPIO1_PU */
203#define WM8400_GPIO1_PU_WIDTH 1 /* GPIO1_PU */
204#define WM8400_GPIO1_PD 0x0010 /* GPIO1_PD */
205#define WM8400_GPIO1_PD_MASK 0x0010 /* GPIO1_PD */
206#define WM8400_GPIO1_PD_SHIFT 4 /* GPIO1_PD */
207#define WM8400_GPIO1_PD_WIDTH 1 /* GPIO1_PD */
208#define WM8400_GPIO1_SEL_MASK 0x000F /* GPIO1_SEL - [3:0] */
209#define WM8400_GPIO1_SEL_SHIFT 0 /* GPIO1_SEL - [3:0] */
210#define WM8400_GPIO1_SEL_WIDTH 4 /* GPIO1_SEL - [3:0] */
211
212/*
213 * R20 (0x14) - GPIO3 & GPIO4
214 */
215#define WM8400_GPIO4_DEB_ENA 0x8000 /* GPIO4_DEB_ENA */
216#define WM8400_GPIO4_DEB_ENA_MASK 0x8000 /* GPIO4_DEB_ENA */
217#define WM8400_GPIO4_DEB_ENA_SHIFT 15 /* GPIO4_DEB_ENA */
218#define WM8400_GPIO4_DEB_ENA_WIDTH 1 /* GPIO4_DEB_ENA */
219#define WM8400_GPIO4_IRQ_ENA 0x4000 /* GPIO4_IRQ_ENA */
220#define WM8400_GPIO4_IRQ_ENA_MASK 0x4000 /* GPIO4_IRQ_ENA */
221#define WM8400_GPIO4_IRQ_ENA_SHIFT 14 /* GPIO4_IRQ_ENA */
222#define WM8400_GPIO4_IRQ_ENA_WIDTH 1 /* GPIO4_IRQ_ENA */
223#define WM8400_GPIO4_PU 0x2000 /* GPIO4_PU */
224#define WM8400_GPIO4_PU_MASK 0x2000 /* GPIO4_PU */
225#define WM8400_GPIO4_PU_SHIFT 13 /* GPIO4_PU */
226#define WM8400_GPIO4_PU_WIDTH 1 /* GPIO4_PU */
227#define WM8400_GPIO4_PD 0x1000 /* GPIO4_PD */
228#define WM8400_GPIO4_PD_MASK 0x1000 /* GPIO4_PD */
229#define WM8400_GPIO4_PD_SHIFT 12 /* GPIO4_PD */
230#define WM8400_GPIO4_PD_WIDTH 1 /* GPIO4_PD */
231#define WM8400_GPIO4_SEL_MASK 0x0F00 /* GPIO4_SEL - [11:8] */
232#define WM8400_GPIO4_SEL_SHIFT 8 /* GPIO4_SEL - [11:8] */
233#define WM8400_GPIO4_SEL_WIDTH 4 /* GPIO4_SEL - [11:8] */
234#define WM8400_GPIO3_DEB_ENA 0x0080 /* GPIO3_DEB_ENA */
235#define WM8400_GPIO3_DEB_ENA_MASK 0x0080 /* GPIO3_DEB_ENA */
236#define WM8400_GPIO3_DEB_ENA_SHIFT 7 /* GPIO3_DEB_ENA */
237#define WM8400_GPIO3_DEB_ENA_WIDTH 1 /* GPIO3_DEB_ENA */
238#define WM8400_GPIO3_IRQ_ENA 0x0040 /* GPIO3_IRQ_ENA */
239#define WM8400_GPIO3_IRQ_ENA_MASK 0x0040 /* GPIO3_IRQ_ENA */
240#define WM8400_GPIO3_IRQ_ENA_SHIFT 6 /* GPIO3_IRQ_ENA */
241#define WM8400_GPIO3_IRQ_ENA_WIDTH 1 /* GPIO3_IRQ_ENA */
242#define WM8400_GPIO3_PU 0x0020 /* GPIO3_PU */
243#define WM8400_GPIO3_PU_MASK 0x0020 /* GPIO3_PU */
244#define WM8400_GPIO3_PU_SHIFT 5 /* GPIO3_PU */
245#define WM8400_GPIO3_PU_WIDTH 1 /* GPIO3_PU */
246#define WM8400_GPIO3_PD 0x0010 /* GPIO3_PD */
247#define WM8400_GPIO3_PD_MASK 0x0010 /* GPIO3_PD */
248#define WM8400_GPIO3_PD_SHIFT 4 /* GPIO3_PD */
249#define WM8400_GPIO3_PD_WIDTH 1 /* GPIO3_PD */
250#define WM8400_GPIO3_SEL_MASK 0x000F /* GPIO3_SEL - [3:0] */
251#define WM8400_GPIO3_SEL_SHIFT 0 /* GPIO3_SEL - [3:0] */
252#define WM8400_GPIO3_SEL_WIDTH 4 /* GPIO3_SEL - [3:0] */
253
254/*
255 * R21 (0x15) - GPIO5 & GPIO6
256 */
257#define WM8400_GPIO6_DEB_ENA 0x8000 /* GPIO6_DEB_ENA */
258#define WM8400_GPIO6_DEB_ENA_MASK 0x8000 /* GPIO6_DEB_ENA */
259#define WM8400_GPIO6_DEB_ENA_SHIFT 15 /* GPIO6_DEB_ENA */
260#define WM8400_GPIO6_DEB_ENA_WIDTH 1 /* GPIO6_DEB_ENA */
261#define WM8400_GPIO6_IRQ_ENA 0x4000 /* GPIO6_IRQ_ENA */
262#define WM8400_GPIO6_IRQ_ENA_MASK 0x4000 /* GPIO6_IRQ_ENA */
263#define WM8400_GPIO6_IRQ_ENA_SHIFT 14 /* GPIO6_IRQ_ENA */
264#define WM8400_GPIO6_IRQ_ENA_WIDTH 1 /* GPIO6_IRQ_ENA */
265#define WM8400_GPIO6_PU 0x2000 /* GPIO6_PU */
266#define WM8400_GPIO6_PU_MASK 0x2000 /* GPIO6_PU */
267#define WM8400_GPIO6_PU_SHIFT 13 /* GPIO6_PU */
268#define WM8400_GPIO6_PU_WIDTH 1 /* GPIO6_PU */
269#define WM8400_GPIO6_PD 0x1000 /* GPIO6_PD */
270#define WM8400_GPIO6_PD_MASK 0x1000 /* GPIO6_PD */
271#define WM8400_GPIO6_PD_SHIFT 12 /* GPIO6_PD */
272#define WM8400_GPIO6_PD_WIDTH 1 /* GPIO6_PD */
273#define WM8400_GPIO6_SEL_MASK 0x0F00 /* GPIO6_SEL - [11:8] */
274#define WM8400_GPIO6_SEL_SHIFT 8 /* GPIO6_SEL - [11:8] */
275#define WM8400_GPIO6_SEL_WIDTH 4 /* GPIO6_SEL - [11:8] */
276#define WM8400_GPIO5_DEB_ENA 0x0080 /* GPIO5_DEB_ENA */
277#define WM8400_GPIO5_DEB_ENA_MASK 0x0080 /* GPIO5_DEB_ENA */
278#define WM8400_GPIO5_DEB_ENA_SHIFT 7 /* GPIO5_DEB_ENA */
279#define WM8400_GPIO5_DEB_ENA_WIDTH 1 /* GPIO5_DEB_ENA */
280#define WM8400_GPIO5_IRQ_ENA 0x0040 /* GPIO5_IRQ_ENA */
281#define WM8400_GPIO5_IRQ_ENA_MASK 0x0040 /* GPIO5_IRQ_ENA */
282#define WM8400_GPIO5_IRQ_ENA_SHIFT 6 /* GPIO5_IRQ_ENA */
283#define WM8400_GPIO5_IRQ_ENA_WIDTH 1 /* GPIO5_IRQ_ENA */
284#define WM8400_GPIO5_PU 0x0020 /* GPIO5_PU */
285#define WM8400_GPIO5_PU_MASK 0x0020 /* GPIO5_PU */
286#define WM8400_GPIO5_PU_SHIFT 5 /* GPIO5_PU */
287#define WM8400_GPIO5_PU_WIDTH 1 /* GPIO5_PU */
288#define WM8400_GPIO5_PD 0x0010 /* GPIO5_PD */
289#define WM8400_GPIO5_PD_MASK 0x0010 /* GPIO5_PD */
290#define WM8400_GPIO5_PD_SHIFT 4 /* GPIO5_PD */
291#define WM8400_GPIO5_PD_WIDTH 1 /* GPIO5_PD */
292#define WM8400_GPIO5_SEL_MASK 0x000F /* GPIO5_SEL - [3:0] */
293#define WM8400_GPIO5_SEL_SHIFT 0 /* GPIO5_SEL - [3:0] */
294#define WM8400_GPIO5_SEL_WIDTH 4 /* GPIO5_SEL - [3:0] */
295
296/*
297 * R22 (0x16) - GPIOCTRL 2
298 */
299#define WM8400_TEMPOK_IRQ_ENA 0x0800 /* TEMPOK_IRQ_ENA */
300#define WM8400_TEMPOK_IRQ_ENA_MASK 0x0800 /* TEMPOK_IRQ_ENA */
301#define WM8400_TEMPOK_IRQ_ENA_SHIFT 11 /* TEMPOK_IRQ_ENA */
302#define WM8400_TEMPOK_IRQ_ENA_WIDTH 1 /* TEMPOK_IRQ_ENA */
303#define WM8400_MIC1SHRT_IRQ_ENA 0x0400 /* MIC1SHRT_IRQ_ENA */
304#define WM8400_MIC1SHRT_IRQ_ENA_MASK 0x0400 /* MIC1SHRT_IRQ_ENA */
305#define WM8400_MIC1SHRT_IRQ_ENA_SHIFT 10 /* MIC1SHRT_IRQ_ENA */
306#define WM8400_MIC1SHRT_IRQ_ENA_WIDTH 1 /* MIC1SHRT_IRQ_ENA */
307#define WM8400_MIC1DET_IRQ_ENA 0x0200 /* MIC1DET_IRQ_ENA */
308#define WM8400_MIC1DET_IRQ_ENA_MASK 0x0200 /* MIC1DET_IRQ_ENA */
309#define WM8400_MIC1DET_IRQ_ENA_SHIFT 9 /* MIC1DET_IRQ_ENA */
310#define WM8400_MIC1DET_IRQ_ENA_WIDTH 1 /* MIC1DET_IRQ_ENA */
311#define WM8400_FLL_LCK_IRQ_ENA 0x0100 /* FLL_LCK_IRQ_ENA */
312#define WM8400_FLL_LCK_IRQ_ENA_MASK 0x0100 /* FLL_LCK_IRQ_ENA */
313#define WM8400_FLL_LCK_IRQ_ENA_SHIFT 8 /* FLL_LCK_IRQ_ENA */
314#define WM8400_FLL_LCK_IRQ_ENA_WIDTH 1 /* FLL_LCK_IRQ_ENA */
315#define WM8400_GPI8_DEB_ENA 0x0080 /* GPI8_DEB_ENA */
316#define WM8400_GPI8_DEB_ENA_MASK 0x0080 /* GPI8_DEB_ENA */
317#define WM8400_GPI8_DEB_ENA_SHIFT 7 /* GPI8_DEB_ENA */
318#define WM8400_GPI8_DEB_ENA_WIDTH 1 /* GPI8_DEB_ENA */
319#define WM8400_GPI8_IRQ_ENA 0x0040 /* GPI8_IRQ_ENA */
320#define WM8400_GPI8_IRQ_ENA_MASK 0x0040 /* GPI8_IRQ_ENA */
321#define WM8400_GPI8_IRQ_ENA_SHIFT 6 /* GPI8_IRQ_ENA */
322#define WM8400_GPI8_IRQ_ENA_WIDTH 1 /* GPI8_IRQ_ENA */
323#define WM8400_GPI8_ENA 0x0010 /* GPI8_ENA */
324#define WM8400_GPI8_ENA_MASK 0x0010 /* GPI8_ENA */
325#define WM8400_GPI8_ENA_SHIFT 4 /* GPI8_ENA */
326#define WM8400_GPI8_ENA_WIDTH 1 /* GPI8_ENA */
327#define WM8400_GPI7_DEB_ENA 0x0008 /* GPI7_DEB_ENA */
328#define WM8400_GPI7_DEB_ENA_MASK 0x0008 /* GPI7_DEB_ENA */
329#define WM8400_GPI7_DEB_ENA_SHIFT 3 /* GPI7_DEB_ENA */
330#define WM8400_GPI7_DEB_ENA_WIDTH 1 /* GPI7_DEB_ENA */
331#define WM8400_GPI7_IRQ_ENA 0x0004 /* GPI7_IRQ_ENA */
332#define WM8400_GPI7_IRQ_ENA_MASK 0x0004 /* GPI7_IRQ_ENA */
333#define WM8400_GPI7_IRQ_ENA_SHIFT 2 /* GPI7_IRQ_ENA */
334#define WM8400_GPI7_IRQ_ENA_WIDTH 1 /* GPI7_IRQ_ENA */
335#define WM8400_GPI7_ENA 0x0001 /* GPI7_ENA */
336#define WM8400_GPI7_ENA_MASK 0x0001 /* GPI7_ENA */
337#define WM8400_GPI7_ENA_SHIFT 0 /* GPI7_ENA */
338#define WM8400_GPI7_ENA_WIDTH 1 /* GPI7_ENA */
339
340/*
341 * R23 (0x17) - GPIO_POL
342 */
343#define WM8400_IRQ_INV 0x1000 /* IRQ_INV */
344#define WM8400_IRQ_INV_MASK 0x1000 /* IRQ_INV */
345#define WM8400_IRQ_INV_SHIFT 12 /* IRQ_INV */
346#define WM8400_IRQ_INV_WIDTH 1 /* IRQ_INV */
347#define WM8400_TEMPOK_POL 0x0800 /* TEMPOK_POL */
348#define WM8400_TEMPOK_POL_MASK 0x0800 /* TEMPOK_POL */
349#define WM8400_TEMPOK_POL_SHIFT 11 /* TEMPOK_POL */
350#define WM8400_TEMPOK_POL_WIDTH 1 /* TEMPOK_POL */
351#define WM8400_MIC1SHRT_POL 0x0400 /* MIC1SHRT_POL */
352#define WM8400_MIC1SHRT_POL_MASK 0x0400 /* MIC1SHRT_POL */
353#define WM8400_MIC1SHRT_POL_SHIFT 10 /* MIC1SHRT_POL */
354#define WM8400_MIC1SHRT_POL_WIDTH 1 /* MIC1SHRT_POL */
355#define WM8400_MIC1DET_POL 0x0200 /* MIC1DET_POL */
356#define WM8400_MIC1DET_POL_MASK 0x0200 /* MIC1DET_POL */
357#define WM8400_MIC1DET_POL_SHIFT 9 /* MIC1DET_POL */
358#define WM8400_MIC1DET_POL_WIDTH 1 /* MIC1DET_POL */
359#define WM8400_FLL_LCK_POL 0x0100 /* FLL_LCK_POL */
360#define WM8400_FLL_LCK_POL_MASK 0x0100 /* FLL_LCK_POL */
361#define WM8400_FLL_LCK_POL_SHIFT 8 /* FLL_LCK_POL */
362#define WM8400_FLL_LCK_POL_WIDTH 1 /* FLL_LCK_POL */
363#define WM8400_GPIO_POL_MASK 0x00FF /* GPIO_POL - [7:0] */
364#define WM8400_GPIO_POL_SHIFT 0 /* GPIO_POL - [7:0] */
365#define WM8400_GPIO_POL_WIDTH 8 /* GPIO_POL - [7:0] */
366
367/*
368 * R65 (0x41) - LDO 1 Control
369 */
370#define WM8400_LDO1_ENA 0x8000 /* LDO1_ENA */
371#define WM8400_LDO1_ENA_MASK 0x8000 /* LDO1_ENA */
372#define WM8400_LDO1_ENA_SHIFT 15 /* LDO1_ENA */
373#define WM8400_LDO1_ENA_WIDTH 1 /* LDO1_ENA */
374#define WM8400_LDO1_SWI 0x4000 /* LDO1_SWI */
375#define WM8400_LDO1_SWI_MASK 0x4000 /* LDO1_SWI */
376#define WM8400_LDO1_SWI_SHIFT 14 /* LDO1_SWI */
377#define WM8400_LDO1_SWI_WIDTH 1 /* LDO1_SWI */
378#define WM8400_LDO1_OPFLT 0x1000 /* LDO1_OPFLT */
379#define WM8400_LDO1_OPFLT_MASK 0x1000 /* LDO1_OPFLT */
380#define WM8400_LDO1_OPFLT_SHIFT 12 /* LDO1_OPFLT */
381#define WM8400_LDO1_OPFLT_WIDTH 1 /* LDO1_OPFLT */
382#define WM8400_LDO1_ERRACT 0x0800 /* LDO1_ERRACT */
383#define WM8400_LDO1_ERRACT_MASK 0x0800 /* LDO1_ERRACT */
384#define WM8400_LDO1_ERRACT_SHIFT 11 /* LDO1_ERRACT */
385#define WM8400_LDO1_ERRACT_WIDTH 1 /* LDO1_ERRACT */
386#define WM8400_LDO1_HIB_MODE 0x0400 /* LDO1_HIB_MODE */
387#define WM8400_LDO1_HIB_MODE_MASK 0x0400 /* LDO1_HIB_MODE */
388#define WM8400_LDO1_HIB_MODE_SHIFT 10 /* LDO1_HIB_MODE */
389#define WM8400_LDO1_HIB_MODE_WIDTH 1 /* LDO1_HIB_MODE */
390#define WM8400_LDO1_VIMG_MASK 0x03E0 /* LDO1_VIMG - [9:5] */
391#define WM8400_LDO1_VIMG_SHIFT 5 /* LDO1_VIMG - [9:5] */
392#define WM8400_LDO1_VIMG_WIDTH 5 /* LDO1_VIMG - [9:5] */
393#define WM8400_LDO1_VSEL_MASK 0x001F /* LDO1_VSEL - [4:0] */
394#define WM8400_LDO1_VSEL_SHIFT 0 /* LDO1_VSEL - [4:0] */
395#define WM8400_LDO1_VSEL_WIDTH 5 /* LDO1_VSEL - [4:0] */
396
397/*
398 * R66 (0x42) - LDO 2 Control
399 */
400#define WM8400_LDO2_ENA 0x8000 /* LDO2_ENA */
401#define WM8400_LDO2_ENA_MASK 0x8000 /* LDO2_ENA */
402#define WM8400_LDO2_ENA_SHIFT 15 /* LDO2_ENA */
403#define WM8400_LDO2_ENA_WIDTH 1 /* LDO2_ENA */
404#define WM8400_LDO2_SWI 0x4000 /* LDO2_SWI */
405#define WM8400_LDO2_SWI_MASK 0x4000 /* LDO2_SWI */
406#define WM8400_LDO2_SWI_SHIFT 14 /* LDO2_SWI */
407#define WM8400_LDO2_SWI_WIDTH 1 /* LDO2_SWI */
408#define WM8400_LDO2_OPFLT 0x1000 /* LDO2_OPFLT */
409#define WM8400_LDO2_OPFLT_MASK 0x1000 /* LDO2_OPFLT */
410#define WM8400_LDO2_OPFLT_SHIFT 12 /* LDO2_OPFLT */
411#define WM8400_LDO2_OPFLT_WIDTH 1 /* LDO2_OPFLT */
412#define WM8400_LDO2_ERRACT 0x0800 /* LDO2_ERRACT */
413#define WM8400_LDO2_ERRACT_MASK 0x0800 /* LDO2_ERRACT */
414#define WM8400_LDO2_ERRACT_SHIFT 11 /* LDO2_ERRACT */
415#define WM8400_LDO2_ERRACT_WIDTH 1 /* LDO2_ERRACT */
416#define WM8400_LDO2_HIB_MODE 0x0400 /* LDO2_HIB_MODE */
417#define WM8400_LDO2_HIB_MODE_MASK 0x0400 /* LDO2_HIB_MODE */
418#define WM8400_LDO2_HIB_MODE_SHIFT 10 /* LDO2_HIB_MODE */
419#define WM8400_LDO2_HIB_MODE_WIDTH 1 /* LDO2_HIB_MODE */
420#define WM8400_LDO2_VIMG_MASK 0x03E0 /* LDO2_VIMG - [9:5] */
421#define WM8400_LDO2_VIMG_SHIFT 5 /* LDO2_VIMG - [9:5] */
422#define WM8400_LDO2_VIMG_WIDTH 5 /* LDO2_VIMG - [9:5] */
423#define WM8400_LDO2_VSEL_MASK 0x001F /* LDO2_VSEL - [4:0] */
424#define WM8400_LDO2_VSEL_SHIFT 0 /* LDO2_VSEL - [4:0] */
425#define WM8400_LDO2_VSEL_WIDTH 5 /* LDO2_VSEL - [4:0] */
426
427/*
428 * R67 (0x43) - LDO 3 Control
429 */
430#define WM8400_LDO3_ENA 0x8000 /* LDO3_ENA */
431#define WM8400_LDO3_ENA_MASK 0x8000 /* LDO3_ENA */
432#define WM8400_LDO3_ENA_SHIFT 15 /* LDO3_ENA */
433#define WM8400_LDO3_ENA_WIDTH 1 /* LDO3_ENA */
434#define WM8400_LDO3_SWI 0x4000 /* LDO3_SWI */
435#define WM8400_LDO3_SWI_MASK 0x4000 /* LDO3_SWI */
436#define WM8400_LDO3_SWI_SHIFT 14 /* LDO3_SWI */
437#define WM8400_LDO3_SWI_WIDTH 1 /* LDO3_SWI */
438#define WM8400_LDO3_OPFLT 0x1000 /* LDO3_OPFLT */
439#define WM8400_LDO3_OPFLT_MASK 0x1000 /* LDO3_OPFLT */
440#define WM8400_LDO3_OPFLT_SHIFT 12 /* LDO3_OPFLT */
441#define WM8400_LDO3_OPFLT_WIDTH 1 /* LDO3_OPFLT */
442#define WM8400_LDO3_ERRACT 0x0800 /* LDO3_ERRACT */
443#define WM8400_LDO3_ERRACT_MASK 0x0800 /* LDO3_ERRACT */
444#define WM8400_LDO3_ERRACT_SHIFT 11 /* LDO3_ERRACT */
445#define WM8400_LDO3_ERRACT_WIDTH 1 /* LDO3_ERRACT */
446#define WM8400_LDO3_HIB_MODE 0x0400 /* LDO3_HIB_MODE */
447#define WM8400_LDO3_HIB_MODE_MASK 0x0400 /* LDO3_HIB_MODE */
448#define WM8400_LDO3_HIB_MODE_SHIFT 10 /* LDO3_HIB_MODE */
449#define WM8400_LDO3_HIB_MODE_WIDTH 1 /* LDO3_HIB_MODE */
450#define WM8400_LDO3_VIMG_MASK 0x03E0 /* LDO3_VIMG - [9:5] */
451#define WM8400_LDO3_VIMG_SHIFT 5 /* LDO3_VIMG - [9:5] */
452#define WM8400_LDO3_VIMG_WIDTH 5 /* LDO3_VIMG - [9:5] */
453#define WM8400_LDO3_VSEL_MASK 0x001F /* LDO3_VSEL - [4:0] */
454#define WM8400_LDO3_VSEL_SHIFT 0 /* LDO3_VSEL - [4:0] */
455#define WM8400_LDO3_VSEL_WIDTH 5 /* LDO3_VSEL - [4:0] */
456
457/*
458 * R68 (0x44) - LDO 4 Control
459 */
460#define WM8400_LDO4_ENA 0x8000 /* LDO4_ENA */
461#define WM8400_LDO4_ENA_MASK 0x8000 /* LDO4_ENA */
462#define WM8400_LDO4_ENA_SHIFT 15 /* LDO4_ENA */
463#define WM8400_LDO4_ENA_WIDTH 1 /* LDO4_ENA */
464#define WM8400_LDO4_SWI 0x4000 /* LDO4_SWI */
465#define WM8400_LDO4_SWI_MASK 0x4000 /* LDO4_SWI */
466#define WM8400_LDO4_SWI_SHIFT 14 /* LDO4_SWI */
467#define WM8400_LDO4_SWI_WIDTH 1 /* LDO4_SWI */
468#define WM8400_LDO4_OPFLT 0x1000 /* LDO4_OPFLT */
469#define WM8400_LDO4_OPFLT_MASK 0x1000 /* LDO4_OPFLT */
470#define WM8400_LDO4_OPFLT_SHIFT 12 /* LDO4_OPFLT */
471#define WM8400_LDO4_OPFLT_WIDTH 1 /* LDO4_OPFLT */
472#define WM8400_LDO4_ERRACT 0x0800 /* LDO4_ERRACT */
473#define WM8400_LDO4_ERRACT_MASK 0x0800 /* LDO4_ERRACT */
474#define WM8400_LDO4_ERRACT_SHIFT 11 /* LDO4_ERRACT */
475#define WM8400_LDO4_ERRACT_WIDTH 1 /* LDO4_ERRACT */
476#define WM8400_LDO4_HIB_MODE 0x0400 /* LDO4_HIB_MODE */
477#define WM8400_LDO4_HIB_MODE_MASK 0x0400 /* LDO4_HIB_MODE */
478#define WM8400_LDO4_HIB_MODE_SHIFT 10 /* LDO4_HIB_MODE */
479#define WM8400_LDO4_HIB_MODE_WIDTH 1 /* LDO4_HIB_MODE */
480#define WM8400_LDO4_VIMG_MASK 0x03E0 /* LDO4_VIMG - [9:5] */
481#define WM8400_LDO4_VIMG_SHIFT 5 /* LDO4_VIMG - [9:5] */
482#define WM8400_LDO4_VIMG_WIDTH 5 /* LDO4_VIMG - [9:5] */
483#define WM8400_LDO4_VSEL_MASK 0x001F /* LDO4_VSEL - [4:0] */
484#define WM8400_LDO4_VSEL_SHIFT 0 /* LDO4_VSEL - [4:0] */
485#define WM8400_LDO4_VSEL_WIDTH 5 /* LDO4_VSEL - [4:0] */
486
487/*
488 * R70 (0x46) - DCDC1 Control 1
489 */
490#define WM8400_DC1_ENA 0x8000 /* DC1_ENA */
491#define WM8400_DC1_ENA_MASK 0x8000 /* DC1_ENA */
492#define WM8400_DC1_ENA_SHIFT 15 /* DC1_ENA */
493#define WM8400_DC1_ENA_WIDTH 1 /* DC1_ENA */
494#define WM8400_DC1_ACTIVE 0x4000 /* DC1_ACTIVE */
495#define WM8400_DC1_ACTIVE_MASK 0x4000 /* DC1_ACTIVE */
496#define WM8400_DC1_ACTIVE_SHIFT 14 /* DC1_ACTIVE */
497#define WM8400_DC1_ACTIVE_WIDTH 1 /* DC1_ACTIVE */
498#define WM8400_DC1_SLEEP 0x2000 /* DC1_SLEEP */
499#define WM8400_DC1_SLEEP_MASK 0x2000 /* DC1_SLEEP */
500#define WM8400_DC1_SLEEP_SHIFT 13 /* DC1_SLEEP */
501#define WM8400_DC1_SLEEP_WIDTH 1 /* DC1_SLEEP */
502#define WM8400_DC1_OPFLT 0x1000 /* DC1_OPFLT */
503#define WM8400_DC1_OPFLT_MASK 0x1000 /* DC1_OPFLT */
504#define WM8400_DC1_OPFLT_SHIFT 12 /* DC1_OPFLT */
505#define WM8400_DC1_OPFLT_WIDTH 1 /* DC1_OPFLT */
506#define WM8400_DC1_ERRACT 0x0800 /* DC1_ERRACT */
507#define WM8400_DC1_ERRACT_MASK 0x0800 /* DC1_ERRACT */
508#define WM8400_DC1_ERRACT_SHIFT 11 /* DC1_ERRACT */
509#define WM8400_DC1_ERRACT_WIDTH 1 /* DC1_ERRACT */
510#define WM8400_DC1_HIB_MODE 0x0400 /* DC1_HIB_MODE */
511#define WM8400_DC1_HIB_MODE_MASK 0x0400 /* DC1_HIB_MODE */
512#define WM8400_DC1_HIB_MODE_SHIFT 10 /* DC1_HIB_MODE */
513#define WM8400_DC1_HIB_MODE_WIDTH 1 /* DC1_HIB_MODE */
514#define WM8400_DC1_SOFTST_MASK 0x0300 /* DC1_SOFTST - [9:8] */
515#define WM8400_DC1_SOFTST_SHIFT 8 /* DC1_SOFTST - [9:8] */
516#define WM8400_DC1_SOFTST_WIDTH 2 /* DC1_SOFTST - [9:8] */
517#define WM8400_DC1_OV_PROT 0x0080 /* DC1_OV_PROT */
518#define WM8400_DC1_OV_PROT_MASK 0x0080 /* DC1_OV_PROT */
519#define WM8400_DC1_OV_PROT_SHIFT 7 /* DC1_OV_PROT */
520#define WM8400_DC1_OV_PROT_WIDTH 1 /* DC1_OV_PROT */
521#define WM8400_DC1_VSEL_MASK 0x007F /* DC1_VSEL - [6:0] */
522#define WM8400_DC1_VSEL_SHIFT 0 /* DC1_VSEL - [6:0] */
523#define WM8400_DC1_VSEL_WIDTH 7 /* DC1_VSEL - [6:0] */
524
525/*
526 * R71 (0x47) - DCDC1 Control 2
527 */
528#define WM8400_DC1_FRC_PWM 0x2000 /* DC1_FRC_PWM */
529#define WM8400_DC1_FRC_PWM_MASK 0x2000 /* DC1_FRC_PWM */
530#define WM8400_DC1_FRC_PWM_SHIFT 13 /* DC1_FRC_PWM */
531#define WM8400_DC1_FRC_PWM_WIDTH 1 /* DC1_FRC_PWM */
532#define WM8400_DC1_STBY_LIM_MASK 0x0300 /* DC1_STBY_LIM - [9:8] */
533#define WM8400_DC1_STBY_LIM_SHIFT 8 /* DC1_STBY_LIM - [9:8] */
534#define WM8400_DC1_STBY_LIM_WIDTH 2 /* DC1_STBY_LIM - [9:8] */
535#define WM8400_DC1_ACT_LIM 0x0080 /* DC1_ACT_LIM */
536#define WM8400_DC1_ACT_LIM_MASK 0x0080 /* DC1_ACT_LIM */
537#define WM8400_DC1_ACT_LIM_SHIFT 7 /* DC1_ACT_LIM */
538#define WM8400_DC1_ACT_LIM_WIDTH 1 /* DC1_ACT_LIM */
539#define WM8400_DC1_VIMG_MASK 0x007F /* DC1_VIMG - [6:0] */
540#define WM8400_DC1_VIMG_SHIFT 0 /* DC1_VIMG - [6:0] */
541#define WM8400_DC1_VIMG_WIDTH 7 /* DC1_VIMG - [6:0] */
542
543/*
544 * R72 (0x48) - DCDC2 Control 1
545 */
546#define WM8400_DC2_ENA 0x8000 /* DC2_ENA */
547#define WM8400_DC2_ENA_MASK 0x8000 /* DC2_ENA */
548#define WM8400_DC2_ENA_SHIFT 15 /* DC2_ENA */
549#define WM8400_DC2_ENA_WIDTH 1 /* DC2_ENA */
550#define WM8400_DC2_ACTIVE 0x4000 /* DC2_ACTIVE */
551#define WM8400_DC2_ACTIVE_MASK 0x4000 /* DC2_ACTIVE */
552#define WM8400_DC2_ACTIVE_SHIFT 14 /* DC2_ACTIVE */
553#define WM8400_DC2_ACTIVE_WIDTH 1 /* DC2_ACTIVE */
554#define WM8400_DC2_SLEEP 0x2000 /* DC2_SLEEP */
555#define WM8400_DC2_SLEEP_MASK 0x2000 /* DC2_SLEEP */
556#define WM8400_DC2_SLEEP_SHIFT 13 /* DC2_SLEEP */
557#define WM8400_DC2_SLEEP_WIDTH 1 /* DC2_SLEEP */
558#define WM8400_DC2_OPFLT 0x1000 /* DC2_OPFLT */
559#define WM8400_DC2_OPFLT_MASK 0x1000 /* DC2_OPFLT */
560#define WM8400_DC2_OPFLT_SHIFT 12 /* DC2_OPFLT */
561#define WM8400_DC2_OPFLT_WIDTH 1 /* DC2_OPFLT */
562#define WM8400_DC2_ERRACT 0x0800 /* DC2_ERRACT */
563#define WM8400_DC2_ERRACT_MASK 0x0800 /* DC2_ERRACT */
564#define WM8400_DC2_ERRACT_SHIFT 11 /* DC2_ERRACT */
565#define WM8400_DC2_ERRACT_WIDTH 1 /* DC2_ERRACT */
566#define WM8400_DC2_HIB_MODE 0x0400 /* DC2_HIB_MODE */
567#define WM8400_DC2_HIB_MODE_MASK 0x0400 /* DC2_HIB_MODE */
568#define WM8400_DC2_HIB_MODE_SHIFT 10 /* DC2_HIB_MODE */
569#define WM8400_DC2_HIB_MODE_WIDTH 1 /* DC2_HIB_MODE */
570#define WM8400_DC2_SOFTST_MASK 0x0300 /* DC2_SOFTST - [9:8] */
571#define WM8400_DC2_SOFTST_SHIFT 8 /* DC2_SOFTST - [9:8] */
572#define WM8400_DC2_SOFTST_WIDTH 2 /* DC2_SOFTST - [9:8] */
573#define WM8400_DC2_OV_PROT 0x0080 /* DC2_OV_PROT */
574#define WM8400_DC2_OV_PROT_MASK 0x0080 /* DC2_OV_PROT */
575#define WM8400_DC2_OV_PROT_SHIFT 7 /* DC2_OV_PROT */
576#define WM8400_DC2_OV_PROT_WIDTH 1 /* DC2_OV_PROT */
577#define WM8400_DC2_VSEL_MASK 0x007F /* DC2_VSEL - [6:0] */
578#define WM8400_DC2_VSEL_SHIFT 0 /* DC2_VSEL - [6:0] */
579#define WM8400_DC2_VSEL_WIDTH 7 /* DC2_VSEL - [6:0] */
580
581/*
582 * R73 (0x49) - DCDC2 Control 2
583 */
584#define WM8400_DC2_FRC_PWM 0x2000 /* DC2_FRC_PWM */
585#define WM8400_DC2_FRC_PWM_MASK 0x2000 /* DC2_FRC_PWM */
586#define WM8400_DC2_FRC_PWM_SHIFT 13 /* DC2_FRC_PWM */
587#define WM8400_DC2_FRC_PWM_WIDTH 1 /* DC2_FRC_PWM */
588#define WM8400_DC2_STBY_LIM_MASK 0x0300 /* DC2_STBY_LIM - [9:8] */
589#define WM8400_DC2_STBY_LIM_SHIFT 8 /* DC2_STBY_LIM - [9:8] */
590#define WM8400_DC2_STBY_LIM_WIDTH 2 /* DC2_STBY_LIM - [9:8] */
591#define WM8400_DC2_ACT_LIM 0x0080 /* DC2_ACT_LIM */
592#define WM8400_DC2_ACT_LIM_MASK 0x0080 /* DC2_ACT_LIM */
593#define WM8400_DC2_ACT_LIM_SHIFT 7 /* DC2_ACT_LIM */
594#define WM8400_DC2_ACT_LIM_WIDTH 1 /* DC2_ACT_LIM */
595#define WM8400_DC2_VIMG_MASK 0x007F /* DC2_VIMG - [6:0] */
596#define WM8400_DC2_VIMG_SHIFT 0 /* DC2_VIMG - [6:0] */
597#define WM8400_DC2_VIMG_WIDTH 7 /* DC2_VIMG - [6:0] */
598
599/*
600 * R75 (0x4B) - Interface
601 */
602#define WM8400_AUTOINC 0x0008 /* AUTOINC */
603#define WM8400_AUTOINC_MASK 0x0008 /* AUTOINC */
604#define WM8400_AUTOINC_SHIFT 3 /* AUTOINC */
605#define WM8400_AUTOINC_WIDTH 1 /* AUTOINC */
606#define WM8400_ARA_ENA 0x0004 /* ARA_ENA */
607#define WM8400_ARA_ENA_MASK 0x0004 /* ARA_ENA */
608#define WM8400_ARA_ENA_SHIFT 2 /* ARA_ENA */
609#define WM8400_ARA_ENA_WIDTH 1 /* ARA_ENA */
610#define WM8400_SPI_CFG 0x0002 /* SPI_CFG */
611#define WM8400_SPI_CFG_MASK 0x0002 /* SPI_CFG */
612#define WM8400_SPI_CFG_SHIFT 1 /* SPI_CFG */
613#define WM8400_SPI_CFG_WIDTH 1 /* SPI_CFG */
614
615/*
616 * R76 (0x4C) - PM GENERAL
617 */
618#define WM8400_CODEC_SOFTST 0x8000 /* CODEC_SOFTST */
619#define WM8400_CODEC_SOFTST_MASK 0x8000 /* CODEC_SOFTST */
620#define WM8400_CODEC_SOFTST_SHIFT 15 /* CODEC_SOFTST */
621#define WM8400_CODEC_SOFTST_WIDTH 1 /* CODEC_SOFTST */
622#define WM8400_CODEC_SOFTSD 0x4000 /* CODEC_SOFTSD */
623#define WM8400_CODEC_SOFTSD_MASK 0x4000 /* CODEC_SOFTSD */
624#define WM8400_CODEC_SOFTSD_SHIFT 14 /* CODEC_SOFTSD */
625#define WM8400_CODEC_SOFTSD_WIDTH 1 /* CODEC_SOFTSD */
626#define WM8400_CHIP_SOFTSD 0x2000 /* CHIP_SOFTSD */
627#define WM8400_CHIP_SOFTSD_MASK 0x2000 /* CHIP_SOFTSD */
628#define WM8400_CHIP_SOFTSD_SHIFT 13 /* CHIP_SOFTSD */
629#define WM8400_CHIP_SOFTSD_WIDTH 1 /* CHIP_SOFTSD */
630#define WM8400_DSLEEP1_POL 0x0008 /* DSLEEP1_POL */
631#define WM8400_DSLEEP1_POL_MASK 0x0008 /* DSLEEP1_POL */
632#define WM8400_DSLEEP1_POL_SHIFT 3 /* DSLEEP1_POL */
633#define WM8400_DSLEEP1_POL_WIDTH 1 /* DSLEEP1_POL */
634#define WM8400_DSLEEP2_POL 0x0004 /* DSLEEP2_POL */
635#define WM8400_DSLEEP2_POL_MASK 0x0004 /* DSLEEP2_POL */
636#define WM8400_DSLEEP2_POL_SHIFT 2 /* DSLEEP2_POL */
637#define WM8400_DSLEEP2_POL_WIDTH 1 /* DSLEEP2_POL */
638#define WM8400_PWR_STATE_MASK 0x0003 /* PWR_STATE - [1:0] */
639#define WM8400_PWR_STATE_SHIFT 0 /* PWR_STATE - [1:0] */
640#define WM8400_PWR_STATE_WIDTH 2 /* PWR_STATE - [1:0] */
641
642/*
643 * R78 (0x4E) - PM Shutdown Control
644 */
645#define WM8400_CHIP_GT150_ERRACT 0x0200 /* CHIP_GT150_ERRACT */
646#define WM8400_CHIP_GT150_ERRACT_MASK 0x0200 /* CHIP_GT150_ERRACT */
647#define WM8400_CHIP_GT150_ERRACT_SHIFT 9 /* CHIP_GT150_ERRACT */
648#define WM8400_CHIP_GT150_ERRACT_WIDTH 1 /* CHIP_GT150_ERRACT */
649#define WM8400_CHIP_GT115_ERRACT 0x0100 /* CHIP_GT115_ERRACT */
650#define WM8400_CHIP_GT115_ERRACT_MASK 0x0100 /* CHIP_GT115_ERRACT */
651#define WM8400_CHIP_GT115_ERRACT_SHIFT 8 /* CHIP_GT115_ERRACT */
652#define WM8400_CHIP_GT115_ERRACT_WIDTH 1 /* CHIP_GT115_ERRACT */
653#define WM8400_LINE_CMP_ERRACT 0x0080 /* LINE_CMP_ERRACT */
654#define WM8400_LINE_CMP_ERRACT_MASK 0x0080 /* LINE_CMP_ERRACT */
655#define WM8400_LINE_CMP_ERRACT_SHIFT 7 /* LINE_CMP_ERRACT */
656#define WM8400_LINE_CMP_ERRACT_WIDTH 1 /* LINE_CMP_ERRACT */
657#define WM8400_UVLO_ERRACT 0x0040 /* UVLO_ERRACT */
658#define WM8400_UVLO_ERRACT_MASK 0x0040 /* UVLO_ERRACT */
659#define WM8400_UVLO_ERRACT_SHIFT 6 /* UVLO_ERRACT */
660#define WM8400_UVLO_ERRACT_WIDTH 1 /* UVLO_ERRACT */
661
662/*
663 * R79 (0x4F) - Interrupt Status 1
664 */
665#define WM8400_MICD_CINT 0x8000 /* MICD_CINT */
666#define WM8400_MICD_CINT_MASK 0x8000 /* MICD_CINT */
667#define WM8400_MICD_CINT_SHIFT 15 /* MICD_CINT */
668#define WM8400_MICD_CINT_WIDTH 1 /* MICD_CINT */
669#define WM8400_MICSCD_CINT 0x4000 /* MICSCD_CINT */
670#define WM8400_MICSCD_CINT_MASK 0x4000 /* MICSCD_CINT */
671#define WM8400_MICSCD_CINT_SHIFT 14 /* MICSCD_CINT */
672#define WM8400_MICSCD_CINT_WIDTH 1 /* MICSCD_CINT */
673#define WM8400_JDL_CINT 0x2000 /* JDL_CINT */
674#define WM8400_JDL_CINT_MASK 0x2000 /* JDL_CINT */
675#define WM8400_JDL_CINT_SHIFT 13 /* JDL_CINT */
676#define WM8400_JDL_CINT_WIDTH 1 /* JDL_CINT */
677#define WM8400_JDR_CINT 0x1000 /* JDR_CINT */
678#define WM8400_JDR_CINT_MASK 0x1000 /* JDR_CINT */
679#define WM8400_JDR_CINT_SHIFT 12 /* JDR_CINT */
680#define WM8400_JDR_CINT_WIDTH 1 /* JDR_CINT */
681#define WM8400_CODEC_SEQ_END_EINT 0x0800 /* CODEC_SEQ_END_EINT */
682#define WM8400_CODEC_SEQ_END_EINT_MASK 0x0800 /* CODEC_SEQ_END_EINT */
683#define WM8400_CODEC_SEQ_END_EINT_SHIFT 11 /* CODEC_SEQ_END_EINT */
684#define WM8400_CODEC_SEQ_END_EINT_WIDTH 1 /* CODEC_SEQ_END_EINT */
685#define WM8400_CDEL_TO_EINT 0x0400 /* CDEL_TO_EINT */
686#define WM8400_CDEL_TO_EINT_MASK 0x0400 /* CDEL_TO_EINT */
687#define WM8400_CDEL_TO_EINT_SHIFT 10 /* CDEL_TO_EINT */
688#define WM8400_CDEL_TO_EINT_WIDTH 1 /* CDEL_TO_EINT */
689#define WM8400_CHIP_GT150_EINT 0x0200 /* CHIP_GT150_EINT */
690#define WM8400_CHIP_GT150_EINT_MASK 0x0200 /* CHIP_GT150_EINT */
691#define WM8400_CHIP_GT150_EINT_SHIFT 9 /* CHIP_GT150_EINT */
692#define WM8400_CHIP_GT150_EINT_WIDTH 1 /* CHIP_GT150_EINT */
693#define WM8400_CHIP_GT115_EINT 0x0100 /* CHIP_GT115_EINT */
694#define WM8400_CHIP_GT115_EINT_MASK 0x0100 /* CHIP_GT115_EINT */
695#define WM8400_CHIP_GT115_EINT_SHIFT 8 /* CHIP_GT115_EINT */
696#define WM8400_CHIP_GT115_EINT_WIDTH 1 /* CHIP_GT115_EINT */
697#define WM8400_LINE_CMP_EINT 0x0080 /* LINE_CMP_EINT */
698#define WM8400_LINE_CMP_EINT_MASK 0x0080 /* LINE_CMP_EINT */
699#define WM8400_LINE_CMP_EINT_SHIFT 7 /* LINE_CMP_EINT */
700#define WM8400_LINE_CMP_EINT_WIDTH 1 /* LINE_CMP_EINT */
701#define WM8400_UVLO_EINT 0x0040 /* UVLO_EINT */
702#define WM8400_UVLO_EINT_MASK 0x0040 /* UVLO_EINT */
703#define WM8400_UVLO_EINT_SHIFT 6 /* UVLO_EINT */
704#define WM8400_UVLO_EINT_WIDTH 1 /* UVLO_EINT */
705#define WM8400_DC2_UV_EINT 0x0020 /* DC2_UV_EINT */
706#define WM8400_DC2_UV_EINT_MASK 0x0020 /* DC2_UV_EINT */
707#define WM8400_DC2_UV_EINT_SHIFT 5 /* DC2_UV_EINT */
708#define WM8400_DC2_UV_EINT_WIDTH 1 /* DC2_UV_EINT */
709#define WM8400_DC1_UV_EINT 0x0010 /* DC1_UV_EINT */
710#define WM8400_DC1_UV_EINT_MASK 0x0010 /* DC1_UV_EINT */
711#define WM8400_DC1_UV_EINT_SHIFT 4 /* DC1_UV_EINT */
712#define WM8400_DC1_UV_EINT_WIDTH 1 /* DC1_UV_EINT */
713#define WM8400_LDO4_UV_EINT 0x0008 /* LDO4_UV_EINT */
714#define WM8400_LDO4_UV_EINT_MASK 0x0008 /* LDO4_UV_EINT */
715#define WM8400_LDO4_UV_EINT_SHIFT 3 /* LDO4_UV_EINT */
716#define WM8400_LDO4_UV_EINT_WIDTH 1 /* LDO4_UV_EINT */
717#define WM8400_LDO3_UV_EINT 0x0004 /* LDO3_UV_EINT */
718#define WM8400_LDO3_UV_EINT_MASK 0x0004 /* LDO3_UV_EINT */
719#define WM8400_LDO3_UV_EINT_SHIFT 2 /* LDO3_UV_EINT */
720#define WM8400_LDO3_UV_EINT_WIDTH 1 /* LDO3_UV_EINT */
721#define WM8400_LDO2_UV_EINT 0x0002 /* LDO2_UV_EINT */
722#define WM8400_LDO2_UV_EINT_MASK 0x0002 /* LDO2_UV_EINT */
723#define WM8400_LDO2_UV_EINT_SHIFT 1 /* LDO2_UV_EINT */
724#define WM8400_LDO2_UV_EINT_WIDTH 1 /* LDO2_UV_EINT */
725#define WM8400_LDO1_UV_EINT 0x0001 /* LDO1_UV_EINT */
726#define WM8400_LDO1_UV_EINT_MASK 0x0001 /* LDO1_UV_EINT */
727#define WM8400_LDO1_UV_EINT_SHIFT 0 /* LDO1_UV_EINT */
728#define WM8400_LDO1_UV_EINT_WIDTH 1 /* LDO1_UV_EINT */
729
730/*
731 * R80 (0x50) - Interrupt Status 1 Mask
732 */
733#define WM8400_IM_MICD_CINT 0x8000 /* IM_MICD_CINT */
734#define WM8400_IM_MICD_CINT_MASK 0x8000 /* IM_MICD_CINT */
735#define WM8400_IM_MICD_CINT_SHIFT 15 /* IM_MICD_CINT */
736#define WM8400_IM_MICD_CINT_WIDTH 1 /* IM_MICD_CINT */
737#define WM8400_IM_MICSCD_CINT 0x4000 /* IM_MICSCD_CINT */
738#define WM8400_IM_MICSCD_CINT_MASK 0x4000 /* IM_MICSCD_CINT */
739#define WM8400_IM_MICSCD_CINT_SHIFT 14 /* IM_MICSCD_CINT */
740#define WM8400_IM_MICSCD_CINT_WIDTH 1 /* IM_MICSCD_CINT */
741#define WM8400_IM_JDL_CINT 0x2000 /* IM_JDL_CINT */
742#define WM8400_IM_JDL_CINT_MASK 0x2000 /* IM_JDL_CINT */
743#define WM8400_IM_JDL_CINT_SHIFT 13 /* IM_JDL_CINT */
744#define WM8400_IM_JDL_CINT_WIDTH 1 /* IM_JDL_CINT */
745#define WM8400_IM_JDR_CINT 0x1000 /* IM_JDR_CINT */
746#define WM8400_IM_JDR_CINT_MASK 0x1000 /* IM_JDR_CINT */
747#define WM8400_IM_JDR_CINT_SHIFT 12 /* IM_JDR_CINT */
748#define WM8400_IM_JDR_CINT_WIDTH 1 /* IM_JDR_CINT */
749#define WM8400_IM_CODEC_SEQ_END_EINT 0x0800 /* IM_CODEC_SEQ_END_EINT */
750#define WM8400_IM_CODEC_SEQ_END_EINT_MASK 0x0800 /* IM_CODEC_SEQ_END_EINT */
751#define WM8400_IM_CODEC_SEQ_END_EINT_SHIFT 11 /* IM_CODEC_SEQ_END_EINT */
752#define WM8400_IM_CODEC_SEQ_END_EINT_WIDTH 1 /* IM_CODEC_SEQ_END_EINT */
753#define WM8400_IM_CDEL_TO_EINT 0x0400 /* IM_CDEL_TO_EINT */
754#define WM8400_IM_CDEL_TO_EINT_MASK 0x0400 /* IM_CDEL_TO_EINT */
755#define WM8400_IM_CDEL_TO_EINT_SHIFT 10 /* IM_CDEL_TO_EINT */
756#define WM8400_IM_CDEL_TO_EINT_WIDTH 1 /* IM_CDEL_TO_EINT */
757#define WM8400_IM_CHIP_GT150_EINT 0x0200 /* IM_CHIP_GT150_EINT */
758#define WM8400_IM_CHIP_GT150_EINT_MASK 0x0200 /* IM_CHIP_GT150_EINT */
759#define WM8400_IM_CHIP_GT150_EINT_SHIFT 9 /* IM_CHIP_GT150_EINT */
760#define WM8400_IM_CHIP_GT150_EINT_WIDTH 1 /* IM_CHIP_GT150_EINT */
761#define WM8400_IM_CHIP_GT115_EINT 0x0100 /* IM_CHIP_GT115_EINT */
762#define WM8400_IM_CHIP_GT115_EINT_MASK 0x0100 /* IM_CHIP_GT115_EINT */
763#define WM8400_IM_CHIP_GT115_EINT_SHIFT 8 /* IM_CHIP_GT115_EINT */
764#define WM8400_IM_CHIP_GT115_EINT_WIDTH 1 /* IM_CHIP_GT115_EINT */
765#define WM8400_IM_LINE_CMP_EINT 0x0080 /* IM_LINE_CMP_EINT */
766#define WM8400_IM_LINE_CMP_EINT_MASK 0x0080 /* IM_LINE_CMP_EINT */
767#define WM8400_IM_LINE_CMP_EINT_SHIFT 7 /* IM_LINE_CMP_EINT */
768#define WM8400_IM_LINE_CMP_EINT_WIDTH 1 /* IM_LINE_CMP_EINT */
769#define WM8400_IM_UVLO_EINT 0x0040 /* IM_UVLO_EINT */
770#define WM8400_IM_UVLO_EINT_MASK 0x0040 /* IM_UVLO_EINT */
771#define WM8400_IM_UVLO_EINT_SHIFT 6 /* IM_UVLO_EINT */
772#define WM8400_IM_UVLO_EINT_WIDTH 1 /* IM_UVLO_EINT */
773#define WM8400_IM_DC2_UV_EINT 0x0020 /* IM_DC2_UV_EINT */
774#define WM8400_IM_DC2_UV_EINT_MASK 0x0020 /* IM_DC2_UV_EINT */
775#define WM8400_IM_DC2_UV_EINT_SHIFT 5 /* IM_DC2_UV_EINT */
776#define WM8400_IM_DC2_UV_EINT_WIDTH 1 /* IM_DC2_UV_EINT */
777#define WM8400_IM_DC1_UV_EINT 0x0010 /* IM_DC1_UV_EINT */
778#define WM8400_IM_DC1_UV_EINT_MASK 0x0010 /* IM_DC1_UV_EINT */
779#define WM8400_IM_DC1_UV_EINT_SHIFT 4 /* IM_DC1_UV_EINT */
780#define WM8400_IM_DC1_UV_EINT_WIDTH 1 /* IM_DC1_UV_EINT */
781#define WM8400_IM_LDO4_UV_EINT 0x0008 /* IM_LDO4_UV_EINT */
782#define WM8400_IM_LDO4_UV_EINT_MASK 0x0008 /* IM_LDO4_UV_EINT */
783#define WM8400_IM_LDO4_UV_EINT_SHIFT 3 /* IM_LDO4_UV_EINT */
784#define WM8400_IM_LDO4_UV_EINT_WIDTH 1 /* IM_LDO4_UV_EINT */
785#define WM8400_IM_LDO3_UV_EINT 0x0004 /* IM_LDO3_UV_EINT */
786#define WM8400_IM_LDO3_UV_EINT_MASK 0x0004 /* IM_LDO3_UV_EINT */
787#define WM8400_IM_LDO3_UV_EINT_SHIFT 2 /* IM_LDO3_UV_EINT */
788#define WM8400_IM_LDO3_UV_EINT_WIDTH 1 /* IM_LDO3_UV_EINT */
789#define WM8400_IM_LDO2_UV_EINT 0x0002 /* IM_LDO2_UV_EINT */
790#define WM8400_IM_LDO2_UV_EINT_MASK 0x0002 /* IM_LDO2_UV_EINT */
791#define WM8400_IM_LDO2_UV_EINT_SHIFT 1 /* IM_LDO2_UV_EINT */
792#define WM8400_IM_LDO2_UV_EINT_WIDTH 1 /* IM_LDO2_UV_EINT */
793#define WM8400_IM_LDO1_UV_EINT 0x0001 /* IM_LDO1_UV_EINT */
794#define WM8400_IM_LDO1_UV_EINT_MASK 0x0001 /* IM_LDO1_UV_EINT */
795#define WM8400_IM_LDO1_UV_EINT_SHIFT 0 /* IM_LDO1_UV_EINT */
796#define WM8400_IM_LDO1_UV_EINT_WIDTH 1 /* IM_LDO1_UV_EINT */
797
798/*
799 * R81 (0x51) - Interrupt Levels
800 */
801#define WM8400_MICD_LVL 0x8000 /* MICD_LVL */
802#define WM8400_MICD_LVL_MASK 0x8000 /* MICD_LVL */
803#define WM8400_MICD_LVL_SHIFT 15 /* MICD_LVL */
804#define WM8400_MICD_LVL_WIDTH 1 /* MICD_LVL */
805#define WM8400_MICSCD_LVL 0x4000 /* MICSCD_LVL */
806#define WM8400_MICSCD_LVL_MASK 0x4000 /* MICSCD_LVL */
807#define WM8400_MICSCD_LVL_SHIFT 14 /* MICSCD_LVL */
808#define WM8400_MICSCD_LVL_WIDTH 1 /* MICSCD_LVL */
809#define WM8400_JDL_LVL 0x2000 /* JDL_LVL */
810#define WM8400_JDL_LVL_MASK 0x2000 /* JDL_LVL */
811#define WM8400_JDL_LVL_SHIFT 13 /* JDL_LVL */
812#define WM8400_JDL_LVL_WIDTH 1 /* JDL_LVL */
813#define WM8400_JDR_LVL 0x1000 /* JDR_LVL */
814#define WM8400_JDR_LVL_MASK 0x1000 /* JDR_LVL */
815#define WM8400_JDR_LVL_SHIFT 12 /* JDR_LVL */
816#define WM8400_JDR_LVL_WIDTH 1 /* JDR_LVL */
817#define WM8400_CODEC_SEQ_END_LVL 0x0800 /* CODEC_SEQ_END_LVL */
818#define WM8400_CODEC_SEQ_END_LVL_MASK 0x0800 /* CODEC_SEQ_END_LVL */
819#define WM8400_CODEC_SEQ_END_LVL_SHIFT 11 /* CODEC_SEQ_END_LVL */
820#define WM8400_CODEC_SEQ_END_LVL_WIDTH 1 /* CODEC_SEQ_END_LVL */
821#define WM8400_CDEL_TO_LVL 0x0400 /* CDEL_TO_LVL */
822#define WM8400_CDEL_TO_LVL_MASK 0x0400 /* CDEL_TO_LVL */
823#define WM8400_CDEL_TO_LVL_SHIFT 10 /* CDEL_TO_LVL */
824#define WM8400_CDEL_TO_LVL_WIDTH 1 /* CDEL_TO_LVL */
825#define WM8400_CHIP_GT150_LVL 0x0200 /* CHIP_GT150_LVL */
826#define WM8400_CHIP_GT150_LVL_MASK 0x0200 /* CHIP_GT150_LVL */
827#define WM8400_CHIP_GT150_LVL_SHIFT 9 /* CHIP_GT150_LVL */
828#define WM8400_CHIP_GT150_LVL_WIDTH 1 /* CHIP_GT150_LVL */
829#define WM8400_CHIP_GT115_LVL 0x0100 /* CHIP_GT115_LVL */
830#define WM8400_CHIP_GT115_LVL_MASK 0x0100 /* CHIP_GT115_LVL */
831#define WM8400_CHIP_GT115_LVL_SHIFT 8 /* CHIP_GT115_LVL */
832#define WM8400_CHIP_GT115_LVL_WIDTH 1 /* CHIP_GT115_LVL */
833#define WM8400_LINE_CMP_LVL 0x0080 /* LINE_CMP_LVL */
834#define WM8400_LINE_CMP_LVL_MASK 0x0080 /* LINE_CMP_LVL */
835#define WM8400_LINE_CMP_LVL_SHIFT 7 /* LINE_CMP_LVL */
836#define WM8400_LINE_CMP_LVL_WIDTH 1 /* LINE_CMP_LVL */
837#define WM8400_UVLO_LVL 0x0040 /* UVLO_LVL */
838#define WM8400_UVLO_LVL_MASK 0x0040 /* UVLO_LVL */
839#define WM8400_UVLO_LVL_SHIFT 6 /* UVLO_LVL */
840#define WM8400_UVLO_LVL_WIDTH 1 /* UVLO_LVL */
841#define WM8400_DC2_UV_LVL 0x0020 /* DC2_UV_LVL */
842#define WM8400_DC2_UV_LVL_MASK 0x0020 /* DC2_UV_LVL */
843#define WM8400_DC2_UV_LVL_SHIFT 5 /* DC2_UV_LVL */
844#define WM8400_DC2_UV_LVL_WIDTH 1 /* DC2_UV_LVL */
845#define WM8400_DC1_UV_LVL 0x0010 /* DC1_UV_LVL */
846#define WM8400_DC1_UV_LVL_MASK 0x0010 /* DC1_UV_LVL */
847#define WM8400_DC1_UV_LVL_SHIFT 4 /* DC1_UV_LVL */
848#define WM8400_DC1_UV_LVL_WIDTH 1 /* DC1_UV_LVL */
849#define WM8400_LDO4_UV_LVL 0x0008 /* LDO4_UV_LVL */
850#define WM8400_LDO4_UV_LVL_MASK 0x0008 /* LDO4_UV_LVL */
851#define WM8400_LDO4_UV_LVL_SHIFT 3 /* LDO4_UV_LVL */
852#define WM8400_LDO4_UV_LVL_WIDTH 1 /* LDO4_UV_LVL */
853#define WM8400_LDO3_UV_LVL 0x0004 /* LDO3_UV_LVL */
854#define WM8400_LDO3_UV_LVL_MASK 0x0004 /* LDO3_UV_LVL */
855#define WM8400_LDO3_UV_LVL_SHIFT 2 /* LDO3_UV_LVL */
856#define WM8400_LDO3_UV_LVL_WIDTH 1 /* LDO3_UV_LVL */
857#define WM8400_LDO2_UV_LVL 0x0002 /* LDO2_UV_LVL */
858#define WM8400_LDO2_UV_LVL_MASK 0x0002 /* LDO2_UV_LVL */
859#define WM8400_LDO2_UV_LVL_SHIFT 1 /* LDO2_UV_LVL */
860#define WM8400_LDO2_UV_LVL_WIDTH 1 /* LDO2_UV_LVL */
861#define WM8400_LDO1_UV_LVL 0x0001 /* LDO1_UV_LVL */
862#define WM8400_LDO1_UV_LVL_MASK 0x0001 /* LDO1_UV_LVL */
863#define WM8400_LDO1_UV_LVL_SHIFT 0 /* LDO1_UV_LVL */
864#define WM8400_LDO1_UV_LVL_WIDTH 1 /* LDO1_UV_LVL */
865
866/*
867 * R82 (0x52) - Shutdown Reason
868 */
869#define WM8400_SDR_CHIP_SOFTSD 0x2000 /* SDR_CHIP_SOFTSD */
870#define WM8400_SDR_CHIP_SOFTSD_MASK 0x2000 /* SDR_CHIP_SOFTSD */
871#define WM8400_SDR_CHIP_SOFTSD_SHIFT 13 /* SDR_CHIP_SOFTSD */
872#define WM8400_SDR_CHIP_SOFTSD_WIDTH 1 /* SDR_CHIP_SOFTSD */
873#define WM8400_SDR_NPDN 0x0800 /* SDR_NPDN */
874#define WM8400_SDR_NPDN_MASK 0x0800 /* SDR_NPDN */
875#define WM8400_SDR_NPDN_SHIFT 11 /* SDR_NPDN */
876#define WM8400_SDR_NPDN_WIDTH 1 /* SDR_NPDN */
877#define WM8400_SDR_CHIP_GT150 0x0200 /* SDR_CHIP_GT150 */
878#define WM8400_SDR_CHIP_GT150_MASK 0x0200 /* SDR_CHIP_GT150 */
879#define WM8400_SDR_CHIP_GT150_SHIFT 9 /* SDR_CHIP_GT150 */
880#define WM8400_SDR_CHIP_GT150_WIDTH 1 /* SDR_CHIP_GT150 */
881#define WM8400_SDR_CHIP_GT115 0x0100 /* SDR_CHIP_GT115 */
882#define WM8400_SDR_CHIP_GT115_MASK 0x0100 /* SDR_CHIP_GT115 */
883#define WM8400_SDR_CHIP_GT115_SHIFT 8 /* SDR_CHIP_GT115 */
884#define WM8400_SDR_CHIP_GT115_WIDTH 1 /* SDR_CHIP_GT115 */
885#define WM8400_SDR_LINE_CMP 0x0080 /* SDR_LINE_CMP */
886#define WM8400_SDR_LINE_CMP_MASK 0x0080 /* SDR_LINE_CMP */
887#define WM8400_SDR_LINE_CMP_SHIFT 7 /* SDR_LINE_CMP */
888#define WM8400_SDR_LINE_CMP_WIDTH 1 /* SDR_LINE_CMP */
889#define WM8400_SDR_UVLO 0x0040 /* SDR_UVLO */
890#define WM8400_SDR_UVLO_MASK 0x0040 /* SDR_UVLO */
891#define WM8400_SDR_UVLO_SHIFT 6 /* SDR_UVLO */
892#define WM8400_SDR_UVLO_WIDTH 1 /* SDR_UVLO */
893#define WM8400_SDR_DC2_UV 0x0020 /* SDR_DC2_UV */
894#define WM8400_SDR_DC2_UV_MASK 0x0020 /* SDR_DC2_UV */
895#define WM8400_SDR_DC2_UV_SHIFT 5 /* SDR_DC2_UV */
896#define WM8400_SDR_DC2_UV_WIDTH 1 /* SDR_DC2_UV */
897#define WM8400_SDR_DC1_UV 0x0010 /* SDR_DC1_UV */
898#define WM8400_SDR_DC1_UV_MASK 0x0010 /* SDR_DC1_UV */
899#define WM8400_SDR_DC1_UV_SHIFT 4 /* SDR_DC1_UV */
900#define WM8400_SDR_DC1_UV_WIDTH 1 /* SDR_DC1_UV */
901#define WM8400_SDR_LDO4_UV 0x0008 /* SDR_LDO4_UV */
902#define WM8400_SDR_LDO4_UV_MASK 0x0008 /* SDR_LDO4_UV */
903#define WM8400_SDR_LDO4_UV_SHIFT 3 /* SDR_LDO4_UV */
904#define WM8400_SDR_LDO4_UV_WIDTH 1 /* SDR_LDO4_UV */
905#define WM8400_SDR_LDO3_UV 0x0004 /* SDR_LDO3_UV */
906#define WM8400_SDR_LDO3_UV_MASK 0x0004 /* SDR_LDO3_UV */
907#define WM8400_SDR_LDO3_UV_SHIFT 2 /* SDR_LDO3_UV */
908#define WM8400_SDR_LDO3_UV_WIDTH 1 /* SDR_LDO3_UV */
909#define WM8400_SDR_LDO2_UV 0x0002 /* SDR_LDO2_UV */
910#define WM8400_SDR_LDO2_UV_MASK 0x0002 /* SDR_LDO2_UV */
911#define WM8400_SDR_LDO2_UV_SHIFT 1 /* SDR_LDO2_UV */
912#define WM8400_SDR_LDO2_UV_WIDTH 1 /* SDR_LDO2_UV */
913#define WM8400_SDR_LDO1_UV 0x0001 /* SDR_LDO1_UV */
914#define WM8400_SDR_LDO1_UV_MASK 0x0001 /* SDR_LDO1_UV */
915#define WM8400_SDR_LDO1_UV_SHIFT 0 /* SDR_LDO1_UV */
916#define WM8400_SDR_LDO1_UV_WIDTH 1 /* SDR_LDO1_UV */
917
918/*
919 * R84 (0x54) - Line Circuits
920 */
921#define WM8400_BG_LINE_COMP 0x8000 /* BG_LINE_COMP */
922#define WM8400_BG_LINE_COMP_MASK 0x8000 /* BG_LINE_COMP */
923#define WM8400_BG_LINE_COMP_SHIFT 15 /* BG_LINE_COMP */
924#define WM8400_BG_LINE_COMP_WIDTH 1 /* BG_LINE_COMP */
925#define WM8400_LINE_CMP_VTHI_MASK 0x00F0 /* LINE_CMP_VTHI - [7:4] */
926#define WM8400_LINE_CMP_VTHI_SHIFT 4 /* LINE_CMP_VTHI - [7:4] */
927#define WM8400_LINE_CMP_VTHI_WIDTH 4 /* LINE_CMP_VTHI - [7:4] */
928#define WM8400_LINE_CMP_VTHD_MASK 0x000F /* LINE_CMP_VTHD - [3:0] */
929#define WM8400_LINE_CMP_VTHD_SHIFT 0 /* LINE_CMP_VTHD - [3:0] */
930#define WM8400_LINE_CMP_VTHD_WIDTH 4 /* LINE_CMP_VTHD - [3:0] */
931
932u16 wm8400_reg_read(struct wm8400 *wm8400, u8 reg);
933int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data);
934int wm8400_set_bits(struct wm8400 *wm8400, u8 reg, u16 mask, u16 val);
935
936#endif
diff --git a/include/linux/mfd/wm8400.h b/include/linux/mfd/wm8400.h
new file mode 100644
index 000000000000..b46b566ac1ac
--- /dev/null
+++ b/include/linux/mfd/wm8400.h
@@ -0,0 +1,40 @@
1/*
2 * wm8400 client interface
3 *
4 * Copyright 2008 Wolfson Microelectronics plc
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; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef __LINUX_MFD_WM8400_H
22#define __LINUX_MFD_WM8400_H
23
24#include <linux/regulator/machine.h>
25
26#define WM8400_LDO1 0
27#define WM8400_LDO2 1
28#define WM8400_LDO3 2
29#define WM8400_LDO4 3
30#define WM8400_DCDC1 4
31#define WM8400_DCDC2 5
32
33struct wm8400_platform_data {
34 int (*platform_init)(struct device *dev);
35};
36
37int wm8400_register_regulator(struct device *dev, int reg,
38 struct regulator_init_data *initdata);
39
40#endif
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index c4db5827963d..eb71b45fdf5a 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -131,6 +131,16 @@ struct usb_device_id {
131#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 131#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
132#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 132#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
133 133
134#define HID_ANY_ID (~0)
135
136struct hid_device_id {
137 __u16 bus;
138 __u32 vendor;
139 __u32 product;
140 kernel_ulong_t driver_data
141 __attribute__((aligned(sizeof(kernel_ulong_t))));
142};
143
134/* s390 CCW devices */ 144/* s390 CCW devices */
135struct ccw_device_id { 145struct ccw_device_id {
136 __u16 match_flags; /* which fields to match against */ 146 __u16 match_flags; /* which fields to match against */
@@ -274,7 +284,7 @@ struct pcmcia_device_id {
274/* Input */ 284/* Input */
275#define INPUT_DEVICE_ID_EV_MAX 0x1f 285#define INPUT_DEVICE_ID_EV_MAX 0x1f
276#define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71 286#define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71
277#define INPUT_DEVICE_ID_KEY_MAX 0x1ff 287#define INPUT_DEVICE_ID_KEY_MAX 0x2ff
278#define INPUT_DEVICE_ID_REL_MAX 0x0f 288#define INPUT_DEVICE_ID_REL_MAX 0x0f
279#define INPUT_DEVICE_ID_ABS_MAX 0x3f 289#define INPUT_DEVICE_ID_ABS_MAX 0x3f
280#define INPUT_DEVICE_ID_MSC_MAX 0x07 290#define INPUT_DEVICE_ID_MSC_MAX 0x07
@@ -388,5 +398,52 @@ struct i2c_device_id {
388 __attribute__((aligned(sizeof(kernel_ulong_t)))); 398 __attribute__((aligned(sizeof(kernel_ulong_t))));
389}; 399};
390 400
401/* dmi */
402enum dmi_field {
403 DMI_NONE,
404 DMI_BIOS_VENDOR,
405 DMI_BIOS_VERSION,
406 DMI_BIOS_DATE,
407 DMI_SYS_VENDOR,
408 DMI_PRODUCT_NAME,
409 DMI_PRODUCT_VERSION,
410 DMI_PRODUCT_SERIAL,
411 DMI_PRODUCT_UUID,
412 DMI_BOARD_VENDOR,
413 DMI_BOARD_NAME,
414 DMI_BOARD_VERSION,
415 DMI_BOARD_SERIAL,
416 DMI_BOARD_ASSET_TAG,
417 DMI_CHASSIS_VENDOR,
418 DMI_CHASSIS_TYPE,
419 DMI_CHASSIS_VERSION,
420 DMI_CHASSIS_SERIAL,
421 DMI_CHASSIS_ASSET_TAG,
422 DMI_STRING_MAX,
423};
424
425struct dmi_strmatch {
426 unsigned char slot;
427 char substr[79];
428};
429
430#ifndef __KERNEL__
431struct dmi_system_id {
432 kernel_ulong_t callback;
433 kernel_ulong_t ident;
434 struct dmi_strmatch matches[4];
435 kernel_ulong_t driver_data
436 __attribute__((aligned(sizeof(kernel_ulong_t))));
437};
438#else
439struct dmi_system_id {
440 int (*callback)(const struct dmi_system_id *);
441 const char *ident;
442 struct dmi_strmatch matches[4];
443 void *driver_data;
444};
445#endif
446
447#define DMI_MATCH(a, b) { a, b }
391 448
392#endif /* LINUX_MOD_DEVICETABLE_H */ 449#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 8b6113503863..5d2970cdce93 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -350,7 +350,6 @@ struct module
350 /* Reference counts */ 350 /* Reference counts */
351 struct module_ref ref[NR_CPUS]; 351 struct module_ref ref[NR_CPUS];
352#endif 352#endif
353
354}; 353};
355#ifndef MODULE_ARCH_INIT 354#ifndef MODULE_ARCH_INIT
356#define MODULE_ARCH_INIT {} 355#define MODULE_ARCH_INIT {}
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 30a1d63b6fb5..cab2a85e2ee8 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -5,8 +5,6 @@
5 * 5 *
6 * Author: Marco van Wieringen <mvw@planets.elm.net> 6 * Author: Marco van Wieringen <mvw@planets.elm.net>
7 * 7 *
8 * Version: $Id: mount.h,v 2.0 1996/11/17 16:48:14 mvw Exp mvw $
9 *
10 */ 8 */
11#ifndef _LINUX_MOUNT_H 9#ifndef _LINUX_MOUNT_H
12#define _LINUX_MOUNT_H 10#define _LINUX_MOUNT_H
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d3ea3de70a8a..64875859d654 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -11,7 +11,7 @@
11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 * Corey Minyard <wf-rch!minyard@relay.EU.net> 12 * Corey Minyard <wf-rch!minyard@relay.EU.net>
13 * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov> 13 * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov>
14 * Alan Cox, <Alan.Cox@linux.org> 14 * Alan Cox, <alan@lxorguk.ukuu.org.uk>
15 * Bjorn Ekwall. <bj0rn@blox.se> 15 * Bjorn Ekwall. <bj0rn@blox.se>
16 * Pekka Riikonen <priikone@poseidon.pspt.fi> 16 * Pekka Riikonen <priikone@poseidon.pspt.fi>
17 * 17 *
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 0d8424f76899..7d8e0455ccac 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -78,6 +78,9 @@ extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
78 int echo); 78 int echo);
79extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); 79extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
80 80
81extern void nfnl_lock(void);
82extern void nfnl_unlock(void);
83
81#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ 84#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
82 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) 85 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
83 86
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 78a5922a2f11..ac8d0233b05c 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -137,7 +137,7 @@ struct nfs_inode {
137 unsigned long attrtimeo_timestamp; 137 unsigned long attrtimeo_timestamp;
138 __u64 change_attr; /* v4 only */ 138 __u64 change_attr; /* v4 only */
139 139
140 unsigned long last_updated; 140 unsigned long attr_gencount;
141 /* "Generation counter" for the attribute cache. This is 141 /* "Generation counter" for the attribute cache. This is
142 * bumped whenever we update the metadata on the 142 * bumped whenever we update the metadata on the
143 * server. 143 * server.
@@ -200,11 +200,10 @@ struct nfs_inode {
200/* 200/*
201 * Bit offsets in flags field 201 * Bit offsets in flags field
202 */ 202 */
203#define NFS_INO_REVALIDATING (0) /* revalidating attrs */ 203#define NFS_INO_ADVISE_RDPLUS (0) /* advise readdirplus */
204#define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */ 204#define NFS_INO_STALE (1) /* possible stale inode */
205#define NFS_INO_STALE (2) /* possible stale inode */ 205#define NFS_INO_ACL_LRU_SET (2) /* Inode is on the LRU list */
206#define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */ 206#define NFS_INO_MOUNTPOINT (3) /* inode is remote mountpoint */
207#define NFS_INO_MOUNTPOINT (4) /* inode is remote mountpoint */
208 207
209static inline struct nfs_inode *NFS_I(const struct inode *inode) 208static inline struct nfs_inode *NFS_I(const struct inode *inode)
210{ 209{
@@ -345,15 +344,11 @@ extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ct
345extern void put_nfs_open_context(struct nfs_open_context *ctx); 344extern void put_nfs_open_context(struct nfs_open_context *ctx);
346extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 345extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
347extern u64 nfs_compat_user_ino64(u64 fileid); 346extern u64 nfs_compat_user_ino64(u64 fileid);
347extern void nfs_fattr_init(struct nfs_fattr *fattr);
348 348
349/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 349/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
350extern __be32 root_nfs_parse_addr(char *name); /*__init*/ 350extern __be32 root_nfs_parse_addr(char *name); /*__init*/
351 351extern unsigned long nfs_inc_attr_generation_counter(void);
352static inline void nfs_fattr_init(struct nfs_fattr *fattr)
353{
354 fattr->valid = 0;
355 fattr->time_start = jiffies;
356}
357 352
358/* 353/*
359 * linux/fs/nfs/file.c 354 * linux/fs/nfs/file.c
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index c9beacd16c00..4e477ae58699 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -119,7 +119,6 @@ struct nfs_server {
119 void (*destroy)(struct nfs_server *); 119 void (*destroy)(struct nfs_server *);
120 120
121 atomic_t active; /* Keep trace of any activity to this server */ 121 atomic_t active; /* Keep trace of any activity to this server */
122 wait_queue_head_t active_wq; /* Wait for any activity to stop */
123 122
124 /* mountd-related mount options */ 123 /* mountd-related mount options */
125 struct sockaddr_storage mountd_address; 124 struct sockaddr_storage mountd_address;
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h
index df7c6b7a7ebb..6549a06ac16e 100644
--- a/include/linux/nfs_mount.h
+++ b/include/linux/nfs_mount.h
@@ -65,4 +65,8 @@ struct nfs_mount_data {
65#define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ 65#define NFS_MOUNT_UNSHARED 0x8000 /* 5 */
66#define NFS_MOUNT_FLAGMASK 0xFFFF 66#define NFS_MOUNT_FLAGMASK 0xFFFF
67 67
68/* The following are for internal use only */
69#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000
70#define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000
71
68#endif 72#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 8c77c11224d1..c1c31acb8a2b 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -36,6 +36,7 @@ struct nfs_fattr {
36 __u32 nlink; 36 __u32 nlink;
37 __u32 uid; 37 __u32 uid;
38 __u32 gid; 38 __u32 gid;
39 dev_t rdev;
39 __u64 size; 40 __u64 size;
40 union { 41 union {
41 struct { 42 struct {
@@ -46,7 +47,6 @@ struct nfs_fattr {
46 __u64 used; 47 __u64 used;
47 } nfs3; 48 } nfs3;
48 } du; 49 } du;
49 dev_t rdev;
50 struct nfs_fsid fsid; 50 struct nfs_fsid fsid;
51 __u64 fileid; 51 __u64 fileid;
52 struct timespec atime; 52 struct timespec atime;
@@ -56,6 +56,7 @@ struct nfs_fattr {
56 __u64 change_attr; /* NFSv4 change attribute */ 56 __u64 change_attr; /* NFSv4 change attribute */
57 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ 57 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
58 unsigned long time_start; 58 unsigned long time_start;
59 unsigned long gencount;
59}; 60};
60 61
61#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ 62#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */
@@ -672,16 +673,16 @@ struct nfs4_rename_res {
672 struct nfs_fattr * new_fattr; 673 struct nfs_fattr * new_fattr;
673}; 674};
674 675
675#define NFS4_SETCLIENTID_NAMELEN (56) 676#define NFS4_SETCLIENTID_NAMELEN (127)
676struct nfs4_setclientid { 677struct nfs4_setclientid {
677 const nfs4_verifier * sc_verifier; 678 const nfs4_verifier * sc_verifier;
678 unsigned int sc_name_len; 679 unsigned int sc_name_len;
679 char sc_name[NFS4_SETCLIENTID_NAMELEN]; 680 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
680 u32 sc_prog; 681 u32 sc_prog;
681 unsigned int sc_netid_len; 682 unsigned int sc_netid_len;
682 char sc_netid[RPCBIND_MAXNETIDLEN]; 683 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
683 unsigned int sc_uaddr_len; 684 unsigned int sc_uaddr_len;
684 char sc_uaddr[RPCBIND_MAXUADDRLEN]; 685 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
685 u32 sc_cb_ident; 686 u32 sc_cb_ident;
686}; 687};
687 688
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 108f47e5fd95..21269405ffe2 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -38,6 +38,7 @@
38#define NFSD_MAY_LOCK 32 38#define NFSD_MAY_LOCK 32
39#define NFSD_MAY_OWNER_OVERRIDE 64 39#define NFSD_MAY_OWNER_OVERRIDE 64
40#define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ 40#define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/
41#define NFSD_MAY_BYPASS_GSS_ON_ROOT 256
41 42
42#define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) 43#define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE)
43#define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) 44#define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC)
@@ -125,7 +126,7 @@ int nfsd_truncate(struct svc_rqst *, struct svc_fh *,
125__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, 126__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *,
126 loff_t *, struct readdir_cd *, filldir_t); 127 loff_t *, struct readdir_cd *, filldir_t);
127__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, 128__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *,
128 struct kstatfs *); 129 struct kstatfs *, int access);
129 130
130int nfsd_notify_change(struct inode *, struct iattr *); 131int nfsd_notify_change(struct inode *, struct iattr *);
131__be32 nfsd_permission(struct svc_rqst *, struct svc_export *, 132__be32 nfsd_permission(struct svc_rqst *, struct svc_export *,
diff --git a/include/linux/of.h b/include/linux/of.h
index 79886ade070f..e2488f5e7cb2 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -71,5 +71,8 @@ extern int of_n_size_cells(struct device_node *np);
71extern const struct of_device_id *of_match_node( 71extern const struct of_device_id *of_match_node(
72 const struct of_device_id *matches, const struct device_node *node); 72 const struct of_device_id *matches, const struct device_node *node);
73extern int of_modalias_node(struct device_node *node, char *modalias, int len); 73extern int of_modalias_node(struct device_node *node, char *modalias, int len);
74extern int of_parse_phandles_with_args(struct device_node *np,
75 const char *list_name, const char *cells_name, int index,
76 struct device_node **out_node, const void **out_args);
74 77
75#endif /* _LINUX_OF_H */ 78#endif /* _LINUX_OF_H */
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 6a0d7cdb5774..e1f83c5065c5 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -1,5 +1,3 @@
1/* $Id: parport.h,v 1.1 1998/05/17 10:57:52 andrea Exp andrea $ */
2
3/* 1/*
4 * Any part of this program may be used in documents licensed under 2 * Any part of this program may be used in documents licensed under
5 * the GNU Free Documentation License, Version 1.1 or any later version 3 * the GNU Free Documentation License, Version 1.1 or any later version
diff --git a/include/linux/parser.h b/include/linux/parser.h
index 7dcd05075756..ea2281e726f6 100644
--- a/include/linux/parser.h
+++ b/include/linux/parser.h
@@ -25,7 +25,7 @@ typedef struct {
25 char *to; 25 char *to;
26} substring_t; 26} substring_t;
27 27
28int match_token(char *, match_table_t table, substring_t args[]); 28int match_token(char *, const match_table_t table, substring_t args[]);
29int match_int(substring_t *, int *result); 29int match_int(substring_t *, int *result);
30int match_octal(substring_t *, int *result); 30int match_octal(substring_t *, int *result);
31int match_hex(substring_t *, int *result); 31int match_hex(substring_t *, int *result);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index f63b5455801c..8edddc240e4f 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -587,6 +587,7 @@
587#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520 587#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520
588#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521 588#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521
589#define PCI_DEVICE_ID_MATROX_G400 0x0525 589#define PCI_DEVICE_ID_MATROX_G400 0x0525
590#define PCI_DEVICE_ID_MATROX_G200EV_PCI 0x0530
590#define PCI_DEVICE_ID_MATROX_G550 0x2527 591#define PCI_DEVICE_ID_MATROX_G550 0x2527
591#define PCI_DEVICE_ID_MATROX_VIA 0x4536 592#define PCI_DEVICE_ID_MATROX_VIA 0x4536
592 593
@@ -1533,7 +1534,9 @@
1533#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 1534#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430
1534#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 1535#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460
1535#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 1536#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480
1536#define PCI_DEVICE_ID_MARVELL_CAFE_SD 0x4101 1537#define PCI_DEVICE_ID_MARVELL_88ALP01_NAND 0x4100
1538#define PCI_DEVICE_ID_MARVELL_88ALP01_SD 0x4101
1539#define PCI_DEVICE_ID_MARVELL_88ALP01_CCIC 0x4102
1537 1540
1538#define PCI_VENDOR_ID_V3 0x11b0 1541#define PCI_VENDOR_ID_V3 0x11b0
1539#define PCI_DEVICE_ID_V3_V960 0x0001 1542#define PCI_DEVICE_ID_V3_V960 0x0001
diff --git a/include/linux/pfn.h b/include/linux/pfn.h
index bb01f8b92b56..7646637221f3 100644
--- a/include/linux/pfn.h
+++ b/include/linux/pfn.h
@@ -1,9 +1,13 @@
1#ifndef _LINUX_PFN_H_ 1#ifndef _LINUX_PFN_H_
2#define _LINUX_PFN_H_ 2#define _LINUX_PFN_H_
3 3
4#ifndef __ASSEMBLY__
5#include <linux/types.h>
6#endif
7
4#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) 8#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
5#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) 9#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
6#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) 10#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
7#define PFN_PHYS(x) ((x) << PAGE_SHIFT) 11#define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT)
8 12
9#endif 13#endif
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 1af82c4e17d4..d82fe825d62f 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -84,12 +84,6 @@ static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk)
84 return tsk->nsproxy->pid_ns; 84 return tsk->nsproxy->pid_ns;
85} 85}
86 86
87static inline struct task_struct *task_child_reaper(struct task_struct *tsk)
88{
89 BUG_ON(tsk != current);
90 return tsk->nsproxy->pid_ns->child_reaper;
91}
92
93void pidhash_init(void); 87void pidhash_init(void);
94void pidmap_init(void); 88void pidmap_init(void);
95 89
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 95ac21ab3a09..4b8cc6a32479 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -37,6 +37,8 @@ extern int platform_add_devices(struct platform_device **, int);
37 37
38extern struct platform_device *platform_device_register_simple(const char *, int id, 38extern struct platform_device *platform_device_register_simple(const char *, int id,
39 struct resource *, unsigned int); 39 struct resource *, unsigned int);
40extern struct platform_device *platform_device_register_data(struct device *,
41 const char *, int, const void *, size_t);
40 42
41extern struct platform_device *platform_device_alloc(const char *name, int id); 43extern struct platform_device *platform_device_alloc(const char *name, int id);
42extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); 44extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num);
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 4dcce54b6d76..42de4003c4ee 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -419,7 +419,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
419 419
420#define suspend_report_result(fn, ret) \ 420#define suspend_report_result(fn, ret) \
421 do { \ 421 do { \
422 __suspend_report_result(__FUNCTION__, fn, ret); \ 422 __suspend_report_result(__func__, fn, ret); \
423 } while (0) 423 } while (0)
424 424
425#else /* !CONFIG_PM_SLEEP */ 425#else /* !CONFIG_PM_SLEEP */
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index be764e514e35..53b70fd1d9a5 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -22,9 +22,11 @@ struct pnp_dev;
22 * Resource Management 22 * Resource Management
23 */ 23 */
24#ifdef CONFIG_PNP 24#ifdef CONFIG_PNP
25struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int); 25struct resource *pnp_get_resource(struct pnp_dev *dev, unsigned long type,
26 unsigned int num);
26#else 27#else
27static inline struct resource *pnp_get_resource(struct pnp_dev *dev, unsigned int type, unsigned int num) 28static inline struct resource *pnp_get_resource(struct pnp_dev *dev,
29 unsigned long type, unsigned int num)
28{ 30{
29 return NULL; 31 return NULL;
30} 32}
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index fb61850d1cfc..27d534f4470d 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -139,7 +139,6 @@ extern int proc_readdir(struct file *, void *, filldir_t);
139extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); 139extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *);
140 140
141extern const struct file_operations proc_kcore_operations; 141extern const struct file_operations proc_kcore_operations;
142extern const struct file_operations ppc_htab_operations;
143 142
144extern int pid_ns_prepare_proc(struct pid_namespace *ns); 143extern int pid_ns_prepare_proc(struct pid_namespace *ns);
145extern void pid_ns_release_proc(struct pid_namespace *ns); 144extern void pid_ns_release_proc(struct pid_namespace *ns);
diff --git a/include/linux/profile.h b/include/linux/profile.h
index 7e7087239af5..570045053ce9 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -35,7 +35,9 @@ enum profile_type {
35extern int prof_on __read_mostly; 35extern int prof_on __read_mostly;
36 36
37/* init basic kernel profiler */ 37/* init basic kernel profiler */
38void __init profile_init(void); 38int profile_init(void);
39int profile_setup(char *str);
40int create_proc_profile(void);
39void profile_tick(int type); 41void profile_tick(int type);
40 42
41/* 43/*
@@ -84,9 +86,9 @@ struct pt_regs;
84 86
85#define prof_on 0 87#define prof_on 0
86 88
87static inline void profile_init(void) 89static inline int profile_init(void)
88{ 90{
89 return; 91 return 0;
90} 92}
91 93
92static inline void profile_tick(int type) 94static inline void profile_tick(int type)
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 376a05048bc5..40401b554484 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -28,8 +28,6 @@
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE. 30 * SUCH DAMAGE.
31 *
32 * Version: $Id: quota.h,v 2.0 1996/11/17 16:48:14 mvw Exp mvw $
33 */ 31 */
34 32
35#ifndef _LINUX_QUOTA_ 33#ifndef _LINUX_QUOTA_
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index ca6b9b5c8d52..a558a4c1d35a 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -3,9 +3,6 @@
3 * macros expand to the right source-code. 3 * macros expand to the right source-code.
4 * 4 *
5 * Author: Marco van Wieringen <mvw@planets.elm.net> 5 * Author: Marco van Wieringen <mvw@planets.elm.net>
6 *
7 * Version: $Id: quotaops.h,v 1.2 1998/01/15 16:22:26 ecd Exp $
8 *
9 */ 6 */
10#ifndef _LINUX_QUOTAOPS_ 7#ifndef _LINUX_QUOTAOPS_
11#define _LINUX_QUOTAOPS_ 8#define _LINUX_QUOTAOPS_
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h
index 7e375111d007..f38b9c586afb 100644
--- a/include/linux/raid/linear.h
+++ b/include/linux/raid/linear.h
@@ -5,8 +5,8 @@
5 5
6struct dev_info { 6struct dev_info {
7 mdk_rdev_t *rdev; 7 mdk_rdev_t *rdev;
8 sector_t size; 8 sector_t num_sectors;
9 sector_t offset; 9 sector_t start_sector;
10}; 10};
11 11
12typedef struct dev_info dev_info_t; 12typedef struct dev_info dev_info_t;
@@ -15,9 +15,11 @@ struct linear_private_data
15{ 15{
16 struct linear_private_data *prev; /* earlier version */ 16 struct linear_private_data *prev; /* earlier version */
17 dev_info_t **hash_table; 17 dev_info_t **hash_table;
18 sector_t hash_spacing; 18 sector_t spacing;
19 sector_t array_sectors; 19 sector_t array_sectors;
20 int preshift; /* shift before dividing by hash_spacing */ 20 int sector_shift; /* shift before dividing
21 * by spacing
22 */
21 dev_info_t disks[0]; 23 dev_info_t disks[0];
22}; 24};
23 25
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index dc0e3fcb9f28..82bea14cae1a 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -19,27 +19,7 @@
19#define _MD_H 19#define _MD_H
20 20
21#include <linux/blkdev.h> 21#include <linux/blkdev.h>
22#include <linux/major.h>
23#include <linux/ioctl.h>
24#include <linux/types.h>
25#include <linux/bitops.h>
26#include <linux/module.h>
27#include <linux/hdreg.h>
28#include <linux/proc_fs.h>
29#include <linux/seq_file.h> 22#include <linux/seq_file.h>
30#include <linux/smp_lock.h>
31#include <linux/delay.h>
32#include <net/checksum.h>
33#include <linux/random.h>
34#include <linux/kernel_stat.h>
35#include <asm/io.h>
36#include <linux/completion.h>
37#include <linux/mempool.h>
38#include <linux/list.h>
39#include <linux/reboot.h>
40#include <linux/vmalloc.h>
41#include <linux/blkpg.h>
42#include <linux/bio.h>
43 23
44/* 24/*
45 * 'md_p.h' holds the 'physical' layout of RAID devices 25 * 'md_p.h' holds the 'physical' layout of RAID devices
@@ -74,19 +54,17 @@
74 54
75extern int mdp_major; 55extern int mdp_major;
76 56
77extern int register_md_personality (struct mdk_personality *p); 57extern int register_md_personality(struct mdk_personality *p);
78extern int unregister_md_personality (struct mdk_personality *p); 58extern int unregister_md_personality(struct mdk_personality *p);
79extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev), 59extern mdk_thread_t * md_register_thread(void (*run) (mddev_t *mddev),
80 mddev_t *mddev, const char *name); 60 mddev_t *mddev, const char *name);
81extern void md_unregister_thread (mdk_thread_t *thread); 61extern void md_unregister_thread(mdk_thread_t *thread);
82extern void md_wakeup_thread(mdk_thread_t *thread); 62extern void md_wakeup_thread(mdk_thread_t *thread);
83extern void md_check_recovery(mddev_t *mddev); 63extern void md_check_recovery(mddev_t *mddev);
84extern void md_write_start(mddev_t *mddev, struct bio *bi); 64extern void md_write_start(mddev_t *mddev, struct bio *bi);
85extern void md_write_end(mddev_t *mddev); 65extern void md_write_end(mddev_t *mddev);
86extern void md_handle_safemode(mddev_t *mddev);
87extern void md_done_sync(mddev_t *mddev, int blocks, int ok); 66extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
88extern void md_error (mddev_t *mddev, mdk_rdev_t *rdev); 67extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev);
89extern void md_unplug_mddev(mddev_t *mddev);
90 68
91extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, 69extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
92 sector_t sector, int size, struct page *page); 70 sector_t sector, int size, struct page *page);
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 1d712c7172a2..e37d80561985 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -18,8 +18,8 @@
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/regulator/consumer.h> 19#include <linux/regulator/consumer.h>
20 20
21struct regulator_constraints;
22struct regulator_dev; 21struct regulator_dev;
22struct regulator_init_data;
23 23
24/** 24/**
25 * struct regulator_ops - regulator operations. 25 * struct regulator_ops - regulator operations.
@@ -51,7 +51,7 @@ struct regulator_ops {
51 int output_uV, int load_uA); 51 int output_uV, int load_uA);
52 52
53 /* the operations below are for configuration of regulator state when 53 /* the operations below are for configuration of regulator state when
54 * it's parent PMIC enters a global STANBY/HIBERNATE state */ 54 * its parent PMIC enters a global STANDBY/HIBERNATE state */
55 55
56 /* set regulator suspend voltage */ 56 /* set regulator suspend voltage */
57 int (*set_suspend_voltage) (struct regulator_dev *, int uV); 57 int (*set_suspend_voltage) (struct regulator_dev *, int uV);
@@ -85,15 +85,17 @@ struct regulator_desc {
85 struct module *owner; 85 struct module *owner;
86}; 86};
87 87
88
89struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 88struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
90 void *reg_data); 89 struct device *dev, void *driver_data);
91void regulator_unregister(struct regulator_dev *rdev); 90void regulator_unregister(struct regulator_dev *rdev);
92 91
93int regulator_notifier_call_chain(struct regulator_dev *rdev, 92int regulator_notifier_call_chain(struct regulator_dev *rdev,
94 unsigned long event, void *data); 93 unsigned long event, void *data);
95 94
96void *rdev_get_drvdata(struct regulator_dev *rdev); 95void *rdev_get_drvdata(struct regulator_dev *rdev);
96struct device *rdev_get_dev(struct regulator_dev *rdev);
97int rdev_get_id(struct regulator_dev *rdev); 97int rdev_get_id(struct regulator_dev *rdev);
98 98
99void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
100
99#endif 101#endif
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 11e737dbfcf2..c6d69331a81e 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -89,15 +89,33 @@ struct regulation_constraints {
89 unsigned apply_uV:1; /* apply uV constraint iff min == max */ 89 unsigned apply_uV:1; /* apply uV constraint iff min == max */
90}; 90};
91 91
92int regulator_set_supply(const char *regulator, const char *regulator_supply); 92/**
93 * struct regulator_consumer_supply - supply -> device mapping
94 *
95 * This maps a supply name to a device.
96 */
97struct regulator_consumer_supply {
98 struct device *dev; /* consumer */
99 const char *supply; /* consumer supply - e.g. "vcc" */
100};
93 101
94const char *regulator_get_supply(const char *regulator); 102/**
103 * struct regulator_init_data - regulator platform initialisation data.
104 *
105 * Initialisation constraints, our supply and consumers supplies.
106 */
107struct regulator_init_data {
108 struct device *supply_regulator_dev; /* or NULL for LINE */
95 109
96int regulator_set_machine_constraints(const char *regulator, 110 struct regulation_constraints constraints;
97 struct regulation_constraints *constraints);
98 111
99int regulator_set_device_supply(const char *regulator, struct device *dev, 112 int num_consumer_supplies;
100 const char *supply); 113 struct regulator_consumer_supply *consumer_supplies;
114
115 /* optional regulator machine specific init */
116 int (*regulator_init)(void *driver_data);
117 void *driver_data; /* core does not touch this */
118};
101 119
102int regulator_suspend_prepare(suspend_state_t state); 120int regulator_suspend_prepare(suspend_state_t state);
103 121
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index e9963af16cda..bc5114d35e99 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -87,7 +87,7 @@ void reiserfs_warning(struct super_block *s, const char *fmt, ...);
87if( !( cond ) ) \ 87if( !( cond ) ) \
88 reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \ 88 reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \
89 __FILE__ ":%i:%s: " format "\n", \ 89 __FILE__ ":%i:%s: " format "\n", \
90 in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __FUNCTION__ , ##args ) 90 in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __func__ , ##args )
91 91
92#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) 92#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args)
93 93
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index 382bb7951166..f19b00b7d530 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -54,7 +54,7 @@ struct hrtimer_sleeper;
54#ifdef CONFIG_DEBUG_RT_MUTEXES 54#ifdef CONFIG_DEBUG_RT_MUTEXES
55# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \ 55# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
56 , .name = #mutexname, .file = __FILE__, .line = __LINE__ 56 , .name = #mutexname, .file = __FILE__, .line = __LINE__
57# define rt_mutex_init(mutex) __rt_mutex_init(mutex, __FUNCTION__) 57# define rt_mutex_init(mutex) __rt_mutex_init(mutex, __func__)
58 extern void rt_mutex_debug_task_free(struct task_struct *tsk); 58 extern void rt_mutex_debug_task_free(struct task_struct *tsk);
59#else 59#else
60# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) 60# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname)
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 66484d4a8459..2e4d58b26c06 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/errno.h> 9#include <linux/errno.h>
10#include <linux/types.h>
10#include <linux/list.h> 11#include <linux/list.h>
11#include <linux/cpumask.h> 12#include <linux/cpumask.h>
12 13
@@ -16,7 +17,8 @@ struct call_single_data {
16 struct list_head list; 17 struct list_head list;
17 void (*func) (void *info); 18 void (*func) (void *info);
18 void *info; 19 void *info;
19 unsigned int flags; 20 u16 flags;
21 u16 priv;
20}; 22};
21 23
22#ifdef CONFIG_SMP 24#ifdef CONFIG_SMP
diff --git a/include/linux/spi/orion_spi.h b/include/linux/spi/orion_spi.h
index b4d9fa6f797c..decf6d8c77b7 100644
--- a/include/linux/spi/orion_spi.h
+++ b/include/linux/spi/orion_spi.h
@@ -11,6 +11,7 @@
11 11
12struct orion_spi_info { 12struct orion_spi_info {
13 u32 tclk; /* no <linux/clk.h> support yet */ 13 u32 tclk; /* no <linux/clk.h> support yet */
14 u32 enable_clock_fix;
14}; 15};
15 16
16 17
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index e5bfe01ee305..6f0ee1b84a4f 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -104,6 +104,7 @@ struct rpc_create_args {
104 const struct rpc_timeout *timeout; 104 const struct rpc_timeout *timeout;
105 char *servername; 105 char *servername;
106 struct rpc_program *program; 106 struct rpc_program *program;
107 u32 prognumber; /* overrides program->number */
107 u32 version; 108 u32 version;
108 rpc_authflavor_t authflavor; 109 rpc_authflavor_t authflavor;
109 unsigned long flags; 110 unsigned long flags;
@@ -124,10 +125,10 @@ struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
124void rpc_shutdown_client(struct rpc_clnt *); 125void rpc_shutdown_client(struct rpc_clnt *);
125void rpc_release_client(struct rpc_clnt *); 126void rpc_release_client(struct rpc_clnt *);
126 127
127int rpcb_register(u32, u32, int, unsigned short, int *); 128int rpcb_register(u32, u32, int, unsigned short);
128int rpcb_v4_register(const u32 program, const u32 version, 129int rpcb_v4_register(const u32 program, const u32 version,
129 const struct sockaddr *address, 130 const struct sockaddr *address,
130 const char *netid, int *result); 131 const char *netid);
131int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int); 132int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int);
132void rpcb_getport_async(struct rpc_task *); 133void rpcb_getport_async(struct rpc_task *);
133 134
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index dc69068d94c7..3afe7fb403b2 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -66,6 +66,7 @@ struct svc_serv {
66 struct list_head sv_tempsocks; /* all temporary sockets */ 66 struct list_head sv_tempsocks; /* all temporary sockets */
67 int sv_tmpcnt; /* count of temporary sockets */ 67 int sv_tmpcnt; /* count of temporary sockets */
68 struct timer_list sv_temptimer; /* timer for aging temporary sockets */ 68 struct timer_list sv_temptimer; /* timer for aging temporary sockets */
69 sa_family_t sv_family; /* listener's address family */
69 70
70 char * sv_name; /* service name */ 71 char * sv_name; /* service name */
71 72
@@ -265,17 +266,17 @@ struct svc_rqst {
265/* 266/*
266 * Rigorous type checking on sockaddr type conversions 267 * Rigorous type checking on sockaddr type conversions
267 */ 268 */
268static inline struct sockaddr_in *svc_addr_in(struct svc_rqst *rqst) 269static inline struct sockaddr_in *svc_addr_in(const struct svc_rqst *rqst)
269{ 270{
270 return (struct sockaddr_in *) &rqst->rq_addr; 271 return (struct sockaddr_in *) &rqst->rq_addr;
271} 272}
272 273
273static inline struct sockaddr_in6 *svc_addr_in6(struct svc_rqst *rqst) 274static inline struct sockaddr_in6 *svc_addr_in6(const struct svc_rqst *rqst)
274{ 275{
275 return (struct sockaddr_in6 *) &rqst->rq_addr; 276 return (struct sockaddr_in6 *) &rqst->rq_addr;
276} 277}
277 278
278static inline struct sockaddr *svc_addr(struct svc_rqst *rqst) 279static inline struct sockaddr *svc_addr(const struct svc_rqst *rqst)
279{ 280{
280 return (struct sockaddr *) &rqst->rq_addr; 281 return (struct sockaddr *) &rqst->rq_addr;
281} 282}
@@ -381,18 +382,20 @@ struct svc_procedure {
381/* 382/*
382 * Function prototypes. 383 * Function prototypes.
383 */ 384 */
384struct svc_serv * svc_create(struct svc_program *, unsigned int, 385struct svc_serv *svc_create(struct svc_program *, unsigned int, sa_family_t,
385 void (*shutdown)(struct svc_serv*)); 386 void (*shutdown)(struct svc_serv *));
386struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, 387struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
387 struct svc_pool *pool); 388 struct svc_pool *pool);
388void svc_exit_thread(struct svc_rqst *); 389void svc_exit_thread(struct svc_rqst *);
389struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, 390struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
390 void (*shutdown)(struct svc_serv*), svc_thread_fn, 391 sa_family_t, void (*shutdown)(struct svc_serv *),
391 struct module *); 392 svc_thread_fn, struct module *);
392int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); 393int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
393void svc_destroy(struct svc_serv *); 394void svc_destroy(struct svc_serv *);
394int svc_process(struct svc_rqst *); 395int svc_process(struct svc_rqst *);
395int svc_register(struct svc_serv *, int, unsigned short); 396int svc_register(const struct svc_serv *, const unsigned short,
397 const unsigned short);
398
396void svc_wake_up(struct svc_serv *); 399void svc_wake_up(struct svc_serv *);
397void svc_reserve(struct svc_rqst *rqstp, int space); 400void svc_reserve(struct svc_rqst *rqstp, int space);
398struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); 401struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu);
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index dc05b54bd3a3..c14fe86dac59 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -72,6 +72,7 @@ extern atomic_t rdma_stat_sq_prod;
72 */ 72 */
73struct svc_rdma_op_ctxt { 73struct svc_rdma_op_ctxt {
74 struct svc_rdma_op_ctxt *read_hdr; 74 struct svc_rdma_op_ctxt *read_hdr;
75 struct svc_rdma_fastreg_mr *frmr;
75 int hdr_count; 76 int hdr_count;
76 struct xdr_buf arg; 77 struct xdr_buf arg;
77 struct list_head dto_q; 78 struct list_head dto_q;
@@ -103,16 +104,30 @@ struct svc_rdma_chunk_sge {
103 int start; /* sge no for this chunk */ 104 int start; /* sge no for this chunk */
104 int count; /* sge count for this chunk */ 105 int count; /* sge count for this chunk */
105}; 106};
107struct svc_rdma_fastreg_mr {
108 struct ib_mr *mr;
109 void *kva;
110 struct ib_fast_reg_page_list *page_list;
111 int page_list_len;
112 unsigned long access_flags;
113 unsigned long map_len;
114 enum dma_data_direction direction;
115 struct list_head frmr_list;
116};
106struct svc_rdma_req_map { 117struct svc_rdma_req_map {
118 struct svc_rdma_fastreg_mr *frmr;
107 unsigned long count; 119 unsigned long count;
108 union { 120 union {
109 struct kvec sge[RPCSVC_MAXPAGES]; 121 struct kvec sge[RPCSVC_MAXPAGES];
110 struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES]; 122 struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES];
111 }; 123 };
112}; 124};
113 125#define RDMACTXT_F_FAST_UNREG 1
114#define RDMACTXT_F_LAST_CTXT 2 126#define RDMACTXT_F_LAST_CTXT 2
115 127
128#define SVCRDMA_DEVCAP_FAST_REG 1 /* fast mr registration */
129#define SVCRDMA_DEVCAP_READ_W_INV 2 /* read w/ invalidate */
130
116struct svcxprt_rdma { 131struct svcxprt_rdma {
117 struct svc_xprt sc_xprt; /* SVC transport structure */ 132 struct svc_xprt sc_xprt; /* SVC transport structure */
118 struct rdma_cm_id *sc_cm_id; /* RDMA connection id */ 133 struct rdma_cm_id *sc_cm_id; /* RDMA connection id */
@@ -136,6 +151,11 @@ struct svcxprt_rdma {
136 struct ib_cq *sc_rq_cq; 151 struct ib_cq *sc_rq_cq;
137 struct ib_cq *sc_sq_cq; 152 struct ib_cq *sc_sq_cq;
138 struct ib_mr *sc_phys_mr; /* MR for server memory */ 153 struct ib_mr *sc_phys_mr; /* MR for server memory */
154 u32 sc_dev_caps; /* distilled device caps */
155 u32 sc_dma_lkey; /* local dma key */
156 unsigned int sc_frmr_pg_list_len;
157 struct list_head sc_frmr_q;
158 spinlock_t sc_frmr_q_lock;
139 159
140 spinlock_t sc_lock; /* transport lock */ 160 spinlock_t sc_lock; /* transport lock */
141 161
@@ -192,8 +212,13 @@ extern int svc_rdma_post_recv(struct svcxprt_rdma *);
192extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *); 212extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
193extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *); 213extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *);
194extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int); 214extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int);
215extern void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt);
195extern struct svc_rdma_req_map *svc_rdma_get_req_map(void); 216extern struct svc_rdma_req_map *svc_rdma_get_req_map(void);
196extern void svc_rdma_put_req_map(struct svc_rdma_req_map *); 217extern void svc_rdma_put_req_map(struct svc_rdma_req_map *);
218extern int svc_rdma_fastreg(struct svcxprt_rdma *, struct svc_rdma_fastreg_mr *);
219extern struct svc_rdma_fastreg_mr *svc_rdma_get_frmr(struct svcxprt_rdma *);
220extern void svc_rdma_put_frmr(struct svcxprt_rdma *,
221 struct svc_rdma_fastreg_mr *);
197extern void svc_sq_reap(struct svcxprt_rdma *); 222extern void svc_sq_reap(struct svcxprt_rdma *);
198extern void svc_rq_reap(struct svcxprt_rdma *); 223extern void svc_rq_reap(struct svcxprt_rdma *);
199extern struct svc_xprt_class svc_rdma_class; 224extern struct svc_xprt_class svc_rdma_class;
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 8cff696dedf5..483e10380aae 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -39,10 +39,7 @@ int svc_send(struct svc_rqst *);
39void svc_drop(struct svc_rqst *); 39void svc_drop(struct svc_rqst *);
40void svc_sock_update_bufs(struct svc_serv *serv); 40void svc_sock_update_bufs(struct svc_serv *serv);
41int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose); 41int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose);
42int svc_addsock(struct svc_serv *serv, 42int svc_addsock(struct svc_serv *serv, int fd, char *name_return);
43 int fd,
44 char *name_return,
45 int *proto);
46void svc_init_xprt_sock(void); 43void svc_init_xprt_sock(void);
47void svc_cleanup_xprt_sock(void); 44void svc_cleanup_xprt_sock(void);
48 45
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h
index 4de56b1d372b..54a379c9e8eb 100644
--- a/include/linux/sunrpc/xprtrdma.h
+++ b/include/linux/sunrpc/xprtrdma.h
@@ -66,9 +66,6 @@
66 66
67#define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */ 67#define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */
68 68
69#define RDMA_RESOLVE_TIMEOUT (5*HZ) /* TBD 5 seconds */
70#define RDMA_CONNECT_RETRY_MAX (2) /* retries if no listener backlog */
71
72/* memory registration strategies */ 69/* memory registration strategies */
73#define RPCRDMA_PERSISTENT_REGISTRATION (1) 70#define RPCRDMA_PERSISTENT_REGISTRATION (1)
74 71
@@ -78,6 +75,7 @@ enum rpcrdma_memreg {
78 RPCRDMA_MEMWINDOWS, 75 RPCRDMA_MEMWINDOWS,
79 RPCRDMA_MEMWINDOWS_ASYNC, 76 RPCRDMA_MEMWINDOWS_ASYNC,
80 RPCRDMA_MTHCAFMR, 77 RPCRDMA_MTHCAFMR,
78 RPCRDMA_FRMR,
81 RPCRDMA_ALLPHYSICAL, 79 RPCRDMA_ALLPHYSICAL,
82 RPCRDMA_LAST 80 RPCRDMA_LAST
83}; 81};
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
new file mode 100644
index 000000000000..b18ec5533e8c
--- /dev/null
+++ b/include/linux/swiotlb.h
@@ -0,0 +1,83 @@
1#ifndef __LINUX_SWIOTLB_H
2#define __LINUX_SWIOTLB_H
3
4#include <linux/types.h>
5
6struct device;
7struct dma_attrs;
8struct scatterlist;
9
10extern void
11swiotlb_init(void);
12
13extern void
14*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
15 dma_addr_t *dma_handle, gfp_t flags);
16
17extern void
18swiotlb_free_coherent(struct device *hwdev, size_t size,
19 void *vaddr, dma_addr_t dma_handle);
20
21extern dma_addr_t
22swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, int dir);
23
24extern void
25swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
26 size_t size, int dir);
27
28extern dma_addr_t
29swiotlb_map_single_attrs(struct device *hwdev, void *ptr, size_t size,
30 int dir, struct dma_attrs *attrs);
31
32extern void
33swiotlb_unmap_single_attrs(struct device *hwdev, dma_addr_t dev_addr,
34 size_t size, int dir, struct dma_attrs *attrs);
35
36extern int
37swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
38 int direction);
39
40extern void
41swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
42 int direction);
43
44extern int
45swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
46 int dir, struct dma_attrs *attrs);
47
48extern void
49swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
50 int nelems, int dir, struct dma_attrs *attrs);
51
52extern void
53swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
54 size_t size, int dir);
55
56extern void
57swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
58 int nelems, int dir);
59
60extern void
61swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr,
62 size_t size, int dir);
63
64extern void
65swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
66 int nelems, int dir);
67
68extern void
69swiotlb_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
70 unsigned long offset, size_t size, int dir);
71
72extern void
73swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr,
74 unsigned long offset, size_t size,
75 int dir);
76
77extern int
78swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
79
80extern int
81swiotlb_dma_supported(struct device *hwdev, u64 mask);
82
83#endif /* __LINUX_SWIOTLB_H */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index d0437f36921f..39d471d1163b 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -972,7 +972,7 @@ extern int sysctl_perm(struct ctl_table_root *root,
972 972
973typedef struct ctl_table ctl_table; 973typedef struct ctl_table ctl_table;
974 974
975typedef int ctl_handler (struct ctl_table *table, int __user *name, int nlen, 975typedef int ctl_handler (struct ctl_table *table,
976 void __user *oldval, size_t __user *oldlenp, 976 void __user *oldval, size_t __user *oldlenp,
977 void __user *newval, size_t newlen); 977 void __user *newval, size_t newlen);
978 978
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 37fa24152bd8..b330e289d71f 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -78,6 +78,8 @@ struct sysfs_ops {
78 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 78 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t);
79}; 79};
80 80
81struct sysfs_dirent;
82
81#ifdef CONFIG_SYSFS 83#ifdef CONFIG_SYSFS
82 84
83int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), 85int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
@@ -117,9 +119,14 @@ int sysfs_add_file_to_group(struct kobject *kobj,
117void sysfs_remove_file_from_group(struct kobject *kobj, 119void sysfs_remove_file_from_group(struct kobject *kobj,
118 const struct attribute *attr, const char *group); 120 const struct attribute *attr, const char *group);
119 121
120void sysfs_notify(struct kobject *kobj, char *dir, char *attr); 122void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
121 123void sysfs_notify_dirent(struct sysfs_dirent *sd);
122extern int __must_check sysfs_init(void); 124struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
125 const unsigned char *name);
126struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
127void sysfs_put(struct sysfs_dirent *sd);
128void sysfs_printk_last_file(void);
129int __must_check sysfs_init(void);
123 130
124#else /* CONFIG_SYSFS */ 131#else /* CONFIG_SYSFS */
125 132
@@ -222,7 +229,24 @@ static inline void sysfs_remove_file_from_group(struct kobject *kobj,
222{ 229{
223} 230}
224 231
225static inline void sysfs_notify(struct kobject *kobj, char *dir, char *attr) 232static inline void sysfs_notify(struct kobject *kobj, const char *dir,
233 const char *attr)
234{
235}
236static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
237{
238}
239static inline
240struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
241 const unsigned char *name)
242{
243 return NULL;
244}
245static inline struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd)
246{
247 return NULL;
248}
249static inline void sysfs_put(struct sysfs_dirent *sd)
226{ 250{
227} 251}
228 252
@@ -231,6 +255,10 @@ static inline int __must_check sysfs_init(void)
231 return 0; 255 return 0;
232} 256}
233 257
258static inline void sysfs_printk_last_file(void)
259{
260}
261
234#endif /* CONFIG_SYSFS */ 262#endif /* CONFIG_SYSFS */
235 263
236#endif /* _SYSFS_H_ */ 264#endif /* _SYSFS_H_ */
diff --git a/include/linux/task_io_accounting.h b/include/linux/task_io_accounting.h
index 5e88afc9a2fb..bdf855c2856f 100644
--- a/include/linux/task_io_accounting.h
+++ b/include/linux/task_io_accounting.h
@@ -5,7 +5,7 @@
5 * Don't include this header file directly - it is designed to be dragged in via 5 * Don't include this header file directly - it is designed to be dragged in via
6 * sched.h. 6 * sched.h.
7 * 7 *
8 * Blame akpm@osdl.org for all this. 8 * Blame Andrew Morton for all this.
9 */ 9 */
10 10
11struct task_io_accounting { 11struct task_io_accounting {
diff --git a/include/linux/telephony.h b/include/linux/telephony.h
index 0d0cf2a1e7bc..5b2b6261f193 100644
--- a/include/linux/telephony.h
+++ b/include/linux/telephony.h
@@ -28,10 +28,6 @@
28 * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION 28 * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION
29 * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 29 * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
30 * 30 *
31 * Version: $Revision: 4.2 $
32 *
33 * $Id: telephony.h,v 4.2 2001/08/06 07:09:43 craigs Exp $
34 *
35 *****************************************************************************/ 31 *****************************************************************************/
36 32
37#ifndef TELEPHONY_H 33#ifndef TELEPHONY_H
diff --git a/include/linux/time.h b/include/linux/time.h
index e15206a7e82e..51e883df0fa5 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -29,6 +29,8 @@ struct timezone {
29 29
30#ifdef __KERNEL__ 30#ifdef __KERNEL__
31 31
32extern struct timezone sys_tz;
33
32/* Parameters used to convert the timespec values: */ 34/* Parameters used to convert the timespec values: */
33#define MSEC_PER_SEC 1000L 35#define MSEC_PER_SEC 1000L
34#define USEC_PER_MSEC 1000L 36#define USEC_PER_MSEC 1000L
diff --git a/include/linux/types.h b/include/linux/types.h
index d4a9ce6e2760..f24f7beb47df 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -191,12 +191,14 @@ typedef __u32 __bitwise __wsum;
191#ifdef __KERNEL__ 191#ifdef __KERNEL__
192typedef unsigned __bitwise__ gfp_t; 192typedef unsigned __bitwise__ gfp_t;
193 193
194#ifdef CONFIG_RESOURCES_64BIT 194#ifdef CONFIG_PHYS_ADDR_T_64BIT
195typedef u64 resource_size_t; 195typedef u64 phys_addr_t;
196#else 196#else
197typedef u32 resource_size_t; 197typedef u32 phys_addr_t;
198#endif 198#endif
199 199
200typedef phys_addr_t resource_size_t;
201
200struct ustat { 202struct ustat {
201 __kernel_daddr_t f_tfree; 203 __kernel_daddr_t f_tfree;
202 __kernel_ino_t f_tinode; 204 __kernel_ino_t f_tinode;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 94ac74aba6b6..8fa973bede5e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1135,6 +1135,7 @@ struct usb_anchor {
1135 struct list_head urb_list; 1135 struct list_head urb_list;
1136 wait_queue_head_t wait; 1136 wait_queue_head_t wait;
1137 spinlock_t lock; 1137 spinlock_t lock;
1138 unsigned int poisoned:1;
1138}; 1139};
1139 1140
1140static inline void init_usb_anchor(struct usb_anchor *anchor) 1141static inline void init_usb_anchor(struct usb_anchor *anchor)
@@ -1459,12 +1460,18 @@ extern struct urb *usb_get_urb(struct urb *urb);
1459extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags); 1460extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags);
1460extern int usb_unlink_urb(struct urb *urb); 1461extern int usb_unlink_urb(struct urb *urb);
1461extern void usb_kill_urb(struct urb *urb); 1462extern void usb_kill_urb(struct urb *urb);
1463extern void usb_poison_urb(struct urb *urb);
1464extern void usb_unpoison_urb(struct urb *urb);
1462extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1465extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1466extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1463extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); 1467extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
1464extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1468extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1465extern void usb_unanchor_urb(struct urb *urb); 1469extern void usb_unanchor_urb(struct urb *urb);
1466extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, 1470extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
1467 unsigned int timeout); 1471 unsigned int timeout);
1472extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor);
1473extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
1474extern int usb_anchor_empty(struct usb_anchor *anchor);
1468 1475
1469/** 1476/**
1470 * usb_urb_dir_in - check if an URB describes an IN transfer 1477 * usb_urb_dir_in - check if an URB describes an IN transfer
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
index 42e84fc315e3..54c446309a2a 100644
--- a/include/linux/usb/Kbuild
+++ b/include/linux/usb/Kbuild
@@ -4,4 +4,5 @@ header-y += ch9.h
4header-y += gadgetfs.h 4header-y += gadgetfs.h
5header-y += midi.h 5header-y += midi.h
6header-y += g_printer.h 6header-y += g_printer.h
7 7header-y += tmc.h
8header-y += vstusb.h
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index ca228bb94218..18a729343ffa 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -160,6 +160,15 @@ struct usb_cdc_mdlm_detail_desc {
160 __u8 bDetailData[0]; 160 __u8 bDetailData[0];
161} __attribute__ ((packed)); 161} __attribute__ ((packed));
162 162
163/* "OBEX Control Model Functional Descriptor" */
164struct usb_cdc_obex_desc {
165 __u8 bLength;
166 __u8 bDescriptorType;
167 __u8 bDescriptorSubType;
168
169 __le16 bcdVersion;
170} __attribute__ ((packed));
171
163/*-------------------------------------------------------------------------*/ 172/*-------------------------------------------------------------------------*/
164 173
165/* 174/*
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index c932390c6da0..935c380ffe47 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -130,6 +130,9 @@ struct usb_function {
130 130
131int usb_add_function(struct usb_configuration *, struct usb_function *); 131int usb_add_function(struct usb_configuration *, struct usb_function *);
132 132
133int usb_function_deactivate(struct usb_function *);
134int usb_function_activate(struct usb_function *);
135
133int usb_interface_id(struct usb_configuration *, struct usb_function *); 136int usb_interface_id(struct usb_configuration *, struct usb_function *);
134 137
135/** 138/**
@@ -316,9 +319,13 @@ struct usb_composite_dev {
316 struct usb_composite_driver *driver; 319 struct usb_composite_driver *driver;
317 u8 next_string_id; 320 u8 next_string_id;
318 321
319 spinlock_t lock; 322 /* the gadget driver won't enable the data pullup
323 * while the deactivation count is nonzero.
324 */
325 unsigned deactivations;
320 326
321 /* REVISIT use and existence of lock ... */ 327 /* protects at least deactivation count */
328 spinlock_t lock;
322}; 329};
323 330
324extern int usb_string_id(struct usb_composite_dev *c); 331extern int usb_string_id(struct usb_composite_dev *c);
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 655341d0f534..0b8617a9176d 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -192,7 +192,7 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
192 * The driver.owner field should be set to the module owner of this driver. 192 * The driver.owner field should be set to the module owner of this driver.
193 * The driver.name field should be set to the name of this driver (remember 193 * The driver.name field should be set to the name of this driver (remember
194 * it will show up in sysfs, so it needs to be short and to the point. 194 * it will show up in sysfs, so it needs to be short and to the point.
195 * Useing the module name is a good idea.) 195 * Using the module name is a good idea.)
196 */ 196 */
197struct usb_serial_driver { 197struct usb_serial_driver {
198 const char *description; 198 const char *description;
diff --git a/include/linux/usb/tmc.h b/include/linux/usb/tmc.h
new file mode 100644
index 000000000000..c045ae12556c
--- /dev/null
+++ b/include/linux/usb/tmc.h
@@ -0,0 +1,43 @@
1/*
2 * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany
3 * Copyright (C) 2008 Novell, Inc.
4 * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de>
5 *
6 * This file holds USB constants defined by the USB Device Class
7 * Definition for Test and Measurement devices published by the USB-IF.
8 *
9 * It also has the ioctl definitions for the usbtmc kernel driver that
10 * userspace needs to know about.
11 */
12
13#ifndef __LINUX_USB_TMC_H
14#define __LINUX_USB_TMC_H
15
16/* USB TMC status values */
17#define USBTMC_STATUS_SUCCESS 0x01
18#define USBTMC_STATUS_PENDING 0x02
19#define USBTMC_STATUS_FAILED 0x80
20#define USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS 0x81
21#define USBTMC_STATUS_SPLIT_NOT_IN_PROGRESS 0x82
22#define USBTMC_STATUS_SPLIT_IN_PROGRESS 0x83
23
24/* USB TMC requests values */
25#define USBTMC_REQUEST_INITIATE_ABORT_BULK_OUT 1
26#define USBTMC_REQUEST_CHECK_ABORT_BULK_OUT_STATUS 2
27#define USBTMC_REQUEST_INITIATE_ABORT_BULK_IN 3
28#define USBTMC_REQUEST_CHECK_ABORT_BULK_IN_STATUS 4
29#define USBTMC_REQUEST_INITIATE_CLEAR 5
30#define USBTMC_REQUEST_CHECK_CLEAR_STATUS 6
31#define USBTMC_REQUEST_GET_CAPABILITIES 7
32#define USBTMC_REQUEST_INDICATOR_PULSE 64
33
34/* Request values for USBTMC driver's ioctl entry point */
35#define USBTMC_IOC_NR 91
36#define USBTMC_IOCTL_INDICATOR_PULSE _IO(USBTMC_IOC_NR, 1)
37#define USBTMC_IOCTL_CLEAR _IO(USBTMC_IOC_NR, 2)
38#define USBTMC_IOCTL_ABORT_BULK_OUT _IO(USBTMC_IOC_NR, 3)
39#define USBTMC_IOCTL_ABORT_BULK_IN _IO(USBTMC_IOC_NR, 4)
40#define USBTMC_IOCTL_CLEAR_OUT_HALT _IO(USBTMC_IOC_NR, 6)
41#define USBTMC_IOCTL_CLEAR_IN_HALT _IO(USBTMC_IOC_NR, 7)
42
43#endif
diff --git a/include/linux/usb/vstusb.h b/include/linux/usb/vstusb.h
new file mode 100644
index 000000000000..1cfac67191ff
--- /dev/null
+++ b/include/linux/usb/vstusb.h
@@ -0,0 +1,71 @@
1/*****************************************************************************
2 * File: drivers/usb/misc/vstusb.h
3 *
4 * Purpose: Support for the bulk USB Vernier Spectrophotometers
5 *
6 * Author: EQware Engineering, Inc.
7 * Oregon City, OR, USA 97045
8 *
9 * Copyright: 2007, 2008
10 * Vernier Software & Technology
11 * Beaverton, OR, USA 97005
12 *
13 * Web: www.vernier.com
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 *
19 *****************************************************************************/
20/*****************************************************************************
21 *
22 * The vstusb module is a standard usb 'client' driver running on top of the
23 * standard usb host controller stack.
24 *
25 * In general, vstusb supports standard bulk usb pipes. It supports multiple
26 * devices and multiple pipes per device.
27 *
28 * The vstusb driver supports two interfaces:
29 * 1 - ioctl SEND_PIPE/RECV_PIPE - a general bulk write/read msg
30 * interface to any pipe with timeout support;
31 * 2 - standard read/write with ioctl config - offers standard read/write
32 * interface with ioctl configured pipes and timeouts.
33 *
34 * Both interfaces can be signal from other process and will abort its i/o
35 * operation.
36 *
37 * A timeout of 0 means NO timeout. The user can still terminate the read via
38 * signal.
39 *
40 * If using multiple threads with this driver, the user should ensure that
41 * any reads, writes, or ioctls are complete before closing the device.
42 * Changing read/write timeouts or pipes takes effect on next read/write.
43 *
44 *****************************************************************************/
45
46struct vstusb_args {
47 union {
48 /* this struct is used for IOCTL_VSTUSB_SEND_PIPE, *
49 * IOCTL_VSTUSB_RECV_PIPE, and read()/write() fops */
50 struct {
51 void __user *buffer;
52 size_t count;
53 unsigned int timeout_ms;
54 int pipe;
55 };
56
57 /* this one is used for IOCTL_VSTUSB_CONFIG_RW */
58 struct {
59 int rd_pipe;
60 int rd_timeout_ms;
61 int wr_pipe;
62 int wr_timeout_ms;
63 };
64 };
65};
66
67#define VST_IOC_MAGIC 'L'
68#define VST_IOC_FIRST 0x20
69#define IOCTL_VSTUSB_SEND_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST)
70#define IOCTL_VSTUSB_RECV_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 1)
71#define IOCTL_VSTUSB_CONFIG_RW _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 2)
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 303d93ffd6b2..d4b03034ee73 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -910,6 +910,8 @@ enum v4l2_mpeg_audio_encoding {
910 V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, 910 V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
911 V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, 911 V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
912 V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, 912 V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
913 V4L2_MPEG_AUDIO_ENCODING_AAC = 3,
914 V4L2_MPEG_AUDIO_ENCODING_AC3 = 4,
913}; 915};
914#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) 916#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
915enum v4l2_mpeg_audio_l1_bitrate { 917enum v4l2_mpeg_audio_l1_bitrate {
@@ -988,12 +990,36 @@ enum v4l2_mpeg_audio_crc {
988 V4L2_MPEG_AUDIO_CRC_CRC16 = 1, 990 V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
989}; 991};
990#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) 992#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
993#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110)
994#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111)
995enum v4l2_mpeg_audio_ac3_bitrate {
996 V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0,
997 V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1,
998 V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2,
999 V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3,
1000 V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4,
1001 V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5,
1002 V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6,
1003 V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7,
1004 V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8,
1005 V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9,
1006 V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10,
1007 V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11,
1008 V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12,
1009 V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13,
1010 V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14,
1011 V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15,
1012 V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16,
1013 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
1014 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
1015};
991 1016
992/* MPEG video */ 1017/* MPEG video */
993#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) 1018#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
994enum v4l2_mpeg_video_encoding { 1019enum v4l2_mpeg_video_encoding {
995 V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, 1020 V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
996 V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, 1021 V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
1022 V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2,
997}; 1023};
998#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) 1024#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
999enum v4l2_mpeg_video_aspect { 1025enum v4l2_mpeg_video_aspect {
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 0081147a9fe8..ef609f842fac 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -108,15 +108,6 @@ static inline int waitqueue_active(wait_queue_head_t *q)
108 return !list_empty(&q->task_list); 108 return !list_empty(&q->task_list);
109} 109}
110 110
111/*
112 * Used to distinguish between sync and async io wait context:
113 * sync i/o typically specifies a NULL wait queue entry or a wait
114 * queue entry bound to a task (current task) to wake up.
115 * aio specifies a wait queue entry with an async notification
116 * callback routine, not associated with any task.
117 */
118#define is_sync_wait(wait) (!(wait) || ((wait)->private))
119
120extern void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); 111extern void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait);
121extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait); 112extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait);
122extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); 113extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait);
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 12b15c561a1f..e585657e9831 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -63,7 +63,15 @@ struct writeback_control {
63 unsigned for_writepages:1; /* This is a writepages() call */ 63 unsigned for_writepages:1; /* This is a writepages() call */
64 unsigned range_cyclic:1; /* range_start is cyclic */ 64 unsigned range_cyclic:1; /* range_start is cyclic */
65 unsigned more_io:1; /* more io to be dispatched */ 65 unsigned more_io:1; /* more io to be dispatched */
66 unsigned range_cont:1; 66 /*
67 * write_cache_pages() won't update wbc->nr_to_write and
68 * mapping->writeback_index if no_nrwrite_index_update
69 * is set. write_cache_pages() may write more than we
70 * requested and we want to make sure nr_to_write and
71 * writeback_index are updated in a consistent manner
72 * so we use a single control to update them
73 */
74 unsigned no_nrwrite_index_update:1;
67}; 75};
68 76
69/* 77/*
diff --git a/include/math-emu/op-2.h b/include/math-emu/op-2.h
index e193fb08fd55..4f26ecc1411b 100644
--- a/include/math-emu/op-2.h
+++ b/include/math-emu/op-2.h
@@ -25,7 +25,7 @@
25#ifndef __MATH_EMU_OP_2_H__ 25#ifndef __MATH_EMU_OP_2_H__
26#define __MATH_EMU_OP_2_H__ 26#define __MATH_EMU_OP_2_H__
27 27
28#define _FP_FRAC_DECL_2(X) _FP_W_TYPE X##_f0, X##_f1 28#define _FP_FRAC_DECL_2(X) _FP_W_TYPE X##_f0 = 0, X##_f1 = 0
29#define _FP_FRAC_COPY_2(D,S) (D##_f0 = S##_f0, D##_f1 = S##_f1) 29#define _FP_FRAC_COPY_2(D,S) (D##_f0 = S##_f0, D##_f1 = S##_f1)
30#define _FP_FRAC_SET_2(X,I) __FP_FRAC_SET_2(X, I) 30#define _FP_FRAC_SET_2(X,I) __FP_FRAC_SET_2(X, I)
31#define _FP_FRAC_HIGH_2(X) (X##_f1) 31#define _FP_FRAC_HIGH_2(X) (X##_f1)
diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h
index bb46e7645d53..cc1ec396f8d6 100644
--- a/include/math-emu/op-common.h
+++ b/include/math-emu/op-common.h
@@ -73,7 +73,7 @@ do { \
73 X##_c = FP_CLS_NAN; \ 73 X##_c = FP_CLS_NAN; \
74 /* Check for signaling NaN */ \ 74 /* Check for signaling NaN */ \
75 if (!(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \ 75 if (!(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \
76 FP_SET_EXCEPTION(FP_EX_INVALID); \ 76 FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_SNAN); \
77 } \ 77 } \
78 break; \ 78 break; \
79 } \ 79 } \
@@ -324,7 +324,7 @@ do { \
324 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \ 324 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
325 R##_s = _FP_NANSIGN_##fs; \ 325 R##_s = _FP_NANSIGN_##fs; \
326 R##_c = FP_CLS_NAN; \ 326 R##_c = FP_CLS_NAN; \
327 FP_SET_EXCEPTION(FP_EX_INVALID); \ 327 FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_ISI); \
328 break; \ 328 break; \
329 } \ 329 } \
330 /* FALLTHRU */ \ 330 /* FALLTHRU */ \
@@ -431,7 +431,7 @@ do { \
431 R##_s = _FP_NANSIGN_##fs; \ 431 R##_s = _FP_NANSIGN_##fs; \
432 R##_c = FP_CLS_NAN; \ 432 R##_c = FP_CLS_NAN; \
433 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \ 433 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
434 FP_SET_EXCEPTION(FP_EX_INVALID); \ 434 FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_IMZ);\
435 break; \ 435 break; \
436 \ 436 \
437 default: \ 437 default: \
@@ -490,11 +490,15 @@ do { \
490 break; \ 490 break; \
491 \ 491 \
492 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \ 492 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
493 R##_s = _FP_NANSIGN_##fs; \
494 R##_c = FP_CLS_NAN; \
495 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
496 FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_IDI);\
493 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \ 497 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
494 R##_s = _FP_NANSIGN_##fs; \ 498 R##_s = _FP_NANSIGN_##fs; \
495 R##_c = FP_CLS_NAN; \ 499 R##_c = FP_CLS_NAN; \
496 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \ 500 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
497 FP_SET_EXCEPTION(FP_EX_INVALID); \ 501 FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_ZDZ);\
498 break; \ 502 break; \
499 \ 503 \
500 default: \ 504 default: \
diff --git a/include/math-emu/soft-fp.h b/include/math-emu/soft-fp.h
index a6f873b45f98..3f284bc03180 100644
--- a/include/math-emu/soft-fp.h
+++ b/include/math-emu/soft-fp.h
@@ -51,6 +51,25 @@
51#ifndef FP_EX_INVALID 51#ifndef FP_EX_INVALID
52#define FP_EX_INVALID 0 52#define FP_EX_INVALID 0
53#endif 53#endif
54#ifndef FP_EX_INVALID_SNAN
55#define FP_EX_INVALID_SNAN 0
56#endif
57/* inf - inf */
58#ifndef FP_EX_INVALID_ISI
59#define FP_EX_INVALID_ISI 0
60#endif
61/* inf / inf */
62#ifndef FP_EX_INVALID_IDI
63#define FP_EX_INVALID_IDI 0
64#endif
65/* 0 / 0 */
66#ifndef FP_EX_INVALID_ZDZ
67#define FP_EX_INVALID_ZDZ 0
68#endif
69/* inf * 0 */
70#ifndef FP_EX_INVALID_IMZ
71#define FP_EX_INVALID_IMZ 0
72#endif
54#ifndef FP_EX_OVERFLOW 73#ifndef FP_EX_OVERFLOW
55#define FP_EX_OVERFLOW 0 74#define FP_EX_OVERFLOW 0
56#endif 75#endif
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index b8e8aa91905a..38f2d93c3957 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -25,6 +25,7 @@
25 25
26#include <linux/input.h> 26#include <linux/input.h>
27#include <linux/workqueue.h> 27#include <linux/workqueue.h>
28#include <linux/interrupt.h>
28 29
29#define IR_TYPE_RC5 1 30#define IR_TYPE_RC5 1
30#define IR_TYPE_PD 2 /* Pulse distance encoded IR */ 31#define IR_TYPE_PD 2 /* Pulse distance encoded IR */
@@ -85,6 +86,10 @@ struct card_ir {
85 u32 code; /* raw code under construction */ 86 u32 code; /* raw code under construction */
86 struct timeval base_time; /* time of last seen code */ 87 struct timeval base_time; /* time of last seen code */
87 int active; /* building raw code */ 88 int active; /* building raw code */
89
90 /* NEC decoding */
91 u32 nec_gpio;
92 struct tasklet_struct tlet;
88}; 93};
89 94
90void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, 95void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
@@ -105,6 +110,7 @@ void ir_rc5_timer_keyup(unsigned long data);
105extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; 110extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE];
106extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE]; 111extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE];
107extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE]; 112extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE];
113extern IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE];
108extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE]; 114extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE];
109extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE]; 115extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE];
110extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE]; 116extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE];
@@ -139,6 +145,7 @@ extern IR_KEYTAB_TYPE ir_codes_proteus_2309[IR_KEYTAB_SIZE];
139extern IR_KEYTAB_TYPE ir_codes_budget_ci_old[IR_KEYTAB_SIZE]; 145extern IR_KEYTAB_TYPE ir_codes_budget_ci_old[IR_KEYTAB_SIZE];
140extern IR_KEYTAB_TYPE ir_codes_asus_pc39[IR_KEYTAB_SIZE]; 146extern IR_KEYTAB_TYPE ir_codes_asus_pc39[IR_KEYTAB_SIZE];
141extern IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE]; 147extern IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE];
148extern IR_KEYTAB_TYPE ir_codes_encore_enltv2[IR_KEYTAB_SIZE];
142extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE]; 149extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE];
143extern IR_KEYTAB_TYPE ir_codes_fusionhdtv_mce[IR_KEYTAB_SIZE]; 150extern IR_KEYTAB_TYPE ir_codes_fusionhdtv_mce[IR_KEYTAB_SIZE];
144extern IR_KEYTAB_TYPE ir_codes_behold[IR_KEYTAB_SIZE]; 151extern IR_KEYTAB_TYPE ir_codes_behold[IR_KEYTAB_SIZE];
@@ -147,7 +154,9 @@ extern IR_KEYTAB_TYPE ir_codes_pinnacle_pctv_hd[IR_KEYTAB_SIZE];
147extern IR_KEYTAB_TYPE ir_codes_genius_tvgo_a11mce[IR_KEYTAB_SIZE]; 154extern IR_KEYTAB_TYPE ir_codes_genius_tvgo_a11mce[IR_KEYTAB_SIZE];
148extern IR_KEYTAB_TYPE ir_codes_powercolor_real_angel[IR_KEYTAB_SIZE]; 155extern IR_KEYTAB_TYPE ir_codes_powercolor_real_angel[IR_KEYTAB_SIZE];
149extern IR_KEYTAB_TYPE ir_codes_avermedia_a16d[IR_KEYTAB_SIZE]; 156extern IR_KEYTAB_TYPE ir_codes_avermedia_a16d[IR_KEYTAB_SIZE];
150 157extern IR_KEYTAB_TYPE ir_codes_encore_enltv_fm53[IR_KEYTAB_SIZE];
158extern IR_KEYTAB_TYPE ir_codes_real_audio_220_32_keys[IR_KEYTAB_SIZE];
159extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere_plus[IR_KEYTAB_SIZE];
151#endif 160#endif
152 161
153/* 162/*
diff --git a/include/media/saa7115.h b/include/media/saa7115.h
index f677dfb9d373..bab212719591 100644
--- a/include/media/saa7115.h
+++ b/include/media/saa7115.h
@@ -1,5 +1,5 @@
1/* 1/*
2 saa7115.h - definition for saa7113/4/5 inputs and frequency flags 2 saa7115.h - definition for saa7111/3/4/5 inputs and frequency flags
3 3
4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) 4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
5 5
@@ -21,13 +21,13 @@
21#ifndef _SAA7115_H_ 21#ifndef _SAA7115_H_
22#define _SAA7115_H_ 22#define _SAA7115_H_
23 23
24/* SAA7113/4/5 HW inputs */ 24/* SAA7111/3/4/5 HW inputs */
25#define SAA7115_COMPOSITE0 0 25#define SAA7115_COMPOSITE0 0
26#define SAA7115_COMPOSITE1 1 26#define SAA7115_COMPOSITE1 1
27#define SAA7115_COMPOSITE2 2 27#define SAA7115_COMPOSITE2 2
28#define SAA7115_COMPOSITE3 3 28#define SAA7115_COMPOSITE3 3
29#define SAA7115_COMPOSITE4 4 /* not available for the saa7113 */ 29#define SAA7115_COMPOSITE4 4 /* not available for the saa7111/3 */
30#define SAA7115_COMPOSITE5 5 /* not available for the saa7113 */ 30#define SAA7115_COMPOSITE5 5 /* not available for the saa7111/3 */
31#define SAA7115_SVIDEO0 6 31#define SAA7115_SVIDEO0 6
32#define SAA7115_SVIDEO1 7 32#define SAA7115_SVIDEO1 7
33#define SAA7115_SVIDEO2 8 33#define SAA7115_SVIDEO2 8
@@ -42,8 +42,15 @@
42#define SAA7115_FREQ_FL_CGCDIV (1 << 1) /* SA 3A[6], CGCDIV, SAA7115 only */ 42#define SAA7115_FREQ_FL_CGCDIV (1 << 1) /* SA 3A[6], CGCDIV, SAA7115 only */
43#define SAA7115_FREQ_FL_APLL (1 << 2) /* SA 3A[3], APLL, SAA7114/5 only */ 43#define SAA7115_FREQ_FL_APLL (1 << 2) /* SA 3A[3], APLL, SAA7114/5 only */
44 44
45#define SAA7115_IPORT_ON 1 45#define SAA7115_IPORT_ON 1
46#define SAA7115_IPORT_OFF 0 46#define SAA7115_IPORT_OFF 0
47
48/* SAA7111 specific output flags */
49#define SAA7111_VBI_BYPASS 2
50#define SAA7111_FMT_YUV422 0x00
51#define SAA7111_FMT_RGB 0x40
52#define SAA7111_FMT_CCIR 0x80
53#define SAA7111_FMT_YUV411 0xc0
47 54
48#endif 55#endif
49 56
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index 2f68f4cd0037..c5a6e22a4b37 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -24,13 +24,13 @@
24 24
25extern unsigned int saa7146_debug; 25extern unsigned int saa7146_debug;
26 26
27//#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),KBUILD_MODNAME,__FUNCTION__) 27//#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),KBUILD_MODNAME,__func__)
28 28
29#ifndef DEBUG_VARIABLE 29#ifndef DEBUG_VARIABLE
30 #define DEBUG_VARIABLE saa7146_debug 30 #define DEBUG_VARIABLE saa7146_debug
31#endif 31#endif
32 32
33#define DEBUG_PROLOG printk("%s: %s(): ",KBUILD_MODNAME,__FUNCTION__) 33#define DEBUG_PROLOG printk("%s: %s(): ",KBUILD_MODNAME, __func__)
34#define INFO(x) { printk("%s: ",KBUILD_MODNAME); printk x; } 34#define INFO(x) { printk("%s: ",KBUILD_MODNAME); printk x; }
35 35
36#define ERR(x) { DEBUG_PROLOG; printk x; } 36#define ERR(x) { DEBUG_PROLOG; printk x; }
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index 234a4711d2ec..b5dbefea3740 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -5,8 +5,6 @@
5 5
6struct sh_mobile_ceu_info { 6struct sh_mobile_ceu_info {
7 unsigned long flags; /* SOCAM_... */ 7 unsigned long flags; /* SOCAM_... */
8 void (*enable_camera)(void);
9 void (*disable_camera)(void);
10}; 8};
11 9
12#endif /* __ASM_SH_MOBILE_CEU_H__ */ 10#endif /* __ASM_SH_MOBILE_CEU_H__ */
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index d548de326722..c5de7bb19fda 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -83,6 +83,9 @@ struct soc_camera_link {
83 int bus_id; 83 int bus_id;
84 /* GPIO number to switch between 8 and 10 bit modes */ 84 /* GPIO number to switch between 8 and 10 bit modes */
85 unsigned int gpio; 85 unsigned int gpio;
86 /* Optional callbacks to power on or off and reset the sensor */
87 int (*power)(struct device *, int);
88 int (*reset)(struct device *);
86}; 89};
87 90
88static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) 91static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
diff --git a/include/media/soc_camera_platform.h b/include/media/soc_camera_platform.h
index 851f18220984..1d092b4678aa 100644
--- a/include/media/soc_camera_platform.h
+++ b/include/media/soc_camera_platform.h
@@ -1,3 +1,13 @@
1/*
2 * Generic Platform Camera Driver Header
3 *
4 * Copyright (C) 2008 Magnus Damm
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10
1#ifndef __SOC_CAMERA_H__ 11#ifndef __SOC_CAMERA_H__
2#define __SOC_CAMERA_H__ 12#define __SOC_CAMERA_H__
3 13
@@ -9,6 +19,7 @@ struct soc_camera_platform_info {
9 unsigned long format_depth; 19 unsigned long format_depth;
10 struct v4l2_pix_format format; 20 struct v4l2_pix_format format;
11 unsigned long bus_param; 21 unsigned long bus_param;
22 void (*power)(int);
12 int (*set_capture)(struct soc_camera_platform_info *info, int enable); 23 int (*set_capture)(struct soc_camera_platform_info *info, int enable);
13}; 24};
14 25
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 77068fcc86bd..7d4e2db78076 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -122,6 +122,8 @@
122#define TUNER_TDA9887 74 /* This tuner should be used only internally */ 122#define TUNER_TDA9887 74 /* This tuner should be used only internally */
123#define TUNER_TEA5761 75 /* Only FM Radio Tuner */ 123#define TUNER_TEA5761 75 /* Only FM Radio Tuner */
124#define TUNER_XC5000 76 /* Xceive Silicon Tuner */ 124#define TUNER_XC5000 76 /* Xceive Silicon Tuner */
125#define TUNER_TCL_MF02GIP_5N 77 /* TCL MF02GIP_5N */
126#define TUNER_PHILIPS_FMD1216MEX_MK3 78
125 127
126/* tv card specific */ 128/* tv card specific */
127#define TDA9887_PRESENT (1<<0) 129#define TDA9887_PRESENT (1<<0)
@@ -178,7 +180,7 @@ struct tuner_setup {
178 unsigned int type; /* Tuner type */ 180 unsigned int type; /* Tuner type */
179 unsigned int mode_mask; /* Allowed tuner modes */ 181 unsigned int mode_mask; /* Allowed tuner modes */
180 unsigned int config; /* configuraion for more complex tuners */ 182 unsigned int config; /* configuraion for more complex tuners */
181 int (*tuner_callback) (void *dev, int command,int arg); 183 int (*tuner_callback) (void *dev, int component, int cmd, int arg);
182}; 184};
183 185
184#endif /* __KERNEL__ */ 186#endif /* __KERNEL__ */
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 41b509babf3f..d73a8e9028a5 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -72,6 +72,10 @@ enum {
72 /* module cs5345: just ident 5345 */ 72 /* module cs5345: just ident 5345 */
73 V4L2_IDENT_CS5345 = 5345, 73 V4L2_IDENT_CS5345 = 5345,
74 74
75 /* module saa6752hs: reserved range 6750-6759 */
76 V4L2_IDENT_SAA6752HS = 6752,
77 V4L2_IDENT_SAA6752HS_AC3 = 6753,
78
75 /* module wm8739: just ident 8739 */ 79 /* module wm8739: just ident 8739 */
76 V4L2_IDENT_WM8739 = 8739, 80 V4L2_IDENT_WM8739 = 8739,
77 81
@@ -161,6 +165,7 @@ enum {
161 /* Micron CMOS sensor chips: 45000-45099 */ 165 /* Micron CMOS sensor chips: 45000-45099 */
162 V4L2_IDENT_MT9M001C12ST = 45000, 166 V4L2_IDENT_MT9M001C12ST = 45000,
163 V4L2_IDENT_MT9M001C12STM = 45005, 167 V4L2_IDENT_MT9M001C12STM = 45005,
168 V4L2_IDENT_MT9M111 = 45007,
164 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ 169 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */
165 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ 170 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */
166}; 171};
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 07d3a9a575d1..2f8719abf5cb 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -76,11 +76,14 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
76 76
77int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, 77int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
78 const char **menu_items); 78 const char **menu_items);
79const char *v4l2_ctrl_get_name(u32 id);
79const char **v4l2_ctrl_get_menu(u32 id); 80const char **v4l2_ctrl_get_menu(u32 id);
80int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def); 81int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
81int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl); 82int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl);
82int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, 83int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu,
83 struct v4l2_queryctrl *qctrl, const char **menu_items); 84 struct v4l2_queryctrl *qctrl, const char **menu_items);
85#define V4L2_CTRL_MENU_IDS_END (0xffffffff)
86int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids);
84u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id); 87u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
85 88
86/* ------------------------------------------------------------------------- */ 89/* ------------------------------------------------------------------------- */
@@ -222,18 +225,22 @@ struct v4l2_crystal_freq {
222 An extra flags field allows device specific configuration regarding 225 An extra flags field allows device specific configuration regarding
223 clock frequency dividers, etc. If not used, then set flags to 0. 226 clock frequency dividers, etc. If not used, then set flags to 0.
224 If the frequency is not supported, then -EINVAL is returned. */ 227 If the frequency is not supported, then -EINVAL is returned. */
225#define VIDIOC_INT_S_CRYSTAL_FREQ _IOW ('d', 113, struct v4l2_crystal_freq) 228#define VIDIOC_INT_S_CRYSTAL_FREQ _IOW('d', 113, struct v4l2_crystal_freq)
226 229
227/* Initialize the sensor registors to some sort of reasonable 230/* Initialize the sensor registors to some sort of reasonable
228 default values. */ 231 default values. */
229#define VIDIOC_INT_INIT _IOW ('d', 114, u32) 232#define VIDIOC_INT_INIT _IOW('d', 114, u32)
230 233
231/* Set v4l2_std_id for video OUTPUT devices. This is ignored by 234/* Set v4l2_std_id for video OUTPUT devices. This is ignored by
232 video input devices. */ 235 video input devices. */
233#define VIDIOC_INT_S_STD_OUTPUT _IOW ('d', 115, v4l2_std_id) 236#define VIDIOC_INT_S_STD_OUTPUT _IOW('d', 115, v4l2_std_id)
234 237
235/* Get v4l2_std_id for video OUTPUT devices. This is ignored by 238/* Get v4l2_std_id for video OUTPUT devices. This is ignored by
236 video input devices. */ 239 video input devices. */
237#define VIDIOC_INT_G_STD_OUTPUT _IOW ('d', 116, v4l2_std_id) 240#define VIDIOC_INT_G_STD_OUTPUT _IOW('d', 116, v4l2_std_id)
241
242/* Set GPIO pins. Very simple right now, might need to be extended with
243 a v4l2_gpio struct if a direction is also needed. */
244#define VIDIOC_INT_S_GPIO _IOW('d', 117, u32)
238 245
239#endif /* V4L2_COMMON_H_ */ 246#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 2745e1afc722..a0a6b41c5e09 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -9,30 +9,20 @@
9#ifndef _V4L2_DEV_H 9#ifndef _V4L2_DEV_H
10#define _V4L2_DEV_H 10#define _V4L2_DEV_H
11 11
12#define OBSOLETE_DEVDATA 1 /* to be removed soon */
13
14#include <linux/poll.h> 12#include <linux/poll.h>
15#include <linux/fs.h> 13#include <linux/fs.h>
16#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/cdev.h>
17#include <linux/mutex.h> 16#include <linux/mutex.h>
18#include <linux/compiler.h> /* need __user */
19#include <linux/videodev2.h> 17#include <linux/videodev2.h>
20 18
21#define VIDEO_MAJOR 81 19#define VIDEO_MAJOR 81
22/* Minor device allocation */
23#define MINOR_VFL_TYPE_GRABBER_MIN 0
24#define MINOR_VFL_TYPE_GRABBER_MAX 63
25#define MINOR_VFL_TYPE_RADIO_MIN 64
26#define MINOR_VFL_TYPE_RADIO_MAX 127
27#define MINOR_VFL_TYPE_VTX_MIN 192
28#define MINOR_VFL_TYPE_VTX_MAX 223
29#define MINOR_VFL_TYPE_VBI_MIN 224
30#define MINOR_VFL_TYPE_VBI_MAX 255
31 20
32#define VFL_TYPE_GRABBER 0 21#define VFL_TYPE_GRABBER 0
33#define VFL_TYPE_VBI 1 22#define VFL_TYPE_VBI 1
34#define VFL_TYPE_RADIO 2 23#define VFL_TYPE_RADIO 2
35#define VFL_TYPE_VTX 3 24#define VFL_TYPE_VTX 3
25#define VFL_TYPE_MAX 4
36 26
37struct v4l2_ioctl_callbacks; 27struct v4l2_ioctl_callbacks;
38 28
@@ -49,12 +39,15 @@ struct video_device
49 39
50 /* sysfs */ 40 /* sysfs */
51 struct device dev; /* v4l device */ 41 struct device dev; /* v4l device */
42 struct cdev cdev; /* character device */
43 void (*cdev_release)(struct kobject *kobj);
52 struct device *parent; /* device parent */ 44 struct device *parent; /* device parent */
53 45
54 /* device info */ 46 /* device info */
55 char name[32]; 47 char name[32];
56 int vfl_type; 48 int vfl_type;
57 int minor; 49 int minor;
50 u16 num;
58 /* attribute to differentiate multiple indices on one physical device */ 51 /* attribute to differentiate multiple indices on one physical device */
59 int index; 52 int index;
60 53
@@ -69,50 +62,50 @@ struct video_device
69 62
70 /* ioctl callbacks */ 63 /* ioctl callbacks */
71 const struct v4l2_ioctl_ops *ioctl_ops; 64 const struct v4l2_ioctl_ops *ioctl_ops;
72
73#ifdef OBSOLETE_DEVDATA /* to be removed soon */
74 /* dev->driver_data will be used instead some day.
75 * Use the video_{get|set}_drvdata() helper functions,
76 * so the switch over will be transparent for you.
77 * Or use {pci|usb}_{get|set}_drvdata() directly. */
78 void *priv;
79#endif
80
81 /* for videodev.c internal usage -- please don't touch */
82 int users; /* video_exclusive_{open|close} ... */
83 struct mutex lock; /* ... helper function uses these */
84}; 65};
85 66
86/* Class-dev to video-device */ 67/* dev to video-device */
87#define to_video_device(cd) container_of(cd, struct video_device, dev) 68#define to_video_device(cd) container_of(cd, struct video_device, dev)
88 69
89/* Version 2 functions */ 70/* Register and unregister devices. Note that if video_register_device fails,
90extern int video_register_device(struct video_device *vfd, int type, int nr); 71 the release() callback of the video_device structure is *not* called, so
91int video_register_device_index(struct video_device *vfd, int type, int nr, 72 the caller is responsible for freeing any data. Usually that means that
92 int index); 73 you call video_device_release() on failure. */
93void video_unregister_device(struct video_device *); 74int __must_check video_register_device(struct video_device *vfd, int type, int nr);
75int __must_check video_register_device_index(struct video_device *vfd,
76 int type, int nr, int index);
77void video_unregister_device(struct video_device *vfd);
94 78
95/* helper functions to alloc / release struct video_device, the 79/* helper functions to alloc/release struct video_device, the
96 later can be used for video_device->release() */ 80 latter can also be used for video_device->release(). */
97struct video_device *video_device_alloc(void); 81struct video_device * __must_check video_device_alloc(void);
82
83/* this release function frees the vfd pointer */
98void video_device_release(struct video_device *vfd); 84void video_device_release(struct video_device *vfd);
99 85
100#ifdef OBSOLETE_DEVDATA /* to be removed soon */ 86/* this release function does nothing, use when the video_device is a
87 static global struct. Note that having a static video_device is
88 a dubious construction at best. */
89void video_device_release_empty(struct video_device *vfd);
90
101/* helper functions to access driver private data. */ 91/* helper functions to access driver private data. */
102static inline void *video_get_drvdata(struct video_device *dev) 92static inline void *video_get_drvdata(struct video_device *dev)
103{ 93{
104 return dev->priv; 94 return dev_get_drvdata(&dev->dev);
105} 95}
106 96
107static inline void video_set_drvdata(struct video_device *dev, void *data) 97static inline void video_set_drvdata(struct video_device *dev, void *data)
108{ 98{
109 dev->priv = data; 99 dev_set_drvdata(&dev->dev, data);
110} 100}
111 101
112/* Obsolete stuff - Still needed for radio devices and obsolete drivers */ 102struct video_device *video_devdata(struct file *file);
113extern struct video_device* video_devdata(struct file*); 103
114extern int video_exclusive_open(struct inode *inode, struct file *file); 104/* Combine video_get_drvdata and video_devdata as this is
115extern int video_exclusive_release(struct inode *inode, struct file *file); 105 used very often. */
116#endif 106static inline void *video_drvdata(struct file *file)
107{
108 return video_get_drvdata(video_devdata(file));
109}
117 110
118#endif /* _V4L2_DEV_H */ 111#endif /* _V4L2_DEV_H */
diff --git a/include/media/v4l2-i2c-drv-legacy.h b/include/media/v4l2-i2c-drv-legacy.h
index 975ffbf4e2c5..e65dd9d84e8b 100644
--- a/include/media/v4l2-i2c-drv-legacy.h
+++ b/include/media/v4l2-i2c-drv-legacy.h
@@ -21,6 +21,17 @@
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 22 */
23 23
24/* NOTE: the full version of this header is in the v4l-dvb repository
25 * and allows v4l i2c drivers to be compiled on older kernels as well.
26 * The version of this header as it appears in the kernel is a stripped
27 * version (without all the backwards compatibility stuff) and so it
28 * looks a bit odd.
29 *
30 * If you look at the full version then you will understand the reason
31 * for introducing this header since you really don't want to have all
32 * the tricky backwards compatibility code in each and every i2c driver.
33 */
34
24struct v4l2_i2c_driver_data { 35struct v4l2_i2c_driver_data {
25 const char * const name; 36 const char * const name;
26 int driverid; 37 int driverid;
diff --git a/include/media/v4l2-i2c-drv.h b/include/media/v4l2-i2c-drv.h
index 40ecef29801d..efdc8bf27f87 100644
--- a/include/media/v4l2-i2c-drv.h
+++ b/include/media/v4l2-i2c-drv.h
@@ -21,6 +21,17 @@
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 22 */
23 23
24/* NOTE: the full version of this header is in the v4l-dvb repository
25 * and allows v4l i2c drivers to be compiled on older kernels as well.
26 * The version of this header as it appears in the kernel is a stripped
27 * version (without all the backwards compatibility stuff) and so it
28 * looks a bit odd.
29 *
30 * If you look at the full version then you will understand the reason
31 * for introducing this header since you really don't want to have all
32 * the tricky backwards compatibility code in each and every i2c driver.
33 */
34
24#ifndef __V4L2_I2C_DRV_H__ 35#ifndef __V4L2_I2C_DRV_H__
25#define __V4L2_I2C_DRV_H__ 36#define __V4L2_I2C_DRV_H__
26 37
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index dc6404618555..0bef03add796 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -39,11 +39,6 @@ struct v4l2_ioctl_ops {
39 struct v4l2_fmtdesc *f); 39 struct v4l2_fmtdesc *f);
40 int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh, 40 int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh,
41 struct v4l2_fmtdesc *f); 41 struct v4l2_fmtdesc *f);
42#if 1
43 /* deprecated, will be removed in 2.6.28 */
44 int (*vidioc_enum_fmt_vbi_cap) (struct file *file, void *fh,
45 struct v4l2_fmtdesc *f);
46#endif
47 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh, 42 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
48 struct v4l2_fmtdesc *f); 43 struct v4l2_fmtdesc *f);
49 44
diff --git a/include/media/videobuf-dvb.h b/include/media/videobuf-dvb.h
index b77748696329..80471c2b6343 100644
--- a/include/media/videobuf-dvb.h
+++ b/include/media/videobuf-dvb.h
@@ -16,7 +16,6 @@ struct videobuf_dvb {
16 int nfeeds; 16 int nfeeds;
17 17
18 /* videobuf_dvb_(un)register manges this */ 18 /* videobuf_dvb_(un)register manges this */
19 struct dvb_adapter adapter;
20 struct dvb_demux demux; 19 struct dvb_demux demux;
21 struct dmxdev dmxdev; 20 struct dmxdev dmxdev;
22 struct dmx_frontend fe_hw; 21 struct dmx_frontend fe_hw;
@@ -24,12 +23,34 @@ struct videobuf_dvb {
24 struct dvb_net net; 23 struct dvb_net net;
25}; 24};
26 25
27int videobuf_dvb_register(struct videobuf_dvb *dvb, 26struct videobuf_dvb_frontend {
27 struct list_head felist;
28 int id;
29 struct videobuf_dvb dvb;
30};
31
32struct videobuf_dvb_frontends {
33 struct list_head felist;
34 struct mutex lock;
35 struct dvb_adapter adapter;
36 int active_fe_id; /* Indicates which frontend in the felist is in use */
37 int gate; /* Frontend with gate control 0=!MFE,1=fe0,2=fe1 etc */
38};
39
40int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f,
28 struct module *module, 41 struct module *module,
29 void *adapter_priv, 42 void *adapter_priv,
30 struct device *device, 43 struct device *device,
31 short *adapter_nr); 44 short *adapter_nr,
32void videobuf_dvb_unregister(struct videobuf_dvb *dvb); 45 int mfe_shared);
46
47void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f);
48
49struct videobuf_dvb_frontend * videobuf_dvb_alloc_frontend(struct videobuf_dvb_frontends *f, int id);
50
51struct videobuf_dvb_frontend * videobuf_dvb_get_frontend(struct videobuf_dvb_frontends *f, int id);
52int videobuf_dvb_find_frontend(struct videobuf_dvb_frontends *f, struct dvb_frontend *p);
53
33 54
34/* 55/*
35 * Local variables: 56 * Local variables:
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index c3626c0ba9d3..fb163e2e0de6 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -61,7 +61,7 @@ extern unsigned int p9_debug_level;
61do { \ 61do { \
62 if ((p9_debug_level & level) == level) \ 62 if ((p9_debug_level & level) == level) \
63 printk(KERN_NOTICE "-- %s (%d): " \ 63 printk(KERN_NOTICE "-- %s (%d): " \
64 format , __FUNCTION__, task_pid_nr(current) , ## arg); \ 64 format , __func__, task_pid_nr(current) , ## arg); \
65} while (0) 65} while (0)
66 66
67#define PRINT_FCALL_ERROR(s, fcall) P9_DPRINTK(P9_DEBUG_ERROR, \ 67#define PRINT_FCALL_ERROR(s, fcall) P9_DPRINTK(P9_DEBUG_ERROR, \
@@ -76,7 +76,7 @@ do { \
76#define P9_EPRINTK(level, format, arg...) \ 76#define P9_EPRINTK(level, format, arg...) \
77do { \ 77do { \
78 printk(level "9p: %s (%d): " \ 78 printk(level "9p: %s (%d): " \
79 format , __FUNCTION__, task_pid_nr(current), ## arg); \ 79 format , __func__, task_pid_nr(current), ## arg); \
80} while (0) 80} while (0)
81 81
82/** 82/**
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 6f8418bf4241..996d12df7594 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -54,8 +54,8 @@
54#define SOL_RFCOMM 18 54#define SOL_RFCOMM 18
55 55
56#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) 56#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
57#define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __FUNCTION__ , ## arg) 57#define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __func__ , ## arg)
58#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __FUNCTION__ , ## arg) 58#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg)
59 59
60/* Connection and socket states */ 60/* Connection and socket states */
61enum { 61enum {
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index a6bb94530cfd..9909774eb998 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -40,11 +40,12 @@
40#include <linux/net.h> 40#include <linux/net.h>
41#include <linux/skbuff.h> 41#include <linux/skbuff.h>
42#include <net/netlabel.h> 42#include <net/netlabel.h>
43#include <asm/atomic.h>
43 44
44/* known doi values */ 45/* known doi values */
45#define CIPSO_V4_DOI_UNKNOWN 0x00000000 46#define CIPSO_V4_DOI_UNKNOWN 0x00000000
46 47
47/* tag types */ 48/* standard tag types */
48#define CIPSO_V4_TAG_INVALID 0 49#define CIPSO_V4_TAG_INVALID 0
49#define CIPSO_V4_TAG_RBITMAP 1 50#define CIPSO_V4_TAG_RBITMAP 1
50#define CIPSO_V4_TAG_ENUM 2 51#define CIPSO_V4_TAG_ENUM 2
@@ -52,10 +53,14 @@
52#define CIPSO_V4_TAG_PBITMAP 6 53#define CIPSO_V4_TAG_PBITMAP 6
53#define CIPSO_V4_TAG_FREEFORM 7 54#define CIPSO_V4_TAG_FREEFORM 7
54 55
56/* non-standard tag types (tags > 127) */
57#define CIPSO_V4_TAG_LOCAL 128
58
55/* doi mapping types */ 59/* doi mapping types */
56#define CIPSO_V4_MAP_UNKNOWN 0 60#define CIPSO_V4_MAP_UNKNOWN 0
57#define CIPSO_V4_MAP_STD 1 61#define CIPSO_V4_MAP_TRANS 1
58#define CIPSO_V4_MAP_PASS 2 62#define CIPSO_V4_MAP_PASS 2
63#define CIPSO_V4_MAP_LOCAL 3
59 64
60/* limits */ 65/* limits */
61#define CIPSO_V4_MAX_REM_LVLS 255 66#define CIPSO_V4_MAX_REM_LVLS 255
@@ -79,10 +84,9 @@ struct cipso_v4_doi {
79 } map; 84 } map;
80 u8 tags[CIPSO_V4_TAG_MAXCNT]; 85 u8 tags[CIPSO_V4_TAG_MAXCNT];
81 86
82 u32 valid; 87 atomic_t refcount;
83 struct list_head list; 88 struct list_head list;
84 struct rcu_head rcu; 89 struct rcu_head rcu;
85 struct list_head dom_list;
86}; 90};
87 91
88/* Standard CIPSO mapping table */ 92/* Standard CIPSO mapping table */
@@ -128,25 +132,26 @@ extern int cipso_v4_rbm_strictvalid;
128 132
129#ifdef CONFIG_NETLABEL 133#ifdef CONFIG_NETLABEL
130int cipso_v4_doi_add(struct cipso_v4_doi *doi_def); 134int cipso_v4_doi_add(struct cipso_v4_doi *doi_def);
131int cipso_v4_doi_remove(u32 doi, 135void cipso_v4_doi_free(struct cipso_v4_doi *doi_def);
132 struct netlbl_audit *audit_info, 136int cipso_v4_doi_remove(u32 doi, struct netlbl_audit *audit_info);
133 void (*callback) (struct rcu_head * head));
134struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi); 137struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi);
138void cipso_v4_doi_putdef(struct cipso_v4_doi *doi_def);
135int cipso_v4_doi_walk(u32 *skip_cnt, 139int cipso_v4_doi_walk(u32 *skip_cnt,
136 int (*callback) (struct cipso_v4_doi *doi_def, void *arg), 140 int (*callback) (struct cipso_v4_doi *doi_def, void *arg),
137 void *cb_arg); 141 void *cb_arg);
138int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def, const char *domain);
139int cipso_v4_doi_domhsh_remove(struct cipso_v4_doi *doi_def,
140 const char *domain);
141#else 142#else
142static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def) 143static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def)
143{ 144{
144 return -ENOSYS; 145 return -ENOSYS;
145} 146}
146 147
148static inline void cipso_v4_doi_free(struct cipso_v4_doi *doi_def)
149{
150 return;
151}
152
147static inline int cipso_v4_doi_remove(u32 doi, 153static inline int cipso_v4_doi_remove(u32 doi,
148 struct netlbl_audit *audit_info, 154 struct netlbl_audit *audit_info)
149 void (*callback) (struct rcu_head * head))
150{ 155{
151 return 0; 156 return 0;
152} 157}
@@ -206,10 +211,15 @@ void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway);
206int cipso_v4_sock_setattr(struct sock *sk, 211int cipso_v4_sock_setattr(struct sock *sk,
207 const struct cipso_v4_doi *doi_def, 212 const struct cipso_v4_doi *doi_def,
208 const struct netlbl_lsm_secattr *secattr); 213 const struct netlbl_lsm_secattr *secattr);
214void cipso_v4_sock_delattr(struct sock *sk);
209int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr); 215int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr);
216int cipso_v4_skbuff_setattr(struct sk_buff *skb,
217 const struct cipso_v4_doi *doi_def,
218 const struct netlbl_lsm_secattr *secattr);
219int cipso_v4_skbuff_delattr(struct sk_buff *skb);
210int cipso_v4_skbuff_getattr(const struct sk_buff *skb, 220int cipso_v4_skbuff_getattr(const struct sk_buff *skb,
211 struct netlbl_lsm_secattr *secattr); 221 struct netlbl_lsm_secattr *secattr);
212int cipso_v4_validate(unsigned char **option); 222int cipso_v4_validate(const struct sk_buff *skb, unsigned char **option);
213#else 223#else
214static inline void cipso_v4_error(struct sk_buff *skb, 224static inline void cipso_v4_error(struct sk_buff *skb,
215 int error, 225 int error,
@@ -225,19 +235,36 @@ static inline int cipso_v4_sock_setattr(struct sock *sk,
225 return -ENOSYS; 235 return -ENOSYS;
226} 236}
227 237
238static inline void cipso_v4_sock_delattr(struct sock *sk)
239{
240}
241
228static inline int cipso_v4_sock_getattr(struct sock *sk, 242static inline int cipso_v4_sock_getattr(struct sock *sk,
229 struct netlbl_lsm_secattr *secattr) 243 struct netlbl_lsm_secattr *secattr)
230{ 244{
231 return -ENOSYS; 245 return -ENOSYS;
232} 246}
233 247
248static inline int cipso_v4_skbuff_setattr(struct sk_buff *skb,
249 const struct cipso_v4_doi *doi_def,
250 const struct netlbl_lsm_secattr *secattr)
251{
252 return -ENOSYS;
253}
254
255static inline int cipso_v4_skbuff_delattr(struct sk_buff *skb)
256{
257 return -ENOSYS;
258}
259
234static inline int cipso_v4_skbuff_getattr(const struct sk_buff *skb, 260static inline int cipso_v4_skbuff_getattr(const struct sk_buff *skb,
235 struct netlbl_lsm_secattr *secattr) 261 struct netlbl_lsm_secattr *secattr)
236{ 262{
237 return -ENOSYS; 263 return -ENOSYS;
238} 264}
239 265
240static inline int cipso_v4_validate(unsigned char **option) 266static inline int cipso_v4_validate(const struct sk_buff *skb,
267 unsigned char **option)
241{ 268{
242 return -ENOSYS; 269 return -ENOSYS;
243} 270}
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index 6048579d0b24..93a56de3594b 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -114,7 +114,7 @@ extern u32 ieee80211_debug_level;
114#define IEEE80211_DEBUG(level, fmt, args...) \ 114#define IEEE80211_DEBUG(level, fmt, args...) \
115do { if (ieee80211_debug_level & (level)) \ 115do { if (ieee80211_debug_level & (level)) \
116 printk(KERN_DEBUG "ieee80211: %c %s " fmt, \ 116 printk(KERN_DEBUG "ieee80211: %c %s " fmt, \
117 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) 117 in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
118static inline bool ieee80211_ratelimit_debug(u32 level) 118static inline bool ieee80211_ratelimit_debug(u32 level)
119{ 119{
120 return (ieee80211_debug_level & level) && net_ratelimit(); 120 return (ieee80211_debug_level & level) && net_ratelimit();
diff --git a/include/net/ip.h b/include/net/ip.h
index 1cbccaf0de3f..bc026ecb513f 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -396,7 +396,7 @@ extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
396int ipv4_doint_and_flush(ctl_table *ctl, int write, 396int ipv4_doint_and_flush(ctl_table *ctl, int write,
397 struct file* filp, void __user *buffer, 397 struct file* filp, void __user *buffer,
398 size_t *lenp, loff_t *ppos); 398 size_t *lenp, loff_t *ppos);
399int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen, 399int ipv4_doint_and_flush_strategy(ctl_table *table,
400 void __user *oldval, size_t __user *oldlenp, 400 void __user *oldval, size_t __user *oldlenp,
401 void __user *newval, size_t newlen); 401 void __user *newval, size_t newlen);
402#ifdef CONFIG_PROC_FS 402#ifdef CONFIG_PROC_FS
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 0b2071d9326d..fe9fcf73c85e 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -165,13 +165,13 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
165 do { \ 165 do { \
166 if (level <= ip_vs_get_debug_level()) \ 166 if (level <= ip_vs_get_debug_level()) \
167 printk(KERN_DEBUG "Enter: %s, %s line %i\n", \ 167 printk(KERN_DEBUG "Enter: %s, %s line %i\n", \
168 __FUNCTION__, __FILE__, __LINE__); \ 168 __func__, __FILE__, __LINE__); \
169 } while (0) 169 } while (0)
170#define LeaveFunction(level) \ 170#define LeaveFunction(level) \
171 do { \ 171 do { \
172 if (level <= ip_vs_get_debug_level()) \ 172 if (level <= ip_vs_get_debug_level()) \
173 printk(KERN_DEBUG "Leave: %s, %s line %i\n", \ 173 printk(KERN_DEBUG "Leave: %s, %s line %i\n", \
174 __FUNCTION__, __FILE__, __LINE__); \ 174 __func__, __FILE__, __LINE__); \
175 } while (0) 175 } while (0)
176#else 176#else
177#define EnterFunction(level) do {} while (0) 177#define EnterFunction(level) do {} while (0)
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h
index 08387553b57e..7e582061b230 100644
--- a/include/net/irda/irda.h
+++ b/include/net/irda/irda.h
@@ -72,7 +72,7 @@ do { if (irda_debug >= (n)) \
72#define IRDA_ASSERT(expr, func) \ 72#define IRDA_ASSERT(expr, func) \
73do { if(!(expr)) { \ 73do { if(!(expr)) { \
74 printk( "Assertion failed! %s:%s:%d %s\n", \ 74 printk( "Assertion failed! %s:%s:%d %s\n", \
75 __FILE__,__FUNCTION__,__LINE__,(#expr) ); \ 75 __FILE__,__func__,__LINE__,(#expr) ); \
76 func } } while (0) 76 func } } while (0)
77#define IRDA_ASSERT_LABEL(label) label 77#define IRDA_ASSERT_LABEL(label) label
78#else 78#else
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5617a1613c91..d861197f83c7 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -645,7 +645,8 @@ enum ieee80211_key_flags {
645 * - Temporal Encryption Key (128 bits) 645 * - Temporal Encryption Key (128 bits)
646 * - Temporal Authenticator Tx MIC Key (64 bits) 646 * - Temporal Authenticator Tx MIC Key (64 bits)
647 * - Temporal Authenticator Rx MIC Key (64 bits) 647 * - Temporal Authenticator Rx MIC Key (64 bits)
648 * 648 * @icv_len: FIXME
649 * @iv_len: FIXME
649 */ 650 */
650struct ieee80211_key_conf { 651struct ieee80211_key_conf {
651 enum ieee80211_key_alg alg; 652 enum ieee80211_key_alg alg;
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index a01b7c4dc763..11dd0137c6a5 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -129,9 +129,8 @@ extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
129 void __user *buffer, 129 void __user *buffer,
130 size_t *lenp, 130 size_t *lenp,
131 loff_t *ppos); 131 loff_t *ppos);
132int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name, 132int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl,
133 int nlen, void __user *oldval, 133 void __user *oldval, size_t __user *oldlenp,
134 size_t __user *oldlenp,
135 void __user *newval, size_t newlen); 134 void __user *newval, size_t newlen);
136#endif 135#endif
137 136
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index f29eeb9777e0..58684066388c 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -25,4 +25,12 @@ static inline int nf_nat_initialized(struct nf_conn *ct,
25 else 25 else
26 return test_bit(IPS_DST_NAT_DONE_BIT, &ct->status); 26 return test_bit(IPS_DST_NAT_DONE_BIT, &ct->status);
27} 27}
28
29struct nlattr;
30
31extern int
32(*nfnetlink_parse_nat_setup_hook)(struct nf_conn *ct,
33 enum nf_nat_manip_type manip,
34 struct nlattr *attr);
35
28#endif /* _NF_NAT_CORE_H */ 36#endif /* _NF_NAT_CORE_H */
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index e4d2d6baa983..17c442a4514e 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11/* 11/*
12 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006 12 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by 15 * it under the terms of the GNU General Public License as published by
@@ -72,8 +72,10 @@ struct cipso_v4_doi;
72/* NetLabel NETLINK protocol version 72/* NetLabel NETLINK protocol version
73 * 1: initial version 73 * 1: initial version
74 * 2: added static labels for unlabeled connections 74 * 2: added static labels for unlabeled connections
75 * 3: network selectors added to the NetLabel/LSM domain mapping and the
76 * CIPSO_V4_MAP_LOCAL CIPSO mapping was added
75 */ 77 */
76#define NETLBL_PROTO_VERSION 2 78#define NETLBL_PROTO_VERSION 3
77 79
78/* NetLabel NETLINK types/families */ 80/* NetLabel NETLINK types/families */
79#define NETLBL_NLTYPE_NONE 0 81#define NETLBL_NLTYPE_NONE 0
@@ -87,6 +89,8 @@ struct cipso_v4_doi;
87#define NETLBL_NLTYPE_CIPSOV6_NAME "NLBL_CIPSOv6" 89#define NETLBL_NLTYPE_CIPSOV6_NAME "NLBL_CIPSOv6"
88#define NETLBL_NLTYPE_UNLABELED 5 90#define NETLBL_NLTYPE_UNLABELED 5
89#define NETLBL_NLTYPE_UNLABELED_NAME "NLBL_UNLBL" 91#define NETLBL_NLTYPE_UNLABELED_NAME "NLBL_UNLBL"
92#define NETLBL_NLTYPE_ADDRSELECT 6
93#define NETLBL_NLTYPE_ADDRSELECT_NAME "NLBL_ADRSEL"
90 94
91/* 95/*
92 * NetLabel - Kernel API for accessing the network packet label mappings. 96 * NetLabel - Kernel API for accessing the network packet label mappings.
@@ -200,7 +204,7 @@ struct netlbl_lsm_secattr {
200 u32 type; 204 u32 type;
201 char *domain; 205 char *domain;
202 struct netlbl_lsm_cache *cache; 206 struct netlbl_lsm_cache *cache;
203 union { 207 struct {
204 struct { 208 struct {
205 struct netlbl_lsm_secattr_catmap *cat; 209 struct netlbl_lsm_secattr_catmap *cat;
206 u32 lvl; 210 u32 lvl;
@@ -352,12 +356,9 @@ static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr)
352int netlbl_cfg_map_del(const char *domain, struct netlbl_audit *audit_info); 356int netlbl_cfg_map_del(const char *domain, struct netlbl_audit *audit_info);
353int netlbl_cfg_unlbl_add_map(const char *domain, 357int netlbl_cfg_unlbl_add_map(const char *domain,
354 struct netlbl_audit *audit_info); 358 struct netlbl_audit *audit_info);
355int netlbl_cfg_cipsov4_add(struct cipso_v4_doi *doi_def,
356 struct netlbl_audit *audit_info);
357int netlbl_cfg_cipsov4_add_map(struct cipso_v4_doi *doi_def, 359int netlbl_cfg_cipsov4_add_map(struct cipso_v4_doi *doi_def,
358 const char *domain, 360 const char *domain,
359 struct netlbl_audit *audit_info); 361 struct netlbl_audit *audit_info);
360int netlbl_cfg_cipsov4_del(u32 doi, struct netlbl_audit *audit_info);
361 362
362/* 363/*
363 * LSM security attribute operations 364 * LSM security attribute operations
@@ -380,12 +381,19 @@ int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap,
380int netlbl_enabled(void); 381int netlbl_enabled(void);
381int netlbl_sock_setattr(struct sock *sk, 382int netlbl_sock_setattr(struct sock *sk,
382 const struct netlbl_lsm_secattr *secattr); 383 const struct netlbl_lsm_secattr *secattr);
384void netlbl_sock_delattr(struct sock *sk);
383int netlbl_sock_getattr(struct sock *sk, 385int netlbl_sock_getattr(struct sock *sk,
384 struct netlbl_lsm_secattr *secattr); 386 struct netlbl_lsm_secattr *secattr);
387int netlbl_conn_setattr(struct sock *sk,
388 struct sockaddr *addr,
389 const struct netlbl_lsm_secattr *secattr);
390int netlbl_skbuff_setattr(struct sk_buff *skb,
391 u16 family,
392 const struct netlbl_lsm_secattr *secattr);
385int netlbl_skbuff_getattr(const struct sk_buff *skb, 393int netlbl_skbuff_getattr(const struct sk_buff *skb,
386 u16 family, 394 u16 family,
387 struct netlbl_lsm_secattr *secattr); 395 struct netlbl_lsm_secattr *secattr);
388void netlbl_skbuff_err(struct sk_buff *skb, int error); 396void netlbl_skbuff_err(struct sk_buff *skb, int error, int gateway);
389 397
390/* 398/*
391 * LSM label mapping cache operations 399 * LSM label mapping cache operations
@@ -404,22 +412,12 @@ static inline int netlbl_cfg_unlbl_add_map(const char *domain,
404{ 412{
405 return -ENOSYS; 413 return -ENOSYS;
406} 414}
407static inline int netlbl_cfg_cipsov4_add(struct cipso_v4_doi *doi_def,
408 struct netlbl_audit *audit_info)
409{
410 return -ENOSYS;
411}
412static inline int netlbl_cfg_cipsov4_add_map(struct cipso_v4_doi *doi_def, 415static inline int netlbl_cfg_cipsov4_add_map(struct cipso_v4_doi *doi_def,
413 const char *domain, 416 const char *domain,
414 struct netlbl_audit *audit_info) 417 struct netlbl_audit *audit_info)
415{ 418{
416 return -ENOSYS; 419 return -ENOSYS;
417} 420}
418static inline int netlbl_cfg_cipsov4_del(u32 doi,
419 struct netlbl_audit *audit_info)
420{
421 return -ENOSYS;
422}
423static inline int netlbl_secattr_catmap_walk( 421static inline int netlbl_secattr_catmap_walk(
424 struct netlbl_lsm_secattr_catmap *catmap, 422 struct netlbl_lsm_secattr_catmap *catmap,
425 u32 offset) 423 u32 offset)
@@ -456,18 +454,35 @@ static inline int netlbl_sock_setattr(struct sock *sk,
456{ 454{
457 return -ENOSYS; 455 return -ENOSYS;
458} 456}
457static inline void netlbl_sock_delattr(struct sock *sk)
458{
459}
459static inline int netlbl_sock_getattr(struct sock *sk, 460static inline int netlbl_sock_getattr(struct sock *sk,
460 struct netlbl_lsm_secattr *secattr) 461 struct netlbl_lsm_secattr *secattr)
461{ 462{
462 return -ENOSYS; 463 return -ENOSYS;
463} 464}
465static inline int netlbl_conn_setattr(struct sock *sk,
466 struct sockaddr *addr,
467 const struct netlbl_lsm_secattr *secattr)
468{
469 return -ENOSYS;
470}
471static inline int netlbl_skbuff_setattr(struct sk_buff *skb,
472 u16 family,
473 const struct netlbl_lsm_secattr *secattr)
474{
475 return -ENOSYS;
476}
464static inline int netlbl_skbuff_getattr(const struct sk_buff *skb, 477static inline int netlbl_skbuff_getattr(const struct sk_buff *skb,
465 u16 family, 478 u16 family,
466 struct netlbl_lsm_secattr *secattr) 479 struct netlbl_lsm_secattr *secattr)
467{ 480{
468 return -ENOSYS; 481 return -ENOSYS;
469} 482}
470static inline void netlbl_skbuff_err(struct sk_buff *skb, int error) 483static inline void netlbl_skbuff_err(struct sk_buff *skb,
484 int error,
485 int gateway)
471{ 486{
472 return; 487 return;
473} 488}
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 703305d00365..ed71b110edf7 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -303,7 +303,7 @@ extern int sctp_debug_flag;
303#define SCTP_ASSERT(expr, str, func) \ 303#define SCTP_ASSERT(expr, str, func) \
304 if (!(expr)) { \ 304 if (!(expr)) { \
305 SCTP_DEBUG_PRINTK("Assertion Failed: %s(%s) at %s:%s:%d\n", \ 305 SCTP_DEBUG_PRINTK("Assertion Failed: %s(%s) at %s:%s:%d\n", \
306 str, (#expr), __FILE__, __FUNCTION__, __LINE__); \ 306 str, (#expr), __FILE__, __func__, __LINE__); \
307 func; \ 307 func; \
308 } 308 }
309 309
diff --git a/include/pcmcia/ciscode.h b/include/pcmcia/ciscode.h
index ad6e278ba7f2..b417985708f2 100644
--- a/include/pcmcia/ciscode.h
+++ b/include/pcmcia/ciscode.h
@@ -119,7 +119,7 @@
119 119
120#define MANFID_TOSHIBA 0x0098 120#define MANFID_TOSHIBA 0x0098
121 121
122#define MANFID_UNGERMANN 0x02c0 122#define MANFID_UNGERMANN 0x02c0
123 123
124#define MANFID_XIRCOM 0x0105 124#define MANFID_XIRCOM 0x0105
125 125
diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h
index e2e10c1e9a06..cfdd5af77dcc 100644
--- a/include/pcmcia/cistpl.h
+++ b/include/pcmcia/cistpl.h
@@ -573,44 +573,6 @@ typedef struct tuple_t {
573#define TUPLE_RETURN_LINK 0x01 573#define TUPLE_RETURN_LINK 0x01
574#define TUPLE_RETURN_COMMON 0x02 574#define TUPLE_RETURN_COMMON 0x02
575 575
576/* For ValidateCIS */
577typedef struct cisinfo_t {
578 u_int Chains;
579} cisinfo_t;
580
581#define CISTPL_MAX_CIS_SIZE 0x200 576#define CISTPL_MAX_CIS_SIZE 0x200
582 577
583/* For ReplaceCIS */
584typedef struct cisdump_t {
585 u_int Length;
586 cisdata_t Data[CISTPL_MAX_CIS_SIZE];
587} cisdump_t;
588
589
590int pcmcia_replace_cis(struct pcmcia_socket *s, cisdump_t *cis);
591
592/* don't use outside of PCMCIA core yet */
593int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *tuple);
594int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple_t *tuple);
595int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple);
596int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse);
597
598int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int *count);
599
600/* ... but use these wrappers instead */
601#define pcmcia_get_first_tuple(p_dev, tuple) \
602 pccard_get_first_tuple(p_dev->socket, p_dev->func, tuple)
603
604#define pcmcia_get_next_tuple(p_dev, tuple) \
605 pccard_get_next_tuple(p_dev->socket, p_dev->func, tuple)
606
607#define pcmcia_get_tuple_data(p_dev, tuple) \
608 pccard_get_tuple_data(p_dev->socket, tuple)
609
610#define pcmcia_parse_tuple(p_dev, tuple, parse) \
611 pccard_parse_tuple(tuple, parse)
612
613#define pcmcia_validate_cis(p_dev, info) \
614 pccard_validate_cis(p_dev->socket, p_dev->func, info)
615
616#endif /* LINUX_CISTPL_H */ 578#endif /* LINUX_CISTPL_H */
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index 45d84b275789..904468a191ef 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -28,72 +28,16 @@ typedef struct conf_reg_t {
28#define CS_WRITE 2 28#define CS_WRITE 2
29 29
30/* for AdjustResourceInfo */ 30/* for AdjustResourceInfo */
31typedef struct adjust_t {
32 u_int Action;
33 u_int Resource;
34 u_int Attributes;
35 union {
36 struct memory {
37 u_long Base;
38 u_long Size;
39 } memory;
40 struct io {
41 ioaddr_t BasePort;
42 ioaddr_t NumPorts;
43 u_int IOAddrLines;
44 } io;
45 struct irq {
46 u_int IRQ;
47 } irq;
48 } resource;
49} adjust_t;
50
51/* Action field */ 31/* Action field */
52#define REMOVE_MANAGED_RESOURCE 1 32#define REMOVE_MANAGED_RESOURCE 1
53#define ADD_MANAGED_RESOURCE 2 33#define ADD_MANAGED_RESOURCE 2
54#define GET_FIRST_MANAGED_RESOURCE 3 34
55#define GET_NEXT_MANAGED_RESOURCE 4
56/* Resource field */
57#define RES_MEMORY_RANGE 1
58#define RES_IO_RANGE 2
59#define RES_IRQ 3
60/* Attribute field */
61#define RES_IRQ_TYPE 0x03
62#define RES_IRQ_TYPE_EXCLUSIVE 0
63#define RES_IRQ_TYPE_TIME 1
64#define RES_IRQ_TYPE_DYNAMIC 2
65#define RES_IRQ_CSC 0x04
66#define RES_SHARED 0x08
67#define RES_RESERVED 0x10
68#define RES_ALLOCATED 0x20
69#define RES_REMOVED 0x40
70 35
71typedef struct event_callback_args_t { 36typedef struct event_callback_args_t {
72 struct pcmcia_device *client_handle; 37 struct pcmcia_device *client_handle;
73 void *client_data; 38 void *client_data;
74} event_callback_args_t; 39} event_callback_args_t;
75 40
76/* for GetConfigurationInfo */
77typedef struct config_info_t {
78 u_char Function;
79 u_int Attributes;
80 u_int Vcc, Vpp1, Vpp2;
81 u_int IntType;
82 u_int ConfigBase;
83 u_char Status, Pin, Copy, Option, ExtStatus;
84 u_int Present;
85 u_int CardValues;
86 u_int AssignedIRQ;
87 u_int IRQAttributes;
88 ioaddr_t BasePort1;
89 ioaddr_t NumPorts1;
90 u_int Attributes1;
91 ioaddr_t BasePort2;
92 ioaddr_t NumPorts2;
93 u_int Attributes2;
94 u_int IOAddrLines;
95} config_info_t;
96
97/* For CardValues field */ 41/* For CardValues field */
98#define CV_OPTION_VALUE 0x01 42#define CV_OPTION_VALUE 0x01
99#define CV_STATUS_VALUE 0x02 43#define CV_STATUS_VALUE 0x02
@@ -257,22 +201,6 @@ typedef struct win_req_t {
257#define WIN_BAR_MASK 0xe000 201#define WIN_BAR_MASK 0xe000
258#define WIN_BAR_SHIFT 13 202#define WIN_BAR_SHIFT 13
259 203
260/* Attributes for RegisterClient -- UNUSED -- */
261#define INFO_MASTER_CLIENT 0x01
262#define INFO_IO_CLIENT 0x02
263#define INFO_MTD_CLIENT 0x04
264#define INFO_MEM_CLIENT 0x08
265#define MAX_NUM_CLIENTS 3
266
267#define INFO_CARD_SHARE 0x10
268#define INFO_CARD_EXCL 0x20
269
270typedef struct cs_status_t {
271 u_char Function;
272 event_t CardState;
273 event_t SocketState;
274} cs_status_t;
275
276typedef struct error_info_t { 204typedef struct error_info_t {
277 int func; 205 int func;
278 int retcode; 206 int retcode;
@@ -308,95 +236,4 @@ typedef struct error_info_t {
308#define CS_EVENT_3VCARD 0x200000 236#define CS_EVENT_3VCARD 0x200000
309#define CS_EVENT_XVCARD 0x400000 237#define CS_EVENT_XVCARD 0x400000
310 238
311/* Return codes */
312#define CS_SUCCESS 0x00
313#define CS_BAD_ADAPTER 0x01
314#define CS_BAD_ATTRIBUTE 0x02
315#define CS_BAD_BASE 0x03
316#define CS_BAD_EDC 0x04
317#define CS_BAD_IRQ 0x06
318#define CS_BAD_OFFSET 0x07
319#define CS_BAD_PAGE 0x08
320#define CS_READ_FAILURE 0x09
321#define CS_BAD_SIZE 0x0a
322#define CS_BAD_SOCKET 0x0b
323#define CS_BAD_TYPE 0x0d
324#define CS_BAD_VCC 0x0e
325#define CS_BAD_VPP 0x0f
326#define CS_BAD_WINDOW 0x11
327#define CS_WRITE_FAILURE 0x12
328#define CS_NO_CARD 0x14
329#define CS_UNSUPPORTED_FUNCTION 0x15
330#define CS_UNSUPPORTED_MODE 0x16
331#define CS_BAD_SPEED 0x17
332#define CS_BUSY 0x18
333#define CS_GENERAL_FAILURE 0x19
334#define CS_WRITE_PROTECTED 0x1a
335#define CS_BAD_ARG_LENGTH 0x1b
336#define CS_BAD_ARGS 0x1c
337#define CS_CONFIGURATION_LOCKED 0x1d
338#define CS_IN_USE 0x1e
339#define CS_NO_MORE_ITEMS 0x1f
340#define CS_OUT_OF_RESOURCE 0x20
341#define CS_BAD_HANDLE 0x21
342
343#define CS_BAD_TUPLE 0x40
344
345#ifdef __KERNEL__
346
347/*
348 * The main Card Services entry point
349 */
350
351enum service {
352 AccessConfigurationRegister, AddSocketServices,
353 AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory,
354 DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo,
355 GetClientInfo, GetConfigurationInfo, GetEventMask,
356 GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple,
357 GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple,
358 GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage,
359 MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow,
360 OpenMemory, ParseTuple, ReadMemory, RegisterClient,
361 RegisterEraseQueue, RegisterMTD, RegisterTimer,
362 ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ,
363 ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices,
364 RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ,
365 RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry,
366 SetEventMask, SetRegion, ValidateCIS, VendorSpecific,
367 WriteMemory, BindDevice, BindMTD, ReportError,
368 SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS,
369 GetFirstWindow, GetNextWindow, GetMemPage
370};
371
372struct pcmcia_socket;
373
374int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg);
375int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config);
376int pcmcia_get_mem_page(window_handle_t win, memreq_t *req);
377int pcmcia_map_mem_page(window_handle_t win, memreq_t *req);
378int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod);
379int pcmcia_release_window(window_handle_t win);
380int pcmcia_request_configuration(struct pcmcia_device *p_dev, config_req_t *req);
381int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req);
382int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req);
383int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_handle_t *wh);
384int pcmcia_suspend_card(struct pcmcia_socket *skt);
385int pcmcia_resume_card(struct pcmcia_socket *skt);
386int pcmcia_eject_card(struct pcmcia_socket *skt);
387int pcmcia_insert_card(struct pcmcia_socket *skt);
388int pccard_reset_card(struct pcmcia_socket *skt);
389
390struct pcmcia_device * pcmcia_dev_present(struct pcmcia_device *p_dev);
391void pcmcia_disable_device(struct pcmcia_device *p_dev);
392
393struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt);
394void pcmcia_put_socket(struct pcmcia_socket *skt);
395
396/* compatibility functions */
397#define pcmcia_reset_card(p_dev, req) \
398 pccard_reset_card(p_dev->socket)
399
400#endif /* __KERNEL__ */
401
402#endif /* _LINUX_CS_H */ 239#endif /* _LINUX_CS_H */
diff --git a/include/pcmcia/cs_types.h b/include/pcmcia/cs_types.h
index f402a0f435b4..315965a37930 100644
--- a/include/pcmcia/cs_types.h
+++ b/include/pcmcia/cs_types.h
@@ -21,14 +21,6 @@
21#include <sys/types.h> 21#include <sys/types.h>
22#endif 22#endif
23 23
24#if defined(__arm__) || defined(__mips__) || defined(__avr32__) || \
25 defined(__bfin__)
26/* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */
27typedef u_int ioaddr_t;
28#else
29typedef u_short ioaddr_t;
30#endif
31
32typedef u_short socket_t; 24typedef u_short socket_t;
33typedef u_int event_t; 25typedef u_int event_t;
34typedef u_char cisdata_t; 26typedef u_char cisdata_t;
diff --git a/include/pcmcia/device_id.h b/include/pcmcia/device_id.h
index e04e0b0d9a25..c33ea08352b8 100644
--- a/include/pcmcia/device_id.h
+++ b/include/pcmcia/device_id.h
@@ -1,10 +1,19 @@
1/* 1/*
2 * Copyright (2003-2004) Dominik Brodowski <linux@brodo.de> 2 * device_id.h -- PCMCIA driver matching helpers
3 * David Woodhouse
4 * 3 *
5 * License: GPL v2 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * (C) 2003 - 2004 David Woodhouse
9 * (C) 2003 - 2004 Dominik Brodowski
6 */ 10 */
7 11
12#ifndef _LINUX_PCMCIA_DEVICE_ID_H
13#define _LINUX_PCMCIA_DEVICE_ID_H
14
15#ifdef __KERNEL__
16
8#define PCMCIA_DEVICE_MANF_CARD(manf, card) { \ 17#define PCMCIA_DEVICE_MANF_CARD(manf, card) { \
9 .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ 18 .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
10 PCMCIA_DEV_ID_MATCH_CARD_ID, \ 19 PCMCIA_DEV_ID_MATCH_CARD_ID, \
@@ -256,3 +265,6 @@
256 265
257 266
258#define PCMCIA_DEVICE_NULL { .match_flags = 0, } 267#define PCMCIA_DEVICE_NULL { .match_flags = 0, }
268
269#endif /* __KERNEL__ */
270#endif /* _LINUX_PCMCIA_DEVICE_ID_H */
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index b316027c853d..a2be80b9a095 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -10,7 +10,7 @@
10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
11 * 11 *
12 * (C) 1999 David A. Hinds 12 * (C) 1999 David A. Hinds
13 * (C) 2003 - 2004 Dominik Brodowski 13 * (C) 2003 - 2008 Dominik Brodowski
14 */ 14 */
15 15
16#ifndef _LINUX_DS_H 16#ifndef _LINUX_DS_H
@@ -23,108 +23,21 @@
23#include <pcmcia/cs_types.h> 23#include <pcmcia/cs_types.h>
24#include <pcmcia/device_id.h> 24#include <pcmcia/device_id.h>
25 25
26typedef struct tuple_parse_t {
27 tuple_t tuple;
28 cisdata_t data[255];
29 cisparse_t parse;
30} tuple_parse_t;
31
32typedef struct win_info_t {
33 window_handle_t handle;
34 win_req_t window;
35 memreq_t map;
36} win_info_t;
37
38typedef struct bind_info_t {
39 dev_info_t dev_info;
40 u_char function;
41 struct pcmcia_device *instance;
42 char name[DEV_NAME_LEN];
43 u_short major, minor;
44 void *next;
45} bind_info_t;
46
47typedef struct mtd_info_t {
48 dev_info_t dev_info;
49 u_int Attributes;
50 u_int CardOffset;
51} mtd_info_t;
52
53typedef struct region_info_t {
54 u_int Attributes;
55 u_int CardOffset;
56 u_int RegionSize;
57 u_int AccessSpeed;
58 u_int BlockSize;
59 u_int PartMultiple;
60 u_char JedecMfr, JedecInfo;
61 memory_handle_t next;
62} region_info_t;
63#define REGION_TYPE 0x0001
64#define REGION_TYPE_CM 0x0000
65#define REGION_TYPE_AM 0x0001
66#define REGION_PREFETCH 0x0008
67#define REGION_CACHEABLE 0x0010
68#define REGION_BAR_MASK 0xe000
69#define REGION_BAR_SHIFT 13
70
71typedef union ds_ioctl_arg_t {
72 adjust_t adjust;
73 config_info_t config;
74 tuple_t tuple;
75 tuple_parse_t tuple_parse;
76 client_req_t client_req;
77 cs_status_t status;
78 conf_reg_t conf_reg;
79 cisinfo_t cisinfo;
80 region_info_t region;
81 bind_info_t bind_info;
82 mtd_info_t mtd_info;
83 win_info_t win_info;
84 cisdump_t cisdump;
85} ds_ioctl_arg_t;
86
87#define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t)
88#define DS_GET_CONFIGURATION_INFO _IOWR('d', 3, config_info_t)
89#define DS_GET_FIRST_TUPLE _IOWR('d', 4, tuple_t)
90#define DS_GET_NEXT_TUPLE _IOWR('d', 5, tuple_t)
91#define DS_GET_TUPLE_DATA _IOWR('d', 6, tuple_parse_t)
92#define DS_PARSE_TUPLE _IOWR('d', 7, tuple_parse_t)
93#define DS_RESET_CARD _IO ('d', 8)
94#define DS_GET_STATUS _IOWR('d', 9, cs_status_t)
95#define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t)
96#define DS_VALIDATE_CIS _IOR ('d', 11, cisinfo_t)
97#define DS_SUSPEND_CARD _IO ('d', 12)
98#define DS_RESUME_CARD _IO ('d', 13)
99#define DS_EJECT_CARD _IO ('d', 14)
100#define DS_INSERT_CARD _IO ('d', 15)
101#define DS_GET_FIRST_REGION _IOWR('d', 16, region_info_t)
102#define DS_GET_NEXT_REGION _IOWR('d', 17, region_info_t)
103#define DS_REPLACE_CIS _IOWR('d', 18, cisdump_t)
104#define DS_GET_FIRST_WINDOW _IOR ('d', 19, win_info_t)
105#define DS_GET_NEXT_WINDOW _IOWR('d', 20, win_info_t)
106#define DS_GET_MEM_PAGE _IOWR('d', 21, win_info_t)
107
108#define DS_BIND_REQUEST _IOWR('d', 60, bind_info_t)
109#define DS_GET_DEVICE_INFO _IOWR('d', 61, bind_info_t)
110#define DS_GET_NEXT_DEVICE _IOWR('d', 62, bind_info_t)
111#define DS_UNBIND_REQUEST _IOW ('d', 63, bind_info_t)
112#define DS_BIND_MTD _IOWR('d', 64, mtd_info_t)
113
114#ifdef __KERNEL__ 26#ifdef __KERNEL__
115#include <linux/device.h> 27#include <linux/device.h>
116#include <pcmcia/ss.h> 28#include <pcmcia/ss.h>
117 29
118typedef struct dev_node_t { 30/*
119 char dev_name[DEV_NAME_LEN]; 31 * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus
120 u_short major, minor; 32 * a.k.a. PCI drivers
121 struct dev_node_t *next; 33 */
122} dev_node_t;
123
124
125struct pcmcia_socket; 34struct pcmcia_socket;
35struct pcmcia_device;
126struct config_t; 36struct config_t;
127 37
38/* dynamic device IDs for PCMCIA device drivers. See
39 * Documentation/pcmcia/driver.txt for details.
40*/
128struct pcmcia_dynids { 41struct pcmcia_dynids {
129 spinlock_t lock; 42 spinlock_t lock;
130 struct list_head list; 43 struct list_head list;
@@ -147,6 +60,14 @@ struct pcmcia_driver {
147int pcmcia_register_driver(struct pcmcia_driver *driver); 60int pcmcia_register_driver(struct pcmcia_driver *driver);
148void pcmcia_unregister_driver(struct pcmcia_driver *driver); 61void pcmcia_unregister_driver(struct pcmcia_driver *driver);
149 62
63/* Some drivers use dev_node_t to store char or block device information.
64 * Don't use this in new drivers, though.
65 */
66typedef struct dev_node_t {
67 char dev_name[DEV_NAME_LEN];
68 u_short major, minor;
69 struct dev_node_t *next;
70} dev_node_t;
150 71
151struct pcmcia_device { 72struct pcmcia_device {
152 /* the socket and the device_no [for multifunction devices] 73 /* the socket and the device_no [for multifunction devices]
@@ -216,10 +137,304 @@ struct pcmcia_device {
216#define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev) 137#define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev)
217#define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv) 138#define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv)
218 139
140/* deprecated -- don't use! */
219#define handle_to_dev(handle) (handle->dev) 141#define handle_to_dev(handle) (handle->dev)
220 142
221/* error reporting */ 143
222void cs_error(struct pcmcia_device *handle, int func, int ret); 144/* (deprecated) error reporting by PCMCIA devices. Use dev_printk()
145 * or dev_dbg() directly in the driver, without referring to pcmcia_error_func()
146 * and/or pcmcia_error_ret() for those functions will go away soon.
147 */
148enum service {
149 AccessConfigurationRegister, AddSocketServices,
150 AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory,
151 DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo,
152 GetClientInfo, GetConfigurationInfo, GetEventMask,
153 GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple,
154 GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple,
155 GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage,
156 MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow,
157 OpenMemory, ParseTuple, ReadMemory, RegisterClient,
158 RegisterEraseQueue, RegisterMTD, RegisterTimer,
159 ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ,
160 ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices,
161 RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ,
162 RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry,
163 SetEventMask, SetRegion, ValidateCIS, VendorSpecific,
164 WriteMemory, BindDevice, BindMTD, ReportError,
165 SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS,
166 GetFirstWindow, GetNextWindow, GetMemPage
167};
168const char *pcmcia_error_func(int func);
169const char *pcmcia_error_ret(int ret);
170
171#define cs_error(p_dev, func, ret) \
172 { \
173 dev_printk(KERN_NOTICE, &p_dev->dev, \
174 "%s : %s\n", \
175 pcmcia_error_func(func), \
176 pcmcia_error_ret(ret)); \
177 }
178
179/* CIS access.
180 * Use the pcmcia_* versions in PCMCIA drivers
181 */
182int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse);
183
184int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function,
185 tuple_t *tuple);
186#define pcmcia_get_first_tuple(p_dev, tuple) \
187 pccard_get_first_tuple(p_dev->socket, p_dev->func, tuple)
188
189int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function,
190 tuple_t *tuple);
191#define pcmcia_get_next_tuple(p_dev, tuple) \
192 pccard_get_next_tuple(p_dev->socket, p_dev->func, tuple)
193
194int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple);
195#define pcmcia_get_tuple_data(p_dev, tuple) \
196 pccard_get_tuple_data(p_dev->socket, tuple)
197
198
199/* loop CIS entries for valid configuration */
200int pcmcia_loop_config(struct pcmcia_device *p_dev,
201 int (*conf_check) (struct pcmcia_device *p_dev,
202 cistpl_cftable_entry_t *cf,
203 cistpl_cftable_entry_t *dflt,
204 unsigned int vcc,
205 void *priv_data),
206 void *priv_data);
207
208/* is the device still there? */
209struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *p_dev);
210
211/* low-level interface reset */
212int pcmcia_reset_card(struct pcmcia_socket *skt);
213
214/* CIS config */
215int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
216 conf_reg_t *reg);
217
218/* device configuration */
219int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req);
220int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req);
221int pcmcia_request_configuration(struct pcmcia_device *p_dev,
222 config_req_t *req);
223
224int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req,
225 window_handle_t *wh);
226int pcmcia_release_window(window_handle_t win);
227
228int pcmcia_get_mem_page(window_handle_t win, memreq_t *req);
229int pcmcia_map_mem_page(window_handle_t win, memreq_t *req);
230
231int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod);
232void pcmcia_disable_device(struct pcmcia_device *p_dev);
223 233
224#endif /* __KERNEL__ */ 234#endif /* __KERNEL__ */
235
236
237
238/* Below, there are only definitions which are used by
239 * - the PCMCIA ioctl
240 * - deprecated PCMCIA userspace tools only
241 *
242 * here be dragons ... here be dragons ... here be dragons ... here be drag
243 */
244
245#if defined(CONFIG_PCMCIA_IOCTL) || !defined(__KERNEL__)
246
247#if defined(__arm__) || defined(__mips__) || defined(__avr32__) || \
248 defined(__bfin__)
249/* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */
250typedef u_int ioaddr_t;
251#else
252typedef u_short ioaddr_t;
253#endif
254
255/* for AdjustResourceInfo */
256typedef struct adjust_t {
257 u_int Action;
258 u_int Resource;
259 u_int Attributes;
260 union {
261 struct memory {
262 u_long Base;
263 u_long Size;
264 } memory;
265 struct io {
266 ioaddr_t BasePort;
267 ioaddr_t NumPorts;
268 u_int IOAddrLines;
269 } io;
270 struct irq {
271 u_int IRQ;
272 } irq;
273 } resource;
274} adjust_t;
275
276/* Action field */
277#define REMOVE_MANAGED_RESOURCE 1
278#define ADD_MANAGED_RESOURCE 2
279#define GET_FIRST_MANAGED_RESOURCE 3
280#define GET_NEXT_MANAGED_RESOURCE 4
281/* Resource field */
282#define RES_MEMORY_RANGE 1
283#define RES_IO_RANGE 2
284#define RES_IRQ 3
285/* Attribute field */
286#define RES_IRQ_TYPE 0x03
287#define RES_IRQ_TYPE_EXCLUSIVE 0
288#define RES_IRQ_TYPE_TIME 1
289#define RES_IRQ_TYPE_DYNAMIC 2
290#define RES_IRQ_CSC 0x04
291#define RES_SHARED 0x08
292#define RES_RESERVED 0x10
293#define RES_ALLOCATED 0x20
294#define RES_REMOVED 0x40
295
296
297typedef struct tuple_parse_t {
298 tuple_t tuple;
299 cisdata_t data[255];
300 cisparse_t parse;
301} tuple_parse_t;
302
303typedef struct win_info_t {
304 window_handle_t handle;
305 win_req_t window;
306 memreq_t map;
307} win_info_t;
308
309typedef struct bind_info_t {
310 dev_info_t dev_info;
311 u_char function;
312 struct pcmcia_device *instance;
313 char name[DEV_NAME_LEN];
314 u_short major, minor;
315 void *next;
316} bind_info_t;
317
318typedef struct mtd_info_t {
319 dev_info_t dev_info;
320 u_int Attributes;
321 u_int CardOffset;
322} mtd_info_t;
323
324typedef struct region_info_t {
325 u_int Attributes;
326 u_int CardOffset;
327 u_int RegionSize;
328 u_int AccessSpeed;
329 u_int BlockSize;
330 u_int PartMultiple;
331 u_char JedecMfr, JedecInfo;
332 memory_handle_t next;
333} region_info_t;
334
335#define REGION_TYPE 0x0001
336#define REGION_TYPE_CM 0x0000
337#define REGION_TYPE_AM 0x0001
338#define REGION_PREFETCH 0x0008
339#define REGION_CACHEABLE 0x0010
340#define REGION_BAR_MASK 0xe000
341#define REGION_BAR_SHIFT 13
342
343/* For ReplaceCIS */
344typedef struct cisdump_t {
345 u_int Length;
346 cisdata_t Data[CISTPL_MAX_CIS_SIZE];
347} cisdump_t;
348
349/* for GetConfigurationInfo */
350typedef struct config_info_t {
351 u_char Function;
352 u_int Attributes;
353 u_int Vcc, Vpp1, Vpp2;
354 u_int IntType;
355 u_int ConfigBase;
356 u_char Status, Pin, Copy, Option, ExtStatus;
357 u_int Present;
358 u_int CardValues;
359 u_int AssignedIRQ;
360 u_int IRQAttributes;
361 ioaddr_t BasePort1;
362 ioaddr_t NumPorts1;
363 u_int Attributes1;
364 ioaddr_t BasePort2;
365 ioaddr_t NumPorts2;
366 u_int Attributes2;
367 u_int IOAddrLines;
368} config_info_t;
369
370/* For ValidateCIS */
371typedef struct cisinfo_t {
372 u_int Chains;
373} cisinfo_t;
374
375typedef struct cs_status_t {
376 u_char Function;
377 event_t CardState;
378 event_t SocketState;
379} cs_status_t;
380
381typedef union ds_ioctl_arg_t {
382 adjust_t adjust;
383 config_info_t config;
384 tuple_t tuple;
385 tuple_parse_t tuple_parse;
386 client_req_t client_req;
387 cs_status_t status;
388 conf_reg_t conf_reg;
389 cisinfo_t cisinfo;
390 region_info_t region;
391 bind_info_t bind_info;
392 mtd_info_t mtd_info;
393 win_info_t win_info;
394 cisdump_t cisdump;
395} ds_ioctl_arg_t;
396
397#define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t)
398#define DS_GET_CONFIGURATION_INFO _IOWR('d', 3, config_info_t)
399#define DS_GET_FIRST_TUPLE _IOWR('d', 4, tuple_t)
400#define DS_GET_NEXT_TUPLE _IOWR('d', 5, tuple_t)
401#define DS_GET_TUPLE_DATA _IOWR('d', 6, tuple_parse_t)
402#define DS_PARSE_TUPLE _IOWR('d', 7, tuple_parse_t)
403#define DS_RESET_CARD _IO ('d', 8)
404#define DS_GET_STATUS _IOWR('d', 9, cs_status_t)
405#define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t)
406#define DS_VALIDATE_CIS _IOR ('d', 11, cisinfo_t)
407#define DS_SUSPEND_CARD _IO ('d', 12)
408#define DS_RESUME_CARD _IO ('d', 13)
409#define DS_EJECT_CARD _IO ('d', 14)
410#define DS_INSERT_CARD _IO ('d', 15)
411#define DS_GET_FIRST_REGION _IOWR('d', 16, region_info_t)
412#define DS_GET_NEXT_REGION _IOWR('d', 17, region_info_t)
413#define DS_REPLACE_CIS _IOWR('d', 18, cisdump_t)
414#define DS_GET_FIRST_WINDOW _IOR ('d', 19, win_info_t)
415#define DS_GET_NEXT_WINDOW _IOWR('d', 20, win_info_t)
416#define DS_GET_MEM_PAGE _IOWR('d', 21, win_info_t)
417
418#define DS_BIND_REQUEST _IOWR('d', 60, bind_info_t)
419#define DS_GET_DEVICE_INFO _IOWR('d', 61, bind_info_t)
420#define DS_GET_NEXT_DEVICE _IOWR('d', 62, bind_info_t)
421#define DS_UNBIND_REQUEST _IOW ('d', 63, bind_info_t)
422#define DS_BIND_MTD _IOWR('d', 64, mtd_info_t)
423
424
425/* used in userspace only */
426#define CS_IN_USE 0x1e
427
428#define INFO_MASTER_CLIENT 0x01
429#define INFO_IO_CLIENT 0x02
430#define INFO_MTD_CLIENT 0x04
431#define INFO_MEM_CLIENT 0x08
432#define MAX_NUM_CLIENTS 3
433
434#define INFO_CARD_SHARE 0x10
435#define INFO_CARD_EXCL 0x20
436
437
438#endif /* !defined(__KERNEL__) || defined(CONFIG_PCMCIA_IOCTL) */
439
225#endif /* _LINUX_DS_H */ 440#endif /* _LINUX_DS_H */
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index ed919dd9bb5c..9b4ac9385f5d 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -53,10 +53,10 @@
53 53
54/* for GetSocket, SetSocket */ 54/* for GetSocket, SetSocket */
55typedef struct socket_state_t { 55typedef struct socket_state_t {
56 u_int flags; 56 u_int flags;
57 u_int csc_mask; 57 u_int csc_mask;
58 u_char Vcc, Vpp; 58 u_char Vcc, Vpp;
59 u_char io_irq; 59 u_char io_irq;
60} socket_state_t; 60} socket_state_t;
61 61
62extern socket_state_t dead_socket; 62extern socket_state_t dead_socket;
@@ -86,79 +86,22 @@ extern socket_state_t dead_socket;
86#define HOOK_POWER_PRE 0x01 86#define HOOK_POWER_PRE 0x01
87#define HOOK_POWER_POST 0x02 87#define HOOK_POWER_POST 0x02
88 88
89
90typedef struct pccard_io_map { 89typedef struct pccard_io_map {
91 u_char map; 90 u_char map;
92 u_char flags; 91 u_char flags;
93 u_short speed; 92 u_short speed;
94 u_int start, stop; 93 u_int start, stop;
95} pccard_io_map; 94} pccard_io_map;
96 95
97typedef struct pccard_mem_map { 96typedef struct pccard_mem_map {
98 u_char map; 97 u_char map;
99 u_char flags; 98 u_char flags;
100 u_short speed; 99 u_short speed;
101 u_long static_start; 100 u_long static_start;
102 u_int card_start; 101 u_int card_start;
103 struct resource *res; 102 struct resource *res;
104} pccard_mem_map; 103} pccard_mem_map;
105 104
106typedef struct cb_bridge_map {
107 u_char map;
108 u_char flags;
109 u_int start, stop;
110} cb_bridge_map;
111
112/*
113 * Socket operations.
114 */
115struct pcmcia_socket;
116
117struct pccard_operations {
118 int (*init)(struct pcmcia_socket *sock);
119 int (*suspend)(struct pcmcia_socket *sock);
120 int (*get_status)(struct pcmcia_socket *sock, u_int *value);
121 int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state);
122 int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io);
123 int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem);
124};
125
126struct pccard_resource_ops {
127 int (*validate_mem) (struct pcmcia_socket *s);
128 int (*adjust_io_region) (struct resource *res,
129 unsigned long r_start,
130 unsigned long r_end,
131 struct pcmcia_socket *s);
132 struct resource* (*find_io) (unsigned long base, int num,
133 unsigned long align,
134 struct pcmcia_socket *s);
135 struct resource* (*find_mem) (unsigned long base, unsigned long num,
136 unsigned long align, int low,
137 struct pcmcia_socket *s);
138 int (*add_io) (struct pcmcia_socket *s,
139 unsigned int action,
140 unsigned long r_start,
141 unsigned long r_end);
142 int (*add_mem) (struct pcmcia_socket *s,
143 unsigned int action,
144 unsigned long r_start,
145 unsigned long r_end);
146 int (*init) (struct pcmcia_socket *s);
147 void (*exit) (struct pcmcia_socket *s);
148};
149/* SS_CAP_STATIC_MAP */
150extern struct pccard_resource_ops pccard_static_ops;
151/* !SS_CAP_STATIC_MAP */
152extern struct pccard_resource_ops pccard_nonstatic_ops;
153
154/* static mem, dynamic IO sockets */
155extern struct pccard_resource_ops pccard_iodyn_ops;
156
157/*
158 * Calls to set up low-level "Socket Services" drivers
159 */
160struct pcmcia_socket;
161
162typedef struct io_window_t { 105typedef struct io_window_t {
163 u_int InUse, Config; 106 u_int InUse, Config;
164 struct resource *res; 107 struct resource *res;
@@ -179,10 +122,25 @@ typedef struct window_t {
179/* Maximum number of memory windows per socket */ 122/* Maximum number of memory windows per socket */
180#define MAX_WIN 4 123#define MAX_WIN 4
181 124
125
126/*
127 * Socket operations.
128 */
129struct pcmcia_socket;
130struct pccard_resource_ops;
182struct config_t; 131struct config_t;
183struct pcmcia_callback; 132struct pcmcia_callback;
184struct user_info_t; 133struct user_info_t;
185 134
135struct pccard_operations {
136 int (*init)(struct pcmcia_socket *s);
137 int (*suspend)(struct pcmcia_socket *s);
138 int (*get_status)(struct pcmcia_socket *s, u_int *value);
139 int (*set_socket)(struct pcmcia_socket *s, socket_state_t *state);
140 int (*set_io_map)(struct pcmcia_socket *s, struct pccard_io_map *io);
141 int (*set_mem_map)(struct pcmcia_socket *s, struct pccard_mem_map *mem);
142};
143
186struct pcmcia_socket { 144struct pcmcia_socket {
187 struct module *owner; 145 struct module *owner;
188 spinlock_t lock; 146 spinlock_t lock;
@@ -199,8 +157,8 @@ struct pcmcia_socket {
199 io_window_t io[MAX_IO_WIN]; 157 io_window_t io[MAX_IO_WIN];
200 window_t win[MAX_WIN]; 158 window_t win[MAX_WIN];
201 struct list_head cis_cache; 159 struct list_head cis_cache;
202 u_int fake_cis_len; 160 size_t fake_cis_len;
203 char *fake_cis; 161 u8 *fake_cis;
204 162
205 struct list_head socket_list; 163 struct list_head socket_list;
206 struct completion socket_released; 164 struct completion socket_released;
@@ -218,12 +176,12 @@ struct pcmcia_socket {
218 struct pci_dev * cb_dev; 176 struct pci_dev * cb_dev;
219 177
220 178
221 /* socket setup is done so resources should be able to be allocated. Only 179 /* socket setup is done so resources should be able to be allocated.
222 * if set to 1, calls to find_{io,mem}_region are handled, and insertion 180 * Only if set to 1, calls to find_{io,mem}_region are handled, and
223 * events are actually managed by the PCMCIA layer.*/ 181 * insertio events are actually managed by the PCMCIA layer.*/
224 u8 resource_setup_done:1; 182 u8 resource_setup_done:1;
225 183
226 /* is set to one if resource setup is done using adjust_resource_info() */ 184 /* It's old if resource setup is done using adjust_resource_info() */
227 u8 resource_setup_old:1; 185 u8 resource_setup_old:1;
228 u8 resource_setup_new:1; 186 u8 resource_setup_new:1;
229 187
@@ -236,75 +194,101 @@ struct pcmcia_socket {
236 194
237 /* Zoom video behaviour is so chip specific its not worth adding 195 /* Zoom video behaviour is so chip specific its not worth adding
238 this to _ops */ 196 this to _ops */
239 void (*zoom_video)(struct pcmcia_socket *, int); 197 void (*zoom_video)(struct pcmcia_socket *,
198 int);
240 199
241 /* so is power hook */ 200 /* so is power hook */
242 int (*power_hook)(struct pcmcia_socket *sock, int operation); 201 int (*power_hook)(struct pcmcia_socket *sock, int operation);
243#ifdef CONFIG_CARDBUS 202
244 /* allows tuning the CB bridge before loading driver for the CB card */ 203 /* allows tuning the CB bridge before loading driver for the CB card */
204#ifdef CONFIG_CARDBUS
245 void (*tune_bridge)(struct pcmcia_socket *sock, struct pci_bus *bus); 205 void (*tune_bridge)(struct pcmcia_socket *sock, struct pci_bus *bus);
246#endif 206#endif
247 207
248 /* state thread */ 208 /* state thread */
249 struct mutex skt_mutex; /* protects socket h/w state */
250
251 struct task_struct *thread; 209 struct task_struct *thread;
252 struct completion thread_done; 210 struct completion thread_done;
253 spinlock_t thread_lock; /* protects thread_events */
254 unsigned int thread_events; 211 unsigned int thread_events;
212 /* protects socket h/w state */
213 struct mutex skt_mutex;
214 /* protects thread_events */
215 spinlock_t thread_lock;
255 216
256 /* pcmcia (16-bit) */ 217 /* pcmcia (16-bit) */
257 struct pcmcia_callback *callback; 218 struct pcmcia_callback *callback;
258 219
259#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) 220#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
260 struct list_head devices_list; /* PCMCIA devices */ 221 /* The following elements refer to 16-bit PCMCIA devices inserted
261 u8 device_count; /* the number of devices, used 222 * into the socket */
262 * only internally and subject 223 struct list_head devices_list;
263 * to incorrectness and change */ 224
225 /* the number of devices, used only internally and subject to
226 * incorrectness and change */
227 u8 device_count;
264 228
229 /* 16-bit state: */
265 struct { 230 struct {
266 u8 present:1, /* PCMCIA card is present in socket */ 231 /* PCMCIA card is present in socket */
267 busy:1, /* "master" ioctl is used */ 232 u8 present:1;
268 dead:1, /* pcmcia module is being unloaded */ 233 /* "master" ioctl is used */
269 device_add_pending:1, /* a multifunction-device 234 u8 busy:1;
270 * add event is pending */ 235 /* pcmcia module is being unloaded */
271 mfc_pfc:1, /* the pending event adds a mfc (1) or pfc (0) */ 236 u8 dead:1;
272 reserved:3; 237 /* a multifunction-device add event is pending */
273 } pcmcia_state; 238 u8 device_add_pending:1;
274 239 /* the pending event adds a mfc (1) or pfc (0) */
275 struct work_struct device_add; /* for adding further pseudo-multifunction 240 u8 mfc_pfc:1;
276 * devices */ 241
242 u8 reserved:3;
243 } pcmcia_state;
244
245
246 /* for adding further pseudo-multifunction devices */
247 struct work_struct device_add;
277 248
278#ifdef CONFIG_PCMCIA_IOCTL 249#ifdef CONFIG_PCMCIA_IOCTL
279 struct user_info_t *user; 250 struct user_info_t *user;
280 wait_queue_head_t queue; 251 wait_queue_head_t queue;
281#endif 252#endif /* CONFIG_PCMCIA_IOCTL */
282#endif 253#endif /* CONFIG_PCMCIA */
283 254
284 /* cardbus (32-bit) */ 255 /* cardbus (32-bit) */
285#ifdef CONFIG_CARDBUS 256#ifdef CONFIG_CARDBUS
286 struct resource * cb_cis_res; 257 struct resource * cb_cis_res;
287 void __iomem *cb_cis_virt; 258 void __iomem *cb_cis_virt;
288#endif 259#endif /* CONFIG_CARDBUS */
289 260
290 /* socket device */ 261 /* socket device */
291 struct device dev; 262 struct device dev;
292 void *driver_data; /* data internal to the socket driver */ 263 /* data internal to the socket driver */
293 264 void *driver_data;
294}; 265};
295 266
296struct pcmcia_socket * pcmcia_get_socket_by_nr(unsigned int nr);
297 267
268/* socket drivers must define the resource operations type they use. There
269 * are three options:
270 * - pccard_static_ops iomem and ioport areas are assigned statically
271 * - pccard_iodyn_ops iomem areas is assigned statically, ioport
272 * areas dynamically
273 * - pccard_nonstatic_ops iomem and ioport areas are assigned dynamically.
274 * If this option is selected, use
275 * "select PCCARD_NONSTATIC" in Kconfig.
276 */
277extern struct pccard_resource_ops pccard_static_ops;
278extern struct pccard_resource_ops pccard_iodyn_ops;
279extern struct pccard_resource_ops pccard_nonstatic_ops;
298 280
281/* socket drivers are expected to use these callbacks in their .drv struct */
282extern int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state);
283extern int pcmcia_socket_dev_resume(struct device *dev);
284
285/* socket drivers use this callback in their IRQ handler */
286extern void pcmcia_parse_events(struct pcmcia_socket *socket,
287 unsigned int events);
299 288
300extern void pcmcia_parse_events(struct pcmcia_socket *socket, unsigned int events); 289/* to register and unregister a socket */
301extern int pcmcia_register_socket(struct pcmcia_socket *socket); 290extern int pcmcia_register_socket(struct pcmcia_socket *socket);
302extern void pcmcia_unregister_socket(struct pcmcia_socket *socket); 291extern void pcmcia_unregister_socket(struct pcmcia_socket *socket);
303 292
304extern struct class pcmcia_socket_class;
305
306/* socket drivers are expected to use these callbacks in their .drv struct */
307extern int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state);
308extern int pcmcia_socket_dev_resume(struct device *dev);
309 293
310#endif /* _LINUX_SS_H */ 294#endif /* _LINUX_SS_H */
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 16be12f1cbe8..0c9514de5df7 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -213,6 +213,8 @@ enum iscsi_err {
213 ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15, 213 ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15,
214 ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16, 214 ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16,
215 ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17, 215 ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17,
216 ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18,
217 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19,
216}; 218};
217 219
218/* 220/*
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 5e75bb7f311c..61e53f14f7e1 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -287,6 +287,11 @@ struct iscsi_session {
287 struct iscsi_pool cmdpool; /* PDU's pool */ 287 struct iscsi_pool cmdpool; /* PDU's pool */
288}; 288};
289 289
290enum {
291 ISCSI_HOST_SETUP,
292 ISCSI_HOST_REMOVED,
293};
294
290struct iscsi_host { 295struct iscsi_host {
291 char *initiatorname; 296 char *initiatorname;
292 /* hw address or netdev iscsi connection is bound to */ 297 /* hw address or netdev iscsi connection is bound to */
@@ -295,6 +300,12 @@ struct iscsi_host {
295 /* local address */ 300 /* local address */
296 int local_port; 301 int local_port;
297 char local_address[ISCSI_ADDRESS_BUF_LEN]; 302 char local_address[ISCSI_ADDRESS_BUF_LEN];
303
304 wait_queue_head_t session_removal_wq;
305 /* protects sessions and state */
306 spinlock_t lock;
307 int num_sessions;
308 int state;
298}; 309};
299 310
300/* 311/*
@@ -302,7 +313,7 @@ struct iscsi_host {
302 */ 313 */
303extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth); 314extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth);
304extern int iscsi_eh_abort(struct scsi_cmnd *sc); 315extern int iscsi_eh_abort(struct scsi_cmnd *sc);
305extern int iscsi_eh_host_reset(struct scsi_cmnd *sc); 316extern int iscsi_eh_target_reset(struct scsi_cmnd *sc);
306extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); 317extern int iscsi_eh_device_reset(struct scsi_cmnd *sc);
307extern int iscsi_queuecommand(struct scsi_cmnd *sc, 318extern int iscsi_queuecommand(struct scsi_cmnd *sc,
308 void (*done)(struct scsi_cmnd *)); 319 void (*done)(struct scsi_cmnd *));
@@ -351,6 +362,8 @@ extern void iscsi_conn_stop(struct iscsi_cls_conn *, int);
351extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *, 362extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *,
352 int); 363 int);
353extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err); 364extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err);
365extern void iscsi_session_failure(struct iscsi_cls_session *cls_session,
366 enum iscsi_err err);
354extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, 367extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
355 enum iscsi_param param, char *buf); 368 enum iscsi_param param, char *buf);
356extern void iscsi_suspend_tx(struct iscsi_conn *conn); 369extern void iscsi_suspend_tx(struct iscsi_conn *conn);
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 192f8716aa9e..a109165714d6 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -381,6 +381,11 @@ static inline int scsi_is_wlun(unsigned int lun)
381#define DID_IMM_RETRY 0x0c /* Retry without decrementing retry count */ 381#define DID_IMM_RETRY 0x0c /* Retry without decrementing retry count */
382#define DID_REQUEUE 0x0d /* Requeue command (no immediate retry) also 382#define DID_REQUEUE 0x0d /* Requeue command (no immediate retry) also
383 * without decrementing the retry count */ 383 * without decrementing the retry count */
384#define DID_TRANSPORT_DISRUPTED 0x0e /* Transport error disrupted execution
385 * and the driver blocked the port to
386 * recover the link. Transport class will
387 * retry or fail IO */
388#define DID_TRANSPORT_FAILFAST 0x0f /* Transport class fastfailed the io */
384#define DRIVER_OK 0x00 /* Driver status */ 389#define DRIVER_OK 0x00 /* Driver status */
385 390
386/* 391/*
@@ -426,6 +431,7 @@ static inline int scsi_is_wlun(unsigned int lun)
426#define SCSI_MLQUEUE_HOST_BUSY 0x1055 431#define SCSI_MLQUEUE_HOST_BUSY 0x1055
427#define SCSI_MLQUEUE_DEVICE_BUSY 0x1056 432#define SCSI_MLQUEUE_DEVICE_BUSY 0x1056
428#define SCSI_MLQUEUE_EH_RETRY 0x1057 433#define SCSI_MLQUEUE_EH_RETRY 0x1057
434#define SCSI_MLQUEUE_TARGET_BUSY 0x1058
429 435
430/* 436/*
431 * Use these to separate status msg and our bytes 437 * Use these to separate status msg and our bytes
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index b49e725be039..a37a8148a310 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -238,6 +238,16 @@ struct scsi_target {
238 * for the device at a time. */ 238 * for the device at a time. */
239 unsigned int pdt_1f_for_no_lun; /* PDT = 0x1f */ 239 unsigned int pdt_1f_for_no_lun; /* PDT = 0x1f */
240 /* means no lun present */ 240 /* means no lun present */
241 /* commands actually active on LLD. protected by host lock. */
242 unsigned int target_busy;
243 /*
244 * LLDs should set this in the slave_alloc host template callout.
245 * If set to zero then there is not limit.
246 */
247 unsigned int can_queue;
248 unsigned int target_blocked;
249 unsigned int max_target_blocked;
250#define SCSI_DEFAULT_TARGET_BLOCKED 3
241 251
242 char scsi_level; 252 char scsi_level;
243 struct execute_work ew; 253 struct execute_work ew;
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 21018a4df452..49d8913c4f86 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -357,6 +357,7 @@ struct fc_rport { /* aka fc_starget_attrs */
357/* bit field values for struct fc_rport "flags" field: */ 357/* bit field values for struct fc_rport "flags" field: */
358#define FC_RPORT_DEVLOSS_PENDING 0x01 358#define FC_RPORT_DEVLOSS_PENDING 0x01
359#define FC_RPORT_SCAN_PENDING 0x02 359#define FC_RPORT_SCAN_PENDING 0x02
360#define FC_RPORT_FAST_FAIL_TIMEDOUT 0x03
360 361
361#define dev_to_rport(d) \ 362#define dev_to_rport(d) \
362 container_of(d, struct fc_rport, dev) 363 container_of(d, struct fc_rport, dev)
@@ -678,12 +679,15 @@ fc_remote_port_chkready(struct fc_rport *rport)
678 if (rport->roles & FC_PORT_ROLE_FCP_TARGET) 679 if (rport->roles & FC_PORT_ROLE_FCP_TARGET)
679 result = 0; 680 result = 0;
680 else if (rport->flags & FC_RPORT_DEVLOSS_PENDING) 681 else if (rport->flags & FC_RPORT_DEVLOSS_PENDING)
681 result = DID_IMM_RETRY << 16; 682 result = DID_TRANSPORT_DISRUPTED << 16;
682 else 683 else
683 result = DID_NO_CONNECT << 16; 684 result = DID_NO_CONNECT << 16;
684 break; 685 break;
685 case FC_PORTSTATE_BLOCKED: 686 case FC_PORTSTATE_BLOCKED:
686 result = DID_IMM_RETRY << 16; 687 if (rport->flags & FC_RPORT_FAST_FAIL_TIMEDOUT)
688 result = DID_TRANSPORT_FAILFAST << 16;
689 else
690 result = DID_TRANSPORT_DISRUPTED << 16;
687 break; 691 break;
688 default: 692 default:
689 result = DID_NO_CONNECT << 16; 693 result = DID_NO_CONNECT << 16;
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 8b6c91df4c7a..c667cc396545 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -135,7 +135,8 @@ extern int iscsi_unregister_transport(struct iscsi_transport *tt);
135/* 135/*
136 * control plane upcalls 136 * control plane upcalls
137 */ 137 */
138extern void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error); 138extern void iscsi_conn_error_event(struct iscsi_cls_conn *conn,
139 enum iscsi_err error);
139extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, 140extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
140 char *data, uint32_t data_size); 141 char *data, uint32_t data_size);
141 142
@@ -207,7 +208,7 @@ extern void iscsi_host_for_each_session(struct Scsi_Host *shost,
207struct iscsi_endpoint { 208struct iscsi_endpoint {
208 void *dd_data; /* LLD private data */ 209 void *dd_data; /* LLD private data */
209 struct device dev; 210 struct device dev;
210 unsigned int id; 211 uint64_t id;
211}; 212};
212 213
213/* 214/*
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index c1b26fcc0b5c..ca699a3017f3 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -240,6 +240,7 @@ int snd_soc_dapm_sys_add(struct device *dev);
240/* dapm audio pin control and status */ 240/* dapm audio pin control and status */
241int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin); 241int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin);
242int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin); 242int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin);
243int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, char *pin);
243int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin); 244int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin);
244int snd_soc_dapm_sync(struct snd_soc_codec *codec); 245int snd_soc_dapm_sync(struct snd_soc_codec *codec);
245 246
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index b62ce3e077f9..b6870cbaf2b3 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -43,6 +43,7 @@ struct snd_tea575x {
43 unsigned int freq_fixup; /* crystal onboard */ 43 unsigned int freq_fixup; /* crystal onboard */
44 unsigned int val; /* hw value */ 44 unsigned int val; /* hw value */
45 unsigned long freq; /* frequency */ 45 unsigned long freq; /* frequency */
46 unsigned long in_use; /* set if the device is in use */
46 struct snd_tea575x_ops *ops; 47 struct snd_tea575x_ops *ops;
47 void *private_data; 48 void *private_data;
48}; 49};
diff --git a/include/video/cyblafb.h b/include/video/cyblafb.h
index 717440575380..d3c1d4e2c8e3 100644
--- a/include/video/cyblafb.h
+++ b/include/video/cyblafb.h
@@ -4,7 +4,7 @@
4#endif 4#endif
5 5
6#if CYBLAFB_DEBUG 6#if CYBLAFB_DEBUG
7#define debug(f,a...) printk("%s:" f, __FUNCTION__ , ## a); 7#define debug(f,a...) printk("%s:" f, __func__ , ## a);
8#else 8#else
9#define debug(f,a...) 9#define debug(f,a...)
10#endif 10#endif
diff --git a/include/video/neomagic.h b/include/video/neomagic.h
index 38910da0ae59..08b663782956 100644
--- a/include/video/neomagic.h
+++ b/include/video/neomagic.h
@@ -123,7 +123,6 @@ typedef volatile struct {
123 123
124struct neofb_par { 124struct neofb_par {
125 struct vgastate state; 125 struct vgastate state;
126 struct mutex open_lock;
127 unsigned int ref_count; 126 unsigned int ref_count;
128 127
129 unsigned char MiscOutReg; /* Misc */ 128 unsigned char MiscOutReg; /* Misc */
diff --git a/include/video/radeon.h b/include/video/radeon.h
index 099ffa5e5bee..d5dcaf154ba4 100644
--- a/include/video/radeon.h
+++ b/include/video/radeon.h
@@ -386,7 +386,7 @@
386#define SC_BOTTOM_RIGHT 0x16F0 386#define SC_BOTTOM_RIGHT 0x16F0
387#define SRC_SC_BOTTOM_RIGHT 0x16F4 387#define SRC_SC_BOTTOM_RIGHT 0x16F4
388#define RB2D_DSTCACHE_MODE 0x3428 388#define RB2D_DSTCACHE_MODE 0x3428
389#define RB2D_DSTCACHE_CTLSTAT 0x342C 389#define RB2D_DSTCACHE_CTLSTAT_broken 0x342C /* do not use */
390#define LVDS_GEN_CNTL 0x02d0 390#define LVDS_GEN_CNTL 0x02d0
391#define LVDS_PLL_CNTL 0x02d4 391#define LVDS_PLL_CNTL 0x02d4
392#define FP2_GEN_CNTL 0x0288 392#define FP2_GEN_CNTL 0x0288
@@ -525,6 +525,9 @@
525#define CRTC_DISPLAY_DIS (1 << 10) 525#define CRTC_DISPLAY_DIS (1 << 10)
526#define CRTC_CRT_ON (1 << 15) 526#define CRTC_CRT_ON (1 << 15)
527 527
528/* DSTCACHE_MODE bits constants */
529#define RB2D_DC_AUTOFLUSH_ENABLE (1 << 8)
530#define RB2D_DC_DC_DISABLE_IGNORE_PE (1 << 17)
528 531
529/* DSTCACHE_CTLSTAT bit constants */ 532/* DSTCACHE_CTLSTAT bit constants */
530#define RB2D_DC_FLUSH_2D (1 << 0) 533#define RB2D_DC_FLUSH_2D (1 << 0)
@@ -532,6 +535,9 @@
532#define RB2D_DC_FLUSH_ALL (RB2D_DC_FLUSH_2D | RB2D_DC_FREE_2D) 535#define RB2D_DC_FLUSH_ALL (RB2D_DC_FLUSH_2D | RB2D_DC_FREE_2D)
533#define RB2D_DC_BUSY (1 << 31) 536#define RB2D_DC_BUSY (1 << 31)
534 537
538/* DSTCACHE_MODE bits constants */
539#define RB2D_DC_AUTOFLUSH_ENABLE (1 << 8)
540#define RB2D_DC_DC_DISABLE_IGNORE_PE (1 << 17)
535 541
536/* CRTC_GEN_CNTL bit constants */ 542/* CRTC_GEN_CNTL bit constants */
537#define CRTC_DBL_SCAN_EN 0x00000001 543#define CRTC_DBL_SCAN_EN 0x00000001
@@ -863,15 +869,10 @@
863#define GMC_DST_16BPP_YVYU422 0x00000c00 869#define GMC_DST_16BPP_YVYU422 0x00000c00
864#define GMC_DST_32BPP_AYUV444 0x00000e00 870#define GMC_DST_32BPP_AYUV444 0x00000e00
865#define GMC_DST_16BPP_ARGB4444 0x00000f00 871#define GMC_DST_16BPP_ARGB4444 0x00000f00
866#define GMC_SRC_MONO 0x00000000
867#define GMC_SRC_MONO_LBKGD 0x00001000
868#define GMC_SRC_DSTCOLOR 0x00003000
869#define GMC_BYTE_ORDER_MSB_TO_LSB 0x00000000 872#define GMC_BYTE_ORDER_MSB_TO_LSB 0x00000000
870#define GMC_BYTE_ORDER_LSB_TO_MSB 0x00004000 873#define GMC_BYTE_ORDER_LSB_TO_MSB 0x00004000
871#define GMC_DP_CONVERSION_TEMP_9300 0x00008000 874#define GMC_DP_CONVERSION_TEMP_9300 0x00008000
872#define GMC_DP_CONVERSION_TEMP_6500 0x00000000 875#define GMC_DP_CONVERSION_TEMP_6500 0x00000000
873#define GMC_DP_SRC_RECT 0x02000000
874#define GMC_DP_SRC_HOST 0x03000000
875#define GMC_DP_SRC_HOST_BYTEALIGN 0x04000000 876#define GMC_DP_SRC_HOST_BYTEALIGN 0x04000000
876#define GMC_3D_FCN_EN_CLR 0x00000000 877#define GMC_3D_FCN_EN_CLR 0x00000000
877#define GMC_3D_FCN_EN_SET 0x08000000 878#define GMC_3D_FCN_EN_SET 0x08000000
@@ -882,6 +883,9 @@
882#define GMC_WRITE_MASK_LEAVE 0x00000000 883#define GMC_WRITE_MASK_LEAVE 0x00000000
883#define GMC_WRITE_MASK_SET 0x40000000 884#define GMC_WRITE_MASK_SET 0x40000000
884#define GMC_CLR_CMP_CNTL_DIS (1 << 28) 885#define GMC_CLR_CMP_CNTL_DIS (1 << 28)
886#define GMC_SRC_DATATYPE_MASK (3 << 12)
887#define GMC_SRC_DATATYPE_MONO_FG_BG (0 << 12)
888#define GMC_SRC_DATATYPE_MONO_FG_LA (1 << 12)
885#define GMC_SRC_DATATYPE_COLOR (3 << 12) 889#define GMC_SRC_DATATYPE_COLOR (3 << 12)
886#define ROP3_S 0x00cc0000 890#define ROP3_S 0x00cc0000
887#define ROP3_SRCCOPY 0x00cc0000 891#define ROP3_SRCCOPY 0x00cc0000
@@ -890,6 +894,7 @@
890#define DP_SRC_SOURCE_MASK (7 << 24) 894#define DP_SRC_SOURCE_MASK (7 << 24)
891#define GMC_BRUSH_NONE (15 << 4) 895#define GMC_BRUSH_NONE (15 << 4)
892#define DP_SRC_SOURCE_MEMORY (2 << 24) 896#define DP_SRC_SOURCE_MEMORY (2 << 24)
897#define DP_SRC_SOURCE_HOST_DATA (3 << 24)
893#define GMC_BRUSH_SOLIDCOLOR 0x000000d0 898#define GMC_BRUSH_SOLIDCOLOR 0x000000d0
894 899
895/* DP_MIX bit constants */ 900/* DP_MIX bit constants */
@@ -975,6 +980,12 @@
975#define DISP_PWR_MAN_TV_ENABLE_RST (1 << 25) 980#define DISP_PWR_MAN_TV_ENABLE_RST (1 << 25)
976#define DISP_PWR_MAN_AUTO_PWRUP_EN (1 << 26) 981#define DISP_PWR_MAN_AUTO_PWRUP_EN (1 << 26)
977 982
983/* RBBM_GUICNTL constants */
984#define RBBM_GUICNTL_HOST_DATA_SWAP_NONE (0 << 0)
985#define RBBM_GUICNTL_HOST_DATA_SWAP_16BIT (1 << 0)
986#define RBBM_GUICNTL_HOST_DATA_SWAP_32BIT (2 << 0)
987#define RBBM_GUICNTL_HOST_DATA_SWAP_HDW (3 << 0)
988
978/* masks */ 989/* masks */
979 990
980#define CONFIG_MEMSIZE_MASK 0x1f000000 991#define CONFIG_MEMSIZE_MASK 0x1f000000
diff --git a/include/video/s1d13xxxfb.h b/include/video/s1d13xxxfb.h
index c99d261df8f7..fe41b8407946 100644
--- a/include/video/s1d13xxxfb.h
+++ b/include/video/s1d13xxxfb.h
@@ -14,7 +14,8 @@
14#define S1D13XXXFB_H 14#define S1D13XXXFB_H
15 15
16#define S1D_PALETTE_SIZE 256 16#define S1D_PALETTE_SIZE 256
17#define S1D_CHIP_REV 7 /* expected chip revision number for s1d13806 */ 17#define S1D13506_CHIP_REV 4 /* expected chip revision number for s1d13506 */
18#define S1D13806_CHIP_REV 7 /* expected chip revision number for s1d13806 */
18#define S1D_FBID "S1D13806" 19#define S1D_FBID "S1D13806"
19#define S1D_DEVICENAME "s1d13806fb" 20#define S1D_DEVICENAME "s1d13806fb"
20 21